From 82d25cd720d3cc9f37cb4fb4ae1be18a9cd6d0cc Mon Sep 17 00:00:00 2001 From: hickert Date: Thu, 8 Mar 2007 14:47:07 +0000 Subject: [PATCH] Added edit frame git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5760 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/sieve/class_My_Parser.inc | 30 +++++++++++++++++++++ include/sieve/class_My_Tree.inc | 20 +++++++++++--- include/sieve/templates/edit_frame_base.tpl | 21 +++++++++++++++ 3 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 include/sieve/templates/edit_frame_base.tpl diff --git a/include/sieve/class_My_Parser.inc b/include/sieve/class_My_Parser.inc index b0ef7ea76..a45d24e83 100644 --- a/include/sieve/class_My_Parser.inc +++ b/include/sieve/class_My_Parser.inc @@ -10,6 +10,36 @@ class My_Parser extends Parser function execute() { + + + /* 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); } diff --git a/include/sieve/class_My_Tree.inc b/include/sieve/class_My_Tree.inc index 9499fd641..a2b169545 100644 --- a/include/sieve/class_My_Tree.inc +++ b/include/sieve/class_My_Tree.inc @@ -32,14 +32,22 @@ class My_Tree extends Tree } /* Create html results */ - $this->dump_ ="
"; + $smarty = get_smarty(); + $smarty->fetch(get_template_path("templates/element_stop.tpl",TRUE,dirname(__FILE__))); + + $this -> dump_ = ""; foreach($this->pap as $key => $object){ if(is_object($object)){ $this->dump_ .= preg_replace("/>/",">\n",$object->execute()); } } - $this->dump_ .= "
"; - return $this->dump_; + + + /* Create html results */ + $smarty = get_smarty(); + $smarty->assign("Contents",$this->dump_); + $ret = $smarty->fetch(get_template_path("templates/edit_frame_base.tpl",TRUE,dirname(__FILE__))); + return ($ret); } @@ -177,6 +185,12 @@ class My_Tree extends Tree } return($tmp); } + + function Add_Element() + { + $tmp = array("ELEMENTS" => array(array("class" => "qouted-string","text"=> "Bla bla, later more"))); + $this->pap[] = new sieve_comment($tmp,rand(1000,100000)); + } } diff --git a/include/sieve/templates/edit_frame_base.tpl b/include/sieve/templates/edit_frame_base.tpl new file mode 100644 index 000000000..9de761cfb --- /dev/null +++ b/include/sieve/templates/edit_frame_base.tpl @@ -0,0 +1,21 @@ + + + + + + + + +
+ + + + + + + + +
+ {$Contents} + +
-- 2.30.2