fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2010-08-24 11:31 am

[dw-free] comment preview missing label and field

[commit: http://hg.dwscoalition.org/dw-free/rev/a6c9f17a72a4]

http://bugs.dwscoalition.org/show_bug.cgi?id=2770

Add labels for subject and comment body when previewing a comment. Also add
edit reason field.

Patch by [personal profile] kareila.

Files modified:
  • cgi-bin/LJ/Talk.pm
  • htdocs/talkpost_do.bml.text
--------------------------------------------------------------------------------
diff -r 1009397cf4f2 -r a6c9f17a72a4 cgi-bin/LJ/Talk.pm
--- a/cgi-bin/LJ/Talk.pm	Tue Aug 24 19:16:33 2010 +0800
+++ b/cgi-bin/LJ/Talk.pm	Tue Aug 24 19:31:21 2010 +0800
@@ -3658,10 +3658,18 @@ sub make_preview {
     # actually composing a comment includes it.  It is then put into this
     # form about 20 lines below: foreach (keys %$form).
     $ret .= "<div style='width: 90%'><form method='post'><p>\n";
+    $ret .= "<label for='subject'>$BML::ML{'/talkpost_do.bml.preview.edit.subject'}</label>";
     $ret .= "<input name='subject' size='50' maxlength='100' value='" . LJ::ehtml($form->{'subject'}) . "' /><br />";
+    $ret .= "<label for='body'>$BML::ML{'/talkpost_do.bml.preview.edit.body'}</label>";
     $ret .= "<textarea class='textbox' rows='10' cols='50' wrap='soft' name='body' style='width: 100%'>";
     $ret .= LJ::ehtml($form->{'body'});
     $ret .= "</textarea></p>";
+
+    # editreason
+    if ( $form->{edit} or $form->{editid} ) {
+        $ret .= "<label for='editreason'>$BML::ML{'/talkpost_do.bml.preview.edit.editreason'}</label>";
+        $ret .= "<input name='editreason' size='75' maxlength='255' value='" . LJ::ehtml( $form->{editreason} ) . "' />";
+    }
 
     # change mode:
     delete $form->{'submitpreview'}; $form->{'submitpost'} = 1;
@@ -3672,7 +3680,7 @@ sub make_preview {
     delete $form->{'do_spellcheck'};
     foreach (keys %$form) {
         $ret .= LJ::html_hidden($_, $form->{$_})
-            unless $_ eq 'body' || $_ eq 'subject' || $_ eq 'prop_opt_preformatted';
+            unless $_ eq 'body' || $_ eq 'subject' || $_ eq 'prop_opt_preformatted' || $_ eq 'editreason';
     }
 
     $ret .= "<br /><input type='submit' value='$BML::ML{'/talkpost_do.bml.preview.submit'}' />\n";
diff -r 1009397cf4f2 -r a6c9f17a72a4 htdocs/talkpost_do.bml.text
--- a/htdocs/talkpost_do.bml.text	Tue Aug 24 19:16:33 2010 +0800
+++ b/htdocs/talkpost_do.bml.text	Tue Aug 24 19:31:21 2010 +0800
@@ -62,6 +62,12 @@
 
 .preview=This is how your comment will look when posted. Using the form below, you can edit your comment further, or you can submit it as is.
 
+.preview.edit.body=<b>New message: </b>
+
+.preview.edit.editreason=<b>Reason for edit: </b>
+
+.preview.edit.subject=<b>New subject: </b>
+
 .preview.subject=<b>Subject: </b>
 
 .preview.submit=Submit
--------------------------------------------------------------------------------