X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_listing.inc;h=3b83e0811adcc73b06f1a2e398003d61833b6611;hb=2c7257e5e02afafdfd3a6c4457c6b87467f26eae;hp=10c05d9652012ebf1b6fcb3bc843858a37747f95;hpb=90322901f59dbad1114f433b0e7aa974d3348d1b;p=gosa.git diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index 10c05d965..3b83e0811 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -256,6 +256,7 @@ class listing { } } + function render() { // Check for exeeded sizelimit @@ -263,6 +264,13 @@ class listing { 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= "\n"; $height= 450; @@ -271,25 +279,31 @@ class listing { $height= $this->height; } - $result.= "
\n"; - $result.= " -"; // Add the footer if requested if ($this->showFooter) { - $result.= ""; + $result.= ""; } - $result.= "
\n"; + $result.= "
\n"; - - // New table for the real list contents - $result.= ""; + // Close list body + $result.= "
\n"; + + $height= ""; + if ($switch){ + $height= "height:100%;"; + } + $result.= "\n"; $this->numColumns= count($this->colprops) + ($this->multiSelect?1:0); // Build list header - $result.= "\n"; + $result.= "\n"; if ($this->multiSelect) { - $result.= "\n"; + $width= "24px"; + if (preg_match('/Konqueror/i', $_SERVER['HTTP_USER_AGENT'])){ + $width= "28px"; + } + $result.= "\n"; } foreach ($this->header as $header) { $result.= $header; } + $result.= "\n"; - // Add 13px for scroller - $result.= "
 
\n"; + // Build list body + $result.= "\n"; // No results? Just take an empty colspanned row if (count($this->entries) + count($this->departments) == 0) { @@ -310,7 +324,7 @@ class listing { // Render multi select if needed if ($this->multiSelect) { - $result.=""; + $result.=""; } // Render defined department columns, fill the rest with some stuff @@ -390,11 +404,12 @@ class listing { $result.= ""; } - $result.= "
  
"; + $result.= "
"; foreach ($this->objectTypes as $objectType) { if (isset($this->objectTypeCount[$objectType['label']])) { @@ -403,10 +418,12 @@ class listing { } } - $result.= " 
"; + // Close list + $result.= ""; + $result.= $switch?"":""; $smarty= get_smarty(); $smarty->assign("usePrototype", "true"); @@ -462,6 +479,7 @@ class listing { 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); } } } @@ -665,11 +683,18 @@ class listing { 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(); @@ -679,21 +704,31 @@ class listing { // 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 @@ -704,13 +739,9 @@ class listing { unset($values['count']); } $params[]= $values; + break; } } - - // Move dn if needed - if ($param == "dn") { - $params[]= LDAP::fix($config["dn"]); - } } // Replace information @@ -850,7 +881,9 @@ class listing { } 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); } @@ -1113,7 +1146,9 @@ class listing { // 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': @@ -1472,6 +1507,17 @@ class listing { } + 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])) {