summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: ef66e2c)
raw | patch | inline | side by side (parent: ef66e2c)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 07:01:29 +0000 (07:01 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 07:01:29 +0000 (07:01 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6074 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/departments/class_departmentManagement.inc b/plugins/admin/departments/class_departmentManagement.inc
index 2bdcf1b879adea05cf4e60150f35271476b5b97e..f4bb2fbac6c3f9bbd41d690c955c8dd2932e5091 100644 (file)
Var init
***************/
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^dep_edit_.*/","/^dep_del_.*/","/^item_selected/","/^remove_multiple_departments/");
/* Reload departments */
$smarty = get_smarty();
$s_entry = preg_replace("/_.*$/","",$s_entry);
$s_entry = base64_decode($s_entry);
// Post for new
+ }elseif(preg_match("/^remove_multiple_departments/",$key)){
+ $s_action="del_multiple";
}elseif(preg_match("/dep_new.*/",$key)){
$s_action="new";
}
-
}
}
+ /********************
+ Delete MULTIPLE entries requested, display confirm dialog
+ ********************/
+
+ if ($s_action=="del_multiple"){
+ $ids = $this->list_get_selected_items();
+
+
+ if(count($ids)){
+ foreach($ids as $id){
+ $id = base64_decode($id);
+ $dn = $this->config->departments[$id];
+
+ 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("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
***************/
}
+
+ 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 32b79bf8806f58ba3f5c60faea0c963bf234310a..ecc1c3784f397b9ae61e206f2710b351ee1ccda6 100755 (executable)
$this->EnableCloseButton(false);
$this->EnableSaveButton (false);
+
+
+ /* Toggle all selected / deselected */
+ $chk = "<input type='checkbox' id='select_all' name='select_all'
+ onClick='toggle_all_(\"^item_selected_[a-zA-Z0-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"=>_("Department name"), "attach" => "style=''"));
$this->AddHeader(array("string" =>_("Actions"), "attach" => "style='width:60px;border-right:0px;text-align:right;'"));
" alt='' height='16' width='1'> ".
" "._("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 departments")."' alt='"._("Remove departments")."' name='remove_multiple_departments'> ";
+
+ $listhead .="</div>";;
$this->SetListHeader($listhead);
}
}
$title = preg_replace('/ /', ' ', @LDAP::fix($this->config->departments[$key]));
+ /* Create each field */
+ $field01 = array("string" => "<input type='checkbox' id='item_selected_".base64_encode($key)."' name='item_selected_".base64_encode($key)."'>" ,
+ "attach" => "style='width:20px;'");
+
$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" => 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));
}
}
index 33fdbbc2f396354da358d3919b5c0f44e6fbb7e3..e4e075aa3027df1de96f6c242222967f00f9360d 100644 (file)
</p>
<p class="plugbottom">
- <input type=submit name="delete_department_confirm" value="{t}Delete{/t}">
-
- <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {if $multiple}
+ <input type=submit name="delete_multiple_department_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_department_cancel" value="{t}Cancel{/t}">
+ {else}
+ <input type=submit name="delete_department_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {/if}
</p>