From 1db46036e135f1d606e0fcc9e70ed5125f3dbdd1 Mon Sep 17 00:00:00 2001 From: cajus Date: Sun, 16 Oct 2005 13:51:19 +0000 Subject: [PATCH] Fixed printer removal git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1573 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_printGeneric.inc | 11 ++++-- .../admin/systems/class_systemManagement.inc | 2 +- .../systems/class_workstationGeneric.inc | 18 +++------ plugins/admin/systems/tabs_workstation.inc | 5 +-- plugins/admin/systems/workstation.tpl | 39 +++++-------------- 5 files changed, 25 insertions(+), 50 deletions(-) diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index dea5899fd..039be7bb6 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -64,7 +64,7 @@ class printgeneric extends plugin */ if((isset($this->attrs['objectClass']))&&(in_array("gotoWorkstation",$this->attrs['objectClass']))){ $this->is_terminal = "true"; - $this->dn = preg_replace("/ou=workstation/","ou=printer",$this->dn); + $this->dn = preg_replace("/ou=workstations,/","ou=printers,",$this->dn); $this->type = "station"; }elseif((isset($this->attrs['objectClass']))&&(in_array("gotoTerminal",$this->attrs['objectClass']))){ $this->type = "terminal"; @@ -352,6 +352,7 @@ class printgeneric extends plugin function remove_from_parent() { + $this->dn= preg_replace('/ou=workstations,/', 'ou=printers,', $this->dn); $ldap= $this->config->get_ldap_link(); $ldap->rmdir($this->dn); show_ldap_error($ldap->get_error()); @@ -417,16 +418,20 @@ class printgeneric extends plugin /* Save to LDAP */ function save() { + if (!$this->is_account){ + return; + } + $dn= $this->dn; plugin::save(); $ldap= $this->config->get_ldap_link(); if((in_array("gotoTerminal",$this->attrs['objectClass']))){ - $this->dn= preg_replace("/ou=terminal/","ou=printer",$this->dn); + $this->dn= preg_replace("/ou=terminals,/","ou=printers,",$this->dn); } if((in_array("gotoWorkstation",$this->attrs['objectClass']))){ - $this->dn= preg_replace("/ou=workstation/","ou=printer",$this->dn); + $this->dn= preg_replace("/ou=workstations,/","ou=printers,",$this->dn); } /* We are currently editing a Terminal, so we want to save a seperate printer which cn is the terminla cn diff --git a/plugins/admin/systems/class_systemManagement.inc b/plugins/admin/systems/class_systemManagement.inc index 17f2fbe01..e0480b3bb 100644 --- a/plugins/admin/systems/class_systemManagement.inc +++ b/plugins/admin/systems/class_systemManagement.inc @@ -206,7 +206,7 @@ class systems extends plugin $this->config->data['TABS']['WORKTABS'], $this->dn); $this->systab->set_acl ($this->acl); $this->systab->by_object['workgeneric']->cn= "wdefault"; - $this->systab->by_object['termservice']->cn= "default"; + $this->systab->by_object['workservice']->cn= "default"; break; case 'server': diff --git a/plugins/admin/systems/class_workstationGeneric.inc b/plugins/admin/systems/class_workstationGeneric.inc index 1b8775ece..062073468 100644 --- a/plugins/admin/systems/class_workstationGeneric.inc +++ b/plugins/admin/systems/class_workstationGeneric.inc @@ -9,8 +9,6 @@ class workgeneric extends plugin /* Generic terminal attributes */ var $gotoMode= "disabled"; - var $gotoTerminalPath= ""; - var $gotoSwapServer= ""; var $gotoSyslogServer= ""; var $gotoNtpServer= ""; var $gotoSndModule= ""; @@ -31,6 +29,7 @@ class workgeneric extends plugin /* Needed values and lists */ var $base= ""; var $cn= ""; + var $l= ""; var $orig_dn= ""; /* Plugin side filled */ @@ -38,11 +37,10 @@ class workgeneric extends plugin /* attribute list for save action */ var $ignore_account= TRUE; - var $attributes= array("gotoMode", "gotoTerminalPath", "macAddress", - "gotoSwapServer", "gotoSyslogServer", "gotoNtpServer", + var $attributes= array("gotoMode", "macAddress", "gotoSyslogServer", "gotoNtpServer", "gotoFloppyEnable", "gotoCdromEnable", "cn", "gotoSndModule", "ghCpuType", "ghMemSize", "ghUsbSupport", "ipHostNumber", - "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser"); + "ghGfxAdapter", "ghSoundAdapter", "gotoLastUser", "l"); var $objectclasses= array("top", "gotoWorkstation", "GOhard"); function workgeneric ($config, $dn= NULL) @@ -140,6 +138,7 @@ class workgeneric extends plugin /* Fill templating stuff */ $smarty= get_smarty(); $smarty->assign("cn", $this->cn); + $smarty->assign("l", $this->l); $smarty->assign("bases", $this->config->idepartments); $smarty->assign("staticAddress", ""); @@ -160,8 +159,7 @@ class workgeneric extends plugin $smarty->assign("ntpservers", $this->config->data['SERVERS']['NTP']); /* Variables */ - foreach(array("base", "gotoMode", "gotoTerminalPath", "gotoSwapServer", - "gotoSyslogServer", "gotoNtpServer") as $val){ + foreach(array("base", "gotoMode", "gotoSyslogServer", "gotoNtpServer") as $val){ $smarty->assign($val."_select", $this->$val); $smarty->assign($val."ACL", chkacl($this->acl, $val)); @@ -205,10 +203,6 @@ class workgeneric extends plugin if (isset($_POST['base']) && chkacl($this->acl, "create") == ""){ $this->base= $_POST['base']; } - - /* Save terminal path to parent since it is used by termstartup, too */ - $this->parent->by_object['termstartup']->gotoTerminalPath= - $this->gotoTerminalPath; } @@ -257,7 +251,7 @@ class workgeneric extends plugin plugin::save(); /* Strip out 'default' values */ - foreach (array("gotoTerminalPath", "gotoSwapServer", "gotoSyslogServer") as $val){ + foreach (array("gotoSyslogServer") as $val){ if ($this->attrs[$val] == "default"){ $this->attrs[$val]= array(); diff --git a/plugins/admin/systems/tabs_workstation.inc b/plugins/admin/systems/tabs_workstation.inc index 4f59e1d56..bb5b892a8 100644 --- a/plugins/admin/systems/tabs_workstation.inc +++ b/plugins/admin/systems/tabs_workstation.inc @@ -10,11 +10,8 @@ class worktabs extends tabs function save_object($save_current= FALSE) { +echo "Take care of the l attribute. It needs to be synced in case of workstations."; tabs::save_object($save_current); - - /* Update reference, transfer variables */ - $this->by_object['termstartup']->gotoTerminalPath= - $this->by_object['workgeneric']->gotoTerminalPath; } diff --git a/plugins/admin/systems/workstation.tpl b/plugins/admin/systems/workstation.tpl index 385a9e766..6ad9f4dff 100644 --- a/plugins/admin/systems/workstation.tpl +++ b/plugins/admin/systems/workstation.tpl @@ -14,6 +14,15 @@ {/if} + + + + + + + +   + {$must} @@ -40,35 +49,6 @@ - - - - - - - - - - - - - - - - -
{t}Root server{/t} - -
{t}Swap server{/t} - -
- - - - @@ -87,7 +67,6 @@
- -- 2.30.2