Jump to content

Изменение вида репутации

Featured Replies

Posted
comment_20296

Есть необходимость изменить стандартный вид репутации.

Буду очень рад автору решения моей проблемы, карму позеленю =) Не исключаю факт что это будет полезно другим.

 

 

 

На данный момент стандартный вид репутации за сообщение. 

 

Так как пользователи бывает промахиваются, да и поступали недовольство столь близкое расположения кнопки понижающую репутацию. Следовательно решил изменить. Прошу помощи.

 

Нужно отрицательную кнопку перенести после самого счетчика репутации.

Идеальный вариант такого изменения - это если оно сработает на все остальные компоненты и так далее.

 

Оформление заслуживает петрушки? =)

comment_20297

Открой шаблон Прочие --> repButtons и замени всё его содержимое на:

<php>
	// Apps can set the key empty to disable, but this will allow all apps to use the popup to show who repped
	if( !isset($data['jsCallback']) )
	{
		$data['jsCallback']	= "ipb.global.repPopUp( this, {$data['primaryId']}, '{$data['app']}', '{$data['type']}' );";
	}
	$repClickable	= ( $this->memberData['gbw_view_reps'] AND $data['jsCallback'] ) ? 'onclick="' . $data['jsCallback'] . '"' : '';
</php>
<if test="reputationBox:|:$this->settings['reputation_enabled']">
	<if test="canRep:|:!( $this->settings['reputation_protected_groups'] && in_array( $member['member_group_id'], explode( ',', $this->settings['reputation_protected_groups'] ) ) ) and $this->memberData['member_id']">	
		<if test="isLike:|:$this->settings['reputation_point_types'] == 'like'">
			<div class='ipsLikeBar right clearfix' id='{$data['domCountId']}'>
				<ul class='ipsList_inline'>
					<if test="!isset($data['hide_text']) OR !$data['hide_text']">
						<li id="{$data['domLikeStripId']}" class='ipsLikeBar_info' <if test="hasNoLikes:|:!$data['likeFormatted']">style="display:none"</if>>
							{$data['likeFormatted']}
						</li>
					</if>
					<if test="canGiveRep:|:IPSMember::canGiveRep( $data, $member ) !== false">
						<li <if test="giveRepUp:|:IPSMember::canRepUp( $data, $member ) === false">style="display:none"</if>>
							<a class='ipsLikeButton ipsLikeButton_enabled rep_up' href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' title='{$this->lang->words['do_like_up']}'>{$this->lang->words['like_this']}</a>
						</li>
						<li <if test="giveRepDown:|:IPSMember::canRepDown( $data, $member ) === false">style="display:none"</if>>
							<a class='ipsLikeButton ipsLikeButton_disabled rep_down' href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=-1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' title='{$this->lang->words['do_like_down']}'>{$this->lang->words['unlike_this']}</a>
						</li>
					</if>
				</ul>
			</div>
		<else />
			<div class='rep_bar clearfix <if test="pos:|:!$data['position'] || $data['position'] == 'right'">right</if>' id='{$data['domCountId']}'>
				{parse variable="repClickable" default="" oncondition="$this->memberData['gbw_view_reps']" value=" clickable"}
				<ul class='ipsList_inline'>
					<if test="canGiveRep:|:IPSMember::canGiveRep( $data, $member ) !== false">
						<li <if test="giveRepUp:|:IPSMember::canRepUp( $data, $member ) === false">style="display:none"</if>>
							<a href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' class='rep_up' title='{$this->lang->words['reputation_up']}'>{parse replacement="rep_up"}</a>
						</li>
					</if>
					<if test="isNotLike:|:$this->settings['reputation_point_types'] != 'like'">
						<if test="hasNoRep:|:$data['rep_points'] == 0">
							<li><span class='reputation zero rep_show{parse variable="repClickable"}' title='{$this->lang->words['reputation']}' {$repClickable}>
						</if>
						<if test="hasPosRep:|:$data['rep_points'] > 0">
							<li><span class='reputation positive rep_show{parse variable="repClickable"}' title='{$this->lang->words['reputation']}' {$repClickable}>
						</if>
						<if test="hasNegRep:|:$data['rep_points'] < 0">
							<li><span class='reputation negative rep_show{parse variable="repClickable"}' title='{$this->lang->words['reputation']}' {$repClickable}>
						</if>
							{parse expression="intval($data['rep_points'])"}
							</span>
						</li>
					</if>
					<if test="canGiveRep:|:IPSMember::canGiveRep( $data, $member ) !== false">
						<li <if test="giveRepDown:|:IPSMember::canRepDown( $data, $member ) === false">style="display:none"</if>>
							<a href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=-1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' class='rep_down' title='{$this->lang->words['reputation_down']}'>{parse replacement="rep_down"}</a>
						</li>
					</if>
				</ul>
			</div>
		</if>
	</if>
</if>
<script type='text/javascript'>
	ipb.global.registerReputation( '{$data['domCountId']}', { domLikeStripId: '{$data['domLikeStripId']}', app: '{$data['app']}', type: '{$data['type']}', typeid: '{$data['primaryId']}' }, parseInt('{$data['rep_points']}') );
</script>

 

 


Работать будет абсолютно везде, т.к. все компоненты берут репутацию из одного шаблона, который мы и поправили. :)

  • 3 недели спустя...
comment_21833

Допустил небольшую ошибочку. В приведённом выше коде не будет отображаться полученная репутация после её понижения/повышения. Исправить можно заменив весь код на:

<php>
	// Apps can set the key empty to disable, but this will allow all apps to use the popup to show who repped
	if( !isset($data['jsCallback']) )
	{
		$data['jsCallback']	= "ipb.global.repPopUp( this, {$data['primaryId']}, '{$data['app']}', '{$data['type']}' );";
	}
	$repClickable	= ( $this->memberData['gbw_view_reps'] AND $data['jsCallback'] ) ? 'onclick="' . $data['jsCallback'] . '"' : '';
</php>
<if test="reputationBox:|:$this->settings['reputation_enabled']">
	<if test="canRep:|:!( $this->settings['reputation_protected_groups'] && in_array( $member['member_group_id'], explode( ',', $this->settings['reputation_protected_groups'] ) ) ) and $this->memberData['member_id']">	
		<if test="isLike:|:$this->settings['reputation_point_types'] == 'like'">
			<div class='ipsLikeBar right clearfix' id='{$data['domCountId']}'>
				<ul class='ipsList_inline'>
					<if test="!isset($data['hide_text']) OR !$data['hide_text']">
						<li id="{$data['domLikeStripId']}" class='ipsLikeBar_info' <if test="hasNoLikes:|:!$data['likeFormatted']">style="display:none"</if>>
							{$data['likeFormatted']}
						</li>
					</if>
					<if test="canGiveRep:|:IPSMember::canGiveRep( $data, $member ) !== false">
						<li <if test="giveRepUp:|:IPSMember::canRepUp( $data, $member ) === false">style="display:none"</if>>
							<a class='ipsLikeButton ipsLikeButton_enabled rep_up' href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' title='{$this->lang->words['do_like_up']}'>{$this->lang->words['like_this']}</a>
						</li>
						<li <if test="giveRepDown:|:IPSMember::canRepDown( $data, $member ) === false">style="display:none"</if>>
							<a class='ipsLikeButton ipsLikeButton_disabled rep_down' href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=-1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' title='{$this->lang->words['do_like_down']}'>{$this->lang->words['unlike_this']}</a>
						</li>
					</if>
				</ul>
			</div>
		<else />
			<div class='rep_bar clearfix <if test="pos:|:!$data['position'] || $data['position'] == 'right'">right</if>' id='{$data['domCountId']}'>
				{parse variable="repClickable" default="" oncondition="$this->memberData['gbw_view_reps']" value=" clickable"}
				<ul class='ipsList_inline'>
					<if test="canGiveRep:|:IPSMember::canGiveRep( $data, $member ) !== false">
						<li <if test="giveRepUp:|:IPSMember::canRepUp( $data, $member ) === false">style="display:none"</if>>
							<a href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' class='rep_up' title='{$this->lang->words['reputation_up']}'>{parse replacement="rep_up"}</a>
						</li>
					</if>
					<if test="isNotLike:|:$this->settings['reputation_point_types'] != 'like'">
						<if test="hasNoRep:|:$data['rep_points'] == 0">
							<li><span class='reputation zero rep_show{parse variable="repClickable"}' title='{$this->lang->words['reputation']}' {$repClickable}>
						</if>
						<if test="hasPosRep:|:$data['rep_points'] > 0">
							<li><span class='reputation positive rep_show{parse variable="repClickable"}' title='{$this->lang->words['reputation']}' {$repClickable}>
						</if>
						<if test="hasNegRep:|:$data['rep_points'] < 0">
							<li><span class='reputation negative rep_show{parse variable="repClickable"}' title='{$this->lang->words['reputation']}' {$repClickable}>
						</if>
							{parse expression="intval($data['rep_points'])"}
							</span>
						</li>
					</if>
					<if test="canGiveRep:|:IPSMember::canGiveRep( $data, $member ) !== false">
						<li <if test="giveRepDown:|:IPSMember::canRepDown( $data, $member ) === false">style="display:none"</if>>
							<a href='{$this->settings['base_url']}app=core&amp;module=global&amp;section=reputation&amp;do=add_rating&amp;app_rate={$data['app']}&amp;type={$data['type']}&amp;type_id={$data['primaryId']}&amp;rating=-1&amp;secure_key={$this->member->form_hash}&amp;post_return={$data['primaryId']}' class='rep_down' title='{$this->lang->words['reputation_down']}'>{parse replacement="rep_down"}</a>
						</li>
					</if>
				</ul>
			</div>
		</if>
	</if>
</if>
<script type='text/javascript'>
	ipb.global.registerReputation( '{$data['domCountId']}', { domLikeStripId: '{$data['domLikeStripId']}', app: '{$data['app']}', type: '{$data['type']}', typeid: '{$data['primaryId']}' }, parseInt('{$data['rep_points']}') );
</script>

 

 

PS: код выше тоже поправил.

Guest
This topic is now closed to further replies.

Последние посетители 0

  • No registered users viewing this page.