Browse Source

! AJAX PM preview now doesn't check the verification code (and works even on send2)
! Enable/disable behaviour of checkboxes in newsletter creation
! Removed a couple of debug leftovers
! Error box created empty in PM pages for AJAX preview (needs probably a change in the class)

emanuele 13 years ago
parent
commit
4f7f40d2ef

+ 0 - 1
Sources/ManageNews.php

@@ -282,7 +282,6 @@ function list_getNews()
 	);
 
 	return $admin_current_news;
-//	$context['sub_template'] = 'edit_news';
 }
 
 /**

+ 3 - 2
Sources/PersonalMessage.php

@@ -1938,6 +1938,7 @@ function messagePostError($error_types, $named_recipients, $recipient_ids = arra
 		'labels' => array(
 			'post_button' => $txt['send_message'],
 		),
+		'preview_type' => 2,
 	);
 	create_control_richedit($editorOptions);
 
@@ -1946,7 +1947,7 @@ function messagePostError($error_types, $named_recipients, $recipient_ids = arra
 
 	// Check whether we need to show the code again.
 	$context['require_verification'] = !$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'];
-	if ($context['require_verification'])
+	if ($context['require_verification'] && !isset($_REQUEST['xml']))
 	{
 		require_once($sourcedir . '/Subs-Editor.php');
 		$verificationOptions = array(
@@ -2146,7 +2147,7 @@ function MessagePost2()
 	}
 
 	// Wrong verification code?
-	if (!$user_info['is_admin'] && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'])
+	if (!$user_info['is_admin'] && !isset($_REQUEST['xml']) && !empty($modSettings['pm_posts_verification']) && $user_info['posts'] < $modSettings['pm_posts_verification'])
 	{
 		require_once($sourcedir . '/Subs-Editor.php');
 		$verificationOptions = array(

+ 15 - 2
Themes/default/ManageNews.template.php

@@ -206,8 +206,8 @@ function template_email_members_compose()
 						<textarea cols="70" rows="9" name="message" id="message" class="editor">', empty($context['message']) ? $context['default_message'] : $context['message'], '</textarea>
 					</p>
 					<ul class="reset">
-						<li><label for="send_pm"><input type="checkbox" name="send_pm" id="send_pm" ', !empty($context['send_pm']) ? 'checked="checked"' : '', 'class="input_check" onclick="if (this.checked && ', $context['total_emails'], ' != 0 && !confirm(\'', $txt['admin_news_cannot_pm_emails_js'], '\')) return false; this.form.parse_html.disabled = this.checked; this.form.send_html.disabled = this.checked; " /> ', $txt['email_as_pms'], '</label></li>
-						<li><label for="send_html"><input type="checkbox" name="send_html" id="send_html" ', !empty($context['send_html']) ? 'checked="checked"' : '', 'class="input_check" onclick="this.form.parse_html.disabled = !this.checked;" /> ', $txt['email_as_html'], '</label></li>
+						<li><label for="send_pm"><input type="checkbox" name="send_pm" id="send_pm" ', !empty($context['send_pm']) ? 'checked="checked"' : '', 'class="input_check" onclick="checkboxes_status(this);" /> ', $txt['email_as_pms'], '</label></li>
+						<li><label for="send_html"><input type="checkbox" name="send_html" id="send_html" ', !empty($context['send_html']) ? 'checked="checked"' : '', 'class="input_check" onclick="checkboxes_status(this);" /> ', $txt['email_as_html'], '</label></li>
 						<li><label for="parse_html"><input type="checkbox" name="parse_html" id="parse_html" checked="checked" disabled="disabled" class="input_check" /> ', $txt['email_parsed_html'], '</label></li>
 					</ul>
 					<p>
@@ -228,6 +228,19 @@ function template_email_members_compose()
 
 	echo '
 		<script type="text/javascript"><!-- // --><![CDATA[
+			function checkboxes_status (item)
+			{
+				if (item.id == \'send_html\')
+					document.getElementById(\'parse_html\').disabled = !document.getElementById(\'parse_html\').disabled;
+				if (item.id == \'send_pm\')
+				{
+					if (!document.getElementById(\'send_html\').checked)
+						document.getElementById(\'parse_html\').disabled = true;
+					else
+						document.getElementById(\'parse_html\').disabled = false;
+					document.getElementById(\'send_html\').disabled = !document.getElementById(\'send_html\').disabled;
+				}
+			}
 			function make_preview ()
 			{
 				$("#preview_box").css({display: \'\'});

+ 3 - 3
Themes/default/PersonalMessage.template.php

@@ -934,17 +934,17 @@ function template_send()
 		</div>';
 
 	echo '
-	<form action="', $scripturl, '?action=pm;sa=send2;preview;xml" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\']);">
+	<form action="', $scripturl, '?action=pm;sa=send2" method="post" accept-charset="', $context['character_set'], '" name="postmodify" id="postmodify" class="flow_hidden" onsubmit="submitonce(this);smc_saveEntities(\'postmodify\', [\'subject\', \'message\']);">
 		<div>
 			<span class="upperframe"><span></span></span>
 			<div class="roundframe"><br class="clear" />';
 
 	// If there were errors for sending the PM, show them.
 	echo '
-				<div class="errorbox"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
+				<div class="', empty($context['error_type']) || $context['error_type'] != 'serious' ? 'noticebox' : 'errorbox', '"', empty($context['post_error']['messages']) ? ' style="display: none"' : '', ' id="errors">
 					<dl>
 						<dt>
-							<strong>', $txt['error_while_submitting'], '</strong>
+							<strong id="error_serious">', $txt['error_while_submitting'] , '</strong>
 						</dt>
 						<dd class="error" id="error_list">
 							', empty($context['post_error']['messages']) ? '' : implode('<br />', $context['post_error']['messages']), '