From 38faac5f97bc71af0a6cffbcca5138f09226470c Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 30 Aug 2005 11:52:08 +0000 Subject: [PATCH] Added printer tab to workstations git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@1263 594d385d-05f5-0310-b6e9-bd551577e9d8 --- plugins/admin/systems/class_printGeneric.inc | 35 ++++++++++++++++---- plugins/admin/systems/tabs_workstation.inc | 4 +++ 2 files changed, 33 insertions(+), 6 deletions(-) diff --git a/plugins/admin/systems/class_printGeneric.inc b/plugins/admin/systems/class_printGeneric.inc index ed2263c21..3394cc566 100644 --- a/plugins/admin/systems/class_printGeneric.inc +++ b/plugins/admin/systems/class_printGeneric.inc @@ -54,7 +54,23 @@ class printgeneric extends plugin } - if(in_array("gotoTerminal",$this->attrs['objectClass'])){ + if((in_array("gotoWorkstation",$this->attrs['objectClass']))){ + $this->is_terminal = "true"; + $this->dn = preg_replace("/ou=workstation/","ou=printer",$this->dn); + + // Reload plugin with new dn... (ou=printers instead of ou=terminals) + plugin::plugin ($this->config, $this->dn); + $ldap->cat($this->dn); + if(count($ldap->fetch())>0){ + $this->orig_dn= $this->dn; + $this->is_account=true; + $this->initially_was_account = true; + }else{ + $this->orig_dn = "new"; + $this->is_account=false; + $this->initially_was_account = false; + } + }elseif((in_array("gotoTerminal",$this->attrs['objectClass']))){ $this->is_terminal = "true"; $this->dn = preg_replace("/ou=terminal/","ou=printer",$this->dn); @@ -106,6 +122,7 @@ class printgeneric extends plugin function execute() { + print_a($this); $smarty= get_smarty(); $display=""; /* Template management. @@ -317,17 +334,23 @@ class printgeneric extends plugin /* Save to LDAP */ function save() { + $dn= $this->dn; plugin::save(); - + + if((in_array("gotoTerminal",$this->attrs['objectClass']))){ + $this->dn= preg_replace("/ou=terminal/","ou=printer",$this->dn); + } + + if((in_array("gotoWorkstation",$this->attrs['objectClass']))){ + $this->dn= preg_replace("/ou=workstation/","ou=printer",$this->dn); + } + $ldap= $this->config->get_ldap_link(); - + /* We are currently editing a Terminal, so we want to save a seperate printer which cn is the terminla cn */ if($this->is_terminal){ - /* Save in ou=printers instead of ou=terminals */ - $this->dn = preg_replace("/ou=terminal/","ou=printer",$this->dn); - /* reduce objectClasses to minimun */ $this->attrs['objectClass']= $this->objectclasses; diff --git a/plugins/admin/systems/tabs_workstation.inc b/plugins/admin/systems/tabs_workstation.inc index 13df2dc0f..4f59e1d56 100644 --- a/plugins/admin/systems/tabs_workstation.inc +++ b/plugins/admin/systems/tabs_workstation.inc @@ -31,6 +31,10 @@ class worktabs extends tabs } tabs::save(TRUE); + if(($this->by_object['printgeneric']->is_account==false)&&($this->by_object['printgeneric']->initially_was_account==true)){ + $this->by_object['printgeneric']->remove_from_parent(); + } + } } -- 2.30.2