fixing bugs

This commit is contained in:
JT Smith 2005-12-07 17:43:01 +00:00
parent a20aa5f587
commit bfffdae8a9
4 changed files with 12 additions and 31 deletions

View file

@ -36,7 +36,7 @@ sub updateProfileSystem {
WebGUI::SQL->write("alter table userProfileField change fieldLabel label varchar(255) not null default 'Undefined'"); 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 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 dataValues possibleValues text");
WebGUI::SQL->write("alter table userProfileField change dataDefault defaultValues text"); WebGUI::SQL->write("alter table userProfileField change dataDefault defaultValue text");
WebGUI::SQL->write("alter table userProfileCategory change categoryName label varchar(255) not null default 'Undefined'"); WebGUI::SQL->write("alter table userProfileCategory change categoryName label varchar(255) not null default 'Undefined'");
} }

View file

@ -155,11 +155,11 @@ sub www_viewProfile {
my @array = (); my @array = ();
foreach my $category (@{WebGUI::ProfileCategory->getCategories}) { foreach my $category (@{WebGUI::ProfileCategory->getCategories}) {
next unless ($category->get("visible"); next unless ($category->get("visible"));
push(@array, {'profile.category' => $category->getLabel}); push(@array, {'profile.category' => $category->getLabel});
foreach my $field (@{$category->getFields}) { foreach my $field (@{$category->getFields}) {
next unless ($field->get("visible")); next unless ($field->get("visible"));
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' => $u->profileField($field->getId) 'profile.value' => $u->profileField($field->getId)

View file

@ -23,28 +23,8 @@ use WebGUI::Session;
use WebGUI::SQL; use WebGUI::SQL;
use WebGUI::Operation::Shared; use WebGUI::Operation::Shared;
use WebGUI::Form::FieldType; use WebGUI::Form::FieldType;
use WebGUI::ProfileField;
#------------------------------------------------------------------- use WebGUI::ProfileCategory;
sub _reorderCategories {
my ($sth, $i, $id);
$sth = WebGUI::SQL->read("select profileCategoryId from userProfileCategory order by sequenceNumber");
while (($id) = $sth->array) {
$i++;
WebGUI::SQL->write("update userProfileCategory set sequenceNumber='$i' where profileCategoryId=".quote($id));
}
$sth->finish;
}
#-------------------------------------------------------------------
sub _reorderFields {
my ($sth, $i, $id);
$sth = WebGUI::SQL->read("select fieldName from userProfileField where profileCategoryId=".quote($_[0])." order by sequenceNumber");
while (($id) = $sth->array) {
$i++;
WebGUI::SQL->write("update userProfileField set sequenceNumber='$i' where fieldName=".quote($id));
}
$sth->finish;
}
#------------------------------------------------------------------- #-------------------------------------------------------------------
sub _submenu { sub _submenu {
@ -75,6 +55,7 @@ sub _submenu {
sub www_deleteProfileCategoryConfirm { sub www_deleteProfileCategoryConfirm {
return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3)); return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3));
return WebGUI::AdminConsole->new("userProfiling")->render(WebGUI::Privilege::vitalComponent()) if (length($session{form}{cid}) != 22 && $session{form}{cid} < 1000 && $session{form}{cid} > 0); return WebGUI::AdminConsole->new("userProfiling")->render(WebGUI::Privilege::vitalComponent()) if (length($session{form}{cid}) != 22 && $session{form}{cid} < 1000 && $session{form}{cid} > 0);
WebGUI::SQL->write("delete from userProfileCategory where profileCategoryId=".quote($session{form}{cid})); WebGUI::SQL->write("delete from userProfileCategory where profileCategoryId=".quote($session{form}{cid}));
WebGUI::SQL->write("update userProfileField set profileCategoryId='1' where profileCategoryId=".quote($session{form}{cid})); WebGUI::SQL->write("update userProfileField set profileCategoryId='1' where profileCategoryId=".quote($session{form}{cid}));
return www_editProfileSettings(); return www_editProfileSettings();

View file

@ -400,7 +400,7 @@ A scalar indicating the type of field this will be when generated as a form elem
A scalar containing a hash reference declaration of possible values. Only used for list type fields. A scalar containing a hash reference declaration of possible values. Only used for list type fields.
=head4 defaultValues =head4 defaultValue
A scalar containing an array reference or scalar declaration of defaultly selected value(s). A scalar containing an array reference or scalar declaration of defaultly selected value(s).
@ -415,12 +415,12 @@ sub set {
$properties->{required} = 0 unless ($properties->{required} == 1); $properties->{required} = 0 unless ($properties->{required} == 1);
$properties->{label} = 'Undefined' if ($properties->{label} =~ /^[\"\']*$/); $properties->{label} = 'Undefined' if ($properties->{label} =~ /^[\"\']*$/);
$properties->{fieldType} = 'text' unless ($properties->{fieldType}); $properties->{fieldType} = 'text' unless ($properties->{fieldType});
if ($properties->{defaultValues} && $properties->{fieldType}=~/List$/) { if ($properties->{defaultValue} && $properties->{fieldType}=~/List$/) {
unless ($properties->{defaultValues} =~ /^\[/) { unless ($properties->{defaultValue} =~ /^\[/) {
$properties->{defaultValues} = "[".$properties->{defaultValues}; $properties->{defaultValue} = "[".$properties->{defaultValue};
} }
unless ($properties->{defaultValues} =~ /\]$/) { unless ($properties->{defaultValue} =~ /\]$/) {
$properties->{defaultValues} .= "]"; $properties->{defaultValue} .= "]";
} }
} }
$properties->{fieldName} = $self->getId; $properties->{fieldName} = $self->getId;