diff --git a/plugins/admin/systems/class_winGeneric.inc b/plugins/admin/systems/class_winGeneric.inc
index fd57c3a642616bee194f02ab3f865e87bf9280c5..ef279f3ab20351aa809392b7a04f8e4c51a9bdad 100644 (file)
"sambaNTPassword","sambaPwdLastSet","sambaAcctFlags");
var $objectclasses= array("posixAccount","person","organizationalPerson","inetOrgPerson","gosaAccount","shadowAccount","sambaSamAccount","top");
+ var $view_logged = FALSE;
- function wingeneric ($config, $dn= NULL, $parent= NULL)
+ function wingeneric (&$config, $dn= NULL, $parent= NULL)
{
plugin::plugin ($config, $dn, $parent);
- $this->netConfigDNS = new termDNS($this->config,$this->dn,$this->objectclasses);
+ $this->netConfigDNS = new termDNS($this->config,$this,$this->objectclasses);
/* Set base */
if ($this->dn == "new"){
$ui= get_userinfo();
$this->base= dn2base($ui->dn);
$this->cn= "";
} else {
- $this->base= preg_replace ("/^[^,]+,[^,]+,[^,]+,/", "", $this->dn);
+ $this->base= preg_replace ("/^[^,]+,".normalizePreg(get_winstations_ou())."/", "", $this->dn);
}
/* Save dn for later references */
$this->orig_dn= $this->dn;
+
+ $this->cn= preg_replace("/\\\$\$/","",$this->cn);
}
function execute()
{
- /* Call parent execute */
- plugin::execute();
+ /* Call parent execute */
+ plugin::execute();
+
+ if($this->is_account && !$this->view_logged){
+ $this->view_logged = TRUE;
+ new log("view","winworkstation/".get_class($this),$this->dn);
+ }
+
/* Do we represent a valid phone? */
- 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 network features.")."</b>";
return($display);
$smarty->assign("base_select", $this->base);
/* Show main page */
- $smarty->assign("netconfig", $this->netConfigDNS->execute());
+ $str = $this->netConfigDNS->execute();
+ if(is_object($this->netConfigDNS->dialog)){
+ return($str);
+ }
+ $smarty->assign("netconfig", $str);
return($smarty->fetch (get_template_path('wingeneric.tpl', TRUE)));
}
$this->netConfigDNS->remove_from_parent();
$ldap= $this->config->get_ldap_link();
$ldap->rmdir($this->dn);
+ new log("remove","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
show_ldap_error($ldap->get_error(), sprintf(_("Removing of system wingeneric/generic with dn '%s' failed."),$this->dn));
$this->handle_post_events("remove");
$ldap->search ("(cn=".$this->cn.")", array("cn"));
if ($ldap->count() != 0){
while ($attrs= $ldap->fetch()){
+ if(preg_match("/cn=dhcp,/",$attrs['dn'])){
+ continue;
+ }
if ($attrs['dn'] != $this->orig_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);
+ new log("create","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$this->handle_post_events("add");
} else {
if ($this->orig_dn != $this->dn){
$ldap->cd($this->dn);
$this->cleanup();
$ldap->modify ($this->attrs);
-
+ new log("modify","winworkstation/".get_class($this),$this->dn,array_keys($this->attrs),$ldap->get_error());
$this->handle_post_events("modify");
}
- # FIXME can't save mac address
- #$this->netConfigDNS->cn = $this->cn;
- #$this->netConfigDNS->save($this->dn);
+ $this->netConfigDNS->cn = preg_replace("/\\\$\$/","",$this->cn);
+ $this->netConfigDNS->save();
show_ldap_error($ldap->get_error(), sprintf(_("Saving of system wingeneric/generic with dn '%s' failed."),$this->dn));
/* Optionally execute a command after we're done */