Code

Updated Opsi
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Aug 2008 12:29:49 +0000 (12:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 26 Aug 2008 12:29:49 +0000 (12:29 +0000)
-Added remove client functionality.
-Added some images.
-Added action dropt down. Does not work currently.

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

gosa-plugins/opsi/admin/opsi/class_opsi.inc
gosa-plugins/opsi/admin/opsi/class_opsigeneric.inc
gosa-plugins/opsi/admin/opsi/generic.tpl

index b0f6bbb1251d1523fbbfd7e2329c74da6e5b9ca2..290f39157f27aa3eabf60a3173d44810954d7594 100644 (file)
@@ -65,7 +65,6 @@ class opsi extends gosaSupportDaemon
   function get_hosts_for_system_management()
   {
     $res = $this->list_clients();
-
     $data = array();
     foreach($res as $entry){
       if(!isset($entry['MAC'][0]['VALUE'])) $entry['MAC'][0]['VALUE'] = "";
@@ -382,15 +381,22 @@ class opsi extends gosaSupportDaemon
     @param
     @return            
    */
-  public function del_client()
+  public function del_client($hostId)
   {
-    /*  <xml> 
-        <header>gosa_opsi_del_client</header> 
-        <source>GOSA</source> 
-        <target>00:01:6c:9d:b9:fa</target> 
-        <hostId>limux-cl-2.intranet.gonicus.de</hostId>
-        </xml>
-     */
+    $data = array("hostId" => $hostId);
+
+    /* Check parameter */ 
+    if(empty($hostId)){
+      trigger_error("No valid host id given, check parameter 1.");
+      return;
+    }
+
+    /* Query SI server */
+    $res    = $this->send_data("gosa_opsi_del_client",$this->target,$data,TRUE);
+    if(isset($res['XML'][0]['ITEM'])){
+      return($res['XML'][0]['ITEM']);
+    }
+    return(array());
   }
 
 
@@ -398,16 +404,22 @@ class opsi extends gosaSupportDaemon
     @param
     @return            
    */
-  public function job_opsi_install_client()
+  public function job_opsi_install_client($hostId)
   {
-    /*  <xml> 
-        <header>job_opsi_install_client</header> 
-        <source>GOSA</source> 
-        <target>00:01:6c:9d:b9:fa</target> 
-        <hostId>limux-cl-2.intranet.gonicus.de</hostId> 
-        <macaddress>00:11:25:4b:8c:e5</macaddress> 
-        </xml>
-     */
+    $data = array("hostId" => $hostId);
+
+    /* Check parameter */ 
+    if(empty($hostId)){
+      trigger_error("No valid host id given, check parameter 1.");
+      return;
+    }
+
+    /* Query SI server */
+    $res    = $this->send_data("job_opsi_install_client",$this->target,$data,TRUE);
+    if(isset($res['XML'][0]['ITEM'])){
+      return($res['XML'][0]['ITEM']);
+    }
+    return(array());
   }
 }
 // vim:tabstop=2:expandtab:shiftwidth=2:filetype=php:syntax:ruler:
index 3b8a1165654360e5a897d963cec4c70c6bdf3bd1..98d4676fcd7243f7ca9b2f4abacfd59221b0a388 100644 (file)
@@ -20,6 +20,7 @@ class opsigeneric extends plugin
   private $init_failed = FALSE;
 
   private $parent_mode = TRUE;
+  private $is_installed = FALSE;
 
   public $mac          = "";
   public $note         = "";
@@ -144,6 +145,7 @@ class opsigeneric extends plugin
     }
 
     $smarty->assign("parent_mode", $this->parent_mode);
+    $smarty->assign("is_installed", $this->is_installed);
     $smarty->assign("init_failed",FALSE);
     $divSLP = new divSelectBox();
     $divALP = new divSelectBox();
@@ -264,7 +266,13 @@ class opsigeneric extends plugin
   }
 
   public function remove_from_parent()
-  {}
+  {
+    $this->opsi->del_client($this->hostId);
+    if($this->opsi->is_error()){
+      msg_dialog::display(_("Error"),msgPool::siError($this->opsi->get_error()),ERROR_DIALOG);
+      return;
+    }
+  }
 
 
   public function save_object()
index 918c5f752dbb23b16c7e8a57703eb96171a82598..a62329a532d8df753ea0c71203ff1364e7b932fa 100644 (file)
@@ -1,5 +1,5 @@
 
-<h2>Opsi host</h2>
+<h2><img src='plugins/opsi/images/client_generic.png' alt=' ' class='center'>&nbsp;{t}Opsi host{/t}</h2>
 
 {if $init_failed}
 
   </td>
  </tr>
  <tr>
-  <td style="width:50%;"><h2>Installed products</h2>
+  <td style="width:50%;"><h2><img class='center' src='plugins/opsi/images/product.png' 
+               alt=' '>&nbsp;{t}Installed products{/t}</h2>
        {$divSLP}
   </td>
-  <td style="width:50%;"><h2>Available products</h2>
+  <td style="width:50%;"><h2>{t}Available products{/t}</h2>
        {$divALP}
   </td>
  </tr>
+ <tr>
+  <td colspan="2">
+   <p class='seperator'>&nbsp;</p><br>
+   {if $parent_mode}
+    <h2><img src='images/rocket.png' alt="" class="center">&nbsp;{t}Action{/t}</h2>
+       <select name='opsi_action'>
+               <option>&nbsp;</option>
+               {if $is_installed}
+               <option value="install">{t}Reinstall{/t}</option>
+               {else}
+               <option value="install">{t}Install{/t}</option>
+               {/if}
+               <option value="wake">{t}Wake{/t}</option>
+       </select>
+       <input type='submit' name='opsi_trigger_action' value="{t}Execute{/t}">
+   {/if}
+  </td>
+ </tr>
 </table> 
 <input type='hidden' name='opsigeneric_posted' value='1'>
 {/if}