More UserList sort options
This commit is contained in:
parent
160ae78f61
commit
a49c94cde8
3 changed files with 43 additions and 6 deletions
|
|
@ -253,6 +253,7 @@ sub prepareView {
|
|||
sub view {
|
||||
|
||||
my $self = shift;
|
||||
my $form = $self->session->form;
|
||||
my $i18n = WebGUI::International->new($self->session, "Asset_UserList");
|
||||
my (%var, @users, @profileField_loop, @profileFields,@profileFieldNames);
|
||||
my ($defaultPublicProfile, $defaultPublicEmail, $user, $sth, $sql, $profileField);
|
||||
|
|
@ -276,6 +277,14 @@ sub view {
|
|||
push(@profileFieldNames, $profileField->{fieldName});
|
||||
unless($self->get("showOnlyVisibleAsNamed") && $profileField->{visible} != 1){
|
||||
$var{'profileField_'.$profileField->{fieldName}.'_label'} = $label;
|
||||
my $sortByURL = '?orderBy='.$profileField->{fieldName};
|
||||
if ($form->process('orderType') eq 'asc' && $form->process('orderBy') eq $profileField->{fieldName}){
|
||||
$sortByURL .= ';orderType=desc';
|
||||
}
|
||||
else{
|
||||
$sortByURL .= ';orderType=asc';
|
||||
}
|
||||
$var{'profileField_'.$profileField->{fieldName}.'_sortByURL'} = $sortByURL;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -292,9 +301,11 @@ sub view {
|
|||
my $constraint;
|
||||
if ($self->session->form->process('search')){
|
||||
$constraint = "(".join(' or ', map {'userProfileData.'.$_->{fieldName}.' like "%'.$self->session->form->process('search').'%"'} @profileFields).")";
|
||||
}elsif ($self->session->form->process('searchExact')){
|
||||
}
|
||||
elsif ($self->session->form->process('searchExact')){
|
||||
$constraint = "(".join(' or ', map {'userProfileData.'.$_->{fieldName}.' like "'.$self->session->form->process('searchExact').'"'} @profileFields).")";
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
my @profileSearchFields = ();
|
||||
my @profileSearchExactFields = ();
|
||||
foreach my $profileField (@profileFields){
|
||||
|
|
@ -371,7 +382,8 @@ sub view {
|
|||
push (@profileFieldValues, {
|
||||
"profile_emailNotPublic"=>1,
|
||||
});
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
push (@profileFieldValues, {
|
||||
"profile_value"=>$user->{$profileField->{fieldName}},
|
||||
});
|
||||
|
|
@ -389,7 +401,8 @@ sub view {
|
|||
$userProperties{"user_name"} = $user->{userName};
|
||||
$userProperties{"user_profile_loop"} = \@profileFieldValues;
|
||||
push(@users,\%userProperties);
|
||||
}else{
|
||||
}
|
||||
else{
|
||||
push(@users, {
|
||||
"user_id"=>$user->{userId},
|
||||
"user_name"=>$user->{userName},
|
||||
|
|
@ -400,6 +413,7 @@ sub view {
|
|||
foreach my $profileField (@profileFields){
|
||||
push (@profileField_loop, {
|
||||
"profileField_label"=>WebGUI::Operation::Shared::secureEval($self->session,$profileField->{label}),
|
||||
"profileField_sortByURL"=>'?orderBy='.$profileField->{fieldName},
|
||||
});
|
||||
}
|
||||
$var{numberOfProfileFields} = scalar(@profileFields);
|
||||
|
|
|
|||
|
|
@ -27,9 +27,12 @@ our $HELP = {
|
|||
{ 'name' => 'searchFormTypeSelect' },
|
||||
{ 'name' => 'searchFormQuery_form' },
|
||||
{ 'name' => 'numberOfProfileFields' },
|
||||
{ 'name' => 'profileField_PROFILEFIELDNAME_label' },
|
||||
{ 'name' => 'profileField_PROFILEFIELDNAME_sortByURL' },
|
||||
{ 'name' => 'profileField_loop',
|
||||
'variables' => [
|
||||
{ 'name' => 'profileField_label' },
|
||||
{ 'name' => 'profileField_sortByURL' },
|
||||
],
|
||||
},
|
||||
{ 'name' => 'alphabetSearch_loop',
|
||||
|
|
|
|||
|
|
@ -240,12 +240,32 @@ true for the 'email' profile field.|,
|
|||
},
|
||||
|
||||
'profileField_loop' => {
|
||||
message => q|A loop contining profile fields|,
|
||||
message => q|A loop containing profile fields|,
|
||||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
'profileField_label' => {
|
||||
message => q|The label for a profile field|,
|
||||
message => q|The label for this profile field|,
|
||||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
|
||||
'profileField_sortByURL' => {
|
||||
message => q|The URL to sort the UserList by this profile field. The default sort order
|
||||
is ascending. After clicking the sort by link for a profile field the sort order will be reversed.|,
|
||||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
'profileField_PROFILEFIELDNAME_label' => {
|
||||
message => q|The label for the profile field with fieldName PROFILEFIELDNAME. Example <tmpl_var
|
||||
profileField_lastName_label>. This tmpl_var exists outside of the profileField_loop.|,
|
||||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
'profileField_PROFILEFIELDNAME_sortByURL' => {
|
||||
message => q|The URL to sort the UserList by PROFILEFIELDNAME. Example <tmpl_var
|
||||
profileField_lastName_sortByURL>. This tmpl_var exists outside of the profileField_loop. The default sort order
|
||||
is ascending. After clicking the sort by link for a profile field the sort order will be reversed.|,
|
||||
lastUpdated => 1081514049
|
||||
},
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue