summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e9ecb3d)
raw | patch | inline | side by side (parent: e9ecb3d)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 08:46:24 +0000 (08:46 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 08:46:24 +0000 (08:46 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6077 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/admin/applications/class_applicationManagement.inc b/plugins/admin/applications/class_applicationManagement.inc
index 801ca3fe6268847ea647622a53ecf8b47b7f3b13..c07e40ccd55ac30aa240b729b7ff2ef861a36a05 100644 (file)
/* These vars will be stored if you try to open a locked app,
to be able to perform your last requests after showing a warning message */
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^appl_edit_/","/^appl_del_/","/^item_selected/","/^remove_multiple_applications/");
$smarty = get_smarty(); // Smarty instance
$s_action = ""; // Contains the action to proceed
// Post for new
}elseif(preg_match("/^appl_new.*/",$key)){
$s_action="new";
+ }elseif(preg_match("/^remove_multiple_applications/",$key)){
+ $s_action="del_multiple";
}elseif(preg_match("/^editPaste.*/i",$key)){
$s_action="editPaste";
}
}
+
+ /********************
+ 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->applications[$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("intro", sprintf(_("You're about to delete the following application(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_application_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ $ui = get_userinfo();
+ $acl = $ui->get_permissions($dn ,"application/application");
+ if (preg_match('/d/', $acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->apptabs= new apptabs($this->config, $this->config->data['TABS']['APPSTABS'], $dn,"application");
+ $this->apptabs->set_acl_base($dn);
+ $this->apptabs->delete ();
+ gosa_log ("Application object'".$dn."' has been removed");
+ unset ($this->apptabs);
+ $this->apptabs= 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 application!"));
+ 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_application_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
/****************
Delete app
****************/
/* Display dialog with system list */
$this->DivListApplication->parent = $this;
$this->DivListApplication->execute();
- $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase);
+ $this->DivListApplication->AddDepartments($this->DivListApplication->selectedBase,3,1);
$this->reload();
$this->DivListApplication->setEntries($this->applications);
return($this->DivListApplication->Draw());
}
}
+ 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);
+ }
+
+
/* Save to LDAP */
function save()
{
diff --git a/plugins/admin/applications/class_divListApplication.inc b/plugins/admin/applications/class_divListApplication.inc
index e81ca4e07d9aee4240a7f26a04d777daa0f800d0..19aa04b87fcb0101d7fb30818ae1e72c01be905a 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" => _("Application name")." / "._("Department"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
/* And the rest, a base selection box */
$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 applications")."' alt='"._("Remove applications")."' name='remove_multiple_applications'> ";
+
+ $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" => sprintf($applimg,$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, $actions), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'");
- $this->AddElement(array($field1,$field2,$field3));
+ $this->AddElement(array($field0,$field1,$field2,$field3));
}
}
index 5b4c3e823caf7521592ea3748fbe2925efc7df69..8598ed857682ce39cf116b1f00dda7b89c1838c4 100644 (file)
</p>
<p class="plugbottom">
- <input type=submit name="delete_app_confirm" value="{t}Delete{/t}">
-
- <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {if $multiple}
+ <input type=submit name="delete_multiple_application_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_application_cancel" value="{t}Cancel{/t}">
+ {else}
+ <input type=submit name="delete_app_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {/if}
</p>
diff --git a/plugins/admin/users/class_userManagement.inc b/plugins/admin/users/class_userManagement.inc
index 676e568b9ec5312f4693a596e4aafa3ca9cf21da..f8b32dc3c759fe5af7ce657debf16877d9125470 100644 (file)
plugin::execute();
/* LOCK MESSAGE Vars */
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/","/^item_selected/","/^remove_multiple_user/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^user_edit_/","/^user_del_/","/^item_selected/","/^remove_multiple_users/");
$smarty = get_smarty(); // Smarty instance
$s_action = ""; // Contains the action to be taken