* Smarter behavior when creating a page and a page of the same name (but
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 2 May 2006 02:57:45 +0000 (02:57 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Tue, 2 May 2006 02:57:45 +0000 (02:57 +0000)
  different location) already exists.

IkiWiki/CGI.pm
debian/changelog

index e5cee9cb95fb0acd5a9ded69287b3f652ab6732f..92d042dc92612bc01f4d5d23d1afcd2692d18e6f 100644 (file)
@@ -360,13 +360,6 @@ sub cgi_editpage ($$) { #{{{
        if (! $form->submitted || $form->submitted eq "Preview" || 
            ! $form->validate) {
                if ($form->field("do") eq "create") {
-                       if (exists $pagesources{lc($page)}) {
-                               # hmm, someone else made the page in the
-                               # meantime?
-                               print $q->redirect("$config{url}/".htmlpage($page));
-                               return;
-                       }
-                       
                        my @page_locs;
                        my $best_loc;
                        my ($from)=$form->param('from')=~/$config{wiki_file_regexp}/;
@@ -395,13 +388,20 @@ sub cgi_editpage ($$) { #{{{
                                        $dir=~s![^/]+/+$!!;
                                        push @page_locs, $dir.$page;
                                }
-
-                               @page_locs = grep {
-                                       ! exists $pagesources{lc($_)} &&
-                                       ! page_locked($_, $session, 1)
-                               } @page_locs;
                        }
 
+                       @page_locs = grep {
+                               ! exists $pagesources{lc($_)} &&
+                               ! page_locked($_, $session, 1)
+                       } @page_locs;
+                       
+                       if (! @page_locs) {
+                               # hmm, someone else made the page in the
+                               # meantime?
+                               print $q->redirect("$config{url}/".htmlpage($page));
+                               return;
+                       }
+                               
                        $form->tmpl_param("page_select", 1);
                        $form->field(name => "page", type => 'select',
                                options => \@page_locs, value => $best_loc);
index 504bf0c9ab6cc77a2f5591907a4e90f16726c7ef..e1c6979dca24e173fbeab79cd57468cc7f06ea91 100644 (file)
@@ -20,8 +20,10 @@ ikiwiki (1.1) UNRELEASED; urgency=low
     enabled by default.
   * Added brokenlinks plugin, not enabled by default, but rather handy.
   * Fix several broken links in the doc wiki.
+  * Smarter behavior when creating a page and a page of the same name (but
+    different location) already exists.
 
- -- Joey Hess <joeyh@debian.org>  Mon,  1 May 2006 21:01:12 -0400
+ -- Joey Hess <joeyh@debian.org>  Mon,  1 May 2006 22:57:04 -0400
 
 ikiwiki (1.0) unstable; urgency=low