mirror of
https://github.com/torrentpier/torrentpier
synced 2025-08-21 13:54:02 -07:00
Added ability to view post_text
of topic (#1401)
* Added ability to view `post_text` of topic * Updated * Update viewtopic.tpl * Update view_post.php * Update view_post.php * Update view_post.php * Update view_post.php * Updated * Update viewtopic.tpl * Create _source.gif * Create icon_code.gif * Update tpl_config.php * Updated * Updated * Updated * Updated * Update config.php * Update icon_code.gif * Updated * Delete icon_code.gif * Update CHANGELOG.md
This commit is contained in:
parent
a965209be0
commit
c116fe970b
10 changed files with 42 additions and 3 deletions
|
@ -6,6 +6,7 @@
|
|||
**Merged pull requests:**
|
||||
|
||||
- Release 2.4.2 🐯 ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added ability to view post_text of topic [\#1401](https://github.com/torrentpier/torrentpier/pull/1401) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added support for rutracker font BBCode tag [\#1397](https://github.com/torrentpier/torrentpier/pull/1397) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Added mod "Reason to move topic" [\#1388](https://github.com/torrentpier/torrentpier/pull/1388) ([belomaxorka](https://github.com/belomaxorka))
|
||||
- Created template file for AJAX quick actions [\#1381](https://github.com/torrentpier/torrentpier/pull/1381) ([belomaxorka](https://github.com/belomaxorka))
|
||||
|
|
|
@ -11,19 +11,22 @@ if (!defined('IN_AJAX')) {
|
|||
die(basename(__FILE__));
|
||||
}
|
||||
|
||||
global $user, $lang;
|
||||
global $user, $lang, $bb_cfg;
|
||||
|
||||
$post_id = isset($this->request['post_id']) ? (int)$this->request['post_id'] : null;
|
||||
$topic_id = isset($this->request['topic_id']) ? (int)$this->request['topic_id'] : null;
|
||||
$return_text = $bb_cfg['show_post_bbcode_button'] && isset($this->request['return_text']) && (bool)$this->request['return_text'];
|
||||
|
||||
if (is_null($post_id)) {
|
||||
$post_id = DB()->fetch_row("SELECT topic_first_post_id FROM " . BB_TOPICS . " WHERE topic_id = $topic_id", 'topic_first_post_id');
|
||||
}
|
||||
|
||||
$post_text_sql = $return_text ? "pt.post_text," : "IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,";
|
||||
|
||||
$sql = "
|
||||
SELECT
|
||||
p.*,
|
||||
h.post_html, IF(h.post_html IS NULL, pt.post_text, NULL) AS post_text,
|
||||
h.post_html, $post_text_sql
|
||||
f.auth_read
|
||||
FROM " . BB_POSTS . " p
|
||||
INNER JOIN " . BB_POSTS_TEXT . " pt ON(pt.post_id = p.post_id)
|
||||
|
@ -52,4 +55,8 @@ if ($post_data['auth_read'] == AUTH_REG) {
|
|||
|
||||
$this->response['post_id'] = $post_id;
|
||||
$this->response['topic_id'] = $topic_id;
|
||||
$this->response['post_html'] = get_parsed_post($post_data);
|
||||
if ($return_text) {
|
||||
$this->response['post_text'] = $post_data['post_text'];
|
||||
} else {
|
||||
$this->response['post_html'] = get_parsed_post($post_data);
|
||||
}
|
||||
|
|
|
@ -474,6 +474,7 @@ $bb_cfg['sf_on_first_page_only'] = true; // Show subforums only on the first pag
|
|||
$bb_cfg['allowed_topics_per_page'] = [50, 100, 150, 200, 250, 300]; // Allowed number of topics per page
|
||||
|
||||
// Topics
|
||||
$bb_cfg['show_post_bbcode_button'] = true; // Show "Code" button in topic to display BBCode of topic
|
||||
$bb_cfg['show_quick_reply'] = true; // Show quick reply forim
|
||||
$bb_cfg['show_rank_text'] = false; // Show user rank name in topics
|
||||
$bb_cfg['show_rank_image'] = true; // Show user rank image in topics
|
||||
|
|
|
@ -1363,6 +1363,7 @@ $lang['READ_PROFILE_TXTB'] = '[Profile]';
|
|||
$lang['SEND_EMAIL_TXTB'] = '[E-mail]';
|
||||
$lang['VISIT_WEBSITE_TXTB'] = '[www]';
|
||||
$lang['EDIT_DELETE_POST_TXTB'] = '[Edit]';
|
||||
$lang['CODE_TOPIC_TXTB'] = '[Code]';
|
||||
$lang['SEARCH_USER_POSTS_TXTB'] = '[Search]';
|
||||
$lang['VIEW_IP_TXTB'] = '[ip]';
|
||||
$lang['DELETE_POST_TXTB'] = '[x]';
|
||||
|
|
BIN
styles/templates/default/images/lang/source/icon_code.gif
Normal file
BIN
styles/templates/default/images/lang/source/icon_code.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.9 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
|
@ -17,6 +17,7 @@ $_main = BB_ROOT . 'styles/' . basename(TEMPLATES_DIR) . '/' . $template_name .
|
|||
$_lang = $_main . 'lang/' . basename($bb_cfg['default_lang']) . '/';
|
||||
|
||||
// post_buttons
|
||||
$images['icon_code'] = $_lang . 'icon_code.gif';
|
||||
$images['icon_quote'] = $_lang . 'icon_quote.gif';
|
||||
$images['icon_edit'] = $_lang . 'icon_edit.gif';
|
||||
$images['icon_search'] = $_lang . 'icon_search.gif';
|
||||
|
@ -129,6 +130,7 @@ $template->assign_vars([
|
|||
if (!empty($page_cfg['load_tpl_vars']) and $vars = array_flip($page_cfg['load_tpl_vars'])) {
|
||||
if (isset($vars['post_buttons'])) {
|
||||
$template->assign_vars([
|
||||
'CODE_IMG' => $bb_cfg['text_buttons'] ? $lang['CODE_TOPIC_TXTB'] : '<img src="' . $images['icon_code'] . '" alt="' . $lang['CODE_TOPIC_TXTB'] . '" title="' . $lang['CODE'] . '" />',
|
||||
'QUOTE_IMG' => $bb_cfg['text_buttons'] ? $lang['REPLY_WITH_QUOTE_TXTB'] : '<img src="' . $images['icon_quote'] . '" alt="' . $lang['REPLY_WITH_QUOTE_TXTB'] . '" title="' . $lang['REPLY_WITH_QUOTE'] . '" />',
|
||||
'EDIT_POST_IMG' => $bb_cfg['text_buttons'] ? $lang['EDIT_DELETE_POST_TXTB'] : '<img src="' . $images['icon_edit'] . '" alt="' . $lang['EDIT_DELETE_POST_TXTB'] . '" title="' . $lang['EDIT_POST'] . '" />',
|
||||
'DELETE_POST_IMG' => $bb_cfg['text_buttons'] ? $lang['DELETE_POST_TXTB'] : '<img src="' . $images['icon_delpost'] . '" alt="' . $lang['DELETE_POST_TXTB'] . '" title="' . $lang['DELETE_POST'] . '" />',
|
||||
|
|
|
@ -11,6 +11,32 @@
|
|||
$(document).ready(function(){ $('div.sp-head').click(); });
|
||||
</script>
|
||||
<!-- ENDIF -->
|
||||
|
||||
<!-- IF $bb_cfg['show_post_bbcode_button'] -->
|
||||
<script type="text/javascript">
|
||||
(function () {
|
||||
let loadedText = [];
|
||||
|
||||
ajax.view_post = function (post_id) {
|
||||
if (loadedText[post_id] != null) {
|
||||
$('#ptx-' + post_id).toggle();
|
||||
return;
|
||||
}
|
||||
ajax.exec({
|
||||
action: 'view_post',
|
||||
post_id: post_id,
|
||||
return_text: true,
|
||||
});
|
||||
};
|
||||
ajax.callback.view_post = function (data) {
|
||||
loadedText[data.post_id] = true;
|
||||
$('#post_' + data.post_id + ' div.post_body').prepend(
|
||||
'<div class="tCenter" id="ptx-' + data.post_id + '"><textarea style="width: 99%; height: 200px; line-height: 1.2;">' + data['post_text'] + '</textarea><hr></div>'
|
||||
);
|
||||
};
|
||||
})();
|
||||
</script>
|
||||
<!-- ENDIF -->
|
||||
<!-- ENDIF / LOGGED_IN -->
|
||||
|
||||
<!-- IF $bb_cfg['use_ajax_posts'] && (AUTH_DELETE || AUTH_REPLY || AUTH_EDIT) -->
|
||||
|
@ -398,6 +424,7 @@ function build_poll_add_form (src_el)
|
|||
<!-- IF postrow.QUOTE --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="ajax.exec({ action: 'posts', post_id: {postrow.POST_ID}, type: 'reply'}); return false;<!-- ELSE -->{QUOTE_URL}{postrow.POST_ID}<!-- ENDIF -->">{QUOTE_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF postrow.EDIT --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="edit_post({postrow.POST_ID}, 'edit'); return false;<!-- ELSE -->{EDIT_POST_URL}{postrow.POST_ID}<!-- ENDIF -->">{EDIT_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF postrow.DELETE --><a class="txtb" href="<!-- IF $bb_cfg['use_ajax_posts'] -->" onclick="ajax.exec({ action: 'posts', post_id: {postrow.POST_ID}, topic_id : {TOPIC_ID}, type: 'delete'}); return false;<!-- ELSE -->{DELETE_POST_URL}{postrow.POST_ID}<!-- ENDIF -->">{DELETE_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF postrow.IS_FIRST_POST && $bb_cfg['show_post_bbcode_button'] --><a href="#" class="txtb" onclick="ajax.view_post('{TOPIC_ID}'); return false;">{CODE_IMG}</a><!-- ENDIF -->
|
||||
<!-- IF postrow.IP --><a class="txtb" href="{IP_POST_URL}{postrow.POST_ID}&t={TOPIC_ID}">{IP_POST_IMG}</a>{POST_BTN_SPACER}<!-- ENDIF -->
|
||||
<!-- IF AUTH_MOD -->
|
||||
<a class="menu-root menu-alt1 txtb" href="#mc_{postrow.POST_ID}">{MC_IMG}</a>{POST_BTN_SPACER}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue