Browse Source

Re-write the main themes template

Signed-off-by: Suki <[email protected]>
Suki 11 years ago
parent
commit
5163455996
1 changed files with 68 additions and 66 deletions
  1. 68 66
      Themes/default/Themes.template.php

+ 68 - 66
Themes/default/Themes.template.php

@@ -16,102 +16,104 @@ function template_main()
 	global $context, $settings, $options, $scripturl, $txt, $modSettings;
 
 	echo '
-	<div id="admincenter">
+	<div id="admincenter">';
+
+	// Theme install info.
+	echo '
 		<div class="cat_bar">
-			<h3 class="catbg">
-				<a href="', $scripturl, '?action=helpadmin;help=themes" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics_hd.png" class="icon" alt="', $txt['help'], '" /></a>
-				', $txt['themeadmin_title'], '
-			</h3>
+		<h3 class="catbg">
+			<a href="', $scripturl, '?action=helpadmin;help=themes" onclick="return reqOverlayDiv(this.href);" class="help"><img src="', $settings['images_url'], '/helptopics_hd.png" class="icon" alt="', $txt['help'], '" /></a>
+			', $txt['themeadmin_title'], '
+		</h3>
 		</div>
 		<div class="information">
 			', $txt['themeadmin_explain'], '
-		</div>
-		<div id="admin_form_wrapper">';
+		</div>';
 
 	// Link to simplemachines.org for latest themes and info!
 	echo '
-			<br />
-			<div class="cat_bar">
-				<h3 class="catbg">
-					', $txt['theme_adding_title'], '
-				</h3>
-			</div>
-			<div class="windowbg2">
+		<br />
+		<div class="cat_bar">
+			<h3 class="catbg">
+				', $txt['theme_adding_title'], '
+			</h3>
+		</div>
+		<div class="windowbg">
+			<div class="content">
 				', $txt['theme_adding'], '
 			</div>
-			<br />';
+		</div>';
 
-	// Warn them if theme creation isn't possible!
-	if (!$context['can_create_new'])
-		echo '
-			<div class="errorbox">', $txt['theme_install_writable'], '</div>';
+	// All the install options.
+	echo '
+		<div id="admin_form_wrapper">
+			<div class="cat_bar">
+				<h3 class="catbg2">
+					', $txt['theme_install'], '
+				</h3>
+			</div>';
 
+	if ($context['can_create_new'])
+	{
+		// From a file.
 		echo '
+			<br />
 			<div class="cat_bar">
 				<h3 class="catbg">
-					<a href="', $scripturl, '?action=helpadmin;help=theme_install" onclick="return reqOverlayDiv(this.href);" class="help" id="theme_install"><img src="', $settings['images_url'], '/helptopics_hd.png" class="icon" alt="', $txt['help'], '" /></a> ', $txt['theme_install'], '
+					', $txt['theme_install_file'], '
 				</h3>
 			</div>
-			<form action="', $scripturl, '?action=admin;area=theme;sa=install" method="post" accept-charset="', $context['character_set'], '" enctype="multipart/form-data" onsubmit="return confirm(\'', $txt['theme_install_new_confirm'], '\');">
-				<div class="windowbg">
-					<div class="content">
-						<dl class="settings">';
+			<div class="content">
+				<form action="', $scripturl, '?action=admin;area=theme;sa=admin;do=file" method="post" accept-charset="', $context['character_set'], '" class="windowbg2">
+					<input type="file" name="theme_gz" id="theme_gz" value="theme_gz" size="40" onchange="this.form.copy.disabled = this.value != \'\'; this.form.theme_dir.disabled = this.value != \'\';" class="input_file" />
+					<input type="submit" name="save" value="' . $txt['save'] . '" class="button_submit" />
+				</form>
+			</div>';
 
-	// Here's a little box for installing a new theme.
-	// @todo Should the value="theme_gz" be there?!
-	if ($context['can_create_new'])
+		// Copied from the default.
 		echo '
-							<dt>
-								<label for="theme_gz">', $txt['theme_install_file'], '</label>:
-							</dt>
-							<dd>
-								<input type="file" name="theme_gz" id="theme_gz" value="theme_gz" size="40" onchange="this.form.copy.disabled = this.value != \'\'; this.form.theme_dir.disabled = this.value != \'\';" class="input_file" />
-							</dd>';
+			<br />
+			<div class="cat_bar">
+				<h3 class="catbg">
+					', $txt['theme_install_new'], '
+				</h3>
+			</div>
+			<div class="content">
+				<form action="', $scripturl, '?action=admin;area=theme;sa=admin;do=copy" method="post" accept-charset="', $context['character_set'], '" class="windowbg2">
+					<input type="text" name="copy" id="copy" value="', $context['new_theme_name'], '" size="40" class="input_text" />
+					<input type="submit" name="save" value="' . $txt['save'] . '" class="button_submit" />
+				</form>
+			</div>';
+	}
 
+	// From a dir.
 	echo '
-							<dt>
-								<label for="theme_dir">', $txt['theme_install_dir'], '</label>:
-							</dt>
-							<dd>
-								<input type="text" name="theme_dir" id="theme_dir" value="', $context['new_theme_dir'], '" size="40" style="width: 70%;" class="input_text" />
-							</dd>';
+			<br />
+			<div class="cat_bar">
+				<h3 class="catbg">
+					', $txt['theme_install_dir'], '
+				</h3>
+			</div>
+			<div class="content">
+				<form action="', $scripturl, '?action=admin;area=theme;sa=admin;do=dir" method="post" accept-charset="', $context['character_set'], '" class="windowbg2">
+					<input type="text" name="theme_dir" id="theme_dir" value="', $context['new_theme_dir'], '" size="40" style="width: 70%;" class="input_text" />
+					<input type="submit" name="save" value="' . $txt['save'] . '" class="button_submit" />
+				</form>
+			</div>';
 
-	if ($context['can_create_new'])
-		echo '
-							<dt>
-								<label for="copy">', $txt['theme_install_new'], ':</label>
-							</dt>
-							<dd>
-								<input type="text" name="copy" id="copy" value="', $context['new_theme_name'], '" size="40" class="input_text" />
-							</dd>';
+	echo '
+		</div>';
 
 	echo '
-						</dl>
-						<input type="submit" name="save" value="', $txt['theme_install_go'], '" class="button_submit" />
-						<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
-						<input type="hidden" name="', $context['admin-tl_token_var'], '" value="', $context['admin-tl_token'], '" />
-					</div>
-				</div>
-			</form>
-		</div>
-	</div>
+	</div>';
 
+	echo '
 	<script type="text/javascript"><!-- // --><![CDATA[
 		window.smfForum_scripturl = smf_scripturl;
 		window.smfForum_sessionid = smf_session_id;
 		window.smfForum_sessionvar = smf_session_var;
 		window.smfThemes_writable = ', $context['can_create_new'] ? 'true' : 'false', ';
 	// ]]></script>';
-
-	if (empty($modSettings['disable_smf_js']))
-		echo '
-		<script type="text/javascript" src="', $scripturl, '?action=viewsmfile;filename=latest-themes.js"></script>';
-
-	echo '
-		<script type="text/javascript"><!-- // --><![CDATA[
-			var tempOldOnload;
-			smfSetLatestThemes();
-		// ]]></script>';
 }
 
 function template_list_themes()