1 # Copyright (C) 2008 Weakish Jiang <weakish@gmail.com>
3 # This program is free software; you can redistribute it and/or modify
4 # it under the terms of the GNU General Public License version 2 as
5 # published by the Free Software Foundation.
7 # You can get a copy of GPL version 2 at
8 # http://www.gnu.org/licenses/gpl-2.0.html
11 # http://www.oddmuse.org/cgi-bin/oddmuse/Backlinks_Extension
13 $ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/backlinks.pl">backlinks.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/Backlinks_Extension">Backlinks Extension</a></p>';
15 *OldGetSearchLink
= *GetSearchLink
;
16 *GetSearchLink
= *NewGetSearchLink
;
17 sub NewGetSearchLink
{
18 my ($text, $class, $name, $title) = @_;
19 my $id = UrlEncode
(QuoteRegexp
($text));
20 $name = UrlEncode
($name);
21 $text = NormalToFree
($text);
22 $id =~ s/_/\ /g; # Search for url-escaped spaces
23 return ScriptLink
("action=backlink;search=\\[\\[$id(\\|.*)*\\]\\]", $text, $class, $name, $title);
26 $Action{backlink
} = \
&DoBackLink
;
30 my $search = GetParam
('search', '');
31 my $taglabel = $search;
32 $taglabel =~ s/\\\[\\\[//;
33 $taglabel =~ s/\\\]\\\]//;
34 ReportError
(T
('The search parameter is missing.')) unless $search;
35 print GetHeader
('', Ts
('Pages link to %s', $taglabel), '');
36 local (%Page, $OpenPageName);
38 foreach my $id (SearchTitleAndBody
($search)) {
41 my @found = keys %hash;
42 if (defined &PageSort
) {
43 @found = sort PageSort
@found;
45 @found = sort(@found);
47 @found = map { $q->li(GetPageLink
($_)) } @found;
48 print $q->start_div({-class=>'search list'}),
49 $q->ul(@found), $q->end_div;