/*
* Copyright 2014 XWiki SAS
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see .
*/
require.config({
'shim': {
'bower/modalBox/modalBox-min': ['bower/jquery/dist/jquery.min'],
}
});
define([
'messages',
'bower/modalBox/modalBox-min'
], function (Messages) {
var STYLE = [
''
].join('');
var CONTENT = [
'
',
' ',
''
].join('');
var ERROR_ADDITIONAL = [
'',
'',
'',
].join('');
var showError = function (errorType, docHtml, moreInfo) {
$('body').append('');
var $modalbox = $('.modalBox')
$modalbox.append(CONTENT + STYLE);
$modalbox.find('.errorType').text(Messages['errorBox_errorType_' + errorType]);
$modalbox.find('.errorExplanation').text(Messages['errorBox_errorExplanation_' + errorType]);
if (moreInfo) {
$modalbox.append(ERROR_ADDITIONAL);
$modalbox.find('.errorMoreExplanation').text(Messages.errorBox_moreExplanation);
$modalbox.find('.errorData').text(Messages['errorBox_' + errorType]);
}
$modalbox.modalBox({
onClose: function () { $('.modalBox').remove(); }
});
$('.iw-modalOverlay').css({'z-index':10000});
};
return {
show: showError
};
});