Code

Updated gotomasses.
[gosa.git] / gosa-plugins / goto / addons / gotomasses / class_gotomasses.inc
1 <?php
3 class gotomasses extends plugin
4 {
5   /* Definitions */
6   var $plHeadline     = "System deployment";
7   var $plDescription  = "This does something";
9   /* attribute list for save action */
10   var $attributes= array();
11   var $objectclasses= array();
13   /* Queue tasks */
14   var $current        = FALSE;
15   var $dialog         = FALSE;
16   var $ids_to_remove  = array();
17   var $divlist        = NULL;
19   var $events         = array();
21   var $sort_by  = "Schedule";
22   var $sort_dir = "down";
23   var $entries  = array();
24   var $range    = 25;
25   var $start    = 0;
27   function gotomasses(&$config, $dn= NULL)
28   {
29     /* Include config object */
30     $this->config= &$config;
31     $this->o_queue = new gosaSupportDaemon(TRUE,10);
32     $this->events  = DaemonEvent::get_event_types();
33   }
36   function execute()
37   {
38     $smarty = get_smarty();
39  
40     /************
41      * Handle posts 
42      ************/
43     
44     $s_entry = $s_action = "";
45     $arr = array( 
47         "/^pause_/"           => "pause",
48         "/^resume_/"          => "resume",
49         "/^execute_process_/" => "execute_process",
50         "/^abort_process_/"   => "abort_process",
52         "/^prio_up_/"     => "prio_up",
53         "/^prio_down_/"   => "prio_down",
55         "/^edit_task_/"             =>  "edit",
56         "/^remove_task_/"           =>  "remove",
57         "/^new_task_/"              =>  "new_task");;
60     foreach($arr as $regex => $action){
61       foreach($_POST as $name => $value){
62         if(preg_match($regex,$name)){
63           $s_action = $action;
64           $s_entry  = preg_replace($regex,"",$name);
65           $s_entry  = preg_replace("/_(x|y)$/","",$s_entry);
66         }
67       }
68     }
70     /* Menu actions */
71     if(isset($_POST['menu_action']) && !empty($_POST['menu_action'])){
72       $s_action = $_POST['menu_action'];
73     }
74     
75     /* Edit posted from list link */
76     if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
77       $s_action = "edit";
78       $s_entry = $_GET['id'];
79     }
82     /************
83      * Handle Priority modifications  
84      ************/
86     if(preg_match("/^prio_/",$s_action)){
87       switch($s_action){
88         case 'prio_down'  : $this->update_priority($s_entry,"down");break;
89         case 'prio_up'    : $this->update_priority($s_entry,"up");break;
90       }
91     }
93     /************
94      * Handle pause/resume/execute modifications  
95      ************/
97     if(preg_match("/^resume/",$s_action) || 
98        preg_match("/^pause/",$s_action) || 
99        preg_match("/^abort_process/",$s_action) || 
100        preg_match("/^execute_process/",$s_action)){
102       switch($s_action){
103         case 'resume'         : $this->resume_queue_entries   (array($s_entry));break; 
104         case 'pause'          : $this->pause_queue_entries    (array($s_entry));break; 
105         case 'execute_process': $this->execute_queue_entries  (array($s_entry));break; 
106         case 'abort_process'  : $this->abort_queue_entries    (array($s_entry));break; 
107         case 'resume_all'         : $this->resume_queue_entries   ($this->list_get_selected_items());break; 
108         case 'pause_all'          : $this->pause_queue_entries    ($this->list_get_selected_items());break; 
109         case 'execute_process_all': $this->execute_queue_entries  ($this->list_get_selected_items());break; 
110         case 'abort_process_all'  : $this->abort_queue_entries    ($this->list_get_selected_items());break; 
112         default : trigger_error("Undefined action setting used (".$s_action.").");
113       }
114       if($this->o_queue->is_error()){
115         msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
116       }
117     }
119     /************
120      * ADD 
121      ************/
122   
123     if(preg_match("/^add_event_/",$s_action)){
124       $type = preg_replace("/^add_event_/","",$s_action);
125       if(isset($this->events['BY_CLASS'][$type])){
126         $e_data = $this->events['BY_CLASS'][$type];
127         $this->dialog = new $e_data['CLASS_NAME']($this->config);
128       }
129     }
131     /************
132      * EDIT
133      ************/
135     if($s_action == "edit"){  
136       $id =  $s_entry;
137       $type = FALSE;
138       if(isset($this->entries[$id])){
139         $event = $this->entries[$s_entry];
140         if(isset($this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']])){
141           $type = $this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']];
142           $this->dialog = new $type['CLASS_NAME']($this->config,$event);
143         }
144       }
145     }
147     /************
148      * REMOVE 
149      ************/
151     /* Remove multiple */
152     if($s_action == "remove_multiple" || $s_action == "remove"){
154       if(!$this->acl_is_removeable()){
155         msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
156       }else{
158         if($s_action == "remove"){
159           $ids = array($s_entry);
160         }else{
161           $ids = $this->list_get_selected_items();
162         }
164         if(count($ids)){
165           $ret = $this->o_queue->ids_exist($ids);
166           $ret = $this->o_queue->get_entries_by_id($ret);
168           $tmp = "";
169           foreach($ret as $task){
171             /* Only remove WAITING or ERROR entries */
172             if(in_array($task['STATUS'],array("waiting","error"))){
173               $this->ids_to_remove[] = $task['ID'];
174               if(isset($this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']])){
175                 $evt = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']];
176                 $tmp.= "\n".$task['ID']." - ".$evt['s_Menu_Name']."&nbsp;".$task['MACADDRESS'];
177               }else{
178                 $tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']."&nbsp;".$task['MACADDRESS'];
179               }
180             }
181           }
182           $smarty->assign("multiple", TRUE); 
183           $smarty->assign("info",sprintf(_("You are about to remove the following actions from the GOsa support Daemon: %s"),"<pre>".$tmp."</pre>"));
184           $this->current = $s_entry;
185           return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
186         }
187       }
188     }
190     /* Remove specified tasks */
191     if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
192       $this->o_queue->remove_entries($this->ids_to_remove);
193       $this->save();
194     }
196     /* Remove aborted */
197     if(isset($_POST['delete_cancel'])){
198       $this->ids_to_remove = array();;
199     }
202     /************
203      * EDIT 
204      ************/
206     /* Close dialog */
207     if(isset($_POST['save_event_dialog'])){
208       if(is_object($this->dialog)){
209         $this->dialog->save_object();
210         if($this->dialog->is_new()){
211           $header     = $this->dialog->get_schedule_action();
212           $targets    = $this->dialog->get_targets();
213           $data       = $this->dialog->save();
215           foreach($targets as $target){
216             $data['macaddress'] =  $target;
217             $this->o_queue->send_data($header,$target,$data,TRUE);
218             if($this->o_queue->is_error()){
219               msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
220                     $this->o_queue->get_error()),ERROR_DIALOG);
221             }else{
222               $this->dialog = FALSE; 
223               $this->current = -1;
224             } 
225           }
226         }else{
227           $id                 = $this->dialog->get_id();
228           $data               = $this->dialog->save();
229           if($this->o_queue->update_entries(array($id),$data)){
230             $this->dialog = FALSE;
231             $this->current = -1;
232           }else{
233             msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
234               $this->o_queue->get_error()),ERROR_DIALOG);
235           }
236         }
237       }
238     }
241     /* Close dialog */
242     if(isset($_POST['abort_event_dialog'])){
243       $this->dialog = FALSE;
244       $this->current = -1;
245     }
247     /* Display dialogs if currently opened */
248     if(is_object($this->dialog)){
249       $this->dialog->save_object();
250       return($this->dialog->execute());
251     }
253     /************
254      * Handle Divlist 
255      ************/
257     $divlist = new MultiSelectWindow($this->config,"gotoMasses",array("gotomasses"));
258     $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa deamon tasks."));
259     $divlist->SetSummary(_("List of queued deamon jobs"));
260     $divlist->EnableCloseButton(FALSE);
261     $divlist->EnableSaveButton(FALSE);
262     $divlist->SetHeadpageMode();
263     $s = ".|"._("Actions")."|\n";
264     $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>&nbsp;"._("Create")."\n";
265     foreach($this->events['BY_CLASS'] as $name =>  $event){
266       $s.= "...|".$event['MenuImage']."&nbsp;".$event['s_Menu_Name']."|add_event_".$name."\n";
267     }
268     if($this->acl_is_removeable()){
269       $s.= "..|---|\n";
270       $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'>&nbsp;"._("Remove")."|remove_multiple\n";
271     }
272     if(preg_match("/w/",$this->getacl(""))){
273       $s.= "..|---|\n";
274       $s.= "..|<img src='images/status_start.png' alt='' border='0' class='center'>&nbsp;"._("Resume all")."|resume_all\n";
275       $s.= "..|<img src='images/status_pause.png' alt='' border='0' class='center'>&nbsp;"._("Pause all")."|pause_all\n";
276       $s.= "..|<img src='images/small_error.png'  alt='' border='0' class='center'>&nbsp;"._("Abort all")."|abort_process_all\n";
277       $s.= "..|<img src='images/rocket.png'       alt='' border='0' class='center'>&nbsp;"._("Execute all")."|execute_process_all\n";
278     }
280     $divlist->SetDropDownHeaderMenu($s);
282     if($this->sort_dir == "up"){
283       $sort_img = "<img src='images/sort_up.png' alt='/\' border=0>";
284     }else{
285       $sort_img = "<img src='images/sort_down.png' alt='\/' border=0>";
286     }
288     if($this->sort_by == "TargetName"){ $sort_img_1 = $sort_img; } else { $sort_img_1 = "" ;}
289     if($this->sort_by == "TaskID"){ $sort_img_2 = $sort_img; } else { $sort_img_2 = "" ;}
290     if($this->sort_by == "Schedule"){ $sort_img_3 = $sort_img; } else { $sort_img_3 = "" ;}
291     if($this->sort_by == "Action"){ $sort_img_4 = $sort_img; } else { $sort_img_4 = "" ;}
293     /* Create divlist */
294     $divlist->SetListHeader("<input type='image' src='images/list_reload.png' title='"._("Reload")."'>");
296     $plug  = $_GET['plug'];
297     $chk = "<input type='checkbox' id='select_all' name='select_all'
298                onClick='toggle_all_(\"^item_selected_[0-9]*$\",\"select_all\");' >";
300     /* set Page header */
301     $divlist->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
302     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=TargetName'>"._("Target").$sort_img_1."</a>"));
303     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=TaskID'>"._("Task").$sort_img_2."</a>",
304                                       "attach"=>"style='width:120px;'"));
305     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Schedule'>"._("Schedule").$sort_img_3."</a>",
306                                       "attach"=>"style='width:100px;'"));
307     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Action'>"._("Status").$sort_img_4."</a>",
308                                       "attach"=>"style='width:80px;'"));
309     $divlist->AddHeader(array("string"=>_("Action"),
310                                       "attach"=>"style='border-right:0px;width:120px;'"));
313     /* Reload the list of entries */
314     $this->reload();
316     foreach($this->entries as $key => $task){
318       $prio_actions="";
319       $action = "";
321       /* If WAITING add priority action
322        */  
323       if(in_array($task['STATUS'],array("waiting"))){
324         $prio_actions.= "<input class='center' type='image' src='images/prio_increase.png' 
325           title='"._("Move up in execution queue")."' name='prio_up_".$key."'>&nbsp;";
326         $prio_actions.= "<input class='center' type='image' src='images/prio_decrease.png' 
327           title='"._("Move down in execution queue")."' name='prio_down_".$key."'>&nbsp;";
328       }
329     
330       /* If WAITING add pause action
331        */  
332       if(in_array($task['STATUS'],array("waiting"))){
333         $prio_actions.= "<input class='center' type='image' src='images/status_pause.png' 
334           title='"._("Pause job")."' name='pause_".$key."'>&nbsp;";
335       }
337       /* If PAUSED add resume action
338        */  
339       if(in_array($task['STATUS'],array("paused"))){
340         $prio_actions.= "<input class='center' type='image' src='images/status_start.png' 
341           title='"._("Resume job")."' name='resume_".$key."'>&nbsp;";
342       }
344       /* If PROCESSING add abort action
345        */  
346       if(in_array($task['STATUS'],array("processing"))){
347         $prio_actions.= "<input class='center' type='image' src='images/small_error.png' 
348           title='"._("Abort execution")."' name='abort_process_".$key."'>";
349       }
351       /* If PAUSED or WAITING add execution action
352        */  
353       if(in_array($task['STATUS'],array("paused","waiting"))){
354         $prio_actions.= "<input class='center' type='image' src='images/rocket.png' 
355           title='"._("Force execution now!")."' name='execute_process_".$key."'>&nbsp;";
356       }
358       /* If PAUSED or WAITING add edit action
359        */  
360       if(in_array($task['STATUS'],array("waiting"))){
361         $action.= "<input type='image' src='images/edit.png' name='edit_task_".$key."' 
362           class='center' alt='"._("Edit")."'>";
363       }
365       /* If WAITING or ERROR add remove action
366        */  
367       if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error"))){
368         $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."' 
369           class='center' alt='"._("Remove")."'>";
370       }
372       $color = "";
373       $display = $task['MACADDRESS'];
374       $display2= $task['HEADERTAG'];
375      
376       /* Check if this event exists as Daemon class 
377        * In this case, display a more accurate entry.
378        */ 
379       if(isset($this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']]['s_Menu_Name'])){
380         $event_type = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']];
381         $display2= $event_type['s_Menu_Name'];
382         if(isset($event_type['ListImage']) && !empty($event_type['ListImage'])){
383           $display2 = $event_type['ListImage']."&nbsp;".$display2;
384         }
385       } 
387       $status = $task['STATUS'];
389       /* Special handling for all entries that have 
390           STATUS == "processing" && PROGRESS == NUMERIC
391        */
392       if($status == "processing" && isset($task['PROGRESS'])){
393         $percent = $task['PROGRESS'];
394         $status = "<img src='progress.php?x=80&amp;y=13&amp;p=".$percent."' alt='".$percent."&nbsp;%'>";
395       }
398       /* Create each field */
399       $field0 = array("string" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$key."'>" ,
400                       "attach" => "style='width:20px;".$color."'");
401       $field1 = array("string" => $display,
402                       "attach" => "style='".$color."'");
403       $field1a= array("string" => $display2,
404                       "attach" => "style='".$color.";width:120px;'");
405       $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:100px;'");
406       $field3 = array("string" => $status,"attach" => "style='".$color.";width:80px;'");
407       $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'");
408       $divlist->AddElement(array($field0,$field1,$field1a,$field2,$field3,$field4));
409     }
411     $smarty = get_smarty();
412     $smarty->assign("events",$this->events);
413     $smarty->assign("start",$this->start);
414     $smarty->assign("start_real", ($this->start + 1));
415     $smarty->assign("ranges", array("10" => "10",
416                                     "20" => "20",
417                                     "25" => "25",
418                                     "50" => "50",
419                                     "100"=> "100",
420                                     "200"=> "200",
421                                     "9999" => "*"));
423     $count = $this->o_queue->number_of_queued_entries();
424     $smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"range"));
425     $smarty->assign("range",$this->range);
426     $smarty->assign("div",$divlist->Draw());
427     return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__))));
428   }
431   /*! \brief  Move an entry up or down in the queue, by updating its execution timestamp  
432       @param  $id     Integer  The ID of the entry which should be updated.
433       @param  $type   String   "up" / "down"
434       @return boolean TRUE in case of success else FALSE
435   */
436   public function update_priority($id,$type = "up")
437   {
438     if($type == "up"){
439       $tmp = $this->o_queue->get_queued_entries(-1,-1,"timestamp DESC");
440     }else{
441       $tmp = $this->o_queue->get_queued_entries(-1,-1,"timestamp ASC");
442     }
443     $last = array();
444     foreach($tmp as $entry){
445       if($entry['ID'] == $id){
446         if(count($last)){
447           $time = strtotime($last['TIMESTAMP']);
448           if($type == "up"){
449             $time ++;
450           }else{
451             $time --;
452           }
453           $time_str = date("YmdHis",$time); 
454           return($this->o_queue->update_entries(array($id),array("timestamp" => $time_str)));
455         }else{
456           return(FALSE);
457         }
458       }
459       $last = $entry;
460     }
461     return(FALSE);
462   }
465   /*! \brief  Resumes to status 'waiting'.
466    *  @return Boolean TRUE in case of success, else FALSE. 
467    */
468   private function resume_queue_entries($ids)
469   {
470     if(!count($ids)){
471       return;
472     }
474     /* Entries are resumed by setting the status to 
475      *  'waiting'
476      */
477     $data = array("status"    => "waiting");
478   
479     /* Check if given ids are valid and check if the status
480      *  allows resuming.
481      */
482     $update_ids = array();
483     foreach($this->o_queue->get_entries_by_id($ids) as $entry){
484       if(isset($entry['STATUS']) && preg_match("/paused/",$entry['STATUS'])){
485         $update_ids[] = $entry['ID'];
486       }
487     }
489     /* Tell the daemon that we have entries to update.
490      */
491     if(count($update_ids)){
492       if(!$this->o_queue->update_entries($update_ids,$data)){
493         msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
494         return(FALSE);
495       }
496     }
497     return(TRUE);
498   }
501   /*! \brief  Force queue job to be done as far as possible.
502    *  @return Boolean TRUE in case of success, else FALSE.
503    */
504   private function execute_queue_entries($ids)
505   {
506     if(!count($ids)){
507       return;
508     }
510     /* Execution is forced by updating the status to 
511      *  waiting and setting the timestamp to current time.
512      */
513     $data = array(  "timestamp" => date("YmdHis",time()), 
514                     "status"    => "waiting");
516     /* Only allow execution of paused or waiting entries 
517      */
518     $update_ids = array();
519     foreach($this->o_queue->get_entries_by_id($ids) as $entry){
520       if(in_array($entry['STATUS'],array("paused","waiting"))){
521         $update_ids[] = $entry['ID'];
522       }
523     }
525     /* Tell the daemon that we want to update some entries
526      */
527     if(count($update_ids)){
528       if(!$this->o_queue->update_entries($update_ids,$data)){
529         msg_dialog::display(_("Error"), sprintf(_("Could not update queue entries.")) , ERROR_DIALOG);
530         return(FALSE);
531       }
532     }
533     return(TRUE);
534   }
537   /*! \brief  Force queue job to be done as far as possible.
538    *  @return Boolean TRUE in case of success, else FALSE.
539    */
540   private function abort_queue_entries($ids)
541   {
542     if(!count($ids)){
543       return;
544     }
545     print_red(_("Not implemented, currently."));
546     return(TRUE);
547   }
550   /*! \brief Pauses the specified queue entry from execution.
551    *  @return Boolean TRUE in case of success, else FALSE. 
552    */
553   private function pause_queue_entries($ids)
554   {
555     if(!count($ids)){
556       return;
557     }
559     /* Entries are paused by setting the status to 
560      *  something different from 'waiting'.
561      * We simply use 'paused'.
562      */   
563     $data = array("status"    => "paused");
565     /* Detect if the ids we got are valid and
566      *  check if the status allows pausing.
567      */ 
568     $update_ids = array();
569     foreach($this->o_queue->get_entries_by_id($ids) as $entry){
570       if(isset($entry['STATUS']) && preg_match("/waiting/",$entry['STATUS'])){
571         $update_ids[] = $entry['ID'];
572       }
573     }
575     /* Tell the daemon that we want to update some entries
576      */
577     if(count($update_ids)){
578       if(!$this->o_queue->update_entries($update_ids,$data)){
579         msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
580         return(FALSE);
581       }
582     }
583     return(TRUE);
584   }
587   /*! \brief  Request list of queued jobs.
588    *  @return Returns an array of all queued jobs.
589    */
590   function reload()
591   {
593     /* Sort map   html-post-name => daemon-col-name
594      */
595     $map = array(
596         "QueuePosition" => "id",
597         "Action"        => "status",
598         "TaskID"        => "headertag",
599         "TargetName"    => "macaddress",
600         "Schedule"      => "timestamp");
602     /* Create sort header 
603      */
604     if(!isset($map[$this->sort_by])){
605       $sort = "id DESC";
606     }else{
607       $sort   = $map[$this->sort_by]; 
608       if($this->sort_dir == "up"){
609         $sort.= " ASC";
610       }else{
611         $sort.= " DESC";
612       }
613     }
614      
615     /* Get entries. */ 
616     $start  = $this->start; 
617     $stop   = $this->range;
618     $entries = $this->o_queue->get_queued_entries($start,$stop,$sort);
619     if ($this->o_queue->is_error()){
620       msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$this->o_queue->get_error()), ERROR_DIALOG);
621     }
623     /* Assign entries by id.
624      */
625     $this->entries = array();
626     foreach($entries as $entry){
627       $this->entries[$entry['ID']]= $entry;
628     }
629   }
632   /*! \brief  Handle post jobs, like sorting.
633    */
634   function save_object()
635   {
636     /* Check for sorting changes 
637      */
638     $sort_vals = array("Action","QueuePosition","TargetName","Schedule","TaskID");
639     if(isset($_GET['sort']) && in_array($_GET['sort'],$sort_vals)){
640       $sort = $_GET['sort'];
641       if($this->sort_by == $sort){
642         if($this->sort_dir == "up"){
643           $this->sort_dir = "down";
644         }else{
645           $this->sort_dir = "up";
646         }
647       }
648       $this->sort_by = $sort;
649     }
651     /* Range selection used? */
652     if(isset($_POST['range']) && is_numeric($_POST['range'])){
653       $this->range = $_POST['range'];
654     }
655     
656     /* Page changed. */
657     if(isset($_GET['start'])){
658       $start = $_GET['start'];
659       if(is_numeric($start) || $start == 0){
660         $this->start = $start;
661       }
662     }
664     /* Check start stop and reset if necessary */
665     $count = $this->o_queue->number_of_queued_entries();
666     if($this->start >= $count){
667       $this->start = $count -1;
668     }
669     if($this->start < 0){
670       $this->start = 0;
671     }
672   }
675   function save()
676   {
677     // We do not save anything here.
678   }
681   /*! \brief  Return a list of all selected items.
682     @return Array   Returns an array containing all selected item ids.
683    */
684   function list_get_selected_items()
685   {
686     $ids = array();
687     foreach($_POST as $name => $value){
688       if(preg_match("/^item_selected_[0-9]*$/",$name)){
689         $id   = preg_replace("/^item_selected_/","",$name);
690         $ids[$id] = $id;
691       }
692     }
693     return($ids);
694   }
697   static function plInfo()
698   {
699     return (array(
700           "plShortName"   => _("System mass deployment"),
701           "plDescription" => _("Provide a mechanism to automatically activate a set of systems"),
702           "plSelfModify"  => FALSE,
703           "plDepends"     => array(),
704           "plPriority"    => 0,
705           "plSection"     => array("addon"),
706           "plCategory"    => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
707           "plProvidedAcls" => array("Comment"   => _("Description")) 
708           ));
709   }
711 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
712 ?>