From 1649f952ce57e54b10d47ec50c9db01699bea945 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 6 Sep 2010 12:46:01 +0000 Subject: [PATCH] Added filter editing class git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19530 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../personal/groupware/class_filterEditor.inc | 18 +++++++++ .../groupware/class_filterManager.inc | 37 ++++++++++++++++--- .../personal/groupware/filterEditor.tpl | 8 ++++ 3 files changed, 58 insertions(+), 5 deletions(-) create mode 100644 gosa-plugins/groupware/personal/groupware/class_filterEditor.inc create mode 100644 gosa-plugins/groupware/personal/groupware/filterEditor.tpl diff --git a/gosa-plugins/groupware/personal/groupware/class_filterEditor.inc b/gosa-plugins/groupware/personal/groupware/class_filterEditor.inc new file mode 100644 index 000000000..244113671 --- /dev/null +++ b/gosa-plugins/groupware/personal/groupware/class_filterEditor.inc @@ -0,0 +1,18 @@ +config = &$config; + $this->parent = &$parent; + $this->filter = $filter; + } + + function execute() + { + $smarty = get_smarty(); + return($smarty->fetch(get_template_path('filterEditor.tpl',TRUE,dirname(__FILE__)))); + } +} +?> diff --git a/gosa-plugins/groupware/personal/groupware/class_filterManager.inc b/gosa-plugins/groupware/personal/groupware/class_filterManager.inc index 5ee686db8..432767c09 100644 --- a/gosa-plugins/groupware/personal/groupware/class_filterManager.inc +++ b/gosa-plugins/groupware/personal/groupware/class_filterManager.inc @@ -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 index 000000000..fc6d02d6c --- /dev/null +++ b/gosa-plugins/groupware/personal/groupware/filterEditor.tpl @@ -0,0 +1,8 @@ + +asdf + +
+
+ + +
-- 2.30.2