Added tmpl_vars for files to UserList
This commit is contained in:
parent
4cba70e772
commit
9229c9a883
3 changed files with 67 additions and 3 deletions
|
|
@ -13,6 +13,7 @@ use WebGUI::Operation::Shared;
|
|||
use WebGUI::International;
|
||||
use WebGUI::Pluggable;
|
||||
use WebGUI::Form::Image;
|
||||
use WebGUI::Form::File;
|
||||
use base 'WebGUI::Asset::Wobject';
|
||||
|
||||
=head1 LEGAL
|
||||
|
|
@ -70,6 +71,48 @@ sub getAlphabetSearchLoop {
|
|||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFieldValue ( value, field )
|
||||
|
||||
Processes the field value for date(Time) fields and Other Thing fields.
|
||||
|
||||
=head3 value
|
||||
|
||||
The value as stored in the database.
|
||||
|
||||
=head3 field
|
||||
|
||||
A reference to a hash containing the fields properties.
|
||||
|
||||
=cut
|
||||
|
||||
sub getFieldValue {
|
||||
|
||||
my $self = shift;
|
||||
my $value = shift;
|
||||
my $field = shift;
|
||||
my $dateFormat = shift || "%z";
|
||||
my $dateTimeFormat = shift;
|
||||
my $processedValue = $value;
|
||||
|
||||
if ($field->{fieldType} eq "date"){
|
||||
$processedValue = $self->session->datetime->epochToHuman($value,$dateFormat);
|
||||
}
|
||||
elsif ($field->{fieldType} eq "dateTime"){
|
||||
$processedValue = $self->session->datetime->epochToHuman($value,$dateTimeFormat);
|
||||
}
|
||||
elsif (WebGUI::Utility::isIn(ucfirst $field->{fieldType},qw(File Image))) {
|
||||
$processedValue = WebGUI::Form::DynamicField->new($self->session,
|
||||
fieldType=>$field->{fieldType},
|
||||
value=>$value
|
||||
)->getValueAsHtml();
|
||||
}
|
||||
|
||||
return $processedValue;
|
||||
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------
|
||||
|
||||
=head2 getFormElement ( data )
|
||||
|
||||
Returns the form element tied to this field.
|
||||
|
|
@ -514,10 +557,17 @@ sub view {
|
|||
$profileFieldName =~ s/ /_/g;
|
||||
$profileFieldName =~ s/\./_/g;
|
||||
my $value = $user->{$profileField->{fieldName}};
|
||||
my %profileFieldValues;
|
||||
if (WebGUI::Utility::isIn(ucfirst $profileField->{fieldType},qw(File Image)) && $value ne ''){
|
||||
my $file = $self->getFieldValue($value,{
|
||||
fieldType=>$profileField->{fieldType}
|
||||
});
|
||||
$profileFieldValues{profile_file} = $file;
|
||||
$userProperties{'user_profile_'.$profileFieldName.'_file'} = $file;
|
||||
}
|
||||
$profileFieldValues{profile_value} = $value;
|
||||
if($profileField->{visible}){
|
||||
push (@profileFieldValues, {
|
||||
"profile_value"=>$value,
|
||||
});
|
||||
push (@profileFieldValues, \%profileFieldValues);
|
||||
}
|
||||
unless($self->get("showOnlyVisibleAsNamed") && $profileField->{visible} != 1){
|
||||
$userProperties{'user_profile_'.$profileFieldName.'_value'} = $value;
|
||||
|
|
|
|||
|
|
@ -54,11 +54,13 @@ our $HELP = {
|
|||
{ 'name' => 'user_name' },
|
||||
{ 'name' => 'user_id' },
|
||||
{ 'name' => 'user_profile_PROFILEFIELDNAME_value' },
|
||||
{ 'name' => 'user_profile_PROFILEFIELDNAME_file' },
|
||||
{ 'name' => 'user_profile_emailNotPublic' },
|
||||
{ 'name' => 'user_profile_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'profile_emailNotPublic' },
|
||||
{ 'name' => 'profile_value' },
|
||||
{ 'name' => 'profile_file' },
|
||||
],
|
||||
},
|
||||
],
|
||||
|
|
|
|||
|
|
@ -300,6 +300,13 @@ profile. Example <tmpl_var user_profile_firstName_value>|,
|
|||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
'user_profile_PROFILEFIELDNAME_file' => {
|
||||
message => q|The file for the profile field with the name PROFILEFIELDNAME in the users user
|
||||
profile. Example <tmpl_var user_profile_firstName_file>. This is available if the profile field is a file or
|
||||
an image.|,
|
||||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
'user_profile_emailNotPublic' => {
|
||||
message => q|A conditional that is true if the users email address is not public.|,
|
||||
lastUpdated => 1081514049
|
||||
|
|
@ -321,6 +328,11 @@ true for the 'email' profile field.|,
|
|||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
'profile_value' => {
|
||||
message => q|The file for this profile field, available if the profile field is an image or file.|,
|
||||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
'profileField_loop' => {
|
||||
message => q|A loop containing profile fields|,
|
||||
lastUpdated => 1081514049
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue