X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=include%2Fclass_MultiSelectWindow.inc;h=9dd83864c87abca7542ae2ccb0f2686a501b7a49;hb=e1d95c29272ce8b78eb366517e668aa6f49736a2;hp=f1cdb16526be02e79a588c5f52e2b6fc85a031c7;hpb=b2063c6fb6bc26b78104ee1184309f70a6b1cd08;p=gosa.git
diff --git a/include/class_MultiSelectWindow.inc b/include/class_MultiSelectWindow.inc
index f1cdb1652..9dd83864c 100644
--- a/include/class_MultiSelectWindow.inc
+++ b/include/class_MultiSelectWindow.inc
@@ -1,5 +1,7 @@
array_Elements = array();
}
- function AddRegex($name,$string,$value,$conn)
+ 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 */
+ if(isset($_SESSION['MultiDialogFilters'][$this->filterName][$name])){
+ $arr['value'] = $_SESSION['MultiDialogFilters'][$this->filterName][$name];
+ $this->$name = $arr['value'];
+ }else{
+ $arr['value'] = $value;
+ }
+
$arr['name'] = $name;
$arr['string'] = $string;
- $arr['value'] = $value;
+ $arr['image'] = $image;
$arr['connAlpha'] = $conn; // Connect with alphabet select
$this->array_Regexes[] = $arr;
}
- function MultiSelectWindow($config){
+ /* Contrucktion */
+ function MultiSelectWindow($config,$filterName)
+ {
$this->config = $config;
$this->SaveButtonString = _("Save");
$this->CloseButtonString = _("Close");
+ $this->filterName = $filterName;
+
+ $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];
+ }
+ }
+
}
- function SetTitle($str){
+ /* Enables the headpage mode, which changes the list look */
+ function SetHeadpageMode()
+ {
+ $this->is_headpage = true;
+ }
+
+ /* Sets the List internal name (not displayed anywhere)
+ it is used to identify every single list
+ */
+ function SetTitle($str)
+ {
$this->string_Title = $str;
}
- function SetListHeader($str){
+ /* Set the list header string */
+ function SetListHeader($str)
+ {
$this->string_ListHeader = $str;
}
- function SetSummary($str){
+ /* This sets the list description which is the first gray bar on top of the list */
+ function SetSummary($str)
+ {
$this->string_Summary = $str;
}
- function SetSaveButtonString($str){
+ /* If the save button is enabled, you can change its caption with this function */
+ function SetSaveButtonString($str)
+ {
$this->SaveButtonString = $str;
}
- function SetCloseButtonString($str){
+ /* If the close button is enabled, you can change its caption with this function */
+ function SetCloseButtonString($str)
+ {
$this->CloseButtonString = $str;
}
- function SetInformation($str){
+ /* With this function you can change the text of the information box */
+ function SetInformation($str)
+ {
$this->string_Information = $str;
}
- function EnableAplhabet($bool){
+ /* Display the alphabet selection box*/
+ function EnableAplhabet($bool)
+ {
$this->bool_DisplayAlpahabet = $bool;
}
- function AddHeader($arr){
+ /* Add additional header col */
+ function AddHeader($arr)
+ {
$this->array_Header[] = $arr;
}
- function AddElement($arr){
+ /* add additional List element */
+ function AddElement($arr)
+ {
$this->array_Elements[] = $arr;
}
- function AddCheckBox($name,$value,$string,$default){
+ /* Add a checkbox to the filter element,
+ the name specifies an existing class var to store the 'selection' */
+ function AddCheckBox($name,$value="Unset",$string="Unset",$default=false)
+ {
$arr = array();
- $arr['name'] = $name;
- $arr['string'] = $string;
- $arr['value'] = $value;
- $arr['default'] = $default;
+
+ if($name == SEPERATOR){
+ $arr['name'] = SEPERATOR;
+ }else{
+ /* 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;
+
+ }
$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()
{
return($this->is_closed);
}
+ /* Enable the close button */
function EnableCloseButton($bool)
{
$this->bool_DisplayCloseButton = $bool;
}
+ /* Enable the save button on the bottom of the list*/
function EnableSaveButton ($bool)
{
$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
+
+ if($this->DivHeight != ""){
+ $divlist->SetHeight($this->DivHeight);
+ }
/* set Header informations
*/
@@ -132,10 +260,20 @@ class MultiSelectWindow{
$boxes = "";
$boxClick = " onClick='document.mainform.submit();' ";
foreach($this->array_Checkboxes as $box){
+
+ if($box['name'] == SEPERATOR){
+ $boxes .= "