mirror of
https://github.com/phpbb/phpbb.git
synced 2025-05-05 23:25:30 +02:00
[ticket/10954] Mark topics read without popup
Also added missing handling of locked forums. PHPBB3-10954
This commit is contained in:
parent
7ce009f2e2
commit
a57c81481d
@ -16,6 +16,43 @@ phpbb.add_ajax_callback('mark_forums_read', function(res) {
|
||||
$(this).removeClass('forum_unread_subforum').addClass('forum_read_subforum');
|
||||
$(this).children('dt[title=' + unread_title + ']').attr('title', read_title);
|
||||
});
|
||||
|
||||
$('li.row dl.forum_unread_locked').each(function(e) {
|
||||
$(this).removeClass('forum_unread_locked').addClass('forum_read_locked');
|
||||
$(this).children('dt[title=' + unread_title + ']').attr('title', read_title);
|
||||
});
|
||||
});
|
||||
|
||||
// This callback will mark all topic icons read
|
||||
phpbb.add_ajax_callback('mark_topics_read', function(res) {
|
||||
var i,j;
|
||||
var read_title = res.NO_UNREAD_POSTS;
|
||||
var unread_title = res.UNREAD_POSTS;
|
||||
var icons_array = [
|
||||
['global_unread', 'global_read'],
|
||||
['announce_unread', 'announce_read'],
|
||||
['sticky_unread', 'sticky_read'],
|
||||
['topic_unread', 'topic_read']
|
||||
];
|
||||
|
||||
var icons_state = ['', '_hot', '_hot_mine', '_locked', '_locked_mine', '_mine'];
|
||||
|
||||
// Make sure all icons are marked as read
|
||||
for (i = 0; i < icons_array.length; i++)
|
||||
{
|
||||
for (j = 0; j < icons_state.length; j++)
|
||||
{
|
||||
$('li.row dl.' + icons_array[i][0] + icons_state[j]).each(function(e) {
|
||||
$(this).removeClass(icons_array[i][0] + icons_state[j]).addClass(icons_array[i][1] + icons_state[j]);
|
||||
$(this).children('dt[title=' + unread_title + ']').attr('title', read_title);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Remove link to first unread post
|
||||
$('span.icon_topic_newest').each(function(e) {
|
||||
$(this).remove();
|
||||
});
|
||||
});
|
||||
|
||||
// This callback finds the post from the delete link, and removes it.
|
||||
|
@ -57,7 +57,7 @@
|
||||
|
||||
<!-- IF .pagination or TOTAL_POSTS or TOTAL_TOPICS -->
|
||||
<div class="pagination">
|
||||
<!-- IF not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="true">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF -->
|
||||
<!-- IF not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" accesskey="m" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF -->
|
||||
<!-- IF TOTAL_TOPICS -->{TOTAL_TOPICS} • <!-- ENDIF -->
|
||||
<!-- IF .pagination -->
|
||||
<!-- INCLUDE pagination.html -->
|
||||
@ -211,7 +211,7 @@
|
||||
|
||||
<!-- IF PAGE_NUMBER or TOTAL_POSTS or TOTAL_TOPICS -->
|
||||
<div class="pagination">
|
||||
<!-- IF TOTAL_TOPICS and not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF -->
|
||||
<!-- IF TOTAL_TOPICS and not S_IS_BOT and U_MARK_TOPICS --><a href="{U_MARK_TOPICS}" data-ajax="mark_topics_read" data-overlay="false">{L_MARK_TOPICS_READ}</a> • <!-- ENDIF -->
|
||||
<!-- IF TOTAL_POSTS and not NEWEST_USER --> {TOTAL_POSTS}<!-- ELSEIF TOTAL_TOPICS and not NEWEST_USER --> {TOTAL_TOPICS} • <!-- ENDIF -->
|
||||
<!-- IF TOTAL_USERS -->{TOTAL_USERS} • <!-- ENDIF -->
|
||||
<!-- IF .pagination -->
|
||||
|
@ -181,7 +181,20 @@ if ($mark_read == 'topics')
|
||||
$redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id);
|
||||
meta_refresh(3, $redirect_url);
|
||||
|
||||
trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));
|
||||
if (!$request->is_ajax())
|
||||
{
|
||||
trigger_error($user->lang['TOPICS_MARKED'] . '<br /><br />' . sprintf($user->lang['RETURN_FORUM'], '<a href="' . $redirect_url . '">', '</a>'));
|
||||
}
|
||||
else
|
||||
{
|
||||
// Tell the ajax script what language vars need to be replaced
|
||||
$data = array(
|
||||
'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'],
|
||||
'UNREAD_POSTS' => $user->lang['UNREAD_POSTS']
|
||||
);
|
||||
$json_response = new phpbb_json_response();
|
||||
$json_response->send($data);
|
||||
}
|
||||
}
|
||||
|
||||
// Is a forum specific topic count required?
|
||||
|
Loading…
x
Reference in New Issue
Block a user