Code

Allow to add new filters
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Sep 2010 08:15:48 +0000 (08:15 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 7 Sep 2010 08:15:48 +0000 (08:15 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19538 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/groupware/personal/groupware/class_filterManager.inc
gosa-plugins/groupware/personal/groupware/filterManager.tpl

index c1a64dc82e5731d3d4a6cc68a30b4c4d29e88f17..bc3132708d7f99940c3992dd35e987cccb081dec 100644 (file)
@@ -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;
             }
index e4f13ae72deb10d294a82151fd17b7c11ee12594..d45154592420357201d30661d48569d68caf787d 100644 (file)
@@ -1,13 +1,7 @@
 <h3>{t}Available filter rules {/t}</h3>
 
 {$list}
-<select name='filterTemplate' size=1>
-    <option>Mails von bestimmten Sendern in einen Ordner verschieben</option>
-    <option>Mails von bekannten Sender (Adressbuch) in Ordner verschieben</option>
-    <option>Mails löschen (Alle und immer!)</option>
-    <option>Bla</option>
-    <option>Manuelle Regel</option>
-</select>
+
 <button name='addFilter'>{msgPool type='addButton'}</button>