diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc
index 8df328051dba25f105145dc343d0a709bc677e24..4d609392cc4473cd82ea269c2d9fcc07500e0c1d 100644 (file)
var $ids_to_remove = array();
var $divlist = NULL;
+ var $events = array();
+ var $event_tags = array();
+
var $sort_by = "Schedule";
var $sort_dir = "down";
var $entries = array();
/* Include config object */
$this->config= &$config;
$this->o_queue = new gosaSupportDaemon(TRUE,10);
+ $this->events = DaemonEvent::get_event_types( USER_EVENT | SYSTEM_EVENT);
+
+ /* Get tags that will be used in queue searches */
+ foreach($this->events['BY_CLASS'] as $evt){
+ if(isset($evt['s_Queued_Action'])){
+ $this->event_tags[] = $evt['s_Queued_Action'];
+ }
+ }
}
function execute()
{
$smarty = get_smarty();
-
+
/************
* Handle posts
************/
$s_entry = $s_action = "";
$arr = array(
- "/^stop_/" => "stop",
- "/^stop_all/" => "stop_all",
- "/^start_/" => "start",
- "/^start_all/" => "start_all",
+
+ "/^pause_/" => "pause",
+ "/^resume_/" => "resume",
+ "/^execute_process_/" => "execute_process",
+ "/^abort_process_/" => "abort_process",
"/^prio_up_/" => "prio_up",
"/^prio_down_/" => "prio_down",
"/^edit_task_/" => "edit",
"/^remove_task_/" => "remove",
- "/^new_task_/" => "new_task",
- "/^remove_multiple_task_/" => "remove_multiple");
+ "/^new_task_/" => "new_task");;
+
foreach($arr as $regex => $action){
foreach($_POST as $name => $value){
}
}
+ /* Menu actions */
+ if(isset($_POST['menu_action']) && !empty($_POST['menu_action'])){
+ $s_action = $_POST['menu_action'];
+ }
+
/* Edit posted from list link */
if(isset($_GET['act']) && $_GET['act'] == "edit" && isset($_GET['id']) && isset($this->tasks[$_GET['id']])){
$s_action = "edit";
************/
if(preg_match("/^prio_/",$s_action)){
-
switch($s_action){
-
case 'prio_down' : $this->update_priority($s_entry,"down");break;
case 'prio_up' : $this->update_priority($s_entry,"up");break;
}
}
/************
- * Handle start/stop modifications
+ * Handle pause/resume/execute modifications
************/
- if(preg_match("/^start/",$s_action) || preg_match("/^stop/",$s_action)){
+ if(preg_match("/^resume/",$s_action) ||
+ preg_match("/^pause/",$s_action) ||
+ preg_match("/^abort_process/",$s_action) ||
+ preg_match("/^execute_process/",$s_action)){
switch($s_action){
- case 'start_all' : $this->start_queue_entries($this->list_get_selected_items());break;
- case 'start' : $this->start_queue_entries(array($s_entry));break;
- case 'stop_all' : $this->stop_queue_entries ($this->list_get_selected_items());break;
- case 'stop' : $this->stop_queue_entries (array($s_entry));break;
- default : trigger_error("Undefined priority setting used.");
+ case 'resume' : $this->resume_queue_entries (array($s_entry));break;
+ case 'pause' : $this->pause_queue_entries (array($s_entry));break;
+ case 'execute_process': $this->execute_queue_entries (array($s_entry));break;
+ case 'abort_process' : $this->abort_queue_entries (array($s_entry));break;
+ case 'resume_all' : $this->resume_queue_entries ($this->list_get_selected_items());break;
+ case 'pause_all' : $this->pause_queue_entries ($this->list_get_selected_items());break;
+ case 'execute_process_all': $this->execute_queue_entries ($this->list_get_selected_items());break;
+ case 'abort_process_all' : $this->abort_queue_entries ($this->list_get_selected_items());break;
+
+ default : trigger_error("Undefined action setting used (".$s_action.").");
}
if($this->o_queue->is_error()){
msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
}
}
+ /************
+ * ADD
+ ************/
+
+ if(preg_match("/^add_event_/",$s_action)){
+ $type = preg_replace("/^add_event_/","",$s_action);
+ if(isset($this->events['BY_CLASS'][$type])){
+ $e_data = $this->events['BY_CLASS'][$type];
+ $this->dialog = new $e_data['CLASS_NAME']($this->config);
+ }
+ }
+
+ /************
+ * EDIT
+ ************/
+
+ if($s_action == "edit"){
+ $id = $s_entry;
+ $type = FALSE;
+ if(isset($this->entries[$id])){
+ $event = $this->entries[$s_entry];
+
+
+ if($event['STATUS'] == "waiting" && isset($this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']])){
+ $type = $this->events['BY_QUEUED_ACTION'][$event['HEADERTAG']];
+ $this->dialog = new $type['CLASS_NAME']($this->config,$event);
+ }
+ }
+ }
+
/************
* REMOVE
************/
}else{
$ids = $this->list_get_selected_items();
}
+
if(count($ids)){
- $this->ids_to_remove = $ids;
- $ret = $this->o_queue->ids_exist($this->ids_to_remove);
+ $ret = $this->o_queue->ids_exist($ids);
$ret = $this->o_queue->get_entries_by_id($ret);
$tmp = "";
foreach($ret as $task){
- $tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS'];
+
+ /* Only remove WAITING or ERROR entries */
+ if(in_array($task['STATUS'],array("waiting","error"))){
+ $this->ids_to_remove[] = $task['ID'];
+ if(isset($this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']])){
+ $evt = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']];
+ $tmp.= "\n".$task['ID']." - ".$evt['s_Menu_Name']." ".$task['MACADDRESS'];
+ }else{
+ $tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS'];
+ }
+ }
}
$smarty->assign("multiple", TRUE);
- $smarty->assign("info",sprintf(_("Your are about to delete the following tasks: %s"),"<pre>".$tmp."</pre>"));
+ $smarty->assign("info",sprintf(_("You are about to remove the following actions from the GOsa support Daemon: %s"),"<pre>".$tmp."</pre>"));
$this->current = $s_entry;
return($smarty->fetch(get_template_path('remove.tpl', TRUE)));
}
* EDIT
************/
- /* Edit selected entry */
- if($s_action == "edit"){
- $entry = $this->o_queue->get_entry_by_id($s_entry);
- if($entry){
- $this->dialog = new goto_task($this->config,$this,$entry);
- $this->current = $s_entry;
+ /* Close dialog */
+ if(isset($_POST['save_event_dialog'])){
+ if(is_object($this->dialog)){
+ $this->dialog->save_object();
+ if(!$this->o_queue->append($this->dialog)){
+ msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."),
+ $this->o_queue->get_error()),ERROR_DIALOG);
+ }else{
+ $this->dialog = FALSE;
+ $this->current = -1;
+ }
}
}
- /* New entry */
- if($s_action== "new_task" && $this->acl_is_createable()){
- $this->dialog = new goto_task($this->config,$this);
- $this->current = -1;
- }
/* Close dialog */
- if(isset($_POST['close_goto_task'])){
+ if(isset($_POST['abort_event_dialog'])){
$this->dialog = FALSE;
$this->current = -1;
}
- /* Close dialog */
- if((isset($_POST['save_goto_task']) || isset($_POST['apply_goto_task'])) && is_object($this->dialog) ){
- $this->dialog->save_object();
- $msgs = $this->dialog->check();
- if(count($msgs)){
- foreach($msgs as $msg){
- msg_dialog::display(_("Error"), $msg, ERROR_DIALOG);
- }
- }else{
-
- if($this->o_queue->id_exists($this->current)){
- $this->o_queue->update_entries(array($this->current),$this->dialog->save());
- }else{
- $tmp = $this->dialog->save();
- $tmp2= array();
- $targets =$tmp['Target'];
- foreach($targets as $target){
- $tmp['Target'] = array($target);
- $tmp2[] = $tmp;
- }
- if(!$this->o_queue->add_multiple($tmp2)){
- msg_dialog::display(_("Error"), $this->o_queue->get_error(), ERROR_DIALOG);
- }
- }
- if(!isset($_POST['apply_goto_task'])){
- $this->dialog = FALSE;
- $this->current = -1;
- }
- $this->save();
- }
- }
-
/* Display dialogs if currently opened */
if(is_object($this->dialog)){
$this->dialog->save_object();
************/
$divlist = new MultiSelectWindow($this->config,"gotoMasses",array("gotomasses"));
- $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa deamon tasks."));
- $divlist->SetSummary(_("List of queued deamon jobs."));
+ $divlist->SetInformation(_("This menu allows you to remove and change the properties of GOsa tasks."));
+ $divlist->SetSummary(_("List of queued jobs"));
$divlist->EnableCloseButton(FALSE);
$divlist->EnableSaveButton(FALSE);
$divlist->SetHeadpageMode();
+ $s = ".|"._("Actions")."|\n";
+ $s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'> "._("Create")."\n";
+ foreach($this->events['BY_CLASS'] as $name => $event){
+ $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n";
+ }
+ if($this->acl_is_removeable()){
+ $s.= "..|---|\n";
+ $s.= "..|<img src='images/edittrash.png' alt='' border='0' class='center'> "._("Remove")."|remove_multiple\n";
+ }
+ if(preg_match("/w/",$this->getacl(""))){
+ $s.= "..|---|\n";
+ $s.= "..|<img src='images/status_start.png' alt='' border='0' class='center'> "._("Resume all")."|resume_all\n";
+ $s.= "..|<img src='images/status_pause.png' alt='' border='0' class='center'> "._("Pause all")."|pause_all\n";
+ $s.= "..|<img src='images/small_error.png' alt='' border='0' class='center'> "._("Abort all")."|abort_process_all\n";
+ $s.= "..|<img src='images/rocket.png' alt='' border='0' class='center'> "._("Execute all")."|execute_process_all\n";
+ }
+
+ $divlist->SetDropDownHeaderMenu($s);
if($this->sort_dir == "up"){
$sort_img = "<img src='images/sort_up.png' alt='/\' border=0>";
if($this->sort_by == "Schedule"){ $sort_img_3 = $sort_img; } else { $sort_img_3 = "" ;}
if($this->sort_by == "Action"){ $sort_img_4 = $sort_img; } else { $sort_img_4 = "" ;}
- /* Display add button if allowed */
- $header = "<div style='padding:5px'>";
- if($this->acl_is_removeable()){
- $header .= "<input type='image' src='images/edittrash.png' name='remove_multiple_task' class='center'> ";
- }
- if(preg_match("/w/",$this->getacl(""))){
- $header .= "<input type='image' src='images/status_stop_all.png' name='stop_all' class='center'> ";
- $header .= "<input type='image' src='images/status_start_all.png' name='start_all' class='center'> ";
- }
- $header .= "</div>";
-
/* Create divlist */
- $divlist->SetListHeader($header);
+ $divlist->SetListHeader("<input type='image' src='images/list_reload.png' title='"._("Reload")."'>");
$plug = $_GET['plug'];
$chk = "<input type='checkbox' id='select_all' name='select_all'
/* set Page header */
$divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'"));
- $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TargetName'>"._("Target").$sort_img_1."</a> / ".
- "<a href='?plug=".$plug."&sort=TaskID'>"._("Task").$sort_img_2."</a>"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TargetName'>"._("Target").$sort_img_1."</a>"));
+ $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=TaskID'>"._("Task").$sort_img_2."</a>",
+ "attach"=>"style='width:120px;'"));
$divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Schedule'>"._("Schedule").$sort_img_3."</a>",
"attach"=>"style='width:100px;'"));
$divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&sort=Action'>"._("Status").$sort_img_4."</a>",
foreach($this->entries as $key => $task){
+ $prio_actions="";
+ $action = "";
- $prio_actions = "<input class='center' type='image' src='images/prio_increase.png' name='prio_up_".$task['ID']."'> ";
- $prio_actions.= "<input class='center' type='image' src='images/prio_decrease.png' name='prio_down_".$task['ID']."'> ";
- $prio_actions.= "<input class='center' type='image' src='images/status_stop_all.png' name='stop_".$task['ID']."'> ";
- $prio_actions.= "<input class='center' type='image' src='images/status_start_all.png' name='start_".$task['ID']."'> ";
+ /* If WAITING add priority action
+ */
+ if(in_array($task['STATUS'],array("waiting"))){
+ $prio_actions.= "<input class='center' type='image' src='images/prio_increase.png'
+ title='"._("Move up in execution queue")."' name='prio_up_".$key."'> ";
+ $prio_actions.= "<input class='center' type='image' src='images/prio_decrease.png'
+ title='"._("Move down in execution queue")."' name='prio_down_".$key."'> ";
+ }
+
+ /* If WAITING add pause action
+ */
+ if(in_array($task['STATUS'],array("waiting"))){
+ $prio_actions.= "<input class='center' type='image' src='images/status_pause.png'
+ title='"._("Pause job")."' name='pause_".$key."'> ";
+ }
- $action = "<input type='image' src='images/edit.png' name='edit_task_".$task['ID']."'
- class='center' alt='"._("Edit")."'>";
+ /* If PAUSED add resume action
+ */
+ if(in_array($task['STATUS'],array("paused"))){
+ $prio_actions.= "<input class='center' type='image' src='images/status_start.png'
+ title='"._("Resume job")."' name='resume_".$key."'> ";
+ }
- if($this->acl_is_removeable()){
- $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$task['ID']."'
- class='center' alt='"._("Reomve")."'>";
+ /* If PROCESSING add abort action
+ */
+ if(in_array($task['STATUS'],array("processing"))){
+ $prio_actions.= "<input class='center' type='image' src='images/small_error.png'
+ title='"._("Abort execution")."' name='abort_process_".$key."'>";
+ }
+
+ /* If PAUSED or WAITING add execution action
+ */
+ if(in_array($task['STATUS'],array("paused","waiting"))){
+ $prio_actions.= "<input class='center' type='image' src='images/rocket.png'
+ title='"._("Force execution now!")."' name='execute_process_".$key."'> ";
+ }
+
+ /* If PAUSED or WAITING add edit action
+ */
+ if(in_array($task['STATUS'],array("waiting"))){
+ $action.= "<input type='image' src='images/edit.png' name='edit_task_".$key."'
+ class='center' alt='"._("Edit")."'>";
+ }
+
+ /* If WAITING or ERROR add remove action
+ */
+ if( $this->acl_is_removeable() && in_array($task['STATUS'],array("waiting","error"))){
+ $action.= "<input type='image' src='images/edittrash.png' name='remove_task_".$key."'
+ class='center' alt='"._("Remove")."'>";
}
$color = "";
$display = $task['MACADDRESS'];
$display2= $task['HEADERTAG'];
+
+ /* Check if this event exists as Daemon class
+ * In this case, display a more accurate entry.
+ */
+ if(isset($this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']]['s_Menu_Name'])){
+ $event_type = $this->events['BY_QUEUED_ACTION'][$task['HEADERTAG']];
+ $display2= $event_type['s_Menu_Name'];
+
+ if(strlen($display2) > 20){
+ $display2 = substr($display2,0,18)."...";
+ }
+
+ if(isset($event_type['ListImage']) && !empty($event_type['ListImage'])){
+ $display2 = $event_type['ListImage']." ".$display2;
+ }
+ }
+
+ $status = $task['STATUS'];
+
+ if($status == "waiting"){
+ $status = "<img class='center' src='images/clock.png' alt=''> "._("Waiting");
+ }
+ if($status == "error"){
+ $status = "<img class='center' src='images/false.png' alt=''> "._("Error");
+ }
+
+ /* Special handling for all entries that have
+ STATUS == "processing" && PROGRESS == NUMERIC
+ */
+ if($status == "processing" && isset($task['PROGRESS'])){
+ $percent = $task['PROGRESS'];
+ $status = "<img src='progress.php?x=80&y=13&p=".$percent."' alt='".$percent." %'>";
+ }
+
/* Create each field */
- $field0 = array("string" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$task['ID']."'>" ,
+ $field0 = array("string" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$key."'>" ,
"attach" => "style='width:20px;".$color."'");
$field1 = array("string" => $display,
"attach" => "style='".$color."'");
$field1a= array("string" => $display2,
- "attach" => "style='".$color.";width:80px;'");
+ "attach" => "style='".$color.";width:120px;'");
$field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:100px;'");
- $field3 = array("string" => $task['STATUS'],"attach" => "style='".$color.";width:80px;'");
+ $field3 = array("string" => $status,"attach" => "style='".$color.";width:80px;'");
$field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'");
$divlist->AddElement(array($field0,$field1,$field1a,$field2,$field3,$field4));
}
-
$smarty = get_smarty();
+ $smarty->assign("events",$this->events);
$smarty->assign("start",$this->start);
$smarty->assign("start_real", ($this->start + 1));
$smarty->assign("ranges", array("10" => "10",
public function update_priority($id,$type = "up")
{
if($type == "up"){
- $tmp = $this->o_queue->get_queued_entries(-1,-1,"timestamp DESC");
+ $tmp = $this->o_queue->get_queued_entries($this->event_tags,-1,-1,"timestamp DESC");
}else{
- $tmp = $this->o_queue->get_queued_entries(-1,-1,"timestamp ASC");
+ $tmp = $this->o_queue->get_queued_entries($this->event_tags,-1,-1,"timestamp ASC");
}
$last = array();
foreach($tmp as $entry){
}
- /*! \brief Force queue job to be done as far as possible.
+ /*! \brief Resumes to status 'waiting'.
* @return Boolean TRUE in case of success, else FALSE.
*/
- private function start_queue_entries($ids)
+ private function resume_queue_entries($ids)
{
if(!count($ids)){
return;
}
+
+ /* Entries are resumed by setting the status to
+ * 'waiting'
+ */
+ $data = array("status" => "waiting");
- $data = array("timestamp" => date("YmdHis"),
- "status" => "-");
- if(!$this->o_queue->update_entries($ids,$data)){
- msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
- return(FALSE);
+ /* Check if given ids are valid and check if the status
+ * allows resuming.
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(isset($entry['STATUS']) && preg_match("/paused/",$entry['STATUS'])){
+ $update_ids[] = $entry['ID'];
+ }
+ }
+
+ /* Tell the daemon that we have entries to update.
+ */
+ if(count($update_ids)){
+ if(!$this->o_queue->update_entries($update_ids,$data)){
+ msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
+ return(FALSE);
+ }
}
return(TRUE);
}
- /*! \brief Stops the specified queue entry from execution.
+ /*! \brief Force queue job to be done as far as possible.
+ * @return Boolean TRUE in case of success, else FALSE.
+ */
+ private function execute_queue_entries($ids)
+ {
+ if(!count($ids)){
+ return;
+ }
+
+ /* Execution is forced by updating the status to
+ * waiting and setting the timestamp to current time.
+ */
+ $data = array( "timestamp" => date("YmdHis",time()),
+ "status" => "waiting");
+
+ /* Only allow execution of paused or waiting entries
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(in_array($entry['STATUS'],array("paused","waiting"))){
+ $update_ids[] = $entry['ID'];
+ }
+ }
+
+ /* Tell the daemon that we want to update some entries
+ */
+ if(count($update_ids)){
+ if(!$this->o_queue->update_entries($update_ids,$data)){
+ msg_dialog::display(_("Error"), sprintf(_("Could not update queue entries.")) , ERROR_DIALOG);
+ return(FALSE);
+ }
+ }
+ return(TRUE);
+ }
+
+
+ /*! \brief Force queue job to be done as far as possible.
+ * @return Boolean TRUE in case of success, else FALSE.
+ */
+ private function abort_queue_entries($ids)
+ {
+ if(!count($ids)){
+ return;
+ }
+
+ /* Entries are paused by setting the status to
+ * something different from 'waiting'.
+ * We simply use 'paused'.
+ */
+ $data = array("status" => "paused");
+
+ /* Detect if the ids we got are valid and
+ * check if the status allows pausing.
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(isset($entry['STATUS']) && preg_match("/processing/",$entry['STATUS'])){
+ if(isset($entry['MACADDRESS'])){
+ $update_ids[] = $entry['MACADDRESS'];
+ }else{
+ trigger_error("No mac address found in event.");
+ }
+ }
+ }
+
+ if(class_available("DaemonEvent_faireboot")){
+ $tmp = new DaemonEvent_faireboot($this->config);
+ $tmp->add_targets($update_ids);
+ if(!$this->o_queue->append($tmp)){
+ msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
+ return(FALSE);
+ }
+ }else{
+ msg_dialog::display(_("Error"),
+ sprintf(_("The Job could not be aborted, the '%s' event class was not found."),
+ "DaemonEvent_faireboot") , ERROR_DIALOG);
+ }
+ }
+
+
+ /*! \brief Pauses the specified queue entry from execution.
* @return Boolean TRUE in case of success, else FALSE.
*/
- private function stop_queue_entries($ids)
+ private function pause_queue_entries($ids)
{
if(!count($ids)){
return;
}
- $data = array("timestamp" => date("YmdHis",(time() + (60*60*24*365))),
- "status" => _("Stoppped"));
- if(!$this->o_queue->update_entries($ids,$data)){
- msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
- return(FALSE);
+
+ /* Entries are paused by setting the status to
+ * something different from 'waiting'.
+ * We simply use 'paused'.
+ */
+ $data = array("status" => "paused");
+
+ /* Detect if the ids we got are valid and
+ * check if the status allows pausing.
+ */
+ $update_ids = array();
+ foreach($this->o_queue->get_entries_by_id($ids) as $entry){
+ if(isset($entry['STATUS']) && preg_match("/waiting/",$entry['STATUS'])){
+ $update_ids[] = $entry['ID'];
+ }
+ }
+
+ /* Tell the daemon that we want to update some entries
+ */
+ if(count($update_ids)){
+ if(!$this->o_queue->update_entries($update_ids,$data)){
+ msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
+ return(FALSE);
+ }
}
return(TRUE);
}
*/
function reload()
{
+
+ /* Sort map html-post-name => daemon-col-name
+ */
$map = array(
"QueuePosition" => "id",
"Action" => "status",
"TargetName" => "macaddress",
"Schedule" => "timestamp");
+ /* Create sort header
+ */
if(!isset($map[$this->sort_by])){
$sort = "id DESC";
}else{
$sort.= " DESC";
}
}
-
+
+ /* Get entries. */
$start = $this->start;
$stop = $this->range;
-
- $entries = $this->o_queue->get_queued_entries($start,$stop,$sort);
- if(!is_array($entries)){
- if ($this->o_queue->get_error()){
- msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$this->o_queue->get_error()), ERROR_DIALOG);
- }
- return(array());
+ $entries = $this->o_queue->get_queued_entries($this->event_tags,$start,$stop,$sort);
+ if ($this->o_queue->is_error()){
+ msg_dialog::display(_("Error"), sprintf(_("Cannot load queue entries: %s"), "<br><br>".$this->o_queue->get_error()), ERROR_DIALOG);
}
+ /* Assign entries by id.
+ */
$this->entries = array();
foreach($entries as $entry){
- $this->entries[]= $entry;
+ $this->entries[$entry['ID']]= $entry;
}
}
*/
function save_object()
{
+ /* Check for sorting changes
+ */
$sort_vals = array("Action","QueuePosition","TargetName","Schedule","TaskID");
if(isset($_GET['sort']) && in_array($_GET['sort'],$sort_vals)){
$sort = $_GET['sort'];
}
$this->sort_by = $sort;
}
+
+ /* Range selection used? */
if(isset($_POST['range']) && is_numeric($_POST['range'])){
$this->range = $_POST['range'];
}
+
+ /* Page changed. */
if(isset($_GET['start'])){
$start = $_GET['start'];
if(is_numeric($start) || $start == 0){
}
- /* Return list of object groups */
- function get_object_groups()
- {
- $ret = array();
- $ldap = $this->config->get_ldap_link();
- $ldap->cd($this->config->current['BASE']);
- $ldap->search("(&(objectClass=gosaGroupOfNames)(cn=*))",array("cn"));
- while($attrs = $ldap->fetch()){
- $ret[$attrs['cn'][0]] = $attrs['cn'][0];
- }
- return($ret);
- }
-
-
function save()
{
// We do not save anything here.
}
- function get_actions()
- {
- /* Prepare list of available actions */
- $actions = array(
- "gosa_ping" => _("GOsa ping"),
- "ping" => _("Ping"),
- "sayHello" => _("Say hello"));
- return($actions);
- }
-
-
static function plInfo()
{
return (array(
"plPriority" => 0,
"plSection" => array("addon"),
"plCategory" => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
- "plProvidedAcls" => array("Comment" => _("Description"),
- "Action" => _("Action"),
- "Day" => _("Day"),
- "Minute" => _("Minute"),
- "Hour" => _("Hour"),
- "Month" => _("Month"),
- "Weekday" => _("Week day"),
- "Target" => _("Target"))
+ "plProvidedAcls" => array("Comment" => _("Description"))
));
}
}