Show users editing and lag, properly send message to indicate that all users have left channel and show basic error box if disconnected.
parent
5ae599fa07
commit
6cbdcdec65
@ -0,0 +1,91 @@
|
|||||||
|
/*
|
||||||
|
* 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 <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
require.config({
|
||||||
|
'shim': {
|
||||||
|
'bower/modalBox/modalBox-min': ['bower/jquery/dist/jquery.min'],
|
||||||
|
}
|
||||||
|
});
|
||||||
|
define([
|
||||||
|
'messages',
|
||||||
|
'bower/modalBox/modalBox-min'
|
||||||
|
], function (Messages) {
|
||||||
|
|
||||||
|
var STYLE = [
|
||||||
|
'<style>',
|
||||||
|
'.modalBox {',
|
||||||
|
' padding:5px;',
|
||||||
|
' border:1px solid #CCC;',
|
||||||
|
' background:#FFF;',
|
||||||
|
' height:500px;',
|
||||||
|
' width:700px;',
|
||||||
|
' display:none;',
|
||||||
|
'}',
|
||||||
|
'img.iw-closeImg {',
|
||||||
|
' width:24px;',
|
||||||
|
' height:24px',
|
||||||
|
'}',
|
||||||
|
'.modalFooter {',
|
||||||
|
' color:#FFF;',
|
||||||
|
' position:absolute;',
|
||||||
|
' bottom:0px',
|
||||||
|
'}',
|
||||||
|
'.modalFooter span {',
|
||||||
|
' cursor:pointer;',
|
||||||
|
'}',
|
||||||
|
'.iw-modalOverlay {',
|
||||||
|
' background:#000;',
|
||||||
|
' opacity:.5',
|
||||||
|
'}',
|
||||||
|
'</style>'
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
var CONTENT = [
|
||||||
|
'<center><h2 class="errorType"></h2></center>',
|
||||||
|
'<br>',
|
||||||
|
'<p class="errorExplanation"></p>'
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
var ERROR_ADDITIONAL = [
|
||||||
|
'<p class="errorMoreExplanation"></p>',
|
||||||
|
'<label for="errorBox_detailsBox" class="errorDetailsLabel"></label>',
|
||||||
|
'<textarea id="errorBox_detailsBox" class="errorData"></textarea>',
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
var showError = function (errorType, docHtml, moreInfo) {
|
||||||
|
$('body').append('<div class="modalBox"></div>');
|
||||||
|
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({
|
||||||
|
onOpen: boxOpened,
|
||||||
|
onClose: function () { $('.modalBox').remove(); }
|
||||||
|
});
|
||||||
|
$('.iw-modalOverlay').css({'z-index':10000});
|
||||||
|
};
|
||||||
|
|
||||||
|
return {
|
||||||
|
show: showError
|
||||||
|
};
|
||||||
|
});
|
@ -0,0 +1,33 @@
|
|||||||
|
define(function () {
|
||||||
|
var out = {};
|
||||||
|
|
||||||
|
out.errorBox_errorType_disconnected = 'Connection Lost';
|
||||||
|
out.errorBox_errorExplanation_disconnected = [
|
||||||
|
'Lost connection to server, you may reconnect by reloading the page or review your work ',
|
||||||
|
'by clicking outside of this box.'
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
out.editingAlone = 'Editing alone';
|
||||||
|
out.editingWithOneOtherPerson = 'Editing with one other person';
|
||||||
|
out.editingWith = 'Editing with';
|
||||||
|
out.otherPeople = 'other people';
|
||||||
|
out.disconnected = 'Disconnected';
|
||||||
|
out.lag = 'Lag';
|
||||||
|
|
||||||
|
out.initialState = [
|
||||||
|
'<p>',
|
||||||
|
'This is <strong>CryptPad</strong>, the zero knowledge realtime collaborative editor.',
|
||||||
|
'<br>',
|
||||||
|
'What you type here is encrypted so only people who have the link can access it.',
|
||||||
|
'<br>',
|
||||||
|
'Even the server cannot see what you type.',
|
||||||
|
'</p>',
|
||||||
|
'<p>',
|
||||||
|
'<small>',
|
||||||
|
'<i>What you see here, what you hear here, when you leave here, let it stay here</i>',
|
||||||
|
'</small>',
|
||||||
|
'</p>',
|
||||||
|
].join('');
|
||||||
|
|
||||||
|
return out;
|
||||||
|
});
|
Loading…
Reference in New Issue