index 22d4e28a02668d359037e244e89efca3e60b034d..55e8499b1ef067f51692e48c21cb6685af0ca6ba 100644 (file)
/* Get global filter config */
if (!is_global("faifilter")){
$base = get_base_from_people($ui->dn);
/* 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;
"regex" => "*");
$faifilter['ShowProfiles'] = true;
$faifilter['ShowTemplates'] = true;
function execute()
{
function execute()
{
+
+ /* Call parent execute */
+ plugin::execute();
+
$display = "";
$smarty = get_smarty();
$s_action = "";
$display = "";
$smarty = get_smarty();
$s_action = "";
$s_action = "new_package";
}elseif(preg_match("/create_profile/i",$key)){
$s_action = "new_profile";
$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);
$s_action = "select_class_name_finished";
}elseif(preg_match("/^entry_edit_.*/",$key)){
$s_entry = preg_replace("/^entry_edit_/","",$key);
$s_entry = preg_replace("/^entry_delete_/","",$key);
$s_entry = preg_replace("/_.*$/","",$s_entry);
$s_action = "delete";
$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
*/
/* Confirm dialog
* Delte object
*/
/* Lock the current entry, so nobody will edit it during deletion */
add_lock ($this->dn, $this->ui->dn);
/* 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 {
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
} else {
}
}
}
}
+ /* Delete canceled? */
+ if (isset($_POST['delete_cancel'])){
+ del_lock ($this->dn);
+ }
+
+
/* Deltetion was confirmed, so delete this entry
*/
if (isset($_POST['delete_terminal_confirm'])){
/* Deltetion was confirmed, so delete this entry
*/
if (isset($_POST['delete_terminal_confirm'])){
$a_setup = ($this->get_type($entry));
$this->dn = $entry['dn'];
$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;
$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;
}
}
$name = $this->dialog->save();
$this->dialog = new $a_setup[0]($this->config,
$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;
}
$this->dialog->by_object[$a_setup[1]]->cn = $name;
$this->is_dialog = true;
}
$faifilter['regex']=$_GET['search']."*";
}
$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;
/* remove double asterisks and save new filter */
$faifilter['regex'] = preg_replace("/\*\*/","*",$faifilter['regex']);
$_SESSION['faifilter']= $faifilter;
unset($this->dialog);
$this->dialog=NULL;
$this->is_dialog = false;
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.
/* 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.
print_red($msg);
}
}else{
print_red($msg);
}
}else{
+ del_lock ($this->dn);
$this->dialog->save();
unset($this->dialog);
$this->dialog=NULL;
$this->is_dialog=false;
$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.
/* 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.
}elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
$display.= "<p style=\"text-align:right\">\n";
}elseif(((isset($this->dialog->current))&&(!$this->dialog->by_object[$this->dialog->current]->is_dialog))){
$display.= "<p style=\"text-align:right\">\n";
- $display.= "<input type=submit name=\"edit_finish\" value=\""._("Finish")."\">\n";
+ $display.= "<input type=\"submit\" name=\"edit_finish\" value=\""._("Finish")."\">\n";
$display.= " \n";
$display.= " \n";
- $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
$display.= "</p>";
}elseif(!isset($this->dialog->current)){
$display.= "<p style=\"text-align:right\">\n";
$display.= "</p>";
}elseif(!isset($this->dialog->current)){
$display.= "<p style=\"text-align:right\">\n";
- $display.= "<input type=submit name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
+ $display.= "<input type=\"submit\" name=\"edit_continue\" value=\""._("Continue")."\"> ";
+ $display.= "<input type=\"submit\" name=\"edit_cancel\" value=\""._("Cancel")."\">\n";
$display.= "</p>";
}
return($display);
$display.= "</p>";
}
return($display);
* Assign all reguired vars to template engine
*/
* Assign all reguired vars to template engine
*/
+ /* Prepare departments */
+ $options= "";
+ foreach ($this->config->idepartments as $key => $value){
+ if ($faifilter['base'] == $key){
+ $options.= "<option selected='selected' value='$key'>$value</option>";
+ } else {
+ $options.= "<option value='$key'>$value</option>";
+ }
+ }
+
/* Create listhead, it will be shown on top of the divlist.
* It provides general navigation and object creation
*/
$faihead =
"<div style='background:#F0F0F9;padding:5px;'> ".
/* Create listhead, it will be shown on top of the divlist.
* It provides general navigation and object creation
*/
$faihead =
"<div style='background:#F0F0F9;padding:5px;'> ".
- " <input type='image' src='images/fai_new_profile.png' align='middle'
- title='"._("New profile bundle")."' name='Create_profile' alt='"._("P")."'> ".
+ "<input class='center' type='image' src='images/list_up.png' align='middle'
+ title='"._("Go up one department")."' name='dep_back' alt='"._("Up"). "'> ".
+
+ "<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_home.png' align='middle'
+ title='"._("Go to users home department")."' name='dep_home' alt='"._("Home")."'> ".
+
+ "<img class='center' src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\"> ".
+
+ " <input class='center' type='image' src='images/fai_new_profile.png' align='middle'
+ title='"._("New profile")."' name='Create_profile' alt='"._("P")."'> ".
- "<img src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\"> ".
+ "<img class='center' src=\"images/list_seperator.png\" alt=\"\" align=\"middle\" height=\"16\" width=\"1\"> ".
- " <input type='image' src='images/fai_new_partitionTable.png' align='middle'
+ " <input class='center' type='image' src='images/fai_new_partitionTable.png' align='middle'
title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'> ".
title='"._("New partition table")."' name='Create_partition' alt='"._("PT")."'> ".
- " <input type='image' src='images/fai_new_script.png' align='middle'
- title='"._("New script bundle")."' name='Create_script' alt='"._("S")."'> ".
+ " <input class='center' type='image' src='images/fai_new_script.png' align='middle'
+ title='"._("New scripts")."' name='Create_script' alt='"._("S")."'> ".
- " <input type='image' src='images/fai_new_hook.png' align='middle'
- title='"._("New hook bundle")."' name='Create_hook' alt='"._("H")."'> ".
+ " <input class='center' type='image' src='images/fai_new_hook.png' align='middle'
+ title='"._("New hooks")."' name='Create_hook' alt='"._("H")."'> ".
- " <input type='image' src='images/fai_new_variable.png' align='middle'
- title='"._("New variable bundle")."' name='Create_variable' alt='"._("V")."'> ".
+ " <input class='center' type='image' src='images/fai_new_variable.png' align='middle'
+ title='"._("New variables")."' name='Create_variable' alt='"._("V")."'> ".
- " <input type='image' src='images/fai_new_template.png' align='middle'
- title='"._("New template bundle")."' name='Create_template' alt='"._("T")."'> ".
+ " <input class='center' type='image' src='images/fai_new_template.png' align='middle'
+ title='"._("New templates")."' name='Create_template' alt='"._("T")."'> ".
- " <input type='image' src='images/fai_new_packages.png' align='middle'
+ " <input class='center' type='image' src='images/fai_new_packages.png' align='middle'
title='"._("New package list")."' name='Create_package' alt='"._("PK")."'> ".
title='"._("New package list")."' name='Create_package' alt='"._("PK")."'> ".
+
+ " <img class='center' src='images/list_seperator.png' align='middle' alt='' height='16' width='1'> ".
+
+ _("Current base")." <select name='base' onChange='mainform.submit()' class='center'>$options</select>".
+ " <input class='center' type='image' src='images/list_submit.png' align='middle' title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ".
"</div>";
"</div>";
/* Create list with objects */
$divlist = new divlist("faiManagement");
/* Create list with objects */
$divlist = new divlist("faiManagement");
- $divlist->SetEntriesPerPage(20);
+ $divlist->SetEntriesPerPage(0);
$divlist->SetSummary(_("This table displays all systems, in the selected tree."));
$divlist->SetHeader(array(
$divlist->SetSummary(_("This table displays all systems, in the selected tree."));
$divlist->SetHeader(array(
- array("string" => " "),
- array("string" => _("Name of FAI class")),
- array("string" => _("Class type")),
- array("string" => _("Actions"), "attach"=>"style='border:none;width:40px;'")));
+ array("string" => " ", "attach" => "style='text-align:center;width:20px;'"),
+ array("string" => _("Name of FAI class"), "attach" => "style=''"),
+ array("string" => _("Class type"), "attach" => "style='width:200px;'"),
+ array("string" => _("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'")));
+
+
+ $action = "<input class='center' type='image' src='images/edit.png' alt='"._("edit")."' name='entry_edit_%KEY%' title='"._("Edit class")."'>";
+ $action .= "<input class='center' type='image' src='images/edittrash.png' alt='"._("delete")."' name='entry_delete_%KEY%' title='"._("Delete class")."'>";
+
+ $editlink ="<a href='?plug=".$_GET['plug']."&edit_entry=%KEY%'>%NAME%</a>";
+ $linkopen = "<a href='?plug=".$_GET['plug']."&act=dep_open&dep_id=%s'>%s</a>";
+
+ 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";
+ }
+ }
+
+
+ $title = $this->config->departments[$key];
+ $field0 = array("string" => "<img src='images/".$non_empty."folder.png' title='"._("department")."' alt='department'>", "attach" => "style='text-align:center;width:20px;'");
+ $field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'");
+ $field2 = array("string" => " ", "attach" => "style='width:200px;'");
+ $field3 = array("string" => " ", "attach" => "style='width:60px;border-right:0px;text-align:right;'");
+
+ $divlist->AddEntry( array($field0,$field1,$field2,$field3));
+ }
- $action = "<input type='image' src='images/edit.png' alt='"._("edit")."' name='entry_edit_%KEY%' title='"._("Edit class")."'>";
- $action .= "<input type='image' src='images/edittrash.png' alt='"._("delete")."' name='entry_delete_%KEY%' title='"._("Delete class")."'>";
/* Attach objects */
foreach($this->objects as $key => $value){
/* Attach objects */
foreach($this->objects as $key => $value){
if(!$faifilter['ShowPartitions']){
$abort = true;
}
if(!$faifilter['ShowPartitions']){
$abort = true;
}
- $img="<img src='images/fai_partitionTable.png' title='"._("Partition table")."' alt='PT'>";
+ $img="<img class='center' src='images/fai_partitionTable.png' title='"._("Partition table")."' alt='PT'>";
$info = _("Partition table");
break;
case "FAIpackageList" :
if(!$faifilter['ShowPackages']){
$abort = true;
}
$info = _("Partition table");
break;
case "FAIpackageList" :
if(!$faifilter['ShowPackages']){
$abort = true;
}
- $img="<img src='images/fai_packages.png' title='"._("Package list")."' alt='PL'>";
+ $img="<img class='center' src='images/fai_packages.png' title='"._("Package list")."' alt='PL'>";
$info = _("Package list");
break;
case "FAIscript" :
if(!$faifilter['ShowScripts']){
$abort = true;
}
$info = _("Package list");
break;
case "FAIscript" :
if(!$faifilter['ShowScripts']){
$abort = true;
}
- $img="<img src='images/fai_script' title='"._("Scripts")."' alt='S'>";
+ $img="<img class='center' src='images/fai_script.png' title='"._("Scripts")."' alt='S'>";
$info = _("Scripts");
break;
case "FAIvariable" :
if(!$faifilter['ShowVariables']){
$abort = true;
}
$info = _("Scripts");
break;
case "FAIvariable" :
if(!$faifilter['ShowVariables']){
$abort = true;
}
- $img="<img src='images/fai_variable.png' title='"._("Variables")."' alt='V'>";
+ $img="<img class='center' src='images/fai_variable.png' title='"._("Variables")."' alt='V'>";
$info = _("Variables");
break;
case "FAIhook" :
if(!$faifilter['ShowHooks']){
$abort = true;
}
$info = _("Variables");
break;
case "FAIhook" :
if(!$faifilter['ShowHooks']){
$abort = true;
}
- $img="<img src='images/fai_hook.png' title='"._("Hooks")."' alt='H'>";
+ $img="<img class='center' src='images/fai_hook.png' title='"._("Hooks")."' alt='H'>";
$info = _("Hooks");
break;
case "FAIprofile" :
if(!$faifilter['ShowProfiles']){
$abort = true;
}
$info = _("Hooks");
break;
case "FAIprofile" :
if(!$faifilter['ShowProfiles']){
$abort = true;
}
- $img="<img src='images/fai_profile.png' title='"._("Profile")."' alt='P'>";
+ $img="<img class='center' src='images/fai_profile.png' title='"._("Profile")."' alt='P'>";
$info = _("Profile");
break;
case "FAItemplate" :
if(!$faifilter['ShowTemplates']){
$abort = true;
}
$info = _("Profile");
break;
case "FAItemplate" :
if(!$faifilter['ShowTemplates']){
$abort = true;
}
- $img="<img src='images/fai_template.png' title='"._("Templates")."' alt='T'>";
+ $img="<img class='center' src='images/fai_template.png' title='"._("Templates")."' alt='T'>";
$info = _("Templates");
break;
default :
$info = _("Templates");
break;
default :
- $img="<img src='images/empty.png' >";$info = "";break;
+ $img="<img class='center' src='images/empty.png' alt=''>";$info = "";break;
}
}
$desc= "";
}
$desc= "";
}
- $field1 = array("string" => $img , "attach" => "style='height:26px;width=20px;'");
- $field2 = array("string" => $value['cn'].$desc , "attach" => "");
- $field3 = array("string" => $info, "attach" => "");
- $field4 = array("string" => preg_replace("/%KEY%/",$key,$action) , "attach"=>"style='text-align:right;border:none'");
+ $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'");
+ $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/"),array($key,$value['cn'].$desc),$editlink) , "attach" => "style=''");
+ $field3 = array("string" => $info, "attach" => "style='width:200px;'");
+ $field4 = array("string" => preg_replace("/%KEY%/",$key,$action) , "attach" => "style='width:60px;border-right:0px;text-align:right;'");
$divlist->AddEntry(array($field1,$field2,$field3,$field4));
}
$divlist->AddEntry(array($field1,$field2,$field3,$field4));
}
$smarty->assign("alphabet" , generate_alphabet());
$smarty->assign("apply" , apply_filter());
$smarty->assign("search_image" , get_template_path('images/search.png'));
$smarty->assign("alphabet" , generate_alphabet());
$smarty->assign("apply" , apply_filter());
$smarty->assign("search_image" , get_template_path('images/search.png'));
+ $smarty->assign("hint", print_sizelimit_warning());
$display = $smarty->fetch(get_template_path('headpage.tpl', TRUE, dirname(__FILE__)));
return ($display);
$display = $smarty->fetch(get_template_path('headpage.tpl', TRUE, dirname(__FILE__)));
return ($display);
// Added for dirlist function...
/* Set base for all searches */
// 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 */
$regex = $faifilter['regex'];
/* Array to save objects */
$this->objects=array();
$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(isset($value["description"][0])){
+ $this->departments[$value['dn']]=convert_department_dn2($value['dn'])." - [".$value["description"][0]."]";
+ }else{
+ $this->departments[$value['dn']]=convert_department_dn2($value['dn']);//$value["description"][0];
+ }
+ }
+
+ /* END NEW LIST MANAGMENT
+ */
+
+
$res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",
FALSE, $base, array("cn","description","objectClass"),TRUE);
$res= get_list($this->ui->subtreeACL, "(objectClass=organizationalUnit)",
FALSE, $base, array("cn","description","objectClass"),TRUE);
}
ksort($this->objects);
reset ($this->objects);
}
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()
}
function remove_lock()