X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_MultiSelectWindow.inc;h=bc99ac9f1857a4d9cf972d3cb67958ec1b694422;hb=cf52f2875e8d24c2985898e38bfe03acf8900e44;hp=80e6fe9b2dcd3616a0ab48c4bd2574c6831ea341;hpb=ed90d35413277b398788bae7f32121873af30f46;p=gosa.git
diff --git a/include/class_MultiSelectWindow.inc b/include/class_MultiSelectWindow.inc
index 80e6fe9b2..bc99ac9f1 100644
--- a/include/class_MultiSelectWindow.inc
+++ b/include/class_MultiSelectWindow.inc
@@ -1,5 +1,7 @@
array_Elements = array();
}
+ function HideFilterPart($bool = true)
+ {
+ $this->HideFilterPart = $bool;
+ }
+
+ function SetHeight($height)
+ {
+ $this->DivHeight=$height;
+ }
+
/* Adds a regex input field to the current dialog */
function AddRegex($name,$string,$value,$conn,$image="images/search.png")
{
$arr = array();
-
+
/* Check if the given input field name was already used
- for this type of dialog */
+ for this type of dialog */
if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
$arr['value'] = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
$this->$name = $arr['value'];
@@ -54,13 +74,51 @@ class MultiSelectWindow{
$this->array_Regexes[] = $arr;
}
+
+ function SetDropDownHeaderMenu($str)
+ {
+ $this->string_ListDropDown = $str;
+ }
+
+ function GetDropDownHeaderMenu()
+ {
+ if(!empty($this->string_ListDropDown)){
+ $mid = new LayersMenu(6, 7, 2, 1);
+ $mid->setImgwww("./images/");
+ $mid->setIcondir("./images/");
+ $mid->setDirroot("/storage/hickert/gosa/include/php_layers_menu/");
+ $mid->setHorizontalMenuTpl('GOsa_MultiSelectHeader.ihtml');
+ $mid->setMenuStructureString($this->string_ListDropDown);
+ $mid->parseStructureForMenu('menu');
+ $mid->newHorizontalMenu('menu');
+ $s = $mid->getHeader();
+ $s.= $mid->getMenu('menu');
+ $s.= $mid->getFooter('menu');
+ return($s);
+ }else{
+ return("");
+ }
+ }
+
+
/* Contrucktion */
- function MultiSelectWindow($config,$filterName)
+ function MultiSelectWindow(&$config, $filterName, $module)
{
- $this->config = $config;
+ $this->config = &$config;
+ $this->module = $module;
$this->SaveButtonString = _("Save");
$this->CloseButtonString = _("Close");
$this->filterName = $filterName;
+ $this->ui = get_userinfo();
+ $this->selectedBase = $_SESSION['CurrentMainBase'];
+
+ /* Check default values for SaveAdditionalVars */
+ foreach($this->SaveAdditionalVars as $name){
+ if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
+ $this->$name = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
+ }
+ }
+
}
/* Enables the headpage mode, which changes the list look */
@@ -70,8 +128,8 @@ class MultiSelectWindow{
}
/* Sets the List internal name (not displayed anywhere)
- it is used to identify every single list
- */
+ it is used to identify every single list
+ */
function SetTitle($str)
{
$this->string_Title = $str;
@@ -125,27 +183,102 @@ class MultiSelectWindow{
$this->array_Elements[] = $arr;
}
+
+ /* Return default header part. With back, home and root icons and department selection */
+ function get_default_header()
+ {
+ $enable_back = TRUE;
+ $enable_root = TRUE;
+ $enable_home = TRUE;
+
+ $ui = get_userinfo();
+
+ /* Check if selectedBase = first available base */
+ $deps = $ui->get_module_departments($this->module);
+
+ if(!count($deps) || $deps[0] == $this->selectedBase){
+ $enable_back = FALSE;
+ $enable_root = FALSE;
+ }
+
+ $listhead ="";
+
+ /* Check if we are in users home department */
+ if(!count($deps) ||$this->selectedBase == get_base_from_people($ui->dn)){
+ $enable_home = FALSE;
+ }
+
+ /* Draw root button */
+ if($enable_root){
+ $listhead .= " ";
+ }else{
+ $listhead .= " ";
+ }
+
+ /* Draw back button */
+ if($enable_back){
+ $listhead .= " ";
+ }else{
+ $listhead .= "
";
+ }
+
+ /* Draw home button */
+ if($enable_home){
+ $listhead .= " ";
+ }else{
+ $listhead .= "
";
+ }
+
+ /* And at least draw reload button, this button is enabled everytime */
+ $listhead .= " ".
+ "
";
+
+ return ($listhead);
+ }
+
/* Add a checkbox to the filter element,
- the name specifies an existing class var to store the 'selection' */
- function AddCheckBox($name,$value,$string,$default)
+ the name specifies an existing class var to store the 'selection' */
+ function AddCheckBox($name,$value="Unset",$string="Unset",$default=false)
{
$arr = array();
-
- /* Check if there was already a variable
- for this dialog which we should use instead of the default*/
- if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
- $arr['default'] = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
- $this->$name = $arr['default'];
+
+ if($name == SEPERATOR){
+ $arr['name'] = SEPERATOR;
}else{
- $arr['default'] = $default;
- }
+ /* Check if there was already a variable
+ for this dialog which we should use instead of the default*/
+ if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
+ $arr['default'] = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
+ $this->$name = $arr['default'];
+ }else{
+ $arr['default'] = $default;
+ $this->$name = $default;
+ }
+ $arr['name'] = $name;
+ $arr['string'] = $string;
+ $arr['value'] = $value;
+ $arr['enabled'] = true;
- $arr['name'] = $name;
- $arr['string'] = $string;
- $arr['value'] = $value;
+ }
$this->array_Checkboxes[] = $arr;
}
+
+ /* Hides or unhides the checkbox with the given name */
+ function DisableCheckBox($name,$HideShow = false)
+ {
+ foreach($this->array_Checkboxes as $key => $chkbox){
+ if($chkbox['name'] == $name){
+ $this->array_Checkboxes[$key]['enabled'] = $HideShow;
+ }
+ }
+ }
+
+
/* Returns true if the close button was pressed */
function isClosed()
{
@@ -164,14 +297,41 @@ class MultiSelectWindow{
$this->bool_DisplaySaveButton = $bool;
}
+ /* Add a list specific filter object to position
+ 1 on top of Information
+ 2 Between Information && Filter
+ 3 Below the Filter Part */
+ function AddUserBoxToFilter($position)
+ {
+ return("");
+ }
+
/* Draw the list with all list elements and filters */
function Draw()
{
+
+ /* Check for exeeded sizelimit */
+ if (($message= check_sizelimit()) != ""){
+ return($message);
+ }
+
$smarty = get_smarty();
+ $smarty->assign("UserBox1",$this->AddUserBoxToFilter(1));
+ $smarty->assign("UserBox2",$this->AddUserBoxToFilter(2));
+ $smarty->assign("UserBox3",$this->AddUserBoxToFilter(3));
$divlist = new divlist($this->string_Title);
$divlist->SetSummary($this->string_Summary);
- $divlist->SetEntriesPerPage(0); // 0 for scrollable list
+ $divlist->SetEntriesPerPage(0); // 0 for scrollable list
+
+ /* Display list footer with summary of all listed entries */
+ if(isset($this->config->data['MAIN']['LIST_SUMMARY']) && preg_match("/true/i",$this->config->data['MAIN']['LIST_SUMMARY'])){
+ $divlist->SetFooter($this->get_List_Bottom_Info());
+ }
+
+ if($this->DivHeight != ""){
+ $divlist->SetHeight($this->DivHeight);
+ }
/* set Header informations
*/
@@ -193,10 +353,20 @@ class MultiSelectWindow{
$boxes = "";
$boxClick = " onClick='document.mainform.submit();' ";
foreach($this->array_Checkboxes as $box){
+
+ if($box['name'] == SEPERATOR){
+ $boxes .= "
";
+ continue;
+ }
+
+ /* Skip disabled boxes */
+ if(!$box['enabled']) continue;
+
+ /* Check if box is checked */
if($box['default'] == true){
- $boxes .=" ".$box['string']." "; + $boxes .=" ".$box['string']." "; }else{ - $boxes .=" ".$box['string']." "; + $boxes .=" ".$box['string']." "; } } $smarty->assign("CheckBoxes", $boxes); @@ -213,24 +383,33 @@ class MultiSelectWindow{ |
- + |