From e9ecb3dd1e21686e251a02999cb362e20ae8cca2 Mon Sep 17 00:00:00 2001
From: hickert ";
+ foreach($this->dns as $dn){
+ add_lock ($dn, $this->ui->dn);
+ $dns_names .= $dn."\n";
+ }
+ $dns_names .="
";
+
+ /* Lock the current entry, so nobody will edit it during deletion */
+ $smarty->assign("info", sprintf(_("You're about to delete the following department(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_department_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+ $acl = $this->ui->get_permissions($dn,"department/department");
+ if (preg_match('/d/', $acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->deptabs= new deptabs($this->config,$this->config->data['TABS']['DEPTABS'], $dn,"department");
+ $this->deptabs->set_acl_base();
+ $this->deptabs->delete ();
+ $this->deptabs = NULL;
+ gosa_log ("Department object'".$this->dn."' has been removed");
+ } else {
+ print_red (_("You have no permission to remove this department."));
+ }
+ /* Remove lock file after successfull deletion */
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries Canceled
+ ********************/
+
+ /* Remove lock */
+ if(isset($_POST['delete_multiple_department_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/***************
Delete entry
***************/
@@ -409,6 +485,20 @@ class departmentManagement extends plugin
}
+
+ function list_get_selected_items()
+ {
+ $ids = array();
+ foreach($_POST as $name => $value){
+ if(preg_match("/^item_selected_[a-z0-9\=]*$/i",$name)){
+ $id = preg_replace("/^item_selected_/","",$name);
+ $ids[$id] = $id;
+ }
+ }
+ return($ids);
+ }
+
+
function remove_lock()
{
if (isset($this->dn)){
diff --git a/plugins/admin/departments/class_divListDepartment.inc b/plugins/admin/departments/class_divListDepartment.inc
index 32b79bf88..ecc1c3784 100755
--- a/plugins/admin/departments/class_divListDepartment.inc
+++ b/plugins/admin/departments/class_divListDepartment.inc
@@ -36,7 +36,14 @@ class divListDepartment extends MultiSelectWindow
$this->EnableCloseButton(false);
$this->EnableSaveButton (false);
+
+
+ /* Toggle all selected / deselected */
+ $chk = "";
+
/* 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"=>_("Department name"), "attach" => "style=''"));
$this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
@@ -99,8 +106,13 @@ class divListDepartment extends MultiSelectWindow
" alt='' height='16' width='1'> ".
" "._("Base")." ".
" ".
- "";
+ " title='"._("Submit department")."' name='submit_department' alt='"._("Submit")."'> ";
+
+ /* Multiple options */
+ $listhead .= " ";
+
+ $listhead .="";;
$this->SetListHeader($listhead);
}
@@ -144,12 +156,16 @@ class divListDepartment extends MultiSelectWindow
}
$title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key]));
+ /* Create each field */
+ $field01 = array("string" => "" ,
+ "attach" => "style='width:20px;'");
+
$field0 = array("string" => "", "attach" => "style='text-align:center;width:20px;'");
$field1 = array("string" => sprintf($linkopen,base64_encode($key),$val), "attach" => "style='' title='".$title."'");
$field2 = array("string" => preg_replace("/%KEY%/", base64_encode($key), $actions), "attach" => "style='width:60px;border-right:0px;text-align:
right;'");
- $this->AddElement( array($field0,$field1,$field2));
+ $this->AddElement( array($field01,$field0,$field1,$field2));
}
}
diff --git a/plugins/admin/departments/remove.tpl b/plugins/admin/departments/remove.tpl
index 33fdbbc2f..e4e075aa3 100644
--- a/plugins/admin/departments/remove.tpl
+++ b/plugins/admin/departments/remove.tpl
@@ -11,8 +11,14 @@
- - - + {if $multiple} + + + + {else} + + + + {/if}
-- 2.30.2