includes/clientside/static/comments.js
changeset 328 dc838fd61a06
parent 214 a6ed8b6cdbe1
child 359 e0787bb6285b
equal deleted inserted replaced
327:c2f4c900c507 328:dc838fd61a06
   183   // Name
   183   // Name
   184   tplvars.NAME = this_comment.name;
   184   tplvars.NAME = this_comment.name;
   185   if ( this_comment.user_id > 1 )
   185   if ( this_comment.user_id > 1 )
   186     tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '">' + this_comment.name + '</a>';
   186     tplvars.NAME = '<a href="' + makeUrlNS('User', this_comment.name) + '">' + this_comment.name + '</a>';
   187   
   187   
       
   188   // Avatar
       
   189   if ( this_comment.user_has_avatar == '1' )
       
   190   {
       
   191     tplvars.AVATAR_URL = scriptPath + '/' + data.avatar_directory + '/' + this_comment.user_id + '.' + this_comment.avatar_type;
       
   192     tplvars.USERPAGE_LINK = makeUrlNS('User', this_comment.name);
       
   193     tplvars.AVATAR_ALT = $lang.get('usercp_avatar_image_alt', { username: this_comment.name });
       
   194   }
       
   195   
   188   // User level
   196   // User level
   189   tplvars.USER_LEVEL = $lang.get('user_type_guest');
   197   tplvars.USER_LEVEL = $lang.get('user_type_guest');
   190   if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
   198   if ( this_comment.user_level >= data.user_level.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
   191   if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
   199   if ( this_comment.user_level >= data.user_level.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
   192   if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
   200   if ( this_comment.user_level >= data.user_level.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
   215   tplbool.signature = ( this_comment.signature == '' ) ? false : true;
   223   tplbool.signature = ( this_comment.signature == '' ) ? false : true;
   216   tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   224   tplbool.can_edit = ( data.auth_edit_comments && ( ( this_comment.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   217   tplbool.auth_mod = data.auth_mod_comments;
   225   tplbool.auth_mod = data.auth_mod_comments;
   218   tplbool.is_friend = ( this_comment.is_buddy == 1 && this_comment.is_friend == 1 );
   226   tplbool.is_friend = ( this_comment.is_buddy == 1 && this_comment.is_friend == 1 );
   219   tplbool.is_foe = ( this_comment.is_buddy == 1 && this_comment.is_friend == 0 );
   227   tplbool.is_foe = ( this_comment.is_buddy == 1 && this_comment.is_friend == 0 );
       
   228   tplbool.user_has_avatar = ( this_comment.user_has_avatar == '1' );
   220   
   229   
   221   if ( tplbool.is_friend )
   230   if ( tplbool.is_friend )
   222     tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_friend_list') + '</b>';
   231     tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_friend_list') + '</b>';
   223   else if ( tplbool.is_foe )
   232   else if ( tplbool.is_foe )
   224     tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_foe_list') + '</b>';
   233     tplvars.USER_LEVEL += '<br /><b>' + $lang.get('comment_on_foe_list') + '</b>';
   442   tplvars.USER_LEVEL = $lang.get('user_type_guest');
   451   tplvars.USER_LEVEL = $lang.get('user_type_guest');
   443   if ( data.user_level >= data.user_level_list.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
   452   if ( data.user_level >= data.user_level_list.member ) tplvars.USER_LEVEL = $lang.get('user_type_member');
   444   if ( data.user_level >= data.user_level_list.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
   453   if ( data.user_level >= data.user_level_list.mod ) tplvars.USER_LEVEL = $lang.get('user_type_mod');
   445   if ( data.user_level >= data.user_level_list.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
   454   if ( data.user_level >= data.user_level_list.admin ) tplvars.USER_LEVEL = $lang.get('user_type_admin');
   446   
   455   
       
   456   // Avatar
       
   457   if ( data.user_has_avatar == '1' )
       
   458   {
       
   459     tplvars.AVATAR_URL = scriptPath + '/' + data.avatar_directory + '/' + data.user_id + '.' + data.avatar_type;
       
   460     tplvars.USERPAGE_LINK = makeUrlNS('User', data.name);
       
   461     tplvars.AVATAR_ALT = $lang.get('usercp_avatar_image_alt', { username: data.name });
       
   462   }
       
   463   
   447   // Send PM link
   464   // Send PM link
   448   tplvars.SEND_PM_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':'';
   465   tplvars.SEND_PM_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/Compose/To/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_send_privmsg') + '</a><br />':'';
   449   
   466   
   450   // Add buddy link
   467   // Add buddy link
   451   tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':'';
   468   tplvars.ADD_BUDDY_LINK=(data.user_id>1)?'<a onclick="window.open(this.href); return false;" href="'+ makeUrlNS('Special', 'PrivateMessages/FriendList/Add/' + ( data.name.replace(/ /g, '_') )) +'">' + $lang.get('comment_btn_add_buddy') + '</a><br />':'';
   466   var tplbool = new Object();
   483   var tplbool = new Object();
   467   
   484   
   468   tplbool.signature = ( data.signature == '' ) ? false : true;
   485   tplbool.signature = ( data.signature == '' ) ? false : true;
   469   tplbool.can_edit = ( data.auth_edit_comments && ( ( data.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   486   tplbool.can_edit = ( data.auth_edit_comments && ( ( data.user_id == data.user_id && data.logged_in ) || data.auth_mod_comments ) );
   470   tplbool.auth_mod = data.auth_mod_comments;
   487   tplbool.auth_mod = data.auth_mod_comments;
       
   488   tplbool.user_has_avatar = ( data.user_has_avatar == '1' );
   471   
   489   
   472   parser.assign_vars(tplvars);
   490   parser.assign_vars(tplvars);
   473   parser.assign_bool(tplbool);
   491   parser.assign_bool(tplbool);
   474   
   492   
   475   var div = document.createElement('div');
   493   var div = document.createElement('div');