includes/clientside/static/comments.js
changeset 359 e0787bb6285b
parent 328 dc838fd61a06
child 407 35d94240a197
equal deleted inserted replaced
358:b25d34fbc7ab 359:e0787bb6285b
   216   tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>';
   216   tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>';
   217   
   217   
   218   // Moderation: Delete post link
   218   // Moderation: Delete post link
   219   tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>';
   219   tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>';
   220   
   220   
       
   221   // Moderation: IP address link
       
   222   if ( this_comment.have_ip )
       
   223   {
       
   224     tplvars.MOD_IP_LINK = '<span id="comment_ip_' + i + '"><a href="#mod_ip_' + i + '" onclick="viewCommentIP(' + this_comment.comment_id + ', ' + i + '); return false;">' + $lang.get('comment_btn_mod_ip_logged') + '</a></span>';
       
   225   }
       
   226   else
       
   227   {
       
   228     tplvars.MOD_IP_LINK = $lang.get('comment_btn_mod_ip_missing');
       
   229   }
       
   230   
   221   var tplbool = new Object();
   231   var tplbool = new Object();
   222   
   232   
   223   tplbool.signature = ( this_comment.signature == '' ) ? false : true;
   233   tplbool.signature = ( this_comment.signature == '' ) ? false : true;
   224   tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   234   tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   225   tplbool.auth_mod = data.auth_mod_comments;
   235   tplbool.auth_mod = data.auth_mod_comments;
   374   }
   384   }
   375   if ( data.src )
   385   if ( data.src )
   376   {
   386   {
   377     document.getElementById('comment_source_' + data.id).value = data.src;
   387     document.getElementById('comment_source_' + data.id).value = data.src;
   378   }
   388   }
       
   389   if ( data.ip_addr )
       
   390   {
       
   391     var span = $('comment_ip_' + data.local_id).object;
       
   392     if ( !span )
       
   393       return false;
       
   394     span.innerHTML = $lang.get('comment_msg_ip_address') + ' <a href="#rdns" onclick="ajaxReverseDNS(this); return false;">' + data.ip_addr + '</a>';
       
   395   }
   379 }
   396 }
   380 
   397 
   381 function approveComment(id)
   398 function approveComment(id)
   382 {
   399 {
   383   var div = document.getElementById('comment_holder_'+id);
   400   var div = document.getElementById('comment_holder_'+id);
   477   var appr = ( data.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
   494   var appr = ( data.approved == 1 ) ? $lang.get('comment_btn_mod_unapprove') : $lang.get('comment_btn_mod_approve');
   478   tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>';
   495   tplvars.MOD_APPROVE_LINK='<a href="#approve_'+i+'" id="comment_approve_'+i+'" onclick="approveComment(\''+i+'\'); return false;">'+appr+'</a>';
   479   
   496   
   480   // Moderation: Delete post link
   497   // Moderation: Delete post link
   481   tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>';
   498   tplvars.MOD_DELETE_LINK='<a href="#mod_del_'+i+'" onclick="deleteComment(\''+i+'\'); return false;">' + $lang.get('comment_btn_mod_delete') + '</a>';
       
   499   
       
   500   // Moderation: IP address link
       
   501   tplvars.MOD_IP_LINK = '<span id="comment_ip_' + i + '"><a href="#mod_ip_' + i + '" onclick="viewCommentIP(' + data.comment_id + ', ' + i + '); return false;">' + $lang.get('comment_btn_mod_ip_logged') + '</a></span>';
   482   
   502   
   483   var tplbool = new Object();
   503   var tplbool = new Object();
   484   
   504   
   485   tplbool.signature = ( data.signature == '' ) ? false : true;
   505   tplbool.signature = ( data.signature == '' ) ? false : true;
   486   tplbool.can_edit = ( data.auth_edit_comments && ( ( data.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   506   tplbool.can_edit = ( data.auth_edit_comments && ( ( data.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   580     span.innerHTML = count_msg;
   600     span.innerHTML = count_msg;
   581     status.appendChild(span);
   601     status.appendChild(span);
   582   }
   602   }
   583 }
   603 }
   584 
   604 
       
   605 function viewCommentIP(id, local_id)
       
   606 {
       
   607   // set "loading" indicator on IP button
       
   608   var span = $('comment_ip_' + local_id).object;
       
   609   if ( !span )
       
   610     return false;
       
   611   span.innerHTML = '<img alt="..." src="' + ajax_load_icon + '" />';
       
   612   
       
   613   var parms = {
       
   614     mode: 'view_ip',
       
   615     id: id,
       
   616     local_id: local_id
       
   617   }
       
   618   ajaxComments(parms);
       
   619 }
       
   620 
   585 function htmlspecialchars(text)
   621 function htmlspecialchars(text)
   586 {
   622 {
   587   text = text.replace(/</g, '&lt;');
   623   text = text.replace(/</g, '&lt;');
   588   text = text.replace(/>/g, '&gt;');
   624   text = text.replace(/>/g, '&gt;');
   589   return text;
   625   return text;