This patch automatically puts the page's title in the search text box at the bottom of each page. Thus, if you have the /BackLinks patch active and want to do a traditional full-search, you just click in the text box and hit enter.
The patch also includes a configuration variable to turn it on or off.
Going from top to bottom...
We need a new configuration variable. Instead of adding to the huge list, I just added a new line right after the list.
# Configuration/constant variables: use vars qw(@RcDays? @HtmlPairs @HtmlSingle? $TempDir? $LockDir? $DataDir $HtmlDir? $UserDir $KeepDir? $PageDir ... $UserGotoBar); # PATCH: Default Search use vars qw($DefaultSearch?); # /PATCH: Default Search
$FreeUpper = 1; # 1 = force upper case, 0 = do not force case $FastGlob? = 1; # 1 = new faster code, 0 = old compatible code # PATCH: Default Search $DefaultSearch? = 1; # 1 = search for title, 0 = blank search box # /PATCH: Default Search
sub GetFooterText { my ($id, $rev) = @_; my $result = '';Becomes:
sub GetFooterText { my ($id, $rev) = @_; my $result = ''; # PATCH: Default search my ($search); # /PATCH: Default search
if ($UseDiff) { $result .= ' ' . &ScriptLinkDiff?(4, $id, T('(diff)'), $rev); } $result .= 'Becomes:
' . &GetSearchForm();
if ($UseDiff) { $result .= ' ' . &ScriptLinkDiff?(4, $id, T('(diff)'), $rev); } # PATCH: Default search if ($DefaultSearch?) { $search = $id; $search =~ s|.*/|/|; $search =~ s|_| |g; } $result .= '
' . &GetSearchForm($search'''); # /PATCH: Default search
sub GetSearchForm { my ($result);
$result = T('Search:') . ' ' . $q->textfield(-name=>'search', -size=>20) . &GetHiddenValue("dosearch", 1); return $result; }Becomes:
# PATCH: Default search sub GetSearchForm { my ($search) = @_; my ($result, $text);
if (defined($search)) { $text = $q->textfield(-name=>'search', -value=>$search, -size=>20); }else{ $text = $q->textfield(-name=>'search', -size=>20); } $result = T('Search:') . ' ' . $text . &GetHiddenValue("dosearch", 1); return $result; } # /PATCH: Default search