summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4e1b954)
raw | patch | inline | side by side (parent: 4e1b954)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 16 Mar 2007 13:19:05 +0000 (13:19 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 16 Mar 2007 13:19:05 +0000 (13:19 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5802 594d385d-05f5-0310-b6e9-bd551577e9d8
index 0d718b2e517746c7cd7e9c94868d815887e09fb3..f38f3bab81eb608f548871ba84a78b5674dc6fbb 100644 (file)
function remove_object($key_id)
{
$class = get_class($this->pap[$key_id]);
- if(in_array($class,array("sieve_if"))){
+ if(in_array($class,array("sieve_if","sieve_elsif","sieve_else"))){
$block_start= $key_id;
$block_end = $this->get_block_end($key_id);
+
for($i = $block_start ; $i <= $block_end ; $i ++ ){
unset($this->pap[$i]);
}
/* Only execute if this is a really a block element.
* Block elements is only sieve_if
*/
- if(in_array(get_class($this->pap[$start]),array("sieve_if"))){
+ if(in_array(get_class($this->pap[$start]),array("sieve_if","sieve_elsif","sieve_else"))){
$class = get_class($this->pap[$start]);
$next_class = get_class($this->pap[$start+1]);
}
$start ++;
$class = get_class($this->pap[$start]);
- $next_class = get_class($this->pap[$start+1]);
+
+ if(isset($this->pap[$start+1])){
+ $next_class = get_class($this->pap[$start+1]);
+ }else{
+ $next_class ="";
+ }
}
}
return($start);
index 1e4f6829f73e71e83093dbf245f9333e9b3b63d6..26bf54c42159e61c218cea3c1fde27a047ab867a 100644 (file)
*/
function get_sieve_script_part()
{
- $tmp = "if ".$this->get_sieve_script_part_recursive($parsed = NULL,$id = 1,$obj_id=1);
+ $tmp = $this->TYPE." ".$this->get_sieve_script_part_recursive($parsed = NULL,$id = 1,$obj_id=1);
return($tmp);
}
$name .= "<b>"._("Condition")."</b>";
if($this->TYPE == "if"){
$name .= " - "._("If");
+ }elseif($this->TYPE == "elsif"){
+ $name .= " - "._("Else if");
}else{
$name .= " - "._("Else");
}
index 9bb2570b701c0589e630e2d0e63cff76794c6224..d25cdfa2eaa1634925890663888e1e2c1f41065f 100644 (file)
/* Element selected */
- if(isset($_POST['element_type']) && isset($element_types[$_POST['element_type']])){
+ if(isset($_POST['element_type']) && isset($element_types[$_POST['element_type']])
+ || isset($_POST['element_type']) &&in_array($_POST['element_type'],array("sieve_else","sieve_elsif"))){
$this->add_element_type = $_POST['element_type'];
}
}
/* Create elements we should add */
- $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()));
if($this->add_element_type == "sieve_if"){
+ $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()));
$ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()));
$ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()));
+ }elseif($this->add_element_type == "sieve_else"){
+ $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()));
+ $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()));
+ $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()));
+ }elseif($this->add_element_type == "sieve_elsif"){
+ $ele[] = new sieve_block_end(NULL,preg_replace("/[^0-9]/","",microtime()));
+ $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()));
+ $ele[] = new sieve_block_start(NULL,preg_replace("/[^0-9]/","",microtime()));
+ }else{
+ $ele[] = new $this->add_element_type(NULL, preg_replace("/[^0-9]/","",microtime()));
}
+
$start = $end = array();
$found = false;
/* Only display select dialog if it is necessary */
if($this->add_new_element){
$smarty = get_smarty();
+
+ $add_else_elsif = FALSE;
+ foreach($this->current_handler->tree_->pap as $obj){
+ if($obj->object_id == $this->add_new_id && in_array(get_class($obj),array("sieve_if","sieve_elsif"))){
+ $add_else_elsif = TRUE;
+ }
+ }
+
+ if($add_else_elsif){
+ $element_types['sieve_else'] = _("Else");
+ $element_types['sieve_elsif'] = _("Else if");
+ }
+
$smarty->assign("element_types",$element_types );
$smarty->assign("element_type",$this->add_element_type);
$str = $smarty->fetch(get_template_path("templates/add_element.tpl",TRUE,dirname(__FILE__)));
diff --git a/include/sieve/templates/object_container_clear.tpl b/include/sieve/templates/object_container_clear.tpl
index 4791fa8c6797a3bebc296b1db9063061971a70e1..aefc8b10a10ae7489abfd707e611da300f1b3843 100644 (file)
<table cellspacing=0 style='width:100%;background-color:#EEEEEE;border: solid 1px #BBB;346575;'>
<tr>
<td style='width:20px; background-color: #235464;'>
+ <input type='image' src='images/sieve_del_object.png' name='Remove_Object_{$ID}'
+ title='{t}Remove this object{/t}' alt='R'>
</td>
<td>
%%OBJECT_CONTENT%%