From: Nik Okuntseff Date: Tue, 22 Mar 2016 20:04:46 +0000 (-0700) Subject: Some refactoring X-Git-Tag: timetracker_1.19-1~1789 X-Git-Url: http://wagnertech.de/git?a=commitdiff_plain;h=7fafd0cdc53c376b557a5504af53dacdfbcdb533;p=timetracker.git Some refactoring --- diff --git a/WEB-INF/templates/header.tpl b/WEB-INF/templates/header.tpl index 2e058ef5..3affffc1 100644 --- a/WEB-INF/templates/header.tpl +++ b/WEB-INF/templates/header.tpl @@ -160,11 +160,11 @@ With 101% height we essentially force the scrollbar to always appear. --> -{if $errors->yes()} +{if $err->yes()} @@ -174,11 +174,11 @@ With 101% height we essentially force the scrollbar to always appear. --> -{if $messages->yes()} +{if $msg->yes()}
- {foreach $errors->getErrors() as $error} + {foreach $err->getErrors() as $error} {$error.message}
{* No need to escape as they are not coming from user and may contain a link. *} {/foreach}
diff --git a/WEB-INF/templates/mobile/header.tpl b/WEB-INF/templates/mobile/header.tpl index b09f0da6..03bfa18f 100644 --- a/WEB-INF/templates/mobile/header.tpl +++ b/WEB-INF/templates/mobile/header.tpl @@ -55,11 +55,11 @@ -{if $errors->yes()} +{if $err->yes()}
- {foreach $messages->getErrors() as $message} + {foreach $msg->getErrors() as $message} {$message.message}
{* No need to escape. *} {/foreach}
@@ -69,11 +69,11 @@ -{if $messages->yes()} +{if $msg->yes()}
- {foreach $errors->getErrors() as $error} + {foreach $err->getErrors() as $error} {$error.message}
{* No need to escape as they are not coming from user and may contain a link. *} {/foreach}
diff --git a/import.php b/import.php index d86628b6..23715e08 100644 --- a/import.php +++ b/import.php @@ -45,8 +45,7 @@ if ($request->isPost()) { $import = new ttImportHelper($err); $import->importXml(); - if ($err->no()) - $messages->add($i18n->getKey('form.import.success')); + if ($err->no()) $msg->add($i18n->getKey('form.import.success')); } // isPost $smarty->assign('forms', array($form->getName()=>$form->toArray()) ); diff --git a/initialize.php b/initialize.php index 2cb0f5be..ded539cc 100644 --- a/initialize.php +++ b/initialize.php @@ -152,8 +152,8 @@ import('html.HttpRequest'); $request = new ttHttpRequest(); import('form.ActionErrors'); -$err = new ActionErrors(); -$messages = new ActionErrors(); +$err = new ActionErrors(); // Error messages for user. +$msg = new ActionErrors(); // Notification messages (not errrors) for user. // Create an instance of ttUser class. This gets us most of user details. import('ttUser'); @@ -193,8 +193,8 @@ $GLOBALS['USER'] = &$user; // Assign things for smarty to use in template files. $smarty->assign('i18n', $i18n->keys); -$smarty->assign('errors', $err); -$smarty->assign('messages', $messages); +$smarty->assign('err', $err); +$smarty->assign('msg', $msg); // TODO: move this code out of here to the files that use it. diff --git a/invoice_send.php b/invoice_send.php index 4ec28bcf..e519132d 100644 --- a/invoice_send.php +++ b/invoice_send.php @@ -88,7 +88,7 @@ if ($request->isPost()) { $mailer->setReceiverCC($cl_cc); $mailer->setSendType(MAIL_MODE); if ($mailer->send($cl_subject, $body)) - $messages->add($i18n->getKey('form.mail.invoice_sent')); + $msg->add($i18n->getKey('form.mail.invoice_sent')); else $err->add($i18n->getKey('error.mail_send')); } diff --git a/mobile/time_edit.php b/mobile/time_edit.php index 46c89d92..8b172e84 100644 --- a/mobile/time_edit.php +++ b/mobile/time_edit.php @@ -98,7 +98,7 @@ if ($request->isPost()) { if (($cl_start == $cl_finish) && ($cl_duration == '0:00')) { $cl_finish = ''; $cl_duration = ''; - $messages->add($i18n->getKey('form.time_edit.uncompleted')); + $msg->add($i18n->getKey('form.time_edit.uncompleted')); } } diff --git a/report_send.php b/report_send.php index 49032455..e11978aa 100644 --- a/report_send.php +++ b/report_send.php @@ -85,7 +85,7 @@ if ($request->isPost()) { $mailer->setReceiverCC($cl_cc); $mailer->setSendType(MAIL_MODE); if ($mailer->send($cl_subject, $body)) - $messages->add($i18n->getKey('form.mail.report_sent')); + $msg->add($i18n->getKey('form.mail.report_sent')); else $err->add($i18n->getKey('error.mail_send')); } diff --git a/time_edit.php b/time_edit.php index 2dca2447..b3756b44 100644 --- a/time_edit.php +++ b/time_edit.php @@ -98,7 +98,7 @@ if ($request->isPost()) { if (($cl_start == $cl_finish) && ($cl_duration == '0:00')) { $cl_finish = ''; $cl_duration = ''; - $messages->add($i18n->getKey('form.time_edit.uncompleted')); + $msg->add($i18n->getKey('form.time_edit.uncompleted')); } }
- {foreach $messages->getErrors() as $message} + {foreach $msg->getErrors() as $message} {$message.message}
{* No need to escape. *} {/foreach}