Code

Added network autodetect button
authorcajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 May 2006 11:03:33 +0000 (11:03 +0000)
committercajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8>
Mon, 29 May 2006 11:03:33 +0000 (11:03 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@3543 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_servRepositorySetup.inc
plugins/admin/systems/class_termDNS.inc
plugins/admin/systems/network.tpl

index 4b885bbd90622fba704b992b2d4d69fea2b6ee0d..8fec23baad07671634fe52e988f494a63209d1a5 100644 (file)
@@ -166,8 +166,8 @@ class servRepositorySetup  extends plugin
     if(!empty($cmd)){
       $res = shell_exec($cmd);
       $res2 = trim($res);
-      if((!$res)){
-        print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s' please check your gosa.conf."),$cmd));
+      if(!$res){
+        print_red(sprintf(_("Can't execute specified REPOSITORY_HOOK '%s'. Please check your gosa.conf."),$cmd));
       }elseif(empty($res2)){
         print_red(sprintf(_("The specified REPOSITORY_HOOK '%s', specified in your gosa.conf, returns an empty string."),$cmd));
       }else{  
index 06af668ebef3a149dd66c28334885c5c0e92c73f..66152454ee4d5897486d193fcde3d90312cdc67e 100644 (file)
@@ -8,7 +8,8 @@ class termDNS extends plugin
   var $cli_parameters   = array("eins" => "Eins ist toll", "zwei" => "Zwei ist noch besser");
 
   /* attribute list for save action */
-  var $ignore_account = TRUE;
+  var $ignore_account = true;
+  var $autonet        = false;
 
   /* Basic informations 
    */
@@ -44,6 +45,12 @@ class termDNS extends plugin
 
     if(isset($this->attrs['cn'][0])){
       $this->OrigCn = $this->attrs['cn'][0];
+      $this->cn = $this->attrs['cn'][0];
+    }
+
+    /* Do we have autonet support? */
+    if (isset($this->config->data['MAIN']['AUTO_NETWORK_HOOK'])){
+      $this->autonet= true;
     }
 
     /* Hide all dns specific code, if dns is not available 
@@ -115,6 +122,25 @@ class termDNS extends plugin
 
     $smarty->assign("staticAddress", ""); 
  
+    /* Check for autonet button */
+    if ($this->autonet && isset($_POST['autonet'])){
+      $cmd= $this->config->data['MAIN']['AUTO_NETWORK_HOOK'];
+      if(!empty($cmd) && $this->cn != ""){
+        $res = shell_exec($cmd." ".$this->cn);
+        if(!$res){
+          print_red(sprintf(_("Can't execute specified AUTO_NETWORK_HOOK '%s'. Please check your gosa.conf."),$cmd));
+        } else {
+          $res= split(';', trim($res));
+          if (isset($res[0]) && $res[0] != ""){
+            $this->ipHostNumber= $res[0];
+          }
+          if (isset($res[1]) && $res[1] != ""){
+            $this->macAddress= $res[1];
+          }
+        }
+      }
+    }
+
     /* There is no dns available 
      */
     if($this->DNSenabled == false){
@@ -128,6 +154,12 @@ class termDNS extends plugin
         $smarty->assign($attr,$this->$attr);
       }
       $smarty->assign("staticAddress","<font class=\"must\">*</font>");
+
+      if ($this->autonet){
+        $smarty->assign("autonet", "true");
+      } else {
+        $smarty->assign("autonet", "");
+      }
       $display.= $smarty->fetch(get_template_path('network.tpl', TRUE));
       return($display);
     }else{
index a2188b5757c6ff483db73ff07e52c4a9801b5ff2..2cfaf0e8069a276d949ea1a22a628fc4f1332076 100644 (file)
@@ -9,10 +9,16 @@
                                        <td><LABEL      for="ipHostNumber">{t}IP-address{/t}{if $IPisMust}{$staticAddress}{/if}</LABEL></td>
                                        <td><input      id="ipHostNumber"       name="ipHostNumber"     size=25 maxlength=80    value="{$ipHostNumber}"></td>
                                </tr>
-                               <tr>
+                               <tr
                                        <td><LABEL      for="macAddress">{t}MAC-address{/t}</LABEL>{$staticAddress}</td>
                                        <td><input      name="macAddress"       id="macAddress" size=25 maxlength=80    value="{$macAddress}"></td>
                                </tr>
+        {if $autonet==true}
+                               <tr
+                                       <td>&nbsp;</td>
+                                       <td><input type="submit" name="autonet" value="{t}Autodetect{/t}"></td>
+                               </tr>
+        {/if}
       </table> 
     </td>
     {if $DNS_is_account==true}