Code

Updated terminal copy & paste
authorhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 15 Jun 2007 07:24:51 +0000 (07:24 +0000)
committerhickert <hickert@594d385d-05f5-0310-b6e9-bd551577e9d8>
Fri, 15 Jun 2007 07:24:51 +0000 (07:24 +0000)
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6597 594d385d-05f5-0310-b6e9-bd551577e9d8

plugins/admin/systems/class_terminalGeneric.inc
plugins/admin/systems/class_terminalStartup.inc
plugins/admin/systems/class_workstationStartup.inc
plugins/admin/systems/paste_generic.tpl

index 36afa8cbe518efbade39b9db8ab9ace318cc9df9..4ddfcb20ac2a7eeeb8e233096b054b38effc8c23 100644 (file)
@@ -540,6 +540,60 @@ class termgeneric extends plugin
   }
 
 
+
+
+
+  /* Display generic part for server copy & paste */
+  function getCopyDialog()
+  {
+    $vars = array("cn");
+    $smarty = get_smarty();
+    $smarty->assign("cn" ,$this->cn);
+    $smarty->assign("object","terminal");
+    $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+    $ret = array();
+    $ret['string'] = $str;
+    $ret['status'] = "";
+    return($ret);
+  }
+
+
+  function saveCopyDialog()
+  {
+    if(isset($_POST['cn'])){
+      $this->cn = $_POST['cn'];
+    }
+  }
+
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+    if(isset($source['macAddress'][0])){
+      $this->netConfigDNS->macAddress = $source['macAddress'][0];
+    }
+    if(isset($source['ipHostNumber'][0])){
+      $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+    }
+
+    /* Create used ntp server array */
+    $this->gotoNtpServer= array();
+    if(isset($source['gotoNtpServer'])){
+      $this->inheritTimeServer = false;
+      unset($source['gotoNtpServer']['count']);
+      foreach($source['gotoNtpServer'] as $server){
+        $this->gotoNtpServer[$server] = $server;
+      }
+    }
+
+    /* Set inherit checkbox state */
+    if((in_array("default",$this->gotoNtpServer)) || (count($this->gotoNtpServer)==0)){
+      $this->inheritTimeServer = true;
+      $this->gotoNtpServer=array();
+    }
+  }
+
+
   /* Return plugin informations for acl handling */
   function plInfo()
   {
index fa71aba613575fb63f84d63df207ca38ca4da314..6f0421abe00993a3eaebefa7d71d64c350af3f26 100644 (file)
@@ -349,7 +349,7 @@ class termstartup extends plugin
         }
       }
     }
-
+    
     /* Add semi automatic values */
     // FIXME: LDAP Server may not be set here...
     $this->gotoKernelParameters= "root=/dev/nfs nfsroot=".
@@ -448,6 +448,19 @@ class termstartup extends plugin
     return($a_return);
   }
 
+
+  function PrepareForCopyPaste($source)
+  {
+    plugin::PrepareForCopyPaste($source);
+
+    $source_o = new termstartup ($this->config, $source['dn']);
+
+    foreach(array("gotoModules", "gotoKernelParameters","gotoShares","customParameters","bootmode","gotoTerminalPath","gotoShares","goLdapServerList","gotoBootKernel","gotoLdapServer","gotoBootKernels") as $attr){
+      $this->$attr = $source_o->$attr;
+    }
+  }
+
+
   /* Return plugin informations for acl handling */
   function plInfo()
   {
index a0f6199070612e57ac007ed79b109691cdaa5c94..567fd2f15551ed5b4aaec9467632c95a519c7332 100644 (file)
@@ -1163,35 +1163,14 @@ class workstartup extends plugin
   {
     plugin::PrepareForCopyPaste($source);    
 
-
-    /* Get arrays */
-    foreach (array("gotoModules", "gotoAutoFs", "gotoFilesystem","gotoKernelParameters") as $val){  
-      $this->$val = array();
-      if (isset($source["$val"]["count"])){
-        for ($i= 0; $i<$source["count"]; $i++){
-          if (isset($source["$val"][$i])){
-            array_push($this->$val, $source["$val"][$i]);
-          }
-        }
-      }
-      sort ($this->$val);
-      $this->$val= array_unique($this->$val);
-    }
-
-        /* Prepare Shares */
-    if((isset($source['gotoShare']))&&(is_array($source['gotoShare']))){
-      unset($source['gotoShare']['count']);
-      foreach($source['gotoShare'] as $share){
-        $tmp = $tmp2 = array();
-        $tmp = split("\|",$share);
-        $tmp2['server']      =$tmp[0];
-        $tmp2['name']        =$tmp[1];
-        $tmp2['mountPoint']  =$tmp[2];
-        $this->gotoShares[$tmp[1]."|".$tmp[0]]=$tmp2;
-      }
+    $source_o = new workstartup ($this->config, $source['dn']);
+    
+    foreach(array("gotoModules", "gotoAutoFs", "gotoFilesystem","gotoKernelParameters","gotoShares","customParameters") as $attr){
+      $this->$attr = $source_o->$attr;
     }
   }
 
+
   /* Return plugin informations for acl handling */ 
   function plInfo()
   {
index 0a6f06643f3262d53264bac9c1fa06fe7f7cb5bd..a15b0dddbaaaa6e95914d89cab9764970fd96626 100644 (file)
@@ -8,3 +8,13 @@
      </tr>
        </table>
 {/if}
+{if $object == "terminal"}
+    <table summary="">
+     <tr>
+      <td><LABEL for="cn">{t}Server name{/t}</LABEL>{$must}</td>
+      <td>
+       <input name="cn" id="cn" size=20 maxlength=60 value="{$cn}">
+      </td>
+     </tr>
+       </table>
+{/if}