Code

Some changes
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 14 Mar 2007 14:32:39 +0000 (14:32 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 14 Mar 2007 14:32:39 +0000 (14:32 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5784 594d385d-05f5-0310-b6e9-bd551577e9d8

include/sieve/class_My_Parser.inc
include/sieve/class_My_Tree.inc
include/sieve/class_sieveManagement.inc
include/sieve/templates/edit_frame_base.tpl
include/sieve/templates/element_anyof.tpl

index 434a80ff6d7761b010c5adec543d7f64adf99b31..698fbbadf33eebd4fb03ab54ff5346b5c7ce123c 100644 (file)
@@ -12,15 +12,14 @@ class My_Parser extends Parser
        {
                /* Create dump of current sieve script */
                if(isset($_POST['Save_Copy'])){
-                       echo "Move this into Management";
-               
+
                        /* force download dialog */
                        header("Content-type: application/tiff\n");
                        if (preg_match('/MSIE 5.5/', $HTTP_USER_AGENT) ||
                                        preg_match('/MSIE 6.0/', $HTTP_USER_AGENT)) {
-                               header('Content-Disposition: filename="dump.txt"');
+                               header('Content-Disposition: filename="dump.script"');
                        } else {
-                               header('Content-Disposition: attachment; filename="dump.txt"');
+                               header('Content-Disposition: attachment; filename="dump.script"');
                        }
                        header("Content-transfer-encoding: binary\n");
                        header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
@@ -31,7 +30,7 @@ class My_Parser extends Parser
                        echo $this->get_sieve_script(); 
                        exit(); 
                }
-       
+
                $ret = $this->dumpParseTree();
                return($ret);
        }
index c6355d40784d809987b22fe405aa0cc686f4163e..b6e59a5810dfdebed08e9b7c3750867b7cc4ea1e 100644 (file)
@@ -20,6 +20,8 @@ class My_Tree extends Tree
   var $add_new_id       = 0;
   var $add_type         = "top";
   var $add_element_type = "";
+  
+  var $Mode = "Structured";
 
   function execute()
   {
@@ -47,7 +49,6 @@ class My_Tree extends Tree
       }
     }
 
-
     return($this->dump());
   }
 
@@ -173,7 +174,16 @@ class My_Tree extends Tree
     
     /* Create html results */
     $smarty = get_smarty();
-    $smarty->assign("Contents",$this->dump_);
+    $smarty->assign("Mode",$this->Mode);
+    if($this->Mode == "Structured"){
+      $smarty->assign("Contents",$this->dump_);
+    }else{
+      if(isset($_POST['script_contents'])){
+        $smarty->assign("Contents",stripslashes($_POST['script_contents']));
+      }else{
+        $smarty->assign("Contents",$this->get_sieve_script());
+      }
+    }
     $ret = $smarty->fetch(get_template_path("templates/edit_frame_base.tpl",TRUE,dirname(__FILE__)));
     return ($ret);
   }
index c65fdca7446e078ce1440ff55c24790e63ff885c..b1980adb727bcda384821fcdc82326d43416aa9d 100644 (file)
@@ -273,6 +273,28 @@ class sieveManagement extends plugin
 
     /* Create output for currently opened sieve script */
     if($this->current_handler){
+
+      if(isset($_POST['script_contents']) && $this->current_handler->tree_->Mode == "Source"){
+        $script = stripslashes($_POST['script_contents']);
+
+        $new_p = new My_Parser;
+        if($new_p->parse($script)){
+          $this->current_handler->parse($script);
+          $this->current_handler->tree_->Mode = "Source";
+        }else{
+          print_red($new_p->status_text);
+          $this->current_handler->tree_->Mode = "Source";
+        }
+      }
+
+      if(isset($_POST['View_Source'])){
+        $this->current_handler->tree_->Mode = "Source";
+      }
+
+      if(isset($_POST['View_Structured'])){
+        $this->current_handler->tree_->Mode = "Structured";
+      }
+
       $ret = $this->current_handler->execute();
       return($ret);
     }
index d99edbba0560ffc571472073b01a039bdc18e62b..93953fabc401c2de29511621dc717eba85cb8f58 100644 (file)
        </tr>
        <tr>
                <td style='background-color: #FFFFFF; border: solid 2px #CCCCCC; '>
-                       {$Contents}
+
+                       {if $Mode == "Structured"}
+                               {$Contents}
+                       {else}
+                               <textarea name='script_contents' style='width:100%;height:350px;'>{$Contents}</textarea>
+                       {/if}
 
                </td>
        </tr>
index bdef028fc00ca3113002769532f9f5eb21b52440..e0b02054f55f677cbe311d75f65c9a38aaf7ee99 100644 (file)
@@ -6,12 +6,12 @@
                                        background-color: #AAAAAA; 
                                        border: solid 1px #EEEEEE
                                        '>
+                       <b>{t}Any of{/t}</b>
             {if $Inverse}
                 <input type='submit' name='toggle_inverse_{$ID}' value='{t}Not{/t}'>
             {else}
                 <input type='submit' name='toggle_inverse_{$ID}' value='{t}-{/t}'>
             {/if}
-                       <img alt='' class='center' src='images/select_department.png'>
                </td>
         <td style='background-color:#BDBDBD ; border: solid 1px #EEEEEE'>
                        {$Contents}