]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/comments.pm
factored out an urlabs from aggregate and cgi
[git.ikiwiki.info.git] / IkiWiki / Plugin / comments.pm
index a3cb7c3d56c784f18251aaa34a14776d6f107962..cdb9262710bd4f86ef4ded3e36833331dcce9d82 100644 (file)
@@ -237,7 +237,7 @@ sub preprocess {
        }
 
        if ($params{page} =~ m/\/\Q$config{comments_pagename}\E\d+_/) {
-               $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page}), undef).
+               $pagestate{$page}{meta}{permalink} = urlto(IkiWiki::dirname($params{page}), undef, 1).
                        "#".page_to_id($params{page});
        }
 
@@ -372,10 +372,8 @@ sub editcomment ($$) {
                error(gettext("bad page name"));
        }
 
-       my $baseurl = urlto($page, undef);
-
        $form->title(sprintf(gettext("commenting on %s"),
-                       IkiWiki::pagetitle($page)));
+                       IkiWiki::pagetitle(IkiWiki::basename($page))));
 
        $form->tmpl_param('helponformattinglink',
                htmllink($page, $page, 'ikiwiki/formatting',
@@ -385,8 +383,7 @@ sub editcomment ($$) {
 
        if ($form->submitted eq CANCEL) {
                # bounce back to the page they wanted to comment on, and exit.
-               # CANCEL need not be considered in future
-               IkiWiki::redirect($cgi, urlto($page, undef));
+               IkiWiki::redirect($cgi, urlto($page));
                exit;
        }
 
@@ -552,13 +549,13 @@ sub editcomment ($$) {
                # Jump to the new comment on the page.
                # The trailing question mark tries to avoid broken
                # caches and get the most recent version of the page.
-               IkiWiki::redirect($cgi, urlto($page, undef).
+               IkiWiki::redirect($cgi, urlto($page).
                        "?updated#".page_to_id($location));
 
        }
        else {
-               IkiWiki::showform ($form, \@buttons, $session, $cgi,
-                       forcebaseurl => $baseurl, page => $page);
+               IkiWiki::showform_preview($form, \@buttons, $session, $cgi,
+                       page => $page);
        }
 
        exit;
@@ -811,14 +808,14 @@ sub pagetemplate (@) {
        if ($shown) {
                if ($template->query(name => 'commentsurl')) {
                        $template->param(commentsurl =>
-                               urlto($page, undef).'#comments');
+                               urlto($page).'#comments');
                }
 
                if ($template->query(name => 'atomcommentsurl') && $config{usedirs}) {
                        # This will 404 until there are some comments, but I
                        # think that's probably OK...
                        $template->param(atomcommentsurl =>
-                               urlto($page, undef).'comments.atom');
+                               urlto($page).'comments.atom');
                }
 
                if ($template->query(name => 'commentslink')) {