Code

Added filter parent
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Mar 2010 16:16:30 +0000 (16:16 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 10 Mar 2010 16:16:30 +0000 (16:16 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@16387 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-core/ihtml/themes/modern/userFilterEditor.tpl
gosa-core/include/class_userFilter.inc
gosa-core/include/class_userFilterEditor.inc

index 2d94578cdce293e238e432b7942467c4fa77140f..e014ab3f5bf7b6eee9a82e83965bb18b2e1bc7b1 100644 (file)
             <input type='text' name='name' id='name' value='{$name}'>
           </td>   
         </tr>
+        <tr>
+          <td>
+            <label for='parent'>{t}parent{/t}</label>
+          </td>
+          <td>
+            <select name='parent'>
+              {html_options values=$fixedFilters output=$fixedFilters selected=$parent}
+            </select>
+          </td>   
+        </tr>
         <tr>
           <td>
             <label for='description'>{t}Description{/t}</label>
index 46e1aec4482625845e980e0059c85dd04440ed99..aa161799542df1eeec925e11984c431bb4d86c0a 100644 (file)
@@ -67,7 +67,7 @@ class userFilter extends plugin
    */
   static function explodeFilterString($filter)
   {
-    list($categories, $name, $description, $filter, $flags) = split(";", $filter);
+    list($parent,$categories, $name, $description, $filter, $flags) = split(";", $filter);
 
     // Ensure that we no empty category in our category list.
     if(empty($categories)){
@@ -85,6 +85,7 @@ class userFilter extends plugin
 
     // build up filter entry.
     $tmp = array(
+        'parent' => $parent, 
         'name' => $name, 
         'categories' => $categories,
         'description' => base64_decode($description),
@@ -105,6 +106,7 @@ class userFilter extends plugin
     foreach($this->filters as $name => $filter){
       $data[$name] = array('data' =>
           array(
+            $filter['parent'],
             $filter['name'],
             $filter['description'],
             implode(", ",$filter['categories']),
@@ -240,7 +242,8 @@ class userFilter extends plugin
     // Build up new list of filters 
     $attrs = array();
     foreach($this->filters as $filter){
-      $tmp = implode(',', $filter['categories']).";";
+      $tmp = $filter['parent'].";";
+      $tmp.= implode(',', $filter['categories']).";";
       $tmp.= $filter['name'].";";
       $tmp.= base64_encode($filter['description']).";";
       $tmp.= base64_encode($filter['filter']).";";
index 90eefe1c336bb4d51a1ebd4c908f3e9ff7d43272..998994a7d809214fa81b49ca27641ae5e5462953 100644 (file)
@@ -8,6 +8,7 @@ class userFilterEditor extends plugin
   // The values
   public $name = "";
   public $description = "";
+  public $parent = "";
   public $selectedCategories = array();
   public $share = FALSE;
   public $enabled = TRUE;
@@ -16,17 +17,20 @@ class userFilterEditor extends plugin
   // 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)
+  function __construct($entry, $categories, $fixedFilters)
   {
     $this->availableCategories = $categories;
+    $this->fixedFilters = $fixedFilters;
     if($entry){
       $this->entry = $entry;
+      $this->parent = $entry['parent'];
       $this->name = $entry['name'];
       $this->description = $entry['description'];
       $this->filter = $entry['filter'];
@@ -64,6 +68,7 @@ class userFilterEditor extends plugin
   {
     plugin::execute();
     $smarty = get_smarty();
+    $smarty->assign('parent', $this->parent);
     $smarty->assign('name', htmlentities($this->name,ENT_COMPAT,'UTF-8'));
     $smarty->assign('filter', htmlentities($this->filter,ENT_COMPAT,'UTF-8'));
     $smarty->assign('share', $this->share);
@@ -71,6 +76,7 @@ class userFilterEditor extends plugin
     $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);
     return($smarty->fetch(get_template_path('userFilterEditor.tpl', FALSE)));
   }
 
@@ -82,7 +88,7 @@ class userFilterEditor extends plugin
     if(isset($_POST['userFilterEditor'])){
 
       // Get posted strings
-      foreach(array('name','description') as $attr){
+      foreach(array('name','description', 'parent') as $attr){
         if(isset($_POST[$attr])){
           $this->$attr = get_post($attr);
         }
@@ -157,6 +163,7 @@ class userFilterEditor extends plugin
   function save()
   {
     $ret= array();
+    $ret['parent'] = $this->parent;
     $ret['name'] = $this->name;
     $ret['description'] = $this->description;
     $ret['categories'] = $this->selectedCategories;