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(); /* Merge arrays for advanced view */ $this->fix_options(); foreach (array("options", "statements") as $type){ $this->advanced->$type= $this->$type + $this->network->$type; } $display.= $this->advanced->execute(); /* Merge back for removals */ foreach (array("options", "statements") as $type){ $this->$type= $this->advanced->$type; $this->network->$type= $this->advanced->$type; } /* Add footer */ $display.= "
"; if(preg_match("/w/",$this->parent->getacl(""))){ $display.= " "; } $display.= ""; $display.= "
"; return ($display); } function remove_from_parent() { } /* Save data to object */ function save_object() { /* Save cn */ if (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); } } ?>