From 03a753007fabe0e077fe6340191f2ed7437eef8f Mon Sep 17 00:00:00 2001 From: hickert Date: Tue, 27 Jul 2010 09:17:27 +0000 Subject: [PATCH] Updated several service dialogs, fixed typos, string, html, post handling and more. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@19149 594d385d-05f5-0310-b6e9-bd551577e9d8 --- .../services/dhcp/class_dhcpPlugin.inc | 282 +++++++++--------- 1 file changed, 141 insertions(+), 141 deletions(-) diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc index dd76799a0..8697308f6 100644 --- a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc +++ b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpPlugin.inc @@ -1,167 +1,167 @@ parent = $parent; - - $this->options = new dhcpOption(); - $this->statements = new dhcpOption(); - - /* Load statements / options */ - if (is_array($attrs)){ - $this->dn= $attrs['dn']; - $this->cn= $attrs['cn'][0]; - $this->new= FALSE; - - /* Load options */ - if (isset($attrs['dhcpOption'])){ - foreach($attrs['dhcpOption'] as $opt){ - $this->options->add(trim($opt)); + /* Used attributes */ + var $cn= ""; + var $orig_cn= ""; + var $options= null; + var $statements= array(); + + /* Subobjects */ + var $network; + var $advanced; + + /* attribute list for save action */ + var $attributes= array(); + var $objectclasses= array(); + + function dhcpPlugin(&$parent,$attrs) + { + $this->parent = $parent; + + $this->options = new dhcpOption(); + $this->statements = new dhcpOption(); + + /* Load statements / options */ + if (is_array($attrs)){ + $this->dn= $attrs['dn']; + $this->cn= $attrs['cn'][0]; + $this->new= FALSE; + + /* Load options */ + if (isset($attrs['dhcpOption'])){ + foreach($attrs['dhcpOption'] as $opt){ + $this->options->add(trim($opt)); + } + } + + /* Load statements */ + if (isset($attrs['dhcpStatements'])){ + foreach($attrs['dhcpStatements'] as $opt){ + $this->statements->add(trim($opt)); + } + } + } else { + /* We keep the parent dn here if it's new */ + $this->dn= $attrs; + $this->new= TRUE; } - } - /* Load statements */ - if (isset($attrs['dhcpStatements'])){ - foreach($attrs['dhcpStatements'] as $opt){ - $this->statements->add(trim($opt)); - } - } - } else { - /* We keep the parent dn here if it's new */ - $this->dn= $attrs; - $this->new= TRUE; + /* Load network module */ + $this->network= new dhcpNetwork(); + $this->network->options= &$this->options; + $this->network->statements= &$this->statements; + $this->advanced= new dhcpAdvanced(); + $this->advanced->options= &$this->options; + $this->advanced->statements= &$this->statements; + + $this->network->parent = $parent; + $this->advanced->parent = $parent; + + /* Save CN for later reference */ + $this->orig_cn= $this->cn; + } + + function execute() + { + plugin::execute(); + return (""); + } + + + function remove_from_parent() + { + } + + + /* Save data to object */ + function save_object() + { +# // CHECK +# foreach (array("filename", "next-server","get-lease-hostnames","use-host-decl-names") as $toberemoved){ +# unset($this->statements[$toberemoved]); +# } + + /* Save sub-objects */ + $this->network->save_object(); + $this->advanced->save_object(); } - /* Load network module */ - $this->network= new dhcpNetwork(); - $this->network->options= &$this->options; - $this->network->statements= &$this->statements; - $this->advanced= new dhcpAdvanced(); - $this->advanced->options= &$this->options; - $this->advanced->statements= &$this->statements; - - $this->network->parent = $parent; - $this->advanced->parent = $parent; - - /* Save CN for later reference */ - $this->orig_cn= $this->cn; - } - - function execute() - { - plugin::execute(); - return (""); - } - - - function remove_from_parent() - { - } - - - /* Save data to object */ - function save_object() - { - # // CHECK - # foreach (array("filename", "next-server","get-lease-hostnames","use-host-decl-names") as $toberemoved){ - # unset($this->statements[$toberemoved]); - # } - - /* Save sub-objects */ - $this->network->save_object(); - $this->advanced->save_object(); - } - - - /* Check values */ - function check() - { - $message= array(); - return $message; - } - - - /* Save to LDAP */ - function save() - { - /* Add cn if we're new */ - if ($this->new){ - $this->dn= "cn=".$this->cn.",".$this->dn; - } else { - $this->dn= "cn=".$this->cn.preg_replace('/^cn=[^,]+/', '', $this->dn); + + /* Check values */ + function check() + { + $message= array(); + return $message; } - /* Assemble new entry - options */ - $this->attrs['dhcpOption']= $this->options->save(); - /* Assemble new entry - statements */ - $this->attrs['dhcpStatements']= $this->statements->save(); + /* Save to LDAP */ + function save() + { + /* Add cn if we're new */ + if ($this->new){ + $this->dn= "cn=".$this->cn.",".$this->dn; + } else { + $this->dn= "cn=".$this->cn.preg_replace('/^cn=[^,]+/', '', $this->dn); + } + + /* Assemble new entry - options */ + $this->attrs['dhcpOption']= $this->options->save(); + + /* Assemble new entry - statements */ + $this->attrs['dhcpStatements']= $this->statements->save(); - /* Move dn to the result */ - $this->attrs['dn']= $this->dn; - $this->attrs['cn']= array($this->cn); - $this->attrs['objectClass']= $this->objectclasses; - $this->attrs['MODIFIED']= TRUE; - return ($this->attrs); - } + /* Move dn to the result */ + $this->attrs['dn']= $this->dn; + $this->attrs['cn']= array($this->cn); + $this->attrs['objectClass']= $this->objectclasses; + $this->attrs['MODIFIED']= TRUE; + return ($this->attrs); + } - function removeAttrs($name, $type) - { - $new= array(); - foreach ($this->attrs[$type] as $value){ - if (!preg_match("/^$name /", $value)){ - $new[]= $value; - } + function removeAttrs($name, $type) + { + $new= array(); + foreach ($this->attrs[$type] as $value){ + if (!preg_match("/^$name /", $value)){ + $new[]= $value; + } + } + $this->attrs[$type]= $new; } - $this->attrs[$type]= $new; - } - function removeOption($name) - { - $this->removeAttrs($name, 'dhcpOption'); - } + function removeOption($name) + { + $this->removeAttrs($name, 'dhcpOption'); + } - function removeStatement($name) - { - $this->removeAttrs($name, 'dhcpStatement'); - } + function removeStatement($name) + { + $this->removeAttrs($name, 'dhcpStatement'); + } } -- 2.30.2