From 50a60f72ec5252a2c555bebe9329e57cd27452a4 Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 29 Mar 2007 09:39:45 +0000 Subject: [PATCH] Updated some error msgs for sieve management git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5925 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/sieve/class_sieveElement_If.inc | 10 ++++++++-- include/sieve/class_sieveElement_Reject.inc | 8 +++++++- include/sieve/class_sieveManagement.inc | 4 +++- include/sieve/templates/element_reject.tpl | 10 ++++++++++ 4 files changed, 28 insertions(+), 4 deletions(-) diff --git a/include/sieve/class_sieveElement_If.inc b/include/sieve/class_sieveElement_If.inc index 9de56b29a..686d45722 100644 --- a/include/sieve/class_sieveElement_If.inc +++ b/include/sieve/class_sieveElement_If.inc @@ -98,6 +98,10 @@ class sieve_if $parsed = $this->_parsed; } + if($parsed == NULL) { + return(array(_("Can't save empty tests."))); + } + /* Walk through all elements */ foreach($parsed as $key => $data){ @@ -525,7 +529,9 @@ class sieve_if $parsed = $this->_parsed; } - if(!is_array($parsed)) return; + if(!is_array($parsed)) { + return; + } /* Walk through all elements */ foreach($parsed as $key => $data){ @@ -1129,7 +1135,7 @@ class sieve_if $smarty->assign("DisplayAdd",TRUE); $smarty->assign("DisplayDel",FALSE); $cont_tmp = $smarty->fetch(get_template_path("templates/object_test_container.tpl",TRUE,dirname(__FILE__))); - $cont_tmp = preg_replace("/%%OBJECT_CONTENT%%/",_("Click here to add a new test"),$cont_tmp); + $cont_tmp = preg_replace("/%%OBJECT_CONTENT%%/",""._("Click here to add a new test")."",$cont_tmp); $smarty->assign("Inverse",$Inverse); $smarty->assign("Contents",$cont_tmp.$Contents); diff --git a/include/sieve/class_sieveElement_Reject.inc b/include/sieve/class_sieveElement_Reject.inc index 398f6ed36..baa100449 100644 --- a/include/sieve/class_sieveElement_Reject.inc +++ b/include/sieve/class_sieveElement_Reject.inc @@ -16,7 +16,11 @@ class sieve_reject function check() { - return(array()); + $msgs = array(); + if(preg_match("/\"/",$this->data)){ + $msgs [] = _("Invalid character found, quotes are not allowed in a reject message."); + } + return($msgs); } function sieve_reject($data,$object_id,$parent) @@ -60,6 +64,8 @@ class sieve_reject $smarty->assign("ID", $this->object_id); $smarty->assign("Message",$this->data); $smarty->assign("Multiline",$Multiline); + $smarty->assign("LastError" , $this->check()); + $smarty->assign("LastErrorCnt" , count($this->check())); $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__))); $object= $smarty->fetch(get_template_path("templates/element_reject.tpl",TRUE,dirname(__FILE__))); $str = preg_replace("/%%OBJECT_CONTENT%%/",addcslashes($object,"\\"),$object_container); diff --git a/include/sieve/class_sieveManagement.inc b/include/sieve/class_sieveManagement.inc index 15606ce3d..cde2d8540 100644 --- a/include/sieve/class_sieveManagement.inc +++ b/include/sieve/class_sieveManagement.inc @@ -399,7 +399,9 @@ class sieveManagement extends plugin print_red($p->status_text);; } }else{ - print_red(_("Please fix all errors before saving.")); + foreach($chk as $msgs){ + print_red(sprintf(_("Please fix all errors before saving. Last error was : %s"),$msgs)); + } } } diff --git a/include/sieve/templates/element_reject.tpl b/include/sieve/templates/element_reject.tpl index 60163c2f9..c9de8b50e 100644 --- a/include/sieve/templates/element_reject.tpl +++ b/include/sieve/templates/element_reject.tpl @@ -1,4 +1,14 @@ + +{foreach from=$LastError item=val key=key} + + + + + {/foreach}
+
{$LastError[$key]}
+ +
{t}Reject mail{/t} -- 2.30.2