From 1f3f152558def25676eed64e2c8b2d383bf2cd36 Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 26 Feb 2008 07:08:35 +0000 Subject: [PATCH] Updated gotomasses. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9116 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../addons/gotomasses/class_gotomasses.inc | 34 +++++++++++++++---- .../gotomasses/events/DaemonEvent_wakeup.tpl | 29 ++++++++++------ .../gotomasses/events/class_DaemonEvent.inc | 22 ++++++++---- .../events/class_DaemonEvent_halt.inc | 2 +- .../events/class_DaemonEvent_reinstall.inc | 2 +- .../events/class_DaemonEvent_update.inc | 2 +- .../events/class_DaemonEvent_wakeup.inc | 6 ++-- 7 files changed, 69 insertions(+), 28 deletions(-) diff --git a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc index d9835f22e..b59bd6b1a 100644 --- a/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc +++ b/gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc @@ -121,6 +121,22 @@ class gotomasses extends plugin } } + /************ + * EDIT + ************/ + + if($s_action == "edit"){ + $id = $s_entry; + $type = FALSE; + if(isset($this->entries[$id])){ + $event = $this->entries[$s_entry]; + if(isset($this->events['BY_EDIT_ACTION'][$event['HEADERTAG']])){ + $type = $this->events['BY_EDIT_ACTION'][$event['HEADERTAG']]; + $this->dialog = new $type['CLASS_NAME']($this->config,$event); + } + } + } + /************ * REMOVE ************/ @@ -217,8 +233,8 @@ class gotomasses extends plugin $divlist->SetHeadpageMode(); $s = ".|"._("Actions")."|\n"; $s.= "..| "._("Create")."\n"; - foreach($this->events as $name => $event){ - $s.= "...|".$event['MenuImage']." ".$event['MenuName']."|add_event_".$name."\n"; + foreach($this->events['BY_CLASS'] as $name => $event){ + $s.= "...|".$event['MenuImage']." ".$event['s_Menu_Name']."|add_event_".$name."\n"; } $divlist->SetDropDownHeaderMenu($s); @@ -254,8 +270,9 @@ class gotomasses extends plugin /* set Page header */ $divlist->AddHeader(array("string"=> $chk, "attach"=>"style='width:20px;'")); - $divlist->AddHeader(array("string"=>""._("Target").$sort_img_1." / ". - ""._("Task").$sort_img_2."")); + $divlist->AddHeader(array("string"=>""._("Target").$sort_img_1."")); + $divlist->AddHeader(array("string"=>""._("Task").$sort_img_2."", + "attach"=>"style='width:80px;'")); $divlist->AddHeader(array("string"=>""._("Schedule").$sort_img_3."", "attach"=>"style='width:100px;'")); $divlist->AddHeader(array("string"=>""._("Status").$sort_img_4."", @@ -286,21 +303,26 @@ class gotomasses extends plugin $display = $task['MACADDRESS']; $display2= $task['HEADERTAG']; + if( isset($this->events['BY_EDIT_ACTION'][$display2]['ListImage']) && + !empty($this->events['BY_EDIT_ACTION'][$display2]['ListImage'])){ + $display2 = $this->events['BY_EDIT_ACTION'][$display2]['ListImage']; + } + /* Create each field */ $field0 = array("string" => "" , "attach" => "style='width:20px;".$color."'"); $field1 = array("string" => $display, "attach" => "style='".$color."'"); $field1a= array("string" => $display2, - "attach" => "style='".$color.";width:80px;'"); + "attach" => "style='".$color.";width:80px; text-align:right;'"); $field2 = array("string" => date("d.m.Y H:i:s",strtotime($task['TIMESTAMP'])),"attach" => "style='".$color.";width:100px;'"); $field3 = array("string" => $task['STATUS'],"attach" => "style='".$color.";width:80px;'"); $field4 = array("string" => $prio_actions.$action,"attach" => "style='".$color.";text-align:right;width:120px;border-right:0px;'"); $divlist->AddElement(array($field0,$field1,$field1a,$field2,$field3,$field4)); } - $smarty = get_smarty(); + $smarty->assign("events",$this->events); $smarty->assign("start",$this->start); $smarty->assign("start_real", ($this->start + 1)); $smarty->assign("ranges", array("10" => "10", diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl index 7caf5f448..04a278c36 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl +++ b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl @@ -1,15 +1,24 @@ - +
- - - - - - - - +
{t}Timestamp{/t}{$timestamp}
{t}Target objects{/t}
- {$target_list} + + + + + + +
{t}Timestamp{/t}{$timestamp}
+
+ + + + +
+ {t}Target objects{/t} +
+ {$target_list} +
diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc index 45dc1def5..df4c05a11 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc @@ -26,6 +26,7 @@ class DaemonEvent protected $s_Menu_Name = "s_Menu_Name not set"; // Diplayed in the ActionsMenu->CreateNew protected $s_Event_Name = "s_Event_Name not set"; // Will be displayed in the Management list. protected $s_Menu_Image = "images/empty.png"; // The deamon command name. + protected $s_List_Image = ""; // The deamon command name. protected $target_add_list_used = FALSE; // Indicates that the target add list was used. protected $time_select_used = FALSE; // Indicates that we have used the timestamp select boxes. @@ -35,7 +36,8 @@ class DaemonEvent protected $config; // GOsa configuration file protected $data; // The event data - protected $s_action = ""; // The deamon command name. + protected $s_New_Action = ""; // The deamon command name. + protected $s_Edit_Action= ""; // The deamon command name. protected $a_targets = array(); // The list of assigned Targets protected $timestamp = 0; // Event execution time; protected $id = -1; // The Table ID @@ -266,11 +268,13 @@ class DaemonEvent public function get_event_info() { $data =array(); - $data['NAME'] = get_class($this); - $data['MenuName'] = $this->s_Menu_Name; - $data['EventName'] = $this->s_Event_Name; - $data['Action'] = $this->s_action; + $data['CLASS_NAME'] = get_class($this); + foreach(array("s_Menu_Name","s_Event_Name","s_New_Action","s_Edit_Action") as $attr){ + $data[$attr] = $this->$attr; + } $data['MenuImage'] = "".$this->s_Menu_Name.""; + $data['ListImage'] = "".$this->s_Event_Name.""; return($data); } @@ -288,7 +292,11 @@ class DaemonEvent foreach($class_mapping as $name => $path){ if(preg_match("/^DaemonEvent_/",$name)){ $tmp = new $name($config); - $list[$name] = $tmp->get_event_info(); + $evt = $tmp->get_event_info(); + + $list['BY_CLASS'][$name] = $evt; + $list['BY_EDIT_ACTION'][$evt['s_Edit_Action']]= $evt; + $list['BY_NEW_ACTION'] [$evt['s_New_Action']] = $evt; } } return($list); @@ -309,7 +317,7 @@ class DaemonEvent */ public function get_header_tag() { - return($this->s_action); + return($this->s_New_Action); } diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc index 76b2cc92c..58961297a 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc @@ -7,7 +7,7 @@ class DaemonEvent_halt extends DaemonEvent DaemonEvent::__construct($config,$data); $this->s_Menu_Name = _("Shutdown"); $this->s_Event_Name = _("Shutdown"); - $this->s_action = "trigger_action_halt"; + $this->s_New_Action = "trigger_action_halt"; $this->s_Menu_Image = "images/status_stopped.png"; } diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc index d10e76d2e..46f7d6428 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc @@ -7,7 +7,7 @@ class DaemonEvent_reinstall extends DaemonEvent DaemonEvent::__construct($config,$data); $this->s_Menu_Name = _("Reinstall"); $this->s_Event_Name = _("Reinstall"); - $this->s_action = "trigger_action_reinstall"; + $this->s_New_Action = "trigger_action_reinstall"; $this->s_Menu_Image = "images/fai_small.png"; } diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc index 17e229078..ca1b9e11e 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc @@ -7,7 +7,7 @@ class DaemonEvent_update extends DaemonEvent DaemonEvent::__construct($config,$data); $this->s_Menu_Name = _("Software update"); $this->s_Event_Name = _("software update"); - $this->s_action = "trigger_action_update"; + $this->s_New_Action = "trigger_action_update"; $this->s_Menu_Image = "images/time.png"; } 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 fadb51628..bb1530d6a 100644 --- a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc +++ b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc @@ -6,9 +6,11 @@ class DaemonEvent_wakeup extends DaemonEvent { DaemonEvent::__construct($config,$data); $this->s_Menu_Name = _("Wake up"); - $this->s_Event_Name = _("Wake up"); - $this->s_action = "job_trigger_action_wake"; + $this->s_Event_Name = _("Wake up a system"); + $this->s_New_Action = "job_trigger_action_wake"; + $this->s_Edit_Action= "trigger_action_wake"; $this->s_Menu_Image = "images/status_running.png"; + $this->s_List_Image = "images/status_running.png"; } public function execute() -- 2.30.2