X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=branches%2Fold%2Fgosa-plugins%2Fmail%2Fpersonal%2Fmail%2Fsieve%2Fclass_sieveElement_Comment.inc;fp=branches%2Fold%2Fgosa-plugins%2Fmail%2Fpersonal%2Fmail%2Fsieve%2Fclass_sieveElement_Comment.inc;h=deaa4f3120ba68ca16e18555117fdbb33c32b929;hb=cff5b6e974405f455a90de3a3fc6cc7b084ffe10;hp=0000000000000000000000000000000000000000;hpb=2ad05dfc09e8a07d6e6886604458f475c9c8f2f8;p=gosa.git diff --git a/branches/old/gosa-plugins/mail/personal/mail/sieve/class_sieveElement_Comment.inc b/branches/old/gosa-plugins/mail/personal/mail/sieve/class_sieveElement_Comment.inc new file mode 100644 index 000000000..deaa4f312 --- /dev/null +++ b/branches/old/gosa-plugins/mail/personal/mail/sieve/class_sieveElement_Comment.inc @@ -0,0 +1,84 @@ +data."*/"; + return($str); + } + + function sieve_comment($data,$object_id) + { + $this->object_id = $object_id; + + if($data === NULL){ + $data = array('ELEMENTS' => array(array('class' => "quoted-string" ,"text" => "/*"._("Your comment here")."*/"))); + } + + foreach($data['ELEMENTS'] as $node){ + + $text = $node['text']; + + /* Convert \t to spaces */ + $text = preg_replace("#\t#"," ",$text); + + /* Remove comment indicator '#' but keep spaces */ + $text = preg_replace("/^([ ]*)\#/","\\1",$text); + + /* Remove comment indicator '/ *' */ + $text = preg_replace("#\/\*#","",$text); + + /* Remove comment indicator '* /' */ + $text = preg_replace("#\*\/#","",$text); + + $this->data .= $text."\n"; + } + $this->data = rtrim($this->data)."\n"; + } + + function check() + { + return(array()) ; + } + + function save_object() + { + if(isset($_POST['comment_'.$this->object_id])){ + $cm = stripslashes( $_POST['comment_'.$this->object_id]); + $cm = preg_replace("/\*\//","* /",$cm); + $this->data = $cm; + } + + if(isset($_POST['toggle_small_'.$this->object_id])){ + $this->small = !$this->small; + } + } + + function execute() + { + $smarty = get_smarty(); + $smarty->assign("ID", $this->object_id); + $smarty->assign("Small", $this->small); + $object_container = $smarty->fetch(get_template_path("templates/object_container.tpl",TRUE,dirname(__FILE__))); + $Comment = $this->data; + + if($this->small){ + $Comment = nl2br(preg_replace("/ /"," ",$Comment)); + } + + /* Create html object */ + $smarty->assign("Comment",$Comment); + $smarty->assign("ID",$this->object_id); + $object = $smarty->fetch(get_template_path("templates/element_comment.tpl",TRUE,dirname(__FILE__))); + $str = preg_replace("/%%OBJECT_CONTENT%%/",addcslashes($object,"\\"),$object_container); + return($str); + } +} +// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: +?>