Code

Updated goto
[gosa.git] / gosa-plugins / goto / addons / goto / class_gotomasses.inc
index b7089ea23366cb5e1c119780f8e715c2e3ac4244..e168b880eecb143abb367b61be94bee7848a07a8 100644 (file)
@@ -180,7 +180,7 @@ class gotomasses extends plugin
     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"){
@@ -189,6 +189,8 @@ class gotomasses extends plugin
           $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);
@@ -218,6 +220,27 @@ class gotomasses extends plugin
 
     /* 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();
     }
@@ -444,7 +467,7 @@ class gotomasses extends plugin
                                     "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__))));
@@ -589,13 +612,14 @@ class gotomasses extends plugin
     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)){
         msg_dialog::display(_("Error"), sprintf(_("Cannot 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."),
+          sprintf(_("The job could not be aborted, the required class '%s' was not found."),
             "DaemonEvent_faireboot") , ERROR_DIALOG);
     }
   }