summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: a161319)
raw | patch | inline | side by side (parent: a161319)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 06:12:03 +0000 (06:12 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 06:12:03 +0000 (06:12 +0000) |
Remove multiple implemented too.
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6073 594d385d-05f5-0310-b6e9-bd551577e9d8
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6073 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/ogroups/class_divListOGroup.inc b/plugins/admin/ogroups/class_divListOGroup.inc
index ad23b1f3dd891d083ad125691a52bc8a7f7b16bf..5ac05bc7791c0596c10ad727188cb3e9bebe9a51 100755 (executable)
$action_col_size += 38;
}
+ /* 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 object groups")." / "._("Departments"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Properties"), "attach" => "style='width:136px;'"));
/* Add department selector */
$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 object groups")."' alt='"._("Remove object groups")."' name='remove_multiple_ogroups'> ";
+
+ $listhead .="</div>";
$this->SetListHeader($listhead);
}
}else{
$desc = " - [ ".$val['description'][0]." ]";
}
+ /* 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 src='images/list_ogroup.png' alt='"._("Object group")."' ".$title.">", "attach" => "style='text-align:center;width: 20px;'");
$field2 = array("string" => sprintf($editlink,$key,($val['cn']['0'].$desc)), "attach" => "style='' ".$title);
$field3 = array("string" => preg_replace("/%KEY/", $key, $this->parent->convert_list($val))." ".$mail, "attach" => "style='width:136px;'");
$field4 = array("string" => preg_replace("/%KEY%/", $key, $actions), "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));
}
}
diff --git a/plugins/admin/ogroups/class_ogroupManagement.inc b/plugins/admin/ogroups/class_ogroupManagement.inc
index df051b4733936b8b2bb21eee776e581dc8eb9ed5..4f4317233f6c95f2afdd5808c064480a3db835c6 100644 (file)
Variable intialisation && Check posts for commands
****************/
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^group_edit_/","/^group_del_/","/^item_selected/","/^remove_multiple_ogroups/");
$smarty = get_smarty();
$s_action = "";
}elseif(preg_match("/^cut_.*/",$key)){
$s_action="cut";
$s_entry = preg_replace("/^cut_/i","",$key);
+ }elseif(preg_match("/^remove_multiple_ogroups/",$key)){
+ $s_action="del_multiple";
}elseif(preg_match("/_group_edit_/",$key)){
$type = preg_replace("/_group_edit_.*$/","",$key);
$s_action="edit";
}
+
+
+
+
+
+ /********************
+ 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){
+ $dn = $this->ogrouplist[$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("info", sprintf(_("You're about to delete the following object group(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_ogroup_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ $acl = $this->ui->get_permissions($dn, "ogroups");
+ if (preg_match('/d/', $acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->ogroup= new ogrouptabs($this->config,$this->config->data['TABS']['OGROUPTABS'], $dn);
+ $this->ogroup->delete ();
+ gosa_log ("Object group'".$this->dn."' has been removed");
+ unset ($this->ogroup);
+ $this->ogroup= NULL;
+ } else {
+
+ /* Normally this shouldn't be reached, send some extra
+ logs to notify the administrator */
+ print_red (_("You are not allowed to delete this object group!"));
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick group 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_ogroup_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/****************
Delete object group
****************/
/* Lock the current entry, so nobody will edit it during deletion */
add_lock ($this->dn, $this->ui->dn);
$smarty->assign("info", sprintf(_("You're about to delete the object group '%s'."), @LDAP::fix($this->dn)));
+ $smarty->assign("multiple", false);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
} else {
/* Add departments if subsearch is disabled */
if(!$this->DivListOGroup->SubSearch){
- $this->DivListOGroup->AddDepartments($this->DivListOGroup->selectedBase,4);
+ $this->DivListOGroup->AddDepartments($this->DivListOGroup->selectedBase,4,1);
}
$this->reload ();
$this->DivListOGroup->setEntries($this->ogrouplist);
}
+ 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);
+ }
+
+
function copyPasteHandling($s_action,$s_entry)
{
if($this->CopyPasteHandler){
index fd14a5a671b2cc64e2920a78aa507bf499385490..720156b97792b42e358f8b48a4bf416f7978150c 100644 (file)
</p>
<p class="plugbottom">
- <input type=submit name="delete_group_confirm" value="{t}Delete{/t}">
-
- <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {if $multiple}
+ <input type=submit name="delete_multiple_ogroup_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_ogroup_cancel" value="{t}Cancel{/t}">
+ {else}
+ <input type=submit name="delete_group_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {/if}
</p>
diff --git a/plugins/admin/users/class_divListUsers.inc b/plugins/admin/users/class_divListUsers.inc
index 177be0a36186be4914eb7ad77c679b5841b49b78..e5cec852ed47bcb8d3f472d32d6515e5bae98cdb 100644 (file)
/* Multiple options */
$listhead .= " <input class='center' type='image' align='middle' src='images/edittrash.png'
- title='"._("Remove selected user")."' alt='"._("Remove user")."' name='remove_multiple_user'> ";
+ title='"._("Remove selected user")."' alt='"._("Remove user")."' name='remove_multiple_users'> ";
$listhead .="</div>";;
$this->SetListHeader($listhead);
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index 9d24b558f2996da673e45c9a726be3b3c04f88ad..676e568b9ec5312f4693a596e4aafa3ca9cf21da 100644 (file)
foreach(array("del" => "user_del", "edit" => "user_edit",
"new" => "user_new",
"new_tpl" => "user_tplnew",
- "del_multiple" => "^remove_multiple_user",
+ "del_multiple" => "^remove_multiple_users",
"create_user_from_tpl" => "userfrom_tpl",
"change_pw" => "user_chgpw",
"editPaste" => "editPaste", "copy" => "copy",
$this->dns[$id] = $dn;
}
-
-
$dns_names = "<br><pre>";
foreach($this->dns as $dn){
add_lock ($dn, $this->ui->dn);