From 858c148b2e1f1470f74638495b36ab32983ff5ba Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Tue, 10 Nov 2009 10:02:35 -0800 Subject: [PATCH 1/3] Users always get default profile field values from the profile field. Fixes bug #11215 --- docs/changelog/7.x.x.txt | 1 + docs/gotcha.txt | 25 +++++++++----- lib/WebGUI/Auth.pm | 2 +- lib/WebGUI/Operation/User.pm | 65 ++++++++++++++++++------------------ lib/WebGUI/ProfileField.pm | 31 +++++++++++------ 5 files changed, 71 insertions(+), 53 deletions(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 616eb1533..02227c078 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -7,6 +7,7 @@ - fixed #11186: Template Attachments i18n - fixed #11218: LDAPS does not create users automatically - fixed #11205: DataTable borked in IE + - fixed #11215: Los Angeles cannot be default timezone 7.8.4 - Fixed a compatibility problem between WRE and new Spectre code. diff --git a/docs/gotcha.txt b/docs/gotcha.txt index 250c6dcde..c294a19a0 100644 --- a/docs/gotcha.txt +++ b/docs/gotcha.txt @@ -7,27 +7,34 @@ upgrading from one version to the next, or even between multiple versions. Be sure to heed the warnings contained herein as they will save you many hours of grief. +7.8.5 +-------------------------------------------------------------------- + * Users, no matter if they are created via anonymous registration, + via the Admin Console Users screen, or via code, now always get + their default values from the Profile Fields instead of via + the Visitor account. Previously, based on how the user was created, + they would get default values from different places. + 7.8.4 -------------------------------------------------------------------- - * A bug introduced in 7.8.1 could cause the Shop sale notification - group to be reset to the group Everyone. The bug has been fixed, - and the group has been reset to Admins. If you were using a different - group, you will need to edit the Shop Settings and reselect the - proper group. + * A bug introduced in 7.8.1 could cause the Shop sale notification + group to be reset to the group Everyone. The bug has been fixed, + and the group has been reset to Admins. If you were using a different + group, you will need to edit the Shop Settings and reselect the + proper group. 7.8.3 -------------------------------------------------------------------- - * WebGUI now requires Locales::Country 0.05 or higher to use - the UPS shipping driver. + * WebGUI now requires Locales::Country 0.05 or higher to use + the UPS shipping driver. 7.8.2 -------------------------------------------------------------------- - * WebGUI now requires Business::PayPal::API 0.62 or higher. + * WebGUI now requires Business::PayPal::API 0.62 or higher. 7.8.1 -------------------------------------------------------------------- - * The EventManagementSystem schedule template was accidently given the same namespace as the main EMS template. This allowed the wrong template to be chosen for the main EMS template and the diff --git a/lib/WebGUI/Auth.pm b/lib/WebGUI/Auth.pm index 1355d24fb..363771176 100644 --- a/lib/WebGUI/Auth.pm +++ b/lib/WebGUI/Auth.pm @@ -242,7 +242,7 @@ sub createAccount { $formField = $field->formField($properties, undef, undef, undef, $defaultValue); } else { - $formField = $field->formField($properties); + $formField = $field->formField($properties, undef, undef, undef, undef, undef, 'useFormDefault'); } diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index a7c78e897..b4abf6721 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -626,27 +626,27 @@ sub www_editUser { my $i18n = WebGUI::International->new($session, "WebGUI"); my %tabs; tie %tabs, 'Tie::IxHash'; - %tabs = ( - "account"=> { label=>$i18n->get("account")}, - "profile"=> { label=>$i18n->get("profile")}, - "groups"=> { label=>$i18n->get('89')}, - ); + %tabs = ( + "account"=> { label=>$i18n->get("account")}, + "profile"=> { label=>$i18n->get("profile")}, + "groups"=> { label=>$i18n->get('89')}, + ); my $tabform = WebGUI::TabForm->new($session,\%tabs); $tabform->formHeader({extras=>'autocomplete="off"'}); my $u = WebGUI::User->new($session,($uid eq 'new') ? '' : $uid); #Setting uid to '' when uid is 'new' so visitor defaults prefill field for new user my $username = ($u->isVisitor && $uid ne "1") ? '' : $u->username; - $tabform->hidden({name=>"op",value=>"editUserSave"}); - $tabform->hidden({name=>"uid",value=>$uid}); - $tabform->getTab("account")->raw('  '); - $tabform->getTab("account")->readOnly(value=>$uid,label=>$i18n->get(378)); - $tabform->getTab("account")->readOnly(value=>$u->karma,label=>$i18n->get(537)) if ($session->setting->get("useKarma")); - $tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->dateCreated,"%z"),label=>$i18n->get(453)); - $tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->lastUpdated,"%z"),label=>$i18n->get(454)); - $tabform->getTab("account")->text( - -name=>"username", - -label=>$i18n->get(50), - -value=>$username - ); + $tabform->hidden({name=>"op",value=>"editUserSave"}); + $tabform->hidden({name=>"uid",value=>$uid}); + $tabform->getTab("account")->raw('  '); + $tabform->getTab("account")->readOnly(value=>$uid,label=>$i18n->get(378)); + $tabform->getTab("account")->readOnly(value=>$u->karma,label=>$i18n->get(537)) if ($session->setting->get("useKarma")); + $tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->dateCreated,"%z"),label=>$i18n->get(453)); + $tabform->getTab("account")->readOnly(value=>$session->datetime->epochToHuman($u->lastUpdated,"%z"),label=>$i18n->get(454)); + $tabform->getTab("account")->text( + -name=>"username", + -label=>$i18n->get(50), + -value=>$username + ); my %status; tie %status, 'Tie::IxHash'; %status = ( @@ -659,7 +659,8 @@ sub www_editUser { -name => "status", -value => $u->status ); - } else { + } + else { $tabform->getTab("account")->selectBox( -name => "status", -options => \%status, @@ -676,7 +677,7 @@ sub www_editUser { -options=>$options, -label=>$i18n->get(164), -value=>$u->authMethod, - ); + ); foreach (@{$session->config->get("authMethods")}) { my $authInstance = WebGUI::Operation::Auth::getInstance($session,$_,$u->userId); my $editUserForm = $authInstance->editUserForm; @@ -690,9 +691,10 @@ sub www_editUser { foreach my $field (@{$category->getFields}) { next if $field->getId =~ /contentPositions/; my $label = $field->getLabel . ($field->isRequired ? "*" : ''); - if ($field->getId eq "alias" && $u->isVisitor) { - $tabform->getTab("profile")->raw($field->formField({label=>$label},1,undef,1)); - } else { + if ($u->isVisitor) { + $tabform->getTab("profile")->raw($field->formField({label=>$label},1,undef,undef,undef,undef,'useFormDefault')); + } + else { $tabform->getTab("profile")->raw($field->formField({label=>$label},1,$u)); } } @@ -777,7 +779,7 @@ sub www_editUserSave { # # Also verify that the posted username is not blank (we need a username) # - + my $postedUsername = $session->form->process("username"); $postedUsername = WebGUI::HTML::filter($postedUsername, "all"); @@ -794,16 +796,15 @@ sub www_editUserSave { $u->authMethod($session->form->process("authMethod")); $u->status($session->form->process("status")); - # Loop through all of this users authentication methods - foreach (@{$session->config->get("authMethods")}) { - - # Instantiate each auth object and call it's save method. These methods are responsible for - # updating authentication information with values supplied by the www_editUser form. - my $authInstance = WebGUI::Operation::Auth::getInstance($session, $_, $actualUserId); - $authInstance->editUserFormSave(); - } + # Loop through all of this users authentication methods + foreach (@{$session->config->get("authMethods")}) { + # Instantiate each auth object and call it's save method. These methods are responsible for + # updating authentication information with values supplied by the www_editUser form. + my $authInstance = WebGUI::Operation::Auth::getInstance($session, $_, $actualUserId); + $authInstance->editUserFormSave(); + } - # Loop through all profile fields, and update them with new values. + # Loop through all profile fields, and update them with new values. foreach my $field (@{WebGUI::ProfileField->getFields($session)}) { next if $field->getId =~ /contentPositions/; $u->profileField($field->getId,$field->formProcess($u)); diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index 8d1397a0e..59dc0d36e 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -24,7 +24,6 @@ use WebGUI::User; use WebGUI::Utility; use WebGUI::Pluggable; - =head1 NAME Package WebGUI::ProfileField @@ -281,17 +280,23 @@ A WebGUI::User object reference to use instead of the currently logged in user. =head3 skipDefault -If true, this causes the default value set up for the form field to be ignored. +If true, this causes the default value set up for the form field to be ignored. In choosing default, +skipDefault has the highest priority. =head3 assignedValue If assignedValue is defined, it will be used to override the default value set up for the -form. +form. assignedValue has the next highest priority. =head3 returnObject If true, it returns a WebGUI::Form object, instead of returning HTML. +=head3 useFieldDefault + +If true, it uses the default setup for the ProfileField, instead of the user's default. useFieldDefault +has the lowest priority. + =cut # FIXME This would be better if it returned an OBJECT not the HTML @@ -299,14 +304,15 @@ If true, it returns a WebGUI::Form object, instead of returning HTML. # And refactor to not require all these arguments HERE but rather in the # constructor or something... sub formField { - my $self = shift; - my $session = $self->session; - my $properties = $self->formProperties(shift); - my $withWrapper = shift; - my $u = shift || $session->user; - my $skipDefault = shift; - my $assignedValue = shift; - my $returnObject = shift; + my $self = shift; + my $session = $self->session; + my $properties = $self->formProperties(shift); + my $withWrapper = shift; + my $u = shift || $session->user; + my $skipDefault = shift; + my $assignedValue = shift; + my $returnObject = shift; + my $useFieldDefault = shift; if ($skipDefault) { $properties->{value} = undef; @@ -314,6 +320,9 @@ sub formField { elsif (defined $assignedValue) { $properties->{value} = $assignedValue; } + elsif ($useFieldDefault) { + $properties->{value} = WebGUI::Operation::Shared::secureEval($session,$properties->{dataDefault}); + } else { # start with specified (or current) user's data. previous data needed by some form types as well (file). $properties->{value} = $u->profileField($self->getId); From a182524fe90182670f482e6fb6fe171aaa60e4ae Mon Sep 17 00:00:00 2001 From: Doug Bell Date: Tue, 10 Nov 2009 12:08:08 -0600 Subject: [PATCH 2/3] fixed #11220: Map asset badly broken --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Asset/Wobject/Map.pm | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 02227c078..f99568c1b 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -8,6 +8,7 @@ - fixed #11218: LDAPS does not create users automatically - fixed #11205: DataTable borked in IE - fixed #11215: Los Angeles cannot be default timezone + - fixed #11220: Map asset badly broken 7.8.4 - Fixed a compatibility problem between WRE and new Spectre code. diff --git a/lib/WebGUI/Asset/Wobject/Map.pm b/lib/WebGUI/Asset/Wobject/Map.pm index 6db5861f0..d92ac69e5 100644 --- a/lib/WebGUI/Asset/Wobject/Map.pm +++ b/lib/WebGUI/Asset/Wobject/Map.pm @@ -468,8 +468,12 @@ ENDHTML # Select box to choose a map point tie my %selectPointOptions, 'Tie::IxHash', ( "" => '-- ' . $i18n->get('select a point'), - map { $_->{assetId} => $_->{title} } sort { $a->{title} cmp $b->{title} } @{$var->{mapPoints}}, ); + if ( $var->{mapPoints} ) { + for my $point ( sort { $a->{title} cmp $b->{title} } @{$var->{mapPoints}} ) { + $selectPointOptions{ $point->{assetId} } = $point->{title}; + } + } $var->{ selectPoint } = WebGUI::Form::selectBox( $session, { extras => q{onchange="WebGUI.Map.focusOn(this.options[this.selectedIndex].value);"}, From 727348a1c970372ce7c5c1027987b79cf9b7995a Mon Sep 17 00:00:00 2001 From: Colin Kuskie Date: Wed, 11 Nov 2009 14:19:37 -0800 Subject: [PATCH 3/3] Fix module use issues. Fixes bug#11222 Remove bad use line from TaxDriver/EU.pm Add line for TT2 in testEnvironment.pl --- docs/changelog/7.x.x.txt | 1 + lib/WebGUI/Shop/TaxDriver/EU.pm | 1 - sbin/testEnvironment.pl | 1 + 3 files changed, 2 insertions(+), 1 deletion(-) diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index f99568c1b..879e9148a 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -9,6 +9,7 @@ - fixed #11205: DataTable borked in IE - fixed #11215: Los Angeles cannot be default timezone - fixed #11220: Map asset badly broken + - fixed #11222: testEnvironment.pl Missing Dependencies 7.8.4 - Fixed a compatibility problem between WRE and new Spectre code. diff --git a/lib/WebGUI/Shop/TaxDriver/EU.pm b/lib/WebGUI/Shop/TaxDriver/EU.pm index 1bdf2bbdb..e734cf1ba 100644 --- a/lib/WebGUI/Shop/TaxDriver/EU.pm +++ b/lib/WebGUI/Shop/TaxDriver/EU.pm @@ -16,7 +16,6 @@ package WebGUI::Shop::TaxDriver::EU; use strict; -use SOAP::Lite; use WebGUI::Content::Account; use WebGUI::TabForm; use WebGUI::Utility qw{ isIn }; diff --git a/sbin/testEnvironment.pl b/sbin/testEnvironment.pl index 32c7c7d68..9bb2e3fd8 100755 --- a/sbin/testEnvironment.pl +++ b/sbin/testEnvironment.pl @@ -95,6 +95,7 @@ checkModule("HTML::Highlight", 0.20 ); checkModule("HTML::TagFilter", 1.03 ); checkModule("HTML::Template", 2.9 ); checkModule("HTML::Template::Expr", 0.07, 2 ); +checkModule("Template::Toolkit", 2.20, 2 ); checkModule("XML::FeedPP", 0.40 ); checkModule("JSON", 2.12 ); checkModule("Config::JSON", "1.3.1" );