Split out error messages from editpage.tmpl into several separate templates.

master
Joey Hess 2008-07-22 19:58:34 -04:00
parent 2b9615194e
commit d76c10cba2
8 changed files with 135 additions and 64 deletions

View File

@ -365,6 +365,7 @@ sub cgi_editpage ($$) { #{{{
htmllink($page, $page, "ikiwiki/formatting", htmllink($page, $page, "ikiwiki/formatting",
noimageinline => 1, noimageinline => 1,
linktext => "FormattingHelp")); linktext => "FormattingHelp"));
$form->tmpl_param("message", "");
if ($form->submitted eq "Cancel") { if ($form->submitted eq "Cancel") {
if ($form->field("do") eq "create" && defined $from) { if ($form->field("do") eq "create" && defined $from) {
@ -416,7 +417,6 @@ sub cgi_editpage ($$) { #{{{
elsif ($form->submitted eq "Save Page") { elsif ($form->submitted eq "Save Page") {
$form->tmpl_param("page_preview", ""); $form->tmpl_param("page_preview", "");
} }
$form->tmpl_param("page_conflict", "");
if ($form->submitted ne "Save Page" || ! $form->validate) { if ($form->submitted ne "Save Page" || ! $form->validate) {
if ($form->field("do") eq "create") { if ($form->field("do") eq "create") {
@ -532,7 +532,7 @@ sub cgi_editpage ($$) { #{{{
if ($form->field("do") ne "create" && ! $exists && if ($form->field("do") ne "create" && ! $exists &&
! defined srcfile($file, 1)) { ! defined srcfile($file, 1)) {
$form->tmpl_param("page_gone", 1); $form->tmpl_param("message", template("editpagegone.tmpl")->output);
$form->field(name => "do", value => "create", force => 1); $form->field(name => "do", value => "create", force => 1);
$form->tmpl_param("page_select", 0); $form->tmpl_param("page_select", 0);
$form->field(name => "page", type => 'hidden'); $form->field(name => "page", type => 'hidden');
@ -542,7 +542,7 @@ sub cgi_editpage ($$) { #{{{
return; return;
} }
elsif ($form->field("do") eq "create" && $exists) { elsif ($form->field("do") eq "create" && $exists) {
$form->tmpl_param("creation_conflict", 1); $form->tmpl_param("message", template("editcreationconflict.tmpl")->output);
$form->field(name => "do", value => "edit", force => 1); $form->field(name => "do", value => "edit", force => 1);
$form->tmpl_param("page_select", 0); $form->tmpl_param("page_select", 0);
$form->field(name => "page", type => 'hidden'); $form->field(name => "page", type => 'hidden');
@ -575,8 +575,9 @@ sub cgi_editpage ($$) { #{{{
if ($@) { if ($@) {
$form->field(name => "rcsinfo", value => rcs_prepedit($file), $form->field(name => "rcsinfo", value => rcs_prepedit($file),
force => 1); force => 1);
$form->tmpl_param("failed_save", 1); my $mtemplate=template("editfailedsave.tmpl");
$form->tmpl_param("error_message", $@); $mtemplate->param(error_message => $@);
$form->tmpl_param("message", $mtemplate->output);
$form->field("editcontent", value => $content, force => 1); $form->field("editcontent", value => $content, force => 1);
$form->tmpl_param("page_select", 0); $form->tmpl_param("page_select", 0);
$form->field(name => "page", type => 'hidden'); $form->field(name => "page", type => 'hidden');
@ -620,7 +621,7 @@ sub cgi_editpage ($$) { #{{{
if (defined $conflict) { if (defined $conflict) {
$form->field(name => "rcsinfo", value => rcs_prepedit($file), $form->field(name => "rcsinfo", value => rcs_prepedit($file),
force => 1); force => 1);
$form->tmpl_param("page_conflict", 1); $form->tmpl_param("message", template("editconflict.tmpl")->output);
$form->field("editcontent", value => $conflict, force => 1); $form->field("editcontent", value => $conflict, force => 1);
$form->field("do", "edit", force => 1); $form->field("do", "edit", force => 1);
$form->tmpl_param("page_select", 0); $form->tmpl_param("page_select", 0);

2
debian/changelog vendored
View File

@ -19,6 +19,8 @@ ikiwiki (2.55) UNRELEASED; urgency=low
some situations. some situations.
* Don't allow uploading an attachment with the same name as an existing * Don't allow uploading an attachment with the same name as an existing
page, to avoid confusion. page, to avoid confusion.
* Split out error messages from editpage.tmpl into several separate
templates.
-- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2008 11:35:46 -0400 -- Joey Hess <joeyh@debian.org> Mon, 21 Jul 2008 11:35:46 -0400

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2008-07-21 10:11-0400\n" "POT-Creation-Date: 2008-07-22 19:44-0400\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -62,16 +62,16 @@ msgid "creating %s"
msgstr "" msgstr ""
#: ../IkiWiki/CGI.pm:512 ../IkiWiki/CGI.pm:540 ../IkiWiki/CGI.pm:550 #: ../IkiWiki/CGI.pm:512 ../IkiWiki/CGI.pm:540 ../IkiWiki/CGI.pm:550
#: ../IkiWiki/CGI.pm:584 ../IkiWiki/CGI.pm:629 #: ../IkiWiki/CGI.pm:586 ../IkiWiki/CGI.pm:631
#, perl-format #, perl-format
msgid "editing %s" msgid "editing %s"
msgstr "" msgstr ""
#: ../IkiWiki/CGI.pm:729 #: ../IkiWiki/CGI.pm:731
msgid "You are banned." msgid "You are banned."
msgstr "" msgstr ""
#: ../IkiWiki/CGI.pm:758 ../IkiWiki/CGI.pm:759 ../IkiWiki.pm:783 #: ../IkiWiki/CGI.pm:760 ../IkiWiki/CGI.pm:761 ../IkiWiki.pm:783
msgid "Error" msgid "Error"
msgstr "" msgstr ""
@ -173,15 +173,20 @@ msgstr ""
msgid "Failed to delete file from S3: " msgid "Failed to delete file from S3: "
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:110 #: ../IkiWiki/Plugin/attachment.pm:22
#, perl-format
msgid "there is already a page named %s"
msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:41
msgid "prohibited by allowed_attachments"
msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:144
msgid "bad attachment filename" msgid "bad attachment filename"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:133 #: ../IkiWiki/Plugin/attachment.pm:186
msgid "attachment rejected"
msgstr ""
#: ../IkiWiki/Plugin/attachment.pm:169
msgid "attachment upload" msgid "attachment upload"
msgstr "" msgstr ""
@ -232,27 +237,27 @@ msgstr ""
msgid "prog not a valid graphviz program" msgid "prog not a valid graphviz program"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/img.pm:49 #: ../IkiWiki/Plugin/img.pm:53
msgid "Image::Magick is not installed" msgid "Image::Magick is not installed"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/img.pm:56 #: ../IkiWiki/Plugin/img.pm:60
#, perl-format #, perl-format
msgid "bad size \"%s\"" msgid "bad size \"%s\""
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/img.pm:66 ../IkiWiki/Plugin/img.pm:70 #: ../IkiWiki/Plugin/img.pm:70 ../IkiWiki/Plugin/img.pm:74
#: ../IkiWiki/Plugin/img.pm:87 #: ../IkiWiki/Plugin/img.pm:91
#, perl-format #, perl-format
msgid "failed to read %s: %s" msgid "failed to read %s: %s"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/img.pm:73 #: ../IkiWiki/Plugin/img.pm:77
#, perl-format #, perl-format
msgid "failed to resize: %s" msgid "failed to resize: %s"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/img.pm:104 #: ../IkiWiki/Plugin/img.pm:108
#, perl-format #, perl-format
msgid "failed to determine size of image %s" msgid "failed to determine size of image %s"
msgstr "" msgstr ""
@ -496,6 +501,76 @@ msgstr ""
msgid "(Diff truncated)" msgid "(Diff truncated)"
msgstr "" msgstr ""
#: ../IkiWiki/Plugin/remove.pm:23 ../IkiWiki/Plugin/rename.pm:26
#, perl-format
msgid "%s does not exist"
msgstr ""
#: ../IkiWiki/Plugin/remove.pm:30
#, perl-format
msgid "%s is not in the srcdir, so it cannot be deleted"
msgstr ""
#: ../IkiWiki/Plugin/remove.pm:33 ../IkiWiki/Plugin/rename.pm:35
#, perl-format
msgid "%s is not a file"
msgstr ""
#: ../IkiWiki/Plugin/remove.pm:100
#, perl-format
msgid "confirm removal of %s"
msgstr ""
#: ../IkiWiki/Plugin/remove.pm:136
msgid "Please select the attachments to remove."
msgstr ""
#: ../IkiWiki/Plugin/remove.pm:176
msgid "removed"
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:32
#, perl-format
msgid "%s is not in the srcdir, so it cannot be renamed"
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:47
msgid "no change to the file name was specified"
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:53
#, perl-format
msgid "illegal name"
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:58
#, perl-format
msgid "%s already exists"
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:64
#, perl-format
msgid "%s already exists on disk"
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:98
#, perl-format
msgid "rename %s"
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:181
msgid "Only one attachment can be renamed at a time."
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:184
msgid "Please select the attachment to rename."
msgstr ""
#: ../IkiWiki/Plugin/rename.pm:229
#, perl-format
msgid "rename %s to %s"
msgstr ""
#: ../IkiWiki/Plugin/search.pm:20 #: ../IkiWiki/Plugin/search.pm:20
#, perl-format #, perl-format
msgid "Must specify %s when using the search plugin" msgid "Must specify %s when using the search plugin"
@ -608,7 +683,7 @@ msgstr ""
msgid "failed to generate image from code" msgid "failed to generate image from code"
msgstr "" msgstr ""
#: ../IkiWiki/Rcs/Stub.pm:69 #: ../IkiWiki/Rcs/Stub.pm:96
msgid "getctime not implemented" msgid "getctime not implemented"
msgstr "" msgstr ""

View File

@ -0,0 +1,7 @@
<p class="error">
<b>Your changes conflict with other changes made to the page.</b>
</p>
<p>
Conflict markers have been inserted into the page content. Reconcile the
conflict and commit again to save your changes.
</p>

View File

@ -0,0 +1,9 @@
<p class="error">
<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
together before saving.
</p>

View File

@ -0,0 +1,10 @@
<p class="error">
<b>Failed to save your changes.</b>
</p>
<p>
Your changes were not able to be saved to disk. The system gave the error:
<blockquote>
<TMPL_VAR ERROR_MESSAGE>
</blockquote>
Your changes are preserved below, and you can try again to save them.
</p>

View File

@ -1,46 +1,6 @@
<br /> <br />
<TMPL_VAR JAVASCRIPT> <TMPL_VAR JAVASCRIPT>
<TMPL_IF NAME="PAGE_CONFLICT"> <TMPL_VAR MESSAGE>
<p>
<b>Your changes conflict with other changes made to the page.</b>
</p>
<p>
Conflict markers have been inserted into the page content. Reconcile the
conflict and commit again to save your changes.
</p>
</TMPL_IF>
<TMPL_IF NAME="FAILED_SAVE">
<p>
<b>Failed to save your changes.</b>
</p>
<p>
Your changes were not able to be saved to disk. The system gave the error:
<blockquote>
<TMPL_VAR ERROR_MESSAGE>
</blockquote>
Your changes are preserved below, and you can try again to save them.
</p>
</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_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
together before saving.
</p>
</TMPL_IF>
<TMPL_VAR FORM-START> <TMPL_VAR FORM-START>
<TMPL_VAR FIELD-DO> <TMPL_VAR FIELD-DO>
<TMPL_VAR FIELD-SID> <TMPL_VAR FIELD-SID>

View File

@ -0,0 +1,7 @@
<p class="error">
<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>