summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 17842f9)
raw | patch | inline | side by side (parent: 17842f9)
author | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Dec 2009 13:29:14 +0000 (13:29 +0000) | ||
committer | cajus <cajus@594d385d-05f5-0310-b6e9-bd551577e9d8> | |
Mon, 7 Dec 2009 13:29:14 +0000 (13:29 +0000) |
git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@14875 594d385d-05f5-0310-b6e9-bd551577e9d8
diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpClass.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpClass.inc
--- /dev/null
@@ -0,0 +1,120 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2003 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+class dhcpClass extends dhcpPlugin
+{
+ /* attribute list for save action */
+ var $objectclasses= array('top', 'dhcpClass', 'dhcpOptions');
+
+ function dhcpClass($parent,&$attrs)
+ {
+ /* Load statements / options */
+ dhcpPlugin::dhcpPlugin($parent,$attrs);
+ }
+
+ function execute()
+ {
+ $smarty= get_smarty();
+ $smarty->assign("cn", $this->cn);
+
+ /* Assign ACLs */
+ $smarty->assign("acl",$this->parent->getacl(""));
+
+ /* Show main page */
+ $display= $smarty->fetch (get_template_path('dhcp_group.tpl', TRUE,
+ dirname(__FILE__))).$this->network->execute();
+ $display.= $this->advanced->execute();
+
+ /* Add footer */
+ $display.= "<div style='width:100%;text-align:right;margin-top:5px;'>";
+ if(preg_match("/w/",$this->parent->getacl(""))){
+ $display.= "<input type=submit name='save_dhcp' value='".msgPool::saveButton()."'> ";
+ }
+ $display.= "<input type=submit name='cancel_dhcp' value='".msgPool::cancelButton()."'>";
+ $display.= "</div>";
+
+ return ($display);
+ }
+
+
+ function remove_from_parent()
+ {
+ }
+
+
+ /* Save data to object */
+ function save_object()
+ {
+ /* Save cn */
+ if (preg_match("/w/",$this->parent->getacl("")) && isset($_POST['cn'])){
+ $this->cn= validate(get_post('cn'));
+ }
+
+ /* Handle global saving */
+ dhcpPlugin::save_object();
+ }
+
+
+ /* Check values */
+ function check()
+ {
+ $message= array();
+
+ $cache = $this->parent->dhcpObjectCache;
+
+ /* All required fields are set? */
+ if ($this->cn == ""){
+ $message[]= msgPool::required(_("Name"));
+ }
+ if (!preg_match('/^[a-z0-9_-]*$/i', $this->cn)){
+ $message[]= msgPool::invalid(_("Name"),$this->cn,"/[a-z0-9_-]/i");
+ }
+
+ /* cn already used? */
+ if ($this->orig_cn != $this->cn || $this->new){
+
+ foreach($cache as $dn => $dummy){
+ if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
+ $message[]= msgPool::duplicated(_("Name"));
+ break;
+ }
+ }
+ }
+
+ /* Check external plugins */
+ $net= $this->network->check();
+ $adv= $this->advanced->check();
+ $message= array_merge($message, $net, $adv);
+
+ return $message;
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ dhcpPlugin::save();
+ return ($this->attrs);
+ }
+
+
+}
+
+?>
diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpNewSectionDialog.inc
index 893761340eac43b4255408304b4c547739fd34e5..9204e2aa0ff0b1f5fde9afe467ae2f3cda7c182c 100644 (file)
/* Mapping array */
var $types= array();
var $classtype= "";
- var $sectionMap= array( "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
- #"dhcpClass" => array("dhcpSubClass"),
+ var $sectionMap= array( "dhcpService" => array("dhcpSharedNetwork", "dhcpSubnet", "dhcpGroup", "dhcpHost", "dhcpClass"),
+ "dhcpClass" => array("dhcpSubClass"),
"dhcpSubClass" => array(),
"dhcpHost" => array(),
"dhcpGroup" => array("dhcpHost"),
"dhcpPool" => array(),
- "dhcpSubnet" => array("dhcpPool", "dhcpGroup", "dhcpHost" /*, "dhcpClass"*/),
+ "dhcpSubnet" => array("dhcpPool", "dhcpGroup", "dhcpHost", "dhcpClass"),
"dhcpSharedNetwork" => array("dhcpSubnet", "dhcpPool"));
function dhcpNewSectionDialog($type)
{
$this->types= array( "dhcpService" => _("Global options"),
- /*"dhcpClass" => _("Class"),*/
+ "dhcpClass" => _("Class"),
"dhcpSubClass" => _("Subclass"),
"dhcpHost" => _("Host"),
"dhcpGroup" => _("Group"),
diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubClass.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_dhcpSubClass.inc
--- /dev/null
@@ -0,0 +1,120 @@
+<?php
+/*
+ This code is part of GOsa (https://gosa.gonicus.de)
+ Copyright (C) 2003 Cajus Pollmeier
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program; if not, write to the Free Software
+ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+*/
+
+class dhcpSubClass extends dhcpPlugin
+{
+ /* attribute list for save action */
+ var $objectclasses= array('top', 'dhcpSubClass', 'dhcpOptions');
+
+ function dhcpSubClass($parent,&$attrs)
+ {
+ /* Load statements / options */
+ dhcpPlugin::dhcpPlugin($parent,$attrs);
+ }
+
+ function execute()
+ {
+ $smarty= get_smarty();
+ $smarty->assign("cn", $this->cn);
+
+ /* Assign ACLs */
+ $smarty->assign("acl",$this->parent->getacl(""));
+
+ /* Show main page */
+ $display= $smarty->fetch (get_template_path('dhcp_group.tpl', TRUE,
+ dirname(__FILE__))).$this->network->execute();
+ $display.= $this->advanced->execute();
+
+ /* Add footer */
+ $display.= "<div style='width:100%;text-align:right;margin-top:5px;'>";
+ if(preg_match("/w/",$this->parent->getacl(""))){
+ $display.= "<input type=submit name='save_dhcp' value='".msgPool::saveButton()."'> ";
+ }
+ $display.= "<input type=submit name='cancel_dhcp' value='".msgPool::cancelButton()."'>";
+ $display.= "</div>";
+
+ return ($display);
+ }
+
+
+ function remove_from_parent()
+ {
+ }
+
+
+ /* Save data to object */
+ function save_object()
+ {
+ /* Save cn */
+ if (preg_match("/w/",$this->parent->getacl("")) && isset($_POST['cn'])){
+ $this->cn= validate(get_post('cn'));
+ }
+
+ /* Handle global saving */
+ dhcpPlugin::save_object();
+ }
+
+
+ /* Check values */
+ function check()
+ {
+ $message= array();
+
+ $cache = $this->parent->dhcpObjectCache;
+
+ /* All required fields are set? */
+ if ($this->cn == ""){
+ $message[]= msgPool::required(_("Name"));
+ }
+ if (!preg_match('/^[a-z0-9_-]*$/i', $this->cn)){
+ $message[]= msgPool::invalid(_("Name"),$this->cn,"/[a-z0-9_-]/i");
+ }
+
+ /* cn already used? */
+ if ($this->orig_cn != $this->cn || $this->new){
+
+ foreach($cache as $dn => $dummy){
+ if (preg_match("/^cn=".$this->cn.",/", $dn) && count($dummy)){
+ $message[]= msgPool::duplicated(_("Name"));
+ break;
+ }
+ }
+ }
+
+ /* Check external plugins */
+ $net= $this->network->check();
+ $adv= $this->advanced->check();
+ $message= array_merge($message, $net, $adv);
+
+ return $message;
+ }
+
+
+ /* Save to LDAP */
+ function save()
+ {
+ dhcpPlugin::save();
+ return ($this->attrs);
+ }
+
+
+}
+
+?>
diff --git a/gosa-plugins/dhcp/admin/systems/services/dhcp/class_servDHCP.inc b/gosa-plugins/dhcp/admin/systems/services/dhcp/class_servDHCP.inc
index 8fd87ac96202ba5c924168b36cfc9aeda1310741..891141bf54bc4c502974ec4643640afad4217843 100644 (file)
$DhcpList->AddEntry(array(
array("string" => $values),
array("string" => $dhcpObject->statements->get('fixed-address')),
- array("string" => preg_replace('/^[^ ]+ /', '', $dhcpObject->dhcpHWAddress)),
+ array("string" => preg_replace('/^[^ ]+ /', '', isset($dhcpObject->dhcpHWAddress)?$dhcpObject->dhcpHWAddress:"")),
array("string" => str_replace("%s",$id,$editImg), "attach" => "style='text-align:right;'")
));
}
continue;
}
- /* Opdate dhcp option 'server-name' to actual server name */
+ /* Update dhcp option 'server-name' to actual server name */
if($this->dn != $this->orig_dn){
$fixed = FALSE;
foreach(array("dhcpHost","dhcpSubnet","dhcpGroup","dhcpSharedNetwork") as $object){