Code

Bugfix for #4721
[gosa.git] / trunk / gosa-plugins / goto / addons / goto / events / class_DaemonEvent.inc
index e46fd57e5b002ebf0dc45237afc3d421a93c87e6..13f80c9dcbff83c2aa5ff3717b0206f652e17fd9 100644 (file)
@@ -255,8 +255,22 @@ class DaemonEvent
     $this->target_list_used = TRUE;
     $divlist = new divSelectBox("EventTargets");
     foreach($this->a_targets as $key => $target){
+      $string = "";
+      if (is_array($target) && isset($target['cn'])) {
+          $string = $target['cn'];
+      }
+      if (is_array($target) && isset($target['ogroup'])) {
+        $title = sprintf(_("Added via object group '%s'"), $target['ogroup']);
+        $string .= sprintf("<img src='plugins/ogroups/images/select_ogroup.png' title=\"%s\">", $title);
+      }
+      if (is_array($target) && isset($target['mac'])) {
+        $string .= " - " . $target['mac'];
+      }else {
+        $string = $target;
+      }
+
       $divlist->AddEntry(array(
-            array("string"  => $target),
+            array("string"  => $string),
             array("string"  => "<input type='image' src='images/lists/trash.png' title='"._("Remove")."' name='del_target_".$key."'>",
               "attach"  => "style='width:20px; border-right:0px;'")
             ));
@@ -417,6 +431,17 @@ class DaemonEvent
       if($dialog->multiple_events) {
         $event_type = get_class($dialog);
         $targets = $dialog->get_targets();
+        $tmp_array[0] = $targets[0];
+        foreach ($targets as $current) {
+          $add_flag = 1;
+          foreach ($tmp_array as $tmp) {
+            if ($current["mac"]==$tmp["mac"]) {
+              $add_flag = 0; break;
+            }
+          }
+          if ($add_flag) $tmp_array[] = $current;
+        }
+        $targets = $tmp_array;
         $timestamp = $dialog->timestamp;
 
         $i = 1;