From b2063c6fb6bc26b78104ee1184309f70a6b1cd08 Mon Sep 17 00:00:00 2001 From: hickert Date: Mon, 27 Feb 2006 07:42:38 +0000 Subject: [PATCH] A git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@2740 594d385d-05f5-0310-b6e9-bd551577e9d8 --- ihtml/themes/altlinux/MultiSelectWindow.tpl | 70 ++++++ ihtml/themes/default/MultiSelectWindow.tpl | 70 ++++++ include/class_MultiSelectWindow.inc | 253 ++++++++++++++++++++ plugins/admin/systems/class_servDHCP.inc | 27 +-- plugins/personal/generic/class_user.inc | 29 ++- plugins/personal/generic/generic.tpl | 4 + 6 files changed, 434 insertions(+), 19 deletions(-) create mode 100644 ihtml/themes/altlinux/MultiSelectWindow.tpl create mode 100644 ihtml/themes/default/MultiSelectWindow.tpl create mode 100644 include/class_MultiSelectWindow.inc diff --git a/ihtml/themes/altlinux/MultiSelectWindow.tpl b/ihtml/themes/altlinux/MultiSelectWindow.tpl new file mode 100644 index 000000000..d03f4e339 --- /dev/null +++ b/ihtml/themes/altlinux/MultiSelectWindow.tpl @@ -0,0 +1,70 @@ + + + + + +
+
+

+ {$Summary} +

+
+
+ {$Header} +
+
+
+
+ {$DivList} + +
+
+
+

+ [i]{t}Information{/t} +

+
+
+ {$Information} +
+
+
+

+ [F]{t}Filters{/t} +

+
+
+ {if $Display_alphabet} + + {$alphabet} +
+ {/if} + { if $CheckBoxes != ""} + + + + +
+ {$CheckBoxes} +
+ {/if} + {$regexes} + {$apply} +
+
+

  +

+
+

+ {if $Display_Save} + + {/if} + {if $Display_Close} + + {/if} +

+
+ + + + diff --git a/ihtml/themes/default/MultiSelectWindow.tpl b/ihtml/themes/default/MultiSelectWindow.tpl new file mode 100644 index 000000000..d03f4e339 --- /dev/null +++ b/ihtml/themes/default/MultiSelectWindow.tpl @@ -0,0 +1,70 @@ + + + + + +
+
+

+ {$Summary} +

+
+
+ {$Header} +
+
+
+
+ {$DivList} + +
+
+
+

+ [i]{t}Information{/t} +

+
+
+ {$Information} +
+
+
+

+ [F]{t}Filters{/t} +

+
+
+ {if $Display_alphabet} + + {$alphabet} +
+ {/if} + { if $CheckBoxes != ""} + + + + +
+ {$CheckBoxes} +
+ {/if} + {$regexes} + {$apply} +
+
+

  +

+
+

+ {if $Display_Save} + + {/if} + {if $Display_Close} + + {/if} +

+
+ + + + diff --git a/include/class_MultiSelectWindow.inc b/include/class_MultiSelectWindow.inc new file mode 100644 index 000000000..f1cdb1652 --- /dev/null +++ b/include/class_MultiSelectWindow.inc @@ -0,0 +1,253 @@ +array_Elements = array(); + } + + function AddRegex($name,$string,$value,$conn) + { + $arr = array(); + $arr['name'] = $name; + $arr['string'] = $string; + $arr['value'] = $value; + $arr['connAlpha'] = $conn; // Connect with alphabet select + $this->array_Regexes[] = $arr; + } + + function MultiSelectWindow($config){ + $this->config = $config; + $this->SaveButtonString = _("Save"); + $this->CloseButtonString = _("Close"); + } + + function SetTitle($str){ + $this->string_Title = $str; + } + + function SetListHeader($str){ + $this->string_ListHeader = $str; + } + + function SetSummary($str){ + $this->string_Summary = $str; + } + + function SetSaveButtonString($str){ + $this->SaveButtonString = $str; + } + + function SetCloseButtonString($str){ + $this->CloseButtonString = $str; + } + + function SetInformation($str){ + $this->string_Information = $str; + } + + function EnableAplhabet($bool){ + $this->bool_DisplayAlpahabet = $bool; + } + + function AddHeader($arr){ + $this->array_Header[] = $arr; + } + + function AddElement($arr){ + $this->array_Elements[] = $arr; + } + + function AddCheckBox($name,$value,$string,$default){ + $arr = array(); + $arr['name'] = $name; + $arr['string'] = $string; + $arr['value'] = $value; + $arr['default'] = $default; + $this->array_Checkboxes[] = $arr; + } + + function isClosed() + { + return($this->is_closed); + } + + function EnableCloseButton($bool) + { + $this->bool_DisplayCloseButton = $bool; + } + + function EnableSaveButton ($bool) + { + $this->bool_DisplaySaveButton = $bool; + } + + function Draw() + { + $smarty = get_smarty(); + + $divlist = new divlist($this->string_Title); + $divlist->SetSummary($this->string_Summary); + $divlist->SetEntriesPerPage(0); // 0 for scrollable list + + /* set Header informations + */ + $header = array(); + foreach($this->array_Header as $head){ + $header[] = $head; + } + $divlist->SetHeader($header); + + /* set Entries + */ + $elements = array(); + foreach($this->array_Elements as $element){ + $divlist->AddEntry($element); + } + + /* Create checkboxes fields + */ + $boxes = ""; + $boxClick = " onClick='document.mainform.submit();' "; + foreach($this->array_Checkboxes as $box){ + if($box['default'] == true){ + $boxes .=" ".$box['string']."
"; + }else{ + $boxes .=" ".$box['string']."
"; + } + } + $smarty->assign("CheckBoxes", $boxes); + + /* Assign regex fields + */ + $regexes = ""; + foreach($this->array_Regexes as $regex){ + $regexes.=" + + + + +
+ + + +
"; + } + $smarty->assign("regexes" , $regexes ); + + /* Assign alphabet and display it + */ + $smarty->assign("Display_alphabet", $this->bool_DisplayAlpahabet); + $smarty->assign("alphabet", generate_alphabet()); + + $smarty->assign("Header" , $this->string_ListHeader ); + $smarty->assign("Summary" , $this->string_Summary); + $smarty->assign("Title" , $this->string_Title); + $smarty->assign("Information" , $this->string_Information); + + $smarty->assign("DivList" , $divlist->DrawList()); + + $smarty->assign("search_image", get_template_path('images/search.png')); + $smarty->assign("searchu_image", get_template_path('images/search_user.png')); + $smarty->assign("tree_image", get_template_path('images/tree.png')); + $smarty->assign("infoimage", get_template_path('images/info_small.png')); + $smarty->assign("launchimage", get_template_path('images/rocket.png')); + $smarty->assign("apply", apply_filter()); + + /* Button handling */ + $smarty->assign("SaveButtonString" ,$this->SaveButtonString); + $smarty->assign("CloseButtonString",$this->CloseButtonString); + + $smarty->assign("Display_Close", $this->bool_DisplayCloseButton); + $smarty->assign("Display_Save" , $this->bool_DisplaySaveButton); + + $display = $smarty->fetch(get_template_path("MultiSelectWindow.tpl")); + return($display); + } + + function Close() + { + $this->is_closed = true; + } + + function Save() + { + $this->is_saved = true; + } + + function save_object() + { + if(isset($_POST['MultiSelectWindow'])){ + + /* Check posts from checkboxes + */ + foreach($this->array_Checkboxes as $key => $box){ + if(isset($_POST[$box['name']])){ + $this->array_Checkboxes[$key]['default'] = true; + $this->$box['name'] = true; + }else{ + $this->array_Checkboxes[$key]['default'] = false; + $this->$box['name'] = false; + } + } + + /* Check regex posts */ + foreach($this->array_Regexes as $key => $box){ + $this->array_Regexes[$key]['value'] = $_POST[$box['name']]; + $this->$box['name'] = $_POST[$box['name']]; + } + + /* call close/save if buttons are pressed */ + if(isset($_POST['CloseMultiSelectWindow'])){ + $this->Close(); + } + + if(isset($_POST['SaveMultiSelectWindow'])){ + $this->Save(); + } + } + + /* check for alphabet selection + Check which regexes are connected to the alphabet + */ + if(isset($_GET['search'])){ + foreach($this->array_Regexes as $key => $box){ + /* check if this regex is connected to the alphabet selection */ + if(($box['connAlpha'])&&(isset($_GET['search']))){ + $val = $_GET['search']."*"; + $val = preg_replace("/\*\**/","*",$val); + $this->array_Regexes[$key]['value'] = $val; + $this->$box['name'] = $val; + } + } + } + + } +} + +?> diff --git a/plugins/admin/systems/class_servDHCP.inc b/plugins/admin/systems/class_servDHCP.inc index 9f4a6e867..4ab97ed61 100644 --- a/plugins/admin/systems/class_servDHCP.inc +++ b/plugins/admin/systems/class_servDHCP.inc @@ -12,34 +12,29 @@ class servdhcp extends plugin var $attributes= array(); var $objectclasses= array("whatever"); + var $dialog ; + function servdhcp ($config, $dn= NULL) { plugin::plugin ($config, $dn); + $this->dialog = new baseSelectDialog($config); } function execute() { - /* Call parent execute */ - plugin::execute(); - /* Fill templating stuff */ $smarty= get_smarty(); $display= ""; - /* Do we need to flip is_account state? */ - if (isset($_POST['modify_state'])){ - $this->is_account= !$this->is_account; - } - - /* Show tab dialog headers */ - if ($this->is_account){ - $display= $this->show_header(_("Remove DHCP service"), - _("This server has DHCP features enabled. You can disable them by clicking below.")); - } else { - $display= $this->show_header(_("Add DHCP service"), - _("This server has DHCP features disabled. You can enable them by clicking below.")); - return ($display); + $this->dialog->save_object(); + if($this->dialog->isSelected()){ + $base = $this->dialog->isSelected(); + } + if($this->dialog->isClosed()){ + echo "blub"; } + echo $base; + return($this->dialog->execute()); $display.= $smarty->fetch(get_template_path('servdhcp.tpl', TRUE)); return($display); diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index bcbd2d14c..7e3d3f45c 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -76,6 +76,8 @@ class user extends plugin var $role= ""; var $publicVisible= ""; + var $dialog; + /* variables to trigger password changes */ var $pw_storage= "crypt"; var $last_pw_storage= "unset"; @@ -206,8 +208,8 @@ class user extends plugin /* execute generates the html output for this node */ function execute() { - /* Call parent execute */ - plugin::execute(); + /* Call parent execute */ + plugin::execute(); $smarty= get_smarty(); @@ -269,6 +271,27 @@ class user extends plugin return; } + /* Base select dialog */ + if(isset($_POST['chooseBase'])){ + $this->dialog = new baseSelectDialog($this->config); + $this->dialog->setCurrentBase($this->base); + } + + /* Dialog handling */ + if(is_object($this->dialog)){ + /* Must be called before save_object */ + $this->dialog->save_object(); + + if($this->dialog->isClosed()){ + $this->dialog = false; + }elseif($this->dialog->isSelected()){ + $this->base = $this->dialog->isSelected(); + $this->dialog= false; + }else{ + return($this->dialog->execute()); + } + } + /* Want picture edit dialog? */ if (isset($_POST['edit_picture'])){ /* Save values for later recovery, in case some presses @@ -442,7 +465,7 @@ class user extends plugin /* Show us the edit screen */ @$smarty->assign("bases", $this->allowedBasesToMoveTo()); # $smarty->assign("bases", $this->config->idepartments); - $smarty->assign("base_select", $this->base); + $smarty->assign("base_select", trim($this->config->idepartments[$this->base])); $smarty->assign("selectmode", chkacl($this->acl, "create")); $smarty->assign("certificatesACL", chkacl($this->acl, "certificates")); $smarty->assign("jpegPhotoACL", chkacl($this->acl, "jpegPhoto")); diff --git a/plugins/personal/generic/generic.tpl b/plugins/personal/generic/generic.tpl index 81fd56016..d8bbab58f 100644 --- a/plugins/personal/generic/generic.tpl +++ b/plugins/personal/generic/generic.tpl @@ -110,9 +110,13 @@
+ + {$base_select} + -- 2.30.2