Code

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

gosa-plugins/systems/admin/systems/class_servGeneric.inc
gosa-plugins/systems/admin/systems/server.tpl

index 54256514aa45a97b13f75a9fa492e67ed995373d..81942231f93f7df2cba772a374c33b89bc39f34f 100644 (file)
@@ -48,6 +48,9 @@ class servgeneric extends plugin
   var $fai_activated  =FALSE;
   var $view_logged = FALSE;
 
+  var $currently_installing = FALSE;
+  var $currently_installing_warned = FALSE;
+
   function servgeneric (&$config, $dn= NULL, $parent= NULL)
   {
     /* Check if FAI is activated */
@@ -74,6 +77,17 @@ class servgeneric extends plugin
     $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
     $this->netConfigDNS->set_acl_category("server");
     $this->netConfigDNS->set_acl_base($this->base);
+
+    /* 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;
+      }
+    }
        
     /* Save dn for later references */
     $this->orig_dn= $this->dn;
@@ -213,6 +227,7 @@ class servgeneric extends plugin
     }
     $smarty->assign("netconfig", $str);
     $smarty->assign("modes", $this->modes);
+    $smarty->assign("currently_installing", $this->currently_installing);
 
     return($smarty->fetch (get_template_path('server.tpl', TRUE)));
   }
@@ -308,6 +323,12 @@ class servgeneric extends plugin
       }
     }
 
+    /* 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 01e35a3a6a736a50baa5bd8f5bf04d5fba339cf4..9cf149f7ca38e5cdeba1ed6addf9c436b7ad8572 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 server{/t}">
     <option>&nbsp;</option>
 {/render}
   </td>
   <td>
+{render acl=$FAIstateACL}
    <input type=submit name="action" value="{t}Execute{/t}">
+{/render}
   </td>
  </tr>
+{/if}
 </table>
 {/if}