Code

Added check if workstation is currently installing
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 09:57:01 +0000 (09:57 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Tue, 11 Mar 2008 09:57:01 +0000 (09:57 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@9658 594d385d-05f5-0310-b6e9-bd551577e9d8

gosa-plugins/goto/admin/systems/goto/class_workstationGeneric.inc
gosa-plugins/goto/admin/systems/goto/workstation.tpl

index 4a9290e10d9b4116866ff3e1ca78220b6129be4f..22d4c28371213e90189f32f821ae3d121b33166a 100644 (file)
@@ -52,6 +52,9 @@ class workgeneric extends plugin
 
   var $member_of_ogroup = FALSE;
 
+  var $currently_installing = FALSE;
+  var $currently_installing_warned = FALSE;
+
   function workgeneric (&$config, $dn= NULL, $parent= NULL)
   {
     $tmp= $config->search("faiManagement", "CLASS",array('menu','tabs'));
@@ -70,6 +73,17 @@ class workgeneric extends plugin
 
     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
 
+    /* Check if this host is currently in installation process*/
+    $o = new gosaSupportDaemon();
+    $e_types = DaemonEvent::get_event_types(USER_EVENT | SYSTEM_EVENT | HIDDEN_EVENT);
+    $evts = $o->get_entries_by_mac(array($this->netConfigDNS->macAddress));
+    foreach($evts as $evt){
+      if(isset($e_types['QUEUED'][$evt['HEADERTAG']]) &&
+          $e_types['QUEUED'][$evt['HEADERTAG']] == "DaemonEvent_reinstall"){
+        $this->currently_installing =TRUE;
+      }
+    }
+
     /* Read arrays */
     foreach (array("ghNetNic", "ghIdeDev", "ghScsiDev") as $val){
       if (!isset($this->attrs[$val])){
@@ -311,6 +325,7 @@ class workgeneric extends plugin
     $smarty->assign("netconfig", $str);
 
     /* Show main page */
+    $smarty->assign("currently_installing", $this->currently_installing);
     return($smarty->fetch (get_template_path('workstation.tpl', TRUE, dirname(__FILE__))));
   }
 
@@ -438,6 +453,12 @@ class workgeneric extends plugin
       $message[]= _("There must be at least one NTP server selected, or the inherit mode activated.");
     }
 
+    /* Warn the user, that this host is currently installing */
+    if($this->currently_installing && !$this->currently_installing_warned){
+      $this->currently_installing_warned = TRUE;
+      $message[] = _("This host is currently installing, if you really want to save it, save again.");
+    }
+
     return ($message);
   }
 
index cbacbfac14dc6e9a21a6e27ee10fe89a5443e765..1ea980e7698ec9aca367ff5c9cc8a5b91129698e 100644 (file)
 <table summary="">
  <tr>
   <td>
+{if $currently_installing}
+       <i>{t}System installation in progress, the FAI state cannot be changed right now.{/t}</i>
+{else}
 {render acl=$FAIstateACL}
    <select size="1" name="saction" title="{t}Select action to execute for this terminal{/t}">
     <option>&nbsp;</option>
 {/render}
   </td>
   <td>
+{render acl=$FAIstateACL}
    <input type=submit name="action" value="{t}Execute{/t}">
+{/render}
   </td>
+{/if}
  </tr>
 </table>
 {/if}