1 <?php
3 class divListMasses extends MultiSelectWindow
4 {
6 /* Current base */
7 var $selectedBase = "";
8 var $departments = array();
10 var $parent ;
11 var $ui ;
13 var $wake = TRUE;
15 function divListMasses (&$config,$parent)
16 {
17 MultiSelectWindow::MultiSelectWindow($config, "gotoMasses", array("gotomasses"));
19 $this->parent = $parent;
20 $this->ui = get_userinfo();
21 $this->SetSummary(_("List of system deployment tasks"));
22 $this->SetHeadpageMode();
23 $this->EnableCloseButton(FALSE);
24 $this->EnableSaveButton(FALSE);
25 $this->SetInformation(_("This menu allows you to add, remove and change the properties of system deployment tasks."));
27 foreach($this->parent->get_actions() as $name => $desc){
28 $this->$name = TRUE;
29 $this->AddCheckBox($name,sprintf(_("Display entries with action %s."),$desc),
30 sprintf(_("Display entries with action %s."),$desc),TRUE);
31 }
32 $plug = $_GET['plug'];
34 /* Toggle all selected / deselected */
35 $chk = "<input type='checkbox' id='select_all' name='select_all'
36 onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
38 /* set Page header */
39 $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
41 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=object'>"._("Target")."</a>"));
42 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=schedule'>"._("Schedule")."</a>",
43 "attach"=>"style='width:100px;'"));
44 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=action'>"._("Type")."</a>",
45 "attach"=>"style='width:80px;'"));
46 $this->AddHeader(array("string"=>_("Action"),
47 "attach"=>"style='border-right:0px;width:40px;'"));
48 }
50 function GenHeader()
51 {
53 /* Display add button if allowed */
54 $header = "<div style='padding:5px'>";
55 if($this->parent->acl_is_createable()){
56 $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'> ";
57 }
59 /* Display add button if allowed */
60 if($this->parent->acl_is_removeable()){
61 $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'> ";
62 }
63 $header .= "</div>";
65 /* Create divlist */
66 $this->SetListHeader($header);
68 }
70 function execute()
71 {
72 $this->ClearElementsList();
73 $this->GenHeader();
74 }
77 function setEntries($tasks)
78 {
79 /* Create edit link */
80 $plug = $_GET['plug'];
81 $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%key%'>%str%</nobr></div>";
83 /* Create action filter array, to sort out those actions we do not want to see */
84 $allowed_action = array();
85 foreach($this->parent->get_actions() as $name => $desc){
86 if($this->$name){
87 $allowed_action[] = $name;
88 }
89 }
91 foreach($tasks as $key => $task){
93 /* Skip unchecked actions */
94 if(!in_array($task['Action'],$allowed_action)){
95 continue;
96 }
98 $action = "<input type='image' src='images/edit.png' name='edit_task_".$key."' class='center' alt='"._("Edit")."'>";
99 if($this->parent->acl_is_removeable()){
100 $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."' class='center' alt='"._("Reomve")."'>";
101 }
102 /* Create each field */
103 $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
104 "attach" => "style='width:20px;'");
106 $field1 = array("string" => preg_replace(array("/%key%/","/%str%/"),array($key,$this->parent->target_to_string($task)),$edit_link));
107 $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='width:100px;'");
108 $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='width:80px;'");
109 $field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'");
110 $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
111 }
112 }
115 function Save()
116 {
117 MultiSelectWindow :: Save();
118 }
121 function save_object()
122 {
123 /* Save automatic created POSTs like regex, checkboxes */
124 MultiSelectWindow :: save_object();
125 }
126 }
127 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
128 ?>