mirror of
https://github.com/phpbb/phpbb.git
synced 2025-06-28 14:18:52 +00:00
[ticket/10273] AJAXified approve / disapprove posts (in viewtopic).
This commit AJAXifies the moderator approval functionality, and adds it to viewtopic instead of the MCP. This commit has involved some language changes, which may affect fallbacks. PHPBB3-10273
This commit is contained in:
parent
c4aaf3ae5a
commit
8a28456f75
6 changed files with 68 additions and 2 deletions
|
@ -476,7 +476,7 @@ $lang = array_merge($lang, array(
|
||||||
'POST_SUBJECT' => 'Post subject',
|
'POST_SUBJECT' => 'Post subject',
|
||||||
'POST_TIME' => 'Post time',
|
'POST_TIME' => 'Post time',
|
||||||
'POST_TOPIC' => 'Post a new topic',
|
'POST_TOPIC' => 'Post a new topic',
|
||||||
'POST_UNAPPROVED' => 'This post is waiting for approval',
|
'POST_UNAPPROVED' => 'Post awaiting approval:',
|
||||||
'PREVIEW' => 'Preview',
|
'PREVIEW' => 'Preview',
|
||||||
'PREVIOUS' => 'Previous', // Used in pagination
|
'PREVIOUS' => 'Previous', // Used in pagination
|
||||||
'PREVIOUS_STEP' => 'Previous',
|
'PREVIOUS_STEP' => 'Previous',
|
||||||
|
|
|
@ -35,6 +35,7 @@ if (empty($lang) || !is_array($lang))
|
||||||
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
// in a url you again do not need to specify an order e.g., 'Click %sHERE%s' is fine
|
||||||
|
|
||||||
$lang = array_merge($lang, array(
|
$lang = array_merge($lang, array(
|
||||||
|
'APPROVE' => 'Approve',
|
||||||
'ATTACHMENT' => 'Attachment',
|
'ATTACHMENT' => 'Attachment',
|
||||||
'ATTACHMENT_FUNCTIONALITY_DISABLED' => 'The attachments feature has been disabled.',
|
'ATTACHMENT_FUNCTIONALITY_DISABLED' => 'The attachments feature has been disabled.',
|
||||||
|
|
||||||
|
@ -49,6 +50,7 @@ $lang = array_merge($lang, array(
|
||||||
'CODE' => 'Code',
|
'CODE' => 'Code',
|
||||||
|
|
||||||
'DELETE_TOPIC' => 'Delete topic',
|
'DELETE_TOPIC' => 'Delete topic',
|
||||||
|
'DISAPPROVE' => 'Disapprove',
|
||||||
'DOWNLOAD_NOTICE' => 'You do not have the required permissions to view the files attached to this post.',
|
'DOWNLOAD_NOTICE' => 'You do not have the required permissions to view the files attached to this post.',
|
||||||
|
|
||||||
'EDITED_TIMES_TOTAL' => array(
|
'EDITED_TIMES_TOTAL' => array(
|
||||||
|
|
|
@ -135,10 +135,18 @@
|
||||||
<p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> » {postrow.POST_DATE} </p>
|
<p class="author"><!-- IF S_IS_BOT -->{postrow.MINI_POST_IMG}<!-- ELSE --><a href="{postrow.U_MINI_POST}">{postrow.MINI_POST_IMG}</a><!-- ENDIF -->{L_POST_BY_AUTHOR} <strong>{postrow.POST_AUTHOR_FULL}</strong> » {postrow.POST_DATE} </p>
|
||||||
|
|
||||||
<!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_REPORTED -->
|
<!-- IF postrow.S_POST_UNAPPROVED or postrow.S_POST_REPORTED -->
|
||||||
|
<form method="post" class="mcp_approve" action="{postrow.U_APPROVE_ACTION}">
|
||||||
<p class="rules">
|
<p class="rules">
|
||||||
<!-- IF postrow.S_POST_UNAPPROVED -->{UNAPPROVED_IMG} <a href="{postrow.U_MCP_APPROVE}"><strong>{L_POST_UNAPPROVED}</strong></a><br /><!-- ENDIF -->
|
<!-- IF postrow.S_POST_UNAPPROVED -->
|
||||||
|
{UNAPPROVED_IMG} <strong>{L_POST_UNAPPROVED}</strong>
|
||||||
|
<input class="button2" type="button" value="{L_DISAPPROVE}" name="action[disapprove]" />
|
||||||
|
<input class="button1" type="button" value="{L_APPROVE}" name="action[approve]" />
|
||||||
|
<input type="hidden" name="post_id_list[]" value="{postrow.POST_ID}" />
|
||||||
|
{S_FORM_TOKEN}
|
||||||
|
<br /><!-- ENDIF -->
|
||||||
<!-- IF postrow.S_POST_REPORTED -->{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
|
<!-- IF postrow.S_POST_REPORTED -->{REPORTED_IMG} <a href="{postrow.U_MCP_REPORT}"><strong>{L_POST_REPORTED}</strong></a><!-- ENDIF -->
|
||||||
</p>
|
</p>
|
||||||
|
</form>
|
||||||
<!-- ENDIF -->
|
<!-- ENDIF -->
|
||||||
|
|
||||||
<div class="content">{postrow.MESSAGE}</div>
|
<div class="content">{postrow.MESSAGE}</div>
|
||||||
|
|
|
@ -658,6 +658,10 @@ p.rules {
|
||||||
|
|
||||||
p.rules img {
|
p.rules img {
|
||||||
vertical-align: middle;
|
vertical-align: middle;
|
||||||
|
}
|
||||||
|
|
||||||
|
p.rules strong {
|
||||||
|
vertical-align: middle;
|
||||||
padding-top: 5px;
|
padding-top: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -86,6 +86,18 @@ function handle_refresh(data, refresh, div)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function parse_hidden(inputs)
|
||||||
|
{
|
||||||
|
var end = [];
|
||||||
|
$(inputs).each(function() {
|
||||||
|
if (this.type === 'hidden')
|
||||||
|
{
|
||||||
|
end.push(this.name + '=' + this.value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return end.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function interacts via AJAX with phpBBs confirm_box function.
|
* This function interacts via AJAX with phpBBs confirm_box function.
|
||||||
|
@ -175,3 +187,42 @@ phpbb.ajaxify('a[href*="watch=forum"]', false, function(el, res) {
|
||||||
});
|
});
|
||||||
phpbb.ajaxify('a[href*="mode=bump"]');
|
phpbb.ajaxify('a[href*="mode=bump"]');
|
||||||
phpbb.ajaxify('a[href*="mark="]'); //captures topics and forums
|
phpbb.ajaxify('a[href*="mark="]'); //captures topics and forums
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forms have to be captured manually, as they're all different.
|
||||||
|
*/
|
||||||
|
$('input[name^="action"]').click(function(e) {
|
||||||
|
var __self = this;
|
||||||
|
var path = $(this).parents('form')[0].action.replace('&', '&');
|
||||||
|
var action = (this.name === 'action[approve]') ? 'approve' : 'disapprove';
|
||||||
|
var data = {
|
||||||
|
action: action,
|
||||||
|
post_id_list: [$(this).siblings('input[name="post_id_list[]"]')[0].value]
|
||||||
|
};
|
||||||
|
$.post(path, data, function(res) {
|
||||||
|
res = JSON.parse(res);
|
||||||
|
phpbb.confirm(res.MESSAGE_TEXT, function(del) {
|
||||||
|
if (del)
|
||||||
|
{
|
||||||
|
path = res.S_CONFIRM_ACTION;
|
||||||
|
data = parse_hidden(res.S_HIDDEN_FIELDS);
|
||||||
|
$.post(path, data + '&confirm=Yes', function(res) {
|
||||||
|
console.log(res);
|
||||||
|
res = JSON.parse(res);
|
||||||
|
var alert = phpbb.alert(res.MESSAGE_TITLE, res.MESSAGE_TEXT);
|
||||||
|
|
||||||
|
$(__self).parents((action === 'approve') ? '.rules' : '.post').remove();
|
||||||
|
|
||||||
|
setTimeout(function() {
|
||||||
|
alert.hide(300, function() {
|
||||||
|
alert.remove();
|
||||||
|
});
|
||||||
|
}, 5000);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
|
@ -1534,6 +1534,7 @@ for ($i = 0, $end = sizeof($post_list); $i < $end; ++$i)
|
||||||
'U_YIM' => $user_cache[$poster_id]['yim'],
|
'U_YIM' => $user_cache[$poster_id]['yim'],
|
||||||
'U_JABBER' => $user_cache[$poster_id]['jabber'],
|
'U_JABBER' => $user_cache[$poster_id]['jabber'],
|
||||||
|
|
||||||
|
'U_APPROVE_ACTION' => append_sid("{$phpbb_root_path}mcp.$phpEx", "i=queue&p={$row['post_id']}&f=$forum_id"),
|
||||||
'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '',
|
'U_REPORT' => ($auth->acl_get('f_report', $forum_id)) ? append_sid("{$phpbb_root_path}report.$phpEx", 'f=' . $forum_id . '&p=' . $row['post_id']) : '',
|
||||||
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
|
'U_MCP_REPORT' => ($auth->acl_get('m_report', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=reports&mode=report_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
|
||||||
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
|
'U_MCP_APPROVE' => ($auth->acl_get('m_approve', $forum_id)) ? append_sid("{$phpbb_root_path}mcp.$phpEx", 'i=queue&mode=approve_details&f=' . $forum_id . '&p=' . $row['post_id'], true, $user->session_id) : '',
|
||||||
|
|
Loading…
Add table
Reference in a new issue