index 464f0a0dd38d7db327cf755abca375cbc25a3f52..ab6d5944354bdf8f56ebf12bbe5a68886a6d80a5 100644 (file)
var $exportColumns= array();
var $useSpan= false;
var $height= 0;
+ var $scrollPosition= 0;
function listing($filename)
}
}
+
function render()
{
// Check for exeeded sizelimit
return($message);
}
+ // Some browsers don't have the ability do do scrollable table bodies, filter them
+ // here.
+ $switch= false;
+ if (preg_match('/(Opera|Konqueror|Safari|msie)/i', $_SERVER['HTTP_USER_AGENT'])){
+ $switch= true;
+ }
+
// Initialize list
$result= "<input type='hidden' value='$this->pid' name='PID'>\n";
+ $result.= "<input type='hidden' name='position_".$this->pid."' id='position_".$this->pid."'>\n";
$height= 450;
if ($this->height != 0) {
$result.= "<input type='hidden' value='$this->height' id='d_height'>\n";
$height= $this->height;
}
- $result.= "<div class='contentboxb' id='listing_container' style='border-top:1px solid #B0B0B0;'>\n";
- $result.= "<table summary='$this->headline' style='width:600px;height:".$height."px;' cellspacing='0' id='t_scrolltable'>
-<tr><td class='scrollhead'><table summary='' style='width:100%;' cellspacing='0' id='t_scrollhead'>\n";
+ $result.= "<table cellpadding='0' cellspacing='0' border='0'><tr><td><div class='listContainer' id='d_scrollbody' style='border-top:1px solid #B0B0B0;width:700px;min-height:".($height+25)."px;'>\n";
+
+ $height= "";
+ if ($switch){
+ $height= "height:100%;";
+ }
+ $result.= "<table summary='$this->headline' style='${height}width:100%; table-layout:fixed;' cellspacing='0' cellpadding='0' id='t_scrolltable'>\n";
$this->numColumns= count($this->colprops) + ($this->multiSelect?1:0);
// Build list header
- $result.= "<tr>\n";
+ $result.= "<thead class='fixedListHeader listHeaderFormat'><tr>\n";
if ($this->multiSelect) {
- $result.= "<td class='listheader' style='width:20px;'><input type='checkbox' id='select_all' name='select_all' title='"._("Select all")."' onClick='toggle_all_(\"listing_selected_[0-9]*$\",\"select_all\");' ></td>\n";
+ $width= "24px";
+ if (preg_match('/Konqueror/i', $_SERVER['HTTP_USER_AGENT'])){
+ $width= "28px";
+ }
+ $result.= "<td class='listheader' style='text-align:center;padding:0;width:$width;'><input type='checkbox' id='select_all' name='select_all' title='"._("Select all")."' onClick='toggle_all_(\"listing_selected_[0-9]*$\",\"select_all\");' ></td>\n";
}
foreach ($this->header as $header) {
$result.= $header;
}
+ $result.= "</tr></thead>\n";
- // Add 13px for scroller
- $result.= "<td class='listheader' style='width:13px;border-right:0px;'> </td></table></td></tr>\n";
-
- // New table for the real list contents
- $result.= "<tr><td colspan='$this->numColumns' class='scrollbody'><div style='width:600px;height:".($height-20)."px;' id='d_scrollbody' class='scrollbody'><table summary='' style='height:100%;width:581px;' cellspacing='0' id='t_scrollbody'>\n";
+ // Build list body
+ $result.= "<tbody class='listScrollContent listBodyFormat' id='t_nscrollbody' style='height:".$height."px;'>\n";
// No results? Just take an empty colspanned row
if (count($this->entries) + count($this->departments) == 0) {
// Render multi select if needed
if ($this->multiSelect) {
- $result.="<td style='text-align:center;width:20px;' class='list1'> </td>";
+ $result.="<td style='text-align:center;padding:0;' class='list1'> </td>";
}
// Render defined department columns, fill the rest with some stuff
$result.= "</tr>";
}
- $result.= "</table></div></td></tr>";
+ // Close list body
+ $result.= "</tbody></table></div></td></tr>";
// Add the footer if requested
if ($this->showFooter) {
- $result.= "<tr><td class='scrollhead'><table summary='' style='width:100%' cellspacing='0' id='t_scrollfoot'><tr><td class='listfooter' style='border-bottom:0px;'>";
+ $result.= "<tr><td class='nlistFooter'>";
foreach ($this->objectTypes as $objectType) {
if (isset($this->objectTypeCount[$objectType['label']])) {
}
}
- $result.= "<td class='listfooter' style='width:13px;border-right:0px;'> </td></table></td></tr>";
+ $result.= "</td></tr>";
}
- $result.= "</table></div>";
+ // Close list
+ $result.= "</table>";
+ $result.= $switch?"<input type='hidden' id='list_workaround'>":"";
+
+ // Add scroll positioner
+ $result.= '<script type="text/javascript" language="javascript">';
+ $result.= '$("t_nscrollbody").scrollTop= '.$this->scrollPosition.';';
+ $result.= 'var box = $("t_nscrollbody").onscroll= function() {$("position_'.$this->pid.'").value= this.scrollTop;}';
+ $result.= '</script>';
$smarty= get_smarty();
$smarty->assign("usePrototype", "true");
// Assign summary
$smarty->assign("HEADLINE", $this->headline);
- return ($smarty->fetch(get_template_path($this->xmlData['definition']['template'], true)));
+ // Try to load template from plugin the folder first...
+ $file = get_template_path($this->xmlData['definition']['template'], true);
+
+ // ... if this fails, try to load the file from the theme folder.
+ if(!file_exists($file)){
+ $file = get_template_path($this->xmlData['definition']['template']);
+ }
+
+ return ($smarty->fetch($file));
}
return;
}
+ // Save position if set
+ if (isset($_POST['position_'.$this->pid]) && is_numeric($_POST['position_'.$this->pid])) {
+ $this->scrollPosition= $_POST['position_'.$this->pid];
+ }
+
// Save base
if (isset($_POST['BASE']) && $this->baseMode) {
- $base= validate($_POST['BASE']);
+ $base= get_post('BASE');
if (isset($this->bases[$base])) {
$this->base= $base;
session::global_set("CurrentMainBase", $this->base);
if (preg_match('/^department_([0-9]+)$/', validate($_GET['act']), $match)){
if (isset($this->departments[$match[1]])){
$this->base= $this->departments[$match[1]]['dn'];
+ session::global_set("CurrentMainBase", $this->base);
}
}
}
$layout= preg_replace("/^\|/", "", $layout);
$layout= preg_replace("/\|$/", "", $layout);
$cols= split("\|", $layout);
+
foreach ($cols as $index => $config) {
if ($config != "") {
$res= "";
$selected= " selected";
$found= true;
}
- $result.= "<option value='".$key."'$selected>".$value."</option>";
+ $key = htmlentities($key,ENT_QUOTES);
+ $result.= "\n<option value=\"".$key."\"$selected>".$value."</option>";
}
+
$result.= "</select>";
// Reset the currently used base to the first DN we found if there
preg_match_all("/%\{filter:([^(]+)\((.*)\)\}/", $data, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
- if (!isset($this->filters[$match[1]])) {
- continue;
+ $cl= "";
+ $method= "";
+ if (preg_match('/::/', $match[1])) {
+ $cl= preg_replace('/::.*$/', '', $match[1]);
+ $method= preg_replace('/^.*::/', '', $match[1]);
+ } else {
+ if (!isset($this->filters[$match[1]])) {
+ continue;
+ }
+ $cl= preg_replace('/::.*$/', '', $this->filters[$match[1]]);
+ $method= preg_replace('/^.*::/', '', $this->filters[$match[1]]);
}
- $cl= preg_replace('/::.*$/', '', $this->filters[$match[1]]);
- $method= preg_replace('/^.*::/', '', $this->filters[$match[1]]);
// Prepare params for function call
$params= array();
// Row is replaced by the row number
if ($param == "row") {
$params[]= $row;
+ continue;
}
// pid is replaced by the current PID
if ($param == "pid") {
$params[]= $this->pid;
+ continue;
}
// base is replaced by the current base
if ($param == "base") {
$params[]= $this->getBase();
+ continue;
}
// Fixie with "" is passed directly
if (preg_match('/^".*"$/', $param)){
$params[]= preg_replace('/"/', '', $param);
+ continue;
+ }
+
+ // Move dn if needed
+ if ($param == "dn") {
+ $params[]= LDAP::fix($config["dn"]);
+ continue;
}
// LDAP variables get replaced by their objects
unset($values['count']);
}
$params[]= $values;
+ break;
}
}
-
- // Move dn if needed
- if ($param == "dn") {
- $params[]= LDAP::fix($config["dn"]);
- }
}
// Replace information
$result.= "<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
continue;
}
- } else {
+ } elseif (is_string($objectclass)) {
if(!in_array($objectclass, $classes)) {
$result.= "<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
continue;
}
+ } elseif (is_array($objectclass)) {
+ if(count(array_intersect($objectclass, $classes)) != count($objectclass)){
+ $result.= "<img src='images/empty.png' alt=' ' class='center' style='padding:1px'>";
+ continue;
+ }
}
}
}
if ($action['type'] == "copypaste") {
- $result.= $this->renderCopyPasteActions($row, $this->entries[$row]['dn'], $category, $class);
+ $copy = !isset($action['copy']) || $action['copy'] == "true";
+ $cut = !isset($action['cut']) || $action['cut'] == "true";
+ $result.= $this->renderCopyPasteActions($row, $this->entries[$row]['dn'], $category, $class,$copy,$cut);
} else {
$result.= $this->renderSnapshotActions($row, $this->entries[$row]['dn'], $category, $class);
}
return;
}
+ // Save position if set
+ if (isset($_POST['position_'.$this->pid]) && is_numeric($_POST['position_'.$this->pid])) {
+ $this->scrollPosition= $_POST['position_'.$this->pid];
+ }
+
$result= array("targets" => array(), "action" => "");
// Filter GET with "act" attributes
if (isset($action['label'])){
$result.= "<li$separator><a href='#'>$img"._($action['label'])." <img border='0' src='images/forward-arrow.png'></a>";
}
+
+ // Ensure we've an array of actions, this enables sub menus with only one action.
+ if(isset($action['action']['type'])){
+ $action['action'] = array($action['action']);
+ }
+
$result.= $this->recurseActions($action['action'])."</li>";
$level--;
$separator= "";
// Check for special types
switch ($action['type']) {
case 'copypaste':
- $result.= $this->renderCopyPasteMenu($separator);
+ $cut = !isset($action['cut']) || $action['cut'] != "false";
+ $copy = !isset($action['copy']) || $action['copy'] != "false";
+ $result.= $this->renderCopyPasteMenu($separator, $copy , $cut);
break;
case 'snapshot':
}
+ function getEntry($dn)
+ {
+ foreach ($this->entries as $entry) {
+ if (isset($entry['dn']) && strcasecmp($dn, $entry['dn']) == 0){
+ return $entry;
+ }
+ }
+ return null;
+ }
+
+
function getType($dn)
{
if (isset($this->objectDnMapping[$dn])) {