From 26213f8ee443addfbc74e92a693e172d023b16e6 Mon Sep 17 00:00:00 2001 From: joey Date: Sat, 17 Mar 2007 23:57:03 +0000 Subject: [PATCH] * Detect the case of two people independently creating the same page at the same time, and let the second person resolve the conflict. --- IkiWiki/CGI.pm | 15 +++++++++++++++ debian/changelog | 4 +++- templates/editpage.tmpl | 11 +++++++++++ 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/IkiWiki/CGI.pm b/IkiWiki/CGI.pm index acf1f5969..2b7727000 100644 --- a/IkiWiki/CGI.pm +++ b/IkiWiki/CGI.pm @@ -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'); diff --git a/debian/changelog b/debian/changelog index ee860a08e..d76e05d77 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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 Sat, 17 Mar 2007 19:31:31 -0400 + -- Joey Hess Sat, 17 Mar 2007 19:56:04 -0400 ikiwiki (1.45) unstable; urgency=low diff --git a/templates/editpage.tmpl b/templates/editpage.tmpl index 15a4069c0..3b3570a44 100644 --- a/templates/editpage.tmpl +++ b/templates/editpage.tmpl @@ -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.

+ +

+While you were creating this page, someone else independently created a page +with the same name. +

+

+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. +

+
/ -- 2.45.2