Code

Add block move buttons
[gosa.git] / include / sieve / class_My_Parser.inc
index 6d796cd8ae23d84fe9a22f31a53574ca8d0bbad4..a45d24e83aa2455afb316ad7878c72eea7e82ff9 100644 (file)
@@ -1,6 +1,6 @@
 <?php
 
-
+define("SIEVE_INDENT_TAB","  ");
 
 /* This class is inherited from the original 'Parser'
  *  class written by Heiko Hund
@@ -10,7 +10,38 @@ class My_Parser extends Parser
 
        function execute()
        {
-               return($this->dumpParseTree());
+
+
+               /* Add Element requested */
+               if(isset($_POST['Add_Element'])){
+                       $this->tree_->Add_Element();
+                       echo "Move this into Management";
+               }
+
+               /* 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"');
+                       } else {
+                               header('Content-Disposition: attachment; filename="dump.txt"');
+                       }
+                       header("Content-transfer-encoding: binary\n");
+                       header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
+                       header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT");
+                       header("Cache-Control: no-cache");
+                       header("Pragma: no-cache");
+                       header("Cache-Control: post-check=0, pre-check=0");
+                       echo $this->get_sieve_script(); 
+                       exit(); 
+               }
+       
+               $ret = $this->dumpParseTree();
+               return($ret);
        }
        
 
@@ -35,7 +66,13 @@ class My_Parser extends Parser
         return $this->status_;
        }
 
-               
+       
+       function get_sieve_script()
+       {
+               return($this->tree_->get_sieve_script());
+       }               
+
+       
        function save_object()
        {
                $this->tree_->save_object();