From: hickert Date: Tue, 7 Sep 2010 08:15:48 +0000 (+0000) Subject: Allow to add new filters X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=47a0e3651aca254b950090495cc058cef70b4e3d;p=gosa.git Allow to add new filters git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19538 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-plugins/groupware/personal/groupware/class_filterManager.inc b/gosa-plugins/groupware/personal/groupware/class_filterManager.inc index c1a64dc82..bc3132708 100644 --- a/gosa-plugins/groupware/personal/groupware/class_filterManager.inc +++ b/gosa-plugins/groupware/personal/groupware/class_filterManager.inc @@ -23,48 +23,6 @@ class filterManager extends plugin{ $this->filter = array(); - $this->filter[] = array ( - 'STATUS' => 'EXISTS', - 'TYPE' => 'AND', - 'NAME' => 'MuellRaus', - 'DESC' => 'Spam loeschen', - 'CONDITIONS' => array ( - array('FIELD' => 'from', - 'COMPARATOR' => 'equals', - 'MATCH' => 'herbert'), - array('FIELD' => 'subject', - 'COMPARATOR' => 'contains', - 'MATCH' => 'advertising'), - ), - 'ACTION' => array ( - array('ACTION'=>'MARK', - 'VALUE' => 'SPAM'), - array('ACTION'=>'MOVE', - 'VALUE' => 'gosa+shared/hickert/trash') - ) - ); - - $this->filter[] = array ( - 'STATUS' => 'NEW', - 'TYPE' => 'OR', - 'NAME' => 'Kunden', - 'DESC' => 'Kunden Mails in Wichtig schieben', - 'CONDITIONS' => array ( - array('FIELD' => 'from', - 'COMPARATOR' => 'contains', - 'MATCH' => 'gonicus'), - array('FIELD' => 'from', - 'COMPARATOR' => 'contains', - 'MATCH' => 'lka'), - ), - 'ACTION' => array ( - array('ACTION'=>'MARK', - 'VALUE' => 'HAM'), - array('ACTION'=>'MOVE', - 'VALUE' => 'gosa+shared/hickert/wichtig') - ) - ); - } function execute() @@ -83,6 +41,7 @@ class filterManager extends plugin{ switch($filter['STATUS']){ case 'NEW' : $img = image('images/lists/element.png[new]');break; + case 'MODIFIED' : $img = image('images/lists/element.png[new]');break; case 'EXISTS' : $img = image('images/lists/element.png');break; default : $img = ""; } @@ -125,6 +84,30 @@ class filterManager extends plugin{ } } + // Add new filter + if(isset($_POST['addFilter'])){ + $filter = array ( + 'STATUS' => 'NEW', + 'TYPE' => 'AND', + 'NAME' => _('name'), + 'DESC' => _('description'), + 'CONDITIONS' => array ( + array('FIELD' => 'from', + 'COMPARATOR' => 'equals', + 'MATCH' => 'example@domain.com'), + array('FIELD' => 'subject', + 'COMPARATOR' => 'contains', + 'MATCH' => _('advertising')), + ), + 'ACTION' => array ( + array('ACTION'=>'MARK', + 'VALUE' => 'SPAM'), + array('ACTION'=>'MOVE', + 'VALUE' => '') + ) + ); + $this->filterEditor = new filterEditor($this->config,$this->parent, $filter); + } // Close filter editor if(isset($_POST['filterEditor_cancel']) && $this->filterEditor instanceOf filterEditor){ @@ -140,7 +123,12 @@ class filterManager extends plugin{ msg_dialog::displayChecks($msgs); }else{ $filter = $this->filterEditor->save(); - $this->filter[$this->currentFilter] = $filter; + if($filter['STATUS'] == 'NEW'){ + $this->filter[] = $filter; + }else{ + if($filter['STATUS'] != 'NEW') $filter['STATUS'] = 'MODIFIED'; + $this->filter[$this->currentFilter] = $filter; + } $this->filterEditor = NULL; $this->currentFilter = NULL; } diff --git a/gosa-plugins/groupware/personal/groupware/filterManager.tpl b/gosa-plugins/groupware/personal/groupware/filterManager.tpl index e4f13ae72..d45154592 100644 --- a/gosa-plugins/groupware/personal/groupware/filterManager.tpl +++ b/gosa-plugins/groupware/personal/groupware/filterManager.tpl @@ -1,13 +1,7 @@

{t}Available filter rules {/t}

{$list} - +