From: hickert Date: Mon, 19 Apr 2010 06:29:20 +0000 (+0000) Subject: Updated listing class to support 'singleSelect'. X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=a75b26dfd0d13bca53a0dc9d355a63e36c9088d7;p=gosa.git Updated listing class to support 'singleSelect'. -Displays 'radio buttons' instead of the 'checkboxes' -This allows us to select a single element, e.g. for the manager attribute. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@17681 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-core/include/class_listing.inc b/gosa-core/include/class_listing.inc index 8b3279817..6ca5c31ae 100644 --- a/gosa-core/include/class_listing.inc +++ b/gosa-core/include/class_listing.inc @@ -28,6 +28,7 @@ class listing { var $departmentBrowser= false; var $departmentRootVisible= false; var $multiSelect= false; + var $singleSelect= false; var $template; var $headline; var $base; @@ -160,7 +161,7 @@ class listing { $this->xmlData= $this->xmlData["list"]; // Load some definition values - foreach (array("departmentBrowser", "departmentRootVisible", "multiSelect", "baseMode") as $token) { + foreach (array("departmentBrowser", "departmentRootVisible", "multiSelect","singleSelect", "baseMode") as $token) { if (isset($this->xmlData['definition'][$token]) && $this->xmlData['definition'][$token] == "true"){ $this->$token= true; @@ -294,11 +295,11 @@ class listing { $result.= "
\n"; $result.= "\n"; - $this->numColumns= count($this->colprops) + ($this->multiSelect?1:0); + $this->numColumns= count($this->colprops) + (($this->multiSelect|$this->singleSelect)?1:0); // Build list header $result.= "\n"; - if ($this->multiSelect) { + if ($this->multiSelect || $this->singleSelect) { $width= "24px"; if (preg_match('/Konqueror/i', $_SERVER['HTTP_USER_AGENT'])){ $width= "28px"; @@ -331,7 +332,7 @@ class listing { $result.=""; // Render multi select if needed - if ($this->multiSelect) { + if ($this->multiSelect || $this->singleSelect) { $result.=""; } @@ -368,6 +369,10 @@ class listing { $trow.="\n"; } + if ($this->singleSelect) { + $trow.="\n"; + } + foreach ($this->xmlData['table']['column'] as $index => $config) { $renderedCell= $this->renderCell($config['value'], $entry, $row); $trow.="\n"; @@ -1064,6 +1069,12 @@ class listing { return $result; } + // Get single selection (radio box) + if($this->singleSelect && isset($_POST['listing_radio_selected'])){ + $entry = $_POST['listing_radio_selected']; + $result['targets']= array($this->entries[$entry]['dn']); + } + // Filter POST with "listing_" attributes foreach ($_POST as $key => $prop) {
 colprops[$index]." class='list0'>".$renderedCell."