Code

Updated gotomasses.
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Feb 2008 07:08:35 +0000 (07:08 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Feb 2008 07:08:35 +0000 (07:08 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9116 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc
gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_wakeup.tpl
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc
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 d9835f22e553fe218d88e93a6de56c97d087dd28..b59bd6b1ad27a52f38a5673b6e72956faf09a404 100644 (file)
@@ -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.= "..|<img src='images/list_new.png' alt='' border='0' class='center'>&nbsp;"._("Create")."\n";
-    foreach($this->events as $name =>  $event){
-      $s.= "...|".$event['MenuImage']."&nbsp;".$event['MenuName']."|add_event_".$name."\n";
+    foreach($this->events['BY_CLASS'] as $name =>  $event){
+      $s.= "...|".$event['MenuImage']."&nbsp;".$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"=>"<a href='?plug=".$plug."&amp;sort=TargetName'>"._("Target").$sort_img_1."</a>&nbsp;/&nbsp;".
-                                     "<a href='?plug=".$plug."&amp;sort=TaskID'>"._("Task").$sort_img_2."</a>"));
+    $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;'"));
     $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>",
@@ -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" => "<input type='checkbox' id='item_selected_".$task['ID']."' name='item_selected_".$task['ID']."'>" ,
                       "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",
index 7caf5f448a90563dfcd07ca6fe31aa721f33845b..04a278c368613eb5f508ce535f3fdcc3f2616352 100644 (file)
@@ -1,15 +1,24 @@
 
-<table>
+<table style='width:100%;'>
        <tr>
-               <td style='vertical-align:top'>{t}Timestamp{/t}</td>
-               <td>{$timestamp}</td>
-       </tr>
-       <tr>
-               <td>{t}Target objects{/t}</td>
-       </tr>
-       <tr>
-               <td colspan="2">
-                       {$target_list}
+               <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>
index 45dc1def5ecd0d739958662dd39c2a95bfcaef57..df4c05a119ce4cdd085638e8123ddfb0fdbc9c18 100644 (file)
@@ -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']    = "<img src='".$this->s_Menu_Image."' alt='".$this->s_Menu_Name."' border='0' class='center'>";
+    $data['ListImage']    = "<img src='".$this->s_List_Image."' title='".$this->s_Event_Name."' 
+                                alt='".$this->s_Event_Name."' border='0' class='center'>";
     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);
   }
 
 
index 76b2cc92c42bc0061ef0657b3e06c56ecb943025..58961297a30ae2b7614936479e23e74aa22b2f70 100644 (file)
@@ -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";
   }
 
index d10e76d2edad95bc4c851406bf0845df17e40450..46f7d6428244720d45b7fd36acb1c4844e409734 100644 (file)
@@ -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";
   }
 
index 17e2290789c51c72b2d859b867f83586ea7a9c35..ca1b9e11e7ad5f508dff45948b079e7b2d130ecf 100644 (file)
@@ -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";
   }
 
index fadb51628e1f837b0d07ebd0fa1f2688c643ff5e..bb1530d6a5bcd32f25dd29de478e5e0b00e67023 100644 (file)
@@ -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()