<?php
$pageRef='Customer care';
include('includes/header.php');
?>
<script>
function successInCreatingAdviceF(result){
var args=result.evalJSON();
$('qResult').style.display='block';
$('qResult').innerHTML=args.opText;
if(parseInt(args.opResult) == 0){
//Success in creating advice
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/advices.php';
}else{
//Failure in creating advice
}
}
//***********************************************
//* This function will be never call. This
//* function during ajax request is called if
//* the request fails. In this case we are
//* simulating ajax request and we can not know
//* if the request is going on or not. Maybe a
//* timeout will make the wrong request
//* detectable.
//* **********************************************
function failureInCreatingAdviceF(){
}
//***********************************************
//* This function is an ajax request simulation.
//* **********************************************
function createAdvice(){
titoloAnnuncio = $F('titoloAnnuncio');
contenutoAnnuncio = $F('contenutoAnnuncio');
if(formValidationRules.validate()){
OL_createAdvice_S(titoloAnnuncio, contenutoAnnuncio, {onSuccess: 'successInCreatingAdviceF', onFailure: 'failureInCreatingAdviceF', formToSubmit: 'myForm', targetElement: 'uploadIframe'})
}else{
alert('<?php echo _T("NI_newAdvice_I"); ?>');
}
}
function backToAdvices(){
window.location.href = 'http://<?php echo $_SERVER['SERVER_ADDR']?>/Oreste/advices.php';
}
</script>
<div id="qResult" class="OpResult"></div>
<form method="POST" enctype="multipart/form-data" name="myForm" id="myForm">
<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:createAdvice();\">" . _T("Save advice") . "</a></li>"; ?>
<?php echo "<li><a href=\"javascript:backToAdvices();\">" . _T("Back to advice management") . "</a></li>"; ?>
</ul>
</div>
</div>
</div>
</div>
<div class="MainColumn">
<!-- *********************************************************** -->
<!-- * Advice 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("New advice") ?></span></span><div class="BlockContentBorder">
<table width="100%">
<tr valign="top"><td style="width: 5%;"><b><?php echo _T("Title") ?></b></td> <td><input class="required" title="<?php echo _T("NI_newAdvice_II") ?>" type="text" id="titoloAnnuncio" name="titoloAnnuncio" style="width:95%;"> </td> </tr>
<tr valign="top"><td style="width: 5%;"><b><?php echo _T("Image") ?></b></td> <td><input class="required" title="<?php echo _T("NI_newAdvice_III") ?>" type="file" id="pathImgAnnuncio" name="pathImgAnnuncio" style="width:95%;"> </td> </tr>
<tr valign="top"><td style="width: 5%;"><b><?php echo _T("Content") ?></b></td> <td><textarea class="required" title="<?php echo _T("NI_newAdvice_IV") ?>" id="contenutoAnnuncio" name="contenutoAnnuncio" style="width:95%;" rows="20"></textarea> </td> </tr>
</table>
</div>
</div>
</div>
</div>
</div>
<iframe style="display:none;" id="uploadIframe" name="uploadIframe" src="#"></iframe>
</form>
<script>
// ************************************************************
// * Observe window load event to call the init page function *
// ************************************************************
Event.observe(window, 'load', function(){
// **************************
// * Install event handlers *
// **************************
Event.observe('qResult', 'mouseover', function(){OL_makeThisElementInvisible('qResult');});
// *********************
// * Install validator *
// *********************
formValidationRules = new Validation('myForm',{immediate:true, onSubmit:false, useTitles:true, stopOnFirst:false});
});
</script>
<!-- tags opened in the header -->
</div>
</div>
</div>
</body>
</html>