Code

Some changes, added better filter management for ProfileEntry
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Sep 2005 12:31:03 +0000 (12:31 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 8 Sep 2005 12:31:03 +0000 (12:31 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1330 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/FAI/class_faiProfileEntry.inc
plugins/admin/FAI/faiProfileEntry.tpl

index d60e267ad8f460ea5dd33e456abdc0e7bc6a5a99..bf8d2033ff1e8333e09006237d3ccf2f1fb8fc6b 100644 (file)
@@ -68,7 +68,7 @@ class faiProfileEntry extends plugin
     $SUBfaifilter = $_SESSION['SUBfaifilter'];
 
     /* If someone used the apply button, update searchfilter */
-    if(isset($_POST['apply'])){
+    if(isset($_POST['Sregex'])){
       foreach($SUBfaifilter as $key => $val){
         if(!isset($_POST[$key])){
           $SUBfaifilter[$key] = false;
@@ -76,8 +76,12 @@ class faiProfileEntry extends plugin
           $SUBfaifilter[$key] =$_POST[$key];
         }
       }
+      $SUBfaifilter['Sregex']= $_POST['Sregex'];
+      if(!strstr($SUBfaifilter['Sregex'],"*")){
+        $SUBfaifilter['Sregex'] = $SUBfaifilter['Sregex']."*";
+      }
     }
-
+  
     /* Save current searchfilter in session*/
     $_SESSION['SUBfaifilter']= $SUBfaifilter;
 
@@ -134,24 +138,29 @@ class faiProfileEntry extends plugin
     /* Check every single class name to match the current search filter */
     foreach($this->FAIAllclasses as $usedClass => $classes){
 
-      $abort = false;
+      $fi = str_replace("*",".*",$SUBfaifilter['Sregex']);  
+      $abort = false; 
+      if(!preg_match("/".$fi."/",$usedClass)){
+        $abort = true;
+      }
       if(($SUBfaifilter['SShowScripts'])&&(!in_array('FAIscript',$classes['objects']))){
-        $abort = "true";
+        $abort = true;
       }
       if(($SUBfaifilter['SShowTemplates'])&&(!in_array('FAItemplate',$classes['objects']))){
-        $abort = "true";
+        $abort = true;
       }
       if(($SUBfaifilter['SShowHooks'])&&(!in_array('FAIhook',$classes['objects']))){
-        $abort = "true";
+        $abort = true;
       }
       if(($SUBfaifilter['SShowVariables'])&&(!in_array('FAIvariable',$classes['objects']))){
-        $abort = "true";
+        $abort = true;
       }
       if(($SUBfaifilter['SShowPartitions'])&&(!in_array('FAIpartitionTable',$classes['objects']))){
-        $abort = "true";
+        $abort = true;
       }
       if(($SUBfaifilter['SShowPackages'])&&(!in_array('FAIpackages',$classes['objects']))){
-        $abort = "true";
+        $abort = true;
       }
 
       if(!$abort){
index b04a7ee336dbe79437e5259f89c63ca3e5e60c71..36b2ba0f26c39da78d9b5760c788fe279834e5b8 100644 (file)
       {$alphabet}
      </table>
         <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
-               <tr><td><input type="checkbox" name="SShowTemplates"    {$SShowTemplatesCHK}>{t}Show only classes with templates{/t}</td></tr>
-               <tr><td><input type="checkbox" name="SShowScripts"              {$SShowScriptsCHK}>{t}Show only classes with scripts{/t}</td></tr>
-               <tr><td><input type="checkbox" name="SShowHooks"                {$SShowHooksCHK}>{t}Show only classes with hooks{/t}</td></tr>
-               <tr><td><input type="checkbox" name="SShowVariables"    {$SShowVariablesCHK}>{t}Show only classes with variables{/t}</td></tr>
-               <tr><td><input type="checkbox" name="SShowPackages"     {$SShowPackagesCHK}>{t}Show only classes with packages{/t}</td></tr>
-               <tr><td><input type="checkbox" name="SShowPartitions"   {$SShowPartitionsCHK}>{t}Show only classes with partitions{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()' 
+                                                               type="checkbox" name="SShowTemplates"   {$SShowTemplatesCHK}>{t}Show only classes with templates{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowScripts"             {$SShowScriptsCHK}>{t}Show only classes with scripts{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowHooks"               {$SShowHooksCHK}>{t}Show only classes with hooks{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowVariables"   {$SShowVariablesCHK}>{t}Show only classes with variables{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowPackages"    {$SShowPackagesCHK}>{t}Show only classes with packages{/t}</td></tr>
+               <tr><td><input onChange='document.mainform.submit()'
+                                                               type="checkbox" name="SShowPartitions"  {$SShowPartitionsCHK}>{t}Show only classes with partitions{/t}</td></tr>
         </table>
      <table summary=""  style="width:100%;border-top:1px solid #B0B0B0;">
      <tr>