Przeglądaj źródła

Now that tabs are gone, I can use the generic template to present much more things :P

Signed-off-by: emanuele <[email protected]>
emanuele 12 lat temu
rodzic
commit
90091eb00d

+ 9 - 0
Sources/Admin.php

@@ -552,6 +552,15 @@ function AdminHome()
 
 	$context['sub_template'] = $context['admin_area'] == 'credits' ? 'credits' : 'admin';
 	$context['page_title'] = $context['admin_area'] == 'credits' ? $txt['support_credits_title'] : $txt['admin_center'];
+	if ($context['admin_area'] != 'credits')
+		$context[$context['admin_menu_name']]['tab_data'] = array(
+			'title' => $txt['admin_center'],
+			'help' => '',
+			'description' => '
+				<strong>' . $txt['hello_guest'] . ' ' . $context['user']['name'] . '!</strong>
+				' . sprintf($txt['admin_main_welcome'], $txt['admin_center'], $txt['help'], $txt['help']),
+		);
+
 
 	// The format of this array is: permission, action, title, description, icon.
 	$quick_admin_tasks = array(

+ 5 - 0
Sources/Drafts.php

@@ -867,6 +867,11 @@ function ModifyDraftSettings($return_config = false)
 	// Setup the template.
 	$context['page_title'] = $txt['managedrafts_settings'];
 	$context['sub_template'] = 'show_settings';
+	$context[$context['admin_menu_name']]['tab_data'] = array(
+		'title' => $txt['drafts'],
+		'help' => '',
+		'description' => $txt['managedrafts_settings_description'],
+	);
 
 	// Saving them ?
 	if (isset($_GET['save']))

+ 5 - 0
Sources/ManageSettings.php

@@ -476,6 +476,11 @@ function ModifyCoreFeatures($return_config = false)
 
 	$context['sub_template'] = 'core_features';
 	$context['page_title'] = $txt['core_settings_title'];
+	$context[$context['admin_menu_name']]['tab_data'] = array(
+		'title' => $txt['core_settings_title'],
+		'help' => '',
+		'description' => $txt['core_settings_desc'],
+	);
 
 	// We love our tokens.
 	createToken('admin-core');

+ 6 - 0
Sources/Reports.php

@@ -61,6 +61,12 @@ function ReportsMain()
 	);
 
 	call_integration_hook('integrate_report_types');
+	// Load up all the tabs...
+	$context[$context['admin_menu_name']]['tab_data'] = array(
+		'title' => $txt['generate_reports'],
+		'help' => '',
+		'description' => $txt['generate_reports_desc'],
+	);
 
 	$is_first = 0;
 	foreach ($context['report_types'] as $k => $temp)

+ 6 - 0
Sources/Who.php

@@ -527,6 +527,12 @@ function Credits($in_admin = false)
 	// Don't blink. Don't even blink. Blink and you're dead.
 	loadLanguage('Who');
 
+	$context[$context['admin_menu_name']]['tab_data'] = array(
+		'title' => $txt['support_credits_title'],
+		'help' => '',
+		'description' => '',
+	);
+
 	$context['credits'] = array(
 		array(
 			'pretext' => $txt['credits_intro'],

+ 1 - 32
Themes/default/Admin.template.php

@@ -19,21 +19,7 @@ function template_admin()
 
 	// Welcome message for the admin.
 	echo '
-	<div id="admincenter">
-		<div id="section_header" class="cat_bar">
-			<h3 class="catbg">';
-
-	template_admin_quick_search();
-
-	echo $txt['admin_center'], '
-			</h3>
-		</div>
-		<div class="roundframe rfix">
-			<div id="welcome">
-				<strong>', $txt['hello_guest'], ' ', $context['user']['name'], '!</strong>
-				', sprintf($txt['admin_main_welcome'], $txt['admin_center'], $txt['help'], $txt['help']), '
-			</div>
-		</div>';
+	<div id="admincenter">';
 
 	// Is there an update available?
 	echo '
@@ -181,14 +167,6 @@ function template_credits()
 	echo '
 
 	<div id="admincenter">
-		<div id="section_header" class="cat_bar">
-			<h3 class="catbg">';
-
-	template_admin_quick_search();
-
-	echo $txt['support_credits_title'], '
-			</h3>
-		</div>
 		<div id="support_credits">
 			<div class="cat_bar">
 				<h3 class="catbg">
@@ -1366,15 +1344,6 @@ function template_core_features()
 	}
 
 	echo '
-			<div id="section_header" class="cat_bar">
-				<h3 class="catbg">';
-
-	template_admin_quick_search();
-
-	echo $txt['core_settings_title'], '
-				</h3>
-			</div>
-			<p class="description">', $txt['core_settings_desc'], '</p>
 			<form id="core_features" action="', $scripturl, '?action=admin;area=corefeatures" method="post" accept-charset="', $context['character_set'], '">
 			<div style="display:none" id="activation_message" class="errorbox"></div>';
 

+ 52 - 45
Themes/default/GenericMenu.template.php

@@ -193,7 +193,7 @@ function template_generic_menu_dropdown_above()
 <div id="admin_content">';
 
 	// It's possible that some pages have their own tabs they wanna force...
-	if (!empty($context['tabs']))
+// 	if (!empty($context['tabs']))
 		template_generic_menu_tabs($menu_context);
 }
 
@@ -223,49 +223,52 @@ function template_generic_menu_tabs(&$menu_context)
 		template_admin_quick_search();
 
 	// Exactly how many tabs do we have?
-	foreach ($context['tabs'] as $id => $tab)
+	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;
+			}
 		}
 	}
 
@@ -291,7 +294,8 @@ function template_generic_menu_tabs(&$menu_context)
 	</div>';
 
 	// Shall we use the tabs? Yes, it's the only known way!
-	echo '
+	if (!empty($selected_tab['description']) || !empty($tab_context['description']))
+		echo '
 	<p class="description">
 		', !empty($selected_tab['description']) ? $selected_tab['description'] : $tab_context['description'], '
 	</p>';
@@ -301,24 +305,27 @@ function template_generic_menu_tabs(&$menu_context)
 	<div id="adm_submenus">
 		<ul class="dropmenu">';
 
-	// Print out all the items in this tab.
-	foreach ($tab_context['tabs'] as $sa => $tab)
+	// Print out all the items in this tab (if any).
+	if (!empty($context['tabs']))
 	{
-		if (!empty($tab['disabled']))
-			continue;
-
-		if (!empty($tab['is_selected']))
+		foreach ($tab_context['tabs'] as $sa => $tab)
 		{
-			echo '
+			if (!empty($tab['disabled']))
+				continue;
+
+			if (!empty($tab['is_selected']))
+			{
+				echo '
 			<li>
 				<a class="active" 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>';
-		}
-		else
-			echo '
+			}
+			else
+				echo '
 			<li>
 				<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

+ 0 - 10
Themes/default/Reports.template.php

@@ -17,16 +17,6 @@ function template_report_type()
 
 	echo '
 	<div id="admincenter">
-		<div class="cat_bar">
-			<h3 class="catbg">';
-
-	template_admin_quick_search();
-
-	echo $txt['generate_reports'], '</h3>
-		</div>
-		<div class="information">
-			', $txt['generate_reports_desc'], '
-		</div>
 		<form action="', $scripturl, '?action=admin;area=reports" method="post" accept-charset="', $context['character_set'], '">
 			<div id="generate_reports_type">
 				<div class="cat_bar">

+ 1 - 1
Themes/default/languages/Admin.english.php

@@ -48,7 +48,7 @@ $txt['admin_agreement_select_language'] = 'Language to edit';
 $txt['admin_agreement_select_language_change'] = 'Change';
 $txt['admin_delete_members'] = 'Delete Selected Members';
 $txt['admin_repair'] = 'Repair All boards and topics';
-$txt['admin_main_welcome'] = 'This is your &quot;%1$s&quot;.  From here, you can edit settings, maintain your forum, view logs, install packages, manage themes, and many other things.<div style="margin-top: 1ex;">If you have any trouble, please look at the &quot;Support &amp; Credits&quot; page.  If the information there doesn\'t help you, feel free to <a href="http://www.simplemachines.org/community/index.php" target="_blank" class="new_win">look to us for help</a> with the problem.</div>You may also find answers to your questions or problems by clicking the <img src="' . $settings['images_url'] . '/helptopics.png" alt="%2$s" title="%3$s" /> symbols for more information on the related functions.';
+$txt['admin_main_welcome'] = 'This is your &quot;%1$s&quot;.  From here, you can edit settings, maintain your forum, view logs, install packages, manage themes, and many other things.<br /><br />If you have any trouble, please look at the &quot;Support &amp; Credits&quot; page.  If the information there doesn\'t help you, feel free to <a href="http://www.simplemachines.org/community/index.php" target="_blank" class="new_win">look to us for help</a> with the problem.<br />You may also find answers to your questions or problems by clicking the <img src="' . $settings['images_url'] . '/helptopics.png" alt="%2$s" title="%3$s" /> symbols for more information on the related functions.';
 $txt['admin_news_desc'] = 'Please place one news item per box. BBC tags, such as <span title="Are you bold?">[b]</span>, <span title="I tall icks!!">[i]</span> and <span title="Brackets are great, no?">[u]</span> are allowed in your news, as well as smileys. Clear a news item\'s text box to remove it.';
 $txt['administrators'] = 'Forum Administrators';
 $txt['admin_reserved_desc'] = 'Reserved names will keep members from registering certain usernames or using these words in their displayed names. Choose the options you wish to use from the bottom before submitting.';