1 If one user (via SVN or otherwise) deletes or moves a page while another user
2 is editing it via the web, bad things happen. This patch addresses this by
3 failing gracefully, and allowing the user to commit a new file with the same
6 The patch is [here](http://ikidev.betacantrips.com//patches/disappear.patch).
7 It requires a strip level of 4 -- sorry about that. There are also some
8 other changes in the conflict-resolution section which seemed to make sense,
9 let me know what you think. --Ethan
11 diff -urX /home/glasserc/ignorepats /home/glasserc/ikiclean/IkiWiki/CGI.pm /home/glasserc/ikidev/IkiWiki/CGI.pm
12 --- /home/glasserc/ikiclean/IkiWiki/CGI.pm 2007-02-11 21:40:32.419641000 -0800
13 +++ /home/glasserc/ikidev/IkiWiki/CGI.pm 2007-02-12 15:35:55.178886000 -0800
18 - my @fields=qw(do rcsinfo subpage from page type editcontent comments);
19 + my @fields=qw(do rcsinfo subpage from page type editcontent comments newfile);
20 my @buttons=("Save Page", "Preview", "Cancel");
22 eval q{use CGI::FormBuilder};
24 $file=$page.".".$type;
28 - if (! -e "$config{srcdir}/$file") {
32 $form->field(name => "do", type => 'hidden');
33 $form->field(name => "from", type => 'hidden');
35 $form->field(name => "comments", type => "text", size => 80);
36 $form->field(name => "editcontent", type => "textarea", rows => 20,
38 + $form->field(name => "newfile", type => 'hidden');
39 $form->tmpl_param("can_commit", $config{rcs});
40 $form->tmpl_param("indexlink", indexlink());
41 $form->tmpl_param("helponformattinglink",
43 if (! $form->submitted) {
44 $form->field(name => "rcsinfo", value => rcs_prepedit($file),
46 + $form->field(name => "newfile",
47 + value => ! -e "$config{srcdir}/$file",
51 + my $newfile = $form->field(name => "newfile");
53 if ($form->submitted eq "Cancel") {
54 if ($newfile && defined $from) {
55 redirect($q, "$config{url}/".htmlpage($from));
59 check_canedit($page, $q, $session);
60 + if (! -e "$config{srcdir}/$file" && ! $form->field(name => 'newfile')){
61 + $form->tmpl_param("page_gone", 1);
62 + $form->field(name => "newfile",
63 + value => 1, force => 1);
64 + $form->tmpl_param("page_select", 0);
65 + $form->field(name => "page", type => 'hidden');
66 + $form->field(name => "type", type => 'hidden');
67 + print $form->render(submit => \@buttons);
71 my $content=$form->field('editcontent');
75 $form->tmpl_param("page_conflict", 1);
76 $form->field("editcontent", value => $conflict, force => 1);
77 - $form->field(name => "comments", value => $form->field('comments'), force => 1);
78 - $form->field("do", "edit)");
79 + $form->field("do", "edit");
80 $form->tmpl_param("page_select", 0);
81 $form->field(name => "page", type => 'hidden');
82 $form->field(name => "type", type => 'hidden');
83 diff -urX /home/glasserc/ignorepats /home/glasserc/ikiclean/templates/editpage.tmpl /home/glasserc/ikidev/templates/editpage.tmpl
84 --- /home/glasserc/ikiclean/templates/editpage.tmpl 2007-02-11 21:40:35.046470000 -0800
85 +++ /home/glasserc/ikidev/templates/editpage.tmpl 2007-02-12 15:33:38.503571000 -0800
87 conflict and commit again to save your changes.
90 +<TMPL_IF NAME="PAGE_GONE">
92 +<b>The page you were editing has disappeared.</b>
95 +Perhaps someone else has deleted it or moved it. If you want to recreate
96 +this page with your text, click "Save Page" again.
101 <span><TMPL_VAR INDEXLINK>/ <TMPL_VAR FORM-TITLE></span>
104 <TMPL_VAR FIELD-FROM>
105 <TMPL_VAR FIELD-RCSINFO>
106 +<TMPL_VAR FIELD-NEWFILE>
107 <TMPL_IF NAME="PAGE_SELECT">
108 Page location: <TMPL_VAR FIELD-PAGE>
109 Page type: <TMPL_VAR FIELD-TYPE>