* Use forcebaseurl to make page previews be displayed with the html base
set to the destination page. This avoids need for hacks to munge the urls in preview mode, which fixes several bugs. * Several destpage fixes in plugins.master
parent
be0f1a63a3
commit
f7bdc2385d
|
@ -21,7 +21,7 @@ sub printheader ($) { #{{{
|
||||||
|
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
sub showform ($$$$) { #{{{
|
sub showform ($$$$;@) { #{{{
|
||||||
my $form=shift;
|
my $form=shift;
|
||||||
my $buttons=shift;
|
my $buttons=shift;
|
||||||
my $session=shift;
|
my $session=shift;
|
||||||
|
@ -35,7 +35,7 @@ sub showform ($$$$) { #{{{
|
||||||
}
|
}
|
||||||
|
|
||||||
printheader($session);
|
printheader($session);
|
||||||
print misctemplate($form->title, $form->render(submit => $buttons));
|
print misctemplate($form->title, $form->render(submit => $buttons), @_);
|
||||||
}
|
}
|
||||||
|
|
||||||
sub redirect ($$) { #{{{
|
sub redirect ($$) { #{{{
|
||||||
|
@ -276,6 +276,8 @@ sub cgi_editpage ($$) { #{{{
|
||||||
file_pruned($page, $config{srcdir}) || $page=~/^\//) {
|
file_pruned($page, $config{srcdir}) || $page=~/^\//) {
|
||||||
error("bad page name");
|
error("bad page name");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
my $baseurl=$config{url}."/".htmlpage($page);
|
||||||
|
|
||||||
my $from;
|
my $from;
|
||||||
if (defined $form->field('from')) {
|
if (defined $form->field('from')) {
|
||||||
|
@ -325,10 +327,9 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$form->tmpl_param("can_commit", $config{rcs});
|
$form->tmpl_param("can_commit", $config{rcs});
|
||||||
$form->tmpl_param("indexlink", indexlink());
|
$form->tmpl_param("indexlink", indexlink());
|
||||||
$form->tmpl_param("helponformattinglink",
|
$form->tmpl_param("helponformattinglink",
|
||||||
htmllink("", "", "ikiwiki/formatting",
|
htmllink($page, $page, "ikiwiki/formatting",
|
||||||
noimageinline => 1,
|
noimageinline => 1,
|
||||||
linktext => "FormattingHelp"));
|
linktext => "FormattingHelp"));
|
||||||
$form->tmpl_param("baseurl", baseurl());
|
|
||||||
|
|
||||||
if ($form->submitted eq "Cancel") {
|
if ($form->submitted eq "Cancel") {
|
||||||
if ($form->field("do") eq "create" && defined $from) {
|
if ($form->field("do") eq "create" && defined $from) {
|
||||||
|
@ -354,9 +355,9 @@ sub cgi_editpage ($$) { #{{{
|
||||||
});
|
});
|
||||||
$form->tmpl_param("page_preview",
|
$form->tmpl_param("page_preview",
|
||||||
htmlize($page, $type,
|
htmlize($page, $type,
|
||||||
linkify($page, "/",
|
linkify($page, $page,
|
||||||
preprocess($page, "/",
|
preprocess($page, $page,
|
||||||
filter($page, "/", $content), 0, 1))));
|
filter($page, $page, $content), 0, 1))));
|
||||||
# previewing may have created files on disk
|
# previewing may have created files on disk
|
||||||
saveindex();
|
saveindex();
|
||||||
}
|
}
|
||||||
|
@ -458,7 +459,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$form->title(sprintf(gettext("editing %s"), pagetitle($page)));
|
$form->title(sprintf(gettext("editing %s"), pagetitle($page)));
|
||||||
}
|
}
|
||||||
|
|
||||||
showform($form, \@buttons, $session, $q);
|
showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
# save page
|
# save page
|
||||||
|
@ -474,7 +475,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$form->field(name => "page", type => 'hidden');
|
$form->field(name => "page", type => 'hidden');
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
$form->title(sprintf(gettext("editing %s"), $page));
|
$form->title(sprintf(gettext("editing %s"), $page));
|
||||||
showform($form, \@buttons, $session, $q);
|
showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
elsif ($form->field("do") eq "create" && $exists) {
|
elsif ($form->field("do") eq "create" && $exists) {
|
||||||
|
@ -488,7 +489,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
value => readfile("$config{srcdir}/$file").
|
value => readfile("$config{srcdir}/$file").
|
||||||
"\n\n\n".$form->field("editcontent"),
|
"\n\n\n".$form->field("editcontent"),
|
||||||
force => 1);
|
force => 1);
|
||||||
showform($form, \@buttons, $session, $q);
|
showform($form, \@buttons, $session, $q, forcebaseurl => $baseurl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -518,7 +519,8 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$form->field(name => "page", type => 'hidden');
|
$form->field(name => "page", type => 'hidden');
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
$form->title(sprintf(gettext("editing %s"), $page));
|
$form->title(sprintf(gettext("editing %s"), $page));
|
||||||
showform($form, \@buttons, $session, $q);
|
showform($form, \@buttons, $session, $q,
|
||||||
|
forcebaseurl => $baseurl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,7 +564,8 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$form->field(name => "page", type => 'hidden');
|
$form->field(name => "page", type => 'hidden');
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
$form->title(sprintf(gettext("editing %s"), $page));
|
$form->title(sprintf(gettext("editing %s"), $page));
|
||||||
showform($form, \@buttons, $session, $q);
|
showform($form, \@buttons, $session, $q,
|
||||||
|
forcebaseurl => $baseurl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
|
@ -29,10 +29,10 @@ sub render_graph (\%) { #{{{
|
||||||
# Use the sha1 of the graphviz code as part of its filename.
|
# Use the sha1 of the graphviz code as part of its filename.
|
||||||
eval q{use Digest::SHA1};
|
eval q{use Digest::SHA1};
|
||||||
error($@) if $@;
|
error($@) if $@;
|
||||||
my $dest=$params{page}."/graph-".
|
my $dest=$params{destpage}."/graph-".
|
||||||
IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($src)).
|
IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($src)).
|
||||||
".png";
|
".png";
|
||||||
will_render($params{page}, $dest);
|
will_render($params{destpage}, $dest);
|
||||||
|
|
||||||
if (! -e "$config{destdir}/$dest") {
|
if (! -e "$config{destdir}/$dest") {
|
||||||
my $pid;
|
my $pid;
|
||||||
|
@ -73,7 +73,7 @@ sub render_graph (\%) { #{{{
|
||||||
return "<img src=\"".urlto($dest, "")."\" />\n";
|
return "<img src=\"".urlto($dest, "")."\" />\n";
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return "<img src=\"".urlto($dest, $params{page})."\" />\n";
|
return "<img src=\"".urlto($dest, $params{destpage})."\" />\n";
|
||||||
}
|
}
|
||||||
} #}}}
|
} #}}}
|
||||||
|
|
||||||
|
|
|
@ -39,7 +39,7 @@ sub preprocess (@) { #{{{
|
||||||
|
|
||||||
my $file = bestlink($params{page}, $image);
|
my $file = bestlink($params{page}, $image);
|
||||||
|
|
||||||
my $dir = $params{page};
|
my $dir = $params{destpage};
|
||||||
my $base = IkiWiki::basename($file);
|
my $base = IkiWiki::basename($file);
|
||||||
|
|
||||||
eval q{use Image::Magick};
|
eval q{use Image::Magick};
|
||||||
|
@ -56,7 +56,7 @@ sub preprocess (@) { #{{{
|
||||||
my $outfile = "$config{destdir}/$dir/${w}x${h}-$base";
|
my $outfile = "$config{destdir}/$dir/${w}x${h}-$base";
|
||||||
$imglink = "$dir/${w}x${h}-$base";
|
$imglink = "$dir/${w}x${h}-$base";
|
||||||
|
|
||||||
will_render($params{page}, $imglink);
|
will_render($params{destpage}, $imglink);
|
||||||
|
|
||||||
if (-e $outfile && (-M srcfile($file) >= -M $outfile)) {
|
if (-e $outfile && (-M srcfile($file) >= -M $outfile)) {
|
||||||
$r = $im->Read($outfile);
|
$r = $im->Read($outfile);
|
||||||
|
|
|
@ -53,11 +53,11 @@ sub genmap ($) { #{{{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
my $dest=$params{page}."/linkmap.png";
|
my $dest=$params{destpage}."/linkmap.png";
|
||||||
|
|
||||||
# Use ikiwiki's function to create the file, this makes sure needed
|
# Use ikiwiki's function to create the file, this makes sure needed
|
||||||
# subdirs are there and does some sanity checking.
|
# subdirs are there and does some sanity checking.
|
||||||
will_render($params{page}, $dest);
|
will_render($params{destpage}, $dest);
|
||||||
writefile($dest, $config{destdir}, "");
|
writefile($dest, $config{destdir}, "");
|
||||||
|
|
||||||
# Run dot to create the graphic and get the map data.
|
# Run dot to create the graphic and get the map data.
|
||||||
|
|
|
@ -114,10 +114,10 @@ sub preprocess (@) { #{{{
|
||||||
# the base for its filename.
|
# the base for its filename.
|
||||||
eval q{use Digest::SHA1};
|
eval q{use Digest::SHA1};
|
||||||
error($@) if $@;
|
error($@) if $@;
|
||||||
my $fn=$params{page}."/sparkline-".
|
my $fn=$params{destpage}."/sparkline-".
|
||||||
IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($php)).
|
IkiWiki::possibly_foolish_untaint(Digest::SHA1::sha1_hex($php)).
|
||||||
".png";
|
".png";
|
||||||
will_render($params{page}, $fn);
|
will_render($params{destpage}, $fn);
|
||||||
|
|
||||||
if (! -e "$config{destdir}/$fn") {
|
if (! -e "$config{destdir}/$fn") {
|
||||||
my $pid;
|
my $pid;
|
||||||
|
|
|
@ -70,21 +70,13 @@ sub create ($$$) { #{{{
|
||||||
|
|
||||||
my $digest = md5_hex($code, $height);
|
my $digest = md5_hex($code, $height);
|
||||||
|
|
||||||
my $imglink= $params->{page} . "/$digest.png";
|
my $imglink= $params->{destpage} . "/$digest.png";
|
||||||
my $imglog = $params->{page} . "/$digest.log";
|
my $imglog = $params->{destpage} . "/$digest.log";
|
||||||
will_render($params->{destpage}, $imglink);
|
will_render($params->{destpage}, $imglink);
|
||||||
will_render($params->{destpage}, $imglog);
|
will_render($params->{destpage}, $imglog);
|
||||||
|
|
||||||
my $imgurl;
|
my $imgurl=urlto($imglink, $params->{destpage});
|
||||||
my $logurl;
|
my $logurl=urlto($imglink, $params->{destpage});
|
||||||
if (! $params->{preview}) {
|
|
||||||
$imgurl = urlto($imglink, $params->{destpage});
|
|
||||||
$logurl = urlto($imglog, $params->{destpage});
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$imgurl=$params->{page}."/$digest.png";
|
|
||||||
$logurl=$params->{page}."/$digest.log";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-e "$config{destdir}/$imglink" ||
|
if (-e "$config{destdir}/$imglink" ||
|
||||||
gen_image($code, $height, $digest, $params->{page})) {
|
gen_image($code, $height, $digest, $params->{page})) {
|
||||||
|
|
|
@ -31,6 +31,10 @@ ikiwiki (2.41) UNRELEASED; urgency=low
|
||||||
rcs_commit either.
|
rcs_commit either.
|
||||||
* monotone: Require version 0.38 or greater, and stop using the mtnmergerc
|
* monotone: Require version 0.38 or greater, and stop using the mtnmergerc
|
||||||
option. (Brian May)
|
option. (Brian May)
|
||||||
|
* Use forcebaseurl to make page previews be displayed with the html base
|
||||||
|
set to the destination page. This avoids need for hacks to munge the urls
|
||||||
|
in preview mode, which fixes several bugs.
|
||||||
|
* Several destpage fixes in plugins.
|
||||||
|
|
||||||
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100
|
-- martin f. krafft <madduck@debian.org> Sun, 02 Mar 2008 17:46:38 +0100
|
||||||
|
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
|
|
||||||
A minor nitpick: if, while editing, you preview your page two times without changing anything, the second time produces an error. --[[buo]]
|
A minor nitpick: if, while editing, you preview your page two times without changing anything, the second time produces an error. --[[buo]]
|
||||||
|
|
||||||
|
> Fixed --[[Joey]]
|
||||||
|
|
|
@ -8,7 +8,7 @@ msgid ""
|
||||||
msgstr ""
|
msgstr ""
|
||||||
"Project-Id-Version: PACKAGE VERSION\n"
|
"Project-Id-Version: PACKAGE VERSION\n"
|
||||||
"Report-Msgid-Bugs-To: \n"
|
"Report-Msgid-Bugs-To: \n"
|
||||||
"POT-Creation-Date: 2008-03-03 15:55-0500\n"
|
"POT-Creation-Date: 2008-03-12 13:53-0400\n"
|
||||||
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
"Language-Team: LANGUAGE <LL@li.org>\n"
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
@ -235,7 +235,7 @@ msgstr ""
|
||||||
msgid "%s is locked by %s and cannot be edited"
|
msgid "%s is locked by %s and cannot be edited"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/mdwn.pm:37
|
#: ../IkiWiki/Plugin/mdwn.pm:42
|
||||||
#, perl-format
|
#, perl-format
|
||||||
msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"
|
msgid "failed to load Markdown.pm perl module (%s) or /usr/bin/markdown (%s)"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
@ -244,11 +244,11 @@ msgstr ""
|
||||||
msgid "stylesheet not found"
|
msgid "stylesheet not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/meta.pm:158
|
#: ../IkiWiki/Plugin/meta.pm:166
|
||||||
msgid "redir page not found"
|
msgid "redir page not found"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: ../IkiWiki/Plugin/meta.pm:171
|
#: ../IkiWiki/Plugin/meta.pm:179
|
||||||
msgid "redir cycle is not allowed"
|
msgid "redir cycle is not allowed"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue