afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-04-05 03:00 am

[dw-free] Quickreply comment box should include Preview button

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

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

Preview button for on quick reply.

Patch by [personal profile] allen.

Files modified:
  • cgi-bin/weblib.pl
  • htdocs/js/quickreply.js
  • htdocs/talkread.bml.text
--------------------------------------------------------------------------------
diff -r 20d5107ac17b -r 723074a3a48f cgi-bin/weblib.pl
--- a/cgi-bin/weblib.pl	Sun Apr 05 02:11:31 2009 +0000
+++ b/cgi-bin/weblib.pl	Sun Apr 05 02:59:14 2009 +0000
@@ -744,6 +744,13 @@ sub create_qr_div {
                                { 'id' => 'submitpost',
                                  'raw' => 'onclick="if (checkLength()) {submitform();}"'
                                  });
+
+    $qrhtml .=" " . LJ::html_submit('submitpview', BML::ml('talk.btn.preview'),
+                               { 'id' => 'submitpview',
+                                 'raw' => 'onclick="preview()"'
+                                 });
+
+    $qrhtml .= LJ::html_hidden('submitpreview', '0');
 
     $qrhtml .= " " . LJ::html_submit('submitmoreopts', BML::ml('/talkread.bml.button.more'),
                                           { 'id' => 'submitmoreopts',
diff -r 20d5107ac17b -r 723074a3a48f htdocs/js/quickreply.js
--- a/htdocs/js/quickreply.js	Sun Apr 05 02:11:31 2009 +0000
+++ b/htdocs/js/quickreply.js	Sun Apr 05 02:59:14 2009 +0000
@@ -31,7 +31,7 @@
         var subject = xGetElementById('subject');
 
         // Is this a dumb browser?
-        if( !ptalkid || !rto || !dtid_field || !qr_div || !cur_div || !qr_form || 
+        if( !ptalkid || !rto || !dtid_field || !qr_div || !cur_div || !qr_form ||
             !qr_form_div || !subject) {
             return true;
         }
@@ -116,11 +116,13 @@
    function submitform()
    {
         var submitmore = xGetElementById('submitmoreopts');
+        var submitpview = xGetElementById('submitpview');
         var submit = xGetElementById('submitpost');
         if (!submitmore || !submit) return false;
 
         submit.disabled = true;
         submitmore.disabled = true;
+        submitpview.disabled = true;
 
         // New top-level comments
         var dtid = xGetElementById('dtid');
@@ -134,6 +136,13 @@
 
         // don't do default form action
         return false;
+   }
+
+   function preview()
+   {
+        var qr_form = xGetElementById('qrform');
+        qr_form.submitpreview.value=1;
+        submitform();
    }
 
    function swapnodes (orig, to_swap) {
diff -r 20d5107ac17b -r 723074a3a48f htdocs/talkread.bml.text
--- a/htdocs/talkread.bml.text	Sun Apr 05 02:11:31 2009 +0000
+++ b/htdocs/talkread.bml.text	Sun Apr 05 02:59:14 2009 +0000
@@ -23,7 +23,7 @@
 
 .posted=Comment Posted Successfully
 
-.qr.spellcheck=Check spelling and preview
+.qr.spellcheck=Check spelling
 
 .replysuspended=<b>(Reply from suspended user)</b>
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org