index b05ff5b211608d0287e2eaba5ed5963efec68d9b..2833ce5e36a00fd6df54c821e55528b139cb9da1 100644 (file)
protected $pathMapping;
protected $lastState;
- // It would be better to get a dn -> [name, description, type] array
- // to avoid these tasks be done several times. Skipping for the moment.
- #'dc' => 'plugins/departments/images/domain.png',
- #'dc' => 'plugins/departments/images/dc.png',
- #'l' => 'plugins/departments/images/locality.png',
- #'c' => 'plugins/departments/images/country.png',
- #'o' => 'plugins/departments/images/organization.png',
- #'ou' => 'plugins/departments/images/folder.png',
function __construct($bases, $base= "")
{
$this->lastState= false;
return false;
}
- }
-
- // Input field set?
- if (isset($_POST['bs_input_'.$this->pid])) {
-
- // Take over input field base
- if ($this->submitButton && isset($_POST['submit_base_'.$this->pid.'_x']) || !$this->submitButton) {
-
- // Check if base is available
- $this->lastState= false;
- foreach ($this->pathMapping as $key => $path) {
- if (mb_strtolower($path) == mb_strtolower($_POST['bs_input_'.$this->pid])) {
- $this->base= $key;
- $this->lastState= true;
- break;
+ }else{
+ // Input field set?
+ if (isset($_POST['bs_input_'.$this->pid])) {
+
+ // Take over input field base
+ if ($this->submitButton && isset($_POST['submit_base_'.$this->pid.'_x']) || !$this->submitButton) {
+
+ // Check if base is available
+ $this->lastState= false;
+ foreach ($this->pathMapping as $key => $path) {
+ if (mb_strtolower($path) == mb_strtolower($_POST['bs_input_'.$this->pid])) {
+ $this->base= $key;
+ $this->lastState= true;
+ break;
+ }
}
}
}
$this->tree.= "</script>";
$selected= $this->base == $config->current['BASE']?"Selected":"";
- $this->tree.= "<div class='treeList' style='display:none;max-height:".$this->height."px' id='bs_".$this->pid."' onmouseover=\"window.clearTimeout(rtimer);\" onmouseout=\"rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\"><a class='treeList$selected' $link>/ ["._("Root")."]</a><ul class='treeList'>\n";
+ $this->tree.= "<div class='treeList' style='display:none;max-height:".$this->height."px' id='bs_".$this->pid."' onmouseover=\"window.clearTimeout(rtimer);\" onmouseout=\"rtimer= Element.hide.delay(0.25, 'bs_".$this->pid."')\"><a class='treeList$selected' $link>/ ["._("Root")."]</a><ul class='treeList'>\n";
$first= true;
$last_indent= 2;
}
$selected= $this->base == $base?" class='treeListSelected'":"";
$link= "onclick=\"\$('bs_rebase_".$this->pid."').value='".base64_encode($base)."';$('submit_tree_base_".$this->pid."').click();\"";
- $this->tree.= "<li><a$selected $link>".str_replace(' ', ' ', ldap::fix(preg_replace('/^[a-z0-9]+=([^,]+),.*$/i', '$1', $base)))."</a>";
+ $this->tree.= "<li>".
+ image($config->department_info[$base]['img'])." <a$selected $link>".
+ $this->gennonbreaks($config->department_info[$base]['name']).
+ ($config->department_info[$base]['description']==''?'':' <span class="informal">['.$this->gennonbreaks($config->department_info[$base]['description']).']</span>').
+ "</a>";
$last_indent= $indent;
$first= false;
}
// Close tree
- for ($i= 0; $i<$last_indent; $i++) {
+ for ($i= 1; $i<$last_indent; $i++) {
$this->tree.= "</li></ul>\n";
}
$this->tree.= "</div>\n";
// Draw submitter if required
if ($this->submitButton) {
- $this->tree.= " <input class='center' type='image' src='images/lists/submit.png' align='middle' title='"._("Submit")."' name='submit_base_".$this->pid."' id='submit_base_".$this->pid."' alt='"._("Submit")."'>";
+ $this->tree.= image('images/lists/submit.png', "submit_base_".$this->pid, _("Submit"));
}
$this->tree.= "<input type='submit' style='display:none' name='submit_tree_base_".$this->pid."' id='submit_tree_base_".$this->pid."'>";
$this->tree.= "<input type='hidden' name='bs_rebase_".$this->pid."' id='bs_rebase_".$this->pid."'>";
return true;
}
+
+ function gennonbreaks($string)
+ {
+ return str_replace('-', '‑', str_replace(' ', ' ', $string));
+ }
+
+
function render()
{
return $this->tree;