Code

added depselect for evironment tab
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 26 Aug 2005 10:17:51 +0000 (10:17 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 26 Aug 2005 10:17:51 +0000 (10:17 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1225 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/personal/environment/class_hotplugDialog.inc
plugins/personal/environment/hotplugDialog.tpl

index 944ab13ea93f2156b26e769665e61a4ab012d9a7..fee4b846ec1583d512819c29d662e62c141492fe 100644 (file)
@@ -19,6 +19,11 @@ class hotplugDialog extends plugin
 
   var $hotplugDevices           = ""; 
   var $hotplugDeviceList        = array(); 
+  var $regex                    = "*";
+  var $depselect                = "/";
+  var $deplist                  = "/";
+
+
 
   function hotplugDialog ($config, $dn= NULL,$use_existing=false )
   {
@@ -37,7 +42,32 @@ class hotplugDialog extends plugin
     }
 
     if($this->use_existing){
+
+      if(isset($_POST['dialogissubmitted'])){
+        $this->regex=$_POST['regexHot'];
+        $this->depselect = $_POST['depselectHot'];
+      }
+
+      if((isset($_GET['search']))&&(!empty($_GET['search']))){
+        $this->regex=$_GET['search']."*";
+        $this->regex=preg_replace("/\*\*/","*",$this->regex);
+      }
+
+      $this->deplist=array_flip($this->config->departments);
+
       $this->hotplugDevices = $this->getHotplugs();
+      $smarty->assign("regexHot"    ,$this->regex);
+      $smarty->assign("deplistHot"  ,$this->deplist);
+      $smarty->assign("depselectHot",$this->depselect);
+      $smarty->assign("apply", apply_filter());
+      $smarty->assign("alphabet", generate_alphabet());
+      $smarty->assign("search_image", get_template_path('images/search.png'));
+      $smarty->assign("tree_image", get_template_path('images/tree.png'));
+      $smarty->assign("infoimage", get_template_path('images/info.png'));
+      $smarty->assign("launchimage", get_template_path('images/launch.png'));
+      $smarty->assign("deplist", $this->config->idepartments);
+
+
       $smarty->assign("hotplugDevices",$this->hotplugDevices);
       $smarty->assign("hotplugDeviceKeys",array_flip($this->hotplugDevices));
       $display.= $smarty->fetch(get_template_path('hotplugDialog.tpl', TRUE,dirname(__FILE__)));
@@ -112,9 +142,9 @@ class hotplugDialog extends plugin
 
   function getHotplugs(){
     $ldap= $this->config->get_ldap_link();
-    $ldap->cd($this->config->current['BASE']);
+    $ldap->cd($this->depselect);
 
-    $ldap->search("(objectClass=gotoEnvironment)",array("gotoHotplugDevice")); 
+    $ldap->search("(&(objectClass=gotoEnvironment)(gotoHotplugDevice=".$this->regex."))",array("gotoHotplugDevice")); 
 
     $a_return = array();  
     $this->hotplugDeviceList = array();
@@ -124,13 +154,16 @@ class hotplugDialog extends plugin
         foreach($attr['gotoHotplugDevice'] as $device){
           $tmp =$tmp2= array();
           $tmp = split("\|",$device);
-          $a_return[$tmp[0]]= $tmp[0]." [".$tmp[1]."] ".$tmp[2];
           
-          $tmp2['name']         = $tmp[0];
-          $tmp2['description'] = $tmp[1];
-          $tmp2['id']           = $tmp[2];
-
-          $this->hotplugDeviceList[$tmp[0]]=$tmp2;
+          if(preg_match("/^".str_replace("*","",$this->regex).".*/i",$tmp[0])){
+            $a_return[$tmp[0]]= $tmp[0]." [".$tmp[1]."] ".$tmp[2];
+            
+            $tmp2['name']         = $tmp[0];
+            $tmp2['description'] = $tmp[1];
+            $tmp2['id']           = $tmp[2];
+
+            $this->hotplugDeviceList[$tmp[0]]=$tmp2;
+          }
         }
       }
     }
index 2abe2af1c6ebd43023bcc353a79a3a89594d30a7..e071ef37ced7d8b6833cbfee0aa5ece1678d0d7f 100644 (file)
                 <option disabled>&nbsp;</option>
                 </select><br>
             </td>
+                       <td>
+                <div class="contentboxh">
+                    <p class="contentboxh"><img src="{$infoimage}" align="right" alt="[i]">{t}Information{/t}</p>
+                </div>
+                <div class="contentboxb">
+                    <p class="contentboxb">
+                        {t}This menu allows you to create, edit and delete selected users.
+                            Having a great number of users, you may want to use the range selectors on top of the user list.{/t}
+                    </p>
+                </div>
+                <br>
+
+                <div class="contentboxh">
+                    <p class="contentboxh"><img src="{$launchimage}" align="right" alt="[F]">{t}Filters{/t}</p>
+                </div>
+                <div class="contentboxb">
+                <table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
+                    <tr>
+                        <td width="50%">
+                            <img alt="" src="{$tree_image}" align=middle>&nbsp;{t}Display groups of department{/t}
+                        </td>
+                        <td>
+                            <select name="depselectHot" size=1 onChange="mainform.submit()" title="{t}Choose the department the search will be based    on{/t}">
+                              {html_options options=$deplistHot selected=$depselectHot}
+                            </select>
+                        </td>
+                    </tr>
+                </table>
+                </div>
+                <div class="contentboxb">
+                    <table summary="" style="width:100%;border-top:1px solid #B0B0B0;">
+                    {$alphabet}
+                    </table>
+                        <table summary="" width="100%" style="border-top:1px solid #B0B0B0;">
+                            <tr>
+                                <td>
+                                    <LABEL for='filter'><img alt="Search" src="{$search_image}" align="middle" title="{t}Display users matching{/t}">
+                                    </LABEL>
+                                </td>
+                                <td width="99%">
+                                    <input id='filter' style='width:99%' type='text' name='regexHot' maxlength='20' value='{$regexHot}'
+                                            title='{t}Regular expression for        matching user names{/t}' onChange="mainform.submit()">
+                                </td>
+                            </tr>
+                        </table>
+                    {$apply}
+                </div>
+            </td>
+
+
                </tr>
        </table>