summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 1e015cd)
raw | patch | inline | side by side (parent: 1e015cd)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 17 Apr 2007 13:47:02 +0000 (13:47 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Tue, 17 Apr 2007 13:47:02 +0000 (13:47 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6071 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/admin/groups/class_divListGroup.inc | patch | blob | history | |
plugins/admin/groups/class_groupManagement.inc | patch | blob | history | |
plugins/admin/groups/remove.tpl | patch | blob | history |
diff --git a/plugins/admin/groups/class_divListGroup.inc b/plugins/admin/groups/class_divListGroup.inc
index 70070da433a4ec3b0c0effed8b46bb031dcd82cd..518e36740b90c3ccc8cf1d7189665373edad52c9 100644 (file)
$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='width:20px;'"));
$this->AddHeader(array("string"=>_("Groupname / Department")));
$this->AddHeader(array("string"=>_("Properties"),"attach"=>"style='width:136px;'"));
/* Add department selection */
$listhead .= _("Base")." <select name='CurrentMainBase' onChange='mainform.submit()' class='center'>$options</select>".
" <input type='image' class='center' src='images/list_submit.png' title='"._("Submit department")."' name='submit_department' alt='"._("Submit").
- "'> ".
- "</div>";
+ "'> ";
+
+ /* Multiple options */
+ $listhead .= " <input class='center' type='image' align='middle' src='images/edittrash.png'
+ title='"._("Remove selected groups")."' alt='"._("Remove groups")."' name='remove_multiple_groups'> ";
+ $listhead .= "</div>";
$this->SetListHeader($listhead);
}
$desc .= " (".$val['FAIrelease'][0].")";
}
+ $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+ "attach" => "style='width:20px;'");
+
$field1 = array("string" => sprintf($userimg,$val['dn']), "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, $posix." ".$enviro." ".$mail." ".$samba." ".$appl." ".$phone), "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/groups/class_groupManagement.inc b/plugins/admin/groups/class_groupManagement.inc
index 09c4bf058613b626d3bf6378f999de00e24c0497..a7376241df13bfcb148290db2455ef1dd884c937 100644 (file)
plugin::execute();
/* Store these posts if the current object is locked (used by somebody else)*/
- $_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_groups/");
/* Save data */
$s_action = "";
}elseif(preg_match("/^cut_.*/",$key)){
$s_action="cut";
$s_entry = preg_replace("/^cut_/i","",$key);
+ }elseif(preg_match("/^remove_multiple_groups/",$key)){
+ $s_action="del_multiple";
}
}
$s_entry = preg_replace("/_.$/","",$s_entry);
}
+ /********************
+ 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->grouplist[$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 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_group_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ $acl = $this->ui->get_permissions($dn, "users/user");
+ if (preg_match('/d/', $acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->usertab= new usertabs($this->config, $this->config->data['TABS']['USERTABS'],$dn);
+ $this->usertab->set_acl_base();
+ $this->usertab->delete ();
+ gosa_log ("User object '".$dn."' has been removed");
+ unset ($this->usertab);
+ $this->usertab= NULL;
+ } else {
+ print_red (sprintf(_("You are not allowed to delete the user '%s'!"),$dn));
+ if(isset($this->ui->uid)){
+ gosa_log ("Warning: '".$this->ui->uid."' tried to trick user deletion.");
+ }
+ }
+ /* Remove lock file after successfull deletion */
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
+ /********************
+ Delete MULTIPLE entries confirmed
+ ********************/
+
+ /* Confirmation for deletion has been passed. Users should be deleted. */
+ if (isset($_POST['delete_multiple_groups_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ /* Load permissions for selected 'dn' and check if
+ we're allowed to remove this 'dn' */
+ $acl = $this->ui->get_permissions($this->dn,"groups/group");
+ if(preg_match("/d/",$acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->grouptab= new grouptabs($this->config,$this->config->data['TABS']['GROUPTABS'], $this->dn);
+ $this->grouptab->set_acl_base($this->dn);
+ $this->grouptab->delete ();
+ gosa_log ("Group object'".$this->dn."' has been removed");
+ unset ($this->grouptab);
+ $this->grouptab= 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 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_user_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/********************
Delete 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 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->DivListGroup->SubSearch){
- $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4);
+ $this->DivListGroup->AddDepartments($this->DivListGroup->selectedBase,4,1);
}
$this->reload ();
$this->DivListGroup->setEntries($this->grouplist);
}
+ 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 reload($CreatePosixsList=false)
{
index 1f3ff8b96601a3be4e701029b07255133c8f1d31..c91b28f7f564072b87626241cb4648584a7270e5 100644 (file)
</p>
<p class="plugbottom">
+
+ {if $multiple}
+ <input type=submit name="delete_multiple_group_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_group_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>