Skip to content

Commit

Permalink
Make sendTestMail globally accessible for some reason.
Browse files Browse the repository at this point in the history
  • Loading branch information
okonomiyaki3000 committed Nov 21, 2016
1 parent d8cffdb commit 62295dd
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 39 deletions.
80 changes: 42 additions & 38 deletions media/system/js/sendtestmail-uncompressed.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,49 +3,53 @@
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
jQuery(function ($)
{
var sendTestMail = function () {
'use strict';

/**
* Calls the sending process of the config class
*/
$('#sendtestmail').click(function () {
var email_data = {
smtpauth : $('input[name="jform[smtpauth]"]:checked').val(),
smtpuser : $('input[name="jform[smtpuser]"]').val(),
smtppass : $('input[name="jform[smtppass]"]').val(),
smtphost : $('input[name="jform[smtphost]"]').val(),
smtpsecure: $('select[name="jform[smtpsecure]"]').val(),
smtpport : $('input[name="jform[smtpport]"]').val(),
mailfrom : $('input[name="jform[mailfrom]"]').val(),
fromname : $('input[name="jform[fromname]"]').val(),
mailer : $('select[name="jform[mailer]"]').val(),
mailonline: $('input[name="jform[mailonline]"]:checked').val()
};
var email_data = {
smtpauth : $('input[name="jform[smtpauth]"]:checked').val(),
smtpuser : $('input[name="jform[smtpuser]"]').val(),
smtppass : $('input[name="jform[smtppass]"]').val(),
smtphost : $('input[name="jform[smtphost]"]').val(),
smtpsecure: $('select[name="jform[smtpsecure]"]').val(),
smtpport : $('input[name="jform[smtpport]"]').val(),
mailfrom : $('input[name="jform[mailfrom]"]').val(),
fromname : $('input[name="jform[fromname]"]').val(),
mailer : $('select[name="jform[mailer]"]').val(),
mailonline: $('input[name="jform[mailonline]"]:checked').val()
};

// Remove js messages, if they exist.
Joomla.removeMessages();
// Remove js messages, if they exist.
Joomla.removeMessages();

$.ajax({
method: "POST",
url: document.getElementById('sendtestmail').getAttribute('data-ajaxuri'),
data: email_data,
dataType: "json"
})
.fail(function (jqXHR, textStatus, error) {
Joomla.renderMessages(Joomla.ajaxErrorsMessages(jqXHR, textStatus, error));
$.ajax({
method: "POST",
url: document.getElementById('sendtestmail').getAttribute('data-ajaxuri'),
data: email_data,
dataType: "json"
})
.fail(function (jqXHR, textStatus, error) {
Joomla.renderMessages(Joomla.ajaxErrorsMessages(jqXHR, textStatus, error));

window.scrollTo(0, 0);
})
.done(function (response) {
// Render messages, if any.
if (typeof response.messages == 'object' && response.messages !== null)
{
Joomla.renderMessages(response.messages);
window.scrollTo(0, 0);
})
.done(function (response) {
// Render messages, if any.
if (typeof response.messages == 'object' && response.messages !== null)
{
Joomla.renderMessages(response.messages);

window.scrollTo(0, 0);
}
});
window.scrollTo(0, 0);
}
});
};

jQuery(function ($)
{
'use strict';

/**
* Calls the sending process of the config class
*/
$('#sendtestmail').click(sendTestMail);
});
2 changes: 1 addition & 1 deletion media/system/js/sendtestmail.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 62295dd

Please sign in to comment.