Browse Source

Merge pull request #1208 from Arantor/release-2.1

! There's a few issues with the warn page if you happen to be a keyboard...
Arantor 10 years ago
parent
commit
aa02048046
3 changed files with 27 additions and 3 deletions
  1. 1 1
      Sources/Xml.php
  2. 2 2
      Themes/default/Profile.template.php
  3. 24 0
      Themes/default/Xml.template.php

+ 1 - 1
Sources/Xml.php

@@ -287,7 +287,7 @@ function warning_preview()
 	else
 		$context['post_error']['messages'][] = array('value' => $txt['cannot_issue_warning'], 'attributes' => array('type' => 'error'));
 
-	$context['sub_template'] = 'pm';
+	$context['sub_template'] = 'warning';
 }
 
 ?>

+ 2 - 2
Themes/default/Profile.template.php

@@ -2553,7 +2553,7 @@ function template_issueWarning()
 
 	echo '
 					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
-					<input type="submit" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
+					<input type="button" name="preview" id="preview_button" value="', $txt['preview'], '" class="button_submit" />
 					<input type="submit" name="save" value="', $context['user']['is_owner'] ? $txt['change_profile'] : $txt['profile_warning_issue'], '" class="button_submit" />
 				</div>
 			</div>
@@ -2592,7 +2592,7 @@ function template_issueWarning()
 					if ($(request).find("error").text() != \'\')
 					{
 						$("#profile_error").css({display:""});
-						var errors_html = \'<span>\' + $("#profile_error").find("span").html() + \'</span>\' + \'<ul class="list_errors" class="reset">\';
+						var errors_html = \'<ul class="list_errors" class="reset">\';
 						var errors = $(request).find(\'error\').each(function() {
 							errors_html += \'<li>\' + $(this).text() + \'</li>\';
 						});

+ 24 - 0
Themes/default/Xml.template.php

@@ -169,6 +169,30 @@ function template_pm()
 </smf>';
 }
 
+function template_warning()
+{
+	global $context, $txt;
+
+	// @todo something could be removed...otherwise it can be merged again with template_post
+	echo '<', '?xml version="1.0" encoding="', $context['character_set'], '"?', '>
+<smf>
+	<preview>
+		<subject><![CDATA[', $context['preview_subject'], ']]></subject>
+		<body><![CDATA[', $context['preview_message'], ']]></body>
+	</preview>
+	<errors serious="', empty($context['error_type']) || $context['error_type'] != 'serious' ? '0' : '1', '">';
+	if (!empty($context['post_error']['messages']))
+		foreach ($context['post_error']['messages'] as $message)
+			echo '
+		<error><![CDATA[', cleanXml($message), ']]></error>';
+
+	echo '
+	</errors>';
+
+	echo '
+</smf>';
+}
+
 function template_stats()
 {
 	global $context, $txt, $modSettings;