fixing remaining bugs

This commit is contained in:
JT Smith 2005-12-07 20:49:59 +00:00
parent dcbcaee880
commit 76c38edb44
3 changed files with 15 additions and 12 deletions

View file

@ -116,11 +116,11 @@ sub www_editProfileCategory {
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub www_editProfileCategorySave { sub www_editProfileCategorySave {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3)); return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
my %data = { my %data = (
label=>WebGUI::FormProcessor::text("label"), label=>WebGUI::FormProcessor::text("label"),
visible=>WebGUI::FormProcessor::yesNo("visible"), visible=>WebGUI::FormProcessor::yesNo("visible"),
editable=>WebGUI::FormProcessor::yesNo("editable"), editable=>WebGUI::FormProcessor::yesNo("editable"),
}; );
if ($session{form}{cid} eq "new") { if ($session{form}{cid} eq "new") {
my $category = WebGUI::ProfileCategory->create(\%data); my $category = WebGUI::ProfileCategory->create(\%data);
$session{form}{cid} = $category->getId; $session{form}{cid} = $category->getId;
@ -186,7 +186,7 @@ sub www_editProfileField {
-value=>$data->{required} -value=>$data->{required}
); );
my $fieldType = WebGUI::Form::FieldType->new( my $fieldType = WebGUI::Form::FieldType->new(
-name=>"dataType", -name=>"fieldType",
-label=>WebGUI::International::get(486,"WebGUIProfile"), -label=>WebGUI::International::get(486,"WebGUIProfile"),
-hoverHelp=>WebGUI::International::get('486 description',"WebGUIProfile"), -hoverHelp=>WebGUI::International::get('486 description',"WebGUIProfile"),
-value=>ucfirst $data->{fieldType}, -value=>ucfirst $data->{fieldType},
@ -204,7 +204,7 @@ sub www_editProfileField {
$fieldType->{types} = \@profileForms; $fieldType->{types} = \@profileForms;
$f->raw($fieldType->toHtmlWithWrapper()); $f->raw($fieldType->toHtmlWithWrapper());
$f->textarea( $f->textarea(
-name => "dataValues", -name => "possibleValues",
-label => WebGUI::International::get(487,"WebGUIProfile"), -label => WebGUI::International::get(487,"WebGUIProfile"),
-hoverHelp => WebGUI::International::get('487 description',"WebGUIProfile"), -hoverHelp => WebGUI::International::get('487 description',"WebGUIProfile"),
-value => $data->{possibleValues}, -value => $data->{possibleValues},
@ -242,11 +242,14 @@ sub www_editProfileFieldSave {
dataDefault=>WebGUI::FormProcessor::textarea("dataDefault"), dataDefault=>WebGUI::FormProcessor::textarea("dataDefault"),
fieldType=>WebGUI::FormProcessor::fieldType("fieldType"), fieldType=>WebGUI::FormProcessor::fieldType("fieldType"),
); );
my $categoryId = WebGUI::FormProcessor::selectBox("profileCategoryId");
if ($session{form}{new}) { if ($session{form}{new}) {
my $field = WebGUI::ProfileField->create(WebGUI::FormProcessor::text("fieldName"), \%data, WebGUI::FormProcessor::selectBox("profileCategoryId")); my $field = WebGUI::ProfileField->create(WebGUI::FormProcessor::text("fid"), \%data, $categoryId);
$session{form}{fid} = $field->getId; $session{form}{fid} = $field->getId;
} else { } else {
WebGUI::ProfileField->new($session{form}{fid})->set(\%data); my $field = WebGUI::ProfileField->new($session{form}{fid});
$field->set(\%data);
$field->setCategory($categoryId);
} }
return www_editProfileSettings(); return www_editProfileSettings();
} }
@ -261,7 +264,7 @@ sub www_editProfileSettings {
$output .= moveUpIcon('op=moveProfileCategoryUp;cid='.$category->getId); $output .= moveUpIcon('op=moveProfileCategoryUp;cid='.$category->getId);
$output .= moveDownIcon('op=moveProfileCategoryDown;cid='.$category->getId); $output .= moveDownIcon('op=moveProfileCategoryDown;cid='.$category->getId);
$output .= ' <b>'.$category->getLabel.'</b><br />'; $output .= ' <b>'.$category->getLabel.'</b><br />';
foreach my $field ($category->getFields) { foreach my $field (@{$category->getFields}) {
$output .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'; $output .= '&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;';
$output .= deleteIcon('op=deleteProfileFieldConfirm;fid='.$field->getId,'',WebGUI::International::get(467,"WebGUIProfile")); $output .= deleteIcon('op=deleteProfileFieldConfirm;fid='.$field->getId,'',WebGUI::International::get(467,"WebGUIProfile"));
$output .= editIcon('op=editProfileField;fid='.$field->getId); $output .= editIcon('op=editProfileField;fid='.$field->getId);

View file

@ -69,7 +69,7 @@ sub create {
my ($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber) from userProfileCategory"); my ($sequenceNumber) = WebGUI::SQL->quickArray("select max(sequenceNumber) from userProfileCategory");
my $id = WebGUI::SQL->setRow("userProfileCategory","profileCategoryId",{profileCategoryId=>"new", sequenceNumber=>$sequenceNumber+1}); my $id = WebGUI::SQL->setRow("userProfileCategory","profileCategoryId",{profileCategoryId=>"new", sequenceNumber=>$sequenceNumber+1});
my $self = $class->new($id); my $self = $class->new($id);
$self->update($properties); $self->set($properties);
return $self; return $self;
} }

View file

@ -79,12 +79,12 @@ sub create {
my $class = shift; my $class = shift;
my $fieldName = shift; my $fieldName = shift;
my $properties = shift; my $properties = shift;
my $categoryId = shift; my $categoryId = shift || "1";
my ($fieldName) = WebGUI::SQL->quickArray("select count(*) from userProfileField where fieldName=".quote($fieldName)); my ($fieldNameExists) = WebGUI::SQL->quickArray("select count(*) from userProfileField where fieldName=".quote($fieldName));
return undef if ($fieldName); return undef if ($fieldNameExists);
my $id = WebGUI::SQL->setRow("userProfileField","fieldName",{fieldName=>"new"},undef,$fieldName); my $id = WebGUI::SQL->setRow("userProfileField","fieldName",{fieldName=>"new"},undef,$fieldName);
my $self = $class->new($id); my $self = $class->new($id);
$self->setCategory($categoryId || "1"); $self->setCategory($categoryId);
$self->set($properties); $self->set($properties);
return $self; return $self;
} }