- Fixed a problem where profile data would be mixed between the current user

and the user your viewing the profile of.
This commit is contained in:
JT Smith 2005-12-16 17:33:48 +00:00
parent 6944fe3316
commit a16b470dd4
5 changed files with 13 additions and 11 deletions

View file

@ -1,7 +1,7 @@
6.8.3 6.8.3
- fixed a problem with enabling Avatars in the Collaboration System. - fixed a problem with enabling Avatars in the Collaboration System.
- fixed a problem with op=editUser where it would use profile field - Fixed a problem where profile data would be mixed between the current user
values of the current user. and the user your viewing the profile of.
- fix [ 1381551 ] epochToHuman for foreign languages - fix [ 1381551 ] epochToHuman for foreign languages
- fix [ 1381305 ] SQLReports report nothing!!! - fix [ 1381305 ] SQLReports report nothing!!!
- fix [ 1381873 ] Matrix missing toolbar - fix [ 1381873 ] Matrix missing toolbar

View file

@ -653,7 +653,7 @@ A string in the format of YYYY-MM-DD or YYYY-MM-DD HH:MM:SS.
sub setToEpoch { sub setToEpoch {
my $set = shift; my $set = shift;
return undef unless defined $set; return undef unless $set;
my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %H:%M:%S' ); my $parser = DateTime::Format::Strptime->new( pattern => '%Y-%m-%d %H:%M:%S' );
my $dt = $parser->parse_datetime($set); my $dt = $parser->parse_datetime($set);
unless ($dt) { unless ($dt) {
@ -662,8 +662,6 @@ sub setToEpoch {
} }
# in epochToSet we apply the user's time zone, so now we have to remove it. # in epochToSet we apply the user's time zone, so now we have to remove it.
$dt->set_time_zone($session{user}{timeZone}|| "America/Chicago"); # assign the user's timezone $dt->set_time_zone($session{user}{timeZone}|| "America/Chicago"); # assign the user's timezone
# my $u = WebGUI::User->new(1);
# $dt->set_time_zone($u->profileField("timeZone")); # convert to the visitor's or default time zone
return $dt->epoch; return $dt->epoch;
} }

View file

@ -164,7 +164,7 @@ sub www_viewProfile {
next if ($field->get("fieldName") eq "email" && !$u->profileField("publicEmail")); next if ($field->get("fieldName") eq "email" && !$u->profileField("publicEmail"));
push(@array, { push(@array, {
'profile.label' => $field->getLabel, 'profile.label' => $field->getLabel,
'profile.value' => $field->formField({dataDefault => $u->profileField($field->getId)},2) 'profile.value' => $field->formField(undef,2,$u)
}); });
} }
} }

View file

@ -279,9 +279,7 @@ sub www_editUser {
foreach my $field (@{$category->getFields}) { foreach my $field (@{$category->getFields}) {
next if $field->getId =~ /contentPositions/; next if $field->getId =~ /contentPositions/;
my $label = $field->getLabel . ($field->isRequired ? "*" : ''); my $label = $field->getLabel . ($field->isRequired ? "*" : '');
# hack to get op=editUser to display the correct stuff. $tabform->getTab("profile")->raw($field->formField({label=>$label},1,$u));
$session{form}{$field->getId} = $u->profileField($field->getId);
$tabform->getTab("profile")->raw($field->formField({label=>$label},1));
} }
} }
my @groupsToAdd = WebGUI::FormProcessor::group("groupsToAdd"); my @groupsToAdd = WebGUI::FormProcessor::group("groupsToAdd");

View file

@ -106,7 +106,7 @@ sub delete {
#------------------------------------------------------------------- #-------------------------------------------------------------------
=head2 formField ( [ formProperties, withWrapper] ) =head2 formField ( [ formProperties, withWrapper, userObject ] )
Returns an HTMLified form field element. Returns an HTMLified form field element.
@ -118,6 +118,10 @@ Optionally pass in a list of properties to override the default properties of an
An integer indicating whether to return just the field's form input, or the field with a table label wrapper (1), or just the field value (2). An integer indicating whether to return just the field's form input, or the field with a table label wrapper (1), or just the field value (2).
=head3 userObject
A WebGUI::User object reference to use instead of the currently logged in user.
=cut =cut
sub formField { sub formField {
@ -137,7 +141,9 @@ sub formField {
my $default; my $default;
if ($session{form}{$properties->{name}}) { if ($session{form}{$properties->{name}}) {
$default = $session{form}{$properties->{name}}; $default = $session{form}{$properties->{name}};
} elsif ($session{user}{$properties->{name}}) { } elsif (defined $u && $u->profileField($properties->{name})) {
$default = $u->profileField($properties->{name});
} elsif (!defined $u && $session{user}{$properties->{name}}) {
$default = $session{user}{$properties->{name}}; $default = $session{user}{$properties->{name}};
} else { } else {
$default = WebGUI::Operation::Shared::secureEval($properties->{dataDefault}); $default = WebGUI::Operation::Shared::secureEval($properties->{dataDefault});