From b376365a9376ea7025ec91485d07af62773fd110 Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 7 Dec 2007 14:32:11 +0000 Subject: [PATCH] Updated multi edit git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8062 594d385d-05f5-0310-b6e9-bd551577e9d8 --- include/class_multi_plug.inc | 4 +- plugins/personal/generic/class_user.inc | 106 +++++++++++++----------- plugins/personal/generic/generic.tpl | 2 +- 3 files changed, 62 insertions(+), 50 deletions(-) diff --git a/include/class_multi_plug.inc b/include/class_multi_plug.inc index 81e92ca7a..0012b2710 100644 --- a/include/class_multi_plug.inc +++ b/include/class_multi_plug.inc @@ -228,8 +228,8 @@ class multi_plug foreach($this->o_tab->by_object as $name => $obj){ $values = $this->o_tab->by_object[$name]->get_multi_edit_values(); - foreach($values as $a_name => $a_value){ - foreach($this->a_handles as $i_id => $o_handle){ + foreach($this->a_handles as $i_id => $o_handle){ + foreach($values as $a_name => $a_value){ $this->a_handles[$i_id]->by_object[$name]->$a_name = $a_value; } } diff --git a/plugins/personal/generic/class_user.inc b/plugins/personal/generic/class_user.inc index d25bf8101..6c1206736 100644 --- a/plugins/personal/generic/class_user.inc +++ b/plugins/personal/generic/class_user.inc @@ -1073,7 +1073,7 @@ class user extends plugin if(!empty($this->personalTitle)){ $pt = $this->personalTitle." "; } - } + } $this->cn= $pt.$this->givenName." ".$this->sn; /* Permissions for that base? */ @@ -1094,53 +1094,48 @@ class user extends plugin $this->set_acl_base($this->base); } - /* This checks will only be done, if we are not editing multiple objects - */ - if(!$this->multiple_support_active){ - - /* UID already used? */ - $ldap= $this->config->get_ldap_link(); - $ldap->cd($this->config->current['BASE']); - $ldap->search("(uid=$this->uid)", array("uid")); - $ldap->fetch(); - if ($ldap->count() != 0 && $this->dn == 'new'){ - $message[]= _("There's already a person with this 'Login' in the database."); - } - - /* In template mode, the uid and givenName are autogenerated... */ - if (!$this->is_template){ - if ($this->sn == ""){ - $message[]= _("The required field 'Name' is not set."); - } - if ($this->givenName == ""){ - $message[]= _("The required field 'Given name' is not set."); - } - if ($this->uid == ""){ - $message[]= _("The required field 'Login' is not set."); - } - if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){ - $ldap->cat($this->new_dn); - if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){ - $message[]= _("There's already a person with this 'Name'/'Given name' combination in the database."); - } - } - } + /* UID already used? */ + $ldap= $this->config->get_ldap_link(); + $ldap->cd($this->config->current['BASE']); + $ldap->search("(uid=$this->uid)", array("uid")); + $ldap->fetch(); + if ($ldap->count() != 0 && $this->dn == 'new'){ + $message[]= _("There's already a person with this 'Login' in the database."); + } - /* Check for valid input */ - if ($this->is_modified && !is_uid($this->uid)){ - $message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed."); + /* In template mode, the uid and givenName are autogenerated... */ + if (!$this->is_template){ + if ($this->sn == ""){ + $message[]= _("The required field 'Name' is not set."); } - if (!is_url($this->labeledURI)){ - $message[]= _("The field 'Homepage' contains an invalid URL definition."); + if ($this->givenName == ""){ + $message[]= _("The required field 'Given name' is not set."); } - if (preg_match ("/[\\\\]/", $this->sn)){ - $message[]= _("The field 'Name' contains invalid characters."); + if ($this->uid == ""){ + $message[]= _("The required field 'Login' is not set."); } - if (preg_match ("/[\\\\]/", $this->givenName)){ - $message[]= _("The field 'Given name' contains invalid characters."); + if (!(isset($this->config->current['DNMODE']) && $this->config->current['DNMODE'] == "uid")){ + $ldap->cat($this->new_dn); + if ($ldap->count() != 0 && $this->dn != $this->new_dn && $this->dn == 'new'){ + $message[]= _("There's already a person with this 'Name'/'Given name' combination in the database."); + } } } + /* Check for valid input */ + if ($this->is_modified && !is_uid($this->uid)){ + $message[]= _("The field 'Login' contains invalid characters. Lowercase, numbers and dashes are allowed."); + } + if (!is_url($this->labeledURI)){ + $message[]= _("The field 'Homepage' contains an invalid URL definition."); + } + if (preg_match ("/[\\\\]/", $this->sn)){ + $message[]= _("The field 'Name' contains invalid characters."); + } + if (preg_match ("/[\\\\]/", $this->givenName)){ + $message[]= _("The field 'Given name' contains invalid characters."); + } + /* Check phone numbers */ if (!is_phone_nr($this->telephoneNumber)){ $message[]= _("The field 'Phone' contains an invalid phone number."); @@ -1158,10 +1153,10 @@ class user extends plugin /* Check for reserved characers */ if (preg_match ('/[,+"?\'()=<>;]/', $this->givenName)){ $message[]= _("The field 'Given name' contains invalid characters."); - } - if (preg_match ('/[,+"?\'()=<>;]/', $this->sn)){ - $message[]= _("The field 'Name' contains invalid characters."); - } + } + if (preg_match ('/[,+"?\'()=<>;]/', $this->sn)){ + $message[]= _("The field 'Name' contains invalid characters."); + } return $message; } @@ -1180,7 +1175,7 @@ class user extends plugin $ldap = $this->config->get_ldap_link(); $ldap->cd ($this->dn); $data = $ldap->get_attribute($this->dn,"jpegPhoto"); - + if((!$data) || ($data == "*removed*")){ /* In case we don't get an entry, load a default picture */ @@ -1478,7 +1473,11 @@ class user extends plugin $ret['old_jpegPhoto'] = $this->old_jpegPhoto; $ret['old_photoData'] = $this->old_photoData; } + if(isset($ret['dateOfBirth'])){ + unset($ret['dateOfBirth']); + } $ret['is_modified'] = $this->is_modified; + $ret['base']=$this->base; return($ret); } @@ -1491,7 +1490,7 @@ class user extends plugin if (isset($_POST['pw_storage'])){ foreach(array("pw_storage") as $val){ if(isset($_POST[$val])){ - $data= validate($_POST[$val]); + $data= validate(get_post($val)); if ($data != $this->$val){ $this->is_modified= TRUE; } @@ -1499,8 +1498,21 @@ class user extends plugin } } } + if(isset($_POST['base'])){ + $this->base = get_post('base'); + } + } + + function multiple_check() + { + /* Call check() to set new_dn correctly ... */ + $message = plugin::multiple_check(); + + echo "Checks missing"; + return($message); } + function multiple_execute() diff --git a/plugins/personal/generic/generic.tpl b/plugins/personal/generic/generic.tpl index be60d8921..cc13dcbd4 100644 --- a/plugins/personal/generic/generic.tpl +++ b/plugins/personal/generic/generic.tpl @@ -227,7 +227,7 @@ - {if $is_template ne "true"} + {if $is_template ne "true" && !$multiple_support} -- 2.30.2