Prechádzať zdrojové kódy

First part of fixing double headers in several sections

Signed-off-by: emanuele <[email protected]>
emanuele 11 rokov pred
rodič
commit
cf5eebdee9

+ 5 - 0
Sources/Drafts.php

@@ -652,6 +652,11 @@ function showProfileDrafts($memID, $draft_type = 0)
 	if ($reverse)
 		$context['drafts'] = array_reverse($context['drafts'], true);
 
+	// Menu tab
+	$context[$context['profile_menu_name']]['tab_data'] = array(
+		'title' => $txt['drafts_show'] . ' - ' . $context['member']['name'],
+		'icon' => 'message_sm.png'
+	);
 	$context['sub_template'] = 'showDrafts';
 }
 

+ 9 - 0
Sources/ModerationCenter.php

@@ -173,6 +173,15 @@ function ModerationMain($dont_call = false)
 	$context['moderation_menu_id'] = $context['max_menu_id'];
 	$context['moderation_menu_name'] = 'menu_data_' . $context['moderation_menu_id'];
 
+	// @todo: html in here is not good
+	$context[$context['moderation_menu_name']]['tab_data'] = array(
+		'title' => $txt['moderation_center'],
+		'help' => '',
+		'description' => '
+			<strong>' . $txt['hello_guest'] . ' ' . $context['user']['name'] . '!</strong>
+			<br /><br />
+			' . $txt['mc_description']);
+
 	// What a pleasant shortcut - even tho we're not *really* on the admin screen who cares...
 	$context['admin_area'] = $mod_include_data['current_area'];
 

+ 10 - 0
Sources/Profile-View.php

@@ -42,6 +42,11 @@ function summary($memID)
 
 	// Are there things we don't show?
 	$context['disabled_fields'] = isset($modSettings['disabled_profile_fields']) ? array_flip(explode(',', $modSettings['disabled_profile_fields'])) : array();
+	// Menu tab
+	$context[$context['profile_menu_name']]['tab_data'] = array(
+		'title' => $txt['summary'],
+		'icon' => 'profile_hd.png'
+	);
 
 	// See if they have broken any warning levels...
 	list ($modSettings['warning_enable'], $modSettings['user_limit']) = explode(',', $modSettings['warning_settings']);
@@ -951,6 +956,11 @@ function statPanel($memID)
 	$timeHours = floor(($user_profile[$memID]['total_time_logged_in'] % 86400) / 3600);
 	$context['time_logged_in'] = ($timeDays > 0 ? $timeDays . $txt['totalTimeLogged2'] : '') . ($timeHours > 0 ? $timeHours . $txt['totalTimeLogged3'] : '') . floor(($user_profile[$memID]['total_time_logged_in'] % 3600) / 60) . $txt['totalTimeLogged4'];
 	$context['num_posts'] = comma_format($user_profile[$memID]['posts']);
+	// Menu tab
+	$context[$context['profile_menu_name']]['tab_data'] = array(
+		'title' => $txt['statPanel_generalStats'] . ' - ' . $context['member']['name'],
+		'icon' => 'stats_info_hd.png'
+	);
 
 	// Number of topics started.
 	$result = $smcFunc['db_query']('', '

+ 68 - 64
Themes/default/GenericMenu.template.php

@@ -214,84 +214,87 @@ function template_generic_menu_tabs(&$menu_context)
 	// Handy shortcut.
 	$tab_context = &$menu_context['tab_data'];
 
-	echo '
+	if (!empty($tab_context['title']))
+	{
+		echo '
 	<div class="cat_bar">
 		<h3 class="catbg">';
 
-	// The function is in Admin.template.php, but since this template is used elsewhere too better check if the function is available
-	if (function_exists('template_admin_quick_search'))
-		template_admin_quick_search();
+		// The function is in Admin.template.php, but since this template is used elsewhere too better check if the function is available
+		if (function_exists('template_admin_quick_search'))
+			template_admin_quick_search();
 
-	// Exactly how many tabs do we have?
-	if (!empty($context['tabs']))
-	{
-		foreach ($context['tabs'] as $id => $tab)
+		// Exactly how many tabs do we have?
+		if (!empty($context['tabs']))
 		{
-			// Can this not be accessed?
-			if (!empty($tab['disabled']))
+			foreach ($context['tabs'] as $id => $tab)
 			{
-				$tab_context['tabs'][$id]['disabled'] = true;
-				continue;
-			}
+				// Can this not be accessed?
+				if (!empty($tab['disabled']))
+				{
+					$tab_context['tabs'][$id]['disabled'] = true;
+					continue;
+				}
 
-			// Did this not even exist - or do we not have a label?
-			if (!isset($tab_context['tabs'][$id]))
-				$tab_context['tabs'][$id] = array('label' => $tab['label']);
-			elseif (!isset($tab_context['tabs'][$id]['label']))
-				$tab_context['tabs'][$id]['label'] = $tab['label'];
+				// Did this not even exist - or do we not have a label?
+				if (!isset($tab_context['tabs'][$id]))
+					$tab_context['tabs'][$id] = array('label' => $tab['label']);
+				elseif (!isset($tab_context['tabs'][$id]['label']))
+					$tab_context['tabs'][$id]['label'] = $tab['label'];
 
-			// Has a custom URL defined in the main admin structure?
-			if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url']))
-				$tab_context['tabs'][$id]['url'] = $tab['url'];
+				// Has a custom URL defined in the main admin structure?
+				if (isset($tab['url']) && !isset($tab_context['tabs'][$id]['url']))
+					$tab_context['tabs'][$id]['url'] = $tab['url'];
 
-			// Any additional paramaters for the url?
-			if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params']))
-				$tab_context['tabs'][$id]['add_params'] = $tab['add_params'];
+				// Any additional paramaters for the url?
+				if (isset($tab['add_params']) && !isset($tab_context['tabs'][$id]['add_params']))
+					$tab_context['tabs'][$id]['add_params'] = $tab['add_params'];
 
-			// Has it been deemed selected?
-			if (!empty($tab['is_selected']))
-				$tab_context['tabs'][$id]['is_selected'] = true;
+				// Has it been deemed selected?
+				if (!empty($tab['is_selected']))
+					$tab_context['tabs'][$id]['is_selected'] = true;
 
-			// Does it have its own help?
-			if (!empty($tab['help']))
-				$tab_context['tabs'][$id]['help'] = $tab['help'];
+				// Does it have its own help?
+				if (!empty($tab['help']))
+					$tab_context['tabs'][$id]['help'] = $tab['help'];
 
-			// Is this the last one?
-			if (!empty($tab['is_last']) && !isset($tab_context['override_last']))
-				$tab_context['tabs'][$id]['is_last'] = true;
-		}
+				// Is this the last one?
+				if (!empty($tab['is_last']) && !isset($tab_context['override_last']))
+					$tab_context['tabs'][$id]['is_last'] = true;
+			}
 
-		// Find the selected tab
-		foreach ($tab_context['tabs'] as $sa => $tab)
-		{
-			if (!empty($tab['is_selected']) || (isset($menu_context['current_subsection']) && $menu_context['current_subsection'] == $sa))
+			// Find the selected tab
+			foreach ($tab_context['tabs'] as $sa => $tab)
 			{
-				$selected_tab = $tab;
-				$tab_context['tabs'][$sa]['is_selected'] = true;
+				if (!empty($tab['is_selected']) || (isset($menu_context['current_subsection']) && $menu_context['current_subsection'] == $sa))
+				{
+					$selected_tab = $tab;
+					$tab_context['tabs'][$sa]['is_selected'] = true;
+				}
 			}
 		}
-	}
 
-	// Show an icon and/or a help item?
-	if (!empty($selected_tab['icon']) || !empty($tab_context['icon']) || !empty($selected_tab['help']) || !empty($tab_context['help']))
-	{
-		if (!empty($selected_tab['icon']) || !empty($tab_context['icon']))
-			echo '<img src="', $settings['images_url'], '/icons/', !empty($selected_tab['icon']) ? $selected_tab['icon'] : $tab_context['icon'], '" alt="" class="icon" />';
+		// Show an icon and/or a help item?
+		if (!empty($selected_tab['icon']) || !empty($tab_context['icon']) || !empty($selected_tab['help']) || !empty($tab_context['help']))
+		{
+			if (!empty($selected_tab['icon']) || !empty($tab_context['icon']))
+				echo '<img src="', $settings['images_url'], '/icons/', !empty($selected_tab['icon']) ? $selected_tab['icon'] : $tab_context['icon'], '" alt="" class="icon" />';
 
-		if (!empty($selected_tab['help']) || !empty($tab_context['help']))
-			echo '<a href="', $scripturl, '?action=helpadmin;help=', !empty($selected_tab['help']) ? $selected_tab['help'] : $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics_hd.png" alt="', $txt['help'], '" class="icon" /></a>';
+			if (!empty($selected_tab['help']) || !empty($tab_context['help']))
+				echo '<a href="', $scripturl, '?action=helpadmin;help=', !empty($selected_tab['help']) ? $selected_tab['help'] : $tab_context['help'], '" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics_hd.png" alt="', $txt['help'], '" class="icon" /></a>';
 
-		echo $tab_context['title'];
-	}
-	else
-	{
-		echo '
-			', $tab_context['title'];
-	}
+			echo $tab_context['title'];
+		}
+		else
+		{
+			echo '
+				', $tab_context['title'];
+		}
 
-	echo '
+		echo '
 		</h3>
 	</div>';
+	}
 
 	// Shall we use the tabs? Yes, it's the only known way!
 	if (!empty($selected_tab['description']) || !empty($tab_context['description']))
@@ -300,14 +303,14 @@ function template_generic_menu_tabs(&$menu_context)
 		', !empty($selected_tab['description']) ? $selected_tab['description'] : $tab_context['description'], '
 	</p>';
 
-	// The admin tabs.
-	echo '
-	<div id="adm_submenus">
-		<ul class="dropmenu">';
-
 	// Print out all the items in this tab (if any).
 	if (!empty($context['tabs']))
 	{
+		// The admin tabs.
+		echo '
+	<div id="adm_submenus">
+		<ul class="dropmenu">';
+
 		foreach ($tab_context['tabs'] as $sa => $tab)
 		{
 			if (!empty($tab['disabled']))
@@ -326,13 +329,14 @@ function template_generic_menu_tabs(&$menu_context)
 				<a href="', isset($tab['url']) ? $tab['url'] : $menu_context['base_url'] . ';area=' . $menu_context['current_area'] . ';sa=' . $sa, $menu_context['extra_parameters'], isset($tab['add_params']) ? $tab['add_params'] : '', '">', $tab['label'], '</a>
 			</li>';
 		}
-	}
 
-	// the end of tabs
-	echo '
+		// the end of tabs
+		echo '
 		</ul>
 	</div>
 	<br class="clear" />';
+
+	}
 }
 
 ?>

+ 1 - 10
Themes/default/ModerationCenter.template.php

@@ -16,16 +16,7 @@ function template_moderation_center()
 
 	// Show a welcome message to the user.
 	echo '
-	<div id="modcenter">
-		<div class="cat_bar">
-			<h3 class="catbg">', $txt['moderation_center'], '</h3>
-		</div>
-		<div class="information">
-			<strong>', $txt['hello_guest'], ' ', $context['user']['name'], '!</strong>
-			<p>
-				', $txt['mc_description'], '
-			</p>
-		</div>';
+	<div id="modcenter">';
 
 	$alternate = true;
 	// Show all the blocks they want to see.

+ 0 - 18
Themes/default/Profile.template.php

@@ -49,11 +49,6 @@ function template_summary()
 
 	// Display the basic information about the user
 	echo '
-<div class="cat_bar">
-	<h3 class="catbg">
-		<img src="', $settings['images_url'], '/icons/profile_hd.png" alt="" class="icon" />', $txt['summary'], '
-	</h3>
-</div>
 <div id="profileview" class="flow_auto">
 	<div id="basicinfo">
 		<div class="windowbg">
@@ -445,13 +440,6 @@ function template_showDrafts()
 	global $context, $settings, $options, $scripturl, $modSettings, $txt;
 
 	echo '
-		<div class="cat_bar">
-			<h3 class="catbg">
-				<span class="ie6_header floatleft"><img src="', $settings['images_url'], '/message_sm.png" alt="" class="icon" />
-					', $txt['drafts_show'], ' - ', $context['member']['name'], '
-				</span>
-			</h3>
-		</div>
 		<div class="pagesection" style="margin-bottom: 0;">
 			<div class="pagelinks">', $context['page_index'], '</div>
 		</div>';
@@ -1039,12 +1027,6 @@ function template_statPanel()
 
 	// First, show a few text statistics such as post/topic count.
 	echo '
-	<div class="cat_bar">
-		<h3 class="catbg">
-			<img src="', $settings['images_url'], '/stats_info_hd.png" alt="" class="icon" />
-			', $txt['statPanel_generalStats'], ' - ', $context['member']['name'], '
-		</h3>
-	</div>
 	<div id="profileview">
 		<div id="generalstats">
 			<div class="windowbg2">

+ 1 - 0
Themes/default/languages/index.english.php

@@ -211,6 +211,7 @@ $txt['welcome_guest_register'] = 'Welcome to <strong>'. $context['forum_name'].
 $txt['please_login'] = 'Please <a href="' . $scripturl . '?action=login">login</a>.';
 $txt['login_or_register'] = 'Please <a href="' . $scripturl . '?action=login">login</a> or <a href="' . $scripturl . '?action=register">register</a>.';
 $txt['welcome_guest_activate'] = '<br />Did you miss your <a href="' . $scripturl . '?action=activate">activation email</a>?';
+// @todo the following to sprintf
 $txt['hello_member'] = 'Hey,';
 // Use numeric entities in the below string.
 $txt['hello_guest'] = 'Welcome,';