From bfffdae8a98e50f06b70cf3c33a83ce866e5d871 Mon Sep 17 00:00:00 2001 From: JT Smith Date: Wed, 7 Dec 2005 17:43:01 +0000 Subject: [PATCH] fixing bugs --- docs/upgrades/upgrade_6.8.0-6.8.1.pl | 2 +- lib/WebGUI/Operation/Profile.pm | 4 ++-- lib/WebGUI/Operation/ProfileSettings.pm | 25 +++---------------------- lib/WebGUI/ProfileField.pm | 12 ++++++------ 4 files changed, 12 insertions(+), 31 deletions(-) diff --git a/docs/upgrades/upgrade_6.8.0-6.8.1.pl b/docs/upgrades/upgrade_6.8.0-6.8.1.pl index 0369bb91c..7438eb008 100644 --- a/docs/upgrades/upgrade_6.8.0-6.8.1.pl +++ b/docs/upgrades/upgrade_6.8.0-6.8.1.pl @@ -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 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 userProfileField change dataDefault defaultValue text"); WebGUI::SQL->write("alter table userProfileCategory change categoryName label varchar(255) not null default 'Undefined'"); } diff --git a/lib/WebGUI/Operation/Profile.pm b/lib/WebGUI/Operation/Profile.pm index 8bb58a292..bba7789c6 100644 --- a/lib/WebGUI/Operation/Profile.pm +++ b/lib/WebGUI/Operation/Profile.pm @@ -155,11 +155,11 @@ sub www_viewProfile { my @array = (); foreach my $category (@{WebGUI::ProfileCategory->getCategories}) { - next unless ($category->get("visible"); + next unless ($category->get("visible")); push(@array, {'profile.category' => $category->getLabel}); foreach my $field (@{$category->getFields}) { 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, { 'profile.label' => $field->getLabel, 'profile.value' => $u->profileField($field->getId) diff --git a/lib/WebGUI/Operation/ProfileSettings.pm b/lib/WebGUI/Operation/ProfileSettings.pm index 4acb6157d..1e07f1a87 100644 --- a/lib/WebGUI/Operation/ProfileSettings.pm +++ b/lib/WebGUI/Operation/ProfileSettings.pm @@ -23,28 +23,8 @@ use WebGUI::Session; use WebGUI::SQL; use WebGUI::Operation::Shared; use WebGUI::Form::FieldType; - -#------------------------------------------------------------------- -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; -} +use WebGUI::ProfileField; +use WebGUI::ProfileCategory; #------------------------------------------------------------------- sub _submenu { @@ -75,6 +55,7 @@ sub _submenu { sub www_deleteProfileCategoryConfirm { 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); + 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})); return www_editProfileSettings(); diff --git a/lib/WebGUI/ProfileField.pm b/lib/WebGUI/ProfileField.pm index ccfa8a73b..478001589 100644 --- a/lib/WebGUI/ProfileField.pm +++ b/lib/WebGUI/ProfileField.pm @@ -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. -=head4 defaultValues +=head4 defaultValue 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->{label} = 'Undefined' if ($properties->{label} =~ /^[\"\']*$/); $properties->{fieldType} = 'text' unless ($properties->{fieldType}); - if ($properties->{defaultValues} && $properties->{fieldType}=~/List$/) { - unless ($properties->{defaultValues} =~ /^\[/) { - $properties->{defaultValues} = "[".$properties->{defaultValues}; + if ($properties->{defaultValue} && $properties->{fieldType}=~/List$/) { + unless ($properties->{defaultValue} =~ /^\[/) { + $properties->{defaultValue} = "[".$properties->{defaultValue}; } - unless ($properties->{defaultValues} =~ /\]$/) { - $properties->{defaultValues} .= "]"; + unless ($properties->{defaultValue} =~ /\]$/) { + $properties->{defaultValue} .= "]"; } } $properties->{fieldName} = $self->getId;