includes/clientside/static/comments.js
changeset 108 1c7f59df9474
parent 102 d807dcd7aed7
child 212 30b857a6b811
equal deleted inserted replaced
107:4042c4dd5ba4 108:1c7f59df9474
   179     tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '">' + this_comment.name + '</a>';
   179     tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '">' + this_comment.name + '</a>';
   180   
   180   
   181   // User level
   181   // User level
   182   tplvars.USER_LEVEL = 'Guest';
   182   tplvars.USER_LEVEL = 'Guest';
   183   if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = 'Member';
   183   if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = 'Member';
   184   if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = 'Moderator';
   184   if ( this_comment.user_level >= data.user_level.mod )    tplvars.USER_LEVEL = 'Moderator';
   185   if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = 'Administrator';
   185   if ( this_comment.user_level >= data.user_level.admin )  tplvars.USER_LEVEL = 'Administrator';
   186                               
   186                               
   187   // Send PM link
   187   // Send PM link
   188   tplvars.SEND_PM_LINK=(this_comment.user_id>1 && data.logged_in)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( this_comment.name.replace(/ /g, '_') )) +'">Send private message</a><br />':'';
   188   tplvars.SEND_PM_LINK=(this_comment.user_id>1 && data.logged_in)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( this_comment.name.replace(/ /g, '_') )) +'">Send private message</a><br />':'';
   189   
   189   
   190   // Add buddy link
   190   // Add buddy link
   191   tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1 && data.logged_in)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( this_comment.name.replace(/ /g, '_') )) +'">Add to buddy list</a><br />':'';
   191   tplvars.ADD_BUDDY_LINK=(this_comment.user_id>1 && data.logged_in && this_comment.is_buddy != 1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( this_comment.name.replace(/ /g, '_') )) +'">Add to buddy list</a><br />':'';
   192   
   192   
   193   // Edit link
   193   // Edit link
   194   tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">edit</a>';
   194   tplvars.EDIT_LINK='<a href="#edit_'+i+'" onclick="editComment(\''+i+'\', this); return false;" id="cmteditlink_'+i+'">edit</a>';
   195   
   195   
   196   // Delete link
   196   // Delete link
   206   var tplbool = new Object();
   206   var tplbool = new Object();
   207   
   207   
   208   tplbool.signature = ( this_comment.signature == '' ) ? false : true;
   208   tplbool.signature = ( this_comment.signature == '' ) ? false : true;
   209   tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   209   tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   210   tplbool.auth_mod = data.auth_mod_comments;
   210   tplbool.auth_mod = data.auth_mod_comments;
       
   211   tplbool.is_friend = ( this_comment.is_buddy == 1 && this_comment.is_friend == 1 );
       
   212   tplbool.is_foe = ( this_comment.is_buddy == 1 && this_comment.is_friend == 0 );
       
   213   
       
   214   if ( tplbool.is_friend )
       
   215     tplvars.USER_LEVEL += '<br /><b>On your friend list</b>';
       
   216   else if ( tplbool.is_foe )
       
   217     tplvars.USER_LEVEL += '<br /><b>On your foe list</b>';
   211   
   218   
   212   parser.assign_vars(tplvars);
   219   parser.assign_vars(tplvars);
   213   parser.assign_bool(tplbool);
   220   parser.assign_bool(tplbool);
   214   
   221   
   215   return '<div id="comment_holder_' + i + '"><input type="hidden" value="'+this_comment.comment_id+'" /><input type="hidden" id="comment_source_'+i+'" />' + parser.run() + '</div>';
   222   return '<div id="comment_holder_' + i + '"><input type="hidden" value="'+this_comment.comment_id+'" /><input type="hidden" id="comment_source_'+i+'" />' + parser.run() + '</div>';