Browse Source

Merge pull request #880 from Arantor/release-2.1

Board index changes
Arantor 11 years ago
parent
commit
6ca3606392

+ 33 - 1
Sources/Subs-BoardIndex.php

@@ -153,8 +153,27 @@ function getBoardIndex($boardIndexOptions)
 					'unapproved_posts' => $row_board['unapproved_posts'] - $row_board['unapproved_topics'],
 					'can_approve_posts' => !empty($user_info['mod_cache']['ap']) && ($user_info['mod_cache']['ap'] == array(0) || in_array($row_board['id_board'], $user_info['mod_cache']['ap'])),
 					'href' => $scripturl . '?board=' . $row_board['id_board'] . '.0',
-					'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['board_name'] . '</a>'
+					'link' => '<a href="' . $scripturl . '?board=' . $row_board['id_board'] . '.0">' . $row_board['board_name'] . '</a>',
+					'board_class' => 'off',
 				);
+
+				// We can do some of the figuring-out-what-icon now.
+				// For certain types of thing we also set up what the tooltip is.
+				if ($this_category[$row_board['id_board']]['is_redirect'])
+				{
+					$this_category[$row_board['id_board']]['board_class'] = 'redirect';
+					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['redirect_board'];
+				}
+				elseif ($this_category[$row_board['id_board']]['new'] || $context['user']['is_guest'])
+				{
+					// If we're showing to guests, we want to give them the idea that something interesting is going on!
+					$this_category[$row_board['id_board']]['board_class'] = 'on';
+					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['new_posts'];
+				}
+				else
+				{
+					$this_category[$row_board['id_board']]['board_tooltip'] = $txt['old_posts'];
+				}
 			}
 			if (!empty($row_board['id_moderator']))
 			{
@@ -215,6 +234,13 @@ function getBoardIndex($boardIndexOptions)
 			// Does this board contain new boards?
 			$this_category[$row_board['id_parent']]['children_new'] |= empty($row_board['is_read']);
 
+			// Update the icon if appropriate
+			if ($this_category[$row_board['id_parent']]['board_class'] == 'off')
+			{
+				$this_category[$row_board['id_parent']]['board_class'] = 'on2';
+				$this_category[$row_board['id_parent']]['board_tooltip'] = $txt['new_posts'];
+			}
+
 			// This is easier to use in many cases for the theme....
 			$this_category[$row_board['id_parent']]['link_children'][] = &$this_category[$row_board['id_parent']]['children'][$row_board['id_board']]['link'];
 		}
@@ -343,6 +369,12 @@ function getBoardIndex($boardIndexOptions)
 	if (!empty($boardIndexOptions['set_latest_post']) && !empty($latest_post['ref']))
 		$context['latest_post'] = $latest_post['ref'];
 
+	// I can't remember why but trying to make a ternary to get this all in one line is actually a Very Bad Idea.
+	if ($boardIndexOptions['include_categories'])
+		call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$categories));
+	else
+		call_integration_hook('integrate_getboardtree', array($boardIndexOptions, &$this_category));
+
 	return $boardIndexOptions['include_categories'] ? $categories : $this_category;
 }
 

+ 3 - 27
Themes/default/BoardIndex.template.php

@@ -142,22 +142,8 @@ function template_main()
 				echo '
 				<tr id="board_', $board['id'], '" class="windowbg2">
 					<td class="windowbg icon"', !empty($board['children']) ? ' rowspan="2"' : '', '>
-						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
-
-				// If the board or children is new, show an indicator.
-				if ($board['new'] || $board['children_new'])
-					echo '
-							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
-				// Is it a redirection board?
-				elseif ($board['is_redirect'])
-					echo '
-							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
-				// No new posts at all! The agony!!
-				else
-					echo '
-							<img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
-
-				echo '
+						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">
+							<span class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></span>
 						</a>
 					</td>
 					<td class="info">
@@ -234,17 +220,7 @@ function template_main()
 	}
 	echo '
 		</table>
-	</div>
-		<ul id="posting_icons">';
-
-	if ($context['user']['is_logged'])
-	echo '
-			<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_some.png" alt="" /> ', $txt['new_posts'], '</li>';
-
-	echo '
-			<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_none.png" alt="" /> ', $txt['old_posts'], '</li>
-			<li class="floatleft"><img src="', $settings['images_url'], '/', $context['theme_variant_url'], 'new_redirect.png" alt="" /> ', $txt['redirect_board'], '</li>
-		</ul>';
+	</div>';
 
 	// Show the mark all as read button?
 	if ($context['user']['is_logged'] && $settings['show_mark_read'] && !empty($context['categories']))

+ 2 - 16
Themes/default/MessageIndex.template.php

@@ -35,22 +35,8 @@ function template_main()
 			echo '
 				<tr id="board_', $board['id'], '" class="windowbg2">
 					<td class="windowbg icon"', !empty($board['children']) ? ' rowspan="2"' : '', '>
-						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">';
-
-			// If the board or children is new, show an indicator.
-			if ($board['new'] || $board['children_new'])
-				echo '
-							<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'on', $board['new'] ? '' : '2', '.png" alt="', $txt['new_posts'], '" title="', $txt['new_posts'], '" />';
-			// Is it a redirection board?
-			elseif ($board['is_redirect'])
-				echo '
-							<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'redirect.png" alt="*" title="*" />';
-			// No new posts at all! The agony!!
-			else
-				echo '
-							<img src="', $settings['images_url'], '/' .$context['theme_variant_url'], 'off.png" alt="', $txt['old_posts'], '" title="', $txt['old_posts'], '" />';
-
-			echo '
+						<a href="', ($board['is_redirect'] || $context['user']['is_guest'] ? $board['href'] : $scripturl . '?action=unread;board=' . $board['id'] . '.0;children'), '">
+							<span class="board_', $board['board_class'], '"', !empty($board['board_tooltip']) ? ' title="' . $board['board_tooltip'] . '"' : '', '></span>
 						</a>
 					</td>
 					<td class="info">

+ 21 - 15
Themes/default/css/index.css

@@ -1666,7 +1666,7 @@ ul li.greeting {
 	margin: 0 0 0 1px;
 	padding: 8px 0 0 0;
 	width: 5%;
-	min-width: 50px;
+	min-width: 60px;
 	/*Top aligned is much nicer for the icon. */
 	vertical-align: top;
 	border-left: 1px solid #ddd;
@@ -1729,6 +1729,25 @@ ul li.greeting {
 	background: -webkit-linear-gradient(bottom, #FFFFFF 1%, #F1F3F5 96%);
 	background: linear-gradient(to top, #FFFFFF 1%, #F1F3F5 96%);
 }
+/* The board index and its icons. */
+.table_list .icon span {
+	background: url(../images/boardicons.png) no-repeat 0 0;
+	display: inline-block;
+	width: 45px;
+	height: 45px;
+}
+.table_list .icon span.board_on {
+	background-position: 0 0;
+}
+.table_list .icon span.board_on2 {
+	background-position: -45px 0;
+}
+.table_list .icon span.board_off {
+	background-position: 0 -45px;
+}
+.table_list .icon span.board_redirect {
+	background-position: -45px -45px;
+}
 /* Hiding unwanted border repeats. */
 .table_list .content tr:first-child .icon, .table_list .content tr:first-child .info,
 .table_list .content tr:first-child .stats, .table_list .content tr:first-child .lastpost {
@@ -1741,25 +1760,12 @@ ul li.greeting {
 }
 
 /* the posting icons */
-#posting_icons {
-	padding: 0 12px 6px 0;
-	margin: -6px 0 16px -8px;
-	line-height: 12px;
-	float: left;
-}
-#posting_icons li {
-	font-size: 0.9em;
-}
-#posting_icons img {
-	vertical-align: middle;
-	margin: 0 0 0 12px;
-}
 #postbuttons_upper ul li a span {
 	line-height: 19px;
 	padding: 0 0 0 6px;
 }
 .mark_read {
-	margin: -5px 0 0 0;
+	margin: -5px 0 16px 0;
 	padding: 0;
 	float: right;
 }

BIN
Themes/default/images/boardicons.png


BIN
Themes/default/images/new_none.png


BIN
Themes/default/images/new_some.png


BIN
Themes/default/images/off.png


BIN
Themes/default/images/on.png


BIN
Themes/default/images/on2.png


BIN
Themes/default/images/redirect.png