Code

Completed lvm partition changes
[gosa.git] / gosa-plugins / fai / admin / fai / class_faiProfileEntry.inc
index d15526631cb65faa85ae77e529b1e36ff507c415..652b36052540a3590076686481e3a7fa2372c9d1 100644 (file)
@@ -11,17 +11,11 @@ class faiProfileEntry extends plugin
   var $FAIAllclasses        = array();
   var $ui;
 
-  function faiProfileEntry (&$config, $dn= NULL,$used=array(),$objects=false)
+  function faiProfileEntry (&$config, $dn= NULL,$used=array(),$base)
   {
     plugin::plugin ($config, $dn);
 
     /* Search only in fai tree */
-    $base = get_ou('faiou').session::get('CurrentMainBase');
-    $faifilter = session::get('faifilter');
-    if($faifilter['branch']!="main"){
-      $base = $faifilter['branch'];
-    }
-  
     $this->ui = get_userinfo();
 
     $filter = "(|(objectClass=FAIscript)(objectClass=FAItemplate)(objectClass=FAIhook)".
@@ -35,7 +29,7 @@ class faiProfileEntry extends plugin
                         "FAIhook"           => "faiHook",
                         "FAIvariable"       => "faiVariable",
                         "FAIpartitionTable" => "faiPartitionTable",
-                        "FAIpackageList"    => "faiPackageList");
+                        "FAIpackageList"    => "faiPackage");
 
     /* Read out all objects from fai tree */
     $ldap= $this->config->get_ldap_link();
@@ -81,7 +75,7 @@ class faiProfileEntry extends plugin
 
     /* If no search filter is set, create one */
     if (!session::is_set("SUBfaifilter")){
-      $SUBfaifilter= array("base" => get_ou('faiou').session::get('CurrentMainBase'), "Sregex" => "*");
+      $SUBfaifilter= array("base" => get_ou('faiBaseRDN').session::get('CurrentMainBase'), "Sregex" => "*");
       $SUBfaifilter['SShowTemplates'] = true;
       $SUBfaifilter['SShowScripts']   = true;
       $SUBfaifilter['SShowHooks']     = true;
@@ -94,8 +88,8 @@ class faiProfileEntry extends plugin
 
   function execute()
   {
-       /* Call parent execute */
-       plugin::execute();
+    /* Call parent execute */
+    plugin::execute();
 
     /* Fill templating stuff */
     $smarty     = get_smarty();
@@ -103,6 +97,11 @@ class faiProfileEntry extends plugin
 
     $SUBfaifilter  = session::get('SUBfaifilter');
 
+    /* Get alphabet selection */
+    if(isset($_GET['search'])){
+      $SUBfaifilter['Sregex'] = strtolower($_GET['search'])."*";
+    }
+
     /* If someone used the apply button, update searchfilter */
     if(isset($_POST['Sregex'])){
       foreach($SUBfaifilter as $key => $val){
@@ -136,12 +135,12 @@ class faiProfileEntry extends plugin
     }
 
     /* Create different picture for each object type */
-    $objTypes['FAIhook']            = "<img src='images/fai_hook.png' title='"._("Hook bundle")."' alt=''>&nbsp;";
-    $objTypes['FAItemplate']        = "<img src='images/fai_template.png' title='"._("Template bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIscript']          = "<img src='images/fai_script.png' title='"._("Script bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIvariable']        = "<img src='images/fai_variable.png' title='"._("Variable bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIpackageList']     = "<img src='images/fai_packages.png' title='"._("Package bundle")."' alt=''>&nbsp;";
-    $objTypes['FAIpartitionTable']  = "<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>&nbsp;";
+    $objTypes['FAIhook']            = "<img src='plugins/fai/images/fai_hook.png' title='"._("Hook bundle")."' alt=''>&nbsp;";
+    $objTypes['FAItemplate']        = "<img src='plugins/fai/images/fai_template.png' title='"._("Template bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIscript']          = "<img src='plugins/fai/images/fai_script.png' title='"._("Script bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIvariable']        = "<img src='plugins/fai/images/fai_variable.png' title='"._("Variable bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIpackageList']     = "<img src='plugins/fai/images/fai_packages.png' title='"._("Package bundle")."' alt=''>&nbsp;";
+    $objTypes['FAIpartitionTable']  = "<img src='plugins/fai/images/fai_partitionTable.png' title='"._("Partition table")."' alt=''>&nbsp;";
 
     /* Magic quotes GPC, escapes every ' " \, to solve some security risks
      * If we post the escaped strings they will be escaped again
@@ -190,7 +189,7 @@ class faiProfileEntry extends plugin
       $fi = str_replace("*",".*",$SUBfaifilter['Sregex']);  
  
       $abort = true;
-      if(!preg_match("/".$fi."/",$usedClass)){
+      if(!preg_match("/^".$fi."/i",$usedClass)){
         $abort = false;
         continue;
       }
@@ -239,7 +238,7 @@ class faiProfileEntry extends plugin
     $smarty->assign("launchimage"   , get_template_path('images/lists/action.png'));
     $smarty->assign("alphabet"      , generate_alphabet());
     $smarty->assign("apply"         , apply_filter(TRUE));
-    $smarty->assign("search_image"  , get_template_path('images/search.png'));
+    $smarty->assign("search_image"  , get_template_path('images/lists/search.png'));
 
     $display.= $smarty->fetch(get_template_path('faiProfileEntry.tpl', TRUE));
     return($display);