Selaa lähdekoodia

Merge pull request #695 from Arantor/release-2.1

! Rework Attachments / Browse Files navigation as per Mantis issue 4786
Arantor 11 vuotta sitten
vanhempi
commit
f77152afd9
2 muutettua tiedostoa jossa 23 lisäystä ja 28 poistoa
  1. 23 6
      Sources/ManageAttachments.php
  2. 0 22
      Themes/default/ManageAttachments.template.php

+ 23 - 6
Sources/ManageAttachments.php

@@ -360,23 +360,37 @@ function ManageAvatarSettings($return_config = false)
  *  and ?action=admin;area=manageattachments;sa=browse;avatars for avatars.
  * Allows sorting by name, date, size and member.
  * Paginates results.
- *
- *  @uses the 'browse' sub template
  */
 function BrowseFiles()
 {
 	global $context, $txt, $scripturl, $options, $modSettings;
-	global $smcFunc, $sourcedir;
-
-	$context['sub_template'] = 'browse';
+	global $smcFunc, $sourcedir, $settings;
 
 	// Attachments or avatars?
 	$context['browse_type'] = isset($_REQUEST['avatars']) ? 'avatars' : (isset($_REQUEST['thumbs']) ? 'thumbs' : 'attachments');
 
+	$titles = array(
+		'attachments' => array('?action=admin;area=manageattachments;sa=browse', $txt['attachment_manager_attachments']),
+		'avatars' => array('?action=admin;area=manageattachments;sa=browse;avatars', $txt['attachment_manager_avatars']),
+		'thumbs' => array('?action=admin;area=manageattachments;sa=browse;thumbs', $txt['attachment_manager_thumbs']),
+	);
+
+	$list_title = $txt['attachment_manager_browse_files'] . ': ';
+	foreach ($titles as $browse_type => $details)
+	{
+		if ($browse_type != 'attachments')
+			$list_title .= ' | ';
+
+		if ($context['browse_type'] == $browse_type)
+			$list_title .= '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ';
+
+		$list_title .= '<a href="' . $scripturl . $details[0] . '">' . $details[1] . '</a>';
+	}
+
 	// Set the options for the list component.
 	$listOptions = array(
 		'id' => 'file_list',
-		'title' => $txt['attachment_manager_' . ($context['browse_type'] === 'avatars' ? 'avatars' : ($context['browse_type'] === 'thumbs' ? 'thumbs' : 'attachments'))],
+		'title' => $list_title,
 		'items_per_page' => $modSettings['defaultMaxMessages'],
 		'base_href' => $scripturl . '?action=admin;area=manageattachments;sa=browse' . ($context['browse_type'] === 'avatars' ? ';avatars' : ($context['browse_type'] === 'thumbs' ? ';thumbs' : '')),
 		'default_sort_col' => 'name',
@@ -545,6 +559,9 @@ function BrowseFiles()
 	// Create the list.
 	require_once($sourcedir . '/Subs-List.php');
 	createList($listOptions);
+
+	$context['sub_template'] = 'show_list';
+	$context['default_list'] = 'file_list';
 }
 
 /**

+ 0 - 22
Themes/default/ManageAttachments.template.php

@@ -33,28 +33,6 @@ function template_avatar_settings_below()
 ';
 }
 
-function template_browse()
-{
-	global $context, $settings, $options, $scripturl, $txt;
-
-	echo '
-	<div id="manage_attachments">
-		<div class="cat_bar">
-			<h3 class="catbg">', $txt['attachment_manager_browse_files'], '</h3>
-		</div>
-		<div class="windowbg2">
-			<div class="content">
-				<a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse">', $context['browse_type'] === 'attachments' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_attachments'], '</a> |
-				<a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse;avatars">', $context['browse_type'] === 'avatars' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_avatars'], '</a> |
-				<a href="', $scripturl, '?action=admin;area=manageattachments;sa=browse;thumbs">', $context['browse_type'] === 'thumbs' ? '<img src="' . $settings['images_url'] . '/selected.png" alt="&gt;" /> ' : '', $txt['attachment_manager_thumbs'], '</a>
-			</div>
-		</div>
-	</div>';
-
-	template_show_list('file_list');
-
-}
-
 function template_maintenance()
 {
 	global $context, $settings, $options, $scripturl, $txt, $modSettings;