diff --git a/docs/changelog/7.x.x.txt b/docs/changelog/7.x.x.txt index 010b1a9ab..4f06fb807 100644 --- a/docs/changelog/7.x.x.txt +++ b/docs/changelog/7.x.x.txt @@ -32,6 +32,8 @@ - fixed #8776: duplicate does not duplicate keywords - rfe: Thingy: export extra rows, meta data (SDH Consulting Group) - rfe: Thingy: Max entries per user (SDH Consulting Group) + - fixed: #4174: UserList template show links that should be hidden (Yung Han + Khoe) 7.6.0 - added: users may now customize the post received page for the CS diff --git a/lib/WebGUI/Asset/Wobject/UserList.pm b/lib/WebGUI/Asset/Wobject/UserList.pm index fa9a670be..fb61011ff 100644 --- a/lib/WebGUI/Asset/Wobject/UserList.pm +++ b/lib/WebGUI/Asset/Wobject/UserList.pm @@ -50,16 +50,28 @@ Returns an array ref that contains tmpl_vars for the Alphabet Search. sub getAlphabetSearchLoop { my $self = shift; - my $fieldName = shift || 'lastName'; + my $fieldName = shift; my $alphabet = shift; my (@alphabet, @alphabetLoop); + + return [] if $fieldName eq 'disableAlphabetSearch'; $alphabet ||= "a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w,x,y,z"; @alphabet = split(/,/,$alphabet); foreach my $letter (@alphabet){ my $htmlEncodedLetter = encode_entities($letter); my $searchURL = "?searchExact_".$fieldName."=".$letter."%25"; - my $hasResults = $self->session->db->quickScalar("select if (" - ."(select count(*) from userProfileData where ".$fieldName." like '".$letter."%')<>0, 1, 0)"); + my $hasResults; + my $users = $self->session->db->read("select userId from userProfileData where lastName like '".$letter."%'"); + while (my $user = $users->hashRef){ + my $showGroupId = $self->get("showGroupId"); + if ($showGroupId eq '0' || ($showGroupId && $self->isInGroup($showGroupId,$user->{userId}))){ + unless ($self->get("hideGroupId") ne '0' && $self->isInGroup($self->get("hideGroupId"),$user->{userId})){ + $hasResults = 1; + last; + } + } + } + push @alphabetLoop, { alphabetSearch_loop_label => $htmlEncodedLetter || $letter, alphabetSearch_loop_hasResults => $hasResults, @@ -162,6 +174,9 @@ sub definition { my $label = WebGUI::Operation::Shared::secureEval($session,$field->{label}); $profileFields{$field->{fieldName}} = $label; } + my %alphabetSearchFieldOptions; + tie %alphabetSearchFieldOptions, 'Tie::IxHash'; + %alphabetSearchFieldOptions = ('disableAlphabetSearch'=>'Disable Alphabet Search',%profileFields); tie %properties, 'Tie::IxHash'; %properties = ( @@ -206,7 +221,7 @@ sub definition { fieldType=>"selectBox", defaultValue=>"lastName", tab=>"display", - options=>\%profileFields, + options=>\%alphabetSearchFieldOptions, label=>$i18n->get("alphabetSearchField label"), hoverHelp=>$i18n->get('alphabetSearchField description'), }, diff --git a/lib/WebGUI/i18n/English/Asset_UserList.pm b/lib/WebGUI/i18n/English/Asset_UserList.pm index d2e591ab5..cf465d322 100644 --- a/lib/WebGUI/i18n/English/Asset_UserList.pm +++ b/lib/WebGUI/i18n/English/Asset_UserList.pm @@ -150,8 +150,10 @@ seperated values|, }, 'alphabetSearchField description' => { - message => q|Select the profile field in which the alphabet search will be done.|, - lastUpdated => 1081514049 + message => q|Select the profile field in which the alphabet search will be done. You can disable +the aplhapbet search function by selecting 'Disable Alphabet Search'. This will improve the performance of the +User List.|, + lastUpdated => 1223651066 }, 'Profile not public message' => {