Code

Updated gotomasses.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Feb 2008 08:47:49 +0000 (08:47 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Feb 2008 08:47:49 +0000 (08:47 +0000)
-Added reinstall, halt, wakeup, update.

git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9118 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc
gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tlp [new file with mode: 0644]
gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tlp [new file with mode: 0644]
gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl [new file with mode: 0644]
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_halt.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_update.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_wakeup.inc

index 9351fc9b47a9d73e529ac3ad94528a092dd32a59..d7043005ade083bbf655be090891afc180542046 100644 (file)
@@ -115,9 +115,9 @@ class gotomasses extends plugin
   
     if(preg_match("/^add_event_/",$s_action)){
       $type = preg_replace("/^add_event_/","",$s_action);
-      if(isset($this->events[$type])){
-        $e_data = $this->events[$type];
-        $this->dialog = new $e_data['NAME']($this->config);
+      if(isset($this->events['BY_CLASS'][$type])){
+        $e_data = $this->events['BY_CLASS'][$type];
+        $this->dialog = new $e_data['CLASS_NAME']($this->config);
       }
     }
 
@@ -283,7 +283,7 @@ class gotomasses extends plugin
     $divlist->AddHeader(array("string"=> $chk,          "attach"=>"style='width:20px;'"));
     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=TargetName'>"._("Target").$sort_img_1."</a>"));
     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=TaskID'>"._("Task").$sort_img_2."</a>",
-                                      "attach"=>"style='width:80px;'"));
+                                      "attach"=>"style='width:120px;'"));
     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Schedule'>"._("Schedule").$sort_img_3."</a>",
                                       "attach"=>"style='width:100px;'"));
     $divlist->AddHeader(array("string"=>"<a href='?plug=".$plug."&amp;sort=Action'>"._("Status").$sort_img_4."</a>",
@@ -313,19 +313,25 @@ class gotomasses extends plugin
       $color = "";
       $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'];
-      }
+     
+      /* Check if this event exists as Daemon class 
+       * In this case, display a more accurate entry.
+       */ 
+      if(isset($this->events['BY_EDIT_ACTION'][$task['HEADERTAG']]['s_Menu_Name'])){
+        $event_type = $this->events['BY_EDIT_ACTION'][$task['HEADERTAG']];
+        $display2= $event_type['s_Menu_Name'];
+        if(isset($event_type['ListImage']) && !empty($event_type['ListImage'])){
+          $display2 = $event_type['ListImage']."&nbsp;".$display2;
+        }
+      } 
 
       /* Create each field */
-      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$key."' name='item_selected_".$key."'>" ,
+      $field0 = array("string" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$key."'>" ,
                       "attach" => "style='width:20px;".$color."'");
       $field1 = array("string" => $display,
                       "attach" => "style='".$color."'");
       $field1a= array("string" => $display2,
-                      "attach" => "style='".$color.";width:80px; text-align:right;'");
+                      "attach" => "style='".$color.";width:120px;'");
       $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;'");
@@ -457,7 +463,7 @@ class gotomasses extends plugin
 
     $this->entries = array();
     foreach($entries as $entry){
-      $this->entries[]= $entry;
+      $this->entries[$entry['ID']]= $entry;
     }
   }
 
diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tlp b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_halt.tlp
new file mode 100644 (file)
index 0000000..4e3fc12
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+       <tr>
+               <td style='width:50%; vertical-align:top;'>
+                       <table>
+                               <tr>
+                                       <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+                                       <td>{$timestamp}</td>
+                               </tr>
+                       </table>
+               </td>
+               <td style='width:50%; vertical-align:top;'>
+                       <table style='width:100%;'>
+                               <tr>
+                                       <td>
+                                               {t}Target objects{/t}
+                                               <br>
+                                               {$target_list}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+       <tr>
+               <td style='width:50%; vertical-align:top;'>
+                       <table>
+                               <tr>
+                                       <td>{t}ID{/t}</td>
+                                       <td>{$data.ID}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Status{/t}</td>
+                                       <td>{$data.STATUS}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Result{/t}</td>
+                                       <td>{$data.RESULT}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Target{/t}</td>
+                                       <td>{$data.MACADDRESS}</td>
+                               </tr>
+                               <tr>
+                                       <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+                                       <td>{$timestamp}</td>
+                               </tr>
+                       </table>
+               </td>
+               <td style='width:50%; vertical-align:top;'>
+                       <table >
+                       </table>
+               </td>
+       </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tlp b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tlp
new file mode 100644 (file)
index 0000000..4e3fc12
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+       <tr>
+               <td style='width:50%; vertical-align:top;'>
+                       <table>
+                               <tr>
+                                       <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+                                       <td>{$timestamp}</td>
+                               </tr>
+                       </table>
+               </td>
+               <td style='width:50%; vertical-align:top;'>
+                       <table style='width:100%;'>
+                               <tr>
+                                       <td>
+                                               {t}Target objects{/t}
+                                               <br>
+                                               {$target_list}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+       <tr>
+               <td style='width:50%; vertical-align:top;'>
+                       <table>
+                               <tr>
+                                       <td>{t}ID{/t}</td>
+                                       <td>{$data.ID}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Status{/t}</td>
+                                       <td>{$data.STATUS}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Result{/t}</td>
+                                       <td>{$data.RESULT}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Target{/t}</td>
+                                       <td>{$data.MACADDRESS}</td>
+                               </tr>
+                               <tr>
+                                       <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+                                       <td>{$timestamp}</td>
+                               </tr>
+                       </table>
+               </td>
+               <td style='width:50%; vertical-align:top;'>
+                       <table >
+                       </table>
+               </td>
+       </tr>
+</table>
+
+{/if}
diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_update.tpl
new file mode 100644 (file)
index 0000000..4e3fc12
--- /dev/null
@@ -0,0 +1,63 @@
+
+{if $is_new}
+
+<table style='width:100%;'>
+       <tr>
+               <td style='width:50%; vertical-align:top;'>
+                       <table>
+                               <tr>
+                                       <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+                                       <td>{$timestamp}</td>
+                               </tr>
+                       </table>
+               </td>
+               <td style='width:50%; vertical-align:top;'>
+                       <table style='width:100%;'>
+                               <tr>
+                                       <td>
+                                               {t}Target objects{/t}
+                                               <br>
+                                               {$target_list}
+                                       </td>
+                               </tr>
+                       </table>
+               </td>
+       </tr>
+</table>
+
+{else}
+
+<table style='width:100%;'>
+       <tr>
+               <td style='width:50%; vertical-align:top;'>
+                       <table>
+                               <tr>
+                                       <td>{t}ID{/t}</td>
+                                       <td>{$data.ID}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Status{/t}</td>
+                                       <td>{$data.STATUS}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Result{/t}</td>
+                                       <td>{$data.RESULT}</td>
+                               </tr>
+                               <tr>
+                                       <td>{t}Target{/t}</td>
+                                       <td>{$data.MACADDRESS}</td>
+                               </tr>
+                               <tr>
+                                       <td style='vertical-align:top'>{t}Timestamp{/t}</td>
+                                       <td>{$timestamp}</td>
+                               </tr>
+                       </table>
+               </td>
+               <td style='width:50%; vertical-align:top;'>
+                       <table >
+                       </table>
+               </td>
+       </tr>
+</table>
+
+{/if}
index 58961297a30ae2b7614936479e23e74aa22b2f70..502ce884405068598b1cdbda2e03623aec483889 100644 (file)
@@ -1,16 +1,44 @@
 <?php
-
 class DaemonEvent_halt extends DaemonEvent
 {
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
-    $this->s_Menu_Name  = _("Shutdown"); 
-    $this->s_Event_Name = _("Shutdown"); 
-    $this->s_New_Action     = "trigger_action_halt";
+    $this->s_Menu_Name  = _("Shutdown");
+    $this->s_Event_Name = _("Shutdown");
+    $this->s_New_Action = "job_trigger_action_halt";
+    $this->s_Edit_Action= "trigger_action_halt";
     $this->s_Menu_Image = "images/status_stopped.png";
+    $this->s_List_Image = "images/status_stopped.png";
+  }
+
+  public function execute()
+  {
+    DaemonEvent::execute();
+
+    $display = $this->get_header();
+
+    $tmp = $this->data;
+
+    /* Check if target add dialog is open */
+    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_halt.tpl', TRUE, dirname(__FILE__)));
+    $display.= $this->get_footer();
+    return($display);
   }
 
+  public function save_object()
+  {
+    DaemonEvent::save_object();
+  }
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 46f7d6428244720d45b7fd36acb1c4844e409734..b4340c1ec9e8370fceb5df5981a9d5230648a5bc 100644 (file)
@@ -5,12 +5,41 @@ class DaemonEvent_reinstall extends DaemonEvent
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
-    $this->s_Menu_Name  = _("Reinstall"); 
+    $this->s_Menu_Name  = _("Reinstall");
     $this->s_Event_Name = _("Reinstall");
-    $this->s_New_Action     = "trigger_action_reinstall"; 
-    $this->s_Menu_Image = "images/fai_small.png";
+    $this->s_New_Action = "job_trigger_action_reinstall";
+    $this->s_Edit_Action= "trigger_action_reinstall";
+    $this->s_Menu_Image = "images/fai_small.png"_small;
+    $this->s_List_Image = "images/fai_small.png";
   }
 
+  public function execute()
+  {
+    DaemonEvent::execute();
+
+    $display = $this->get_header();
+
+    $tmp = $this->data;
+
+    /* Check if target add dialog is open */
+    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_reinstall.tpl', TRUE, dirname(__FILE__)));
+    $display.= $this->get_footer();
+    return($display);
+  }
+
+  public function save_object()
+  {
+    DaemonEvent::save_object();
+  }
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index ca1b9e11e7ad5f508dff45948b079e7b2d130ecf..03e589c4bd72b3c48fb7ad290353475de31828b6 100644 (file)
@@ -1,16 +1,46 @@
 <?php
 
+
 class DaemonEvent_update extends DaemonEvent
 {
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
-    $this->s_Menu_Name  = _("Software update"); 
-    $this->s_Event_Name = _("software update"); 
-    $this->s_New_Action     = "trigger_action_update";
+    $this->s_Menu_Name  = _("Software update");
+    $this->s_Event_Name = _("software update");
+    $this->s_New_Action = "job_trigger_action_update";
+    $this->s_Edit_Action= "trigger_action_update";
     $this->s_Menu_Image = "images/time.png";
+    $this->s_List_Image = "images/time.png";
+  }
+
+  public function execute()
+  {
+    DaemonEvent::execute();
+
+    $display = $this->get_header();
+
+    $tmp = $this->data;
+
+    /* Check if target add dialog is open */
+    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_update.tpl', TRUE, dirname(__FILE__)));
+    $display.= $this->get_footer();
+    return($display);
   }
 
+  public function save_object()
+  {
+    DaemonEvent::save_object();
+  }
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>
index 9386ea1d11c1ec8970950472e8f66a10b9074884..69fb776d80631f2880df096b4f65ef473eb2d768 100644 (file)
@@ -6,7 +6,7 @@ class DaemonEvent_wakeup extends DaemonEvent
   {
     DaemonEvent::__construct($config,$data);
     $this->s_Menu_Name  = _("Wake up"); 
-    $this->s_Event_Name = _("Wake up a system"); 
+    $this->s_Event_Name = _("Start 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";