diff --git a/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc b/trunk/gosa-plugins/goto/addons/goto/events/class_DaemonEvent.inc
index 6268d9c0eb24fd1fffe0f5a875b0ecbeb58da89a..13f80c9dcbff83c2aa5ff3717b0206f652e17fd9 100644 (file)
$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;'")
));
}
+ /*! \brief Save an event dialog and check if multiple events needs to be created */
+ static function save_event_dialog($dialog, $current, $o_queue, $config)
+ {
+ if(is_object($dialog)){
+ $dialog->save_object();
+ 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;
+ $count = count($targets);
+ while($i <= $count) {
+ $operations = $dialog->concurrent_operations;
+ $event = new $event_type($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(!$o_queue->append($event)){
+ msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+ }
+
+ # Calculate start time for the next run
+ $timestamp = $timestamp + ($dialog->time_offset*60);
+ }
+
+ return(array(FALSE, -1));
+ } else {
+ $dialog->save_object();
+ if(!$o_queue->append($dialog)){
+ msg_dialog::display(_("Service infrastructure"),msgPool::siError($o_queue->get_error()),ERROR_DIALOG);
+ return(array($dialog, $current));
+ }else{
+ return(array(FALSE, -1));
+ }
+ }
+ }
+}
+
/*! \brief Returns a complete list of all available events.
@return Array Containing $this->get_event_info() for all available events.
*/