From 584a608332a5162c24b0a5c695d28e95da9455ec Mon Sep 17 00:00:00 2001 From: hickert Date: Wed, 10 Mar 2010 16:04:40 +0000 Subject: [PATCH] Updated userFilter -Is now able to read fixedFilters -Whats missing, make userFilterEditor able to set fixedFilters as parent git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16385 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/include/class_listing.inc | 6 ++++++ gosa-core/include/class_management.inc | 3 +-- gosa-core/include/class_userFilter.inc | 15 ++++++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index 38842dfb2..6175a4232 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -121,6 +121,12 @@ class listing { } + function getFilter() + { + return($this->filter); + } + + function setFilter($filter) { $this->filter= &$filter; diff --git a/gosa-core/include/class_management.inc b/gosa-core/include/class_management.inc index 6bdd603ca..b15a12462 100644 --- a/gosa-core/include/class_management.inc +++ b/gosa-core/include/class_management.inc @@ -186,8 +186,7 @@ class management function editFilter() { - $headpage = $this->getHeadpage(); - $this->dialogObject = new userFilter($this->config,$headpage->categories); + $this->dialogObject = new userFilter($this->config,$this->getHeadpage()); } function renderList() diff --git a/gosa-core/include/class_userFilter.inc b/gosa-core/include/class_userFilter.inc index 8a0ba6208..46e1aec44 100644 --- a/gosa-core/include/class_userFilter.inc +++ b/gosa-core/include/class_userFilter.inc @@ -2,13 +2,15 @@ class userFilter extends plugin { - protected $fitlers = array(); + protected $filters = array(); protected $availableCategories = array(); public $objectclasses = array('gosaProperties'); public $attributes = array('gosaUserDefinedFilter'); public $gosaUserDefinedFilter = array(); + private $listing = NULL; + private $fixedFilter = NULL; /*! \brief Returns true if we are able to read and write userFilters * (schema has to be present, gosaProperties) @@ -27,14 +29,17 @@ class userFilter extends plugin /*! \brief Initiates the filter editing dialog. */ - function __construct($config, $categories) + function __construct($config, $listing) { // Initialize this plugin with the users dn to gather user defined filters. $ui = get_userinfo(); plugin::plugin($config, $ui->dn); + $this->listing = &$listing; + $filter= $this->listing->getFilter(); + $this->fixedFilter = $filter->getFixedFilters(); // Keep list of currently managed categories. - $this->availableCategories = array_unique($categories); + $this->availableCategories = array_unique($this->listing->categories); // Load list of filters if(isset($this->attrs['gosaUserDefinedFilter'])){ @@ -157,13 +162,13 @@ class userFilter extends plugin if($action['action'] == 'edit' && count($action['targets']) == 1){ $key= $this->filterWidget->getKey($action['targets'][0]); if(isset($this->filters[$key])){ - $this->dialog=new userFilterEditor($this->filters[$key], $this->availableCategories); + $this->dialog=new userFilterEditor($this->filters[$key], $this->availableCategories, $this->fixedFilter); } } // Act on new requests if(isset($_POST['addFilter'])){ - $this->dialog=new userFilterEditor(array(), $this->availableCategories); + $this->dialog=new userFilterEditor(array(), $this->availableCategories, $this->fixedFilter); } // Act on remove requests -- 2.30.2