From 519ade931313ab5cc877df7eda4057013e64734e Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 26 Feb 2008 07:45:55 +0000 Subject: [PATCH] Updated gotmasses. -Can edit events now. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9117 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/gotomasses/class_gotomasses.inc | 55 +++++++++++-------- .../gotomasses/events/DaemonEvent_wakeup.tpl | 39 +++++++++++++ .../gotomasses/events/class_DaemonEvent.inc | 18 ++++++ .../events/class_DaemonEvent_wakeup.inc | 21 ++++--- 4 files changed, 102 insertions(+), 31 deletions(-) diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc index b59bd6b1a..9351fc9b4 100644 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc @@ -189,22 +189,33 @@ class gotomasses extends plugin /* Close dialog */ if(isset($_POST['save_event_dialog'])){ - if($this->dialog->is_new()){ - $header = $this->dialog->get_header_tag(); - $targets = $this->dialog->get_targets(); - $data = $this->dialog->save(); - $data['timestamp'] = $this->dialog->get_timestamp(); - - - foreach($targets as $target){ - $data['mac'] = $target; - if(!$this->o_queue->send($header,$target,$data,TRUE)){ - msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), - $this->o_queue->get_error()),ERROR_DIALOG); - } + if(is_object($this->dialog)){ + + if($this->dialog->is_new()){ + $header = $this->dialog->get_header_tag(); + $targets = $this->dialog->get_targets(); + $data = $this->dialog->save(); + $data['timestamp'] = $this->dialog->get_timestamp(); + + + foreach($targets as $target){ + $data['mac'] = $target; + if(!$this->o_queue->send($header,$target,$data,TRUE)){ + msg_dialog::display(_("Daemon"),sprintf(_("Something went wrong while talking to the daemon: %s."), + $this->o_queue->get_error()),ERROR_DIALOG); + } + } + $this->dialog = FALSE; + $this->current = -1; + }else{ + $id = $this->dialog->get_id(); + $data = $this->dialog->save(); + $data['timestamp'] = $this->dialog->get_timestamp(); + if($this->o_queue->update_entries(array($id),$data)){ + $this->dialog = FALSE; + $this->current = -1; + } } - $this->dialog = FALSE; - $this->current = -1; } } @@ -286,16 +297,16 @@ class gotomasses extends plugin foreach($this->entries as $key => $task){ - $prio_actions = " "; - $prio_actions.= " "; - $prio_actions.= " "; - $prio_actions.= " "; + $prio_actions = " "; + $prio_actions.= " "; + $prio_actions.= " "; + $prio_actions.= " "; - $action = ""; if($this->acl_is_removeable()){ - $action.= ""; } @@ -309,7 +320,7 @@ class gotomasses extends plugin } /* Create each field */ - $field0 = array("string" => "" , + $field0 = array("string" => "" , "attach" => "style='width:20px;".$color."'"); $field1 = array("string" => $display, "attach" => "style='".$color."'"); diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl index 04a278c36..4e3fc127d 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl +++ b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl @@ -1,4 +1,6 @@ +{if $is_new} +
@@ -22,3 +24,40 @@
+ +{else} + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + +
{t}ID{/t}{$data.ID}
{t}Status{/t}{$data.STATUS}
{t}Result{/t}{$data.RESULT}
{t}Target{/t}{$data.MACADDRESS}
{t}Timestamp{/t}{$timestamp}
+
+ +
+
+ +{/if} diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc index df4c05a11..8da1e500e 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc @@ -58,6 +58,11 @@ class DaemonEvent /* Load values from given data */ if(count($data)){ $this->is_new = FALSE; + + $attrs = array("id" => "ID"); + foreach($attrs as $to => $from){ + $this->$to = $data[$from]; + } } } @@ -349,6 +354,19 @@ class DaemonEvent } + /*! \brief Returns the event ID + @return Returns the event ID + */ + public function get_id() + { + if($this->is_new){ + return(-1); + }else{ + return($this->data['ID']); + } + } + + /*! \brief Returns a set of elements selected in a MultiSelectWindow @return Array[integer]=integer */ diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc index bb1530d6a..9386ea1d1 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc @@ -19,16 +19,19 @@ class DaemonEvent_wakeup extends DaemonEvent $display = $this->get_header(); + $tmp = $this->data; + /* Check if target add dialog is open */ - if($this->is_target_list_open()){ - $display .= $this->get_target_add_list(); - }else{ - $smarty = get_smarty(); - $smarty->assign("target_list" , $this->get_target_list()); - $smarty->assign("timestamp" , $this->get_time_select()); - $display.= $smarty->fetch(get_template_path('DaemonEvent_wakeup.tpl', TRUE, dirname(__FILE__))); - } - + if($this->is_target_list_open() && $this->is_new){ + return($this->get_target_add_list()); + } + + $smarty = get_smarty(); + $smarty->assign("data" , $this->data); + $smarty->assign("target_list" , $this->get_target_list()); + $smarty->assign("is_new" , $this->is_new); + $smarty->assign("timestamp" , $this->get_time_select()); + $display.= $smarty->fetch(get_template_path('DaemonEvent_wakeup.tpl', TRUE, dirname(__FILE__))); $display.= $this->get_footer(); return($display); } -- 2.30.2