Code

Bugfix for #4271
[gosa.git] / trunk / gosa-plugins / goto / addons / goto / class_gotomasses.inc
index 0338582703545101d99b2cf198b6e39cd3f34c94..a56993518b15a28222de19c12b70824d62872944 100644 (file)
@@ -256,6 +256,11 @@ class gotomasses extends plugin
               $j_name = $task['ID']." - ".$task['HEADERTAG']." ".$task['MACADDRESS'];
             }
 
+            /* If system name is available show it in parantheses next to each entry */
+            if(isset($task['PLAINNAME']) && $task['PLAINNAME'] != 'none') {
+              $j_name .= sprintf(" (%s) ", $task['PLAINNAME']);
+            }
+
             /* Only remove WAITING or ERROR entries */
             if(in_array($task['STATUS'],array("waiting","error","processed")) || 
                 ($task['STATUS'] == "processing" && !preg_match("/install/",$task['HEADERTAG'])) ){
@@ -322,51 +327,7 @@ class gotomasses extends plugin
 
     /* Close dialog */
     if(isset($_POST['save_event_dialog'])){
-      if(is_object($this->dialog)){
-        $this->dialog->save_object();
-        if($this->dialog->multiple_events) {
-          $event_type = get_class($this->dialog);
-          $targets = $this->dialog->get_targets();
-          $timestamp = $this->dialog->timestamp;
-
-          $i = 1;
-          $count = count($targets);
-          while($i <= $count) {
-            $operations = $this->dialog->concurrent_operations;
-            $event = new $event_type($this->config);
-            $event->set_timestamp($timestamp);
-            $event->set_type(SCHEDULED_EVENT);
-
-            while($operations > 0) {
-              $i++;
-              $target = array_shift($targets);
-              $event->add_targets(array($target));
-              $operations--;
-            }
-
-            $event->save_object();
-            $event->get_targets();
-            if(!$this->o_queue->append($event)){
-              msg_dialog::display(_("Service infrastructure"),msgPool::siError($this->o_queue->get_error()),ERROR_DIALOG);
-            }
-
-            # Calculate start time for the next run
-            $timestamp = $timestamp + ($this->dialog->time_offset*60);
-          }
-
-          $this->dialog = FALSE;
-          $this->current = -1;
-        }
-        else {
-          $this->dialog->save_object();
-          if(!$this->o_queue->append($this->dialog)){
-            msg_dialog::display(_("Service infrastructure"),msgPool::siError($this->o_queue->get_error()),ERROR_DIALOG);
-          }else{
-            $this->dialog = FALSE; 
-            $this->current = -1;
-          } 
-        }
-      }
+      list($this->dialog, $this->current) = DaemonEvent::save_event_dialog($this->dialog, $this->current, $this->o_queue, $this->config);
     }