diff --git a/docs/changelog/6.x.x.txt b/docs/changelog/6.x.x.txt index 0e802fc4f..6e46aedd5 100644 --- a/docs/changelog/6.x.x.txt +++ b/docs/changelog/6.x.x.txt @@ -50,6 +50,8 @@ - Added prepared statement handlers to WebGUI::SQL. - Added transaction handlers to WebGUI::SQL. - Added additional debugging to WebGUI::SQL. + - Added a better user search mechanism, which works well even with 100,000 + users. 6.0.3 diff --git a/docs/migration.txt b/docs/migration.txt index dc5b82e93..6766be221 100644 --- a/docs/migration.txt +++ b/docs/migration.txt @@ -140,6 +140,11 @@ gen61i18nfrom60data.pl We also made the International API object oriented. The old procedural version is still intact as well. See WebGUI::International for API changes. +As a developer you can convert your translations (including English) and your +help files using a script we provide. You can find the script here: + +http://www.plainblack.com/translations?wid=1552&func=viewSubmission&sid=1213 + 5.8 WebGUI::Session Changes In 6.1 we changed the session API to remove functions that didn't really diff --git a/lib/WebGUI/Operation/User.pm b/lib/WebGUI/Operation/User.pm index 592f140b5..697866584 100644 --- a/lib/WebGUI/Operation/User.pm +++ b/lib/WebGUI/Operation/User.pm @@ -468,8 +468,8 @@ sub www_listUsers { return WebGUI::Privilege::adminOnly() unless (WebGUI::Grouping::isInGroup(3)); WebGUI::Session::setScratch("userSearchKeyword",$session{form}{keyword}); WebGUI::Session::setScratch("userSearchStatus",$session{form}{status}); - my ($output, $data, $f, $rows, $p, $search, %status, $selectedStatus); - $output = helpIcon(8); + my ($data, $rows, $p, %status, $selectedStatus); + my $output = helpIcon(8); $output .= '

'.WebGUI::International::get(149).'

'; $output .= '
'; tie %status, 'Tie::IxHash'; @@ -479,10 +479,27 @@ sub www_listUsers { Deactivated => WebGUI::International::get(818), Selfdestructed => WebGUI::International::get(819) ); - $f = WebGUI::HTMLForm->new(1); + my $f = WebGUI::HTMLForm->new(1); $f->hidden("op","listUsers"); - $f->text("keyword",'',$session{scratch}{userSearchKeyword}); - $f->select( + $f->hidden( + -name=>"doit", + -value=>1 + ); + $f->selectList( + -name=>"modifier", + -value=>([$session{form}{modifier}] || ["contains"]), + -options=>{ + startsWith=>WebGUI::International::get("starts with"), + contains=>WebGUI::International::get("contains"), + endsWith=>WebGUI::International::get("ends with") + } + ); + $f->text( + -name=>"keyword", + -value=>$session{scratch}{userSearchKeyword}, + -size=>15 + ); + $f->selectList( -name => "status", -value => [$session{form}{status} || "users.status like '%'"], -options=> \%status @@ -490,6 +507,7 @@ sub www_listUsers { $f->submit(WebGUI::International::get(170)); $output .= $f->print; $output .= '
'; + return _submenu($output) unless ($session{form}{doit}); $output .= ''; $output .= ' @@ -505,16 +523,18 @@ sub www_listUsers { } else { $selectedStatus = "status like '%'"; } - if ($session{scratch}{userSearchKeyword} ne "") { - $search = " and (users.username like ".quote("%".$session{scratch}{userSearchKeyword}."%") - ." or email.fieldData like ".quote("%".$session{scratch}{userSearchKeyword}."%").")"; + my $keyword = $session{scratch}{userSearchKeyword}; + if ($session{form}{modifier} eq "startsWith") { + $keyword .= "%"; + } elsif ($session{form}{modifier} eq "contains") { + $keyword = "%".$keyword."%"; + } else { + $keyword = "%".$keyword; } $p = WebGUI::Paginator->new(WebGUI::URL::page("op=listUsers")); $p->setDataByQuery("select users.userId, users.username, users.status, users.dateCreated, users.lastUpdated, - email.fieldData as email - from users left join userProfileData email on users.userId=email.userId and - email.fieldName='email' - where $selectedStatus $search order by users.username"); + email.fieldData as email from users left join userProfileData email on users.userId=email.userId and email.fieldName='email' + where $selectedStatus and (users.username like ".quote($keyword)." or email.fieldData like ".quote($keyword).") order by users.username"); $rows = $p->getPageData; foreach $data (@$rows) { $output .= ''; diff --git a/lib/WebGUI/i18n/English/WebGUI.pm b/lib/WebGUI/i18n/English/WebGUI.pm index 1c76b75f1..cdae7c454 100644 --- a/lib/WebGUI/i18n/English/WebGUI.pm +++ b/lib/WebGUI/i18n/English/WebGUI.pm @@ -7118,6 +7118,24 @@ Following a guide like the above will help you get good ranking on search engine lastUpdated => 1056151382 }, + 'starts with' => { + message => q|Starts With|, + lastUpdated => 1089039511, + context => 'A phrase or word begins with this.' + }, + + 'contains' => { + message => q|Contains|, + lastUpdated => 1089039511, + context => 'A phrase or word contains this.' + }, + + 'ends with' => { + message => q|Ends With|, + lastUpdated => 1089039511, + context => q|A phrase or word ends with this.| + } + }; 1;
'.WebGUI::International::get(816).'