summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ce721cd)
raw | patch | inline | side by side (parent: ce721cd)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 2 Dec 2008 12:56:20 +0000 (12:56 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 2 Dec 2008 12:56:20 +0000 (12:56 +0000) |
-We can't actually remove entries.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13111 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@13111 594d385d-05f5-0310-b6e9-bd551577e9d8
gosa-plugins/fai/admin/fai/class_divListFai.inc | patch | blob | history | |
gosa-plugins/fai/admin/fai/class_faiManagement.inc | patch | blob | history |
diff --git a/gosa-plugins/fai/admin/fai/class_divListFai.inc b/gosa-plugins/fai/admin/fai/class_divListFai.inc
index f171d9c0655394c665cdec7be0d473340f13db80..458ba09efada72fb5809509c38d6b87d85a059e0 100644 (file)
/* set Page header */
$this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
- $this->AddHeader(array("string" => " ", "attach" => "style='text-align:center;width:20px;'"));
$this->AddHeader(array("string" => _("Class name"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Class type"), "attach" => "style='width:200px;'"));
$this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
/* Add seperator */
$add_sep = false;
- /* Get complete fai acls, to be able to check if we must show or hide the snapshot abilities */
- $acl_all = $ui->has_complete_category_acls($this->parent->acl_base,$this->module);
-
/* Add default header */
$listhead = MultiSelectWindow::get_default_header(false);
/* Dynamic action col, depending on snapshot icons */
$action_col_size = 130;
-# if($this->parent->snapshotEnabled()){
-# $action_col_size += 32;
-# }
/********************
Attach objects
********************/
+ /* Initialize summary attributes
+ */
$cnts = array();
foreach($objects as $key => $data){
$cnts[$key] = 0;
}
- foreach($list as $key => $value){
- $info = "";
- $img = "";
- $type = $value['type'];
- $abort =false;
-
- $cnts[$type] ++;
-
- if(isset($objects[$type])){
- $img = "<img class='center' src='".$objects[$type]['IMG']."' title='".$objects[$type]['NAME']."' alt='".$objects[$type]['KZL']."'>";
- $info = $objects[$type]['NAME'];
- $var = $objects[$type]['VAR'];
- }else{
- $img = "<img class='center' src='images/empty.png' alt=''>";
- $info = "";
- $var = "";
- }
-
- if((isset($value['description']))&&(!empty($value['description']))){
- $desc= " [".$value['description']."]";
- }else{
- $desc= "";
- }
-
- /* Add copy & cut icons */
- $ui = get_userinfo();
- $action ="";
- $acl_all = $ui->has_complete_category_acls($this->parent->acl_base,$this->module);
-
- if(preg_match("/^opsi_/",$type)){
- $editlink ="<a href='?plug=".$_GET['plug']."&edit_opsi_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
- $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'
- name='entry_opsi_edit_%KEY%' title='"._("Edit product")."'><img src='images/empty.png' alt=' ' class='center'>";
- }else{
-
- /* Add copy & cut functionality */
- $action.= $this->parent->get_copypaste_action($value['dn'],"fai",$value['class'],TRUE,FALSE);
-
- if(preg_match("/^freeze/", $value['FAIstate'])){
- $editlink ="<a href='?plug=".$_GET['plug']."&edit_freeze_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
- $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'
- name='entry_freeze_edit_%KEY%' title='"._("Edit class")."'>";
- $action.= "<img src='images/lists/locked.png' alt='F' class='center'>";
- }else{
- $editlink ="<a href='?plug=".$_GET['plug']."&edit_entry=%KEY%' title='%TITLE%'>%NAME%</a>";
- $action.= "<input class='center' type='image' src='images/lists/edit.png' alt='"._("edit")."'
- name='entry_edit_%KEY%' title='"._("Edit class")."'>";
- if(preg_match("/d/",$value['acl'])){
- $action.= "<input class='center' type='image' src='images/lists/trash.png' alt='"._("delete")."'
- name='entry_delete_%KEY%' title='"._("Delete class")."'>";
- }
- }
- }
-
-# $action.= $this->parent->get_snapshot_action($val['dn'],$this->module);
-
- /* Cutted objects should be displayed in light grey */
- $display = $value['cn'].$desc;
- if($this->parent->CopyPasteHandler){
- foreach($this->parent->CopyPasteHandler->queue as $queue_key => $queue_data){
- if($queue_data['dn'] == $value['dn']) {
- $display = "<font color='#999999'>".$display."</font>";
- break;
- }
- }
- }
- $edi = $editlink;
- $acti = $action;
-
- $display = "<div style='overflow:hidden; height:1em;'>".$display."</div>";
-
- /* Some objects are non ldap objects which do not have a dn.
- */
- if(!isset($value['dn'])) $value['dn'] = "";
-
- /* Create each field */
- $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
- "attach" => "style='width:20px;'");
- $field1 = array("string" => $img , "attach" => "style='text-align:center;width:20px;'");
- $field2 = array("string" => preg_replace(array("/%KEY%/","/%NAME%/","/%TITLE%/"),array($key,$display,preg_replace('/ /', ' ', LDAP::fix($value['dn']))),$edi) , "attach" => "style=''");
- $field3 = array("string" => $info, "attach" => "style='width:200px;'");
- $field4 = array("string" => preg_replace("/%KEY%/",$key,$acti) , "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
- $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
- }
+ /* Walk through entries an build up a printable row for each object
+ */
+ foreach($list as $key => $value){
+
+ /* Build up edit icons - depending on read acls for the current type
+ */
+ $name = "";
+ $name = "";
+ $icon_list = "";
+ foreach($objects as $type => $type_data){
+ if(isset($value[$type])){
+ $name = $value[$type]['cn'];
+ $icon_list .= "<input type='image' src='".$type_data['IMG']."' title='".$type_data['NAME']."'
+ alt='".$type_data['KZL']."' class='center' name='edit_".$key."_".$type."'>\n";
+ $cnts[$type] ++;
+ }else{
+ $icon_list .= "<img src='images/empty.png' alt=' ' class='center'>\n";
+ }
+ }
+
+ /* Create actions string
+ */
+ $actions = "";
+
+
+ /* Create list
+ */
+ $field1 = array(
+ "string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+ "attach" => "style='width:20px;'");
+ $field2 = array(
+ "string" => $name,
+ "attach" => "style=''");
+ $field3 = array(
+ "string" => $icon_list ,
+ "attach" => "style='width:200px;'");
+ $field4 = array(
+ "string" => $actions,
+ "attach" => "style='width:".$action_col_size."px;border-right: 0px;text-align:right;'");
+
+ $this->AddElement(array($field1,$field2,$field3,$field4));
+ }
/* Create summary string for list footer */
$num_deps=0;
diff --git a/gosa-plugins/fai/admin/fai/class_faiManagement.inc b/gosa-plugins/fai/admin/fai/class_faiManagement.inc
index 1e4155283131d0880a24d94f4257e4b49f980ed2..8148eb65bade41d9e0b02834c7ff3bfc3055d704 100644 (file)
break;
}
}
- if(preg_match("/^entry_edit_.*/",$name)){
- $s_entry = preg_replace("/^entry_edit_/","",$name);
- $s_entry = preg_replace("/_.*$/","",$s_entry);
- $s_action = "edit";
- break;
- }elseif(preg_match("/^entry_freeze_edit_.*/",$name)){
- $s_entry = preg_replace("/^entry_freeze_edit_/","",$name);
- $s_entry = preg_replace("/_.*$/","",$s_entry);
+ if(preg_match("/^edit_[0-9]*_.*$/",$name)){
+
+ $i_entryID = preg_replace("/^edit_([0-9]*)_.*$/i","\\1",$name);
+ $s_entryType= preg_replace("/^edit_[0-9]*_([^_]*)_.*$/i","\\1",$name);
$s_action = "edit";
- $no_save = TRUE;
+
break;
}elseif(preg_match("/^entry_delete_.*/",$name)){
$s_entry = preg_replace("/^entry_delete_/","",$name);
$s_action = "opsi_edit";
}
- if(isset($_GET['edit_entry'])){
- $s_entry = $_GET['edit_entry'];
- $s_action = "edit";
- }
-
- if(isset($_GET['edit_freeze_entry'])){
- $s_entry = $_GET['edit_freeze_entry'];
- $s_action = "edit";
- $no_save = TRUE;
- }
-
if(isset($_GET['act']) && $_GET['act'] == "freeze_branch"){
$s_action = "freeze_branch";
}
****************/
if(($s_action == "edit") && (!isset($this->dialog->config))){
- $entry = $this->objects[$s_entry];
- $a_setup = $this->get_type($entry);
- $this->dn = $entry['dn'];
+ if(isset($this->objects[$i_entryID][$s_entryType])){
+ $entry = $this->objects[$i_entryID][$s_entryType];
+ $a_setup = $this->get_type($entry);
+ $this->dn = $entry['dn'];
- /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
- if (($user= get_lock($this->dn)) != ""){
- return(gen_locked_message ($user, $this->dn, TRUE));
- }
- add_lock ($this->dn, $this->ui->dn);
-
- $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
- $this->dialog->parent = &$this;
- $this->dialog->by_object[$a_setup[1]]->FAIstate = $entry['FAIstate'];
- $this->dialog->set_acl_base($this->dn);
- $this->is_dialog = true;
- session::set('objectinfo',$this->dn);
- }
+ /* Check locking, save current plugin in 'back_plugin', so the dialog knows where to return. */
+ if (($user= get_lock($this->dn)) != ""){
+ return(gen_locked_message ($user, $this->dn, TRUE));
+ }
+ add_lock ($this->dn, $this->ui->dn);
+
+ $this->dialog = new $a_setup[0]($this->config,$this->config->data['TABS'][$a_setup[2]],$this->dn,"fai");
+ $this->dialog->parent = &$this;
+ $this->dialog->by_object[$a_setup[1]]->FAIstate = $entry['FAIstate'];
+ $this->dialog->set_acl_base($this->dn);
+ $this->is_dialog = true;
+ session::set('objectinfo',$this->dn);
+ }
+ }
/* Branch handling
$obj['description'] = $object['description'][0];
$obj['objectClass'] = $object['objectClass'];
- $this->objects[strtolower($obj['cn']).$obj['cn'].$type] = $obj;
- $this->objects[strtolower($obj['cn']).$obj['cn'].$type]['type']=$type;
+ $this->objects[$obj['cn']][$type] = $obj;
+ $this->objects[$obj['cn']][$type]['type']=$type;
}
}
}
$entry = array("cn" => $name,
"description" => $data['DESC'],
"type" => "opsi_netboot");
- $this->objects[$name."_opsi_netboot"] = $entry;
+ $this->objects[$name]['opse_netboot'] = $entry;
}
}
if(!$err && $this->DivListFai->ShowOpsiLocal){
$entry = array("cn" => $name,
"description" => $data['DESC'],
"type" => "opsi_local");
- $this->objects[$name."_opsi_local"] = $entry;
+ $this->objects[$name]["opsi_local"] = $entry;
}
}
if($err){
}
}
}
-
- ksort($this->objects);
+
+ uksort($this->objects, 'strnatcasecmp');
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;
+ $this->objects = array_values($this->objects);
}
function remove_lock()