Code

Updated mass deployment
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 07:29:31 +0000 (07:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Wed, 27 Feb 2008 07:29:31 +0000 (07:29 +0000)
-Added reboot event.

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

gosa-plugins/goto/addons/gotomasses/class_gotomasses.inc
gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.tpl [new file with mode: 0644]
gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reinstall.tpl
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent.inc
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc [new file with mode: 0644]
gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reinstall.inc

index 47d78b40fa89995481061fb3f44aa04cb064b147..22a91d117f3da5588893540570e88065cf3c06a8 100644 (file)
@@ -533,7 +533,7 @@ class gotomasses extends plugin
           "plPriority"    => 0,
           "plSection"     => array("addon"),
           "plCategory"    => array("gotomasses" => array("objectClass" => "none", "description" => _("System mass deployment"))),
-          "plProvidedAcls" => array("Comment"   => _("Description"), 
+          "plProvidedAcls" => array("Comment"   => _("Description")) 
           ));
   }
 }
diff --git a/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.tpl b/gosa-plugins/goto/addons/gotomasses/events/DaemonEvent_reboot.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 4e3fc127d969422457a48dc11387dc7298378bbb..448c1f39ab3d764f77f30e5f8193118d07e6a1a9 100644 (file)
                                        <td>{t}ID{/t}</td>
                                        <td>{$data.ID}</td>
                                </tr>
+                               <tr>
+                                       <td>{t}Progress{/t}</td>
+                                       <td><input type="text" name="progress" value="{$progress}"></td>
+                               </tr>
                                <tr>
                                        <td>{t}Status{/t}</td>
-                                       <td>{$data.STATUS}</td>
+                                       <td><input type="text" name="status" value="{$status}"></td>
                                </tr>
                                <tr>
                                        <td>{t}Result{/t}</td>
index 0568bfeea822e98d476f21ab1124483928787b3e..0945f62866b67ff3fa7cb799cc61eb06d82d1b45 100644 (file)
@@ -3,7 +3,7 @@
 /*
    This code is part of GOsa (http://www.gosa-project.org)
    Copyright (C) 2008 Fabian Hickert
-
+G
    This program is free software; you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation; either version 2 of the License, or
@@ -36,7 +36,7 @@ class DaemonEvent
   protected $s_Menu_Image = "images/empty.png";     // Image displayed in Actions->New
   protected $s_List_Image = "";                     // Image displayed in event listing
 
-  protected $config;          // GOsa configuration object 
+  public $config;          // GOsa configuration object 
   protected $data;            // The event data, when edited
 
   protected $a_targets    = array();  // The list of assigned Targets (When newly created)
@@ -436,6 +436,15 @@ class DaemonEvent
     return($ids);
   }
 
+  /*! \brief Add a target MAC address 
+      @param Array A List of all target that should be added.
+   */
+  public function add_targets($targets) 
+  {
+    foreach($targets as $target){
+      $this->a_targets[] = $target;
+    }
+  }
 }
 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
diff --git a/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc b/gosa-plugins/goto/addons/gotomasses/events/class_DaemonEvent_reboot.inc
new file mode 100644 (file)
index 0000000..38e391b
--- /dev/null
@@ -0,0 +1,45 @@
+<?php
+
+class DaemonEvent_reboot extends DaemonEvent
+{
+  public function __construct($config,$data = array())
+  {
+    DaemonEvent::__construct($config,$data);
+    $this->s_Menu_Name  = _("Reboot"); 
+    $this->s_Event_Name = _("Reboot a system"); 
+    $this->s_New_Action = "job_trigger_action_reboot";
+    $this->s_Edit_Action= "trigger_action_reboot";
+    $this->s_Menu_Image = "images/list_reload.png";
+    $this->s_List_Image = "images/list_reload.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_reboot.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 05989035f9a96dbc6b0f0ee41e7a293de3f309d9..59e3f57674b4f5d9f3dc59384d31844c9f79bc28 100644 (file)
@@ -2,6 +2,9 @@
 
 class DaemonEvent_reinstall extends DaemonEvent
 {
+  var $progress = -1;  
+  var $status   = "none";  
+
   public function __construct($config,$data = array())
   {
     DaemonEvent::__construct($config,$data);
@@ -11,6 +14,15 @@ class DaemonEvent_reinstall extends DaemonEvent
     $this->s_Edit_Action= "trigger_action_reinstall";
     $this->s_Menu_Image = "images/fai_small.png";
     $this->s_List_Image = "images/fai_small.png";
+  
+    if(!$this->is_new()){
+      if(isset($data['PROGRESS'])){
+        $this->progress = $data['PROGRESS'];
+      }
+      if(isset($data['STATUS'])){
+        $this->progress = $data['STATUS'];
+      }
+    }
   }
 
   public function execute()
@@ -27,6 +39,8 @@ class DaemonEvent_reinstall extends DaemonEvent
     }
 
     $smarty = get_smarty();
+    $smarty->assign("status"        , $this->status);
+    $smarty->assign("progress"        , $this->progress);
     $smarty->assign("data"        , $this->data);
     $smarty->assign("target_list" , $this->get_target_list());
     $smarty->assign("is_new"      , $this->is_new);
@@ -38,8 +52,22 @@ class DaemonEvent_reinstall extends DaemonEvent
 
   public function save_object()
   {
-    DaemonEvent::save_object();
-  }
+    $ret = DaemonEvent::save_object();
+    foreach(array("progress","status") as $attr){
+      if(isset($_POST[$attr])){
+        $this->$attr = get_post($attr);
+      }
+    }
+  } 
+
+  public function save()
+  {
+    $ret = DaemonEvent::save();
+    foreach(array("progress","status") as $attr){
+      $ret[$attr] = $this->$attr;
+    }
+    return($ret);
+  } 
 } 
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
 ?>