summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 25cbc9c)
raw | patch | inline | side by side (parent: 25cbc9c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 11 May 2006 04:31:35 +0000 (04:31 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Thu, 11 May 2006 04:31:35 +0000 (04:31 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3271 594d385d-05f5-0310-b6e9-bd551577e9d8
include/class_MultiSelectWindow.inc | patch | blob | history | |
plugins/admin/groups/class_divListGroup.inc | patch | blob | history | |
plugins/admin/systems/class_divListSystem.inc | patch | blob | history |
index 988a719479691d76486a248d255fc3146709a2e5..11c86d7c0a8ca29db5ed94aa01c49f2589076d71 100644 (file)
var $filterName = "Liste";
+ var $DepartmentsAdded = false;
+ var $selectedBase = "";
+
function ClearElementsList()
{
$this->array_Elements = array();
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'];
$this->SaveButtonString = _("Save");
$this->CloseButtonString = _("Close");
$this->filterName = $filterName;
+
+ /* Set default base */
+ if(!isset($_SESSION['CurrentMainBase'])){
+ $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
+ }
+ $this->selectedBase = $_SESSION['CurrentMainBase'];
}
/* Enables the headpage mode, which changes the list look */
}
/* 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;
}
/* Add a checkbox to the filter element,
- the name specifies an existing class var to store the 'selection' */
+ the name specifies an existing class var to store the 'selection' */
function AddCheckBox($name,$value="Unset",$string="Unset",$default=false)
{
$arr = array();
-
+
if($name == SEPERATOR){
$arr['name'] = SEPERATOR;
}else{
}
}
-
+
/* Returns true if the close button was pressed */
function isClosed()
</table>";
}
$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);
-
+
/* Check for exeeded sizelimit */
$smarty->assign("hint" , print_sizelimit_warning());
$smarty->assign("DivList" , $divlist->DrawList());
/* 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);
$smarty->assign("filterName" , $this->filterName);
$smarty->assign("is_headpage" , $this->is_headpage);
-
+
$display = $smarty->fetch(get_template_path("MultiSelectWindow.tpl"));
return($display);
}
}
/* Store all checkboxes/ regexes ...
- Store data also into a session var, to keep the checkboxes check after reload */
+ Store data also into a session var, to keep the checkboxes check after reload */
function save_object()
{
+ /* Update current base */
+ if($this->DepartmentsAdded){
+ $s_action ="";
+ foreach($_POST as $key => $value){
+ if(preg_match("/^dep_back.*/i",$key)){
+ $s_action="back";
+ }elseif(preg_match("/^dep_root.*/",$key)){
+ $s_action="root";
+ }elseif(preg_match("/^dep_home.*/i",$key)){
+ $s_action="home";
+ }
+ }
+
+ /* Save base selection from headpage selectbox*/
+ if(isset($_POST['CurrentMainBase'])){
+ $this->selectedBase = $_POST['CurrentMainBase'];
+ }
+
+ /* Homebutton is posted */
+ if($s_action=="home"){
+ $ui= get_userinfo();
+ $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
+ $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
+ }
+
+ /* Open selected department
+ this is posted by the parent class MultiSelectWindow */
+ if(isset($_GET['act'])&& ($_GET['act'] == "dep_open")){
+ $s_entry = base64_decode($_GET['dep_id']);
+ $this->selectedBase = $this->config->departments[trim($s_entry)];
+ }
+
+ /* back to the roots ^^ */
+ if($s_action=="root"){
+ $this->selectedBase=($this->config->current['BASE']);
+ }
+
+
+ /* If Back-button is pressed, move back one step in DN */
+ if($s_action == "back"){
+ //FIXME: This is not 100% correct. We'll only display ou's, but there may be
+ // a step between. You'll stumble in a "hidden" department in this case.
+ $base_back= preg_replace("/^[^,]+,/", "", $_SESSION['CurrentMainBase']);
+
+ /* The department array keeps non DN entries as index. We need to convert
+ it before checking the existance. */
+ $base_back= trim(convert_department_dn($base_back));
+
+ /* Check if the department exists, otherwise revert to the configure base DN */
+ if(isset($this->config->departments[$base_back])){
+ $_SESSION['CurrentMainBase']= $this->config->departments[$base_back];
+ }else{
+ $_SESSION['CurrentMainBase']= $this->config->departments['/'];
+ }
+ }
+ }
if(isset($_POST['MultiSelectWindow'.$this->filterName])){
/* Check posts from checkboxes
- */
+ */
foreach($this->array_Checkboxes as $key => $box){
if(isset($_POST[$box['name']])){
$this->array_Checkboxes[$key]['default'] = true;
if(isset($_POST['CloseMultiSelectWindow'])){
$this->Close();
}
-
+
if(isset($_POST['SaveMultiSelectWindow'])){
$this->Save();
}
}
/* check for alphabet selection
- Check which regexes are connected to the alphabet
- */
+ 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 */
/* this function adds the sub-departments of the current tree to the list */
function AddDepartments($base = false,$numtabs = 3)
{
+ $this->DepartmentsAdded = true;
+
/* check for a valid base */
if(!$base){
if(!isset($_SESSION['CurrentMainBase'])){
}
}
-
+
/* Add to divlist */
$row = array();
$row[] = $field1 = array("string" => "<img src='images/".$non_empty."folder.png' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
diff --git a/plugins/admin/groups/class_divListGroup.inc b/plugins/admin/groups/class_divListGroup.inc
index d1e60e06dfb16c1055202a0d5161e6621ba5f69e..34e56a9acebd0a99965f8aa4d730de4069bce1ac 100644 (file)
$this->parent = $parent;
$this->ui = get_userinfo();
- /* Set default base */
- if(!isset($_SESSION['CurrentMainBase'])){
- $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
- }
- $this->selectedBase = $_SESSION['CurrentMainBase'];
-
/* Set list strings */
$this->SetTitle(_("List of groups"));
$this->SetSummary(_("List of groups"));
$this->AddCheckBox(SEPERATOR);
/* Add SubSearch checkbox */
- $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), true);
+ $this->AddCheckBox("SubSearch", _("Select to search within subtrees"), _("Ignore subtrees"), false);
/* Name ,Text ,Default , Connect with alphabet */
$this->AddRegex ("Regex", _("Regular expression for matching group names"), "*" , true);
{
/* Save automatic created POSTs like regex, checkboxes */
MultiSelectWindow::save_object();
-
- $s_action ="";
- foreach($_POST as $key => $value){
- if(preg_match("/^dep_back.*/i",$key)){
- $s_action="back";
- }elseif(preg_match("/^dep_root.*/",$key)){
- $s_action="root";
- }elseif(preg_match("/^dep_home.*/i",$key)){
- $s_action="home";
- }
- }
-
- /* Save base selection from headpage selectbox*/
- if(isset($_POST['CurrentMainBase'])){
- $this->selectedBase = $_POST['CurrentMainBase'];
- }
-
- /* Homebutton is posted */
- if($s_action=="home"){
- $ui= get_userinfo();
- $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
- $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
- }
-
- /* Open selected department
- this is posted by the parent class MultiSelectWindow */
- if(isset($_GET['act'])&& ($_GET['act'] == "dep_open")){
- $s_entry = base64_decode($_GET['dep_id']);
- $this->selectedBase = $this->config->departments[trim($s_entry)];
- }
-
- /* back to the roots ^^ */
- if($s_action=="root"){
- $this->selectedBase=($this->config->current['BASE']);
- }
-
- /* If Backbutton is Posted */
- if($s_action=="back"){
- $base_back = preg_replace("/^[^,]+,/","",$this->selectedBase);
- $base_back = convert_department_dn($base_back);
- if(isset($this->config->departments[trim($base_back)])){
- $this->selectedBase= $this->config->departments[trim($base_back)];
- }else{
- $this->selectedBase= $this->config->departments["/"];
- }
- }
-
- $_SESSION['CurrentMainBase'] = $this->selectedBase;
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/plugins/admin/systems/class_divListSystem.inc b/plugins/admin/systems/class_divListSystem.inc
index 5751b7b0aa50db288291fd35f59681f896239123..a0cf16e758510333e03e6d6fbcd431587ada545b 100644 (file)
$this->parent = $parent;
$this->ui = get_userinfo();
- /* Set default base */
- if(!isset($_SESSION['CurrentMainBase'])){
- $_SESSION['CurrentMainBase'] = $this->config->current['BASE'];
- }
- $this->selectedBase = $_SESSION['CurrentMainBase'];
-
/* Set list strings */
$this->SetTitle(_("List of systems"));
$this->SetSummary(_("List of systems"));
function save_object()
{
/* Save automatic created POSTs like regex, checkboxes */
- MultiSelectWindow::save_object();
-
- $s_action ="";
- foreach($_POST as $key => $value){
- if(preg_match("/^dep_back.*/i",$key)){
- $s_action="back";
- }elseif(preg_match("/^dep_root.*/",$key)){
- $s_action="root";
- }elseif(preg_match("/^dep_home.*/i",$key)){
- $s_action="home";
- }
- }
-
- /* Save base selection from headpage selectbox*/
- if(isset($_POST['CurrentMainBase'])){
- $this->selectedBase = $_POST['CurrentMainBase'];
- }
-
- /* Homebutton is posted */
- if($s_action=="home"){
- $ui= get_userinfo();
- $this->selectedBase=(preg_replace("/^[^,]+,/","",$ui->dn));
- $this->selectedBase=(preg_replace("/^[^,]+,/","",$this->selectedBase));
- }
-
- /* Open selected department
- this is posted by the parent class MultiSelectWindow */
- if(isset($_GET['act'])&& ($_GET['act'] == "dep_open")){
- $s_entry = base64_decode($_GET['dep_id']);
- $this->selectedBase = $this->config->departments[trim($s_entry)];
- }
-
- /* back to the roots ^^ */
- if($s_action=="root"){
- $this->selectedBase=($this->config->current['BASE']);
- }
-
- /* If Backbutton is Posted */
- if($s_action=="back"){
- $base_back = preg_replace("/^[^,]+,/","",$this->selectedBase);
- $base_back = convert_department_dn($base_back);
- if(isset($this->config->departments[trim($base_back)])){
- $this->selectedBase= $this->config->departments[trim($base_back)];
- }else{
- $this->selectedBase= $this->config->departments["/"];
- }
- }
-
- $_SESSION['CurrentMainBase'] = $this->selectedBase;
+ MultiSelectWindow :: save_object();
}
}
// vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler: