Colin: adding avatar to collaboration systems and refactoring some user profile stuff. Added photo and avatar fields to user profile.
This commit is contained in:
parent
852ba1ba15
commit
e75988cd1f
37 changed files with 1000 additions and 279 deletions
|
|
@ -27,11 +27,15 @@ addTimeZonesToUserPreferences();
|
|||
# up to 2^32 as SCALARs. :(
|
||||
removeUnneededFiles();
|
||||
updateCollaboration();
|
||||
addPhotoField();
|
||||
addAvatarField();
|
||||
addEnableAvatarColumn();
|
||||
finish();
|
||||
|
||||
#-------------------------------------------------
|
||||
sub updateCollaboration {
|
||||
print "\tAdding collaboration/rss template\n" unless ($quiet);
|
||||
WebGUI::SQL->write("ALTER TABLE Collaboration ADD COLUMN rssTemplateId varchar(22) binary NOT NULL default 'PBtmpl0000000000000142' after notificationTemplateId");
|
||||
my $template = <<STOP;
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<rss version="2.0">
|
||||
|
|
@ -97,6 +101,33 @@ sub removeUnneededFiles {
|
|||
unlink("../../www/index.pl");
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub addPhotoField {
|
||||
##Get profileCategoryId.
|
||||
my ($categoryId) = WebGUI::SQL->quickArray(q!select profileCategoryId from userProfileCategory where categoryName='WebGUI::International::get(439,"WebGUI");'!);
|
||||
##Get last sequence number
|
||||
my ($lastField) = WebGUI::SQL->buildArray(qq!select max(sequenceNumber) from userProfileField where profileCategoryId=$categoryId!);
|
||||
++ $lastField;
|
||||
##Insert Photo Field
|
||||
WebGUI::SQL->write(sprintf q!insert into userProfileField values ('photo','WebGUI::International::get("photo","WebGUI");', 1, 0, 'Image', '', '', %d, %d, 1, 1)!, $lastField, $categoryId);
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub addAvatarField {
|
||||
##Get profileCategoryId.
|
||||
my ($categoryId) = WebGUI::SQL->buildArray(q!select profileCategoryId from userProfileCategory where categoryName='WebGUI::International::get(449,"WebGUI");';!);
|
||||
##Get last sequence number
|
||||
my ($lastField) = WebGUI::SQL->buildArray(qq!select max(sequenceNumber) from userProfileField where profileCategoryId=$categoryId!);
|
||||
++ $lastField;
|
||||
##Insert Photo Field
|
||||
WebGUI::SQL->write( sprintf q!insert into userProfileField values('avatar','WebGUI::International::get("avatar","WebGUI");', 0, 0, 'Image', '', '', %d, %d, 1, 0)!, $lastField, $categoryId );
|
||||
}
|
||||
|
||||
#-------------------------------------------------
|
||||
sub addEnableAvatarColumn {
|
||||
WebGUI::SQL->write('ALTER TABLE Collaboration ADD COLUMN avatarsEnabled int(11) NOT NULL DEFAULT 0');
|
||||
}
|
||||
|
||||
#--- DO NOT EDIT BELOW THIS LINE
|
||||
|
||||
#-------------------------------------------------
|
||||
|
|
@ -108,7 +139,6 @@ sub start {
|
|||
);
|
||||
WebGUI::Session::open("../..",$configFile);
|
||||
WebGUI::Session::refreshUserInfo(3);
|
||||
WebGUI::SQL->write("ALTER TABLE Collaboration ADD COLUMN rssTemplateId varchar(22) binary NOT NULL default 'PBtmpl0000000000000142' after notificationTemplateId");
|
||||
WebGUI::SQL->write("insert into webguiVersion values (".quote($toVersion).",'upgrade',".time().")");
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -82,6 +82,17 @@ sub appendPostListTemplateVars {
|
|||
} else {
|
||||
$url = $post->getUrl."#".$post->getId;
|
||||
}
|
||||
my $avatarUrl;
|
||||
if ($self->get('avatarsEnabled')) {
|
||||
#ownerUserId from post
|
||||
#Create user object.
|
||||
my $user = WebGUI::User->new($post->get('ownerUserId'));
|
||||
#Get avatar field, storage Id.
|
||||
my $storageId = $user->get("avatar");
|
||||
my $avatar = WebGUI::Storage->get($storageId);
|
||||
#Get url from storage object.
|
||||
$avatarUrl = $avatar->getUrl;
|
||||
}
|
||||
push(@{$var->{post_loop}}, {
|
||||
%{$post->get},
|
||||
"id"=>$post->getId,
|
||||
|
|
@ -105,6 +116,7 @@ sub appendPostListTemplateVars {
|
|||
"isFourth"=>(($i+1)%4==0),
|
||||
"isFifth"=>(($i+1)%5==0),
|
||||
"user.isPoster"=>$post->isPoster,
|
||||
"avatar.url"=>$post->isPoster,
|
||||
%lastReply
|
||||
});
|
||||
$i++;
|
||||
|
|
@ -399,6 +411,10 @@ sub definition {
|
|||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
avatarsEnabled =>{
|
||||
fieldType=>"yesNo",
|
||||
defaultValue=>0
|
||||
},
|
||||
moderateGroupId =>{
|
||||
fieldType=>"group",
|
||||
defaultValue=>'4'
|
||||
|
|
@ -616,6 +632,12 @@ sub getEditForm {
|
|||
-hoverHelp=>WebGUI::International::get('use preview description', 'Asset_Collaboration'),
|
||||
-value=>$self->getValue("usePreview")
|
||||
);
|
||||
$tabform->getTab("properties")->yesNo(
|
||||
-name=>"avatarsEnabled",
|
||||
-label=>WebGUI::International::get('enable avatars', 'Asset_Collaboration'),
|
||||
-hoverHelp=>WebGUI::International::get('enable avatars description', 'Asset_Collaboration'),
|
||||
-value=>$self->getValue("avatarsEnabled")
|
||||
);
|
||||
$tabform->getTab("security")->yesNo(
|
||||
-name=>"moderatePosts",
|
||||
-label=>WebGUI::International::get('moderate', 'Asset_Collaboration'),
|
||||
|
|
|
|||
|
|
@ -61,6 +61,10 @@ An array reference of the items to be checked if no value is specified. Defaults
|
|||
|
||||
Boolean representing whether the checklist should be represented vertically or horizontally. If set to "1" will be displayed vertically. Defaults to "0".
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -75,12 +79,28 @@ sub definition {
|
|||
},
|
||||
vertical=>{
|
||||
defaultValue=>0
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayValue ( )
|
||||
|
||||
Return the all options
|
||||
|
||||
=cut
|
||||
|
||||
sub displayValue {
|
||||
my ($self) = @_;
|
||||
return join ", ", @{ $self->{value} };
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ Defaults to "0". Set to "1" if this field should be checked.
|
|||
|
||||
The value returned by this field if it is checked and no value is specified. Defaults to "1".
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -65,6 +69,9 @@ sub definition {
|
|||
defaultValue=> 0
|
||||
},
|
||||
defaultValue=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -39,6 +39,33 @@ The following methods are specifically available from this class. Check the supe
|
|||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
|
|
|||
|
|
@ -39,6 +39,33 @@ The following methods are specifically available from this class. Check the supe
|
|||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ package WebGUI::Form::Control;
|
|||
use strict;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Operation::Shared;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
|
|
@ -133,6 +134,10 @@ A stylesheet class assigned to each label/field pair.
|
|||
|
||||
A text string that will pop up when the user hovers over the label when toHtmlWithWrapper() is called. This string should indicate how to use the field and is usually tied into the help system.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -183,13 +188,66 @@ sub definition {
|
|||
},
|
||||
idPrefix=>{
|
||||
defaultValue=>undef
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>0
|
||||
},
|
||||
});
|
||||
return $definition;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayForm ( )
|
||||
|
||||
This utility method is used to format values for the Profile system but can
|
||||
be used in other areas as well. Most form elements will just return toHtml.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayForm {
|
||||
my ($self) = @_;
|
||||
$self->toHtml;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayFormWithWrapper ( )
|
||||
|
||||
This utility method is used to format values for the Profile system but can
|
||||
be used in other areas as well. Most form elements will just return displayForm.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayFormWithWrapper {
|
||||
my $self = shift;
|
||||
if ($self->passUiLevelCheck) {
|
||||
my ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext) = $self->prepareWrapper;
|
||||
return '<tr'.$rowClass.'>
|
||||
<td'.$labelClass.$hoverHelp.' valign="top" style="width: 25%;">'.$self->{label}.'</td>
|
||||
<td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->displayForm().$subtext."</td>
|
||||
</tr>\n";
|
||||
} else {
|
||||
return $self->toHtmlAsHidden;
|
||||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayValue ( )
|
||||
|
||||
This utility method is used to format values for the Profile system. Most
|
||||
form elements will just return their value.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayValue {
|
||||
my ($self) = @_;
|
||||
return $self->{value};
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 generateIdParameter ( name )
|
||||
|
||||
A class method that returns a value to be used as the autogenerated ID for this field instance. Unless overriden, it simply returns the name with "_formId" appended to it.
|
||||
|
|
@ -375,6 +433,40 @@ sub new {
|
|||
$params{id} = $params{idPrefix}.$params{id};
|
||||
bless \%params, $class;
|
||||
}
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 prepareWrapper ( )
|
||||
|
||||
Common code for preparing wrappers for *WithWrapper
|
||||
|
||||
=cut
|
||||
|
||||
sub prepareWrapper {
|
||||
my $self = shift;
|
||||
my $rowClass = $self->{rowClass};
|
||||
$rowClass = qq| class="$rowClass" | if($self->{rowClass});
|
||||
my $labelClass = $self->{labelClass};
|
||||
$labelClass = qq| class="$labelClass" | if($self->{labelClass});
|
||||
my $fieldClass = $self->{fieldClass};
|
||||
$fieldClass = qq| class="$fieldClass" | if($self->{fieldClass});
|
||||
my $hoverHelp = $self->{hoverHelp};
|
||||
$hoverHelp =~ s/\r/ /g;
|
||||
$hoverHelp =~ s/\n/ /g;
|
||||
$hoverHelp =~ s/&/& amp;/g;
|
||||
$hoverHelp =~ s/>/& gt;/g;
|
||||
$hoverHelp =~ s/</& lt;/g;
|
||||
$hoverHelp =~ s/&/&/g;
|
||||
$hoverHelp =~ s/>/>/g;
|
||||
$hoverHelp =~ s/</</g;
|
||||
$hoverHelp =~ s/"/"/g;
|
||||
$hoverHelp =~ s/'/\\'/g;
|
||||
$hoverHelp =~ s/^\s+//;
|
||||
$hoverHelp = qq| onmouseover="return escape('$hoverHelp')"| if ($hoverHelp);
|
||||
my $subtext = $self->{subtext};
|
||||
$subtext = qq| <span class="formSubtext">$subtext</span>| if ($subtext);
|
||||
return ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -412,35 +504,8 @@ Renders the form field to HTML as a table row complete with labels, subtext, hov
|
|||
|
||||
sub toHtmlWithWrapper {
|
||||
my $self = shift;
|
||||
my $passUiLevelCheck = 0;
|
||||
if ($session{config}{$self->{uiLevelOverride}."_uiLevel"}{$self->{name}}) { # use override if it exists
|
||||
$passUiLevelCheck = ($session{config}{$self->{uiLevelOverride}."_uiLevel"}{$self->{name}} <= $session{user}{uiLevel});
|
||||
} else { # use programmed default
|
||||
$passUiLevelCheck = ($self->{uiLevel} <= $session{user}{uiLevel});
|
||||
}
|
||||
$passUiLevelCheck = WebGUI::Grouping::isInGroup(3) unless ($passUiLevelCheck); # override if in admins group
|
||||
if ($passUiLevelCheck) {
|
||||
my $rowClass = $self->{rowClass};
|
||||
$rowClass = qq| class="$rowClass" | if($self->{rowClass});
|
||||
my $labelClass = $self->{labelClass};
|
||||
$labelClass = qq| class="$labelClass" | if($self->{labelClass});
|
||||
my $fieldClass = $self->{fieldClass};
|
||||
$fieldClass = qq| class="$fieldClass" | if($self->{fieldClass});
|
||||
my $hoverHelp = $self->{hoverHelp};
|
||||
$hoverHelp =~ s/\r/ /g;
|
||||
$hoverHelp =~ s/\n/ /g;
|
||||
$hoverHelp =~ s/&/& amp;/g;
|
||||
$hoverHelp =~ s/>/& gt;/g;
|
||||
$hoverHelp =~ s/</& lt;/g;
|
||||
$hoverHelp =~ s/&/&/g;
|
||||
$hoverHelp =~ s/>/>/g;
|
||||
$hoverHelp =~ s/</</g;
|
||||
$hoverHelp =~ s/"/"/g;
|
||||
$hoverHelp =~ s/'/\\'/g;
|
||||
$hoverHelp =~ s/^\s+//;
|
||||
$hoverHelp = qq| onmouseover="return escape('$hoverHelp')"| if ($hoverHelp);
|
||||
my $subtext = $self->{subtext};
|
||||
$subtext = qq| <span class="formSubtext">$subtext</span>| if ($subtext);
|
||||
if ($self->passUiLevelCheck) {
|
||||
my ($fieldClass, $rowClass, $labelClass, $hoverHelp, $subtext) = $self->prepareWrapper;
|
||||
return '<tr'.$rowClass.'>
|
||||
<td'.$labelClass.$hoverHelp.' valign="top" style="width: 25%;">'.$self->{label}.'</td>
|
||||
<td valign="top"'.$fieldClass.' style="width: 75%;">'.$self->toHtml().$subtext."</td>
|
||||
|
|
@ -450,5 +515,27 @@ sub toHtmlWithWrapper {
|
|||
}
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 passUiLevelCheck ( )
|
||||
|
||||
Renders the form field to HTML as a table row complete with labels, subtext, hoverhelp, etc.
|
||||
|
||||
=cut
|
||||
|
||||
sub passUiLevelCheck {
|
||||
my $self = shift;
|
||||
my $passUiLevelCheck = 0;
|
||||
if ($session{config}{$self->{uiLevelOverride}."_uiLevel"}{$self->{name}}) { # use override if it exists
|
||||
$passUiLevelCheck = ($session{config}{$self->{uiLevelOverride}."_uiLevel"}{$self->{name}} <= $session{user}{uiLevel});
|
||||
} else { # use programmed default
|
||||
$passUiLevelCheck = ($self->{uiLevel} <= $session{user}{uiLevel});
|
||||
}
|
||||
$passUiLevelCheck = WebGUI::Grouping::isInGroup(3) unless ($passUiLevelCheck); # override if in admins group
|
||||
return $passUiLevelCheck;
|
||||
}
|
||||
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -67,6 +67,10 @@ A default date is placed in the value field. Set this to "1" to leave it empty.
|
|||
|
||||
If no value is specified, this will be used. Defaults to today and now.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -84,13 +88,29 @@ sub definition {
|
|||
},
|
||||
noDate=>{
|
||||
defaultValue=>0
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayValue ( )
|
||||
|
||||
Return the date in a human readable format for the Profile system.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayValue {
|
||||
my ($self) = @_;
|
||||
return WebGUI::DateTime::epochToHuman($self->{value},"%z");
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
||||
Returns the human readable name or type of this form control.
|
||||
|
|
|
|||
|
|
@ -58,6 +58,10 @@ Defaults to 19. Determines the maximum number of characters allowed in this fiel
|
|||
|
||||
Defaults to 19. The displayed size of the box for the date to be typed in.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=head4 defaultValue
|
||||
|
||||
If no value is specified, this will be used. Defaults to today and now.
|
||||
|
|
@ -76,7 +80,10 @@ sub definition {
|
|||
},
|
||||
size=>{
|
||||
defaultValue=> 19
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,33 @@ The following methods are specifically available from this class. Check the supe
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
||||
Returns the human readable name or type of this form control.
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ If no name is specified a default name of "file" will be used.
|
|||
|
||||
Defaults to 1. Determines how many files the user can upload with this form control.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -68,11 +72,61 @@ sub definition {
|
|||
},
|
||||
maxAttachments=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayForm ( )
|
||||
|
||||
If an image is uploaded, then return the image and a control to
|
||||
delete it. Otherwise, display a form element to upload a file.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayForm {
|
||||
my ($self) = @_;
|
||||
return $self->toHtml unless $self->{value};
|
||||
##There are files inside here, for each one, display the image
|
||||
##and another form control for deleting it.
|
||||
my $location = WebGUI::Storage->get($self->{value});
|
||||
my $id = $location->getId;
|
||||
my $fileForm = '';
|
||||
foreach my $file ( @{ $location->getFiles } ) {
|
||||
$fileForm .= sprintf qq!<img src="%s" /><br />!, $location->getUrl($file);
|
||||
my $action = join '_', '_', $self->{name}, 'delete';
|
||||
$fileForm .= WebGUI::International::get(392)
|
||||
. " "x4
|
||||
. WebGUI::Form::YesNo->new({-name=>$action, -value=>0})->toHtml;
|
||||
}
|
||||
my $hid = $self->toHtmlAsHidden();
|
||||
$fileForm .= $hid;
|
||||
return $fileForm;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayValue ( )
|
||||
|
||||
This utility method is used to format values for the Profile system. Most
|
||||
form elements will just return their value.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayValue {
|
||||
my ($self) = @_;
|
||||
return '' unless $self->{value};
|
||||
my $location = WebGUI::Storage->get($self->{value});
|
||||
local $_;
|
||||
my @files = map { sprintf qq!<img src="%s" /> %s!, $location->getFileIconUrl($_), $_; } @{ $location->getFiles };
|
||||
my $fileValue = join "<br />\n", @files;
|
||||
return $fileValue;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
|
|
@ -92,20 +146,37 @@ sub getName {
|
|||
|
||||
=head2 getValueFromPost ( )
|
||||
|
||||
Returns the storageId for the storage location that the file(s) got uploaded to. Returns undef if no files were uploaded.
|
||||
Returns the storageId for the storage location that the file(s) got
|
||||
uploaded to. Returns undef if no files were uploaded. Also handles
|
||||
deleting the file if it was specified.
|
||||
|
||||
=cut
|
||||
|
||||
sub getValueFromPost {
|
||||
my $self = shift;
|
||||
my $storage = WebGUI::Storage->create;
|
||||
$storage->addFileFromFormPost($self->{name});
|
||||
my @files = @{ $storage->getFiles };
|
||||
if (scalar(@files) < 1) {
|
||||
my $value = $session{req}->param($self->{name});
|
||||
if ($session{req}->param(join '_', '_', $self->{name}, 'delete')) {
|
||||
my $storage = WebGUI::Storage->get($value);
|
||||
$storage->delete;
|
||||
return undef;
|
||||
} else {
|
||||
return $storage->getId;
|
||||
return '';
|
||||
}
|
||||
else {
|
||||
my $storage;
|
||||
if ($value) {
|
||||
$storage = WebGUI::Storage::Image->get($value);
|
||||
}
|
||||
else {
|
||||
$storage = WebGUI::Storage::Image->create;
|
||||
}
|
||||
$storage->addFileFromFormPost($self->{name});
|
||||
my @files = @{ $storage->getFiles };
|
||||
if (scalar(@files) < 1) {
|
||||
$storage->delete;
|
||||
return undef;
|
||||
} else {
|
||||
my $id = $storage->getId;
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -139,18 +210,5 @@ sub toHtml {
|
|||
return $uploadControl;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head4 toHtmlAsHidden ( )
|
||||
|
||||
Returns undef.
|
||||
|
||||
=cut
|
||||
|
||||
sub toHtmlAsHidden {
|
||||
return undef;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
||||
|
|
|
|||
|
|
@ -60,6 +60,10 @@ Defaults to 0. Used if no value is specified.
|
|||
|
||||
Defaults to 11. The number of characters that will be displayed at once in this field. Usually no need to override the default.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -74,7 +78,10 @@ sub definition {
|
|||
},
|
||||
size=>{
|
||||
defaultValue=>11
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,6 +72,10 @@ This will be used if no value is specified. Should be passed as an array referen
|
|||
|
||||
A text label that will be displayed if toHtmlWithWrapper() is called. Defaults to getName().
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -92,7 +96,10 @@ sub definition {
|
|||
},
|
||||
excludeGroups=>{
|
||||
defaultValue=>[]
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,6 +63,10 @@ The number of columns (in characters) wide the box should be. Defaults to the se
|
|||
|
||||
The ID of the WebGUI::Asset::RichEdit object to load. Defaults to the richEditor setting or "PBrichedit000000000001" if that's not set.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -77,7 +81,10 @@ sub definition {
|
|||
},
|
||||
richEditId=>{
|
||||
defaultValue=>$session{setting}{richEditor} || "PBrichedit000000000001"
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -39,6 +39,33 @@ The following methods are specifically available from this class. Check the supe
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 generateIdParameter ( )
|
||||
|
||||
A class method that returns a value to be used as the autogenerated ID for this field instance. Returns undef because this field type can have more than one with the same name, therefore autogenerated ID's aren't terribly useful.
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ A hash reference containing name value pairs. The name of each pair will be used
|
|||
|
||||
value and defaultValue are array referneces containing the names from the options list that should be stored.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -66,7 +70,10 @@ sub definition {
|
|||
},
|
||||
defaultValue=>{
|
||||
defaultValue=>[]
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
120
lib/WebGUI/Form/Image.pm
Normal file
120
lib/WebGUI/Form/Image.pm
Normal file
|
|
@ -0,0 +1,120 @@
|
|||
package WebGUI::Form::Image;
|
||||
|
||||
=head1 LEGAL
|
||||
|
||||
-------------------------------------------------------------------
|
||||
WebGUI is Copyright 2001-2005 Plain Black Corporation.
|
||||
-------------------------------------------------------------------
|
||||
Please read the legal notices (docs/legal.txt) and the license
|
||||
(docs/license.txt) that came with this distribution before using
|
||||
this software.
|
||||
-------------------------------------------------------------------
|
||||
http://www.plainblack.com info@plainblack.com
|
||||
-------------------------------------------------------------------
|
||||
|
||||
=cut
|
||||
|
||||
use strict;
|
||||
use base 'WebGUI::Form::File';
|
||||
use WebGUI::International;
|
||||
use WebGUI::Session;
|
||||
use WebGUI::Storage;
|
||||
use WebGUI::Style;
|
||||
use WebGUI::Form::YesNo;
|
||||
use WebGUI::Session;
|
||||
|
||||
=head1 NAME
|
||||
|
||||
Package WebGUI::Form::Image
|
||||
|
||||
=head1 DESCRIPTION
|
||||
|
||||
Creates a text input box form field.
|
||||
|
||||
=head1 SEE ALSO
|
||||
|
||||
This is a subclass of WebGUI::Form::File, and thereform WebGUI::Form::Image.
|
||||
|
||||
=head1 METHODS
|
||||
|
||||
The following methods are specifically available from this class. Check the superclasses for additional methods.
|
||||
|
||||
=cut
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 name
|
||||
|
||||
If no name is specified a default name of "file" will be used.
|
||||
|
||||
=head4 maxAttachments
|
||||
|
||||
Defaults to 1. Determines how many files the user can upload with this form control.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
name=>{
|
||||
defaultValue=>"file"
|
||||
},
|
||||
maxAttachments=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayValue ( )
|
||||
|
||||
This utility method is used to format values for the Profile system. It
|
||||
displays each image in the storage location that is the value of the
|
||||
profile field.
|
||||
|
||||
=cut
|
||||
|
||||
sub displayValue {
|
||||
my ($self) = @_;
|
||||
return '' unless $self->{value};
|
||||
my $location = WebGUI::Storage->get($self->{value});
|
||||
local $_;
|
||||
my @files = map { sprintf qq!<img src="%s" />!, $location->getUrl($_) } @{ $location->getFiles };
|
||||
my $fileValue = join "<br />\n", @files;
|
||||
return $fileValue;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
||||
Returns the human readable name or type of this form control.
|
||||
|
||||
=cut
|
||||
|
||||
sub getName {
|
||||
return WebGUI::International::get("image","WebGUI");
|
||||
}
|
||||
|
||||
1;
|
||||
|
||||
|
||||
|
|
@ -60,6 +60,10 @@ Defaults to 0. Used if no value is specified.
|
|||
|
||||
Defaults to 11. The number of characters that will be displayed at once in this field. Usually no need to override the default.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -74,7 +78,10 @@ sub definition {
|
|||
},
|
||||
size=>{
|
||||
defaultValue=>11
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,6 +57,10 @@ The following additional parameters have been added via this sub class.
|
|||
|
||||
A time interval in seconds that is used if value is not specified. Defaults to 1.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -65,7 +69,10 @@ sub definition {
|
|||
push(@{$definition}, {
|
||||
defaultValue=>{
|
||||
defaultValue=>1,
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ Defaults to 35. Determines the maximum number of characters allowed in this fiel
|
|||
|
||||
Defaults to 30. Specifies how big of a text box to display.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -66,7 +70,10 @@ sub definition {
|
|||
},
|
||||
size=>{
|
||||
defaultValue=>30
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,33 @@ The following methods are specifically available from this class. Check the supe
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
||||
Returns the human readable name or type of this form control.
|
||||
|
|
|
|||
|
|
@ -51,6 +51,10 @@ The following additional parameters have been added via this sub class.
|
|||
|
||||
Defaults to "0". Set to "1" if this field should be checked.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -59,7 +63,10 @@ sub definition {
|
|||
push(@{$definition}, {
|
||||
checked=>{
|
||||
defaultValue=> 0
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -56,6 +56,10 @@ A hash reference containing key values that will be returned with the form post
|
|||
|
||||
Boolean representing whether the checklist should be represented vertically or horizontally. If set to "1" will be displayed vertically. Defaults to "0".
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -67,12 +71,28 @@ sub definition {
|
|||
},
|
||||
vertical=>{
|
||||
defaultValue=>0
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayValue ( )
|
||||
|
||||
Return the all options
|
||||
|
||||
=cut
|
||||
|
||||
sub displayValue {
|
||||
my ($self) = @_;
|
||||
return join ", ", @{ $self->{value} };
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
|
|
|||
|
|
@ -38,6 +38,33 @@ The following methods are specifically available from this class. Check the supe
|
|||
=cut
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 definition ( [ additionalTerms ] )
|
||||
|
||||
See the super class for additional details.
|
||||
|
||||
=head3 additionalTerms
|
||||
|
||||
The following additional parameters have been added via this sub class.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
my $class = shift;
|
||||
my $definition = shift || [];
|
||||
push(@{$definition}, {
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
|
|
|||
|
|
@ -68,6 +68,10 @@ Boolean indicating whether the user can select multiple items from this list lik
|
|||
|
||||
A boolean value for whether or not the values in the options hash should be sorted. Defaults to "0".
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -88,12 +92,28 @@ sub definition {
|
|||
},
|
||||
size=>{
|
||||
defaultValue=>1
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 displayValue ( )
|
||||
|
||||
Return the all options
|
||||
|
||||
=cut
|
||||
|
||||
sub displayValue {
|
||||
my ($self) = @_;
|
||||
return join ", ", @{ $self->{value} };
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getName ()
|
||||
|
|
|
|||
|
|
@ -55,6 +55,10 @@ Defaults to 255. Determines the maximum number of characters allowed in this fie
|
|||
|
||||
Defaults to the setting textBoxSize or 30 if that's not set. Specifies how big of a text box to display.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -66,7 +70,10 @@ sub definition {
|
|||
},
|
||||
size=>{
|
||||
defaultValue=>$session{setting}{textBoxSize} || 30
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ The number of columns (in characters) wide the box should be. Defaults to the se
|
|||
|
||||
The style of wrapping this form should use. Defaults to "virtual". Other possible values are "off" and "physical".
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -73,7 +77,10 @@ sub definition {
|
|||
},
|
||||
wrap=>{
|
||||
defaultValue=>"virtual"
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,6 +59,10 @@ Defaults to 8. Determines the maximum number of characters allowed in this field
|
|||
|
||||
Default to 8. Determines how many characters wide the field wlll be.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -70,7 +74,10 @@ sub definition {
|
|||
},
|
||||
size=>{
|
||||
defaultValue=>8
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ The following additional parameters have been added via this sub class.
|
|||
|
||||
Defaults to 2048. Determines the maximum number of characters allowed in this field.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -60,7 +64,10 @@ sub definition {
|
|||
push(@{$definition}, {
|
||||
maxlength=>{
|
||||
defaultValue=> 2048
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ The following additional parameters have been added via this sub class.
|
|||
|
||||
Can be a 1 or 0. Defaults to 0 if no value is specified.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -60,7 +64,10 @@ sub definition {
|
|||
push(@{$definition}, {
|
||||
defaultValue=>{
|
||||
defaultValue=>0
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,6 +52,10 @@ The following additional parameters have been added via this sub class.
|
|||
|
||||
Defaults to 10. Determines the maximum number of characters allowed in this field.
|
||||
|
||||
=head4 profileEnabled
|
||||
|
||||
Flag that tells the User Profile system that this is a valid form element in a User Profile
|
||||
|
||||
=cut
|
||||
|
||||
sub definition {
|
||||
|
|
@ -60,7 +64,10 @@ sub definition {
|
|||
push(@{$definition}, {
|
||||
maxlength=>{
|
||||
defaultValue=> 10
|
||||
}
|
||||
},
|
||||
profileEnabled=>{
|
||||
defaultValue=>1
|
||||
},
|
||||
});
|
||||
return $class->SUPER::definition($definition);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -130,6 +130,11 @@ our $HELP = {
|
|||
description => 'use preview description',
|
||||
namespace => 'Asset_Collaboration',
|
||||
},
|
||||
{
|
||||
title => 'enable avatars',
|
||||
description => 'enable avatars description',
|
||||
namespace => 'Asset_Collaboration',
|
||||
},
|
||||
{
|
||||
title => 'moderate',
|
||||
description => 'moderate description',
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ use WebGUI::Operation::Auth;
|
|||
use WebGUI::DateTime;
|
||||
use WebGUI::ErrorHandler;
|
||||
use WebGUI::FormProcessor;
|
||||
use WebGUI::Form::DynamicField;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::HTML;
|
||||
use WebGUI::HTMLForm;
|
||||
|
|
@ -36,47 +37,50 @@ use WebGUI::Operation::Shared;
|
|||
# Builds Extra form requirements for anonymous registration.
|
||||
sub getRequiredProfileFields {
|
||||
my ($f,$a,$method,$label,$default,$values,$data,@array);
|
||||
|
||||
|
||||
#$f = WebGUI::HTMLForm->new();
|
||||
|
||||
|
||||
$a = WebGUI::SQL->read("select * from userProfileField, userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId and
|
||||
userProfileField.required=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber",WebGUI::SQL->getSlave);
|
||||
while($data = $a->hashRef) {
|
||||
my %hash = ();
|
||||
$method = $data->{dataType};
|
||||
$label = WebGUI::Operation::Shared::secureEval($data->{fieldLabel});
|
||||
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
|
||||
if ($method eq "selectList") {
|
||||
$values = WebGUI::Operation::Shared::secureEval($data->{dataValues});
|
||||
# note: this big if statement doesn't look elegant, but doing regular ORs caused problems with the array reference.
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = [$session{form}{$data->{fieldName}}];
|
||||
} elsif ($session{user}{$data->{fieldName}}) {
|
||||
$default = [$session{user}{$data->{fieldName}}];
|
||||
}
|
||||
$hash{'profile.formElement'} = WebGUI::Form::selectList({
|
||||
"name"=>$data->{fieldName},
|
||||
"options"=>$values,
|
||||
"value"=>$default
|
||||
});
|
||||
} else {
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = $session{form}{$data->{fieldName}};
|
||||
} elsif (exists $session{user}{$data->{fieldName}}) {
|
||||
$default = $session{user}{$data->{fieldName}};
|
||||
} else {
|
||||
$default = $data->{dataDefault};
|
||||
}
|
||||
|
||||
my $cmd = 'WebGUI::Form::'.$method.'({"name"=>$data->{fieldName},"value"=>$default})';
|
||||
$hash{'profile.formElement'} = eval($cmd);
|
||||
|
||||
}
|
||||
$hash{'profile.formElement.label'} = $label;
|
||||
push(@array,\%hash)
|
||||
}
|
||||
$a->finish;
|
||||
return \@array;
|
||||
userProfileField.required=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber",WebGUI::SQL->getSlave);
|
||||
while($data = $a->hashRef) {
|
||||
my %hash = ();
|
||||
$method = $data->{dataType};
|
||||
$label = WebGUI::Operation::Shared::secureEval($data->{fieldLabel});
|
||||
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
|
||||
if ($method eq "selectList") {
|
||||
$values = WebGUI::Operation::Shared::secureEval($data->{dataValues});
|
||||
# note: this big if statement doesn't look elegant, but doing regular ORs caused problems with the array reference.
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = [$session{form}{$data->{fieldName}}];
|
||||
}
|
||||
elsif ($session{user}{$data->{fieldName}}) {
|
||||
$default = [$session{user}{$data->{fieldName}}];
|
||||
}
|
||||
$hash{'profile.formElement'} = WebGUI::Form::selectList({
|
||||
"name"=>$data->{fieldName},
|
||||
"options"=>$values,
|
||||
"value"=>$default
|
||||
});
|
||||
}
|
||||
else {
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = $session{form}{$data->{fieldName}};
|
||||
}
|
||||
elsif (exists $session{user}{$data->{fieldName}}) {
|
||||
$default = $session{user}{$data->{fieldName}};
|
||||
}
|
||||
else {
|
||||
$default = $data->{dataDefault};
|
||||
}
|
||||
|
||||
my $cmd = 'WebGUI::Form::'.$method.'({"name"=>$data->{fieldName},"value"=>$default})';
|
||||
$hash{'profile.formElement'} = eval($cmd);
|
||||
}
|
||||
$hash{'profile.formElement.label'} = $label;
|
||||
push(@array,\%hash)
|
||||
}
|
||||
$a->finish;
|
||||
return \@array;
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
|
@ -109,105 +113,98 @@ sub saveProfileFields {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub validateProfileData {
|
||||
my (%data, $error, $a, %field, $warning);
|
||||
tie %field, 'Tie::CPHash';
|
||||
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
and userProfileCategory.editable=1 and userProfileField.editable=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
|
||||
while (%field = $a->hash) {
|
||||
my $fieldData = WebGUI::FormProcessor::process($field{fieldName},$field{dataType}, $field{dataDefault});
|
||||
WebGUI::Macro::negate(\$fieldData);
|
||||
$data{$field{fieldName}} = $fieldData;
|
||||
|
||||
if ($field{required} && $data{$field{fieldName}} eq "") {
|
||||
$error .= '<li>'.(WebGUI::Operation::Shared::secureEval($field{fieldLabel})).' '.WebGUI::International::get(451).'</li>';
|
||||
}elsif($field{fieldName} eq "email" && isDuplicateEmail($data{$field{fieldName}})){
|
||||
$warning .= '<li>'.WebGUI::International::get(1072).'</li>';
|
||||
}
|
||||
}
|
||||
$a->finish;
|
||||
return (\%data, $error, $warning);
|
||||
my (%data, $error, $a, %field, $warning);
|
||||
tie %field, 'Tie::CPHash';
|
||||
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
and userProfileCategory.editable=1 and userProfileField.editable=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
|
||||
while (%field = $a->hash) {
|
||||
$data{$field{fieldName}} = WebGUI::Macro::negate(WebGUI::FormProcessor::process($field{fieldName},$field{dataType}, $field{dataDefault}));
|
||||
if ($field{required} && $data{$field{fieldName}} eq "") {
|
||||
$error .= '<li>'.(WebGUI::Operation::Shared::secureEval($field{fieldLabel})).' '.WebGUI::International::get(451).'</li>';
|
||||
}
|
||||
elsif($field{fieldName} eq "email" && isDuplicateEmail($data{$field{fieldName}})){
|
||||
$warning .= '<li>'.WebGUI::International::get(1072).'</li>';
|
||||
}
|
||||
}
|
||||
$a->finish;
|
||||
return (\%data, $error, $warning);
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfile {
|
||||
my ($a, $data, $method, $values, $category, $label, $default, $previousCategory, $subtext, $vars, @profile, @array);
|
||||
return WebGUI::Operation::Auth::www_auth("init") if($session{user}{userId} eq '1');
|
||||
|
||||
$vars->{displayTitle} .= '<h1>'.WebGUI::International::get(338).'</h1>';
|
||||
|
||||
$vars->{'profile.message'} = $_[0] if($_[0]);
|
||||
$vars->{'profile.form.header'} = "\n\n".WebGUI::Form::formHeader({});
|
||||
$vars->{'profile.form.footer'} = WebGUI::Form::formFooter();
|
||||
|
||||
$vars->{'profile.form.hidden'} = WebGUI::Form::hidden({"name"=>"op","value"=>"editProfileSave"});
|
||||
$vars->{'profile.form.hidden'} .= WebGUI::Form::hidden({"name"=>"uid","value"=>$session{user}{userId}});
|
||||
|
||||
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
and userProfileCategory.editable=1 and userProfileField.editable=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
|
||||
my $counter = 0;
|
||||
while($data = $a->hashRef) {
|
||||
$counter++;
|
||||
my %hash = ();
|
||||
$category = WebGUI::Operation::Shared::secureEval($data->{categoryName});
|
||||
$method = $data->{dataType};
|
||||
$label = WebGUI::Operation::Shared::secureEval($data->{fieldLabel});
|
||||
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
|
||||
|
||||
if ($method eq "selectList" || $method eq "checkList" || $method eq "radioList") {
|
||||
$values = WebGUI::Operation::Shared::secureEval($data->{dataValues});
|
||||
my $orderedValues = {};
|
||||
tie %{$orderedValues}, 'Tie::IxHash';
|
||||
foreach my $ov (sort keys %{$values}) {
|
||||
$orderedValues->{$ov} = $values->{$ov};
|
||||
}
|
||||
# note: this big if statement doesn't look elegant, but doing regular ORs caused problems with the array reference.
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = [$session{form}{$data->{fieldName}}];
|
||||
} elsif ($session{user}{$data->{fieldName}}) {
|
||||
$default = [$session{user}{$data->{fieldName}}];
|
||||
}
|
||||
$hash{'profile.form.element'} = WebGUI::Form::selectList({
|
||||
"name"=>$data->{fieldName},
|
||||
"options"=>$values,
|
||||
"value"=>$default
|
||||
});
|
||||
} else {
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = $session{form}{$data->{fieldName}};
|
||||
} elsif (exists $session{user}{$data->{fieldName}}) {
|
||||
$default = $session{user}{$data->{fieldName}};
|
||||
}
|
||||
my $cmd = 'WebGUI::Form::'.$method.'({"name"=>$data->{fieldName},"value"=>$default})';
|
||||
$hash{'profile.form.element'} = eval($cmd);
|
||||
|
||||
}
|
||||
$hash{'profile.form.element.label'} = $label;
|
||||
if ($data->{required}) {
|
||||
$hash{'profile.form.element.subtext'} = "*";
|
||||
}
|
||||
push(@profile,\%hash);
|
||||
if (($previousCategory && $category ne $previousCategory) || $counter eq $a->rows) {
|
||||
my @temp = @profile;
|
||||
my $hashRef;
|
||||
$hashRef->{'profile.form.category'} = $previousCategory;
|
||||
$hashRef->{'profile.form.category.loop'} = \@temp;
|
||||
push(@array,$hashRef);
|
||||
@profile = ();
|
||||
}
|
||||
$previousCategory = $category;
|
||||
}
|
||||
$a->finish;
|
||||
|
||||
my ($a, $data, $previousCategory, $subtext, $vars, @profile, @array);
|
||||
return WebGUI::Operation::Auth::www_auth("init") if($session{user}{userId} eq '1');
|
||||
|
||||
$vars->{displayTitle} .= '<h1>'.WebGUI::International::get(338).'</h1>';
|
||||
|
||||
$vars->{'profile.message'} = $_[0] if($_[0]);
|
||||
$vars->{'profile.form.header'} = "\n\n".WebGUI::Form::formHeader({});
|
||||
$vars->{'profile.form.footer'} = WebGUI::Form::formFooter();
|
||||
|
||||
$vars->{'profile.form.hidden'} = WebGUI::Form::hidden({"name"=>"op","value"=>"editProfileSave"});
|
||||
$vars->{'profile.form.hidden'} .= WebGUI::Form::hidden({"name"=>"uid","value"=>$session{user}{userId}});
|
||||
|
||||
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
and userProfileCategory.editable=1 and userProfileField.editable=1 order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
|
||||
my $counter = 0;
|
||||
while($data = $a->hashRef) {
|
||||
$counter++;
|
||||
my %hash = ();
|
||||
my $category = WebGUI::Operation::Shared::secureEval($data->{categoryName});
|
||||
my $label = WebGUI::Operation::Shared::secureEval($data->{fieldLabel});
|
||||
my $values = WebGUI::Operation::Shared::secureEval($data->{dataValues});
|
||||
my $method = $data->{dataType};
|
||||
my $orderedValues = {};
|
||||
tie %{$orderedValues}, 'Tie::IxHash';
|
||||
foreach my $ov (sort keys %{$values}) {
|
||||
$orderedValues->{$ov} = $values->{$ov};
|
||||
}
|
||||
my $default;
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = $session{form}{$data->{fieldName}};
|
||||
}
|
||||
elsif ($session{user}{$data->{fieldName}}) {
|
||||
$default = $session{user}{$data->{fieldName}};
|
||||
}
|
||||
else {
|
||||
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
|
||||
}
|
||||
my $form = WebGUI::Form::DynamicField->new(
|
||||
name => $data->{fieldName},
|
||||
value => $default,
|
||||
options => $orderedValues,
|
||||
fieldType => $method,
|
||||
);
|
||||
|
||||
$hash{'profile.form.element'} = $form->displayForm();
|
||||
$hash{'profile.form.element.label'} = $label;
|
||||
|
||||
if ($data->{required}) {
|
||||
$hash{'profile.form.element.subtext'} = "*";
|
||||
}
|
||||
if (($previousCategory && $category ne $previousCategory) || $counter eq $a->rows) {
|
||||
my @temp = @profile;
|
||||
my $hashRef;
|
||||
$hashRef->{'profile.form.category'} = $previousCategory;
|
||||
$hashRef->{'profile.form.category.loop'} = \@temp;
|
||||
push(@array,$hashRef);
|
||||
@profile = ();
|
||||
}
|
||||
$previousCategory = $category;
|
||||
push(@profile,\%hash);
|
||||
}
|
||||
$a->finish;
|
||||
|
||||
$vars->{'profile.form.elements'} = \@array;
|
||||
$vars->{'profile.form.submit'} = WebGUI::Form::submit({});
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions();
|
||||
$vars->{'profile.form.submit'} = WebGUI::Form::submit({});
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions();
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new("PBtmpl0000000000000051")->process($vars));
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_editProfileSave {
|
||||
my ($profile, $fieldName, $error, $u, $warning);
|
||||
return WebGUI::Operation::Auth::www_auth("init") if ($session{user}{userId} eq '1');
|
||||
return WebGUI::Operation::Auth::www_auth("init") if ($session{user}{userId} eq '1');
|
||||
|
||||
($profile, $error, $warning) = validateProfileData();
|
||||
$error .= $warning;
|
||||
|
|
@ -215,8 +212,8 @@ sub www_editProfileSave {
|
|||
return www_editProfile('<ul>'.$error.'</ul>') if($error ne "");
|
||||
|
||||
$u = WebGUI::User->new($session{user}{userId});
|
||||
foreach $fieldName (keys %{$profile}) {
|
||||
$u->profileField($fieldName,WebGUI::HTML::filter(${$profile}{$fieldName},"javascript"));
|
||||
foreach $fieldName (keys %{$profile}) {
|
||||
$u->profileField($fieldName,WebGUI::HTML::filter(${$profile}{$fieldName},"javascript"));
|
||||
}
|
||||
WebGUI::Session::refreshUserInfo($session{user}{userId});
|
||||
return WebGUI::Operation::Auth::www_auth();
|
||||
|
|
@ -224,48 +221,63 @@ sub www_editProfileSave {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
sub www_viewProfile {
|
||||
my ($a, %data, $category, $label, $value, $previousCategory, $u, %gender,$vars,@array);
|
||||
%gender = ('neuter'=>WebGUI::International::get(403),'male'=>WebGUI::International::get(339),'female'=>WebGUI::International::get(340));
|
||||
my ($a, %data, $category, $label, $value, $previousCategory, $u, $vars, @array);
|
||||
$u = WebGUI::User->new($session{form}{uid});
|
||||
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(347).' '.$u->username.'</h1>';
|
||||
$vars->{displayTitle} = '<h1>'.WebGUI::International::get(347).' '.$u->username.'</h1>';
|
||||
|
||||
return WebGUI::Privilege::notMember() if($u->username eq "");
|
||||
|
||||
return WebGUI::Operation::Shared::userStyle($vars->{displayTitle}.WebGUI::International::get(862)) if($u->profileField("publicProfile") < 1 && ($session{user}{userId} ne $session{form}{uid} || WebGUI::Grouping::isInGroup(3)));
|
||||
|
||||
return WebGUI::Privilege::insufficient() if(!WebGUI::Grouping::isInGroup(2));
|
||||
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
|
||||
$a = WebGUI::SQL->read("select * from userProfileField,userProfileCategory where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
and userProfileCategory.visible=1 and userProfileField.visible=1 order by userProfileCategory.sequenceNumber,
|
||||
userProfileField.sequenceNumber",WebGUI::SQL->getSlave);
|
||||
while (%data = $a->hash) {
|
||||
$category = WebGUI::Operation::Shared::secureEval($data{categoryName});
|
||||
if ($category ne $previousCategory) {
|
||||
my $header;
|
||||
$header->{'profile.category'} = $category;
|
||||
push(@array,$header);
|
||||
}
|
||||
|
||||
$label = WebGUI::Operation::Shared::secureEval($data{fieldLabel});
|
||||
if ($data{dataValues}) {
|
||||
$value = WebGUI::Operation::Shared::secureEval($data{dataValues});
|
||||
$value = ${$value}{$u->profileField($data{fieldName})};
|
||||
} else {
|
||||
$value = $u->profileField($data{fieldName});
|
||||
}
|
||||
if ($data{dataType} eq "date") {
|
||||
$value = WebGUI::DateTime::epochToHuman($value,"%z");
|
||||
}
|
||||
unless ($data{fieldName} eq "email" and $u->profileField("publicEmail") < 1) {
|
||||
my $hash;
|
||||
$hash->{'profile.label'} = $label;
|
||||
$hash->{'profile.value'} = $value;
|
||||
push(@array,$hash);
|
||||
}
|
||||
$previousCategory = $category;
|
||||
}
|
||||
$vars->{'profile.elements'} = \@array;
|
||||
$a->finish;
|
||||
if ($session{user}{userId} eq $session{form}{uid}) {
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions();
|
||||
|
||||
while (%data = $a->hash) {
|
||||
|
||||
$category = WebGUI::Operation::Shared::secureEval($data{categoryName});
|
||||
if ($category ne $previousCategory) {
|
||||
my $header;
|
||||
$header->{'profile.category'} = $category;
|
||||
push(@array,$header);
|
||||
$previousCategory = $category;
|
||||
}
|
||||
|
||||
next if ($data{fieldName} eq "email" and $u->profileField("publicEmail"));
|
||||
|
||||
$label = WebGUI::Operation::Shared::secureEval($data{fieldLabel});
|
||||
|
||||
##If the form field has multiple selections, only display the one the user
|
||||
##currently has selected.
|
||||
if ($data{dataValues}) {
|
||||
$value = WebGUI::Operation::Shared::secureEval($data{dataValues});
|
||||
$value = ${$value}{$u->profileField($data{fieldName})};
|
||||
}
|
||||
else {
|
||||
$value = $u->profileField($data{fieldName});
|
||||
}
|
||||
|
||||
my $form = WebGUI::Form::DynamicField->new(
|
||||
value => $value,
|
||||
fieldType => $data{dataType},
|
||||
);
|
||||
|
||||
$value = $form->displayValue();
|
||||
|
||||
my $hash;
|
||||
|
||||
$hash->{'profile.label'} = $label;
|
||||
$hash->{'profile.value'} = $value;
|
||||
push(@array,$hash);
|
||||
}
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new("PBtmpl0000000000000052")->process($vars));
|
||||
$vars->{'profile.elements'} = \@array;
|
||||
$a->finish;
|
||||
if ($session{user}{userId} eq $session{form}{uid}) {
|
||||
$vars->{'profile.accountOptions'} = WebGUI::Operation::Shared::accountOptions();
|
||||
}
|
||||
return WebGUI::Operation::Shared::userStyle(WebGUI::Asset::Template->new("PBtmpl0000000000000052")->process($vars));
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ use WebGUI::Privilege;
|
|||
use WebGUI::Session;
|
||||
use WebGUI::SQL;
|
||||
use WebGUI::Operation::Shared;
|
||||
use WebGUI::Form::FieldType;
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
sub _reorderCategories {
|
||||
|
|
@ -212,14 +213,24 @@ sub www_editProfileField {
|
|||
-hoverHelp=>WebGUI::International::get('474 description',"WebGUIProfile"),
|
||||
-value=>$data{required}
|
||||
);
|
||||
$f->fieldType(
|
||||
#WebGUI::ErrorHandler::warn("type=".$data{dataType});
|
||||
my $fieldType = WebGUI::Form::FieldType->new(
|
||||
-name=>"dataType",
|
||||
-label=>WebGUI::International::get(486,"WebGUIProfile"),
|
||||
-hoverHelp=>WebGUI::International::get('486 description',"WebGUIProfile"),
|
||||
-value=>$data{dataType},
|
||||
-defaultValue=>"text",
|
||||
-types=>[qw(dateTime timeZone TimeField float zipcode text textarea HTMLArea url date email phone integer yesNo selectList radioList checkList)]
|
||||
);
|
||||
-value=>ucfirst $data{dataType},
|
||||
-defaultValue=>"Text",
|
||||
);
|
||||
my @profileForms = ();
|
||||
foreach my $form ( sort @{ $fieldType->{types} }) {
|
||||
my $cmd = join '::', 'WebGUI::Form', $form;
|
||||
eval "use $cmd";
|
||||
my $w = eval "$cmd->new();";
|
||||
push @profileForms, $form if $w->{profileEnabled};
|
||||
}
|
||||
|
||||
$fieldType->{types} = \@profileForms;
|
||||
$f->raw($fieldType->toHtmlWithWrapper());
|
||||
$f->textarea(
|
||||
-name => "dataValues",
|
||||
-label => WebGUI::International::get(487,"WebGUIProfile"),
|
||||
|
|
|
|||
|
|
@ -15,10 +15,11 @@ use Tie::CPHash;
|
|||
use Tie::IxHash;
|
||||
use WebGUI::AdminConsole;
|
||||
use WebGUI::DateTime;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::FormProcessor;
|
||||
use WebGUI::Group;
|
||||
use WebGUI::Grouping;
|
||||
use WebGUI::Form;
|
||||
use WebGUI::Form::DynamicField;
|
||||
use WebGUI::HTMLForm;
|
||||
use WebGUI::Icon;
|
||||
use WebGUI::International;
|
||||
|
|
@ -278,48 +279,39 @@ sub www_editUser {
|
|||
where userProfileField.profileCategoryId=userProfileCategory.profileCategoryId
|
||||
order by userProfileCategory.sequenceNumber,userProfileField.sequenceNumber");
|
||||
my $previousCategory;
|
||||
while(my %data = $a->hash) {
|
||||
my $category = WebGUI::Operation::Shared::secureEval($data{categoryName});
|
||||
while(my $data = $a->hashRef) {
|
||||
my $category = WebGUI::Operation::Shared::secureEval($data->{categoryName});
|
||||
if ($category ne $previousCategory) {
|
||||
$tabform->getTab("profile")->raw('<tr><td colspan="2" class="tableHeader">'.$category.'</td></tr>');
|
||||
}
|
||||
my $values = WebGUI::Operation::Shared::secureEval($data{dataValues});
|
||||
my $method = $data{dataType};
|
||||
my $label = WebGUI::Operation::Shared::secureEval($data{fieldLabel});
|
||||
my $values = WebGUI::Operation::Shared::secureEval($data->{dataValues});
|
||||
my $method = $data->{dataType};
|
||||
my $label = WebGUI::Operation::Shared::secureEval($data->{fieldLabel});
|
||||
my $default;
|
||||
if ($method eq "selectList" || $method eq "checkList" || $method eq "radioList") {
|
||||
my $orderedValues = {};
|
||||
tie %{$orderedValues}, 'Tie::IxHash';
|
||||
foreach my $ov (sort keys %{$values}) {
|
||||
$orderedValues->{$ov} = $values->{$ov};
|
||||
}
|
||||
if ($session{form}{$data{fieldName}}) {
|
||||
$default = [$session{form}{$data{fieldName}}];
|
||||
} elsif (defined $u->profileField($data{fieldName}) && (defined($values->{$u->profileField($data{fieldName})}))) {
|
||||
$default = [$u->profileField($data{fieldName})];
|
||||
} else {
|
||||
$default = WebGUI::Operation::Shared::secureEval($data{dataDefault});
|
||||
}
|
||||
$tabform->getTab("profile")->$method(
|
||||
-name=>$data{fieldName},
|
||||
-options=>$orderedValues,
|
||||
-label=>$label,
|
||||
-value=>$default
|
||||
);
|
||||
} elsif ($method) {
|
||||
if ($session{form}{$data{fieldName}}) {
|
||||
$default = $session{form}{$data{fieldName}};
|
||||
} elsif (defined $u->profileField($data{fieldName})) {
|
||||
$default = $u->profileField($data{fieldName});
|
||||
} else {
|
||||
$default = WebGUI::Operation::Shared::secureEval($data{dataDefault});
|
||||
}
|
||||
$tabform->getTab("profile")->$method(
|
||||
-name=>$data{fieldName},
|
||||
-label=>$label,
|
||||
-value=>$default
|
||||
);
|
||||
}
|
||||
my $orderedValues = {};
|
||||
tie %{$orderedValues}, 'Tie::IxHash';
|
||||
foreach my $ov (sort keys %{$values}) {
|
||||
$orderedValues->{$ov} = $values->{$ov};
|
||||
}
|
||||
if ($session{form}{$data->{fieldName}}) {
|
||||
$default = $session{form}{$data->{fieldName}};
|
||||
}
|
||||
elsif ($session{user}{$data->{fieldName}}) {
|
||||
$default = $session{user}{$data->{fieldName}};
|
||||
}
|
||||
else {
|
||||
$default = WebGUI::Operation::Shared::secureEval($data->{dataDefault});
|
||||
}
|
||||
|
||||
my $form = WebGUI::Form::DynamicField->new(
|
||||
name => $data->{fieldName},
|
||||
label => $label,
|
||||
value => $default,
|
||||
options => $orderedValues,
|
||||
fieldType => $method,
|
||||
);
|
||||
|
||||
$tabform->getTab("profile")->raw($form->displayFormWithWrapper());
|
||||
$previousCategory = $category;
|
||||
}
|
||||
$a->finish;
|
||||
|
|
|
|||
|
|
@ -1266,6 +1266,15 @@ A URL for sorting and displaying the list of posts by their ratings.
|
|||
lastUpdated => 1114467741,
|
||||
},
|
||||
|
||||
'enable avatars' => {
|
||||
message => q|Enable Avatars?|,
|
||||
lastUpdated => 1131432414,
|
||||
},
|
||||
|
||||
'enable avatars description' => {
|
||||
message => q|<p>Select "Yes" to display Avatars for users in the Collaboration System. The Avatar field inthe User Profile has to be enabled, and users will need to upload an Avatar image to display.</p><p>Using Avatars will slow down the performance of Collaboration Systems.</p>|,
|
||||
lastUpdated => 1131432717,
|
||||
},
|
||||
|
||||
'collaboration rss template title' => {
|
||||
message => q|Collaboration RSS Template|,
|
||||
|
|
|
|||
|
|
@ -367,6 +367,11 @@ Be aware that any database links you create here will be available to all conten
|
|||
lastUpdated => 1031514049
|
||||
},
|
||||
|
||||
'392' => {
|
||||
message => q|Delete this file?|,
|
||||
lastUpdated => 1131831533,
|
||||
},
|
||||
|
||||
'743' => {
|
||||
message => q|You must specify a valid email address in order to attempt to recover your password.|,
|
||||
lastUpdated => 1035246389
|
||||
|
|
@ -3248,6 +3253,12 @@ that Asset and all Assets below it.</p>
|
|||
context => q|Field type name|
|
||||
},
|
||||
|
||||
'image' => {
|
||||
message => q|Image|,
|
||||
lastUpdated =>0,
|
||||
context => q|Field type name|
|
||||
},
|
||||
|
||||
'codearea' => {
|
||||
message => q|Code Area|,
|
||||
lastUpdated =>0,
|
||||
|
|
@ -3803,6 +3814,16 @@ Message Boards hold forums for users. There are many different Wobjects in WebG
|
|||
lastUpdated => 1128919994,
|
||||
},
|
||||
|
||||
'photo' => {
|
||||
message => q|Photo|,
|
||||
lastUpdated => 1131246503,
|
||||
},
|
||||
|
||||
'avatar' => {
|
||||
message => q|Avatar|,
|
||||
lastUpdated => 1131246512,
|
||||
},
|
||||
|
||||
};
|
||||
|
||||
1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue