mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-11-15 20:24:51 +08:00
be45d989f8
Fix idn encoder Small fixes
76 lines
1.3 KiB
JavaScript
76 lines
1.3 KiB
JavaScript
|
|
function RainLoopFormHelper(sID, sAjaxFile, fCallback)
|
|
{
|
|
try
|
|
{
|
|
var
|
|
oForm = $(sID),
|
|
oSubmit = $('#rainloop-save-button', oForm),
|
|
sSubmitValue = oSubmit.val(),
|
|
oDesc = oForm.find('.rainloop-result-desc')
|
|
;
|
|
|
|
oSubmit.click(function (oEvent) {
|
|
|
|
var oDefAjax = null;
|
|
|
|
oEvent.preventDefault();
|
|
|
|
oForm
|
|
.addClass('rainloop-ajax')
|
|
.removeClass('rainloop-error')
|
|
.removeClass('rainloop-success')
|
|
;
|
|
|
|
oDesc.text('');
|
|
oSubmit.val('...');
|
|
|
|
oDefAjax = $.ajax({
|
|
'type': 'POST',
|
|
'async': true,
|
|
'url': OC.filePath('rainloop', 'ajax', sAjaxFile),
|
|
'data': oForm.serialize(),
|
|
'dataType': 'json',
|
|
'global': true
|
|
});
|
|
|
|
oDefAjax.always(function (oData) {
|
|
|
|
var bResult = false;
|
|
|
|
oForm.removeClass('rainloop-ajax');
|
|
oSubmit.val(sSubmitValue);
|
|
|
|
if (oData)
|
|
{
|
|
bResult = 'success' === oData['status'];
|
|
if (oData['Message'])
|
|
{
|
|
oDesc.text(oData['Message']);
|
|
}
|
|
}
|
|
|
|
if (bResult)
|
|
{
|
|
oForm.addClass('rainloop-success');
|
|
}
|
|
else
|
|
{
|
|
oForm.addClass('rainloop-error');
|
|
if ('' === oDesc.text())
|
|
{
|
|
oDesc.text('Error');
|
|
}
|
|
}
|
|
|
|
if (fCallback)
|
|
{
|
|
fCallback(bResult, oData);
|
|
}
|
|
});
|
|
|
|
return false;
|
|
});
|
|
}
|
|
catch(e) {}
|
|
}
|