summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 2239cac)
raw | patch | inline | side by side (parent: 2239cac)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 12 Mar 2010 13:30:49 +0000 (13:30 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Fri, 12 Mar 2010 13:30:49 +0000 (13:30 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16488 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-core/include/class_userFilter.inc | patch | blob | history | |
gosa-core/include/class_userFilterEditor.inc | patch | blob | history |
index a96e1b877347184d76cb14eb71f2d1cb4cc16fb0..f713e4860bb517565245444406ee8f7ed5b792ee 100644 (file)
public $pathTitle= "Filter";
public $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)
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($this->listing->categories);
// Load list of filters
if(isset($this->attrs['gosaUserDefinedFilter'])){
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->fixedFilter);
+ $this->dialog=new userFilterEditor($this->filters[$key], $this->listing);
}
}
// Act on new requests
if(isset($_POST['addFilter'])){
- $this->dialog=new userFilterEditor(array(), $this->availableCategories, $this->fixedFilter);
+ $this->dialog=new userFilterEditor(array(), $this->listing);
}
// Act on remove requests
diff --git a/gosa-core/include/class_userFilterEditor.inc b/gosa-core/include/class_userFilterEditor.inc
index ea8bc2ead3a6d4d25d6b3e71929417c5e143fbee..f118b56183157d953f5bbb0aba43251594292874 100644 (file)
public $enabled = TRUE;
public $queries = array();
+ public $listing = NULL;
+
// The list of all categories mangaged by the current filter object.
// Used in the grop-down box.
- public $availableCategories = array();
- public $fixedFilters = array();
public $orig_name = "";
+
/*! \brief Instantiate the filter editing dialog.
* Parses the filter info into editable data.
*/
- function __construct($entry, $categories, $fixedFilters)
+ function __construct($entry, $listing)
{
- $this->availableCategories = $categories;
- $this->fixedFilters = $fixedFilters;
+ $this->listing = &$listing;
if($entry){
$this->entry = $entry;
$this->parent = $entry['parent'];
{
plugin::execute();
+ $smarty = get_smarty();
+
// Build up HTML compliant html output
$queries = array();
foreach($this->queries as $key => $query){
$queries[$key] = $query;
}
- $smarty = get_smarty();
+ // Build up list of hard coded filters
+ $filter= $this->listing->getFilter();
+
+ $smarty->assign("fixedFilters", array_keys($filter->searches));
$smarty->assign('parent', $this->parent);
$smarty->assign('name', htmlentities($this->name,ENT_COMPAT,'UTF-8'));
$smarty->assign('queries', $queries);
$smarty->assign('enable', $this->enabled);
$smarty->assign('description', htmlentities($this->description,ENT_COMPAT,'UTF-8'));
$smarty->assign('selectedCategories', $this->selectedCategories);
- $smarty->assign('availableCategories', $this->availableCategories);
- $smarty->assign('fixedFilters', $this->fixedFilters);
+ $smarty->assign('availableCategories', array_unique($this->listing->categories));
return($smarty->fetch(get_template_path('userFilterEditor.tpl', FALSE)));
}
// Add new query
if(isset($_POST['addQuery'])){
- $this->queries[] = array('backend'=>'filterLDAP', 'filter' => '(objectClass=*)');
+
+ $filter= $this->listing->getFilter();
+ $backend = 'filterLDAP';
+ $query = "(objectClass=*)";
+ if(isset($filter->searches[$this->parent])){
+ $query = $filter->searches[$this->parent]['query']['filter'];
+ $backend = $filter->searches[$this->parent]['query']['backend'];
+ }
+
+ $this->queries[] = array('backend'=> $backend, 'filter' => userFilterEditor::_autoIndentFilter($query," "));
}
}
}