all.pl 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  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 2 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, write to the
  15. # Free Software Foundation, Inc.
  16. # 59 Temple Place, Suite 330
  17. # Boston, MA 02111-1307 USA
  18. use strict;
  19. use v5.10;
  20. AddModuleDescription('all.pl', 'All Action');
  21. our ($q, %Action, $HomePage, $UrlProtocols);
  22. $Action{all} = \&DoPrintAllPages;
  23. our $Monolithic = 0;
  24. sub DoPrintAllPages {
  25. return if (!UserIsAdminOrError());
  26. $Monolithic = 1; # changes ScriptLink
  27. print GetHeader('', T('Complete Content'))
  28. . $q->p(Ts('The main page is %s.', $q->a({-href=>'#' . $HomePage}, $HomePage)));
  29. print $q->p($q->b(Ts('(for %s)', GetParam('lang', 0)))) if GetParam('lang', 0);
  30. PrintAllPages(0, 0, undef, undef, AllPagesList());
  31. PrintFooter();
  32. }
  33. *OldAllScriptLink = \&ScriptLink;
  34. *ScriptLink = \&NewAllScriptLink;
  35. sub NewAllScriptLink {
  36. my ($action, $text, $class, $name, $title, $accesskey, $nofollow) = @_;
  37. if ($Monolithic
  38. and $action !~ /^($UrlProtocols)\%3a/
  39. and $action !~ /^\%2f/
  40. and $action !~ /=/) {
  41. my %params;
  42. $params{-href} = '#' . $action;
  43. $params{'-class'} = $class if $class;
  44. $params{'-name'} = $name if $name;
  45. $params{'-title'} = $title if $title;
  46. $params{'-accesskey'} = $accesskey if $accesskey;
  47. $params{'-rel'} = 'nofollow' if $nofollow;
  48. return $q->a(\%params, $text);
  49. } else {
  50. return OldAllScriptLink(@_);
  51. }
  52. }