]> git.vanrenterghem.biz Git - git.ikiwiki.info.git/blobdiff - IkiWiki/Plugin/editpage.pm
editpage, comment: Clean up title when editing or creating a page or comment.
[git.ikiwiki.info.git] / IkiWiki / Plugin / editpage.pm
index 837bfed13983ea23da1ed8792db435fb7a02c0c1..537b86ad1d12c1c507d2710a237051b7d4e3c91a 100644 (file)
@@ -98,7 +98,7 @@ sub cgi_editpage ($$) {
                error(gettext("bad page name"));
        }
 
-       my $baseurl = urlto($page, undef, 1);
+       my $baseurl = urlto($page);
 
        my $from;
        if (defined $form->field('from')) {
@@ -156,13 +156,13 @@ sub cgi_editpage ($$) {
        my $previewing=0;
        if ($form->submitted eq "Cancel") {
                if ($form->field("do") eq "create" && defined $from) {
-                       redirect($q, urlto($from, undef));
+                       redirect($q, urlto($from));
                }
                elsif ($form->field("do") eq "create") {
                        redirect($q, baseurl(undef));
                }
                else {
-                       redirect($q, urlto($page, undef));
+                       redirect($q, $baseurl);
                }
                exit;
        }
@@ -262,7 +262,7 @@ sub cgi_editpage ($$) {
                                        @page_locs=$page;
                                }
                                else {
-                                       redirect($q, urlto($page, undef));
+                                       redirect($q, $baseurl);
                                        exit;
                                }
                        }
@@ -291,7 +291,7 @@ sub cgi_editpage ($$) {
                                value => $best_loc);
                        $form->field(name => "type", type => 'select',
                                options => \@page_types);
-                       $form->title(sprintf(gettext("creating %s"), pagetitle($page)));
+                       $form->title(sprintf(gettext("creating %s"), pagetitle(basename($page))));
                        
                }
                elsif ($form->field("do") eq "edit") {
@@ -309,7 +309,7 @@ sub cgi_editpage ($$) {
                        $form->tmpl_param("page_select", 0);
                        $form->field(name => "page", type => 'hidden');
                        $form->field(name => "type", type => 'hidden');
-                       $form->title(sprintf(gettext("editing %s"), pagetitle($page)));
+                       $form->title(sprintf(gettext("editing %s"), pagetitle(basename($page))));
                }
                
                showform($form, \@buttons, $session, $q,
@@ -434,7 +434,7 @@ sub cgi_editpage ($$) {
                else {
                        # The trailing question mark tries to avoid broken
                        # caches and get the most recent version of the page.
-                       redirect($q, urlto($page, undef)."?updated");
+                       redirect($q, $baseurl."?updated");
                }
        }