AJAX Comment on Posts เพิ่มความสามารถการ Comment ให้สามารถแทรก Comment ลงในPosts


แนะนำ Mod ต่างๆ ของ PHPBB3 แนะนำความสามารถ ของ mod การติดตั้ง การเข้ากันได้กับเวอร์ชั่น

Moderator: mindphp

User avatar
M004
PHP VIP Members
PHP VIP Members
Posts: 1323
Joined: 01/01/1970 7:00 am

AJAX Comment on Posts เพิ่มความสามารถการ Comment ให้สามารถแทรก Comment ลงในPosts

Post by M004 » 08/04/2013 6:46 pm

รายละเอียดเกี่ยวกับ AJAX Comment on Postsn
เป็น Mod ที่ทำให้ สามารถ แทรก Comment ลงใน โพส หรือ Comment อีกครั้ง
ทำให้สามารถเข้าถึงการพูดคุย แบบ comment ต่อ comment
พัฒนาโดย : Ali@php (Ali Faraji)
Version : 1.0.0
phpBB Version(s) : 3.0.0 Up
ดาวน์โหลดได้ที่ : https://www.phpbb.com/community/viewtop ... &t=2169115
AJAX Comment on Posts เพิ่มความสามารถการ Comment ให้สามารถแทรก Comment ลงในPosts 1.jpg
1.jpg (29.58 KiB) Viewed 682 times
AJAX Comment on Posts เพิ่มความสามารถการ Comment ให้สามารถแทรก Comment ลงในPosts 2.jpg
2.jpg (35.88 KiB) Viewed 682 times
AJAX Comment on Posts เพิ่มความสามารถการ Comment ให้สามารถแทรก Comment ลงในPosts 3.jpg
3.jpg (49.51 KiB) Viewed 682 times
ขั้นตอนการติดตั้ง
เปิดไฟล์ viewtopic.php
ค้นหา

Code: Select all

include($phpbb_root_path . 'includes/bbcode.' . $phpEx);
เพิ่มหลังคำที่ค้นหา

Code: Select all

// BEGIN Comment on Posts
include($phpbb_root_path . 'includes/functions_posting.' . $phpEx);
include($phpbb_root_path . 'includes/functions_comments.' . $phpEx);
// END Comment on Posts
ค้นหา

Code: Select all

$voted_id    = request_var('vote_id', array('' => 0)); 
เติมคำหลังคำที่ค้นหา

Code: Select all

// BEGIN Comment on Posts
$cedit_id     = request_var('ce', 0); 
$cdelete_id = request_var('cd', 0); 
$box_id        = request_var('box', 0);
$deleteall = request_var('deleteall', 0);
$user->setup('mods/comments');
// END Comment on Posts      
ค้นหา

Code: Select all

		// we do not want to allow removal of the last post if a moderator locked it!
		!$row['post_edit_locked']
	)));
เพิ่มคำหลังคำที่ค้นหา

Code: Select all

    // BEGIN Commeny on posts
    if (isset($_GET['limit']))
    {
        $limit = request_var('limit', 0) + $config['comments_limit'];
    }
    $sql = 'SELECT COUNT(post_id) AS commentcount
        FROM ' . COMMENTS_TABLE . '
        WHERE post_id ='. $row['post_id'] .'';
    $result = $db->sql_query($sql);
    $commentcount = (int) $db->sql_fetchfield('commentcount');
    $db->sql_freeresult($result);
    // END Commeny on posts    
ค้นหา

Code: Select all

		'L_IGNORE_POST'		=> ($row['hide_post']) ? sprintf($user->lang['POST_BY_FOE'], get_username_string('full', $poster_id, $row['username'], $row['user_colour'], $row['post_username']), '<a href="' . $viewtopic_url . "&p={$row['post_id']}&view=show#p{$row['post_id']}" . '">', '</a>') : '',
เพิ่มคำหลังคำที่ค้นหา

Code: Select all

		// BEGIN Comment on Posts
		'COMLIMIT'			=> ((isset($_GET['limit'])) ? request_var('limit', 0) : 0) + $config['comments_limit'],
		'COMMENT_ACTION'	=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "f=$forum_id&t=$topic_id&box=" .$row['post_id'] . "" . (($start == 0) ? '' : "&start=$start")),
		'SEND_COMMENT'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id&box=" .$row['post_id'] . "" . (($start == 0) ? '' : "&start=$start") ."#sendcomment"),
		'MORE_COMMENT'		=> append_sid("{$phpbb_root_path}viewtopic.$phpEx", "t=$topic_id&limit=" .((isset($_GET['limit'])) ? $limit : $config['comments_limit']). "&p=" .$row['post_id'] . "" . (($start == 0) ? '' : "&start=$start") ."#p" .$row['post_id']. ""),
		'POSTER'			=> $poster_id,
		'COMMENTCOUNT'		=> ($commentcount == 1) ? sprintf($user->lang['COMMENT_TITLE'], $commentcount) : sprintf($user->lang['COMMENT_TITLE_PLURAL'], $commentcount),
		'SHOWMORE'			=> $commentcount > $config['comments_limit'],
		// END Comment on Posts
ค้นหา

Code: Select all

	unset($attachments[$row['post_id']]);
เติมคำหลังที่ค้นหา

Code: Select all

	// BEGIN Comment on Posts
	if ($config['enable_comments'] == 1)
	{
		show_comment($row['post_id'], $topic_id, $forum_id);
	}
	// END Comment on Posts
ค้นหา

Code: Select all

// We need to do the same with the topic_id. See #53025.
if (empty($_REQUEST['t']) && !empty($topic_id))
{
	$_REQUEST['t'] = $topic_id;
}
เติมคำหลังที่ค้นหา

Code: Select all

// BEGIN Comment on Posts
$user->add_lang('posting');
display_custom_bbcodes();
$bbcode_status	= ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false;
$quote_status	= true;
$bbcode_status	= ($config['allow_bbcode'] && $auth->acl_get('f_bbcode', $forum_id)) ? true : false;
$smilies_status	= ($config['allow_smilies'] && $auth->acl_get('f_smilies', $forum_id)) ? true : false;
$img_status		= ($bbcode_status && $auth->acl_get('f_img', $forum_id)) ? true : false;
$url_status		= ($config['allow_post_links']) ? true : false;
$flash_status	= ($bbcode_status && $auth->acl_get('f_flash', $forum_id) && $config['allow_post_flash']) ? true : false;

$template->assign_vars(array(
	'S_BBCODE_ALLOWED'			=> ($bbcode_status) ? 1 : 0,
	'S_BBCODE_QUOTE'		=> $quote_status,
	'MAX_FONT_SIZE'			=> (int) $config['max_post_font_size'],
	'S_BBCODE_IMG'			=> $img_status,
	'S_BBCODE_URL'			=> $url_status,
	'S_BBCODE_FLASH'		=> $flash_status,
	'S_BBCODE_QUOTE'		=> $quote_status,
	'S_SMILIES_ALLOWED'			=> $smilies_status,
	'BBCODE_STATUS'			=> ($bbcode_status) ? sprintf($user->lang['BBCODE_IS_ON'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>') : sprintf($user->lang['BBCODE_IS_OFF'], '<a href="' . append_sid("{$phpbb_root_path}faq.$phpEx", 'mode=bbcode') . '">', '</a>'),
	'IMG_STATUS'			=> ($img_status) ? $user->lang['IMAGES_ARE_ON'] : $user->lang['IMAGES_ARE_OFF'],
	'FLASH_STATUS'			=> ($flash_status) ? $user->lang['FLASH_IS_ON'] : $user->lang['FLASH_IS_OFF'],
	'URL_STATUS'			=> ($bbcode_status && $url_status) ? $user->lang['URL_IS_ON'] : $user->lang['URL_IS_OFF'],
	'SMILIES_STATUS'		=> ($smilies_status) ? $user->lang['SMILIES_ARE_ON'] : $user->lang['SMILIES_ARE_OFF'],
	'ENABLE_COMMENTS'		=> ($config['enable_comments'] == 1) ? true : false,
	'U_SEECOM'				=> $auth->acl_get('u_seecom'),
	'F_SENDCOM'				=> $auth->acl_get('f_sendcom', $forum_id),
	'M_COMDELETE'			=> $auth->acl_get('m_comdelete'),
	'LIMIT' 				=> request_var('limit', 0),
	'COMMENT_PATH'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx"),
	'MAX_COMMENTS_CHAR'		=> $config['max_comments_char'],
	'MIN_COMMENTS_CHAR'		=> $config['min_comments_char'],
	'COMMENTSTATUS'		    => $topic_data['topic_status'],
));

$comment = request_var('commentsubmit', '');
if ($comment) 
{
	add_comment($box_id, $topic_id, $forum_id);
}
if ($cedit_id) 
{
	edit_comment($cedit_id);
}
$commentupdate = request_var('commentupdate', '');
if ($commentupdate)
{
	update_comment($forum_id, $topic_id, $post_id, $cedit_id);
}

if ($cdelete_id) 
{
	delete_comment($cdelete_id);
}

if ($deleteall) 
{
	delete_all_comments($deleteall);
}
// AJAX variables
$template->assign_vars(array(
	'LIMIT' 				=> request_var('limit', 0),
	'COMMENT_PATH'			=> append_sid("{$phpbb_root_path}viewtopic.$phpEx"),
	'MAX_COMMENTS_CHAR'		=> $config['max_comments_char'],
	'MIN_COMMENTS_CHAR'		=> $config['min_comments_char'],
	'MAX_CHAR_ERROR'		=> sprintf($user->lang['CHARACHTER_LIMIT_MAX'], $config['max_comments_char']),
	'MIN_CHAR_ERROR'		=> sprintf($user->lang['CHARACHTER_LIMIT_MIN'], $config['min_comments_char'])
));
	generate_smilies('inline', $forum_id, 'comments');
// END Comment on Posts
เปิดไฟล์ includes/constants.php
ค้นหา

Code: Select all

// Additional tables
เติมหลังคำที่ค้นหา

Code: Select all

define('COMMENTS_TABLE',			$table_prefix . 'comments');
เปิดไฟล์ styles/prosilver/template/overall_header.html
ค้นหา

Code: Select all

<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/forum_fn.js"></script>
เติมหลังคำที่ค้นหา

Code: Select all

<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/js/jquery.js"></script>
<script type="text/javascript" src="{T_SUPER_TEMPLATE_PATH}/js/jquery-ui.js"></script>
<script src="{T_SUPER_TEMPLATE_PATH}/js/comments.js"></script>
<link href="{T_SUPER_TEMPLATE_PATH}/js/jquery-ui.css" rel="stylesheet" type="text/css" />
เปิดไฟล์ styles/prosilver/template/viewtopic_body.html
ค้นหา

Code: Select all

			<div class="content">{postrow.MESSAGE}</div>
เติมคำหลังที่ค้นหา

Code: Select all

		<br /><br />
		<!-- IF ENABLE_COMMENTS -->
		<!-- IF U_SEECOM -->
		<div id="scrollpoint{postrow.POST_ID}"></div>
		<!-- IF postrow.COMMENTCOUNT neq 0 --><div class="commenttitle <!-- IF postrow.S_ROW_COUNT is odd -->bg2<!-- ELSE -->bg1<!-- ENDIF -->">{postrow.COMMENTCOUNT}<!-- IF M_COMDELETE -->  <a href="#" onclick="ajax_delete_all_comments('{postrow.POST_ID}', '{LIMIT}', '{COMMENT_PATH}'); return false;"><span>[Delete comments]</span></a><!-- ENDIF --></div><!-- ENDIF -->
		<!-- BEGIN comment -->
			<div id="c{comment.COMMENT_ID}" class="post <!-- IF postrow.S_ROW_COUNT is odd -->bg2<!-- ELSE -->bg1<!-- ENDIF -->" style="-webkit-border-radius: 5px;-moz-border-radius: 5px;border-radius: 5px;">
				<div class="inner"><span class="corners-top" style="background-image:none;"><span style="background-image:none;"></span></span>
				<div class="postbody" style="width:85%;">
					<ul class="profile-icons">
						<!-- IF comment.U_COMDEDIT  --><li class="edit-icon"><a href="javascript:void(0);" onclick="ajax_edit_form('{postrow.POST_ID}', '{postrow.POSTER_ID}', '{comment.COMMENT_ID}', '{LIMIT}', '{COMMENT_PATH}');" title="{L_EDIT_POST}"><span>{L_EDIT_POST}</span></a></li><!-- ENDIF -->
						<!-- IF comment.U_COMDELETE --><li class="delete-icon"><a href="javascript:void(0);" onclick="ajax_delete_comment('{postrow.POST_ID}', '{comment.COMMENT_ID}', '{LIMIT}', '{COMMENT_PATH}');" title="{L_DELETE_POST}"><span>{L_DELETE_POST}</span></a></li><!-- ENDIF -->
					</ul>
					{comment.COMMENT_DATE}
					<div class="commentcontent" style="padding-top:10px;">
						<div class="comtext" style="font-size:12px;">
						{comment.TEXT}
						</div>
					</div>
				</div>
			<dl class="postprofile" style="width:14%;">
				<dt>
					<a href="{comment.U_PROFILE}">{comment.AVATAR}</a><br>
					<a href="{comment.U_PROFILE}" style="color: #{comment.COLOUR};" class="username-coloured">{comment.USERNAME}</a>
					<dt>{comment.RANK_TITLE}</dt>
				</dt>
			</dl>
		
			<span class="corners-bottom" style="background-image:none;"><span style="background-image:none;"></span></span></div>
			</div>
		<!-- END comment -->
		<div id="commentscroll{postrow.POST_ID}"></div>
			<fieldset class="submit-buttons">
			<!-- IF F_SENDCOM --><a href="javascript:void(0);" onclick="<!-- IF COMMENTSTATUS eq 0 -->ajax_send_form('{postrow.COMMENT_ACTION}', '{postrow.POSTER_ID}', '{postrow.POST_ID}', '{LIMIT}', '{COMMENT_PATH}');<!-- ELSE -->return false;<!-- ENDIF -->" class="button2" style="padding-top:3px; padding-bottom:3px;"><!-- IF COMMENTSTATUS eq 1 -->{L_SEND_COMMENT_LOCKED}<!-- ELSE -->{L_SEND_COMMENT}<!-- ENDIF --></a><!-- ENDIF -->
			<!-- IF postrow.SHOWMORE --> <a href="javascript:void(0);" onclick="ajax_pagination('{postrow.MORE_COMMENT}', '{postrow.POST_ID}', '{LIMIT}');" class="button2" style="padding-top:3px; padding-bottom:3px;">{L_MORE_COMMENT}</a><!-- ENDIF --></fieldset>
		<!-- ENDIF -->
		<!-- ENDIF -->
ค้นหา

Code: Select all

<!-- END postrow -->
เติมหลังคำที่ค้นหา

Code: Select all

<!-- IF ENABLE_COMMENTS -->
	<!-- IF F_SENDCOM -->
	<div id="commentsending">
			<!-- INCLUDE posting_buttons.html -->
				<div id="smiley-box">
					<!-- IF S_SMILIES_ALLOWED and smiley -->
					<strong>{L_SMILIES}</strong><br />
						<!-- BEGIN smiley -->
							<a href="#" onclick="insert_text('{smiley.A_SMILEY_CODE}', true); return false;"><img src="{smiley.SMILEY_IMG}" width="{smiley.SMILEY_WIDTH}" height="{smiley.SMILEY_HEIGHT}" alt="{smiley.SMILEY_CODE}" title="{smiley.SMILEY_DESC}" /></a>
						<!-- END smiley -->
					<!-- ENDIF -->
					<!-- IF S_SHOW_SMILEY_LINK and S_SMILIES_ALLOWED-->
						<br /><a href="{U_MORE_SMILIES}" onclick="popup(this.href, 300, 350, '_phpbbsmilies'); return false;">{L_MORE_SMILIES}</a>
					<!-- ENDIF -->
					<!-- IF BBCODE_STATUS -->
						<br />{BBCODE_STATUS}<br />
							<!-- IF S_BBCODE_ALLOWED -->
								{IMG_STATUS}<br />
								{FLASH_STATUS}<br />
								{URL_STATUS}<br />
							<!-- ENDIF -->
						{SMILIES_STATUS}
					<!-- ENDIF -->
				</div>

		<div id="message-box">
			<form id="postform" method="post">

				<!-- IF F_SENDCOM -->
					<textarea id="message" style="height:170px;width:850px;">{EDITTEXT}</textarea><br />
				<!-- ELSE -->
					<textarea id="message" style="height:170px; width: 30%;" disabled>{L_NOT_ALLOWED_SEND}</textarea><br />
				<!-- ENDIF -->
				<input type="hidden" accesskey="s" tabindex="6" value="{L_SUBMIT}" class="button1 default-submit-action" id="commentsubmit" />
				{S_FORM_TOKEN}
			</form>
		</div>
		<!-- IF MAX_COMMENTS_CHAR neq '0' -->
		<div id="charremain"></div>
		<!-- ENDIF -->
	</div>
	<!-- ENDIF -->
<!-- ENDIF -->
ค้นหา

Code: Select all

<!-- INCLUDE overall_footer.html -->
เติมก่อนคำที่หา

Code: Select all

<script type="text/javascript">
// variables
var maxlimit = '{MAX_COMMENTS_CHAR}';
var minlimit = '{MIN_COMMENTS_CHAR}';
// Language variables
var langsendtitle = '{L_SEND_COMMENT_TITLE}';
var langsubmit = '{L_SUBMIT}';
var langcomdelete = '{L_COMMENT_DELETE_CONFIRM}';
var langcomdeletetitle = '{L_COMMENT_DELETE_CONFIRM_TITLE}';
var commentdeleteallconfirm = '{L_COMMENT_DELETE_ALL_CONFIRM}';
var langyes = '{L_YES}';
var langno = '{L_NO}';
var langmaxcharerror = '{MAX_CHAR_ERROR}';
var langmincharerror = '{MIN_CHAR_ERROR}';
var langcharerrortitle = '{L_CHARACHTER_LIMIT_ERROR}';
var langeditcomment = '{L_COMMENT_EDIT_TITLE}';
var langremainchar = '{L_REMAINED_CHAR}';
// display handling
$("#commentsending").css("display", "none");
</script>
เปิดไฟล์ styles/prosilver/theme/common.css
ค้นหา

Code: Select all

.clear {
	display: block;
	clear: both;
	font-size: 1px;
	line-height: 1px;
	background: transparent;
}
เติมหลังคำที่หา

Code: Select all

.commenttitle {
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
margin-bottom: 10px;
font-weight: bold;
font-size: 15px;
text-align: center;
padding-top: 10px;
padding-bottom: 10px;
color: rgb(109, 109, 109);
}

.commenttitle span {
font-size: 10px;
}
ติดตั้งไฟล์ comment_mod_install.php

Code: Select all

ตัวอย่าง
domain.tld/phpBB3/comment_mod_install.php

Return to “PHPBB3.0 Mod Review”

Users browsing this forum: No registered users and 1 guest