Cambiata gui exception per estendere MultiMessageException Implementata logging degli accessi all'applicazione Modificato loginmanager per loggare gli accessi Creata classe d'appoggio per generare il testo delle email Creato stile di base per le form dell'amministrazione Bugfix e migliorie grafiche
95 lines
2.5 KiB
PHP
95 lines
2.5 KiB
PHP
<?php
|
|
/*
|
|
Author: Riccardo Di Dato
|
|
Creation Date: 25/gen/2016
|
|
*/
|
|
|
|
require_once(dirname(__FILE__)."/../load.php");
|
|
|
|
GUIHandler::generateHtmlHeaders(array(),true);
|
|
|
|
if (!AdminLoginManager::isLogged()){
|
|
GUIHandler::redirect("admin/login.php");
|
|
}
|
|
else if (!AdminLoginManager::getLogged()->hasRole(AdminModel::ADMIN_TYPE_SUPERADMIN)){
|
|
GUIHandler::redirect("admin/index.php");
|
|
}
|
|
|
|
MenuGenerator::generateMenu();
|
|
|
|
HTMLHelper::generateAdminHead();
|
|
|
|
|
|
$id = PostHandler::get("id");
|
|
|
|
$tmp = new stdClass();
|
|
$tmp->from = "";
|
|
$tmp->recipient = "";
|
|
$tmp->subject = "";
|
|
$tmp->body = "";
|
|
$mail = new MailModel($tmp);
|
|
|
|
|
|
if (!is_null($id) && strcmp("", $id)!=0){
|
|
$mail = GlobalVariables::get("dao")->getFirst("MailModel",array("id"=>$id));
|
|
if (is_null($mail)){
|
|
GUIHandler::redirect("admin/listMail.php");
|
|
}
|
|
}
|
|
|
|
$action = PostHandler::get("action");
|
|
if (!is_null($action) && strcmp("", $action)!=0){
|
|
if (strcmp("cancel", $action)==0){
|
|
GUIHandler::redirect("admin/listMail.php");
|
|
}
|
|
else if (strcmp("save", $action)==0){
|
|
$mail->from = PostHandler::get("from");
|
|
$mail->recipient = PostHandler::get("recipient");
|
|
$mail->subject = PostHandler::get("subject");
|
|
$mail->body = PostHandler::get("body");
|
|
GlobalVariables::get("dao")->save($mail);
|
|
GUIHandler::redirect("admin/listMail.php");
|
|
}
|
|
}
|
|
|
|
?>
|
|
<div>
|
|
<form id="mailForm" method="POST" action="">
|
|
<input type="hidden" name="action" value="" />
|
|
<input type="hidden" name="id" value="<?php echo $id;?>" />
|
|
|
|
<div>
|
|
<span class="label">From</span>
|
|
<input type="text" name="from" value="<?php echo $mail->from; ?>" />
|
|
</div>
|
|
<div>
|
|
<span class="label">To</span>
|
|
<input type="text" name="recipient" value="<?php echo $mail->recipient; ?>" />
|
|
</div>
|
|
<div>
|
|
<span class="label">Subject</span>
|
|
<input type="text" name="subject" value="<?php echo $mail->subject; ?>" />
|
|
</div>
|
|
<div>
|
|
<span class="label">Body</span>
|
|
<textarea name="body" id="body_editor" rows="10" cols="80"><?php echo $mail->body;?></textarea>
|
|
</div>
|
|
</form>
|
|
<div class="formBtns">
|
|
<a href="#" id="mailForm_salva" >Salva</a>
|
|
<a href="#" id="mailForm_annulla">Annulla</a>
|
|
</div>
|
|
</div>
|
|
<script type="text/javascript">
|
|
$(document).ready(function(event){
|
|
CKEDITOR.replace('body_editor');
|
|
$("#mailForm_salva").click(function(event){
|
|
$("form#mailForm input[type=hidden][name=action]").val("save");
|
|
$("form#mailForm").submit();
|
|
});
|
|
$("#mailForm_annulla").click(function(event){
|
|
$("form#mailForm input[type=hidden][name=action]").val("cancel");
|
|
$("form#mailForm").submit();
|
|
});
|
|
});
|
|
</script>
|