* Detect the case of two people independently creating the same page at the
authorjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 17 Mar 2007 23:57:03 +0000 (23:57 +0000)
committerjoey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071>
Sat, 17 Mar 2007 23:57:03 +0000 (23:57 +0000)
  same time, and let the second person resolve the conflict.

IkiWiki/CGI.pm
debian/changelog
templates/editpage.tmpl

index acf1f5969f3ff0641158cf0bc4f7d9753e6b3ac4..2b772700067ca9c942d2f56138ebd21fb6e16dfb 100644 (file)
@@ -497,6 +497,21 @@ sub cgi_editpage ($$) { #{{{
                        print $form->render(submit => \@buttons);
                        return;
                }
+               elsif (-e "$config{srcdir}/$file" &&
+                      $form->field("do") eq "create") {
+                       $form->tmpl_param("creation_conflict", 1);
+                       $form->field(name => "do", value => "edit", force => 1);
+                       $form->tmpl_param("page_select", 0);
+                       $form->field(name => "page", type => 'hidden');
+                       $form->field(name => "type", type => 'hidden');
+                       $form->title(sprintf(gettext("editing %s"), $page));
+                       $form->field("editcontent", 
+                               value => readfile("$config{srcdir}/$file").
+                                        "\n\n\n".$form->field("editcontent"),
+                               force => 1);
+                       print $form->render(submit => \@buttons);
+                       return;
+               }
                
                my $content=$form->field('editcontent');
 
index ee860a08e349db9ccf341565caf5b2f081ffcaf2..d76e05d7753b11c3939b734d4b94f2867e68a503 100644 (file)
@@ -8,8 +8,10 @@ ikiwiki (1.46) UNRELEASED; urgency=low
     with the same name already exists, and generally simplify the edit code.
   * Make ikiwiki -verbose -setup with a setup file that enabled syslog logging
     output the verbose build log to stdout, rather than to the syslog.
+  * Detect the case of two people independently creating the same page at the
+    same time, and let the second person resolve the conflict.
 
- -- Joey Hess <joeyh@debian.org>  Sat, 17 Mar 2007 19:31:31 -0400
+ -- Joey Hess <joeyh@debian.org>  Sat, 17 Mar 2007 19:56:04 -0400
 
 ikiwiki (1.45) unstable; urgency=low
 
index 15a4069c00325000cd913bb2cf784e4cc8df7f95..3b3570a448557f98f7dc674cc95de81b04a09721 100644 (file)
@@ -42,6 +42,17 @@ Perhaps someone else has deleted it or moved it. If you want to recreate
 this page with your text, click "Save Page" again.
 </p>
 </TMPL_IF>
+<TMPL_IF NAME="CREATION_CONFLICT">
+<p>
+<b>While you were creating this page, someone else independently created a page
+with the same name.</b>
+</p>
+<p>
+The edit box below contains the page's current content, followed by the 
+content you entered previously, to allow you to merge the two contents
+together before saving.
+</p>
+</TMPL_IF>
 <TMPL_VAR FORM-START>
 <div class="header">
 <span><TMPL_VAR INDEXLINK>/ <TMPL_VAR FORM-TITLE></span>