summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: e718f99)
raw | patch | inline | side by side (parent: e718f99)
author | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 22 Aug 2007 07:49:18 +0000 (07:49 +0000) | ||
committer | hickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Wed, 22 Aug 2007 07:49:18 +0000 (07:49 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@7095 594d385d-05f5-0310-b6e9-bd551577e9d8
plugins/addons/gotomasses/class_gotomasses.inc | patch | blob | history | |
plugins/addons/gotomasses/remove.tpl | patch | blob | history |
diff --git a/plugins/addons/gotomasses/class_gotomasses.inc b/plugins/addons/gotomasses/class_gotomasses.inc
index dc2bb580ed7f0e843595837c1fd5797729f52536..540e0d9f7abc9ef8ac711a711889c222765dd86d 100644 (file)
var $tasks = array();
var $current =false;
var $dialog = FALSE;
+ var $ids_to_remove = array();
function gotomasses($config, $dn= NULL)
{
************/
$s_entry = $s_action = "";
- $arr = array("/^edit_task_/"=>"edit","/^remove_task_/"=>"remove","/^new_task_/"=>"new_task");
+ $arr = array( "/^edit_task_/"=>"edit","/^remove_task_/"=>"remove",
+ "/^new_task_/"=>"new_task","/^remove_multiple_task_/" => "remove_multiple");
foreach($arr as $regex => $action){
foreach($_POST as $name => $value){
if(preg_match($regex,$name)){
* List posts
************/
+ /* Remove multiple */
+ if($s_action == "remove_multiple"){
+ if(!$this->acl_is_removeable()){
+ print_red(_("You are not allowed to remove a task."));
+ }else{
+ $this->ids_to_remove = $this->list_get_selected_items();
+ $tmp = "";
+ foreach($this->ids_to_remove as $id){
+ $task = $this->tasks[$id];
+ $tmp.= "\n".$this->target_to_string($task);
+ }
+ $smarty->assign("multiple", TRUE);
+ $smarty->assign("info",sprintf(_("Your are about to delete the following tasks: %s"),"<pre>".$tmp."</pre>"));
+ $this->current = $s_entry;
+ return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
+ }
+ }
+
+ /* Remove specified tasks */
+ if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
+ foreach($this->ids_to_remove as $id){
+ if(isset($this->tasks[$id])){
+ unset($this->tasks);
+ }
+ }
+ }
+
/* Remove entry from list */
if($s_action == "remove" && isset($this->tasks[$s_entry])){
if(!$this->acl_is_removeable()){
print_red(_("You are not allowed to remove a task."));
}else{
- $smarty->assign("info",_("Your are about to delete a gotomasses task."));
+ $entry = $this->tasks[$s_entry];
$this->current = $s_entry;
+ $smarty->assign("info",sprintf(_("Your are about to delete the following tasks: %s"),
+ "<pre>".$this->target_to_string($entry)."</pre>"));
+ $smarty->assign("multiple", FALSE);
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
}
}
$this->save();
}
+ /* Remove aborted */
+ if(isset($_POST['delete_cancel'])){
+ $this->ids_to_remove = array();;
+ }
+
/* Edit selected entry */
if($s_action == "edit" && isset($this->tasks[$s_entry])){
$entry = $this->tasks[$s_entry];
$divlist->SetInformation(_("This menu allows you to add, remove and change the properties of gotomasses tasks."));
/* Display add button if allowed */
+ $header = "<div style='padding:5px'>";
if($this->acl_is_createable()){
- $header = "<div style='padding:5px'>
- <input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'>
- </div>";
- }else{
- $header = "";
+ $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'> ";
}
+ /* Display add button if allowed */
+ if($this->acl_is_removeable()){
+ $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'> ";
+ }
+ $header .= "</div>";
+
/* Get Permissions */
$ui = get_userinfo();
$acls = $this->getacl("");
/* Create divlist */
$divlist->SetListHeader($header);
+ /* 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 */
+ $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
+
$divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=object'>"._("Target")."</a>"));
$divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=schedule'>"._("Schedule")."</a>",
"attach"=>"style='width:100px;'"));
if($this->acl_is_removeable()){
$action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."' class='center' alt='"._("Reomve")."'>";
}
+ /* Create each field */
+ $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+ "attach" => "style='width:20px;'");
+
$field1 = array("string" => "<div style='width:100%;overflow:hidden;'><nobr>".$this->target_to_string($task)."</nobr></div>");
$field2 = array("string" => $this->time_to_string($task),"attach" => "style='width:100px;'");
$field3 = array("string" => $this->action_to_string($task),"attach" => "style='width:80px;'");
$field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'");
- $divlist->AddElement(array($field1,$field2,$field3,$field4));
+ $divlist->AddElement(array($field0,$field1,$field2,$field3,$field4));
}
}
}
+ 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 get_actions()
{
/* Prepare list of available actions */
index e34108e5a53bf91bd827745ddbd32ff7d9dbe2b1..023142f975b76ec1ea7ede3d4d55d0a3aaa16f8a 100644 (file)
</p>
<p class="plugbottom">
+{if $multiple}
+ <input type=submit name="delete_multiple_confirm" value="{t}Delete{/t}">
+{else}
<input type=submit name="delete_confirm" value="{t}Delete{/t}">
+{/if}
<input type=submit name="delete_cancel" value="{t}Cancel{/t}">
</p>