Code

Skip Setting FAIstate in Workgeneric if FAI is disabled
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Dec 2006 11:29:49 +0000 (11:29 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Thu, 7 Dec 2006 11:29:49 +0000 (11:29 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@5340 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_workstationGeneric.inc
plugins/admin/systems/workstation.tpl

index 0330d015e3443af3949ddf272230a2ca545aad1f..ef68b3993add8d2a3e020635384a8a83ab3a8187 100644 (file)
@@ -48,7 +48,7 @@ class workgeneric extends plugin
       "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule",
       "ghCpuType", "ghMemSize", "ghUsbSupport",
       "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l","FAIscript");
-  var $objectclasses= array("top", "gotoWorkstation", "GOhard","FAIobject");
+  var $objectclasses= array("top", "gotoWorkstation", "GOhard");
 
   var $mapActions   = array("reboot"          => "localboot",
                             "instant_update"  => "softupdate",
@@ -58,10 +58,16 @@ class workgeneric extends plugin
                             "memcheck"        => "memcheck",
                             "sysinfo"         => "sysinfo");
 
-
+  
+  var $fai_activated = FALSE;
 
   function workgeneric ($config, $dn= NULL, $parent= NULL)
   {
+    $tmp = search_config($config->data,"faiManagement","CLASS");
+    if(!empty($tmp)){
+      $this->fai_activated = TRUE;
+    }
+
     plugin::plugin ($config, $dn, $parent);
     $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
 
@@ -162,34 +168,36 @@ class workgeneric extends plugin
         } elseif ($_POST['saction'] != "wake") {
 
           /* Set FAIstate */
-          $ldap = $this->config->get_ldap_link();
-          $ldap->cd($this->config->current['BASE']);
-          $ldap->cat($this->dn,array("objectClass"));
-          $res = $ldap->fetch();
-
-          $attrs = array();
-          $attrs['FAIstate'] = "";
-          if(isset($this->mapActions[$_POST['saction']])){
-            $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
-          }
+          if($this->fai_activated){
+            $ldap = $this->config->get_ldap_link();
+            $ldap->cd($this->config->current['BASE']);
+            $ldap->cat($this->dn,array("objectClass"));
+            $res = $ldap->fetch();
+
+            $attrs = array();
+            $attrs['FAIstate'] = "";
+            if(isset($this->mapActions[$_POST['saction']])){
+              $attrs['FAIstate'] = $this->mapActions[$_POST ['saction']];
+            }
 
-          for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
-            $attrs['objectClass'][] = $res['objectClass'][$i];
-          }
+            for($i = 0; $i < $res['objectClass']['count'] ; $i ++){
+              $attrs['objectClass'][] = $res['objectClass'][$i];
+            }
 
-          if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
-            $attrs['objectClass'][] = "FAIobject";
-          }
+            if(($attrs['FAIstate'] != "") && (!in_array("FAIobject",$attrs['objectClass']))){
+              $attrs['objectClass'][] = "FAIobject";
+            }
 
-          if($attrs['FAIstate'] == ""){
-            #FIXME we should check if FAIobject is used anymore
-            $attrs['FAIstate'] = array();
-          }
+            if($attrs['FAIstate'] == ""){
+#FIXME we should check if FAIobject is not used anymore
+              $attrs['FAIstate'] = array();
+            }
 
-          $ldap->cd($this->dn);
-          $ldap->modify($attrs);
-          show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn));
+            $ldap->cd($this->dn);
+            $ldap->modify($attrs);
+            show_ldap_error($ldap->get_error(), sprintf(_("Saving of system workstation/generic (FAIstate) with dn '%s' failed."),$this->dn));
+
+          }
           $this->didAction= TRUE;
         }
       }
@@ -291,6 +299,7 @@ class workgeneric extends plugin
     $smarty->assign("modes", $this->modes);
     $smarty->assign("nfsservers", $this->config->data['SERVERS']['NFS']);
     $smarty->assign("syslogservers", $this->gotoSyslogServers);
+    $smarty->assign("fai_activated",$this->fai_activated);
 
     $ntpser = array();
     foreach($this->gotoNtpServers as $server){
@@ -496,6 +505,8 @@ class workgeneric extends plugin
       }
     }
 
+    print_a($this->attrs);
+
     /* cn=default and macAddress=- indicates that this is a template */
     if($this->cn == "wdefault"){
       $this->netConfigDNS->macAddress = "-";
index df95ee5b954999ba34c5fdc8e589e2bc05707e68..428b5ca048a6f04f1ecdff32ea42541cfc681c75 100644 (file)
 {$netconfig}
 {/if}
 <p class="plugbottom" style="margin-bottom:0px; padding:0px;">&nbsp;</p>
+
+{if $fai_activated}
 <h2><img class="center" alt="" align="middle" src="images/rocket.png"> {t}Action{/t}</h2>
 <table summary="">
  <tr>
   </td>
  </tr>
 </table>
+{/if}
 <input type="hidden" name="workgeneric_posted" value="1">
  {if $cn eq 'wdefault'}
 <!-- Place cursor -->