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. --Ethan
9 diff -urX /home/glasserc/ignorepats /home/glasserc/ikiclean/IkiWiki/CGI.pm /home/glasserc/ikidev/IkiWiki/CGI.pm
10 --- /home/glasserc/ikiclean/IkiWiki/CGI.pm 2007-02-11 21:40:32.419641000 -0800
11 +++ /home/glasserc/ikidev/IkiWiki/CGI.pm 2007-02-12 15:35:55.178886000 -0800
16 - my @fields=qw(do rcsinfo subpage from page type editcontent comments);
17 + my @fields=qw(do rcsinfo subpage from page type editcontent comments newfile);
18 my @buttons=("Save Page", "Preview", "Cancel");
20 eval q{use CGI::FormBuilder};
22 $file=$page.".".$type;
26 - if (! -e "$config{srcdir}/$file") {
30 $form->field(name => "do", type => 'hidden');
31 $form->field(name => "from", type => 'hidden');
33 $form->field(name => "comments", type => "text", size => 80);
34 $form->field(name => "editcontent", type => "textarea", rows => 20,
36 + $form->field(name => "newfile", type => 'hidden');
37 $form->tmpl_param("can_commit", $config{rcs});
38 $form->tmpl_param("indexlink", indexlink());
39 $form->tmpl_param("helponformattinglink",
41 if (! $form->submitted) {
42 $form->field(name => "rcsinfo", value => rcs_prepedit($file),
44 + $form->field(name => "newfile",
45 + value => ! -e "$config{srcdir}/$file",
49 + my $newfile = $form->field(name => "newfile");
51 if ($form->submitted eq "Cancel") {
52 if ($newfile && defined $from) {
53 redirect($q, "$config{url}/".htmlpage($from));
57 check_canedit($page, $q, $session);
58 + if (! -e "$config{srcdir}/$file" && ! $form->field(name => 'newfile')){
59 + $form->tmpl_param("page_gone", 1);
60 + $form->field(name => "newfile",
61 + value => 1, force => 1);
62 + $form->tmpl_param("page_select", 0);
63 + $form->field(name => "page", type => 'hidden');
64 + $form->field(name => "type", type => 'hidden');
65 + print $form->render(submit => \@buttons);
69 my $content=$form->field('editcontent');
73 $form->tmpl_param("page_conflict", 1);
74 $form->field("editcontent", value => $conflict, force => 1);
75 - $form->field(name => "comments", value => $form->field('comments'), force => 1);
76 - $form->field("do", "edit)");
77 + $form->field("do", "edit");
78 $form->tmpl_param("page_select", 0);
79 $form->field(name => "page", type => 'hidden');
80 $form->field(name => "type", type => 'hidden');
81 diff -urX /home/glasserc/ignorepats /home/glasserc/ikiclean/templates/editpage.tmpl /home/glasserc/ikidev/templates/editpage.tmpl
82 --- /home/glasserc/ikiclean/templates/editpage.tmpl 2007-02-11 21:40:35.046470000 -0800
83 +++ /home/glasserc/ikidev/templates/editpage.tmpl 2007-02-12 15:33:38.503571000 -0800
85 conflict and commit again to save your changes.
88 +<TMPL_IF NAME="PAGE_GONE">
90 +<b>The page you were editing has disappeared.</b>
93 +Perhaps someone else has deleted it or moved it. If you want to recreate
94 +this page with your text, click "Save Page" again.
99 <span><TMPL_VAR INDEXLINK>/ <TMPL_VAR FORM-TITLE></span>
102 <TMPL_VAR FIELD-FROM>
103 <TMPL_VAR FIELD-RCSINFO>
104 +<TMPL_VAR FIELD-NEWFILE>
105 <TMPL_IF NAME="PAGE_SELECT">
106 Page location: <TMPL_VAR FIELD-PAGE>
107 Page type: <TMPL_VAR FIELD-TYPE>