changeset 155:4d2f0d6866e5

Updated the display of the blog comment when using AJAX
author Steve Kemp <steve@steve.org.uk>
date Thu, 03 Jan 2008 21:45:58 +0000
parents 9f91d9377d1a
children 8b0c547cd015
files cgi-bin/comments.cgi themes/blog.steve.org.uk/comment-form.inc
diffstat 2 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/cgi-bin/comments.cgi	Thu Jan 03 21:44:20 2008 +0000
+++ b/cgi-bin/comments.cgi	Thu Jan 03 21:45:58 2008 +0000
@@ -134,6 +134,8 @@
 #  Open the file.
 #
 my $file = $COMMENT . "/" . $id . "." . $timestr;
+$file =~ s/[ \t]//g;
+
 open( FILE, ">", $file );
 print FILE "Name: $name\n";
 print FILE "Mail: $mail\n";
@@ -149,13 +151,13 @@
 #
 if ( length($TO) && length($FROM) )
 {
-    open  ( SENDMAIL, "|/usr/lib/sendmail -t -f $FROM");
-    print SENDMAIL "To: $TO\n";
-    print SENDMAIL "From: $FROM\n";
-    print SENDMAIL "Subject: New Comment [$id]\n";
-    print SENDMAIL "\n\n";
-    print ( SENDMAIL  `cat $file` );
-    close ( SENDMAIL );
+    open ( SENDMAIL, "|/usr/lib/sendmail -t -f $FROM");
+    print  SENDMAIL "To: $TO\n";
+    print  SENDMAIL "From: $FROM\n";
+    print  SENDMAIL "Subject: New Comment [$id]\n";
+    print  SENDMAIL "\n\n";
+    print  SENDMAIL  `cat $file`;
+    close( SENDMAIL );
 }
 
 #
@@ -164,8 +166,10 @@
 if ( $cgi->param( "ajax" ) )
 {
     print <<EOF;
-
+<h3>Comment Submitted</h3>
+<blockquote>
 <p>Thanks for your comment, it will be made live when the queue is moderated next.</p>
+</blockquote>
 
 EOF
     exit;
--- a/themes/blog.steve.org.uk/comment-form.inc	Thu Jan 03 21:44:20 2008 +0000
+++ b/themes/blog.steve.org.uk/comment-form.inc	Thu Jan 03 21:45:58 2008 +0000
@@ -1,7 +1,7 @@
 <!-- tmpl_if name='comments_enabled' -->
+<div id="output">
 <h3>Add A Comment</h3>
 <blockquote>
-<div id="output">
 <form action="/cgi-bin/comments.cgi" method="post">
 <input type="hidden" name="id" value="<!-- tmpl_var name='link' escape='html' -->">
 <input type="hidden" name="captcha" value="">
@@ -17,6 +17,6 @@
 </table>
 </form>
 <p>Your submission will be ignored if any field is left blank.  But your email address will not be displayed.</p>
+</blockquote>
 </div>
-</blockquote>
 <!-- /tmpl_if -->