summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 43d1946)
raw | patch | inline | side by side (parent: 43d1946)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 13:15:08 +0000 (13:15 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 13:15:08 +0000 (13:15 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6091 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/fai/class_divListFai.inc | patch | blob | history | |
plugins/admin/fai/class_faiManagement.inc | patch | blob | history | |
plugins/admin/fai/remove.tpl | patch | blob | history |
index b95c43bf6f355f318cbdd5b08721e65fe5b0a47d..1a735a3a2f8aa1cf46a91276c59e6acc10c9951e 100644 (file)
$action_col_size += 20;
}
+ /* Toggle all selected / deselected */
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
+
/* 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" => _("Name of FAI class"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Class type"), "attach" => "style='width:200px;'"));
$listhead .= _("Base")." <select name='CurrentMainBase' 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>";
+ title='"._("Submit department")."' name='submit_department' alt='". _("Submit")."'> ";
+
+ /* Multiple options */
+ $listhead .= " <input class='center' type='image' align='middle' src='images/edittrash.png'
+ title='"._("Remove selected fai objects")."' alt='"._("Remove fai objects")."' name='remove_multiple_fai_objects'> ";
+
+ $listhead .="</div>";;
+
$this->SetListHeader($listhead);
}
$edi = $editlink;
$acti = $action;
+ /* 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,$value['cn'].$desc,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($field1,$field2,$field3,$field4));
+ $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
}
}
index 629b0190d77383bd51a939402e5a36d1b5a42e09..a3b4d5f4e114574733b7a228e7795941b504bf84 100644 (file)
$s_entry = "";
/* If an entry was locked, these vars will be stored in a session to allow direct edit */
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^edit_entry$/","/^id$/","/^entry_edit_/","/^entry_delete_/","/^item_selected/","/^remove_multiple_fai_objects/");
/****************
"/create_script/i"=>"new_script", "/create_hook/i"=>"new_hook",
"/create_variable/i"=>"new_variable", "/create_template/i"=>"new_template",
"/create_package/i"=>"new_package", "/create_profile/i"=>"new_profile",
- "/edit_continue/"=>"select_class_name_finished");
+ "/edit_continue/"=>"select_class_name_finished",
+
+ "/^remove_multiple_fai_objects/" => "del_multiple");
foreach($_POST as $name => $value){
foreach($posts as $reg => $act ){
/* 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 FAI class at '%s'."), @LDAP::fix($this->dn)));
+ $smarty->assign("multiple", false);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
} else {
}
+ /********************
+ Delete MULTIPLE entries requested, display confirm dialog
+ ********************/
+
+ if ($s_action=="del_multiple"){
+ $this->dns = array();
+ $ids = $this->list_get_selected_items();
+
+ if(count($ids)){
+
+ foreach($ids as $id){
+ $dn = $this->objects[$id]['dn'];
+ if (($user= get_lock($dn)) != ""){
+ return(gen_locked_message ($user, $dn));
+ }
+ $this->dns[$id] = $dn;
+ }
+
+ $dns_names = "<br><pre>";
+ foreach($this->dns as $dn){
+ add_lock ($dn, $this->ui->dn);
+ $dns_names .= $dn."\n";
+ }
+ $dns_names .="</pre>";
+
+ /* Lock the current entry, so nobody will edit it during deletion */
+ $smarty->assign("warning", sprintf(_("You're about to delete the following fai object(s) %s"), @LDAP::fix($dns_names)));
+ $smarty->assign("multiple", true);
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries confirmed
+ ********************/
+
+ /* Confirmation for deletion has been passed. Users should be deleted. */
+ if (isset($_POST['delete_multiple_fai_object_confirm'])){
+
+ /* Find out more about the object type */
+ $ldap = $this->config->get_ldap_link();
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ $ldap->cat($dn, array('objectClass'));
+ $attrs = $ldap->fetch();
+ $type = $this->get_type($attrs);
+
+ $acl = $this->ui->get_permissions($dn,"fai/".$type[1]);
+ if(preg_match("/d/",$acl)){
+
+ $this->dialog = new $type[0]($this->config, $this->config->data['TABS'][$type[2]], $dn,"fai");
+ $this->dialog->set_acl_base($dn);
+ $this->dialog->by_object[$type[1]]->remove_from_parent ();
+ unset ($this->dialog);
+ gosa_log ("FAI class '".$dn."' has been tagged as removed");
+ $this->dialog= NULL;
+ $to_del = clean_up_releases($dn);
+ save_release_changes_now();
+
+ foreach($to_del as $dn){
+ $ldap->rmdir_recursive($dn);
+ gosa_log(sprintf(_("Release cleanup : Removing object (tagged as remvoed) that is no longer in use '%s'."),$dn));
+ }
+
+ } else {
+
+ /* Normally this shouldn't be reached, send some extra
+ logs to notify the administrator */
+ print_red (_("You are not allowed to delete this component!"));
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick system ".
+ "deletion.");
+ }
+
+ /* Remove lock file after successfull deletion */
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries Canceled
+ ********************/
+
+ /* Remove lock */
+ if(isset($_POST['delete_multiple_fai_object_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/****************
Delete aborted
****************/
/* Display dialog with system list */
$this->DivListFai->parent = $this;
$this->DivListFai->execute();
- $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4);
+ $this->DivListFai->AddDepartments($this->DivListFai->selectedBase,4,1);
$this->reload();
$this->DivListFai->setEntries($this->objects);
return($this->DivListFai->Draw());
}
return ($ret);
}
-
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[0-9]*$/",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+
+
/* reload list of objects */
function reload()
{
index 947e2c26e321c047c6035858200daeb531167dd3..10bf93dc5e9a70ac838f3c6b6c3a1334d40636a2 100644 (file)
</p>
<p class="plugbottom">
- <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
-
- <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+{if $multiple}
+ <input type=submit name="delete_multiple_fai_object_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_fai_object_cancel" value="{t}Cancel{/t}">
+{else}
+ <input type=submit name="delete_terminal_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+{/if}
</p>