X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=gosa-core%2Finclude%2Fclass_listing.inc;h=911c904f06dc254c12121b74081c25d0b17e3bc8;hb=d80790d56d1589784e14cef534cc2c1a7590fd9d;hp=89f383f668555e5be929cc5901d9f9962ac0f4c7;hpb=27521bfa376ff381f9340ad85abb4bd84c7dc264;p=gosa.git diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index 89f383f66..911c904f0 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -49,7 +49,8 @@ class listing { var $snapshotHandler= null; var $exporter= array(); var $exportColumns= array(); - var $showExporter= false; + var $useSpan= false; + var $height= 0; function listing($filename) @@ -65,11 +66,15 @@ class listing { } // Set base for filter - $this->base= session::global_get("CurrentMainBase"); - if ($this->base == null) { + if ($this->baseMode) { + $this->base= session::global_get("CurrentMainBase"); + if ($this->base == null) { + $this->base= $config->current['BASE']; + } + $this->refreshBasesList(); + } else { $this->base= $config->current['BASE']; } - $this->refreshBasesList(); // Move footer information $this->showFooter= ($config->get_cfg_value("listSummary") == "true"); @@ -84,7 +89,9 @@ class listing { foreach($class_mapping as $class => $dummy) { if (preg_match('/Exporter$/', $class)) { $info= call_user_func(array($class, "getInfo")); - $this->exporter= array_merge($this->exporter, $info); + if ($info != null) { + $this->exporter= array_merge($this->exporter, $info); + } } } } @@ -96,6 +103,12 @@ class listing { } + function setHeight($height) + { + $this->height= $height; + } + + function setSnapshotHandler($handler) { $this->snapshotHandler= &$handler; @@ -109,7 +122,6 @@ class listing { $this->departments= $this->getDepartments(); } $this->filter->setBase($this->base); - $this->entries= $this->filter->query(); } @@ -252,8 +264,14 @@ class listing { // Initialize list $result= "\n"; + $height= 450; + if ($this->height != 0) { + $result= "\n"; + $height= $this->height; + } + $result.= "
\n"; - $result.= " + $result.= "
\n"; // New table for the real list contents - $result.= "
\n"; $this->numColumns= count($this->colprops) + ($this->multiSelect?1:0); @@ -270,7 +288,7 @@ class listing { $result.= "
 
\n"; + $result.= "
\n"; // No results? Just take an empty colspanned row if (count($this->entries) + count($this->departments) == 0) { @@ -282,6 +300,7 @@ class listing { $deps= 0; // Draw department browser if configured and we're not in sub mode + $this->useSpan= false; if ($this->departmentBrowser && $this->filter->scope != "sub") { // Fill with department browser if configured this way $departmentIterator= new departmentSortIterator($this->departments, $this->sortDirection[$this->sortColumn]); @@ -299,6 +318,7 @@ class listing { $colspan= 1; if (isset($config['span'])){ $colspan= $config['span']; + $this->useSpan= true; } $result.=""; $rest-= $colspan; @@ -331,6 +351,7 @@ class listing { // Save rendered column $sort= preg_replace('/.*>([^<]+)<.*$/', '$1', $renderedCell); + $sort= preg_replace('/ /', '', $sort); if (preg_match('/entries) + $deps == 0)?"border:0;":""; + $emptyListStyle= (count($this->entries) + (($this->useSpan && count($this->entries))?$deps:0) == 0)?"border:0;":""; if ((count($this->entries) + $deps) < 22) { $result.= ""; for ($i= 0; $i<$this->numColumns; $i++) { @@ -386,12 +407,6 @@ class listing { $result.= "
colprops[$index]." class='list1'>".$this->renderCell($config['value'], $entry, $row)."
"; - // Open export window? - if ($this->showExporter) { - $result.= ""; - $this->showExporter= false; - } - $smarty= get_smarty(); $smarty->assign("FILTER", $this->filter->render()); $smarty->assign("SIZELIMIT", print_sizelimit_warning()); @@ -431,7 +446,7 @@ class listing { } // Save base - if (isset($_POST['BASE']) && $this->baseMode == true) { + if (isset($_POST['BASE']) && $this->baseMode) { $base= validate($_POST['BASE']); if (isset($this->bases[$base])) { $this->base= $base; @@ -448,16 +463,14 @@ class listing { } // Filter POST with "act" attributes -> posted from action menu - if (isset($_POST['act']) && $_POST['act'] != '') { + if (isset($_POST['exec_act']) && $_POST['act'] != '') { if (preg_match('/^export.*$/', $_POST['act']) && isset($this->exporter[$_POST['act']])) { $exporter= $this->exporter[$_POST['act']]; - $instance= new $exporter['class']($this->plainHeader, $this->entries, $this->exportColumns); + $userinfo= ", "._("created by")." ".$ui->cn." - ".strftime('%A, %d. %B %Y, %H:%M:%S'); + $instance= new $exporter['class']($this->headline.$userinfo, $this->plainHeader, $this->entries, $this->exportColumns); $type= call_user_func(array($exporter['class'], "getInfo")); $type= $type[$_POST['act']]; - session::set('binarytype', $type['mime']); - session::set('binaryfile', $type['filename']); - session::set('binary', $instance->query()); - $this->showExporter= true; + send_binary_content($instance->query(), $type['filename'], $type= $type['mime']); } } @@ -596,6 +609,10 @@ class listing { function renderBase() { + if (!$this->baseMode) { + return; + } + $result= "". + $result= "
". "