summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 97be73e)
raw | patch | inline | side by side (parent: 97be73e)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 6 Sep 2010 14:16:06 +0000 (14:16 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 6 Sep 2010 14:16:06 +0000 (14:16 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19533 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/groupware/personal/groupware/class_filterEditor.inc | patch | blob | history |
diff --git a/gosa-plugins/groupware/personal/groupware/class_filterEditor.inc b/gosa-plugins/groupware/personal/groupware/class_filterEditor.inc
index 832f3e9a5f996ee4cb025c8174f313f7119fd7c2..5522daa50600ec6f8e6f28ce68514cc4b26f7ff7 100644 (file)
$this->config = &$config;
$this->parent = &$parent;
$this->filter = $filter;
- }
-
- function execute()
- {
- $smarty = get_smarty();
- $smarty->assign('NAME',set_post($this->filter['NAME']));
- $smarty->assign('DESC',set_post($this->filter['DESC']));
- $smarty->assign('filterStr', $this->renderFilter());
-
- return($smarty->fetch(get_template_path('filterEditor.tpl',TRUE,dirname(__FILE__))));
- }
-
- function renderFilter()
- {
- $filter = $this->filter;
- $actions = array(
+ $this->types = array('OR' => _("or"), 'AND' => _("and"));
+ $this->actions = array(
"MOVE" => _("move mail to"),
"COPY" => _("copy mail to"),
"FORWARD" => _("forward message to"),
"DROP" => _("remove mail"),
"REPLY" => _("reply"));
- $fields = array(
+ $this->fields = array(
'subject' => _("Subject"),
'from'=> _("From"),
'body'=> _("Body"),
'age'=> _("Age"),
'size'=> _("Size"));
- $comparators = array(
+ $this->comparators = array(
"is" => _("is"),
"is not" => _("is not"),
"equal" => _("is equal"),
"is not in addressbook" => _("is not in the addressbook"),
"greater than" => _("is greater than"),
"less than" => _("smaller than"));
+ }
-
+ function execute()
+ {
+ $smarty = get_smarty();
+ $smarty->assign('NAME',set_post($this->filter['NAME']));
+ $smarty->assign('DESC',set_post($this->filter['DESC']));
+ $smarty->assign('filterStr', $this->renderFilter());
+
+ return($smarty->fetch(get_template_path('filterEditor.tpl',TRUE,dirname(__FILE__))));
+ }
+
+ function renderFilter()
+ {
+ $filter = $this->filter;
$cnt = count($filter['CONDITIONS']);
$str = "<h3>"._("Filter conditions")."</h3>";
$str .= "<li>";
$str .= _("Check field")." ";
$str .= "\n<select name='cField_{$id}' onChange='document.mainform.submit();'>";
- foreach($fields as $field => $desc){
+ foreach($this->fields as $field => $desc){
$checked = ($field == $cond['FIELD'])? ' selected ' : '';
$str.= "\n<option {$checked} value=\"".set_post($field)."\">".set_post($desc)."</option>";
}
$str .= "\n</select>";
$str .= " "._("if it")." ";
$str .= "\n<select name='cComparator_{$id}' onChange='document.mainform.submit();'>";
- foreach($comparators as $comparator => $desc){
+ foreach($this->comparators as $comparator => $desc){
$checked = ($comparator == $cond['COMPARATOR'])? ' selected ' : '';
$str.= "\n<option {$checked} value=\"".set_post($comparator)."\">".set_post($desc)."</option>";
}
}
$cnt --;
$str .= "</li>";
- if($cnt) $str .= $filter['TYPE'];
+ if($cnt) $str .= $this->types[$filter['TYPE']];
}
$str .= "</ul>";
+ $str .= "<button name='addCondition'>".msgPool::addButton()."</button> ";
+ if(count($filter['CONDITIONS']) >= 2){
+ $str .= "<button name='removeCondition'>".msgPool::delButton()."</button> ";
+ }
$str .= "<hr>";
$str .= "<h3>"._("Filter actions")."</h3>";
foreach($filter['ACTION'] as $id => $action){
$str .= "<li>";
$str .= "\n<select name='cAction_{$id}' onChange='document.mainform.submit();'>";
- foreach($actions as $act => $desc){
+ foreach($this->actions as $act => $desc){
$checked = ($act == $action['ACTION'])? ' selected ' : '';
$str.= "\n<option {$checked} value=\"".set_post($act)."\">".set_post($desc)."</option>";
}
}
$str.= "</ul>";
+ $str .= "<button name='addAction'>".msgPool::addButton()."</button> ";
+ if(count($filter['ACTION']) >= 2){
+ $str .= "<button name='removeAction'>".msgPool::delButton()."</button> ";
+ }
return($str);
}
$this->filter['ACTION'][$id]['VALUE'] = get_post('cValue_'.$id);
}
}
+
+ if(isset($_POST['removeCondition']) && count($this->filter['CONDITIONS']) >= 2){
+ array_pop($this->filter['CONDITIONS']);
+ }
+
+ if(isset($_POST['addCondition'])){
+ $this->filter['CONDITIONS'][] = array('FIELD' => key($this->fields),'COMPARATOR' => key($this->comparators), 'MATCH' => '');
+ }
+
+ if(isset($_POST['removeAction']) && count($this->filter['ACTION']) >= 2){
+ array_pop($this->filter['ACTION']);
+ }
+
+ if(isset($_POST['addAction'])){
+ $this->filter['ACTION'][] = array('ACTION' => 'MOVE', 'VALUE' => '');
+ }
}
}
?>