Code

Updated some error msgs for sieve management
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Mar 2007 09:39:45 +0000 (09:39 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 29 Mar 2007 09:39:45 +0000 (09:39 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5925 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_sieveElement_If.inc
include/sieve/class_sieveElement_Reject.inc
include/sieve/class_sieveManagement.inc
include/sieve/templates/element_reject.tpl

index 9de56b29ad0ceeeb3106c52e0f938d2562254134..686d457221eca9b87ee3e7875d8c89d89fef64e0 100644 (file)
@@ -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%%/","<b>"._("Click here to add a new test")."</b>",$cont_tmp);
 
           $smarty->assign("Inverse",$Inverse);
           $smarty->assign("Contents",$cont_tmp.$Contents);
index 398f6ed3644c511f295ca5096c8e4f42e6853ece..baa100449d292fe32620f784a2d7ed2990a76a88 100644 (file)
@@ -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);
index 15606ce3d955dfcc764b9931425fb8e38af2d6b6..cde2d8540861c61a2322b8722dca02fda503adda 100644 (file)
@@ -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));
+        }
       }
     }
 
index 60163c2f9b68c7423b5b86d511238c2664a07ede..c9de8b50e19c583a6fdc027d98516c506bd4050d 100644 (file)
@@ -1,4 +1,14 @@
 <table class='sieve_reject_container'>
+
+{foreach from=$LastError item=val key=key}
+        <tr>
+            <td colspan=4>
+                <div class='sieve_error_msgs'>{$LastError[$key]}</div>
+
+            </td>
+        </tr>
+
+    {/foreach}
        <tr>
                <td>
                        <b>{t}Reject mail{/t}</b>