From: <de...@de...> - 2012-11-29 08:25:19
|
Author: PeterThoeny Date: 2012-11-29 02:25:08 -0600 (Thu, 29 Nov 2012) New Revision: 24229 Trac url: http://develop.twiki.org/trac/changeset/24229 Modified: twiki/trunk/core/data/TWiki/SearchResultsPagination.txt twiki/trunk/core/data/TWiki/TWikiPreferences.txt twiki/trunk/core/data/TWiki/WebChanges.txt twiki/trunk/core/data/TWiki/WebSearch.txt twiki/trunk/core/data/TWiki/WebSearchAdvanced.txt Log: Item7061: Search Results Pagination - use a new SEARCHRESULTSPERPAGE preferences setting to define the default number of results to show, default set to 50 (can be overloaded as a user preferences setting) Modified: twiki/trunk/core/data/TWiki/SearchResultsPagination.txt =================================================================== --- twiki/trunk/core/data/TWiki/SearchResultsPagination.txt 2012-11-29 07:41:03 UTC (rev 24228) +++ twiki/trunk/core/data/TWiki/SearchResultsPagination.txt 2012-11-29 08:25:08 UTC (rev 24229) @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="TWikiContributor" date="1354162767" format="1.1" version="$Rev$"}% +%META:TOPICINFO{author="TWikiContributor" date="1354177288" format="1.1" version="$Rev$"}% ---+ Search Results Pagination When a =%<nop>SEARCH{...}%= returns many results, you may want to paginate the results. @@ -40,7 +40,7 @@ ---++ Results per page -By default, each page shows 20 results. +By default, each page shows %SEARCHRESULTSPERPAGE% results, which is defined by the SEARCHRESULTSPERPAGE preferences setting. To change it to 10, change the initial part as follows. (The second line is inserted.) <verbatim> @@ -48,7 +48,7 @@ %CALCULATE{$SET(limit, %URLPARAM{"limit" default="10"}%)}%<nop> %SEARCH{ </verbatim> -If you specify =limit=50= URL parameter manually, that's observed. +If you specify =limit=20= URL parameter manually, that's observed. If you specify =limit=all= URL parameter, all results are shown without pagination. ---++ URL parameters @@ -78,7 +78,7 @@ <!-- %STARTSECTION{"preamble"}% %CALCULATE{$SET(start, %URLPARAM{"start" default="0"}%)}%<nop> -%CALCULATE{$SET(limit, %URLPARAM{"limit" default="20"}%)}%<nop> +%CALCULATE{$SET(limit, %URLPARAM{"limit" default="%SEARCHRESULTSPERPAGE%"}%)}%<nop> %CALCULATE{$SET(ntopics, 0)}%<nop> <div id="searchTopNav%INCLUDINGTOPIC%" style="margin-bottom: 1em; %IF{ "defined 'style'" then="%style%" }%"></div> %ENDSECTION{"preamble"}% @@ -86,7 +86,7 @@ %STARTSECTION{"postamble"}% <div id="searchBottomNav%INCLUDINGTOPIC%" style="%IF{ "defined 'style'" then="%style%" }%"> %CALCULATE{$SET(gray, <span style='color: gray;'>)}%<nop> -%CALCULATE{$SET(numlimit, $IF($SEARCH(^\d+$, $GET(limit)) > 0, $GET(limit), 100000))}%<nop> +%CALCULATE{$SET(numlimit, $IF($VALUE($GET(limit)) > 0, $GET(limit), 100000))}%<nop> %CALCULATE{$SET(npages, $INT($GET(ntopics)/$GET(numlimit)+1))}%<nop> %CALCULATE{$SET(prevText, $IF($GET(start) >= $GET(numlimit), <a href='%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?$GET(searchparams)start=$INT($GET(start)-$GET(numlimit));limit=$GET(limit)'>«Previous</a>, $GET(gray)«Previous</span>))$IF($GET(npages) > 1, $GET(prevText)$SET(linksText, $GET(prevText)))}% %CALCULATE{$SET(stepsText, )$SET(pages, $INT(($GET(ntopics) - 1)/$GET(numlimit)+1))$SET(i, 0)$WHILE($counter<=$GET(pages), $SET(stepsText, $GET(stepsText)$IF($GET(i)==$GET(start), <b>$counter</b>, <a href='%SCRIPTURL{view}%/%BASEWEB%/%BASETOPIC%?$GET(searchparams)start=$GET(i);limit=$GET(limit)'>$counter</a>))$SETM(i, +$GET(numlimit)))$IF($GET(npages) > 1, $GET(stepsText)$SET(linksText, $GET(linksText)$GET(stepsText)))$SET(linksText, $GET(linksText) )}% Modified: twiki/trunk/core/data/TWiki/TWikiPreferences.txt =================================================================== --- twiki/trunk/core/data/TWiki/TWikiPreferences.txt 2012-11-29 07:41:03 UTC (rev 24228) +++ twiki/trunk/core/data/TWiki/TWikiPreferences.txt 2012-11-29 08:25:08 UTC (rev 24229) @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="TWikiContributor" date="1352453309" format="1.1" version="$Rev$"}% +%META:TOPICINFO{author="TWikiContributor" date="1354177303" format="1.1" version="$Rev$"}% ---+!! <nop>%WIKITOOLNAME% Site-Level Preferences This topic defines __site-level__ settings that apply to all users and webs on this TWikiSite. @@ -162,6 +162,8 @@ * Set SEARCHVARDEFAULTTYPE = literal * Stop words, e.g., common words and characters to exclude from a keyword search: * Set SEARCHSTOPWORDS = a, all, am, an, and, any, as, at, b, be, by, c, d, e, for, from, g, h, how, i, i'm, i.e., in, is, isn't, it, it's, its, j, k, l, m, n, o, of, on, or, p, q, r, s, t, that, that's, the, this, to, u, v, w, was, wasn't, what, what's, when, where, who, who's, will, with, x, y, z + * Default number of results per page in %SYSTEMWEB%.SearchResultsPagination: + * Set SEARCHRESULTSPERPAGE = 50 #EmailSettings ---+++ E-mail Settings Modified: twiki/trunk/core/data/TWiki/WebChanges.txt =================================================================== --- twiki/trunk/core/data/TWiki/WebChanges.txt 2012-11-29 07:41:03 UTC (rev 24228) +++ twiki/trunk/core/data/TWiki/WebChanges.txt 2012-11-29 08:25:08 UTC (rev 24229) @@ -1,4 +1,4 @@ -%META:TOPICINFO{author="TWikiContributor" date="1354169957" format="1.1" version="$Rev$"}% +%META:TOPICINFO{author="TWikiContributor" date="1354177279" format="1.1" version="$Rev$"}% ---+ %MAKETEXT{"Recent Changes in [_1] Web" args="<nop>%INCLUDINGWEB%"}% <span style="font-size: 50%">%MAKETEXT{"retrieved at [_1]" args="%DISPLAYTIME{"$hour:$min ($tz)"}%"}%</span> %INCLUDE{"%SYSTEMWEB%.SearchResultsPagination" section="preamble"}%<nop> %SEARCH{ @@ -17,6 +17,6 @@ }% %INCLUDE{"%SYSTEMWEB%.SearchResultsPagination" section="postamble"}%<nop> -%MAKETEXT{"Show [_1] results per page, or show <a href='[_2]' rel='nofollow'>all changes</a>." args="%CALCULATE{$LISTJOIN(, , $LISTMAP($IF($VALUE($GET(limit))==$item, <b>$item</b>, <a href='%SCRIPTURLPATH{"view"}%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=$item' rel='nofollow'>$item</a>), 10, 20, 50, 100, 500, 1000))}%, %SCRIPTURLPATH{"view"}%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=All"}% +%MAKETEXT{"Show [_1] results per page, or [_2]show all[_3]." args="%CALCULATE{$LISTJOIN(, , $LISTMAP($IF($VALUE($GET(limit))==$item, <b>$item</b>, <a href='%SCRIPTURLPATH{"view"}%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=$item' rel='nofollow'>$item</a>), 10, 20, 50, 100, 500, 1000)), $IF($EXACT($GET(limit), all), <b>, <a href='%SCRIPTURLPATH{"view"}%/%INCLUDINGWEB%/%INCLUDINGTOPIC%?limit=all' rel='nofollow'>), $IF($EXACT($GET(limit), all), </b>, </a>)}%"}% __Related topics:__ %ICON{feed}% [[%INCLUDINGWEB%.WebRss][RSS feed]], [[%INCLUDINGWEB%.WebAtom][ATOM feed]], [[%INCLUDINGWEB%.WebNotify][WebNotify]], %IF{"istopic '%SYSTEMWEB%.SiteChanges'" then="[[%SYSTEMWEB%.SiteChanges][site changes]], "}%[[%SYSTEMWEB%.SiteMap][site map]] Modified: twiki/trunk/core/data/TWiki/WebSearch.txt =================================================================== --- twiki/trunk/core/data/TWiki/WebSearch.txt 2012-11-29 07:41:03 UTC (rev 24228) +++ twiki/trunk/core/data/TWiki/WebSearch.txt 2012-11-29 08:25:08 UTC (rev 24229) @@ -1,8 +1,8 @@ -%META:TOPICINFO{author="TWikiContributor" date="1273873464" format="1.1" version="$Rev$"}% +%META:TOPICINFO{author="TWikiContributor" date="1354177269" format="1.1" version="$Rev$"}% %META:TOPICPARENT{name="WebHome"}% ---+ %MAKETEXT{"Web Search"}% -%IF{"defined search" then='%ICON{feed}% <a href="%SCRIPTURL{"view"}%/%BASEWEB%/WebRss?search=%URLPARAM{"search" encode="url"}%;type=%IF{"'%URLPARAM{"regex" encode="url"}%'='on' OR '%URLPARAM{"type" encode="url"}%'='regex'" then="regex" else="word"}%;excludetopic=%BASETOPIC%,WebHome,WebStatistics;web=%URLPARAM{"web" encode="url" default="%BASEWEB%"}%;limit=%URLPARAM{"limit" encode="url" default="all"}%;scope=%URLPARAM{"scope" encode="url" default="text"}%;casesensitive=%URLPARAM{"casesensitive" encode="url" default="off"}%">%MAKETEXT{"Get notified on changes on this search"}%</a>'}% +%IF{"defined search" then='%ICON{feed}% <a href="%SCRIPTURL{"view"}%/%BASEWEB%/WebRss?search=%URLPARAM{"search" encode="url"}%;type=%IF{"'%URLPARAM{"regex" encode="url"}%'='on' OR '%URLPARAM{"type" encode="url"}%'='regex'" then="regex" else="word"}%;excludetopic=%BASETOPIC%,WebHome,WebStatistics;web=%URLPARAM{"web" encode="url" default="%BASEWEB%"}%;limit=%URLPARAM{"limit" encode="url" default="%SEARCHRESULTSPERPAGE%"}%;scope=%URLPARAM{"scope" encode="url" default="text"}%;casesensitive=%URLPARAM{"casesensitive" encode="url" default="off"}%">%MAKETEXT{"Get notified on changes on this search"}%</a>'}% %INCLUDE{"%SYSTEMWEB%.SearchResultsPagination" section="preamble"}%<nop> %SEARCH{ Modified: twiki/trunk/core/data/TWiki/WebSearchAdvanced.txt =================================================================== --- twiki/trunk/core/data/TWiki/WebSearchAdvanced.txt 2012-11-29 07:41:03 UTC (rev 24228) +++ twiki/trunk/core/data/TWiki/WebSearchAdvanced.txt 2012-11-29 08:25:08 UTC (rev 24229) @@ -1,8 +1,8 @@ -%META:TOPICINFO{author="TWikiContributor" date="1354168351" format="1.1" version="$Rev$"}% +%META:TOPICINFO{author="TWikiContributor" date="1354177266" format="1.1" version="$Rev$"}% %META:TOPICPARENT{name="WebSearch"}% ---+ %MAKETEXT{"Advanced Search"}% -%IF{"defined search" then='%ICON{feed}% <a href="%SCRIPTURL{"view"}%/%BASEWEB%/WebRss?search=%URLPARAM{"search" encode="url"}%;type=%IF{"'%URLPARAM{"regex" encode="url"}%'='on' OR '%URLPARAM{"type" encode="url"}%'='regex'" then="regex" else="word"}%;excludetopic=%BASETOPIC%,WebHome,WebStatistics;web=%URLPARAM{"web" encode="url" default="%BASEWEB%"}%;limit=%URLPARAM{"limit" encode="url" default="all"}%;scope=%URLPARAM{"scope" encode="url" default="text"}%;casesensitive=%URLPARAM{"casesensitive" encode="url" default="off"}%">%MAKETEXT{"Get notified on changes on this search"}%</a>'}% +%IF{"defined search" then='%ICON{feed}% <a href="%SCRIPTURL{"view"}%/%BASEWEB%/WebRss?search=%URLPARAM{"search" encode="url"}%;type=%IF{"'%URLPARAM{"regex" encode="url"}%'='on' OR '%URLPARAM{"type" encode="url"}%'='regex'" then="regex" else="word"}%;excludetopic=%BASETOPIC%,WebHome,WebStatistics;web=%URLPARAM{"web" encode="url" default="%BASEWEB%"}%;limit=%URLPARAM{"limit" encode="url" default="%SEARCHRESULTSPERPAGE%"}%;scope=%URLPARAM{"scope" encode="url" default="text"}%;casesensitive=%URLPARAM{"casesensitive" encode="url" default="off"}%">%MAKETEXT{"Get notified on changes on this search"}%</a>'}% %INCLUDE{"%SYSTEMWEB%.SearchResultsPagination" section="preamble"}%<nop> %SEARCH{ @@ -77,7 +77,7 @@ </tr> <tr> <th class="twikiLast">%MAKETEXT{"Limit results to:"}%</th> -<td class="twikiLast"><input type="text" class="twikiInputField" id="limit" name="limit" size="3" value="%IF{" '%URLPARAM{"limit" encode="entity" default="all"}%' = 'all' " then="all" else="%URLPARAM{"limit" encode="entity"}%"}%" /><label for="limit"> %MAKETEXT{"Topics per web"}% </label><span class="twikiSmall">%MAKETEXT{"(=all= to show all topics)"}%</span> +<td class="twikiLast"><input type="text" class="twikiInputField" id="limit" name="limit" size="3" value="%CALCULATE{$GET(limit)}%" /><label for="limit"> %MAKETEXT{"Topics per web"}% </label><span class="twikiSmall">%MAKETEXT{"(=all= to show all topics)"}%</span> </td> </tr> </table> |