summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 691a44d)
raw | patch | inline | side by side (parent: 691a44d)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 13:35:41 +0000 (13:35 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 18 Apr 2007 13:35:41 +0000 (13:35 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6093 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/plugins/gofax/blocklists/class_blocklistManagement.inc b/plugins/gofax/blocklists/class_blocklistManagement.inc
index d3e7377803a8848f3105b9a1001675d145432a5d..a002dfcb8dac9cd1a3ca537dadaabc375ba451b1 100644 (file)
/* Call parent execute */
plugin::execute();
- $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFaxBlocklist_/","/^act$/","/^id$/");
+ $_SESSION['LOCK_VARS_TO_USE'] = array("/^goFaxBlocklist_/","/^act$/","/^id$/","/^remove_multiple_blocklists/","/^item_selected/");
/***************
Init vars
// Post for new
}elseif(preg_match("/^goFaxBlocklist_new.*/",$key)){
$s_action="new";
+ }elseif(preg_match("/^remove_multiple_blocklists/",$key)){
+ $s_action="del_multiple";
}
}
}
+ /********************
+ Delete MULTIPLE entries requested, display confirm dialog
+ ********************/
+
+ if ($s_action=="del_multiple"){
+
+ $this->dns = array();
+ $ids = $this->list_get_selected_items();
+
+ if(count($ids)){
+ foreach($ids as $id){
+ $dn = $this->blocklists[$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 blocklists(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_blocklist_confirm'])){
+
+ /* Remove user by user and check acls before removeing them */
+ foreach($this->dns as $key => $dn){
+ $acl = $this->ui->get_permissions($dn, "blocklist/blocklist");
+ if (preg_match('/d/', $acl)){
+ $this->dn = $dn;
+ $this->remove_from_parent();
+ } else {
+ print_red (sprintf(_("You are not allowed to delete the blocklist '%s'!"),$dn));
+ }
+ /* Remove lock file after successfull deletion */
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ $this->reload();
+ }
+
+
+ /********************
+ Delete MULTIPLE entries Canceled
+ ********************/
+
+ /* Remove lock */
+ if(isset($_POST['delete_multiple_blocklist_cancel'])){
+ foreach($this->dns as $key => $dn){
+ del_lock ($dn);
+ unset($this->dns[$key]);
+ }
+ }
+
+
/***************
Remove blocklist
***************/
add_lock ($this->dn, $this->ui->dn);
$smarty->assign("info", sprintf(_("You're about to delete the blocklist '%s'."), $this->dn));
+ $smarty->assign("multiple", false);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
}
}
/* Add departments if subsearch is disabled */
if(!$this->DivListBlocklist->SubSearch){
- $this->DivListBlocklist->AddDepartments($this->DivListBlocklist->selectedBase);
+ $this->DivListBlocklist->AddDepartments($this->DivListBlocklist->selectedBase,3,1);
}
$this->reload();
$this->DivListBlocklist->setEntries($this->blocklists);
}
+ 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);
+ }
+
+
/* Return departments, that will be included within snapshot detection */
function get_used_snapshot_bases()
{
diff --git a/plugins/gofax/blocklists/class_divListBlocklists.inc b/plugins/gofax/blocklists/class_divListBlocklists.inc
index f96f64c435a23f8262235269cbe7b7f9f9523ee9..02c616324a8ca285fd80ee9b7d540145e65d01a2 100755 (executable)
$action_col_size += 20;
}
+ /* 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" => _("Blocklist name")." / "._("Department"), "attach" => "style=''"));
$this->AddHeader(array("string" => _("Actions"), "attach" => "style='width:".$action_col_size."px;border-right:0px;text-align:right;'" ));
/* Append 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 blocklists")."' alt='"._("Remove blocklists")."' name='remove_multiple_blocklists'> ";
+
+ $listhead .="</div>";
$this->SetListHeader($listhead);
}
}else{
$display= $val["cn"][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($blockimg,$val['dn']), "attach" => "style='text-align:center;width:20px;'");
$field2 = array("string" => sprintf($editlink,$key,$display), "attach" => "style='' title='".preg_replace('/ /', ' ', @LDAP::fix($val['dn']))."'");
$field3 = array("string" => preg_replace("/%KEY%/", "$key", $action), "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 6784741a48d2e688e3356cf4a9cb794d113c316f..ebea1e3ca9e8aa450846dd9567a5024660511295 100644 (file)
</p>
<p class="plugbottom">
- <input type=submit name="delete_blocklist_confirm" value="{t}Delete{/t}">
-
- <input type=submit name="delete_blocklist_cancel" value="{t}Cancel{/t}">
+ {if $multiple}
+ <input type=submit name="delete_multiple_blocklist_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_multiple_blocklist_cancel" value="{t}Cancel{/t}">
+ {else}
+ <input type=submit name="delete_blocklist_confirm" value="{t}Delete{/t}">
+
+ <input type=submit name="delete_blocklist_cancel" value="{t}Cancel{/t}">
+ {/if}
</p>