size_limit. */ protected function draw_dn($dn,$level) { if (DEBUG_ENABLED) debug_log('Entered with (%s,%s)',33,__FILE__,__LINE__,__METHOD__,$dn,$level); static $tm = null; if (! isset($tm)) { $tm = new TreeMenu(); $tm->setDirroot(JSDIR.'phplayersmenu/'); $tm->setIcondir(IMGDIR); $tm->setIconwww(IMGDIR); $tm->setImgwww(JSDIR.'phplayersmenu/menuimages/'); } $tree_plm = $this->to_plm($dn,$level); $tm->setMenuStructureString($tree_plm); $tm->parseStructureForMenu('pla_tree_'.$this->server_id); $tm->setTreeMenuTheme(''); $tm->newTreeMenu('pla_tree_'.$this->server_id); echo sprintf('%s',$this->getDepth()+3-1,$tm->getTreeMenu('pla_tree_'.$this->server_id)); } protected function to_plm($dn,$level) { if (DEBUG_ENABLED) debug_log('Entered with (%s,%s)',33,__FILE__,__LINE__,__METHOD__,$dn,$level); $ldapserver = $this->getLdapServer(); $dnEntry = $this->getEntry($dn); if (!$dnEntry) { $this->addEntry($dn); $dnEntry = $this->getEntry($dn); } if (!$dnEntry) { if (DEBUG_ENABLED) debug_log('Returning (%s)',33,__FILE__,__LINE__,__METHOD__,''); return ''; } $encoded_dn = rawurlencode($dn); $edit_href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$this->server_id,$encoded_dn); $rdn = get_rdn($dn); $dots = ''; for ($i=0;$i<=$level+1;$i++) $dots .= '.'; # Have we tranversed this part of the tree yet? if ($dnEntry->isOpened()) { $child_count = $this->get_children_number($dnEntry); $tree_plm = sprintf("%s|%s|%s|%s|%s|%s|%s\n", $dots, ($this->get_formatted_dn($dnEntry, $level)).($child_count ? ' ('.$child_count.')' : ''), $edit_href, $this->get_formatted_title($dnEntry, $level), $dnEntry->getIcon($ldapserver), '', ($dnEntry->isOpened() ? 1 : 0)); $tree_plm .= $this->get_plm_before_first_child($dnEntry, $level); foreach ($dnEntry->getChildren() as $dn) { $tree_plm .= $this->to_plm($dn,$level+1); } $tree_plm .= $this->get_plm_after_last_child($dnEntry, $level); } else { $child_count = $this->get_children_number($dnEntry); if ($child_count) { $tree_plm = sprintf("%s|%s|%s|%s|%s|%s|%s|%s\n", $dots, ($this->get_formatted_dn($dnEntry, $level)).($child_count ? ' ('.$child_count.')' : ''), $edit_href, $this->get_formatted_title($dnEntry, $level), $dnEntry->getIcon($ldapserver), '', ($dnEntry->isOpened() ? 1 : 0), $child_count); } else { $tree_plm = sprintf("%s|%s|%s|%s|%s|%s|%s|%s\n", $dots, ($this->get_formatted_dn($dnEntry, $level)), $edit_href, $this->get_formatted_title($dnEntry, $level), $dnEntry->getIcon($ldapserver), '', ($dnEntry->isOpened() ? 1 : 0), $child_count === false ? 1 : 0); } } if (DEBUG_ENABLED) debug_log('Returning (%s)',33,__FILE__,__LINE__,__METHOD__,$tree_plm); return $tree_plm; } protected function get_formatted_title($entry, $level) { return $entry->getDn(); } protected function get_plm_before_first_child($entry, $level) { $ldapserver = $this->getLdapServer(); $plm = ''; if (!$ldapserver->isReadOnly() && ($entry->getChildrenNumber() > 10) && ($ldapserver->isShowCreateEnabled())) { $encoded_dn = rawurlencode($entry->getDn()); $create_href = sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s', $ldapserver->server_id, $encoded_dn); $dots = '.'; for ($i=0;$i<=$level+1;$i++) $dots .= '.'; $plm = sprintf("%s|%s|%s|%s|%s|%s|%s\n", $dots, _('Create new entry here'), $create_href, $entry->getDn(), 'star.png', '', 0); } return $plm; } protected function get_plm_after_last_child($entry, $level) { $ldapserver = $this->getLdapServer(); $plm = ''; if (!$ldapserver->isReadOnly() && !$entry->isLeaf() && $ldapserver->isShowCreateEnabled()) { $encoded_dn = rawurlencode($entry->getDn()); $create_href = sprintf('cmd.php?cmd=template_engine&server_id=%s&container=%s', $ldapserver->server_id, $encoded_dn); $dots = '.'; for ($i=0;$i<=$level+1;$i++) $dots .= '.'; $plm = sprintf("%s|%s|%s|%s|%s|%s|%s\n", $dots, _('Create new entry here'), $create_href, $entry->getDn(), 'star.png', '', 0); } return $plm; } } ?>