Code

Added filter editing class
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 6 Sep 2010 12:46:01 +0000 (12:46 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 6 Sep 2010 12:46:01 +0000 (12:46 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19530 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/groupware/personal/groupware/class_filterEditor.inc [new file with mode: 0644]
gosa-plugins/groupware/personal/groupware/class_filterManager.inc
gosa-plugins/groupware/personal/groupware/filterEditor.tpl [new file with mode: 0644]

diff --git a/gosa-plugins/groupware/personal/groupware/class_filterEditor.inc b/gosa-plugins/groupware/personal/groupware/class_filterEditor.inc
new file mode 100644 (file)
index 0000000..2441136
--- /dev/null
@@ -0,0 +1,18 @@
+<?php
+
+class filterEditor extends plugin
+{
+    function __construct($config, $parent, $filter)
+    {
+        $this->config = &$config;
+        $this->parent = &$parent;
+        $this->filter = $filter;
+    }
+
+    function execute()
+    {
+        $smarty = get_smarty();
+        return($smarty->fetch(get_template_path('filterEditor.tpl',TRUE,dirname(__FILE__))));
+    }
+}
+?>
index 5ee686db8ac79007b0f788bb9ece89a810cb0e20..432767c098190148deb315f6d7aaf2968a6bc098 100644 (file)
@@ -17,12 +17,13 @@ class filterManager extends plugin{
         $this->filterListing->setEditable(true);
         $this->filterListing->setColspecs(array('*'));
         $this->filterListing->setWidth("100%");
-        $this->filterListing->setHeight("200px;");
+        $this->filterListing->setHeight("150px;");
         $this->filterListing->setAcl($this->parent->getacl('mailFilter'));
 
 
         $this->filter = array(); 
         $this->filter[] =   array (
+                'STATUS' => 'EXISTS',
                 'TYPE' => 'AND',
                 'NAME' => 'MuellRaus',
                 'DESC' => 'Spam loeschen',
@@ -43,6 +44,7 @@ class filterManager extends plugin{
                 );
 
         $this->filter[] =   array (
+                'STATUS' => 'NEW',
                 'TYPE' => 'OR',
                 'NAME' => 'Kunden',
                 'DESC' => 'Kunden Mails in Wichtig schieben',
@@ -66,13 +68,25 @@ class filterManager extends plugin{
 
     function execute()
     {
+        // Display filter editor while a filter rule is edited
+        if($this->filterEditor instanceOf filterEditor){
+            $this->filterEditor->save_object();
+            return($this->filterEditor->execute());
+        }
+        
 
         $smarty = get_smarty();
-
         $data = $lData = array();
         foreach($this->filter as $key => $filter){
             $data[$key] = $filter;
-            $lData[$key] = array('data' => array($filter['NAME'], $filter['DESC']));
+
+            switch($filter['STATUS']){
+                case 'NEW' : $img = image('images/lists/element.png[new]');break;
+                case 'EXISTS' : $img = image('images/lists/element.png');break;
+                default : $img = "";
+            }
+
+            $lData[$key] = array('data' => array($img,$filter['NAME'], $filter['DESC']));
         }
         $this->filterListing->setListData($data,$lData);
         $this->filterListing->update();
@@ -104,10 +118,23 @@ class filterManager extends plugin{
             $key = $action['targets'][0];
             $key = $this->filterListing->getKey($key);
             if(isset($this->filter[$key])){
-                
-            
+                $filter = $this->filter[$key];
+                $this->filterEditor = new filterEditor($this->config,$this->parent, $filter);
+                $this->currentFilter = $key;
             }
         }
+
+        // Close filter editor 
+        if(isset($_POST['filterEditor_cancel'])){
+            $this->currentFilter = NULL;
+            $this->filterEditor = NULL;
+        }
+
+        // Save filter modifications and close the dialog
+        if(isset($_POST['filterEditor_ok'])){
+            $this->filterEditor = NULL;
+            $this->currentFilter = NULL;
+        }
     }
 }
 
diff --git a/gosa-plugins/groupware/personal/groupware/filterEditor.tpl b/gosa-plugins/groupware/personal/groupware/filterEditor.tpl
new file mode 100644 (file)
index 0000000..fc6d02d
--- /dev/null
@@ -0,0 +1,8 @@
+
+asdf
+
+<hr>
+<div class="plugin-actions">
+    <button name='filterEditor_ok'>{msgPool type='okButton'}</button>
+    <button name='filterEditor_cancel'>{msgPool type='cancelButton'}</button>
+</div>