Added more field types to profile fields.

This commit is contained in:
JT Smith 2003-05-10 21:54:15 +00:00
parent 9b7d273b6d
commit f131a648c2
2 changed files with 7 additions and 19 deletions

View file

@ -15,6 +15,7 @@ use strict qw(vars subs);
use URI;
use WebGUI::DateTime;
use WebGUI::ErrorHandler;
use WebGUI::FormProcessor;
use WebGUI::HTMLForm;
use WebGUI::International;
use WebGUI::Macro;
@ -88,12 +89,7 @@ sub _validateProfileData {
tie %field, 'Tie::CPHash';
$a = WebGUI::SQL->read("select dataType,fieldName,fieldLabel,required from userProfileField");
while (%field = $a->hash) {
if ($field{dataType} eq "date") {
$data{$field{fieldName}} = WebGUI::DateTime::setToEpoch($session{form}{$field{fieldName}});
$session{form}{$field{fieldName}} = $data{$field{fieldName}};
} elsif (exists $session{form}{$field{fieldName}}) {
$data{$field{fieldName}} = $session{form}{$field{fieldName}};
}
$data{$field{fieldName}} = WebGUI::FormProcessor::process($field{fieldName},$field{dataType});
if ($field{required} && $data{$field{fieldName}} eq "") {
$error .= '<li>';
$error .= eval $field{fieldLabel};
@ -304,7 +300,7 @@ sub www_editProfile {
} else {
$subtext = "";
}
if ($method eq "select") {
if ($method eq "selectList") {
# note: this big if statement doesn't look elegant, but doing regular
# ORs caused problems with the array reference.
if ($session{form}{$data{fieldName}}) {

View file

@ -197,19 +197,11 @@ sub www_editProfileField {
-label=>WebGUI::International::get(474,"WebGUI/Profile"),
-value=>$data{required}
);
tie %hash, 'Tie::IxHash';
%hash = ( 'text'=>WebGUI::International::get(475),
'textarea'=>WebGUI::International::get(476),
'HTMLArea'=>WebGUI::International::get(477),
'url'=>WebGUI::International::get(478),
'date'=>WebGUI::International::get(479),
'email'=>WebGUI::International::get(480),
'phone'=>WebGUI::International::get(481),
'integer'=>WebGUI::International::get(482),
'yesNo'=>WebGUI::International::get(483),
'select'=>WebGUI::International::get(484)
$f->fieldType(
-name=>"dataType",
-label=>WebGUI::International::get(486),
-value=>[$data{dataType} || "text"]
);
$f->select("dataType",\%hash,WebGUI::International::get(486),[$data{dataType}]);
$f->textarea("dataValues",WebGUI::International::get(487),$data{dataValues});
$f->textarea("dataDefault",WebGUI::International::get(488),$data{dataDefault});
tie %hash, 'Tie::CPHash';