diff --git a/plugins/admin/systems/class_servGeneric.inc b/plugins/admin/systems/class_servGeneric.inc
index a9e93f5a59c6686592181e893a259ba81deda838..b46e85b29ceb61d2f4b63dd497a77d7c9dbf97de 100644 (file)
var $fai_activated =FALSE;
var $view_logged = FALSE;
- function servgeneric ($config, $dn= NULL, $parent= NULL)
+ function servgeneric (&$config, $dn= NULL, $parent= NULL)
{
/* Check if FAI is activated */
- $tmp = search_config($config->data,"faiManagement","CLASS");
+ $tmp = $config->search("faiManagement", "CLASS",array('menu','tabs'));
+
if(!empty($tmp)){
$this->fai_activated = TRUE;
}
} else {
$this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
}
- $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
+ $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
$this->netConfigDNS->set_acl_category("server");
$this->netConfigDNS->set_acl_base($this->base);
if($this->is_account && !$this->view_logged){
$this->view_logged = TRUE;
- @log::log("view","server/".get_class($this),$this->dn);
+ new log("view","server/".get_class($this),$this->dn);
}
/* Do we represent a valid server? */
- if (!$this->is_account && $this->parent == NULL){
+ if (!$this->is_account && $this->parent === NULL){
$display= "<img alt=\"\" src=\"images/stop.png\" align=middle> <b>".
_("This 'dn' has no server features.")."</b>";
return($display);
/* Check for action */
if (isset($_POST['action']) && $this->acl_is_writeable("FAIstate")){
- $cmd= search_config($this->config->data['TABS'], "workgeneric", "ACTIONCMD");
+ $cmd = $this->config->search("workgeneric", "ACTIONCMD",array('tabs'));
if ($cmd == ""){
print_red(_("No ACTIONCMD definition found in your gosa.conf"));
} else {
/* Show main page */
$smarty->assign("fai_activated",$this->fai_activated);
- $smarty->assign("netconfig", $this->netConfigDNS->execute());
+
+ $str = $this->netConfigDNS->execute();
+ if(is_object($this->netConfigDNS->dialog)){
+ return($str);
+ }
+ $smarty->assign("netconfig", $str);
$smarty->assign("modes", $this->modes);
return($smarty->fetch (get_template_path('server.tpl', TRUE)));
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
- @log::log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ new log("remove","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
show_ldap_error($ldap->get_error(), sprintf(_("Removing of system server/generic with dn '%s' failed."),$this->dn));
$message[]= _("The required field 'Server name' is not set.");
}
+ /* Check if given name is a valid host/dns name */
+ if(!is_dns_name($this->cn)){
+ $message[] = _("Please specify a valid name for this object.");
+ }
+
if ($this->orig_dn != $this->dn){
$ldap= $this->config->get_ldap_link();
$ldap->cd ($this->base);
if ($ldap->count() != 0){
while ($attrs= $ldap->fetch()){
if ($attrs['dn'] != $this->orig_dn){
- if(!preg_match("/,ou=incoming,/",$attrs['dn'])){
+ if(!preg_match("/cn=dhcp,/",$attrs['dn']) && !preg_match("/,ou=incoming,/",$attrs['dn']) && preg_match("/,ou=servers,ou=systems,/",$attrs['dn'])){
$message[]= sprintf (_("There is already an entry '%s' in the base choosen by you"), $this->cn);
break;
}
$ldap->create_missing_trees(preg_replace('/^[^,]+,/', '', $this->dn));
$ldap->cd($this->dn);
$ldap->add($this->attrs);
- @log::log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ new log("create","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$mode= "add";
} else {
/* cn is not case sensitive for ldap, but for php it is!! */
if($this->config->current['DNMODE'] == "cn"){
if (strtolower($this->orig_dn) != (strtolower($this->dn))){
- $this->move($this->orig_dn, $this->dn);
+ $this->recursive_move($this->orig_dn, $this->dn);
plugin::save();
}
}else{
if ($this->orig_dn != $this->dn){
- $this->move($this->orig_dn, $this->dn);
+ $this->recursive_move($this->orig_dn, $this->dn);
plugin::save();
}
}
$ldap->cd($this->dn);
$this->cleanup();
$ldap->modify ($this->attrs);
- @log::log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
+ new log("modify","server/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$mode= "modify";
}
show_ldap_error($ldap->get_error(), sprintf(_("Saving of system server/generic with dn '%s' failed."),$this->dn));
$this->netConfigDNS->cn = $this->cn;
- $this->netConfigDNS->save($this->dn);
+ $this->netConfigDNS->save();
/* Optionally execute a command after we're done */
if(!$this->didAction){
}
+ /* Display generic part for server copy & paste */
+ function getCopyDialog()
+ {
+ $vars = array("cn");
+
+ $smarty = get_smarty();
+ $smarty->assign("cn" ,$this->cn);
+ $smarty->assign("object","server");
+ $str = $smarty->fetch(get_template_path("paste_generic.tpl",TRUE));
+ $ret = array();
+ $ret['string'] = $str;
+ $ret['status'] = "";
+ return($ret);
+ }
+
+
+ function saveCopyDialog()
+ {
+ if(isset($_POST['cn'])){
+ $this->cn = $_POST['cn'];
+ }
+ }
+
+
+ function PrepareForCopyPaste($source)
+ {
+ plugin::PrepareForCopyPaste($source);
+ if(isset($source['macAddress'][0])){
+ $this->netConfigDNS->macAddress = $source['macAddress'][0];
+ }
+ if(isset($source['ipHostNumber'][0])){
+ $this->netConfigDNS->ipHostNumber = $source['ipHostNumber'][0];
+ }
+
+ }
+
+
+
/* Return plugin informations for acl handling */
function plInfo()
{
"plPriority" => 1,
"plSection" => array("administration"),
"plCategory" => array("server" => array("description" => _("Server"),
- "objectClass" => "gotoWorkstation")),
+ "objectClass" => "goServer")),
"plProvidedAcls"=> array(
"cn" => _("Name"),
"description" => _("Description"),