diff --git a/gosa-plugins/goto/addons/goto/class_gotomasses.inc b/gosa-plugins/goto/addons/goto/class_gotomasses.inc
index e1556f54b305e2188de14b1afc2d9cb9e6b9d6f3..e168b880eecb143abb367b61be94bee7848a07a8 100644 (file)
{
/* Include config object */
$this->config= &$config;
{
/* Include config object */
$this->config= &$config;
- $this->o_queue = new gosaSupportDaemon(TRUE,10);
+ $this->o_queue = new gosaSupportDaemon(TRUE,5);
$this->events = DaemonEvent::get_event_types( SYSTEM_EVENT);
/* Get tags that will be used in queue searches */
$this->event_tags = array("none");
$this->events = DaemonEvent::get_event_types( SYSTEM_EVENT);
/* Get tags that will be used in queue searches */
$this->event_tags = array("none");
- foreach($this->events['BY_CLASS'] as $evt){
- if(isset($evt['s_Queued_Action'])){
- $this->event_tags[] = $evt['s_Queued_Action'];
- }
+ foreach($this->events['SCHEDULED'] as $evt){
+ $this->event_tags[] = $evt['s_Queued_Action'];
}
}
}
}
$type = FALSE;
if(isset($this->entries[$id])){
$event = $this->entries[$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']];
+ if($event['STATUS'] == "waiting" && isset($this->events['QUEUED'][$event['HEADERTAG']])){
+ $evt_name = $this->events['QUEUED'][$event['HEADERTAG']];
+ $type = $this->events['BY_CLASS'][$evt_name];
$this->dialog = new $type['CLASS_NAME']($this->config,$event);
}
}
$this->dialog = new $type['CLASS_NAME']($this->config,$event);
}
}
if($s_action == "remove_multiple" || $s_action == "remove"){
if(!$this->acl_is_removeable()){
if($s_action == "remove_multiple" || $s_action == "remove"){
if(!$this->acl_is_removeable()){
- msg_dialog::display(_("Permission error"), _("You have no permission to delete this entry!"), ERROR_DIALOG);
+ msg_dialog::display(_("Permission"), msgPool::permDelete(), ERROR_DIALOG);
}else{
if($s_action == "remove"){
}else{
if($s_action == "remove"){
$ids = $this->list_get_selected_items();
}
$ids = $this->list_get_selected_items();
}
+ $this->ids_to_remove = array();
+
if(count($ids)){
$ret = $this->o_queue->ids_exist($ids);
$ret = $this->o_queue->get_entries_by_id($ret);
if(count($ids)){
$ret = $this->o_queue->ids_exist($ids);
$ret = $this->o_queue->get_entries_by_id($ret);
/* Only remove WAITING or ERROR entries */
if(in_array($task['STATUS'],array("waiting","error"))){
$this->ids_to_remove[] = $task['ID'];
/* 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']];
+ if(isset($this->events['QUEUED'][$task['HEADERTAG']])){
+ $evt_name = $this->events['QUEUED'][$task['HEADERTAG']];
+ $evt = $this->events['BY_CLASS'][$evt_name];
$tmp.= "\n".$task['ID']." - ".$evt['s_Menu_Name']." ".$task['MACADDRESS'];
}else{
$tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS'];
$tmp.= "\n".$task['ID']." - ".$evt['s_Menu_Name']." ".$task['MACADDRESS'];
}else{
$tmp.= "\n".$task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS'];
/* Remove specified tasks */
if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
/* Remove specified tasks */
if(count($this->ids_to_remove) && isset($_POST['delete_multiple_confirm'])){
+
+ /* Reboot hosts with not yet startet installations and timestamps in the past
+ */
+ timezone::get_default_timezone();
+ foreach($this->ids_to_remove as $id){
+ $entry = $this->o_queue->get_entries_by_id(array($id));
+ if(isset($entry['ANSWER1'])){
+ $entry = $entry['ANSWER1'];
+ if( $entry['STATUS'] == "wating" &&
+ $entry['HEADERTAG'] == "trigger_action_reinstall"){
+ $evt = new DaemonEvent_reinstall($this->config,$entry);
+ if($evt->get_timestamp(FALSE) < time()){
+ $r_evt = new DaemonEvent_localboot($this->config);
+ $r_evt->add_targets(array($entry['MACADDRESS']));
+ $r_evt->set_type(TRIGGERED_EVENT);
+ $this->o_queue->append($r_evt);
+ }
+ }
+ }
+ }
+
$this->o_queue->remove_entries($this->ids_to_remove);
$this->save();
}
$this->o_queue->remove_entries($this->ids_to_remove);
$this->save();
}
$divlist->SetHeadpageMode();
$s = ".|"._("Actions")."|\n";
$s.= "..|<img src='images/list_new.png' alt='' border='0' class='center'> "._("Create")."\n";
$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){
+
+ foreach($this->events['SCHEDULED'] as $name => $event){
$s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n";
}
if($this->acl_is_removeable()){
$s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n";
}
if($this->acl_is_removeable()){
}
if(preg_match("/w/",$this->getacl(""))){
$s.= "..|---|\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";
+ $s.= "..|<img src='images/status_start.png' alt='' border='0' class='center'> "._("Resume")."|resume_all\n";
+ $s.= "..|<img src='images/status_pause.png' alt='' border='0' class='center'> "._("Pause")."|pause_all\n";
+ $s.= "..|<img src='images/small_error.png' alt='' border='0' class='center'> "._("Abort")."|abort_process_all\n";
+ $s.= "..|<img src='images/rocket.png' alt='' border='0' class='center'> "._("Execute")."|execute_process_all\n";
}
$divlist->SetDropDownHeaderMenu($s);
}
$divlist->SetDropDownHeaderMenu($s);
/* Check if this event exists as Daemon class
* In this case, display a more accurate entry.
*/
/* 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(isset($this->events['QUEUED'][$task['HEADERTAG']])){
+ $evt_name = $this->events['QUEUED'][$task['HEADERTAG']];
+ $event_type = $this->events['BY_CLASS'][$evt_name];
+ $display2 = $event_type['s_Menu_Name'];
if(strlen($display2) > 20){
$display2 = substr($display2,0,18)."...";
if(strlen($display2) > 20){
$display2 = substr($display2,0,18)."...";
"9999" => "*"));
$count = $this->o_queue->number_of_queued_entries();
"9999" => "*"));
$count = $this->o_queue->number_of_queued_entries();
- $smarty->assign("range_selector", range_selector($count, $this->start, $this->range,"range"));
+ $divlist->SetListFooter(range_selector($count, $this->start, $this->range,"range"));
$smarty->assign("range",$this->range);
$smarty->assign("div",$divlist->Draw());
return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__))));
$smarty->assign("range",$this->range);
$smarty->assign("div",$divlist->Draw());
return($smarty->fetch (get_template_path('gotomasses.tpl', TRUE, dirname(__FILE__))));
*/
if(count($update_ids)){
if(!$this->o_queue->update_entries($update_ids,$data)){
*/
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);
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
return(FALSE);
}
}
return(FALSE);
}
}
*/
if(count($update_ids)){
if(!$this->o_queue->update_entries($update_ids,$data)){
*/
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);
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entries.")) , ERROR_DIALOG);
return(FALSE);
}
}
return(FALSE);
}
}
if(class_available("DaemonEvent_faireboot")){
$tmp = new DaemonEvent_faireboot($this->config);
$tmp->add_targets($update_ids);
if(class_available("DaemonEvent_faireboot")){
$tmp = new DaemonEvent_faireboot($this->config);
$tmp->add_targets($update_ids);
+ $tmp->set_type(TRIGGERED_EVENT);
if(!$this->o_queue->append($tmp)){
if(!$this->o_queue->append($tmp)){
- msg_dialog::display(_("Error"), sprintf(_("Could not update queue entry: %s"),$id) , ERROR_DIALOG);
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
return(FALSE);
}
}else{
msg_dialog::display(_("Error"),
return(FALSE);
}
}else{
msg_dialog::display(_("Error"),
- sprintf(_("The Job could not be aborted, the '%s' event class was not found."),
+ sprintf(_("The job could not be aborted, the required class '%s' was not found."),
"DaemonEvent_faireboot") , ERROR_DIALOG);
}
}
"DaemonEvent_faireboot") , ERROR_DIALOG);
}
}
*/
if(count($update_ids)){
if(!$this->o_queue->update_entries($update_ids,$data)){
*/
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);
+ msg_dialog::display(_("Error"), sprintf(_("Cannot update queue entry: %s"),$id) , ERROR_DIALOG);
return(FALSE);
}
}
return(FALSE);
}
}