summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: eeef28a)
raw | patch | inline | side by side (parent: eeef28a)
author | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 9 Feb 2010 20:07:29 +0000 (20:07 +0000) | ||
committer | psc <psc@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 9 Feb 2010 20:07:29 +0000 (20:07 +0000) |
- Add sub search checkbox to hotplug device selection dialog
- Use get_list instead of ldap->search to get the list of hotplug
devices and honor the subsearch flag while on it.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15604 594d385d-05f5-0310-b6e9-bd551577e9d8
- Use get_list instead of ldap->search to get the list of hotplug
devices and honor the subsearch flag while on it.
git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15604 594d385d-05f5-0310-b6e9-bd551577e9d8
trunk/gosa-plugins/goto/personal/environment/class_hotplugDialog.inc | patch | blob | history | |
trunk/gosa-plugins/goto/personal/environment/hotplugDialog.tpl | patch | blob | history |
diff --git a/trunk/gosa-plugins/goto/personal/environment/class_hotplugDialog.inc b/trunk/gosa-plugins/goto/personal/environment/class_hotplugDialog.inc
index 7719fdb06ab3655065a801b2802b340f15e57ce6..2fd7c342e8683fc6b07c81755409c3cb1f16f650 100644 (file)
var $depselect = "/";
var $deplist = "/";
var $skipThese = array();
+ var $subtree = FALSE;
function hotplugDialog (&$config,$skipThese = array())
{
$this->depselect = $_POST['depselectHot'];
}
+ $this->subtree = isset($_POST['SubSearch']);
+
if((isset($_GET['search']))&&(!empty($_GET['search']))){
$this->regex=$_GET['search']."*";
$this->regex=preg_replace("/\*\*/","*",$this->regex);
$smarty->assign("tree_image", get_template_path('images/lists/search-subtree.png'));
$smarty->assign("launchimage", get_template_path('images/lists/action.png'));
$smarty->assign("deplist", $this->config->idepartments);
+ $smarty->assign("subtree", $this->subtree?"checked":"");
$smarty->assign("hotplugDevices",$this->hotplugDevices);
function getHotplugs()
{
- $ldap= $this->config->get_ldap_link();
- $ldap->cd(get_ou('deviceRDN').$this->depselect);
- $ldap->search("(&(objectClass=gotoDevice)(|(cn=".$this->regex.")(description=".$this->regex.")))",array("gotoHotplugDevice","cn","dn"));
+ $filter = "(&(objectClass=gotoDevice)(|(cn=".$this->regex.")(description=".$this->regex.")))";
+ $base = get_ou('deviceRDN').$this->depselect;
+ $attrs = array("gotoHotplugDevice", "cn", "dn");
+ $cat = "devices";
+
+ if ($this->subtree) {
+ $res = get_list($filter, $cat, $this->depselect, $attrs, GL_SUBSEARCH);
+ } else {
+ $res = get_list($filter, $cat, $base, $attrs);
+ }
$a_return = array();
$this->hotplugDeviceList = array();
- while($attr = $ldap->fetch()){
+ foreach ($res as $device) {
- if(isset($attr['gotoHotplugDevice'][0])){
+ if(isset($device['gotoHotplugDevice'][0])){
- $hot_plug = $attr['gotoHotplugDevice'][0];
+ $hot_plug = $device['gotoHotplugDevice'][0];
$tmp = preg_split("/\|/",$hot_plug);
$tmp2 = array();
- if(in_array($attr['cn'][0],$this->skipThese)){
+ if(in_array($device['cn'][0],$this->skipThese)){
continue;
}
- $tmp2['name'] = $attr['cn'][0];
+ $tmp2['name'] = $device['cn'][0];
$tmp2['description'] = $tmp[0];
$tmp2['id'] = $tmp[1];
$tmp2['produkt'] = $tmp[2];
$tmp2['vendor'] = $tmp[3];
- $tmp2['dn'] = $attr['dn'];
+ $tmp2['dn'] = $device['dn'];
- $a_return[$attr['cn'][0]]= $attr['cn'][0]." [".$tmp[0]."] ".$tmp[1];
+ $a_return[$device['cn'][0]]= $device['cn'][0]." [".$tmp[0]."] ".$tmp[1];
- $this->hotplugDeviceList[$attr['cn'][0]]=$tmp2;
+ $this->hotplugDeviceList[$device['cn'][0]]=$tmp2;
}
}
uksort($a_return,"strnatcasecmp");
diff --git a/trunk/gosa-plugins/goto/personal/environment/hotplugDialog.tpl b/trunk/gosa-plugins/goto/personal/environment/hotplugDialog.tpl
index 689ea74bde8032b2204e0e4cf7628c88cb57c380..f39ee4366aede78f931f413b0433361b5b060fc1 100644 (file)
</select>
</td>
</tr>
+ <tr>
+ <td>
+ <input type="checkbox" name='SubSearch' value='1' title='{t}Select to search within subtrees{/t}' onClick='document.mainform.submit();' {$subtree}> {t}Search in subtrees{/t}
+ </td>
</table>
<table summary="" width="100%" style="border-top:1px solid #B0B0B0;background-color:#F8F8F8">
<tr>