all.pl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # Copyright (C) 2006 Alex Schroeder <alex@emacswiki.org>
  2. #
  3. # This program is free software; you can redistribute it and/or modify
  4. # it under the terms of the GNU General Public License as published by
  5. # the Free Software Foundation; either version 3 of the License, or
  6. # (at your option) any later version.
  7. #
  8. # This program is distributed in the hope that it will be useful,
  9. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. # GNU General Public License for more details.
  12. #
  13. # You should have received a copy of the GNU General Public License
  14. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. use strict;
  16. use v5.10;
  17. AddModuleDescription('all.pl', 'All Action');
  18. our ($q, %Action, $HomePage, $UrlProtocols);
  19. $Action{all} = \&DoPrintAllPages;
  20. our $Monolithic = 0;
  21. sub DoPrintAllPages {
  22. return if (!UserIsAdminOrError());
  23. $Monolithic = 1; # changes ScriptLink
  24. print GetHeader('', T('Complete Content'))
  25. . $q->p(Ts('The main page is %s.', $q->a({-href=>'#' . $HomePage}, $HomePage)));
  26. print $q->p($q->b(Ts('(for %s)', GetParam('lang', 0)))) if GetParam('lang', 0);
  27. PrintAllPages(0, 0, undef, undef, AllPagesList());
  28. PrintFooter();
  29. }
  30. *OldAllScriptLink = \&ScriptLink;
  31. *ScriptLink = \&NewAllScriptLink;
  32. sub NewAllScriptLink {
  33. my ($action, $text, $class, $name, $title, $accesskey, $nofollow) = @_;
  34. if ($Monolithic
  35. and $action !~ /^($UrlProtocols)\%3a/
  36. and $action !~ /^\%2f/
  37. and $action !~ /=/) {
  38. my %params;
  39. $params{-href} = '#' . $action;
  40. $params{'-class'} = $class if $class;
  41. $params{'-name'} = $name if $name;
  42. $params{'-title'} = $title if $title;
  43. $params{'-accesskey'} = $accesskey if $accesskey;
  44. $params{'-rel'} = 'nofollow' if $nofollow;
  45. return $q->a(\%params, $text);
  46. } else {
  47. return OldAllScriptLink(@_);
  48. }
  49. }