From bdc083c7e2c3ff72fa2b0bf7971fb4f89b8b9ddc Mon Sep 17 00:00:00 2001 From: Weakish Jiang Date: Fri, 25 Apr 2008 09:48:28 +0000 Subject: [PATCH] ($Action, DoList) Add new action list --- modules/search-list.pl | 38 +++++++++++++++++++++++++++++++++++--- 1 file changed, 35 insertions(+), 3 deletions(-) diff --git a/modules/search-list.pl b/modules/search-list.pl index 676dd8ba..11b823e1 100644 --- a/modules/search-list.pl +++ b/modules/search-list.pl @@ -15,13 +15,13 @@ # Free Software Foundation, Inc. # 59 Temple Place, Suite 330 # Boston, MA 02111-1307 USA - -$ModulesDescription .= '

$Id: search-list.pl,v 1.10 2007/11/13 20:24:50 sheep Exp $

'; +# syntax change by Weakish Jiang +$ModulesDescription .= '

$Id: search-list.pl,v 1.11 2008/04/25 09:48:28 weakish Exp $

'; push(@MyRules, \&SearchListRule); sub SearchListRule { - if ($bol && /\G(<list (.*?)>)/cgis) { + if ($bol && /\G(\[\[!list (.*?)\]\])/cgis) { # Clean(CloseHtmlEnvironments()); Dirty($1); @@ -51,3 +51,35 @@ sub SearchListRule { } return undef; } + +# Add a new action list + +$Action{list} = \&DoList; + +sub DoList { +my $id = shift; +my $search = GetParam('search', ''); + ReportError(T('The search parameter is missing.')) unless $search; + print GetHeader('', Ts('Page list for %s', $search), ''); + if (!$ListPage) { + $ListPage = 1; + # Now save information required for saving the cache of the current page. + local (%Page, $OpenPageName); + my %hash = (); + foreach my $id (SearchTitleAndBody($search)) { + $hash{$id} = 1 unless $id eq $original; # skip the page with the query + } + my @found = keys %hash; + if (defined &PageSort) { + @found = sort PageSort @found; + } else { + @found = sort(@found); + } + @found = map { $q->li(GetPageLink($_)) } @found; + print $q->start_div({-class=>'search list'}), + $q->ul(@found), $q->end_div; + } + $ListPage = 0; + PrintFooter(); +} +