X-Git-Url: https://git.tokkee.org/?a=blobdiff_plain;f=plugins%2Fadmin%2Ffai%2Fclass_faiManagement.inc;h=bd5c1fb3b7ec890f60b1e3943a0426ed6dfbbf4c;hb=d1baab4eb6f9e84efe3be655942a898d80165e0f;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..bd5c1fb3b 100644 --- a/plugins/admin/fai/class_faiManagement.inc +++ b/plugins/admin/fai/class_faiManagement.inc @@ -25,6 +25,7 @@ require "tabsScript.inc"; require "tabsProfile.inc"; require "tabsPackage.inc"; + class faiManagement extends plugin { /* Definitions */ @@ -68,7 +69,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; @@ -125,9 +126,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,8 +136,45 @@ 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 @@ -162,7 +198,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 +208,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'])){ @@ -277,7 +319,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; } @@ -341,6 +383,7 @@ class faiManagement extends plugin $display.= "

"; }elseif(!isset($this->dialog->current)){ $display.= "

\n"; + $display.= " "; $display.= "\n"; $display.= "

"; } @@ -353,14 +396,35 @@ 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 = "
 ". + " ". + + " ". + + " ". + + "\"\" ". + "  ". + title='"._("New profile")."' name='Create_profile' alt='"._("P")."'> ". "\"\" ". @@ -368,19 +432,24 @@ class faiManagement extends plugin title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'> ". "  ". + title='"._("New scripts")."' name='Create_script' alt='"._("S")."'> ". "  ". + title='"._("New hooks")."' name='Create_hook' alt='"._("H")."'> ". "  ". + title='"._("New variables")."' name='Create_variable' alt='"._("V")."'> ". "  ". + title='"._("New templates")."' name='Create_template' alt='"._("T")."'> ". "  ". + + "  ". + + _("Current base")." ". + "  ". "
"; @@ -395,11 +464,39 @@ class faiManagement extends plugin array("string" => " "), array("string" => _("Name of FAI class")), array("string" => _("Class type")), - array("string" => _("Actions"), "attach"=>"style='border:none;width:40px;'"))); + array("string" => _("Actions"), "attach"=>"style='border-right:none;width:40px;'"))); + + + $action = ""; + $action .= ""; + + $editlink ="%NAME%"; + $linkopen = "%s"; + + foreach($this->departments as $key => $val) { + if(!isset($this->config->departments[trim($key)])){ + $this->config->departments[trim($key)]=""; + } + + $non_empty=""; + $keys= str_replace("/","\/",$key); + foreach($this->config->departments as $keyd=>$vald ){ + if(preg_match("/".$keys."\/.*/",$keyd)){ + $non_empty="full"; + } + } - $action = ""; - $action .= ""; + $title = $this->config->departments[$key]; + $field0 = array("string" => "department", "attach"=>"style='width:20px;'"); + $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "title='".$title."'"); + $field2 = array("string" => ""); + $field3 = array("string" => "","attach"=>"style='text-align:right;border-right:none;'"); + + $divlist->AddEntry( array($field0,$field1,$field2,$field3)); + + } + /* Attach objects */ foreach($this->objects as $key => $value){ @@ -427,7 +524,7 @@ class faiManagement extends plugin if(!$faifilter['ShowScripts']){ $abort = true; } - $img="S"; + $img="S"; $info = _("Scripts"); break; case "FAIvariable" : @@ -459,7 +556,7 @@ class faiManagement extends plugin $info = _("Templates"); break; default : - $img="";$info = "";break; + $img="";$info = "";break; } @@ -471,7 +568,7 @@ class faiManagement extends plugin } $field1 = array("string" => $img , "attach" => "style='height:26px;width=20px;'"); - $field2 = array("string" => $value['cn'].$desc , "attach" => ""); + $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/"),array($key,$value['cn'].$desc),$editlink) , "attach" => ""); $field3 = array("string" => $info, "attach" => ""); $field4 = array("string" => preg_replace("/%KEY%/",$key,$action) , "attach"=>"style='text-align:right;border:none'"); $divlist->AddEntry(array($field1,$field2,$field3,$field4)); @@ -512,7 +609,7 @@ class faiManagement extends plugin // Added for dirlist function... /* Set base for all searches */ - $base= $faifilter['base']; + $base= "ou=fai,ou=configs,ou=systems,".$faifilter['base']; $regex = $faifilter['regex']; /* Array to save objects */ @@ -520,6 +617,33 @@ class faiManagement extends plugin $this->objects=array(); + /* NEW LIST MANAGMENT + * We also need to search for the departments + * So we are able to navigate like in konquerer + */ + $base2 = $faifilter['base']; + + $res3 = get_list2($this->ui->subtreeACL, "(&(|(ou=$regex)(description=$regex))(objectClass=gosaDepartment))", + TRUE, $base2, array("ou", "description"), TRUE); + + $this->departments= array(); + $tmp = array(); + foreach ($res3 as $value){ + $tmp[strtolower($value['dn']).$value['dn']]=$value; + } + ksort($tmp); + foreach($tmp as $value){ + if($value["description"][0]!=".."){ + $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]"; + }else{ + $this->departments[$value['dn']]=$value["description"][0]; + } + } + + /* END NEW LIST MANAGMENT + */ + + $res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)", FALSE, $base, array("cn","description","objectClass"),TRUE); @@ -562,6 +686,15 @@ class faiManagement extends plugin } ksort($this->objects); reset ($this->objects); + + /* use numeric index, thats a bit more secure */ + $tmp0 = array(); + foreach($this->objects as $obj){ + $tmp0[]= $obj; + } + $this->objects = array(); + $this->objects = $tmp0; + } function remove_lock()