Implement archived boards, via categories hidden by default

This commit is contained in:
Travis Burtrum 2014-02-08 17:40:07 -05:00
parent f808070271
commit 90d2036d2c
2 changed files with 19 additions and 3 deletions

View File

@ -30,7 +30,15 @@ if (!defined('SMF'))
function getBoardIndex($boardIndexOptions)
{
global $smcFunc, $scripturl, $user_info, $modSettings, $txt;
global $settings, $context;
global $settings, $context, $show_archived;
//xxx show archived boards
if($boardIndexOptions['include_categories']){
if(isset($_GET['show_archived']))
$_SESSION['show_archived'] = $_GET['show_archived'] == 0 ? 0 : 1;
$show_archived = !empty($user_info['possibly_robot']) || (isset($_SESSION['show_archived']) && $_SESSION['show_archived'] == 1);
}
//xxx end show archived boards
// For performance, track the latest post while going through the boards.
if (!empty($boardIndexOptions['set_latest_post']))
@ -63,7 +71,9 @@ function getBoardIndex($boardIndexOptions)
LEFT JOIN {db_prefix}members AS mods_mem ON (mods_mem.id_member = mods.id_member)
WHERE {query_see_board}' . (empty($boardIndexOptions['countChildPosts']) ? (empty($boardIndexOptions['base_level']) ? '' : '
AND b.child_level >= {int:child_level}') : '
AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)),
AND b.child_level BETWEEN ' . $boardIndexOptions['base_level'] . ' AND ' . ($boardIndexOptions['base_level'] + 1)) .
//xxx show archived boards
(isset($show_archived) && !$show_archived ? ' AND c.forumid = 1' : ''),
array(
'current_member' => $user_info['id'],
'child_level' => $boardIndexOptions['base_level'],

View File

@ -3944,7 +3944,7 @@ function loadClassFile($filename)
function setupMenuContext()
{
global $context, $modSettings, $user_info, $txt, $scripturl;
global $context, $modSettings, $user_info, $txt, $scripturl, $show_archived;
// Set up the menu privileges.
$context['allow_search'] = allowedTo('search_posts');
@ -3969,6 +3969,12 @@ function setupMenuContext()
),
'is_last' => $context['right_to_left'],
),
//xxx show archived boards
'show_archived' => array(
'title' => ($show_archived ? 'Hide' : 'Show').' Archived Boards',
'href' => $scripturl . '?show_archived='.($show_archived ? 0 : 1),
'show' => isset($show_archived),
),
'help' => array(
'title' => $txt['help'],
'href' => $scripturl . '?action=help',