From a57c81481d21433bdb185accfd7f2b82858ba461 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 12 Dec 2012 18:38:17 +0100 Subject: [ticket/10954] Mark topics read without popup Also added missing handling of locked forums. PHPBB3-10954 --- phpBB/viewforum.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'phpBB/viewforum.php') diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 83e5d4caa5..1b84c5f52f 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -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'] . '

' . sprintf($user->lang['RETURN_FORUM'], '', '')); + if (!$request->is_ajax()) + { + trigger_error($user->lang['TOPICS_MARKED'] . '

' . sprintf($user->lang['RETURN_FORUM'], '', '')); + } + 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? -- cgit v1.2.1 From 7efc37d1f9d4a4335fc91af147cd059c17b7d45e Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Wed, 12 Dec 2012 19:09:18 +0100 Subject: [ticket/10954] Modify is_ajax check for consistency PHPBB3-10954 --- phpBB/viewforum.php | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'phpBB/viewforum.php') diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index 1b84c5f52f..d514cf2d61 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -181,11 +181,7 @@ if ($mark_read == 'topics') $redirect_url = append_sid("{$phpbb_root_path}viewforum.$phpEx", 'f=' . $forum_id); meta_refresh(3, $redirect_url); - if (!$request->is_ajax()) - { - trigger_error($user->lang['TOPICS_MARKED'] . '

' . sprintf($user->lang['RETURN_FORUM'], '', '')); - } - else + if ($request->is_ajax()) { // Tell the ajax script what language vars need to be replaced $data = array( @@ -195,6 +191,8 @@ if ($mark_read == 'topics') $json_response = new phpbb_json_response(); $json_response->send($data); } + + trigger_error($user->lang['TOPICS_MARKED'] . '

' . sprintf($user->lang['RETURN_FORUM'], '', '')); } // Is a forum specific topic count required? -- cgit v1.2.1 From 16c021e98667fe353e6b3a6cb0bbf3b8f2319f98 Mon Sep 17 00:00:00 2001 From: Marc Alexander Date: Fri, 14 Dec 2012 15:46:45 +0100 Subject: [ticket/10954] Change behavior of marking topics/forums It will now display a popup message for 3 seconds which will confirm the taken action. The amount of DOM traversals have been significantly reduced and jQuery.each is now used instead of for loops. Additionally, it is now possible to click on the mark topics/forums read links without triggering an AJAX error. PHPBB3-10954 --- phpBB/viewforum.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'phpBB/viewforum.php') diff --git a/phpBB/viewforum.php b/phpBB/viewforum.php index d514cf2d61..5fed514a12 100644 --- a/phpBB/viewforum.php +++ b/phpBB/viewforum.php @@ -183,10 +183,13 @@ if ($mark_read == 'topics') if ($request->is_ajax()) { - // Tell the ajax script what language vars need to be replaced + // Tell the ajax script what language vars and URL need to be replaced $data = array( 'NO_UNREAD_POSTS' => $user->lang['NO_UNREAD_POSTS'], - 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'] + 'UNREAD_POSTS' => $user->lang['UNREAD_POSTS'], + 'U_MARK_TOPICS' => ($user->data['is_registered'] || $config['load_anon_lastread']) ? append_sid("{$phpbb_root_path}viewforum.$phpEx", 'hash=' . generate_link_hash('global') . "&f=$forum_id&mark=topics&mark_time=" . time()) : '', + 'MESSAGE_TITLE' => $user->lang['INFORMATION'], + 'MESSAGE_TEXT' => $user->lang['TOPICS_MARKED'] ); $json_response = new phpbb_json_response(); $json_response->send($data); -- cgit v1.2.1