summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 87f012a)
raw | patch | inline | side by side (parent: 87f012a)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 12:57:08 +0000 (12:57 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 12:57:08 +0000 (12:57 +0000) |
diff --git a/plugins/admin/mimetypes/class_divListMimeTypes.inc b/plugins/admin/mimetypes/class_divListMimeTypes.inc
index 17a706e633ea2cac129c3fa37224f4f8525d8948..8fbd5c22519b90192f73c0e97d19b037b01ad610 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" => _("Mime type name")." / "._("Department"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'"));
/* And at least add a department 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 mimetype")."' alt='"._("Remove mimetype")."' name='remove_multiple_mimetypes'> ";
+
+ $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($mimeimg,$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));
}
}
diff --git a/plugins/admin/mimetypes/class_mimetypeManagement.inc b/plugins/admin/mimetypes/class_mimetypeManagement.inc
index e4e7782efb8be47d0bc510984a14089499890e40..44e0efb1e6feabe41064c649abe052bdff6a0be7 100755 (executable)
/* These vars will be stored if you try to open a locked mime,
to be able to perform your last requests after showing a warning message */
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^act$/","/^id$/","/^mime_edit_/","/^mime_del_/","/^item_selected/","/^remove_multiple_mimetypes/");
$smarty = get_smarty(); // Smarty instance
$s_action = ""; // Contains the action to proceed
// Post for new
}elseif(preg_match("/^mime_new.*/",$key)){
$s_action="new";
+ }elseif(preg_match("/^remove_multiple_mimetypes/",$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->mimetypes[$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 user(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_mimetype_confirm'])){
+
+ $ui = get_userinfo();
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+
+ $acl = $ui->get_permissions($dn,"mimetypes/mimetype");
+ if(preg_match("/d/",$acl)){
+
+ /* Delete request is permitted, perform LDAP action */
+ $this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $dn,"mimetypes");
+ $this->mimetabs->set_acl_base($dn);
+ $this->mimetabs->delete ();
+ gosa_log ("Mime type object'".$dn."' has been removed");
+ unset ($this->mimetabs);
+ $this->mimetabs= 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 mime type!"));
+ 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_mimetype_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/****************
Delete mime type
****************/
add_lock ($this->dn, $this->ui->dn);
$smarty= get_smarty();
$smarty->assign("intro", sprintf(_("You're about to delete the mime type '%s'."), @LDAP::fix($this->dn)));
+ $smarty->assign("multiple", false);
return($smarty->fetch (get_template_path('remove.tpl', TRUE)));
} else {
$ui = get_userinfo();
$acl = $ui->get_permissions($this->dn,"mimetypes/mimetype");
if(preg_match("/d/",$acl)){
+
/* Delete request is permitted, perform LDAP action */
$this->mimetabs= new mimetabs($this->config, $this->config->data['TABS']['MIMETABS'], $this->dn,"mimetypes");
$this->mimetabs->set_acl_base($this->dn);
/* Display dialog with system list */
$this->DivListMimeTypes->parent = $this;
$this->DivListMimeTypes->execute();
- $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase);
+ $this->DivListMimeTypes->AddDepartments($this->DivListMimeTypes->selectedBase,3,1);
$this->reload();
$this->DivListMimeTypes->setEntries($this->mimetypes);
return($this->DivListMimeTypes->Draw());
return(false);
}
+
+ 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()
{
index 593c8175d6a2bcd764262d02207d4b2efae19db7..30c4233186c897949c925caa41d0b79b3fe55998 100755 (executable)
</p>
<p class="plugbottom">
- <input type=submit name="delete_mime_confirm" value="{t}Delete{/t}">
-
- <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {if $multiple}
+ <input type=submit name="delete_multiple_mimetype_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_mimetype_cancel" value="{t}Cancel{/t}">
+ {else}
+ <input type=submit name="delete_mime_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_cancel" value="{t}Cancel{/t}">
+ {/if}
</p>