includes/clientside/static/comments.js
changeset 748 e39454295bbb
parent 582 a38876c0793c
child 754 75decd836c94
--- a/includes/clientside/static/comments.js	Thu Nov 20 22:58:30 2008 -0500
+++ b/includes/clientside/static/comments.js	Thu Nov 20 22:59:11 2008 -0500
@@ -154,6 +154,10 @@
   }
     
   document.getElementById('ajaxEditContainer').innerHTML = html;
+  if ( document.getElementById('commentform_message') )
+  {
+    document.getElementById('commentform_message').allow_wysiwyg = data.auth_edit_wysiwyg
+  }
   
   for ( i = 0; i < data.comments.length; i++ )
   {
@@ -261,6 +265,8 @@
 {
   document.getElementById('leave_comment_button').style.display = 'none';
   document.getElementById('comment_form').style.display = 'block';
+  if ( $dynano('commentform_message').object.allow_wysiwyg )
+    $dynano('commentform_message').makeSwitchable();
 }
 
 window.hideCommentForm = function()
@@ -289,6 +295,7 @@
   ta.value = src;
   ta.id = 'comment_edit_'+id;
   cmt.appendChild(ta);
+  $dynano(ta).makeSwitchable();
   
   link.style.fontWeight = 'bold';
   link.innerHTML = $lang.get('comment_btn_save');
@@ -336,7 +343,7 @@
 {
   var name = document.getElementById('commentform_name').value;
   var subj = document.getElementById('commentform_subject').value;
-  var text = document.getElementById('commentform_message').value;
+  var text = $dynano('commentform_message').getContent();
   if ( document.getElementById('commentform_captcha') )
   {
     var captcha_code = document.getElementById('commentform_captcha').value;
@@ -349,11 +356,15 @@
   }
   if ( subj == '' )
   {
+    load_component('messagebox');
+    load_component('fadefilter');
     new MessageBox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter a subject for your comment.');
     return false;
   }
   if ( text == '' )
   {
+    load_component('messagebox');
+    load_component('fadefilter');
     new MessageBox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter some text for the body of your comment .');
     return false;
   }