diff options
author | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-17 23:57:03 +0000 |
---|---|---|
committer | joey <joey@0fa5a96a-9a0e-0410-b3b2-a0fd24251071> | 2007-03-17 23:57:03 +0000 |
commit | 26213f8ee443addfbc74e92a693e172d023b16e6 (patch) | |
tree | b034bfda2dc1ff04a7a5669f4c1a8d8747629915 | |
parent | 50a9ef47538666c565c26ad7125a9e6484330cfd (diff) | |
download | ikiwiki-26213f8ee443addfbc74e92a693e172d023b16e6.tar ikiwiki-26213f8ee443addfbc74e92a693e172d023b16e6.tar.gz |
* Detect the case of two people independently creating the same page at the
same time, and let the second person resolve the conflict.
-rw-r--r-- | IkiWiki/CGI.pm | 15 | ||||
-rw-r--r-- | debian/changelog | 4 | ||||
-rw-r--r-- | templates/editpage.tmpl | 11 |
3 files changed, 29 insertions, 1 deletions
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 <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 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. </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> |