X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Ffai%2Fclass_faiManagement.inc;h=55e8499b1ef067f51692e48c21cb6685af0ca6ba;hb=8e89e901eb67f63011a49553de75353330a3871e;hp=87046b49854f3ef2de0a974b5a586be3c71f6b28;hpb=339b8ef25b01ecdd50d2d02f9bda1656f9a75d9d;p=gosa.git diff --git a/plugins/admin/fai/class_faiManagement.inc b/plugins/admin/fai/class_faiManagement.inc index 87046b498..55e8499b1 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -68,7 +68,7 @@ class faiManagement extends plugin /* Get global filter config */ if (!is_global("faifilter")){ $base = get_base_from_people($ui->dn); - $faifilter= array("base" => "ou=fai,ou=configs,ou=systems,".$base, + $faifilter= array("base" => $base, "regex" => "*"); $faifilter['ShowProfiles'] = true; $faifilter['ShowTemplates'] = true; @@ -83,6 +83,10 @@ class faiManagement extends plugin function execute() { + + /* Call parent execute */ + plugin::execute(); + $display = ""; $smarty = get_smarty(); $s_action = ""; @@ -125,9 +129,7 @@ class faiManagement extends plugin $s_action = "new_package"; }elseif(preg_match("/create_profile/i",$key)){ $s_action = "new_profile"; - }elseif(preg_match("/UseNewClass/",$key)){ - $s_action = "select_class_name_finished"; - }elseif(preg_match("/UseSelectedClass/",$key)){ + }elseif(preg_match("/edit_continue/",$key)){ $s_action = "select_class_name_finished"; }elseif(preg_match("/^entry_edit_.*/",$key)){ $s_entry = preg_replace("/^entry_edit_/","",$key); @@ -137,10 +139,47 @@ class faiManagement extends plugin $s_entry = preg_replace("/^entry_delete_/","",$key); $s_entry = preg_replace("/_.*$/","",$s_entry); $s_action = "delete"; + }elseif(preg_match("/dep_back.*/i",$key)){ + $s_action="back"; + }elseif(preg_match("/dep_home.*/i",$key)){ + $s_action="home"; + }elseif(preg_match("/dep_root.*/i",$key)){ + $s_action="root"; } } + if($s_action=="root"){ + $faifilter['base']=($this->config->current['BASE']); + } + + if($s_action=="home"){ + $faifilter['base']=(preg_replace("/^[^,]+,/","",$this->ui->dn)); + $faifilter['base']=(preg_replace("/^[^,]+,/","",$faifilter['base'])); + } + + if($s_action=="back"){ + $base_back = preg_replace("/^[^,]+,/","",$faifilter['base']); + $base_back = convert_department_dn($base_back); + + if(isset($this->config->departments[trim($base_back)])){ + $faifilter['base']= $this->config->departments[trim($base_back)]; + }else{ + $faifilter['base']= $this->config->departments["/"]; + } + } + + if(isset($_GET['act'])&&($_GET['act']=="dep_open")){ + $s_action="open"; + $s_entry = base64_decode($_GET['dep_id']); + $faifilter['base']= $this->config->departments[trim($s_entry)]; + } + + if(isset($_GET['edit_entry'])){ + $s_entry = $_GET['edit_entry']; + $s_action = "edit"; + } + /* Confirm dialog * Delte object */ @@ -162,7 +201,7 @@ class faiManagement extends plugin /* Lock the current entry, so nobody will edit it during deletion */ add_lock ($this->dn, $this->ui->dn); - $smarty->assign("warning", sprintf(_("You're about to delete all information about the component at '%s'."), $this->dn)); + $smarty->assign("warning", sprintf(_("You're about to delete all information about the FAI class at '%s'."), $this->dn)); return($smarty->fetch(get_template_path('remove.tpl', TRUE))); } else { @@ -172,6 +211,12 @@ class faiManagement extends plugin } } + /* Delete canceled? */ + if (isset($_POST['delete_cancel'])){ + del_lock ($this->dn); + } + + /* Deltetion was confirmed, so delete this entry */ if (isset($_POST['delete_terminal_confirm'])){ @@ -217,10 +262,12 @@ class faiManagement extends plugin $a_setup = ($this->get_type($entry)); $this->dn = $entry['dn']; + add_lock ($this->dn, $this->ui->dn); $this->dialog= new $a_setup[0]($this->config, $this->config->data['TABS'][$a_setup[2]],$this->dn); $this->is_dialog = true; + $_SESSION['objectinfo'] = $this->dn; } @@ -277,7 +324,7 @@ class faiManagement extends plugin $name = $this->dialog->save(); $this->dialog = new $a_setup[0]($this->config, - $this->config->data['TABS'][$a_setup[2]],$this->dn); + $this->config->data['TABS'][$a_setup[2]],$this->dn,$name); $this->dialog->by_object[$a_setup[1]]->cn = $name; $this->is_dialog = true; } @@ -289,6 +336,11 @@ class faiManagement extends plugin $faifilter['regex']=$_GET['search']."*"; } + /* Department select */ + if((isset($_POST['base']))&&($s_action=="")){ + $faifilter['base']=$_POST['base']; + } + /* remove double asterisks and save new filter */ $faifilter['regex'] = preg_replace("/\*\*/","*",$faifilter['regex']); $_SESSION['faifilter']= $faifilter; @@ -300,9 +352,10 @@ class faiManagement extends plugin unset($this->dialog); $this->dialog=NULL; $this->is_dialog = false; + unset($_SESSION['objectinfo']); + del_lock ($this->dn); } - /* This check if the given tab could be saved * If it was possible to save it, remove dialog object. * If it wasn't possible, show errors and keep dialog. @@ -314,14 +367,15 @@ class faiManagement extends plugin print_red($msg); } }else{ + del_lock ($this->dn); $this->dialog->save(); unset($this->dialog); $this->dialog=NULL; $this->is_dialog=false; + unset($_SESSION['objectinfo']); } } - /* If dialog is set, but $this->is_dialog==false, then * only the "abort" button is shown, this are dialogs that must not be saved. * If is_dialog == true, we are currently editing tab objects. @@ -335,13 +389,14 @@ class faiManagement extends plugin }elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){ $display.= "
\n"; - $display.= "\n"; + $display.= "\n"; $display.= " \n"; - $display.= "\n"; + $display.= "\n"; $display.= "
"; }elseif(!isset($this->dialog->current)){ $display.= "\n"; - $display.= "\n"; + $display.= " "; + $display.= "\n"; $display.= "
"; } return($display); @@ -353,34 +408,60 @@ class faiManagement extends plugin * Assign all reguired vars to template engine */ + /* Prepare departments */ + $options= ""; + foreach ($this->config->idepartments as $key => $value){ + if ($faifilter['base'] == $key){ + $options.= ""; + } else { + $options.= ""; + } + } + /* Create listhead, it will be shown on top of the divlist. * It provides general navigation and object creation */ $faihead = "