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,$desc,$desc,TRUE);
30 }
31 $plug = $_GET['plug'];
33 /* Toggle all selected / deselected */
34 $chk = "<input type='checkbox' id='select_all' name='select_all'
35 onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
37 /* set Page header */
38 $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
40 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=object'>"._("Target")."</a>"));
41 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=schedule'>"._("Schedule")."</a>",
42 "attach"=>"style='width:100px;'"));
43 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=action'>"._("Type")."</a>",
44 "attach"=>"style='width:80px;'"));
45 $this->AddHeader(array("string"=>_("Action"),
46 "attach"=>"style='border-right:0px;width:40px;'"));
47 }
49 function GenHeader()
50 {
52 /* Display add button if allowed */
53 $header = "<div style='padding:5px'>";
54 if($this->parent->acl_is_createable()){
55 $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'> ";
56 }
58 /* Display add button if allowed */
59 if($this->parent->acl_is_removeable()){
60 $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'> ";
61 }
62 $header .= "</div>";
64 /* Create divlist */
65 $this->SetListHeader($header);
67 }
69 function execute()
70 {
71 $this->ClearElementsList();
72 $this->GenHeader();
73 }
76 function setEntries($tasks)
77 {
78 /* Create edit link */
79 $plug = $_GET['plug'];
80 $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%key%'>%str%</nobr></div>";
82 /* Create action filter array, to sort out those actions we do not want to see */
83 $allowed_action = array();
84 foreach($this->parent->get_actions() as $name => $desc){
85 if($this->$name){
86 $allowed_action[] = $name;
87 }
88 }
90 foreach($tasks as $key => $task){
92 /* Skip unchecked actions */
93 if(!in_array($task['Action'],$allowed_action)){
94 continue;
95 }
97 $action = "<input type='image' src='images/edit.png' name='edit_task_".$key."' class='center' alt='"._("Edit")."'>";
98 if($this->parent->acl_is_removeable()){
99 $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."' class='center' alt='"._("Reomve")."'>";
100 }
101 /* Create each field */
102 $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
103 "attach" => "style='width:20px;'");
105 $field1 = array("string" => preg_replace(array("/%key%/","/%str%/"),array($key,$this->parent->target_to_string($task)),$edit_link));
106 $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='width:100px;'");
107 $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='width:80px;'");
108 $field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'");
109 $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
110 }
111 }
114 function Save()
115 {
116 MultiSelectWindow :: Save();
117 }
120 function save_object()
121 {
122 /* Save automatic created POSTs like regex, checkboxes */
123 MultiSelectWindow :: save_object();
124 }
125 }
126 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
127 ?>