diff --git a/plugins/admin/systems/class_baseSelectDialog.inc b/plugins/admin/systems/class_baseSelectDialog.inc
index d91da77aa904a8846eec68756233bb2698bacba8..a2569d644fd067be9e79a2c22d874469839cb7e0 100644 (file)
class baseSelectDialog extends MultiSelectWindow
{
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 $base_selection_regex = "*"; // Used regex ...
// var $Doesnothing = ""; // Checkbox which does nothing
- var $selectedBase = false; // used to specify the selected base,
- // false if none is selected
- function baseSelectDialog ($config)
+ var $BaseToUse = false; // used to specify the selected base,
+ // false if none is selected
+
+ var $allowedBases = array();
+
+ function baseSelectDialog ($config,$onlyAllowThisBases = array())
{
{
- MultiSelectWindow::MultiSelectWindow($config);
+ MultiSelectWindow::MultiSelectWindow($config,"BASEselectWindow");
- $this->selected_base = $config->current['BASE'];
+ $this->selectedBase = $config->current['BASE'];
+ $this->allowedBases = $onlyAllowThisBases;
+
$this->SetTitle("Base");
$this->SetSummary(_("Choose a base"));
$this->SetListHeader("<div style='background:#F0F0F9;padding:5px;'>".
$this->SetTitle("Base");
$this->SetSummary(_("Choose a base"));
$this->SetListHeader("<div style='background:#F0F0F9;padding:5px;'>".
- " <input class='center' type='image' align='middle' src='images/list_back.png'
- title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <input class='center' type='image' src='images/list_root.png' align='middle'
title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
" <input class='center' type='image' src='images/list_root.png' align='middle'
title='"._("Go to root department")."' name='dep_root' alt='"._("Root")."'> ".
+ " <input class='center' type='image' align='middle' src='images/list_back.png'
+ title='"._("Go up one department")."' alt='"._("Up")."' name='dep_back'> ".
" <input class='center' type='image' align='middle' src='images/list_home.png'
title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
" <input class='center' type='image' align='middle' src='images/list_home.png'
title='"._("Go to users department")."' alt='"._("Home")."' name='dep_home'> ".
+ " <input class='center' type='image' src='images/list_reload.png' align='middle' title='"._("Reload list")."' name='submit_department' alt='"._("Submit")."'> ".
"</div>");
$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."));
"</div>");
$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."));
$this->EnableCloseButton(true);
$this->EnableSaveButton (true);
$this->EnableCloseButton(true);
$this->EnableSaveButton (true);
+ $this->SetSaveButtonString(_("Use"));
+ $this->SetCloseButtonString(_("Cancel"));
+
$this->AddHeader(array("string"=>" ","attach"=>"style='width:20px;'"));
$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);
/* Text ,Value ,Name ,Is selected */
// $this->AddCheckBox("Doesnothing","servers","Doesnothing",true);
function setEntries()
{
$this->ClearElementsList();
function setEntries()
{
$this->ClearElementsList();
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->selected_base);
- $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"));
$link = "<a href='?plug=".$_GET['plug']."&open_dep=%s'>%s</a>";
$link = "<a href='?plug=".$_GET['plug']."&open_dep=%s'>%s</a>";
- $base_back = preg_replace("/^[^,]+,/","",$this->selected_base);
+ $base_back = preg_replace("/^[^,]+,/","",$this->selectedBase);
$base_back = convert_department_dn($base_back);
$base_back = convert_department_dn($base_back);
+
+ $filter = "(&(objectClass=gosaDepartment)".
+ "(|(ou=".$this->base_selection_regex.")".
+ "(cn=".$this->base_selection_regex.")".
+ "(description=".$this->base_selection_regex.")))";
+
+ $ui = get_userinfo();
+ $res = get_list($filter,$ui->subtreeACL,$this->selectedBase,array("ou","description","cn"),GL_SIZELIMIT);
+
/* Add departments, to be able to switch into them
*/
/* Add departments, to be able to switch into them
*/
- while($attrs = $ldap->fetch()){
-
+ foreach($res as $attrs){
+
$key = $attrs['dn'] ;
$val = $attrs['ou'][0];
$key = $attrs['dn'] ;
$val = $attrs['ou'][0];
+
+ if(count($this->allowedBases) != 0){
+ if(!isset($this->allowedBases[$key])){
+ continue;
+ break;
+ }
+ }
/* Append description */
if(isset($attrs['description'][0])){
/* Append description */
if(isset($attrs['description'][0])){
$field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>",
"attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($link,base64_encode($key),$val), "attach" => "style=''");
$field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>",
"attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($link,base64_encode($key),$val), "attach" => "style=''");
- $field3 = array("string" => sprintf(" <input type='image' img src='images/save.png' name='usebase_%s'>",base64_encode($key)),
+ $field3 = array("string" => sprintf(" <input title='"._("Select this base")."' type='image' img src='images/save.png' name='usebase_%s'>",base64_encode($key)),
"attach" => "style='width:50px;border-right:0px;text-align:right;'");
$this->AddElement(array($field1,$field2,$field3));
}
"attach" => "style='width:50px;border-right:0px;text-align:right;'");
$this->AddElement(array($field1,$field2,$field3));
}
function Save()
{
MultiSelectWindow :: Save();
function Save()
{
MultiSelectWindow :: Save();
- $this->selectedBase = $this->selected_base;
+ $this->BaseToUse = $this->selectedBase;
}
function isSelected()
{
}
function isSelected()
{
- return($this->selectedBase);
+ return($this->BaseToUse);
}
function setCurrentBase($base)
{
}
function setCurrentBase($base)
{
- $this->selected_base = $base;
+ $this->selectedBase = $base;
}
function save_object()
}
function save_object()
MultiSelectWindow::save_object();
if(isset($_GET['open_dep'])){
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 ="";
}
$s_action ="";
$tmp = preg_replace("/^usebase_/","",$key);
$tmp = preg_replace("/_.*$/","",$tmp);
$tmp = base64_decode($tmp);
$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"){
}
}
$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"){
}
/* 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"){
}
/* 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)])){
$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{
}else{
- $this->selected_base= $this->config->departments["/"];
+ $this->selectedBase= $this->config->departments["/"];
}
}
}
}
}
}