From 6ae7a3503964fb97587cf21b9c1b4276b9db23fc Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 15 Jun 2007 07:24:51 +0000 Subject: [PATCH] Updated terminal copy & paste git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@6597 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../admin/systems/class_terminalGeneric.inc | 54 +++++++++++++++++++ .../admin/systems/class_terminalStartup.inc | 15 +++++- .../systems/class_workstationStartup.inc | 31 ++--------- plugins/admin/systems/paste_generic.tpl | 10 ++++ 4 files changed, 83 insertions(+), 27 deletions(-) diff --git a/plugins/admin/systems/class_terminalGeneric.inc b/plugins/admin/systems/class_terminalGeneric.inc index 36afa8cbe..4ddfcb20a 100644 --- a/plugins/admin/systems/class_terminalGeneric.inc +++ b/plugins/admin/systems/class_terminalGeneric.inc @@ -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() { diff --git a/plugins/admin/systems/class_terminalStartup.inc b/plugins/admin/systems/class_terminalStartup.inc index fa71aba61..6f0421abe 100644 --- a/plugins/admin/systems/class_terminalStartup.inc +++ b/plugins/admin/systems/class_terminalStartup.inc @@ -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() { diff --git a/plugins/admin/systems/class_workstationStartup.inc b/plugins/admin/systems/class_workstationStartup.inc index a0f619907..567fd2f15 100644 --- a/plugins/admin/systems/class_workstationStartup.inc +++ b/plugins/admin/systems/class_workstationStartup.inc @@ -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() { diff --git a/plugins/admin/systems/paste_generic.tpl b/plugins/admin/systems/paste_generic.tpl index 0a6f06643..a15b0dddb 100644 --- a/plugins/admin/systems/paste_generic.tpl +++ b/plugins/admin/systems/paste_generic.tpl @@ -8,3 +8,13 @@ {/if} +{if $object == "terminal"} + + + + + +
{$must} + +
+{/if} -- 2.30.2