doubleclick.pl 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. # Copyright (C) 2004 Alex Schroeder <alex@emacswiki.org>
  2. # 2004 Niklas Volbers <mithrandir42@web.de>
  3. #
  4. # This program is free software; you can redistribute it and/or modify
  5. # it under the terms of the GNU General Public License as published by
  6. # the Free Software Foundation; either version 3 of the License, or
  7. # (at your option) any later version.
  8. #
  9. # This program is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. # GNU General Public License for more details.
  13. #
  14. # You should have received a copy of the GNU General Public License
  15. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. # This module offers the user the additional possibility to
  17. # edit a page by double-clicking on it. The user must have
  18. # JavaScript enabled for this to work.
  19. use strict;
  20. use v5.10;
  21. AddModuleDescription('doubleclick.pl', 'Doubleclick Extension');
  22. our ($ScriptName);
  23. *OldDoubleclickGetHeader = \&GetHeader;
  24. *GetHeader = \&NewDoubleclickGetHeader;
  25. sub NewDoubleclickGetHeader {
  26. my $id = shift;
  27. my $html = OldDoubleclickGetHeader($id, @_);
  28. my $action = lc(GetParam('action', 'browse'));
  29. if (($action eq 'browse') and $id) {
  30. my $ondblclick="ondblclick=\"location.href='"
  31. . $ScriptName . "?action=edit;id=" . $id . "'\"";
  32. $html =~ s/\<body /\<body $ondblclick /;
  33. }
  34. return $html;
  35. }