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

View file

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