includes/clientside/static/comments.js
changeset 102 d807dcd7aed7
parent 86 c162ca39db8f
child 108 1c7f59df9474
equal deleted inserted replaced
101:bb4e677a4da9 102:d807dcd7aed7
   145     
   145     
   146   }
   146   }
   147     
   147     
   148   document.getElementById('ajaxEditContainer').innerHTML = html;
   148   document.getElementById('ajaxEditContainer').innerHTML = html;
   149   
   149   
   150   //for ( i = 0; i < data.comments.length; i++ )
   150   for ( i = 0; i < data.comments.length; i++ )
   151   //{
   151   {
   152   //  document.getElementById('comment_source_'+i).value = data.comments[i].comment_source;
   152     document.getElementById('comment_source_'+i).value = data.comments[i].comment_source;
   153   //}
   153   }
   154   
   154   
   155 }
   155 }
   156 
   156 
   157 var _render_comment = function(this_comment, data)
   157 var _render_comment = function(this_comment, data)
   158 {
   158 {
   228 }
   228 }
   229 
   229 
   230 function editComment(id, link)
   230 function editComment(id, link)
   231 {
   231 {
   232   var ctr = document.getElementById('subject_'+id);
   232   var ctr = document.getElementById('subject_'+id);
   233   var subj = trim(ctr.firstChild.nodeValue); // If there's a span in there that says 'unapproved', this eliminates it
   233   var subj = ( ctr.firstChild ) ? trim(ctr.firstChild.nodeValue) : ''; // If there's a span in there that says 'unapproved', this eliminates it
   234   ctr.innerHTML = '';
   234   ctr.innerHTML = '';
   235   var ipt = document.createElement('input');
   235   var ipt = document.createElement('input');
   236   ipt.id = 'subject_edit_'+id;
   236   ipt.id = 'subject_edit_'+id;
   237   ipt.value = subj;
   237   ipt.value = subj;
   238   ctr.appendChild(ipt);
   238   ctr.appendChild(ipt);
   271   ajaxComments(req);
   271   ajaxComments(req);
   272 }
   272 }
   273 
   273 
   274 function deleteComment(id)
   274 function deleteComment(id)
   275 {
   275 {
   276   //var c = confirm('Do you really want to delete this comment?');
   276   if ( !shift )
   277   //if(!c);
   277   {
   278   //  return false;
   278     var c = confirm('Do you really want to delete this comment?');
       
   279     if(!c)
       
   280       return false;
       
   281   }
   279   var div = document.getElementById('comment_holder_'+id);
   282   var div = document.getElementById('comment_holder_'+id);
   280   var real_id = div.getElementsByTagName('input')[0]['value'];
   283   var real_id = div.getElementsByTagName('input')[0]['value'];
   281   var req = {
   284   var req = {
   282     'mode' : 'delete',
   285     'mode' : 'delete',
   283     'id'   : real_id,
   286     'id'   : real_id,
   298   }
   301   }
   299   else
   302   else
   300   {
   303   {
   301     var captcha_code = '';
   304     var captcha_code = '';
   302     var captcha_id   = '';
   305     var captcha_id   = '';
       
   306   }
       
   307   if ( subj == '' )
       
   308   {
       
   309     new messagebox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter a subject for your comment.');
       
   310     return false;
       
   311   }
       
   312   if ( text == '' )
       
   313   {
       
   314     new messagebox(MB_OK|MB_ICONSTOP, 'Input validation failed', 'Please enter some text for the body of your comment .');
       
   315     return false;
   303   }
   316   }
   304   var req = {
   317   var req = {
   305     'mode' : 'submit',
   318     'mode' : 'submit',
   306     'name' : name,
   319     'name' : name,
   307     'subj' : subj,
   320     'subj' : subj,