* Patch from Ethan to improve behavior if a page is deleted or moved while
someone is editing it. * Some cleanup of field setting in the failed edit and conflict handling code.master
parent
2dfe3efcb7
commit
072967e62a
|
@ -290,7 +290,8 @@ sub cgi_editpage ($$) { #{{{
|
||||||
my $q=shift;
|
my $q=shift;
|
||||||
my $session=shift;
|
my $session=shift;
|
||||||
|
|
||||||
my @fields=qw(do rcsinfo subpage from page type editcontent comments);
|
my @fields=qw(do rcsinfo subpage from page type editcontent comments
|
||||||
|
newfile);
|
||||||
my @buttons=("Save Page", "Preview", "Cancel");
|
my @buttons=("Save Page", "Preview", "Cancel");
|
||||||
|
|
||||||
eval q{use CGI::FormBuilder};
|
eval q{use CGI::FormBuilder};
|
||||||
|
@ -352,10 +353,6 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$file=$page.".".$type;
|
$file=$page.".".$type;
|
||||||
}
|
}
|
||||||
|
|
||||||
my $newfile=0;
|
|
||||||
if (! -e "$config{srcdir}/$file") {
|
|
||||||
$newfile=1;
|
|
||||||
}
|
|
||||||
|
|
||||||
$form->field(name => "do", type => 'hidden');
|
$form->field(name => "do", type => 'hidden');
|
||||||
$form->field(name => "from", type => 'hidden');
|
$form->field(name => "from", type => 'hidden');
|
||||||
|
@ -366,6 +363,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$form->field(name => "comments", type => "text", size => 80);
|
$form->field(name => "comments", type => "text", size => 80);
|
||||||
$form->field(name => "editcontent", type => "textarea", rows => 20,
|
$form->field(name => "editcontent", type => "textarea", rows => 20,
|
||||||
cols => 80);
|
cols => 80);
|
||||||
|
$form->field(name => "newfile", type => 'hidden');
|
||||||
$form->tmpl_param("can_commit", $config{rcs});
|
$form->tmpl_param("can_commit", $config{rcs});
|
||||||
$form->tmpl_param("indexlink", indexlink());
|
$form->tmpl_param("indexlink", indexlink());
|
||||||
$form->tmpl_param("helponformattinglink",
|
$form->tmpl_param("helponformattinglink",
|
||||||
|
@ -374,13 +372,16 @@ sub cgi_editpage ($$) { #{{{
|
||||||
if (! $form->submitted) {
|
if (! $form->submitted) {
|
||||||
$form->field(name => "rcsinfo", value => rcs_prepedit($file),
|
$form->field(name => "rcsinfo", value => rcs_prepedit($file),
|
||||||
force => 1);
|
force => 1);
|
||||||
|
$form->field(name => "newfile",
|
||||||
|
value => ! -e "$config{srcdir}/$file",
|
||||||
|
force => 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($form->submitted eq "Cancel") {
|
if ($form->submitted eq "Cancel") {
|
||||||
if ($newfile && defined $from) {
|
if ($form->field(name => "newfile") && defined $from) {
|
||||||
redirect($q, "$config{url}/".htmlpage($from));
|
redirect($q, "$config{url}/".htmlpage($from));
|
||||||
}
|
}
|
||||||
elsif ($newfile) {
|
elsif ($form->field(name => "newfile")) {
|
||||||
redirect($q, $config{url});
|
redirect($q, $config{url});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
@ -495,6 +496,16 @@ sub cgi_editpage ($$) { #{{{
|
||||||
else {
|
else {
|
||||||
# save page
|
# save page
|
||||||
check_canedit($page, $q, $session);
|
check_canedit($page, $q, $session);
|
||||||
|
if (! -e "$config{srcdir}/$file" && ! $form->field(name => 'newfile')){
|
||||||
|
$form->tmpl_param("page_gone", 1);
|
||||||
|
$form->field(name => "newfile",
|
||||||
|
value => 1, force => 1);
|
||||||
|
$form->tmpl_param("page_select", 0);
|
||||||
|
$form->field(name => "page", type => 'hidden');
|
||||||
|
$form->field(name => "type", type => 'hidden');
|
||||||
|
print $form->render(submit => \@buttons);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
my $content=$form->field('editcontent');
|
my $content=$form->field('editcontent');
|
||||||
|
|
||||||
|
@ -510,8 +521,6 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$form->tmpl_param("failed_save", 1);
|
$form->tmpl_param("failed_save", 1);
|
||||||
$form->tmpl_param("error_message", $@);
|
$form->tmpl_param("error_message", $@);
|
||||||
$form->field("editcontent", value => $content, force => 1);
|
$form->field("editcontent", value => $content, force => 1);
|
||||||
$form->field(name => "comments", value => $form->field('comments'), force => 1);
|
|
||||||
$form->field("do", "edit)");
|
|
||||||
$form->tmpl_param("page_select", 0);
|
$form->tmpl_param("page_select", 0);
|
||||||
$form->field(name => "page", type => 'hidden');
|
$form->field(name => "page", type => 'hidden');
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
|
@ -528,7 +537,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
$message=$form->field('comments');
|
$message=$form->field('comments');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($newfile) {
|
if ($form->field(name => "newfile")) {
|
||||||
rcs_add($file);
|
rcs_add($file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -555,8 +564,7 @@ sub cgi_editpage ($$) { #{{{
|
||||||
force => 1);
|
force => 1);
|
||||||
$form->tmpl_param("page_conflict", 1);
|
$form->tmpl_param("page_conflict", 1);
|
||||||
$form->field("editcontent", value => $conflict, force => 1);
|
$form->field("editcontent", value => $conflict, force => 1);
|
||||||
$form->field(name => "comments", value => $form->field('comments'), force => 1);
|
$form->field("do", "edit", force => 1);
|
||||||
$form->field("do", "edit)");
|
|
||||||
$form->tmpl_param("page_select", 0);
|
$form->tmpl_param("page_select", 0);
|
||||||
$form->field(name => "page", type => 'hidden');
|
$form->field(name => "page", type => 'hidden');
|
||||||
$form->field(name => "type", type => 'hidden');
|
$form->field(name => "type", type => 'hidden');
|
||||||
|
|
|
@ -38,8 +38,12 @@ ikiwiki (1.44) UNRELEASED; urgency=low
|
||||||
search plugin.
|
search plugin.
|
||||||
* Correct a bug that could lead to infinite looping after signin in some
|
* Correct a bug that could lead to infinite looping after signin in some
|
||||||
circumstances.
|
circumstances.
|
||||||
|
* Patch from Ethan to improve behavior if a page is deleted or moved while
|
||||||
|
someone is editing it.
|
||||||
|
* Some cleanup of field setting in the failed edit and conflict handling
|
||||||
|
code.
|
||||||
|
|
||||||
-- Joey Hess <joeyh@debian.org> Fri, 23 Feb 2007 19:06:13 -0500
|
-- Joey Hess <joeyh@debian.org> Fri, 23 Feb 2007 19:26:46 -0500
|
||||||
|
|
||||||
ikiwiki (1.43) unstable; urgency=low
|
ikiwiki (1.43) unstable; urgency=low
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,15 @@ Your changes were not able to be saved to disk. The system gave the error:
|
||||||
Your changes are preserved below, and you can try again to save them.
|
Your changes are preserved below, and you can try again to save them.
|
||||||
</p>
|
</p>
|
||||||
</TMPL_IF>
|
</TMPL_IF>
|
||||||
|
<TMPL_IF NAME="PAGE_GONE">
|
||||||
|
<p>
|
||||||
|
<b>The page you were editing has disappeared.</b>
|
||||||
|
</p>
|
||||||
|
<p>
|
||||||
|
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_VAR FORM-START>
|
<TMPL_VAR FORM-START>
|
||||||
<div class="header">
|
<div class="header">
|
||||||
<span><TMPL_VAR INDEXLINK>/ <TMPL_VAR FORM-TITLE></span>
|
<span><TMPL_VAR INDEXLINK>/ <TMPL_VAR FORM-TITLE></span>
|
||||||
|
@ -40,6 +49,7 @@ Your changes are preserved below, and you can try again to save them.
|
||||||
<TMPL_VAR FIELD-DO>
|
<TMPL_VAR FIELD-DO>
|
||||||
<TMPL_VAR FIELD-FROM>
|
<TMPL_VAR FIELD-FROM>
|
||||||
<TMPL_VAR FIELD-RCSINFO>
|
<TMPL_VAR FIELD-RCSINFO>
|
||||||
|
<TMPL_VAR FIELD-NEWFILE>
|
||||||
<TMPL_IF NAME="PAGE_SELECT">
|
<TMPL_IF NAME="PAGE_SELECT">
|
||||||
Page location: <TMPL_VAR FIELD-PAGE>
|
Page location: <TMPL_VAR FIELD-PAGE>
|
||||||
Page type: <TMPL_VAR FIELD-TYPE>
|
Page type: <TMPL_VAR FIELD-TYPE>
|
||||||
|
|
Loading…
Reference in New Issue