forked from github/kensanata.oddmuse
All the source files containing non-ASCII characters needed to have utf8 added. This will be necessary for user config files as well! The regular expressions identifying page names had to be changed. UrlEncode translates the string back to bytes before encoding it. Cached RSS files are saved with UTF-8 encoding and therefore need their meta-data changed (using the XML::RSS module to do this correctly didn't work for some of the test files). The CGI object's parameters, keywords and info_path are decoded correctly. File access uses the UTF-8 layer (reading, writing, appending, access to the log of recent changes, running sub processes with grep and diff). The mac compatibility extension will also disable the use of grep if non-ASCII characters are searched for because of an unexplained problem with grep.
65 lines
2.3 KiB
Perl
65 lines
2.3 KiB
Perl
# Copyright (C) 2005 Alex Schroeder <alex@emacswiki.org>
|
|
#
|
|
# This program is free software; you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with this program; if not, write to the
|
|
# Free Software Foundation, Inc.
|
|
# 59 Temple Place, Suite 330
|
|
# Boston, MA 02111-1307 USA
|
|
|
|
$ModulesDescription .= '<p><a href="http://git.savannah.gnu.org/cgit/oddmuse.git/tree/modules/dynamic-comments.pl">dynamic-comments.pl</a>, see <a href="http://www.oddmuse.org/cgi-bin/oddmuse/Dynamic_Comments_Extension">Dynamic Comments Extension</a></p>';
|
|
|
|
push(@MyInitVariables, \&DynamicCommentsAddScript);
|
|
|
|
sub DynamicCommentsAddScript {
|
|
$HtmlHeaders .= qq{
|
|
<script type="text/Javascript">
|
|
function togglecomments (id) {
|
|
var elem = document.getElementById(id);
|
|
if (elem.className=="commentshown") {
|
|
elem.className="commenthidden";
|
|
}
|
|
else {
|
|
elem.className="commentshown";
|
|
}
|
|
}
|
|
</script>
|
|
} unless $HtmlHeaders =~ /commenthidden/; # mod_perl?
|
|
}
|
|
|
|
my $num = 0;
|
|
|
|
*DynamicCommentsOldGetPageLink = *GetPageLink;
|
|
*GetPageLink = *DynamicCommentsNewGetPageLink;
|
|
|
|
sub DynamicCommentsNewGetPageLink {
|
|
my ($id, @rest) = @_;
|
|
if ($CollectingJournal and $id =~ /^$CommentsPrefix/) {
|
|
my $title = $id;
|
|
$title =~ s/_/ /g;
|
|
my $page = PageHtml($id);
|
|
if ($page) {
|
|
my $anchor = "id" . $num++;
|
|
return qq{<a href="javascript:togglecomments('$anchor')">$title</a>}
|
|
. '</p>' # close p before opening div
|
|
. $q->div({-class=>commenthidden, -id=>$anchor},
|
|
$page,
|
|
$q->p(DynamicCommentsOldGetPageLink($id, T('Add Comment'))))
|
|
. '<p>'; # open an empty p that will be closed in PrintAllPages
|
|
} else {
|
|
return DynamicCommentsOldGetPageLink($id, T('Add Comment'));
|
|
}
|
|
} else {
|
|
return DynamicCommentsOldGetPageLink($id, @rest);
|
|
}
|
|
}
|