<?php
$pageRef='Customer care';
include('includes/header.php');
?>
<script>
function toCustomerCare(){
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/customerCare.php';
}
function createNewAdvice(){
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/newAdvice.php';
}
function setAdviceEventHandlers(){
setTimeout("$$('a.aAdviceModify').each(function(s){Event.observe(s,'click',function(){modifyAdvice(s);})})", 1);
setTimeout("$$('a.aAdviceDelete').each(function(s){Event.observe(s,'click',function(){deleteAdvice(s);})})", 1);
}
function successInDeletingAdviceF(transport){
var args=transport.responseText.evalJSON();
//Success in delete request
//Operation result advice
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
//Success in delete operation
OL_advicesTableLoad('w', {elementToFill: 'advicesTable', onSuccess: setAdviceEventHandlers});
}else{
//Failure in delete operation
}
}
function failureInDeletingAdviceF(){
//Failure in delete request
alert('<?php echo _T("NI_advices_II"); ?>');
}
function deleteAdvice(elem){
var args = elem.name.split("_");
var advID = args[0];
var advTitle = args[1];
// ***************************************************************************************************************************************************
// * Confirm sentence: 'Eliminare annuncio \"'+advTitle+'\"?\n\nNOTA: il testo andrÓ perso'
// ***************************************************************************************************************************************************
answer = confirm('<?php echo _T("NI_advices_I"); ?>');
if(answer != 0){
OL_deleteAdvice(advID, {onSuccess: successInDeletingAdviceF, onFailure: failureInDeletingAdviceF});
}else{
}
}
function modifyAdvice(elem){
var args = elem.name.split("_");
var advID = args[0];
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/viewAdviceDetailed.php?advID='+advID;
}
</script>
<div id="qResult" class="OpResult"></div>
<div class="Columns">
<div class="Column1">
<!-- *********************************************************** -->
<!-- * Menu tab * -->
<!-- *********************************************************** -->
<div class="Block"><div class="BlockBL"><div></div></div><div class="BlockBR"><div></div></div><div class="BlockTL"></div><div class="BlockTR"><div></div></div><div class="BlockT"></div><div class="BlockR"><div></div></div><div class="BlockB"><div></div></div><div class="BlockL"></div><div class="BlockC"></div><div class="BlockContent"><span class="BlockHeader"><span><?php echo _T("Actions"); ?></span></span><div class="BlockContentBorder">
<ul>
<?php echo "<li><a href=\"javascript:createNewAdvice();\">" . _T("New advice") . "</a></li>"; ?>
<?php echo "<li><a href=\"javascript:toCustomerCare();\">" . _T("Back to customer care") . "</a></li>"; ?>
</ul>
</div>
</div>
</div>
</div>
<div class="MainColumn" id="advicesTable">
<!-- *********************************************************** -->
<!-- * Advices table * -->
<!-- *********************************************************** -->
</div>
</div>
<script>
// ************************************************************
// * Observe window load event to call the init page function *
// ************************************************************
Event.observe(window, 'load', function(){
// *****************************************
// * Load advices table for the first time *
// *****************************************
OL_advicesTableLoad('w', {elementToFill: 'advicesTable', onSuccess: setAdviceEventHandlers});
// **************************
// * Install event handlers *
// **************************
Event.observe('qResult', 'mouseover', function(){OL_makeThisElementInvisible('qResult');});
// *********************
// * Install validator *
// *********************
// formValidationRules = new Validation('formToValidate',{immediate:true, onSubmit:false, useTitles:true, stopOnFirst:false});
});
</script>
</div>
</div>
</div>
</body>
</html>