more profile updates

This commit is contained in:
JT Smith 2005-12-07 16:23:47 +00:00
parent 4c2ea84993
commit 39eb753e7e
3 changed files with 44 additions and 3 deletions

View file

@ -25,6 +25,10 @@
- fix [ 1373493 ] Upgrade script fails because parameters are not quoted
- Upgrade now uses --results-file parameter on mysqldump because some
operating system don't handle UTF-8 characters through their pipes.
- Added backend API for user profile schema to eliminate inconsistencies
and to allow the dashboard to use user profile fields as preferences rather
than having a seperate asset type for it. This mechanism is more efficient,
and thusly increases the performance of the dashboard.
6.8.0
- Switched Date::Manip to DateTime for better performance and more

View file

@ -24,11 +24,22 @@ start(); # this line required
upgradeRichEditor();
fixCSFaqTemplateAnchors();
updateProfileSystem();
convertDashboardPrefs();
finish(); # this line required
#-------------------------------------------------
sub updateProfileSystem {
print "\tUpdating user profile system.\n" unless ($quiet);
WebGUI::SQL->write("alter table userProfileField change fieldLabel label varchar(255) not null default 'Undefined'");
WebGUI::SQL->write("alter table userProfileField change dataType fieldType varchar(128) not null default 'text'");
WebGUI::SQL->write("alter table userProfileField change dataValues possibleValues text");
WebGUI::SQL->write("alter table userProfileField change dataDefault defaultValues text");
WebGUI::SQL->write("alter table userProfileCategory change categoryName label varchar(255) not null default 'Undefined'");
}
#-------------------------------------------------
sub upgradeRichEditor {
print "\tUpgrade rich editor\n" unless ($quiet);

View file

@ -103,14 +103,39 @@ sub delete {
#-------------------------------------------------------------------
=head2 formField ()
=head2 formField ( formProperties )
Returns an HTMLified form field element.
=head3 formProperties
Optionally pass in a list of properties to override the default properties of any form element. You cannot override the pieces specified as part of the form field like field type, label, options, etc.
=cut
sub formField {
my $self = shift;
my $properties = shift;
$properties->{label} = WebGUI::Operation::Shared::secureEval($self->get("label"));
$properties->{fieldType} = $self->get("fieldType");
$properties->{name} = $self->getId;
my $values = WebGUI::Operation::Shared::secureEval($self->get("possibleValues"));
my $orderedValues = {};
tie %{$orderedValues}, 'Tie::IxHash';
foreach my $ov (sort keys %{$values}) {
$orderedValues->{$ov} = $values->{$ov};
}
$properties->{options} = $orderedValues;
my $default;
if ($session{form}{$data->{fieldName}}) {
$default = $session{form}{$data->{fieldName}};
} elsif ($session{user}{$data->{fieldName}}) {
$default = $session{user}{$data->{fieldName}};
} else {
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
}
$properties->{value} = $default;
return WebGUI::Form::DynamicField->new($properties)->displayForm;
}
@ -123,7 +148,8 @@ Returns the value retrieved from a form post.
=cut
sub formProcess {
my $self = shift;
return WebGUI::FormProcessor::process($self->getId,$self->get("fieldType"),WebGUI::Operation::Shared::secureEval($self->get("possibleValues")));
}
#-------------------------------------------------------------------