5 Commits 99af4d984d ... f21f257c1b

Author SHA1 Message Date
  Alex Schroeder f21f257c1b Fix parenthesis 1 year ago
  Alex Schroeder 48916943a1 More spans for the search bar 1 year ago
  Alex Schroeder 3b185e5521 Add some spans to the gotobar for better styling 1 year ago
  Alex Schroeder 612af8f7fb Make feed link more flexible 1 year ago
  Alex Schroeder dc9131e600 Fix translation-link.t 1 year ago
3 changed files with 39 additions and 17 deletions
  1. 10 0
      modules/journal-rss.pl
  2. 2 2
      t/translation-links.t
  3. 27 15
      wiki.pl

+ 10 - 0
modules/journal-rss.pl

@@ -31,6 +31,7 @@ sub DoJournalRss {
   local $CollectingJournal = 1;
   # Fake the result of GetRcLines()
   local *GetRcLines = \&JournalRssGetRcLines;
+  local *RcSelfWebsite = \&JournalRssSelfWebsite;
   local *RcSelfAction = \&JournalRssSelfAction;
   local *RcPreviousAction = \&JournalRssPreviousAction;
   local *RcLastAction = \&JournalRssLastAction;
@@ -55,6 +56,15 @@ sub JournalRssParameters {
   return $more;
 }
 
+sub JournalRssSelfWebsite {
+  my $more = '';
+  my $search = GetParam('rcfilteronly', '');
+  $more .= ";search=" . UrlEncode($search) if $search;
+  my $match = GetParam('match', '');
+  $more .= ";match=" . UrlEncode($match) if $match;
+  return $more;
+}
+
 sub JournalRssSelfAction {
   return "action=journal" . JournalRssParameters(qw(offset));
 }

+ 2 - 2
t/translation-links.t

@@ -129,8 +129,8 @@ test_page(update_page('Testing', 'This is spam.'), 'This page does not exist');
 test_page(update_page('Spam', 'Trying again.'), 'This page does not exist');
 test_page(get_page('action=translate id=Spam target=Harmless translation=en'),
 	  'Edit Denied',
-	  'Regular expression "spam" matched on this page');
+	  'Regular expression "spam" matched "Spam" on this page');
 test_page(get_page('Spam'), 'This page does not exist');
 test_page(get_page('action=translate id=Harmless target=Spam translation=en'),
 	  'Edit Denied',
-	  'Regular expression "spam" matched on this page');
+	  'Regular expression "spam" matched "Spam" on this page');

+ 27 - 15
wiki.pl

@@ -1712,6 +1712,11 @@ sub RcOtherParameters {
   return $more;
 }
 
+sub RcSelfWebsite {
+  my $action = 'rc';
+  return "action=$action" . RcOtherParameters(qw(from upto days));
+}
+
 sub RcSelfAction {
   my $action = GetParam('action', 'rc');
   return "action=$action" . RcOtherParameters(qw(from upto days));
@@ -1898,7 +1903,7 @@ sub GetRcRss {
 };
   my $title = QuoteHtml($SiteName) . ': ' . GetParam('title', QuoteHtml(NormalToFree($HomePage)));
   $rss .= "<title>$title</title>\n";
-  $rss .= "<link>$ScriptName?" . RcSelfAction() . "</link>\n";
+  $rss .= "<link>$ScriptName?" . RcSelfWebsite() . "</link>\n";
   $rss .= qq{<atom:link href="$ScriptName?} . RcSelfAction() . qq{" rel="self" type="application/rss+xml" />\n};
   $rss .= qq{<atom:link href="$ScriptName?} . RcPreviousAction() . qq{" rel="previous" type="application/rss+xml" />\n};
   $rss .= qq{<atom:link href="$ScriptName?} . RcLastAction() . qq{" rel="last" type="application/rss+xml" />\n};
@@ -1918,7 +1923,7 @@ sub GetRcRss {
     $rss .= "<image>\n";
     $rss .= "<url>$RssImageUrl</url>\n";
     $rss .= "<title>$title</title>\n";    # the same as the channel
-    $rss .= "<link>$ScriptName?" . RcSelfAction() . "</link>\n"; # the same as the channel
+    $rss .= "<link>$ScriptName?" . RcSelfWebsite() . "</link>\n"; # the same as the channel
     $rss .= "</image>\n";
   }
   my $limit = GetParam("rsslimit", 15); # Only take the first 15 entries
@@ -2552,23 +2557,30 @@ sub GetFormStart {
 }
 
 sub GetSearchForm {
-  my $html = GetFormStart(undef, 'get', 'search') . $q->start_p;
-  $html .= $q->label({-for=>'search'}, T('Search:')) . ' '
-      . $q->textfield(-name=>'search', -id=>'search', -size=>15, -accesskey=>T('f')) . ' ';
-  if (GetParam('search') ne '' and UserIsAdmin()) { # see DoBrowseRequest
-    $html .= $q->label({-for=>'replace'}, T('Replace:')) . ' '
-	. $q->textfield(-name=>'replace', -id=>'replace', -size=>20) . ' '
-        . $q->label({-for=>'delete', -title=>'If you want to replace matches with the empty string'}, T('Delete')) . ' '
-	. $q->input({-type=>'checkbox', -name=>'delete'})
-	. $q->submit('preview', T('Preview'));
+  my $html = GetFormStart(undef, 'get', 'search');
+  my $replacing = (GetParam('search') ne '' and UserIsAdmin());
+  $html .= $q->start_p({-class => ($replacing ? 'replace' : 'search')});
+  $html .= $q->span({-class=>'search'},
+                    $q->label({-for=>'search'}, T('Search:')) . ' '
+                    . $q->textfield(-name=>'search', -id=>'search', -size=>15, -accesskey=>T('f'))) . ' ';
+  if ($replacing) { # see DoBrowseRequest
+    $html .= $q->span({-class=>'replace'},
+                      $q->label({-for=>'replace'}, T('Replace:')) . ' '
+                      . $q->textfield(-name=>'replace', -id=>'replace', -size=>20)) . ' '
+        . $q->span({-class=>'delete'},
+                   $q->label({-for=>'delete', -title=>'If you want to replace matches with the empty string'}, T('Delete')) . ' '
+                   . $q->input({-type=>'checkbox', -name=>'delete'})) . ' '
+	. $q->submit('preview', T('Preview')) . ' ';
   }
   if (GetParam('matchingpages', $MatchingPages)) {
-    $html .= $q->label({-for=>'matchingpage'}, T('Filter:')) . ' '
-	. $q->textfield(-name=>'match', -id=>'matchingpage', -size=>15) . ' ';
+    $html .= $q->span({-class=>'match'},
+                      $q->label({-for=>'matchingpage'}, T('Filter:')) . ' '
+                      . $q->textfield(-name=>'match', -id=>'matchingpage', -size=>15)) . ' ';
   }
   if (%Languages) {
-    $html .= $q->label({-for=>'searchlang'}, T('Language:')) . ' '
-	. $q->textfield(-name=>'lang', -id=>'searchlang', -size=>5, -default=>GetParam('lang', '')) . ' ';
+    $html .= $q->span({-class=>'lang'},
+                      $q->label({-for=>'searchlang'}, T('Language:')) . ' '
+                      . $q->textfield(-name=>'lang', -id=>'searchlang', -size=>5, -default=>GetParam('lang', ''))) . ' ';
   }
   $html .= $q->submit('dosearch', T('Go!')) . $q->end_p . $q->end_form;
   return $html;