X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Fsystems%2Fclass_baseSelectDialog.inc;h=0a1040c7a22909d72193cfec8ba8122ab60fb998;hb=7a6a428eb1c6534e448094d51bc6a542fe832bb9;hp=9db43a10292897c6d30b79ad993bf54e48949493;hpb=13a0a4239ec38fd208c924cac1d0fb3847bb04ad;p=gosa.git diff --git a/plugins/admin/systems/class_baseSelectDialog.inc b/plugins/admin/systems/class_baseSelectDialog.inc index 9db43a102..0a1040c7a 100644 --- a/plugins/admin/systems/class_baseSelectDialog.inc +++ b/plugins/admin/systems/class_baseSelectDialog.inc @@ -2,32 +2,35 @@ class baseSelectDialog extends MultiSelectWindow { - var $selected_base = ""; // Used for navigation + var $selectedBase = ""; // Used for navigation var $base_selection_regex = "*"; // Used regex ... -// var $Doesnothing = ""; // Checkbox which does nothing - - var $selectedBase = false; // used to specify the selected base, + var $BaseToUse = false; // used to specify the selected base, // false if none is selected var $allowedBases = array(); + var $parent = NULL; - function baseSelectDialog ($config,$onlyAllowThisBases = array()) + function baseSelectDialog ($config,$parent,$onlyAllowThisBases = array()) { - MultiSelectWindow::MultiSelectWindow($config); - - $this->selected_base = $config->current['BASE']; - + echo "Need to pass module via parameter!
"; + $module= "all"; + MultiSelectWindow::MultiSelectWindow($config, "BASEselectWindow", $module); + + $this->parent = $parent; + + $this->selectedBase = $config->current['BASE']; $this->allowedBases = $onlyAllowThisBases; $this->SetTitle("Base"); $this->SetSummary(_("Choose a base")); $this->SetListHeader("
". - "  ". "  ". + "  ". "  ". + "  ". "
"); $this->SetInformation(_("Step in the prefered tree and click save to use the current subtree as base. Or click the image at the end of each entry.")); @@ -36,9 +39,12 @@ class baseSelectDialog extends MultiSelectWindow $this->EnableCloseButton(true); $this->EnableSaveButton (true); + $this->SetSaveButtonString(_("Use")); + $this->SetCloseButtonString(_("Cancel")); + $this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'")); - $this->AddHeader(array("string"=>"Base")); - $this->AddHeader(array("string"=>"Option","attach"=>"style='width:50px;border-right:0px;'")); + $this->AddHeader(array("string"=>_("Base"))); + $this->AddHeader(array("string"=>_("Action"),"attach"=>"style='width:50px;border-right:0px;'")); /* Text ,Value ,Name ,Is selected */ // $this->AddCheckBox("Doesnothing","servers","Doesnothing",true); @@ -57,16 +63,16 @@ class baseSelectDialog extends MultiSelectWindow { $this->ClearElementsList(); $ldap = $this->config->get_ldap_link(); - $ldap->cd($this->selected_base); + $ldap->cd($this->selectedBase); $ldap->ls("(&(objectClass=gosaDepartment) (|(ou=".$this->base_selection_regex.") (cn=".$this->base_selection_regex.") (description=".$this->base_selection_regex.")))", - $this->selected_base,array("ou","description","cn")); + $this->selectedBase,array("ou","description","cn")); $link = "%s"; - $base_back = preg_replace("/^[^,]+,/","",$this->selected_base); + $base_back = preg_replace("/^[^,]+,/","",$this->selectedBase); $base_back = convert_department_dn($base_back); /* Add departments, to be able to switch into them @@ -108,7 +114,7 @@ class baseSelectDialog extends MultiSelectWindow $field1 = array("string" => "department", "attach" => "style='text-align:center;width:20px;'"); $field2 = array("string" => sprintf($link,base64_encode($key),$val), "attach" => "style=''"); - $field3 = array("string" => sprintf(" ",base64_encode($key)), + $field3 = array("string" => sprintf(" ",base64_encode($key)), "attach" => "style='width:50px;border-right:0px;text-align:right;'"); $this->AddElement(array($field1,$field2,$field3)); } @@ -117,26 +123,29 @@ class baseSelectDialog extends MultiSelectWindow function Save() { MultiSelectWindow :: Save(); - $this->selectedBase = $this->selected_base; + $this->BaseToUse = $this->selectedBase; } function isSelected() { - return($this->selectedBase); + return($this->BaseToUse); } function setCurrentBase($base) { - $this->selected_base = $base; + $this->selectedBase = $base; } function save_object() { + /* Save current base */ + $old_base = $this->selectedBase; + /* Save automatic created POSTs like regex, checkboxes */ MultiSelectWindow::save_object(); if(isset($_GET['open_dep'])){ - $this->selected_base = base64_decode($_GET['open_dep']); + $this->selectedBase = base64_decode($_GET['open_dep']); } $s_action =""; @@ -151,33 +160,38 @@ class baseSelectDialog extends MultiSelectWindow $tmp = preg_replace("/^usebase_/","",$key); $tmp = preg_replace("/_.*$/","",$tmp); $tmp = base64_decode($tmp); - $this->selectedBase = $tmp; + $this->BaseToUse = $tmp; } } $ui= get_userinfo(); /* Homebutton is posted */ if($s_action=="home"){ - $this->selected_base=(preg_replace("/^[^,]+,/","",$ui->dn)); - $this->selected_base=(preg_replace("/^[^,]+,/","",$this->selected_base)); + $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn)); + $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase)); } /* back to the roots ^^ */ if($s_action=="root"){ - $this->selected_base=($this->config->current['BASE']); + $this->selectedBase=($this->config->current['BASE']); } /* If Backbutton is Posted */ if($s_action=="back"){ - $base_back = preg_replace("/^[^,]+,/","",$this->selected_base); + $base_back = preg_replace("/^[^,]+,/","",$this->selectedBase); $base_back = convert_department_dn($base_back); if(isset($this->config->departments[trim($base_back)])){ - $this->selected_base= $this->config->departments[trim($base_back)]; + $this->selectedBase= $this->config->departments[trim($base_back)]; }else{ - $this->selected_base= $this->config->departments["/"]; + $this->selectedBase= $this->config->departments["/"]; } } + + /* Restore old base, if selected base is not allowed */ + if(count($this->allowedBases) && !isset($this->allowedBases[$this->selectedBase])){ + $this->selectedBase = $old_base; + } } } // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: