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 function divListMasses (&$config,$parent)
14 {
15 MultiSelectWindow::MultiSelectWindow($config, "gotoMasses", array("gotomasses"));
17 $this->parent = $parent;
18 $this->ui = get_userinfo();
19 $this->SetSummary(_("List of system deployment tasks"));
20 $this->SetHeadpageMode();
21 $this->EnableCloseButton(FALSE);
22 $this->EnableSaveButton(FALSE);
23 $this->SetInformation(_("This menu allows you to add, remove and change the properties of system deployment tasks."));
24 $this->GenHeader();
25 }
27 function GenHeader()
28 {
30 /* Display add button if allowed */
31 $header = "<div style='padding:5px'>";
32 if($this->parent->acl_is_createable()){
33 $header .= "<input type='image' src='images/gotomasses_new_task.png' name='new_task' class='center'> ";
34 }
36 /* Display add button if allowed */
37 if($this->parent->acl_is_removeable()){
38 $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'> ";
39 }
40 $header .= "</div>";
42 /* Create divlist */
43 $this->SetListHeader($header);
45 $plug = $_GET['plug'];
47 /* Toggle all selected / deselected */
48 $chk = "<input type='checkbox' id='select_all' name='select_all'
49 onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
51 /* set Page header */
52 $this->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
54 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=object'>"._("Target")."</a>"));
55 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=schedule'>"._("Schedule")."</a>",
56 "attach"=>"style='width:100px;'"));
57 $this->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=action'>"._("Type")."</a>",
58 "attach"=>"style='width:80px;'"));
59 $this->AddHeader(array("string"=>_("Action"),
60 "attach"=>"style='border-right:0px;width:40px;'"));
61 }
63 function execute()
64 {
65 $this->ClearElementsList();
66 $this->GenHeader();
67 }
70 function setEntries($tasks)
71 {
72 /* Create edit link */
73 $plug = $_GET['plug'];
74 $edit_link = "<div style='width:100%;overflow:hidden;'><nobr><a href='?plug=".$_GET['plug']."&act=edit&id=%key%'>%str%</nobr></div>";
76 foreach($tasks as $key => $task){
77 $action = "<input type='image' src='images/edit.png' name='edit_task_".$key."' class='center' alt='"._("Edit")."'>";
78 if($this->parent->acl_is_removeable()){
79 $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."' class='center' alt='"._("Reomve")."'>";
80 }
81 /* Create each field */
82 $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
83 "attach" => "style='width:20px;'");
85 $field1 = array("string" => preg_replace(array("/%key%/","/%str%/"),array($key,$this->parent->target_to_string($task)),$edit_link));
86 $field2 = array("string" => $this->parent->time_to_string($task),"attach" => "style='width:100px;'");
87 $field3 = array("string" => $this->parent->action_to_string($task),"attach" => "style='width:80px;'");
88 $field4 = array("string" => $action,"attach" => "style='text-align:right;width:40px;border-right:0px;'");
89 $this->AddElement(array($field0,$field1,$field2,$field3,$field4));
90 }
91 }
94 function Save()
95 {
96 MultiSelectWindow :: Save();
97 }
100 function save_object()
101 {
102 /* Save automatic created POSTs like regex, checkboxes */
103 MultiSelectWindow :: save_object();
104 }
105 }
106 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
107 ?>