mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
CommonJS (research)
This commit is contained in:
parent
2fa2cd191e
commit
56607de87c
91 changed files with 20220 additions and 12933 deletions
10
dev/AdminBoot.js
Normal file
10
dev/AdminBoot.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
kn = require('./Knoin/Knoin.js'),
|
||||
RL = require('./Boots/AdminApp.js')
|
||||
;
|
||||
|
||||
kn.bootstart(RL);
|
||||
|
|
@ -1,5 +1,24 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
$ = require('../External/jquery.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
window = require('../External/window.js'),
|
||||
$html = require('../External/$html.js'),
|
||||
$window = require('../External/$window.js'),
|
||||
$doc = require('../External/$doc.js'),
|
||||
AppData = require('../External/AppData.js'),
|
||||
Globals = require('../Common/Globals.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
KnoinAbstractBoot = require('../Knoin/KnoinAbstractBoot.js'),
|
||||
RL = require('./RL.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractBoot
|
||||
|
|
@ -25,24 +44,25 @@ function AbstractApp()
|
|||
this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body');
|
||||
|
||||
$window.on('error', function (oEvent) {
|
||||
if (RL && oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
|
||||
if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
|
||||
-1 === Utils.inArray(oEvent.originalEvent.message, [
|
||||
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
|
||||
]))
|
||||
{
|
||||
// TODO cjs
|
||||
RL.remote().jsError(
|
||||
Utils.emptyFunction,
|
||||
oEvent.originalEvent.message,
|
||||
oEvent.originalEvent.filename,
|
||||
oEvent.originalEvent.lineno,
|
||||
location && location.toString ? location.toString() : '',
|
||||
window.location && window.location.toString ? window.location.toString() : '',
|
||||
$html.attr('class'),
|
||||
Utils.microtime() - Globals.now
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
$document.on('keydown', function (oEvent) {
|
||||
$doc.on('keydown', function (oEvent) {
|
||||
if (oEvent && oEvent.ctrlKey)
|
||||
{
|
||||
$html.addClass('rl-ctrl-key-pressed');
|
||||
|
|
@ -70,19 +90,19 @@ AbstractApp.prototype.oSubs = {};
|
|||
AbstractApp.prototype.download = function (sLink)
|
||||
{
|
||||
var
|
||||
oLink = null,
|
||||
oE = null,
|
||||
sUserAgent = navigator.userAgent.toLowerCase()
|
||||
oLink = null,
|
||||
sUserAgent = window.navigator.userAgent.toLowerCase()
|
||||
;
|
||||
|
||||
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
|
||||
{
|
||||
oLink = document.createElement('a');
|
||||
oLink = window.document.createElement('a');
|
||||
oLink['href'] = sLink;
|
||||
|
||||
if (document['createEvent'])
|
||||
if (window.document['createEvent'])
|
||||
{
|
||||
oE = document['createEvent']('MouseEvents');
|
||||
oE = window.document['createEvent']('MouseEvents');
|
||||
if (oE && oE['initEvent'] && oLink['dispatchEvent'])
|
||||
{
|
||||
oE['initEvent']('click', true, true);
|
||||
|
|
@ -113,7 +133,7 @@ AbstractApp.prototype.link = function ()
|
|||
{
|
||||
if (null === this.oLink)
|
||||
{
|
||||
this.oLink = new LinkBuilder();
|
||||
this.oLink = new LinkBuilder(); // TODO cjs
|
||||
}
|
||||
|
||||
return this.oLink;
|
||||
|
|
@ -126,7 +146,7 @@ AbstractApp.prototype.local = function ()
|
|||
{
|
||||
if (null === this.oLocal)
|
||||
{
|
||||
this.oLocal = new LocalStorage();
|
||||
this.oLocal = new LocalStorage(); // TODO cjs
|
||||
}
|
||||
|
||||
return this.oLocal;
|
||||
|
|
@ -163,7 +183,7 @@ AbstractApp.prototype.settingsSet = function (sName, mValue)
|
|||
AbstractApp.prototype.setTitle = function (sTitle)
|
||||
{
|
||||
sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
|
||||
RL.settingsGet('Title') || '';
|
||||
RL.settingsGet('Title') || ''; // TODO cjs
|
||||
|
||||
window.document.title = '_';
|
||||
window.document.title = sTitle;
|
||||
|
|
@ -180,6 +200,8 @@ AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
|
|||
bInIframe = !!RL.settingsGet('InIframe')
|
||||
;
|
||||
|
||||
// TODO cjs
|
||||
|
||||
bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
|
||||
bClose = Utils.isUnd(bClose) ? false : !!bClose;
|
||||
|
||||
|
|
@ -285,7 +307,7 @@ AbstractApp.prototype.capa = function (sName)
|
|||
|
||||
AbstractApp.prototype.bootstart = function ()
|
||||
{
|
||||
var self = this;
|
||||
var ssm = require('../External/ssm.js');
|
||||
|
||||
Utils.initOnStartOrLangChange(function () {
|
||||
Utils.initNotificationLanguage();
|
||||
|
|
@ -300,11 +322,11 @@ AbstractApp.prototype.bootstart = function ()
|
|||
'maxWidth': 767,
|
||||
'onEnter': function() {
|
||||
$html.addClass('ssm-state-mobile');
|
||||
self.pub('ssm.mobile-enter');
|
||||
RL.pub('ssm.mobile-enter');
|
||||
},
|
||||
'onLeave': function() {
|
||||
$html.removeClass('ssm-state-mobile');
|
||||
self.pub('ssm.mobile-leave');
|
||||
RL.pub('ssm.mobile-leave');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
@ -343,17 +365,21 @@ AbstractApp.prototype.bootstart = function ()
|
|||
}
|
||||
});
|
||||
|
||||
RL.sub('ssm.mobile-enter', function () {
|
||||
RL.sub('ssm.mobile-enter', function () { // TODO cjs
|
||||
RL.data().leftPanelDisabled(true);
|
||||
});
|
||||
|
||||
RL.sub('ssm.mobile-leave', function () {
|
||||
RL.sub('ssm.mobile-leave', function () { // TODO cjs
|
||||
RL.data().leftPanelDisabled(false);
|
||||
});
|
||||
|
||||
RL.data().leftPanelDisabled.subscribe(function (bValue) {
|
||||
RL.data().leftPanelDisabled.subscribe(function (bValue) { // TODO cjs
|
||||
$html.toggleClass('rl-left-panel-disabled', bValue);
|
||||
});
|
||||
|
||||
ssm.ready();
|
||||
};
|
||||
|
||||
module.exports = AbstractApp;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,19 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
window = require('../External/window.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
AbstractApp = require('./AbstractApp.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractApp
|
||||
|
|
@ -26,7 +40,7 @@ AdminApp.prototype.data = function ()
|
|||
{
|
||||
if (null === this.oData)
|
||||
{
|
||||
this.oData = new AdminDataStorage();
|
||||
this.oData = new AdminDataStorage(); // TODO cjs
|
||||
}
|
||||
|
||||
return this.oData;
|
||||
|
|
@ -39,7 +53,7 @@ AdminApp.prototype.remote = function ()
|
|||
{
|
||||
if (null === this.oRemote)
|
||||
{
|
||||
this.oRemote = new AdminAjaxRemoteStorage();
|
||||
this.oRemote = new AdminAjaxRemoteStorage(); // TODO cjs
|
||||
}
|
||||
|
||||
return this.oRemote;
|
||||
|
|
@ -52,7 +66,7 @@ AdminApp.prototype.cache = function ()
|
|||
{
|
||||
if (null === this.oCache)
|
||||
{
|
||||
this.oCache = new AdminCacheStorage();
|
||||
this.oCache = new AdminCacheStorage(); // TODO cjs
|
||||
}
|
||||
|
||||
return this.oCache;
|
||||
|
|
@ -60,6 +74,7 @@ AdminApp.prototype.cache = function ()
|
|||
|
||||
AdminApp.prototype.reloadDomainList = function ()
|
||||
{
|
||||
// TODO cjs
|
||||
RL.data().domainsLoading(true);
|
||||
RL.remote().domainList(function (sResult, oData) {
|
||||
RL.data().domainsLoading(false);
|
||||
|
|
@ -80,6 +95,7 @@ AdminApp.prototype.reloadDomainList = function ()
|
|||
|
||||
AdminApp.prototype.reloadPluginList = function ()
|
||||
{
|
||||
// TODO cjs
|
||||
RL.data().pluginsLoading(true);
|
||||
RL.remote().pluginList(function (sResult, oData) {
|
||||
RL.data().pluginsLoading(false);
|
||||
|
|
@ -100,6 +116,7 @@ AdminApp.prototype.reloadPluginList = function ()
|
|||
|
||||
AdminApp.prototype.reloadPackagesList = function ()
|
||||
{
|
||||
// TODO cjs
|
||||
RL.data().packagesLoading(true);
|
||||
RL.data().packagesReal(true);
|
||||
|
||||
|
|
@ -147,6 +164,7 @@ AdminApp.prototype.reloadPackagesList = function ()
|
|||
|
||||
AdminApp.prototype.updateCoreData = function ()
|
||||
{
|
||||
// TODO cjs
|
||||
var oRainData = RL.data();
|
||||
|
||||
oRainData.coreUpdating(true);
|
||||
|
|
@ -208,6 +226,7 @@ AdminApp.prototype.reloadLicensing = function (bForce)
|
|||
{
|
||||
bForce = Utils.isUnd(bForce) ? false : !!bForce;
|
||||
|
||||
// TODO cjs
|
||||
RL.data().licensingProcess(true);
|
||||
RL.data().licenseError('');
|
||||
|
||||
|
|
@ -296,7 +315,6 @@ AdminApp.prototype.bootstart = function ()
|
|||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {AdminApp}
|
||||
*/
|
||||
RL = new AdminApp();
|
||||
module.exports = new AdminApp();
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,22 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
$ = require('../External/jquery.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Globals = require('../Common/Globals.js'),
|
||||
Consts = require('../Common/Consts.js'),
|
||||
Plugins = require('../Common/Plugins.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
AbstractApp = require('./AbstractApp.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractApp
|
||||
|
|
@ -1287,7 +1304,6 @@ RainLoopApp.prototype.bootstart = function ()
|
|||
RL.pub('rl.bootstart-end');
|
||||
};
|
||||
|
||||
/**
|
||||
* @type {RainLoopApp}
|
||||
*/
|
||||
RL = new RainLoopApp();
|
||||
module.exports = new RainLoopApp();
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,8 +1,12 @@
|
|||
/*jslint bitwise: true*/
|
||||
// Base64 encode / decode
|
||||
// http://www.webtoolkit.info/
|
||||
|
||||
Base64 = {
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/*jslint bitwise: true*/
|
||||
var Base64 = {
|
||||
|
||||
// private property
|
||||
_keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
||||
|
|
@ -161,4 +165,7 @@ Base64 = {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = Base64;
|
||||
/*jslint bitwise: false*/
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,119 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
Consts.Defaults = {};
|
||||
Consts.Values = {};
|
||||
Consts.DataImages = {};
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPage = 20;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsPerPage = 50;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Array}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.DefaultAjaxTimeout = 30000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SearchAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SendMessageAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SaveMessageAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsSyncAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.UnuseOptionValue = '__UNUSE__';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.ClientSideCookieIndexName = 'rlcsc';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulPort = 143;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulSecurePort = 993;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulPort = 25;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulSecurePort = 465;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.MessageBodyCacheLimit = 15;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.AjaxErrorLimit = 7;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.TokenErrorLimit = 10;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
|
||||
129
dev/Common/Consts.js
Normal file
129
dev/Common/Consts.js
Normal file
|
|
@ -0,0 +1,129 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var Consts = {};
|
||||
|
||||
Consts.Values = {};
|
||||
Consts.DataImages = {};
|
||||
Consts.Defaults = {};
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPage = 20;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsPerPage = 50;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {Array}
|
||||
*/
|
||||
Consts.Defaults.MessagesPerPageArray = [10, 20, 30, 50, 100/*, 150, 200, 300*/];
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.DefaultAjaxTimeout = 30000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SearchAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SendMessageAjaxTimeout = 300000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.SaveMessageAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Defaults.ContactsSyncAjaxTimeout = 200000;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.UnuseOptionValue = '__UNUSE__';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.Values.ClientSideCookieIndexName = 'rlcsc';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulPort = 143;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.ImapDefaulSecurePort = 993;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulPort = 25;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.SmtpDefaulSecurePort = 465;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.MessageBodyCacheLimit = 15;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.AjaxErrorLimit = 7;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {number}
|
||||
*/
|
||||
Consts.Values.TokenErrorLimit = 10;
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.UserDotPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2P8DwQACgAD/il4QJ8AAAAASUVORK5CYII=';
|
||||
|
||||
/**
|
||||
* @const
|
||||
* @type {string}
|
||||
*/
|
||||
Consts.DataImages.TranspPic = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAC0lEQVQIW2NkAAIAAAoAAggA9GkAAAAASUVORK5CYII=';
|
||||
|
||||
module.exports = Consts;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,11 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var Enums = {};
|
||||
|
||||
/**
|
||||
* @enum {string}
|
||||
*/
|
||||
|
|
@ -428,3 +434,7 @@ Enums.Notification = {
|
|||
'UnknownNotification': 999,
|
||||
'UnknownError': 999
|
||||
};
|
||||
|
||||
module.exports = Enums;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,9 +1,20 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Globals = {},
|
||||
window = require('../External/window.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
$html = require('../External/$html.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
Globals.now = (new Date()).getTime();
|
||||
Globals.now = (new window.Date()).getTime();
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
|
|
@ -48,7 +59,7 @@ Globals.bUnload = false;
|
|||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
Globals.sUserAgent = (navigator.userAgent || '').toLowerCase();
|
||||
Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase();
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
|
|
@ -149,9 +160,25 @@ Globals.oHtmlEditorLangsMap = {
|
|||
'zh-cn': 'zh-cn'
|
||||
};
|
||||
|
||||
if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
|
||||
if (Globals.bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
|
||||
{
|
||||
Globals.bAllowPdfPreview = !!_.find(navigator.mimeTypes, function (oType) {
|
||||
Globals.bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
|
||||
return oType && 'application/pdf' === oType.type;
|
||||
});
|
||||
}
|
||||
|
||||
Globals.oI18N = {},
|
||||
|
||||
Globals.oNotificationI18N = {},
|
||||
|
||||
Globals.aBootstrapDropdowns = [],
|
||||
|
||||
Globals.aViewModels = {
|
||||
'settings': [],
|
||||
'settings-removed': [],
|
||||
'settings-disabled': []
|
||||
};
|
||||
|
||||
module.exports = Globals;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,846 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
ko.bindingHandlers.tooltip = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
sClass = $oEl.data('tooltip-class') || '',
|
||||
sPlacement = $oEl.data('tooltip-placement') || 'top'
|
||||
;
|
||||
|
||||
$oEl.tooltip({
|
||||
'delay': {
|
||||
'show': 500,
|
||||
'hide': 100
|
||||
},
|
||||
'html': true,
|
||||
'container': 'body',
|
||||
'placement': sPlacement,
|
||||
'trigger': 'hover',
|
||||
'title': function () {
|
||||
return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' : '<span class="tooltip-class ' + sClass + '">' +
|
||||
Utils.i18n(ko.utils.unwrapObservable(fValueAccessor())) + '</span>';
|
||||
}
|
||||
}).click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.tooltip2 = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
sClass = $oEl.data('tooltip-class') || '',
|
||||
sPlacement = $oEl.data('tooltip-placement') || 'top'
|
||||
;
|
||||
|
||||
$oEl.tooltip({
|
||||
'delay': {
|
||||
'show': 500,
|
||||
'hide': 100
|
||||
},
|
||||
'html': true,
|
||||
'container': 'body',
|
||||
'placement': sPlacement,
|
||||
'title': function () {
|
||||
return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' :
|
||||
'<span class="tooltip-class ' + sClass + '">' + fValueAccessor()() + '</span>';
|
||||
}
|
||||
}).click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.tooltip3 = {
|
||||
'init': function (oElement) {
|
||||
|
||||
var $oEl = $(oElement);
|
||||
|
||||
$oEl.tooltip({
|
||||
'container': 'body',
|
||||
'trigger': 'hover manual',
|
||||
'title': function () {
|
||||
return $oEl.data('tooltip3-data') || '';
|
||||
}
|
||||
});
|
||||
|
||||
$document.click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var sValue = ko.utils.unwrapObservable(fValueAccessor());
|
||||
if ('' === sValue)
|
||||
{
|
||||
$(oElement).data('tooltip3-data', '').tooltip('hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).data('tooltip3-data', sValue).tooltip('show');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.registrateBootstrapDropdown = {
|
||||
'init': function (oElement) {
|
||||
BootstrapDropdowns.push($(oElement));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.openDropdownTrigger = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (ko.utils.unwrapObservable(fValueAccessor()))
|
||||
{
|
||||
var $el = $(oElement);
|
||||
if (!$el.hasClass('open'))
|
||||
{
|
||||
$el.find('.dropdown-toggle').dropdown('toggle');
|
||||
Utils.detectDropdownVisibility();
|
||||
}
|
||||
|
||||
fValueAccessor()(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.dropdownCloser = {
|
||||
'init': function (oElement) {
|
||||
$(oElement).closest('.dropdown').on('click', '.e-item', function () {
|
||||
$(oElement).dropdown('toggle');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.popover = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
$(oElement).popover(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.csstext = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
|
||||
{
|
||||
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
|
||||
{
|
||||
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.resizecrop = {
|
||||
'init': function (oElement) {
|
||||
$(oElement).addClass('resizecrop').resizecrop({
|
||||
'width': '100',
|
||||
'height': '100',
|
||||
'wrapperCSS': {
|
||||
'border-radius': '10px'
|
||||
}
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
fValueAccessor()();
|
||||
$(oElement).resizecrop({
|
||||
'width': '100',
|
||||
'height': '100'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.onEnter = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
$(oElement).on('keypress', function (oEvent) {
|
||||
if (oEvent && 13 === window.parseInt(oEvent.keyCode, 10))
|
||||
{
|
||||
$(oElement).trigger('change');
|
||||
fValueAccessor().call(oViewModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.onEsc = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
$(oElement).on('keypress', function (oEvent) {
|
||||
if (oEvent && 27 === window.parseInt(oEvent.keyCode, 10))
|
||||
{
|
||||
$(oElement).trigger('change');
|
||||
fValueAccessor().call(oViewModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.clickOnTrue = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (ko.utils.unwrapObservable(fValueAccessor()))
|
||||
{
|
||||
$(oElement).click();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.modal = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
|
||||
$(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
|
||||
'keyboard': false,
|
||||
'show': ko.utils.unwrapObservable(fValueAccessor())
|
||||
})
|
||||
.on('shown', function () {
|
||||
Utils.windowResize();
|
||||
})
|
||||
.find('.close').click(function () {
|
||||
fValueAccessor()(false);
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).modal(ko.utils.unwrapObservable(fValueAccessor()) ? 'show' : 'hide');
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.i18nInit = {
|
||||
'init': function (oElement) {
|
||||
Utils.i18nToNode(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.i18nUpdate = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
ko.utils.unwrapObservable(fValueAccessor());
|
||||
Utils.i18nToNode(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.link = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).attr('href', ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.title = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).attr('title', ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.textF = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.initDom = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
fValueAccessor()(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.initResizeTrigger = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
var aValues = ko.utils.unwrapObservable(fValueAccessor());
|
||||
$(oElement).css({
|
||||
'height': aValues[1],
|
||||
'min-height': aValues[1]
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var
|
||||
aValues = ko.utils.unwrapObservable(fValueAccessor()),
|
||||
iValue = Utils.pInt(aValues[1]),
|
||||
iSize = 0,
|
||||
iOffset = $(oElement).offset().top
|
||||
;
|
||||
|
||||
if (0 < iOffset)
|
||||
{
|
||||
iOffset += Utils.pInt(aValues[2]);
|
||||
iSize = $window.height() - iOffset;
|
||||
|
||||
if (iValue < iSize)
|
||||
{
|
||||
iValue = iSize;
|
||||
}
|
||||
|
||||
$(oElement).css({
|
||||
'height': iValue,
|
||||
'min-height': iValue
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.appendDom = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).hide().empty().append(ko.utils.unwrapObservable(fValueAccessor())).show();
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.draggable = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
iTriggerZone = 100,
|
||||
iScrollSpeed = 3,
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
sDroppableSelector = fAllValueFunc && fAllValueFunc['droppableSelector'] ? fAllValueFunc['droppableSelector'] : '',
|
||||
oConf = {
|
||||
'distance': 20,
|
||||
'handle': '.dragHandle',
|
||||
'cursorAt': {'top': 22, 'left': 3},
|
||||
'refreshPositions': true,
|
||||
'scroll': true
|
||||
}
|
||||
;
|
||||
|
||||
if (sDroppableSelector)
|
||||
{
|
||||
oConf['drag'] = function (oEvent) {
|
||||
|
||||
$(sDroppableSelector).each(function () {
|
||||
var
|
||||
moveUp = null,
|
||||
moveDown = null,
|
||||
$this = $(this),
|
||||
oOffset = $this.offset(),
|
||||
bottomPos = oOffset.top + $this.height()
|
||||
;
|
||||
|
||||
window.clearInterval($this.data('timerScroll'));
|
||||
$this.data('timerScroll', false);
|
||||
|
||||
if (oEvent.pageX >= oOffset.left && oEvent.pageX <= oOffset.left + $this.width())
|
||||
{
|
||||
if (oEvent.pageY >= bottomPos - iTriggerZone && oEvent.pageY <= bottomPos)
|
||||
{
|
||||
moveUp = function() {
|
||||
$this.scrollTop($this.scrollTop() + iScrollSpeed);
|
||||
Utils.windowResize();
|
||||
};
|
||||
|
||||
$this.data('timerScroll', window.setInterval(moveUp, 10));
|
||||
moveUp();
|
||||
}
|
||||
|
||||
if (oEvent.pageY >= oOffset.top && oEvent.pageY <= oOffset.top + iTriggerZone)
|
||||
{
|
||||
moveDown = function() {
|
||||
$this.scrollTop($this.scrollTop() - iScrollSpeed);
|
||||
Utils.windowResize();
|
||||
};
|
||||
|
||||
$this.data('timerScroll', window.setInterval(moveDown, 10));
|
||||
moveDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
oConf['stop'] = function() {
|
||||
$(sDroppableSelector).each(function () {
|
||||
window.clearInterval($(this).data('timerScroll'));
|
||||
$(this).data('timerScroll', false);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
oConf['helper'] = function (oEvent) {
|
||||
return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null);
|
||||
};
|
||||
|
||||
$(oElement).draggable(oConf).on('mousedown', function () {
|
||||
Utils.removeInFocus();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.droppable = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
fValueFunc = fValueAccessor(),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fOverCallback = fAllValueFunc && fAllValueFunc['droppableOver'] ? fAllValueFunc['droppableOver'] : null,
|
||||
fOutCallback = fAllValueFunc && fAllValueFunc['droppableOut'] ? fAllValueFunc['droppableOut'] : null,
|
||||
oConf = {
|
||||
'tolerance': 'pointer',
|
||||
'hoverClass': 'droppableHover'
|
||||
}
|
||||
;
|
||||
|
||||
if (fValueFunc)
|
||||
{
|
||||
oConf['drop'] = function (oEvent, oUi) {
|
||||
fValueFunc(oEvent, oUi);
|
||||
};
|
||||
|
||||
if (fOverCallback)
|
||||
{
|
||||
oConf['over'] = function (oEvent, oUi) {
|
||||
fOverCallback(oEvent, oUi);
|
||||
};
|
||||
}
|
||||
|
||||
if (fOutCallback)
|
||||
{
|
||||
oConf['out'] = function (oEvent, oUi) {
|
||||
fOutCallback(oEvent, oUi);
|
||||
};
|
||||
}
|
||||
|
||||
$(oElement).droppable(oConf);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.nano = {
|
||||
'init': function (oElement) {
|
||||
if (!Globals.bDisableNanoScroll)
|
||||
{
|
||||
$(oElement)
|
||||
.addClass('nano')
|
||||
.nanoScroller({
|
||||
'iOSNativeScrolling': false,
|
||||
'preventPageScrolling': true
|
||||
})
|
||||
;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.saveTrigger = {
|
||||
'init': function (oElement) {
|
||||
|
||||
var $oEl = $(oElement);
|
||||
|
||||
$oEl.data('save-trigger-type', $oEl.is('input[type=text],input[type=email],input[type=password],select,textarea') ? 'input' : 'custom');
|
||||
|
||||
if ('custom' === $oEl.data('save-trigger-type'))
|
||||
{
|
||||
$oEl.append(
|
||||
' <i class="icon-spinner animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>'
|
||||
).addClass('settings-saved-trigger');
|
||||
}
|
||||
else
|
||||
{
|
||||
$oEl.addClass('settings-saved-trigger-input');
|
||||
}
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var
|
||||
mValue = ko.utils.unwrapObservable(fValueAccessor()),
|
||||
$oEl = $(oElement)
|
||||
;
|
||||
|
||||
if ('custom' === $oEl.data('save-trigger-type'))
|
||||
{
|
||||
switch (mValue.toString())
|
||||
{
|
||||
case '1':
|
||||
$oEl
|
||||
.find('.animated,.error').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.success').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case '0':
|
||||
$oEl
|
||||
.find('.animated,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.error').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case '-2':
|
||||
$oEl
|
||||
.find('.error,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.animated').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
default:
|
||||
$oEl
|
||||
.find('.animated').hide()
|
||||
.end()
|
||||
.find('.error,.success').removeClass('visible')
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (mValue.toString())
|
||||
{
|
||||
case '1':
|
||||
$oEl.addClass('success').removeClass('error');
|
||||
break;
|
||||
case '0':
|
||||
$oEl.addClass('error').removeClass('success');
|
||||
break;
|
||||
case '-2':
|
||||
// $oEl;
|
||||
break;
|
||||
default:
|
||||
$oEl.removeClass('error success');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.emailsTags = {
|
||||
'init': function(oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fValue = fValueAccessor(),
|
||||
fFocusCallback = function (bValue) {
|
||||
if (fValue && fValue.focusTrigger)
|
||||
{
|
||||
fValue.focusTrigger(bValue);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
$oEl.inputosaurus({
|
||||
'parseOnBlur': true,
|
||||
'allowDragAndDrop': true,
|
||||
'focusCallback': fFocusCallback,
|
||||
'inputDelimiters': [',', ';'],
|
||||
'autoCompleteSource': function (oData, fResponse) {
|
||||
RL.getAutocomplete(oData.term, function (aData) {
|
||||
fResponse(_.map(aData, function (oEmailItem) {
|
||||
return oEmailItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
},
|
||||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oEmail = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oEmail = new EmailModel();
|
||||
oEmail.mailsoParse(sValue);
|
||||
oEmail.clearDuplicateName();
|
||||
return [oEmail.toLine(false), oEmail];
|
||||
}
|
||||
|
||||
return [sValue, null];
|
||||
|
||||
});
|
||||
},
|
||||
'change': _.bind(function (oEvent) {
|
||||
$oEl.data('EmailsTagsValue', oEvent.target.value);
|
||||
fValue(oEvent.target.value);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fEmailsTagsFilter = fAllValueFunc['emailsTagsFilter'] || null,
|
||||
sValue = ko.utils.unwrapObservable(fValueAccessor())
|
||||
;
|
||||
|
||||
if ($oEl.data('EmailsTagsValue') !== sValue)
|
||||
{
|
||||
$oEl.val(sValue);
|
||||
$oEl.data('EmailsTagsValue', sValue);
|
||||
$oEl.inputosaurus('refresh');
|
||||
}
|
||||
|
||||
if (fEmailsTagsFilter && ko.utils.unwrapObservable(fEmailsTagsFilter))
|
||||
{
|
||||
$oEl.inputosaurus('focus');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.contactTags = {
|
||||
'init': function(oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fValue = fValueAccessor(),
|
||||
fFocusCallback = function (bValue) {
|
||||
if (fValue && fValue.focusTrigger)
|
||||
{
|
||||
fValue.focusTrigger(bValue);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
$oEl.inputosaurus({
|
||||
'parseOnBlur': true,
|
||||
'allowDragAndDrop': false,
|
||||
'focusCallback': fFocusCallback,
|
||||
'inputDelimiters': [',', ';'],
|
||||
'outputDelimiter': ',',
|
||||
'autoCompleteSource': function (oData, fResponse) {
|
||||
RL.getContactTagsAutocomplete(oData.term, function (aData) {
|
||||
fResponse(_.map(aData, function (oTagItem) {
|
||||
return oTagItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
},
|
||||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oTag = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oTag = new ContactTagModel();
|
||||
oTag.name(sValue);
|
||||
return [oTag.toLine(false), oTag];
|
||||
}
|
||||
|
||||
return [sValue, null];
|
||||
|
||||
});
|
||||
},
|
||||
'change': _.bind(function (oEvent) {
|
||||
$oEl.data('ContactTagsValue', oEvent.target.value);
|
||||
fValue(oEvent.target.value);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fContactTagsFilter = fAllValueFunc['contactTagsFilter'] || null,
|
||||
sValue = ko.utils.unwrapObservable(fValueAccessor())
|
||||
;
|
||||
|
||||
if ($oEl.data('ContactTagsValue') !== sValue)
|
||||
{
|
||||
$oEl.val(sValue);
|
||||
$oEl.data('ContactTagsValue', sValue);
|
||||
$oEl.inputosaurus('refresh');
|
||||
}
|
||||
|
||||
if (fContactTagsFilter && ko.utils.unwrapObservable(fContactTagsFilter))
|
||||
{
|
||||
$oEl.inputosaurus('focus');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.command = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
var
|
||||
jqElement = $(oElement),
|
||||
oCommand = fValueAccessor()
|
||||
;
|
||||
|
||||
if (!oCommand || !oCommand.enabled || !oCommand.canExecute)
|
||||
{
|
||||
throw new Error('You are not using command function');
|
||||
}
|
||||
|
||||
jqElement.addClass('command');
|
||||
ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click'].init.apply(oViewModel, arguments);
|
||||
},
|
||||
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
|
||||
var
|
||||
bResult = true,
|
||||
jqElement = $(oElement),
|
||||
oCommand = fValueAccessor()
|
||||
;
|
||||
|
||||
bResult = oCommand.enabled();
|
||||
jqElement.toggleClass('command-not-enabled', !bResult);
|
||||
|
||||
if (bResult)
|
||||
{
|
||||
bResult = oCommand.canExecute();
|
||||
jqElement.toggleClass('command-can-not-be-execute', !bResult);
|
||||
}
|
||||
|
||||
jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult);
|
||||
|
||||
if (jqElement.is('input') || jqElement.is('button'))
|
||||
{
|
||||
jqElement.prop('disabled', !bResult);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.extenders.trimmer = function (oTarget)
|
||||
{
|
||||
var oResult = ko.computed({
|
||||
'read': oTarget,
|
||||
'write': function (sNewValue) {
|
||||
oTarget(Utils.trim(sNewValue.toString()));
|
||||
},
|
||||
'owner': this
|
||||
});
|
||||
|
||||
oResult(oTarget());
|
||||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.posInterer = function (oTarget, iDefault)
|
||||
{
|
||||
var oResult = ko.computed({
|
||||
'read': oTarget,
|
||||
'write': function (sNewValue) {
|
||||
var iNew = Utils.pInt(sNewValue.toString(), iDefault);
|
||||
if (0 >= iNew)
|
||||
{
|
||||
iNew = iDefault;
|
||||
}
|
||||
|
||||
if (iNew === oTarget() && '' + iNew !== '' + sNewValue)
|
||||
{
|
||||
oTarget(iNew + 1);
|
||||
}
|
||||
|
||||
oTarget(iNew);
|
||||
}
|
||||
});
|
||||
|
||||
oResult(oTarget());
|
||||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.reversible = function (oTarget)
|
||||
{
|
||||
var mValue = oTarget();
|
||||
|
||||
oTarget.commit = function ()
|
||||
{
|
||||
mValue = oTarget();
|
||||
};
|
||||
|
||||
oTarget.reverse = function ()
|
||||
{
|
||||
oTarget(mValue);
|
||||
};
|
||||
|
||||
oTarget.commitedValue = function ()
|
||||
{
|
||||
return mValue;
|
||||
};
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.extenders.toggleSubscribe = function (oTarget, oOptions)
|
||||
{
|
||||
oTarget.subscribe(oOptions[1], oOptions[0], 'beforeChange');
|
||||
oTarget.subscribe(oOptions[2], oOptions[0]);
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.extenders.falseTimeout = function (oTarget, iOption)
|
||||
{
|
||||
oTarget.iTimeout = 0;
|
||||
oTarget.subscribe(function (bValue) {
|
||||
if (bValue)
|
||||
{
|
||||
window.clearTimeout(oTarget.iTimeout);
|
||||
oTarget.iTimeout = window.setTimeout(function () {
|
||||
oTarget(false);
|
||||
oTarget.iTimeout = 0;
|
||||
}, Utils.pInt(iOption));
|
||||
}
|
||||
});
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateNone = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
||||
this.subscribe(function (sValue) {
|
||||
sValue = Utils.trim(sValue);
|
||||
this.hasError('' !== sValue && !(/^[^@\s]+@[^@\s]+$/.test(sValue)));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateSimpleEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
||||
this.subscribe(function (sValue) {
|
||||
sValue = Utils.trim(sValue);
|
||||
this.hasError('' !== sValue && !(/^.+@.+$/.test(sValue)));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateFunc = function (fFunc)
|
||||
{
|
||||
this.hasFuncError = ko.observable(false);
|
||||
|
||||
if (Utils.isFunc(fFunc))
|
||||
{
|
||||
this.subscribe(function (sValue) {
|
||||
this.hasFuncError(!fFunc(sValue));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
Utils = require('./Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -313,3 +322,7 @@ LinkBuilder.prototype.socialFacebook = function ()
|
|||
{
|
||||
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||
};
|
||||
|
||||
module.exports = LinkBuilder;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,3 +1,13 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
Globals = require('./Globals.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
|
|
@ -154,7 +164,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
|
|||
|
||||
var
|
||||
oConfig = Globals.oHtmlEditorDefaultConfig,
|
||||
sLanguage = RL.settingsGet('Language'),
|
||||
sLanguage = RL.settingsGet('Language'), // TODO cjs
|
||||
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
|
||||
;
|
||||
|
||||
|
|
@ -258,3 +268,7 @@ NewHtmlEditorWrapper.prototype.clear = function (bFocus)
|
|||
this.setHtml('', bFocus);
|
||||
};
|
||||
|
||||
|
||||
module.exports = NewHtmlEditorWrapper;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Plugins = {},
|
||||
Utils = require('./Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
|
|
@ -61,7 +70,7 @@ Plugins.runHook = function (sName, aArguments)
|
|||
*/
|
||||
Plugins.mainSettingsGet = function (sName)
|
||||
{
|
||||
return RL ? RL.settingsGet(sName) : null;
|
||||
return RL ? RL.settingsGet(sName) : null; // TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -74,9 +83,9 @@ Plugins.mainSettingsGet = function (sName)
|
|||
*/
|
||||
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||
{
|
||||
if (RL)
|
||||
if (RL) // TODO cjs
|
||||
{
|
||||
RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
|
||||
RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions); // TODO cjs
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -92,4 +101,6 @@ Plugins.settingsGet = function (sPluginSection, sName)
|
|||
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
|
||||
};
|
||||
|
||||
module.exports = Plugins;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,19 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
$ = require('../External/jquery.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
key = require('../External/key.js'),
|
||||
|
||||
Enums = require('./Enums.js'),
|
||||
Utils = require('./Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {koProperty} oKoList
|
||||
|
|
@ -710,3 +724,7 @@ Selector.prototype.on = function (sEventName, fCallback)
|
|||
{
|
||||
this.oCallbacks[sEventName] = fCallback;
|
||||
};
|
||||
|
||||
module.exports = Selector;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,22 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Utils = {},
|
||||
$ = require('../External/jquery.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
window = require('../External/window.js'),
|
||||
$window = require('../External/$window.js'),
|
||||
$doc = require('../External/$doc.js'),
|
||||
NotificationClass = require('../External/NotificationClass.js'),
|
||||
Enums = require('./Enums.js'),
|
||||
Globals = require('./Globals.js')
|
||||
;
|
||||
|
||||
Utils.trim = $.trim;
|
||||
Utils.inArray = $.inArray;
|
||||
Utils.isArray = _.isArray;
|
||||
|
|
@ -322,7 +339,7 @@ Utils.audio = (function () {
|
|||
*/
|
||||
Utils.hos = function (oObject, sProp)
|
||||
{
|
||||
return oObject && Object.hasOwnProperty ? Object.hasOwnProperty.call(oObject, sProp) : false;
|
||||
return oObject && window.Object && window.Object.hasOwnProperty ? window.Object.hasOwnProperty.call(oObject, sProp) : false;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -335,7 +352,7 @@ Utils.i18n = function (sKey, oValueList, sDefaulValue)
|
|||
{
|
||||
var
|
||||
sValueName = '',
|
||||
sResult = Utils.isUnd(I18n[sKey]) ? (Utils.isUnd(sDefaulValue) ? sKey : sDefaulValue) : I18n[sKey]
|
||||
sResult = Utils.isUnd(Globals.oI18N[sKey]) ? (Utils.isUnd(sDefaulValue) ? sKey : sDefaulValue) : Globals.oI18N[sKey]
|
||||
;
|
||||
|
||||
if (!Utils.isUnd(oValueList) && !Utils.isNull(oValueList))
|
||||
|
|
@ -393,17 +410,18 @@ Utils.i18nToNode = function (oElement)
|
|||
});
|
||||
};
|
||||
|
||||
Utils.i18nToDoc = function ()
|
||||
Utils.i18nReload = function ()
|
||||
{
|
||||
if (window.rainloopI18N)
|
||||
if (window['rainloopI18N'])
|
||||
{
|
||||
I18n = window.rainloopI18N || {};
|
||||
Utils.i18nToNode($document);
|
||||
Globals.oI18N = window['rainloopI18N'] || {};
|
||||
|
||||
Utils.i18nToNode($doc);
|
||||
|
||||
Globals.langChangeTrigger(!Globals.langChangeTrigger());
|
||||
}
|
||||
|
||||
window.rainloopI18N = {};
|
||||
window['rainloopI18N'] = null;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -720,72 +738,73 @@ Utils.getNotification = function (iCode, mMessage)
|
|||
return mMessage;
|
||||
}
|
||||
|
||||
return Utils.isUnd(NotificationI18N[iCode]) ? '' : NotificationI18N[iCode];
|
||||
return Utils.isUnd(Globals.oNotificationI18N[iCode]) ? '' : Globals.oNotificationI18N[iCode];
|
||||
};
|
||||
|
||||
Utils.initNotificationLanguage = function ()
|
||||
{
|
||||
NotificationI18N[Enums.Notification.InvalidToken] = Utils.i18n('NOTIFICATIONS/INVALID_TOKEN');
|
||||
NotificationI18N[Enums.Notification.AuthError] = Utils.i18n('NOTIFICATIONS/AUTH_ERROR');
|
||||
NotificationI18N[Enums.Notification.AccessError] = Utils.i18n('NOTIFICATIONS/ACCESS_ERROR');
|
||||
NotificationI18N[Enums.Notification.ConnectionError] = Utils.i18n('NOTIFICATIONS/CONNECTION_ERROR');
|
||||
NotificationI18N[Enums.Notification.CaptchaError] = Utils.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
|
||||
NotificationI18N[Enums.Notification.SocialFacebookLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
|
||||
NotificationI18N[Enums.Notification.SocialTwitterLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
|
||||
NotificationI18N[Enums.Notification.SocialGoogleLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
|
||||
NotificationI18N[Enums.Notification.DomainNotAllowed] = Utils.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
|
||||
NotificationI18N[Enums.Notification.AccountNotAllowed] = Utils.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
|
||||
var oN = Globals.oNotificationI18N || {};
|
||||
oN[Enums.Notification.InvalidToken] = Utils.i18n('NOTIFICATIONS/INVALID_TOKEN');
|
||||
oN[Enums.Notification.AuthError] = Utils.i18n('NOTIFICATIONS/AUTH_ERROR');
|
||||
oN[Enums.Notification.AccessError] = Utils.i18n('NOTIFICATIONS/ACCESS_ERROR');
|
||||
oN[Enums.Notification.ConnectionError] = Utils.i18n('NOTIFICATIONS/CONNECTION_ERROR');
|
||||
oN[Enums.Notification.CaptchaError] = Utils.i18n('NOTIFICATIONS/CAPTCHA_ERROR');
|
||||
oN[Enums.Notification.SocialFacebookLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_FACEBOOK_LOGIN_ACCESS_DISABLE');
|
||||
oN[Enums.Notification.SocialTwitterLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_TWITTER_LOGIN_ACCESS_DISABLE');
|
||||
oN[Enums.Notification.SocialGoogleLoginAccessDisable] = Utils.i18n('NOTIFICATIONS/SOCIAL_GOOGLE_LOGIN_ACCESS_DISABLE');
|
||||
oN[Enums.Notification.DomainNotAllowed] = Utils.i18n('NOTIFICATIONS/DOMAIN_NOT_ALLOWED');
|
||||
oN[Enums.Notification.AccountNotAllowed] = Utils.i18n('NOTIFICATIONS/ACCOUNT_NOT_ALLOWED');
|
||||
|
||||
NotificationI18N[Enums.Notification.AccountTwoFactorAuthRequired] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
|
||||
NotificationI18N[Enums.Notification.AccountTwoFactorAuthError] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
|
||||
oN[Enums.Notification.AccountTwoFactorAuthRequired] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_REQUIRED');
|
||||
oN[Enums.Notification.AccountTwoFactorAuthError] = Utils.i18n('NOTIFICATIONS/ACCOUNT_TWO_FACTOR_AUTH_ERROR');
|
||||
|
||||
NotificationI18N[Enums.Notification.CouldNotSaveNewPassword] = Utils.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
|
||||
NotificationI18N[Enums.Notification.CurrentPasswordIncorrect] = Utils.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
|
||||
NotificationI18N[Enums.Notification.NewPasswordShort] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
|
||||
NotificationI18N[Enums.Notification.NewPasswordWeak] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
|
||||
NotificationI18N[Enums.Notification.NewPasswordForbidden] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
|
||||
oN[Enums.Notification.CouldNotSaveNewPassword] = Utils.i18n('NOTIFICATIONS/COULD_NOT_SAVE_NEW_PASSWORD');
|
||||
oN[Enums.Notification.CurrentPasswordIncorrect] = Utils.i18n('NOTIFICATIONS/CURRENT_PASSWORD_INCORRECT');
|
||||
oN[Enums.Notification.NewPasswordShort] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_SHORT');
|
||||
oN[Enums.Notification.NewPasswordWeak] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_WEAK');
|
||||
oN[Enums.Notification.NewPasswordForbidden] = Utils.i18n('NOTIFICATIONS/NEW_PASSWORD_FORBIDDENT');
|
||||
|
||||
NotificationI18N[Enums.Notification.ContactsSyncError] = Utils.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
|
||||
oN[Enums.Notification.ContactsSyncError] = Utils.i18n('NOTIFICATIONS/CONTACTS_SYNC_ERROR');
|
||||
|
||||
NotificationI18N[Enums.Notification.CantGetMessageList] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
|
||||
NotificationI18N[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
|
||||
NotificationI18N[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
|
||||
NotificationI18N[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
|
||||
NotificationI18N[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
|
||||
oN[Enums.Notification.CantGetMessageList] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE_LIST');
|
||||
oN[Enums.Notification.CantGetMessage] = Utils.i18n('NOTIFICATIONS/CANT_GET_MESSAGE');
|
||||
oN[Enums.Notification.CantDeleteMessage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_MESSAGE');
|
||||
oN[Enums.Notification.CantMoveMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
|
||||
oN[Enums.Notification.CantCopyMessage] = Utils.i18n('NOTIFICATIONS/CANT_MOVE_MESSAGE');
|
||||
|
||||
NotificationI18N[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
|
||||
NotificationI18N[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
|
||||
NotificationI18N[Enums.Notification.InvalidRecipients] = Utils.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
|
||||
oN[Enums.Notification.CantSaveMessage] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_MESSAGE');
|
||||
oN[Enums.Notification.CantSendMessage] = Utils.i18n('NOTIFICATIONS/CANT_SEND_MESSAGE');
|
||||
oN[Enums.Notification.InvalidRecipients] = Utils.i18n('NOTIFICATIONS/INVALID_RECIPIENTS');
|
||||
|
||||
NotificationI18N[Enums.Notification.CantCreateFolder] = Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
|
||||
NotificationI18N[Enums.Notification.CantRenameFolder] = Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
|
||||
NotificationI18N[Enums.Notification.CantDeleteFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
|
||||
NotificationI18N[Enums.Notification.CantDeleteNonEmptyFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
|
||||
NotificationI18N[Enums.Notification.CantSubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
|
||||
NotificationI18N[Enums.Notification.CantUnsubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
|
||||
oN[Enums.Notification.CantCreateFolder] = Utils.i18n('NOTIFICATIONS/CANT_CREATE_FOLDER');
|
||||
oN[Enums.Notification.CantRenameFolder] = Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER');
|
||||
oN[Enums.Notification.CantDeleteFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER');
|
||||
oN[Enums.Notification.CantDeleteNonEmptyFolder] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_NON_EMPTY_FOLDER');
|
||||
oN[Enums.Notification.CantSubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_SUBSCRIBE_FOLDER');
|
||||
oN[Enums.Notification.CantUnsubscribeFolder] = Utils.i18n('NOTIFICATIONS/CANT_UNSUBSCRIBE_FOLDER');
|
||||
|
||||
NotificationI18N[Enums.Notification.CantSaveSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
|
||||
NotificationI18N[Enums.Notification.CantSavePluginSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
|
||||
oN[Enums.Notification.CantSaveSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_SETTINGS');
|
||||
oN[Enums.Notification.CantSavePluginSettings] = Utils.i18n('NOTIFICATIONS/CANT_SAVE_PLUGIN_SETTINGS');
|
||||
|
||||
NotificationI18N[Enums.Notification.DomainAlreadyExists] = Utils.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
|
||||
oN[Enums.Notification.DomainAlreadyExists] = Utils.i18n('NOTIFICATIONS/DOMAIN_ALREADY_EXISTS');
|
||||
|
||||
NotificationI18N[Enums.Notification.CantInstallPackage] = Utils.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
|
||||
NotificationI18N[Enums.Notification.CantDeletePackage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
|
||||
NotificationI18N[Enums.Notification.InvalidPluginPackage] = Utils.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
|
||||
NotificationI18N[Enums.Notification.UnsupportedPluginPackage] = Utils.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
|
||||
oN[Enums.Notification.CantInstallPackage] = Utils.i18n('NOTIFICATIONS/CANT_INSTALL_PACKAGE');
|
||||
oN[Enums.Notification.CantDeletePackage] = Utils.i18n('NOTIFICATIONS/CANT_DELETE_PACKAGE');
|
||||
oN[Enums.Notification.InvalidPluginPackage] = Utils.i18n('NOTIFICATIONS/INVALID_PLUGIN_PACKAGE');
|
||||
oN[Enums.Notification.UnsupportedPluginPackage] = Utils.i18n('NOTIFICATIONS/UNSUPPORTED_PLUGIN_PACKAGE');
|
||||
|
||||
NotificationI18N[Enums.Notification.LicensingServerIsUnavailable] = Utils.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
|
||||
NotificationI18N[Enums.Notification.LicensingExpired] = Utils.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
|
||||
NotificationI18N[Enums.Notification.LicensingBanned] = Utils.i18n('NOTIFICATIONS/LICENSING_BANNED');
|
||||
oN[Enums.Notification.LicensingServerIsUnavailable] = Utils.i18n('NOTIFICATIONS/LICENSING_SERVER_IS_UNAVAILABLE');
|
||||
oN[Enums.Notification.LicensingExpired] = Utils.i18n('NOTIFICATIONS/LICENSING_EXPIRED');
|
||||
oN[Enums.Notification.LicensingBanned] = Utils.i18n('NOTIFICATIONS/LICENSING_BANNED');
|
||||
|
||||
NotificationI18N[Enums.Notification.DemoSendMessageError] = Utils.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
|
||||
oN[Enums.Notification.DemoSendMessageError] = Utils.i18n('NOTIFICATIONS/DEMO_SEND_MESSAGE_ERROR');
|
||||
|
||||
NotificationI18N[Enums.Notification.AccountAlreadyExists] = Utils.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
|
||||
oN[Enums.Notification.AccountAlreadyExists] = Utils.i18n('NOTIFICATIONS/ACCOUNT_ALREADY_EXISTS');
|
||||
|
||||
NotificationI18N[Enums.Notification.MailServerError] = Utils.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
|
||||
NotificationI18N[Enums.Notification.InvalidInputArgument] = Utils.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
|
||||
NotificationI18N[Enums.Notification.UnknownNotification] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
|
||||
NotificationI18N[Enums.Notification.UnknownError] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
|
||||
oN[Enums.Notification.MailServerError] = Utils.i18n('NOTIFICATIONS/MAIL_SERVER_ERROR');
|
||||
oN[Enums.Notification.InvalidInputArgument] = Utils.i18n('NOTIFICATIONS/INVALID_INPUT_ARGUMENT');
|
||||
oN[Enums.Notification.UnknownNotification] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
|
||||
oN[Enums.Notification.UnknownError] = Utils.i18n('NOTIFICATIONS/UNKNOWN_ERROR');
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1418,7 +1437,7 @@ Utils.addSettingsViewModel = function (SettingsViewModelClass, sTemplate, sLabel
|
|||
'IsDefault': !!bDefault
|
||||
};
|
||||
|
||||
ViewModels['settings'].push(SettingsViewModelClass);
|
||||
Globals.aViewModels['settings'].push(SettingsViewModelClass);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1426,7 +1445,7 @@ Utils.addSettingsViewModel = function (SettingsViewModelClass, sTemplate, sLabel
|
|||
*/
|
||||
Utils.removeSettingsViewModel = function (SettingsViewModelClass)
|
||||
{
|
||||
ViewModels['settings-removed'].push(SettingsViewModelClass);
|
||||
Globals.aViewModels['settings-removed'].push(SettingsViewModelClass);
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -1434,7 +1453,7 @@ Utils.removeSettingsViewModel = function (SettingsViewModelClass)
|
|||
*/
|
||||
Utils.disableSettingsViewModel = function (SettingsViewModelClass)
|
||||
{
|
||||
ViewModels['settings-disabled'].push(SettingsViewModelClass);
|
||||
Globals.aViewModels['settings-disabled'].push(SettingsViewModelClass);
|
||||
};
|
||||
|
||||
Utils.convertThemeName = function (sTheme)
|
||||
|
|
@ -2061,7 +2080,7 @@ Utils.restoreKeyFilter = function ()
|
|||
};
|
||||
|
||||
Utils.detectDropdownVisibility = _.debounce(function () {
|
||||
Globals.dropdownVisibility(!!_.find(BootstrapDropdowns, function (oItem) {
|
||||
Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) {
|
||||
return oItem.hasClass('open');
|
||||
}));
|
||||
}, 50);
|
||||
|
|
@ -2082,4 +2101,6 @@ Utils.triggerAutocompleteInputChange = function (bDelay) {
|
|||
}
|
||||
};
|
||||
|
||||
module.exports = Utils;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,78 +0,0 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Consts = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Enums = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
NotificationI18N = {},
|
||||
|
||||
/**
|
||||
* @type {Object.<Function>}
|
||||
*/
|
||||
Utils = {},
|
||||
|
||||
/**
|
||||
* @type {Object.<Function>}
|
||||
*/
|
||||
Plugins = {},
|
||||
|
||||
/**
|
||||
* @type {Object.<Function>}
|
||||
*/
|
||||
Base64 = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
Globals = {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
ViewModels = {
|
||||
'settings': [],
|
||||
'settings-removed': [],
|
||||
'settings-disabled': []
|
||||
},
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
BootstrapDropdowns = [],
|
||||
|
||||
/**
|
||||
* @type {*}
|
||||
*/
|
||||
kn = null,
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
AppData = window['rainloopAppData'] || {},
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
I18n = window['rainloopI18N'] || {},
|
||||
|
||||
$html = $('html'),
|
||||
|
||||
// $body = $('body'),
|
||||
|
||||
$window = $(window),
|
||||
|
||||
$document = $(window.document),
|
||||
|
||||
NotificationClass = window.Notification && window.Notification.requestPermission ? window.Notification : null
|
||||
;
|
||||
|
|
@ -1,8 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/*jshint onevar: false*/
|
||||
/**
|
||||
* @type {?AdminApp}
|
||||
*/
|
||||
var RL = null;
|
||||
/*jshint onevar: true*/
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/*jshint onevar: false*/
|
||||
/**
|
||||
* @type {?RainLoopApp}
|
||||
*/
|
||||
var
|
||||
RL = null,
|
||||
|
||||
$proxyDiv = $('<div></div>')
|
||||
;
|
||||
/*jshint onevar: true*/
|
||||
|
|
@ -1,52 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
|
||||
|
||||
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
|
||||
$window.unload(function () {
|
||||
Globals.bUnload = true;
|
||||
});
|
||||
|
||||
$html.on('click.dropdown.data-api', function () {
|
||||
Utils.detectDropdownVisibility();
|
||||
});
|
||||
|
||||
// export
|
||||
window['rl'] = window['rl'] || {};
|
||||
window['rl']['addHook'] = Plugins.addHook;
|
||||
window['rl']['settingsGet'] = Plugins.mainSettingsGet;
|
||||
window['rl']['remoteRequest'] = Plugins.remoteRequest;
|
||||
window['rl']['pluginSettingsGet'] = Plugins.settingsGet;
|
||||
window['rl']['addSettingsViewModel'] = Utils.addSettingsViewModel;
|
||||
window['rl']['createCommand'] = Utils.createCommand;
|
||||
|
||||
window['rl']['EmailModel'] = EmailModel;
|
||||
window['rl']['Enums'] = Enums;
|
||||
|
||||
window['__RLBOOT'] = function (fCall) {
|
||||
|
||||
// boot
|
||||
$(function () {
|
||||
|
||||
if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
|
||||
{
|
||||
$('#rl-templates').html(window['rainloopTEMPLATES'][0]);
|
||||
|
||||
_.delay(function () {
|
||||
window['rainloopAppData'] = {};
|
||||
window['rainloopI18N'] = {};
|
||||
window['rainloopTEMPLATES'] = {};
|
||||
|
||||
kn.setBoot(RL).bootstart();
|
||||
$html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
|
||||
|
||||
}, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
fCall(false);
|
||||
}
|
||||
|
||||
window['__RLBOOT'] = null;
|
||||
});
|
||||
};
|
||||
5
dev/External/$div.js
vendored
Normal file
5
dev/External/$div.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./jquery.js')('<div></div>');
|
||||
5
dev/External/$doc.js
vendored
Normal file
5
dev/External/$doc.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./jquery.js')(window.document);
|
||||
5
dev/External/$html.js
vendored
Normal file
5
dev/External/$html.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./jquery.js')('html');
|
||||
5
dev/External/$window.js
vendored
Normal file
5
dev/External/$window.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./jquery.js')(window);
|
||||
5
dev/External/AppData.js
vendored
Normal file
5
dev/External/AppData.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./window.js')['rainloopAppData'] || {};
|
||||
5
dev/External/JSON.js
vendored
Normal file
5
dev/External/JSON.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = JSON;
|
||||
9
dev/External/NotificationClass.js
vendored
Normal file
9
dev/External/NotificationClass.js
vendored
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('./window.js')
|
||||
;
|
||||
|
||||
module.exports = window.Notification && window.Notification.requestPermission ? window.Notification : null;
|
||||
5
dev/External/crossroads.js
vendored
Normal file
5
dev/External/crossroads.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = crossroads;
|
||||
5
dev/External/hasher.js
vendored
Normal file
5
dev/External/hasher.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = hasher;
|
||||
5
dev/External/jquery.js
vendored
Normal file
5
dev/External/jquery.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = $;
|
||||
5
dev/External/key.js
vendored
Normal file
5
dev/External/key.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = key;
|
||||
864
dev/External/ko.js
vendored
Normal file
864
dev/External/ko.js
vendored
Normal file
|
|
@ -0,0 +1,864 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
$ = require('./jquery.js'),
|
||||
_ = require('./underscore.js'),
|
||||
window = require('./window.js'),
|
||||
$window = require('./$window.js'),
|
||||
$doc = require('./$doc.js'),
|
||||
Globals = require('../Common/Globals.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
ko.bindingHandlers.tooltip = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
sClass = $oEl.data('tooltip-class') || '',
|
||||
sPlacement = $oEl.data('tooltip-placement') || 'top'
|
||||
;
|
||||
|
||||
$oEl.tooltip({
|
||||
'delay': {
|
||||
'show': 500,
|
||||
'hide': 100
|
||||
},
|
||||
'html': true,
|
||||
'container': 'body',
|
||||
'placement': sPlacement,
|
||||
'trigger': 'hover',
|
||||
'title': function () {
|
||||
return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' : '<span class="tooltip-class ' + sClass + '">' +
|
||||
Utils.i18n(ko.utils.unwrapObservable(fValueAccessor())) + '</span>';
|
||||
}
|
||||
}).click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.tooltip2 = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
sClass = $oEl.data('tooltip-class') || '',
|
||||
sPlacement = $oEl.data('tooltip-placement') || 'top'
|
||||
;
|
||||
|
||||
$oEl.tooltip({
|
||||
'delay': {
|
||||
'show': 500,
|
||||
'hide': 100
|
||||
},
|
||||
'html': true,
|
||||
'container': 'body',
|
||||
'placement': sPlacement,
|
||||
'title': function () {
|
||||
return $oEl.is('.disabled') || Globals.dropdownVisibility() ? '' :
|
||||
'<span class="tooltip-class ' + sClass + '">' + fValueAccessor()() + '</span>';
|
||||
}
|
||||
}).click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.tooltip3 = {
|
||||
'init': function (oElement) {
|
||||
|
||||
var $oEl = $(oElement);
|
||||
|
||||
$oEl.tooltip({
|
||||
'container': 'body',
|
||||
'trigger': 'hover manual',
|
||||
'title': function () {
|
||||
return $oEl.data('tooltip3-data') || '';
|
||||
}
|
||||
});
|
||||
|
||||
$doc.click(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
|
||||
Globals.tooltipTrigger.subscribe(function () {
|
||||
$oEl.tooltip('hide');
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var sValue = ko.utils.unwrapObservable(fValueAccessor());
|
||||
if ('' === sValue)
|
||||
{
|
||||
$(oElement).data('tooltip3-data', '').tooltip('hide');
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).data('tooltip3-data', sValue).tooltip('show');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.registrateBootstrapDropdown = {
|
||||
'init': function (oElement) {
|
||||
Globals.aBootstrapDropdowns.push($(oElement));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.openDropdownTrigger = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (ko.utils.unwrapObservable(fValueAccessor()))
|
||||
{
|
||||
var $el = $(oElement);
|
||||
if (!$el.hasClass('open'))
|
||||
{
|
||||
$el.find('.dropdown-toggle').dropdown('toggle');
|
||||
Utils.detectDropdownVisibility();
|
||||
}
|
||||
|
||||
fValueAccessor()(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.dropdownCloser = {
|
||||
'init': function (oElement) {
|
||||
$(oElement).closest('.dropdown').on('click', '.e-item', function () {
|
||||
$(oElement).dropdown('toggle');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.popover = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
$(oElement).popover(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.csstext = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
|
||||
{
|
||||
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
|
||||
{
|
||||
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
|
||||
}
|
||||
else
|
||||
{
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.resizecrop = {
|
||||
'init': function (oElement) {
|
||||
$(oElement).addClass('resizecrop').resizecrop({
|
||||
'width': '100',
|
||||
'height': '100',
|
||||
'wrapperCSS': {
|
||||
'border-radius': '10px'
|
||||
}
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
fValueAccessor()();
|
||||
$(oElement).resizecrop({
|
||||
'width': '100',
|
||||
'height': '100'
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.onEnter = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
$(oElement).on('keypress', function (oEvent) {
|
||||
if (oEvent && 13 === window.parseInt(oEvent.keyCode, 10))
|
||||
{
|
||||
$(oElement).trigger('change');
|
||||
fValueAccessor().call(oViewModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.onEsc = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
$(oElement).on('keypress', function (oEvent) {
|
||||
if (oEvent && 27 === window.parseInt(oEvent.keyCode, 10))
|
||||
{
|
||||
$(oElement).trigger('change');
|
||||
fValueAccessor().call(oViewModel);
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.clickOnTrue = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
if (ko.utils.unwrapObservable(fValueAccessor()))
|
||||
{
|
||||
$(oElement).click();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.modal = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
|
||||
$(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
|
||||
'keyboard': false,
|
||||
'show': ko.utils.unwrapObservable(fValueAccessor())
|
||||
})
|
||||
.on('shown', function () {
|
||||
Utils.windowResize();
|
||||
})
|
||||
.find('.close').click(function () {
|
||||
fValueAccessor()(false);
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).modal(ko.utils.unwrapObservable(fValueAccessor()) ? 'show' : 'hide');
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.i18nInit = {
|
||||
'init': function (oElement) {
|
||||
Utils.i18nToNode(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.i18nUpdate = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
ko.utils.unwrapObservable(fValueAccessor());
|
||||
Utils.i18nToNode(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.link = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).attr('href', ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.title = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).attr('title', ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.textF = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
$(oElement).text(ko.utils.unwrapObservable(fValueAccessor()));
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.initDom = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
fValueAccessor()(oElement);
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.initResizeTrigger = {
|
||||
'init': function (oElement, fValueAccessor) {
|
||||
var aValues = ko.utils.unwrapObservable(fValueAccessor());
|
||||
$(oElement).css({
|
||||
'height': aValues[1],
|
||||
'min-height': aValues[1]
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var
|
||||
aValues = ko.utils.unwrapObservable(fValueAccessor()),
|
||||
iValue = Utils.pInt(aValues[1]),
|
||||
iSize = 0,
|
||||
iOffset = $(oElement).offset().top
|
||||
;
|
||||
|
||||
if (0 < iOffset)
|
||||
{
|
||||
iOffset += Utils.pInt(aValues[2]);
|
||||
iSize = $window.height() - iOffset;
|
||||
|
||||
if (iValue < iSize)
|
||||
{
|
||||
iValue = iSize;
|
||||
}
|
||||
|
||||
$(oElement).css({
|
||||
'height': iValue,
|
||||
'min-height': iValue
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.appendDom = {
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
$(oElement).hide().empty().append(ko.utils.unwrapObservable(fValueAccessor())).show();
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.draggable = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
iTriggerZone = 100,
|
||||
iScrollSpeed = 3,
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
sDroppableSelector = fAllValueFunc && fAllValueFunc['droppableSelector'] ? fAllValueFunc['droppableSelector'] : '',
|
||||
oConf = {
|
||||
'distance': 20,
|
||||
'handle': '.dragHandle',
|
||||
'cursorAt': {'top': 22, 'left': 3},
|
||||
'refreshPositions': true,
|
||||
'scroll': true
|
||||
}
|
||||
;
|
||||
|
||||
if (sDroppableSelector)
|
||||
{
|
||||
oConf['drag'] = function (oEvent) {
|
||||
|
||||
$(sDroppableSelector).each(function () {
|
||||
var
|
||||
moveUp = null,
|
||||
moveDown = null,
|
||||
$this = $(this),
|
||||
oOffset = $this.offset(),
|
||||
bottomPos = oOffset.top + $this.height()
|
||||
;
|
||||
|
||||
window.clearInterval($this.data('timerScroll'));
|
||||
$this.data('timerScroll', false);
|
||||
|
||||
if (oEvent.pageX >= oOffset.left && oEvent.pageX <= oOffset.left + $this.width())
|
||||
{
|
||||
if (oEvent.pageY >= bottomPos - iTriggerZone && oEvent.pageY <= bottomPos)
|
||||
{
|
||||
moveUp = function() {
|
||||
$this.scrollTop($this.scrollTop() + iScrollSpeed);
|
||||
Utils.windowResize();
|
||||
};
|
||||
|
||||
$this.data('timerScroll', window.setInterval(moveUp, 10));
|
||||
moveUp();
|
||||
}
|
||||
|
||||
if (oEvent.pageY >= oOffset.top && oEvent.pageY <= oOffset.top + iTriggerZone)
|
||||
{
|
||||
moveDown = function() {
|
||||
$this.scrollTop($this.scrollTop() - iScrollSpeed);
|
||||
Utils.windowResize();
|
||||
};
|
||||
|
||||
$this.data('timerScroll', window.setInterval(moveDown, 10));
|
||||
moveDown();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
oConf['stop'] = function() {
|
||||
$(sDroppableSelector).each(function () {
|
||||
window.clearInterval($(this).data('timerScroll'));
|
||||
$(this).data('timerScroll', false);
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
oConf['helper'] = function (oEvent) {
|
||||
return fValueAccessor()(oEvent && oEvent.target ? ko.dataFor(oEvent.target) : null);
|
||||
};
|
||||
|
||||
$(oElement).draggable(oConf).on('mousedown', function () {
|
||||
Utils.removeInFocus();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.droppable = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
if (!Globals.bMobileDevice)
|
||||
{
|
||||
var
|
||||
fValueFunc = fValueAccessor(),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fOverCallback = fAllValueFunc && fAllValueFunc['droppableOver'] ? fAllValueFunc['droppableOver'] : null,
|
||||
fOutCallback = fAllValueFunc && fAllValueFunc['droppableOut'] ? fAllValueFunc['droppableOut'] : null,
|
||||
oConf = {
|
||||
'tolerance': 'pointer',
|
||||
'hoverClass': 'droppableHover'
|
||||
}
|
||||
;
|
||||
|
||||
if (fValueFunc)
|
||||
{
|
||||
oConf['drop'] = function (oEvent, oUi) {
|
||||
fValueFunc(oEvent, oUi);
|
||||
};
|
||||
|
||||
if (fOverCallback)
|
||||
{
|
||||
oConf['over'] = function (oEvent, oUi) {
|
||||
fOverCallback(oEvent, oUi);
|
||||
};
|
||||
}
|
||||
|
||||
if (fOutCallback)
|
||||
{
|
||||
oConf['out'] = function (oEvent, oUi) {
|
||||
fOutCallback(oEvent, oUi);
|
||||
};
|
||||
}
|
||||
|
||||
$(oElement).droppable(oConf);
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.nano = {
|
||||
'init': function (oElement) {
|
||||
if (!Globals.bDisableNanoScroll)
|
||||
{
|
||||
$(oElement)
|
||||
.addClass('nano')
|
||||
.nanoScroller({
|
||||
'iOSNativeScrolling': false,
|
||||
'preventPageScrolling': true
|
||||
})
|
||||
;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.saveTrigger = {
|
||||
'init': function (oElement) {
|
||||
|
||||
var $oEl = $(oElement);
|
||||
|
||||
$oEl.data('save-trigger-type', $oEl.is('input[type=text],input[type=email],input[type=password],select,textarea') ? 'input' : 'custom');
|
||||
|
||||
if ('custom' === $oEl.data('save-trigger-type'))
|
||||
{
|
||||
$oEl.append(
|
||||
' <i class="icon-spinner animated"></i><i class="icon-remove error"></i><i class="icon-ok success"></i>'
|
||||
).addClass('settings-saved-trigger');
|
||||
}
|
||||
else
|
||||
{
|
||||
$oEl.addClass('settings-saved-trigger-input');
|
||||
}
|
||||
},
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
var
|
||||
mValue = ko.utils.unwrapObservable(fValueAccessor()),
|
||||
$oEl = $(oElement)
|
||||
;
|
||||
|
||||
if ('custom' === $oEl.data('save-trigger-type'))
|
||||
{
|
||||
switch (mValue.toString())
|
||||
{
|
||||
case '1':
|
||||
$oEl
|
||||
.find('.animated,.error').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.success').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case '0':
|
||||
$oEl
|
||||
.find('.animated,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.error').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
case '-2':
|
||||
$oEl
|
||||
.find('.error,.success').hide().removeClass('visible')
|
||||
.end()
|
||||
.find('.animated').show().addClass('visible')
|
||||
;
|
||||
break;
|
||||
default:
|
||||
$oEl
|
||||
.find('.animated').hide()
|
||||
.end()
|
||||
.find('.error,.success').removeClass('visible')
|
||||
;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (mValue.toString())
|
||||
{
|
||||
case '1':
|
||||
$oEl.addClass('success').removeClass('error');
|
||||
break;
|
||||
case '0':
|
||||
$oEl.addClass('error').removeClass('success');
|
||||
break;
|
||||
case '-2':
|
||||
// $oEl;
|
||||
break;
|
||||
default:
|
||||
$oEl.removeClass('error success');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.emailsTags = {
|
||||
'init': function(oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fValue = fValueAccessor(),
|
||||
fFocusCallback = function (bValue) {
|
||||
if (fValue && fValue.focusTrigger)
|
||||
{
|
||||
fValue.focusTrigger(bValue);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
$oEl.inputosaurus({
|
||||
'parseOnBlur': true,
|
||||
'allowDragAndDrop': true,
|
||||
'focusCallback': fFocusCallback,
|
||||
'inputDelimiters': [',', ';'],
|
||||
'autoCompleteSource': function (oData, fResponse) {
|
||||
RL.getAutocomplete(oData.term, function (aData) {
|
||||
fResponse(_.map(aData, function (oEmailItem) {
|
||||
return oEmailItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
},
|
||||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oEmail = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oEmail = new EmailModel();
|
||||
oEmail.mailsoParse(sValue);
|
||||
oEmail.clearDuplicateName();
|
||||
return [oEmail.toLine(false), oEmail];
|
||||
}
|
||||
|
||||
return [sValue, null];
|
||||
|
||||
});
|
||||
},
|
||||
'change': _.bind(function (oEvent) {
|
||||
$oEl.data('EmailsTagsValue', oEvent.target.value);
|
||||
fValue(oEvent.target.value);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fEmailsTagsFilter = fAllValueFunc['emailsTagsFilter'] || null,
|
||||
sValue = ko.utils.unwrapObservable(fValueAccessor())
|
||||
;
|
||||
|
||||
if ($oEl.data('EmailsTagsValue') !== sValue)
|
||||
{
|
||||
$oEl.val(sValue);
|
||||
$oEl.data('EmailsTagsValue', sValue);
|
||||
$oEl.inputosaurus('refresh');
|
||||
}
|
||||
|
||||
if (fEmailsTagsFilter && ko.utils.unwrapObservable(fEmailsTagsFilter))
|
||||
{
|
||||
$oEl.inputosaurus('focus');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.contactTags = {
|
||||
'init': function(oElement, fValueAccessor) {
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fValue = fValueAccessor(),
|
||||
fFocusCallback = function (bValue) {
|
||||
if (fValue && fValue.focusTrigger)
|
||||
{
|
||||
fValue.focusTrigger(bValue);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
$oEl.inputosaurus({
|
||||
'parseOnBlur': true,
|
||||
'allowDragAndDrop': false,
|
||||
'focusCallback': fFocusCallback,
|
||||
'inputDelimiters': [',', ';'],
|
||||
'outputDelimiter': ',',
|
||||
'autoCompleteSource': function (oData, fResponse) {
|
||||
RL.getContactTagsAutocomplete(oData.term, function (aData) { // TODO cjs
|
||||
fResponse(_.map(aData, function (oTagItem) {
|
||||
return oTagItem.toLine(false);
|
||||
}));
|
||||
});
|
||||
},
|
||||
'parseHook': function (aInput) {
|
||||
return _.map(aInput, function (sInputValue) {
|
||||
|
||||
var
|
||||
sValue = Utils.trim(sInputValue),
|
||||
oTag = null
|
||||
;
|
||||
|
||||
if ('' !== sValue)
|
||||
{
|
||||
oTag = new ContactTagModel();
|
||||
oTag.name(sValue);
|
||||
return [oTag.toLine(false), oTag];
|
||||
}
|
||||
|
||||
return [sValue, null];
|
||||
|
||||
});
|
||||
},
|
||||
'change': _.bind(function (oEvent) {
|
||||
$oEl.data('ContactTagsValue', oEvent.target.value);
|
||||
fValue(oEvent.target.value);
|
||||
}, this)
|
||||
});
|
||||
},
|
||||
'update': function (oElement, fValueAccessor, fAllBindingsAccessor) {
|
||||
|
||||
var
|
||||
$oEl = $(oElement),
|
||||
fAllValueFunc = fAllBindingsAccessor(),
|
||||
fContactTagsFilter = fAllValueFunc['contactTagsFilter'] || null,
|
||||
sValue = ko.utils.unwrapObservable(fValueAccessor())
|
||||
;
|
||||
|
||||
if ($oEl.data('ContactTagsValue') !== sValue)
|
||||
{
|
||||
$oEl.val(sValue);
|
||||
$oEl.data('ContactTagsValue', sValue);
|
||||
$oEl.inputosaurus('refresh');
|
||||
}
|
||||
|
||||
if (fContactTagsFilter && ko.utils.unwrapObservable(fContactTagsFilter))
|
||||
{
|
||||
$oEl.inputosaurus('focus');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.bindingHandlers.command = {
|
||||
'init': function (oElement, fValueAccessor, fAllBindingsAccessor, oViewModel) {
|
||||
var
|
||||
jqElement = $(oElement),
|
||||
oCommand = fValueAccessor()
|
||||
;
|
||||
|
||||
if (!oCommand || !oCommand.enabled || !oCommand.canExecute)
|
||||
{
|
||||
throw new Error('You are not using command function');
|
||||
}
|
||||
|
||||
jqElement.addClass('command');
|
||||
ko.bindingHandlers[jqElement.is('form') ? 'submit' : 'click'].init.apply(oViewModel, arguments);
|
||||
},
|
||||
|
||||
'update': function (oElement, fValueAccessor) {
|
||||
|
||||
var
|
||||
bResult = true,
|
||||
jqElement = $(oElement),
|
||||
oCommand = fValueAccessor()
|
||||
;
|
||||
|
||||
bResult = oCommand.enabled();
|
||||
jqElement.toggleClass('command-not-enabled', !bResult);
|
||||
|
||||
if (bResult)
|
||||
{
|
||||
bResult = oCommand.canExecute();
|
||||
jqElement.toggleClass('command-can-not-be-execute', !bResult);
|
||||
}
|
||||
|
||||
jqElement.toggleClass('command-disabled disable disabled', !bResult).toggleClass('no-disabled', !!bResult);
|
||||
|
||||
if (jqElement.is('input') || jqElement.is('button'))
|
||||
{
|
||||
jqElement.prop('disabled', !bResult);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ko.extenders.trimmer = function (oTarget)
|
||||
{
|
||||
var oResult = ko.computed({
|
||||
'read': oTarget,
|
||||
'write': function (sNewValue) {
|
||||
oTarget(Utils.trim(sNewValue.toString()));
|
||||
},
|
||||
'owner': this
|
||||
});
|
||||
|
||||
oResult(oTarget());
|
||||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.posInterer = function (oTarget, iDefault)
|
||||
{
|
||||
var oResult = ko.computed({
|
||||
'read': oTarget,
|
||||
'write': function (sNewValue) {
|
||||
var iNew = Utils.pInt(sNewValue.toString(), iDefault);
|
||||
if (0 >= iNew)
|
||||
{
|
||||
iNew = iDefault;
|
||||
}
|
||||
|
||||
if (iNew === oTarget() && '' + iNew !== '' + sNewValue)
|
||||
{
|
||||
oTarget(iNew + 1);
|
||||
}
|
||||
|
||||
oTarget(iNew);
|
||||
}
|
||||
});
|
||||
|
||||
oResult(oTarget());
|
||||
return oResult;
|
||||
};
|
||||
|
||||
ko.extenders.reversible = function (oTarget)
|
||||
{
|
||||
var mValue = oTarget();
|
||||
|
||||
oTarget.commit = function ()
|
||||
{
|
||||
mValue = oTarget();
|
||||
};
|
||||
|
||||
oTarget.reverse = function ()
|
||||
{
|
||||
oTarget(mValue);
|
||||
};
|
||||
|
||||
oTarget.commitedValue = function ()
|
||||
{
|
||||
return mValue;
|
||||
};
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.extenders.toggleSubscribe = function (oTarget, oOptions)
|
||||
{
|
||||
oTarget.subscribe(oOptions[1], oOptions[0], 'beforeChange');
|
||||
oTarget.subscribe(oOptions[2], oOptions[0]);
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.extenders.falseTimeout = function (oTarget, iOption)
|
||||
{
|
||||
oTarget.iTimeout = 0;
|
||||
oTarget.subscribe(function (bValue) {
|
||||
if (bValue)
|
||||
{
|
||||
window.clearTimeout(oTarget.iTimeout);
|
||||
oTarget.iTimeout = window.setTimeout(function () {
|
||||
oTarget(false);
|
||||
oTarget.iTimeout = 0;
|
||||
}, Utils.pInt(iOption));
|
||||
}
|
||||
});
|
||||
|
||||
return oTarget;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateNone = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
||||
this.subscribe(function (sValue) {
|
||||
sValue = Utils.trim(sValue);
|
||||
this.hasError('' !== sValue && !(/^[^@\s]+@[^@\s]+$/.test(sValue)));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateSimpleEmail = function ()
|
||||
{
|
||||
this.hasError = ko.observable(false);
|
||||
|
||||
this.subscribe(function (sValue) {
|
||||
sValue = Utils.trim(sValue);
|
||||
this.hasError('' !== sValue && !(/^.+@.+$/.test(sValue)));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
return this;
|
||||
};
|
||||
|
||||
ko.observable.fn.validateFunc = function (fFunc)
|
||||
{
|
||||
this.hasFuncError = ko.observable(false);
|
||||
|
||||
if (Utils.isFunc(fFunc))
|
||||
{
|
||||
this.subscribe(function (sValue) {
|
||||
this.hasFuncError(!fFunc(sValue));
|
||||
}, this);
|
||||
|
||||
this.valueHasMutated();
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
module.exports = ko;
|
||||
|
||||
}(module));
|
||||
5
dev/External/moment.js
vendored
Normal file
5
dev/External/moment.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = moment;
|
||||
5
dev/External/ssm.js
vendored
Normal file
5
dev/External/ssm.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = ssm;
|
||||
5
dev/External/underscore.js
vendored
Normal file
5
dev/External/underscore.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = window;
|
||||
5
dev/External/window.js
vendored
Normal file
5
dev/External/window.js
vendored
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = window;
|
||||
|
|
@ -1,14 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function KnoinAbstractBoot()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
KnoinAbstractBoot.prototype.bootstart = function ()
|
||||
{
|
||||
|
||||
};
|
||||
|
|
@ -1,77 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @param {?=} aViewModels = []
|
||||
* @constructor
|
||||
*/
|
||||
function KnoinAbstractScreen(sScreenName, aViewModels)
|
||||
{
|
||||
this.sScreenName = sScreenName;
|
||||
this.aViewModels = Utils.isArray(aViewModels) ? aViewModels : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.oCross = null;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.sScreenName = '';
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.aViewModels = [];
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.viewModels = function ()
|
||||
{
|
||||
return this.aViewModels;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.screenName = function ()
|
||||
{
|
||||
return this.sScreenName;
|
||||
};
|
||||
|
||||
KnoinAbstractScreen.prototype.routes = function ()
|
||||
{
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {?Object}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.__cross = function ()
|
||||
{
|
||||
return this.oCross;
|
||||
};
|
||||
|
||||
KnoinAbstractScreen.prototype.__start = function ()
|
||||
{
|
||||
var
|
||||
aRoutes = this.routes(),
|
||||
oRoute = null,
|
||||
fMatcher = null
|
||||
;
|
||||
|
||||
if (Utils.isNonEmptyArray(aRoutes))
|
||||
{
|
||||
fMatcher = _.bind(this.onRoute || Utils.emptyFunction, this);
|
||||
oRoute = crossroads.create();
|
||||
|
||||
_.each(aRoutes, function (aItem) {
|
||||
oRoute.addRoute(aItem[0], fMatcher).rules = aItem[1];
|
||||
});
|
||||
|
||||
this.oCross = oRoute;
|
||||
}
|
||||
};
|
||||
|
|
@ -1,94 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @param {string=} sPosition = ''
|
||||
* @param {string=} sTemplate = ''
|
||||
* @constructor
|
||||
*/
|
||||
function KnoinAbstractViewModel(sPosition, sTemplate)
|
||||
{
|
||||
this.bDisabeCloseOnEsc = false;
|
||||
this.sPosition = Utils.pString(sPosition);
|
||||
this.sTemplate = Utils.pString(sTemplate);
|
||||
|
||||
this.sDefaultKeyScope = Enums.KeyState.None;
|
||||
this.sCurrentKeyScope = this.sDefaultKeyScope;
|
||||
|
||||
this.viewModelName = '';
|
||||
this.viewModelVisibility = ko.observable(false);
|
||||
this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
|
||||
|
||||
this.viewModelDom = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.sPosition = '';
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.sTemplate = '';
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelName = '';
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelDom = null;
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelTemplate = function ()
|
||||
{
|
||||
return this.sTemplate;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelPosition = function ()
|
||||
{
|
||||
return this.sPosition;
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
|
||||
{
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
|
||||
{
|
||||
this.sCurrentKeyScope = RL.data().keyScope();
|
||||
RL.data().keyScope(this.sDefaultKeyScope);
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
|
||||
{
|
||||
RL.data().keyScope(this.sCurrentKeyScope);
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
if (oEvent && self.modalVisibility && self.modalVisibility())
|
||||
{
|
||||
if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||
{
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
return false;
|
||||
}
|
||||
else if (Enums.EventKeyCode.Backspace === oEvent.keyCode && !Utils.inFocus())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
|
@ -1,5 +1,21 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
$ = require('../External/jquery.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
hasher = require('../External/hasher.js'),
|
||||
crossroads = require('../External/crossroads.js'),
|
||||
$html = require('../External/$html.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
Globals = require('../Common/Globals.js'),
|
||||
Enums = require('../Common/Enums.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -32,6 +48,22 @@ Knoin.prototype.hideLoading = function ()
|
|||
$('#rl-loading').hide();
|
||||
};
|
||||
|
||||
Knoin.prototype.rl = function ()
|
||||
{
|
||||
return this.oBoot;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} thisObject
|
||||
*/
|
||||
Knoin.prototype.constructorEnd = function (thisObject)
|
||||
{
|
||||
if (Utils.isFunc(thisObject['__constructor_end']))
|
||||
{
|
||||
thisObject['__constructor_end'].call(thisObject);
|
||||
}
|
||||
};
|
||||
|
||||
Knoin.prototype.routeOff = function ()
|
||||
{
|
||||
hasher.changed.active = false;
|
||||
|
|
@ -42,20 +74,6 @@ Knoin.prototype.routeOn = function ()
|
|||
hasher.changed.active = true;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} oBoot
|
||||
* @return {Knoin}
|
||||
*/
|
||||
Knoin.prototype.setBoot = function (oBoot)
|
||||
{
|
||||
if (Utils.isNormal(oBoot))
|
||||
{
|
||||
this.oBoot = oBoot;
|
||||
}
|
||||
|
||||
return this;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @return {?Object}
|
||||
|
|
@ -82,7 +100,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
|||
|
||||
ViewModelClass.__builded = true;
|
||||
ViewModelClass.__vm = oViewModel;
|
||||
oViewModel.data = RL.data();
|
||||
oViewModel.data = RL.data(); // TODO cjs
|
||||
|
||||
oViewModel.viewModelName = ViewModelClass.__name;
|
||||
|
||||
|
|
@ -97,7 +115,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
|||
if ('Popups' === sPosition)
|
||||
{
|
||||
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () {
|
||||
kn.hideScreenPopup(ViewModelClass);
|
||||
kn.hideScreenPopup(ViewModelClass); // TODO cjs
|
||||
});
|
||||
|
||||
oViewModel.modalVisibility.subscribe(function (bValue) {
|
||||
|
|
@ -108,8 +126,8 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
|||
this.viewModelDom.show();
|
||||
this.storeAndSetKeyScope();
|
||||
|
||||
RL.popupVisibilityNames.push(this.viewModelName);
|
||||
oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10);
|
||||
RL.popupVisibilityNames.push(this.viewModelName); // TODO cjs
|
||||
oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10); // TODO cjs
|
||||
|
||||
Utils.delegateRun(this, 'onFocus', [], 500);
|
||||
}
|
||||
|
|
@ -118,7 +136,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
|||
Utils.delegateRun(this, 'onHide');
|
||||
this.restoreKeyScope();
|
||||
|
||||
RL.popupVisibilityNames.remove(this.viewModelName);
|
||||
RL.popupVisibilityNames.remove(this.viewModelName); // TODO cjs
|
||||
oViewModel.viewModelDom.css('z-index', 2000);
|
||||
|
||||
Globals.tooltipTrigger(!Globals.tooltipTrigger());
|
||||
|
|
@ -131,7 +149,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
|||
}, oViewModel);
|
||||
}
|
||||
|
||||
Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
|
||||
Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs
|
||||
|
||||
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||
'i18nInit': true,
|
||||
|
|
@ -144,7 +162,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
|||
oViewModel.registerPopupKeyDown();
|
||||
}
|
||||
|
||||
Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
|
||||
Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -175,7 +193,7 @@ Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
|
|||
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
|
||||
{
|
||||
ViewModelClassToHide.__vm.modalVisibility(false);
|
||||
Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]);
|
||||
Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]); // TODO cjs
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -193,7 +211,7 @@ Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
|
|||
{
|
||||
ViewModelClassToShow.__vm.modalVisibility(true);
|
||||
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
|
||||
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);
|
||||
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]); // TODO cjs
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -284,7 +302,7 @@ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
|
|||
{
|
||||
Utils.delegateRun(self.oCurrentScreen, 'onShow');
|
||||
|
||||
Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]);
|
||||
Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]); // TODO cjs
|
||||
|
||||
if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
|
||||
{
|
||||
|
|
@ -298,7 +316,7 @@ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
|
|||
Utils.delegateRun(ViewModelClass.__vm, 'onShow');
|
||||
Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200);
|
||||
|
||||
Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]);
|
||||
Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]); // TODO cjs
|
||||
}
|
||||
|
||||
}, self);
|
||||
|
|
@ -351,9 +369,9 @@ Knoin.prototype.startScreens = function (aScreensClasses)
|
|||
oScreen.__started = true;
|
||||
oScreen.__start();
|
||||
|
||||
Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]);
|
||||
Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]); // TODO cjs
|
||||
Utils.delegateRun(oScreen, 'onStart');
|
||||
Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]);
|
||||
Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]); // TODO cjs
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
|
@ -402,14 +420,67 @@ Knoin.prototype.setHash = function (sHash, bSilence, bReplace)
|
|||
/**
|
||||
* @return {Knoin}
|
||||
*/
|
||||
Knoin.prototype.bootstart = function ()
|
||||
Knoin.prototype.bootstart = function (RL)
|
||||
{
|
||||
if (this.oBoot && this.oBoot.bootstart)
|
||||
this.oBoot = RL;
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
$window = require('../External/$window.js'),
|
||||
$html = require('../External/$html.js'),
|
||||
Plugins = require('../Common/Plugins.js'),
|
||||
EmailModel = require('../Models/EmailModel.js')
|
||||
;
|
||||
|
||||
$html.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile');
|
||||
|
||||
$window.keydown(Utils.killCtrlAandS).keyup(Utils.killCtrlAandS);
|
||||
$window.unload(function () {
|
||||
Globals.bUnload = true;
|
||||
});
|
||||
|
||||
$html.on('click.dropdown.data-api', function () {
|
||||
Utils.detectDropdownVisibility();
|
||||
});
|
||||
|
||||
// export
|
||||
window['rl'] = window['rl'] || {};
|
||||
window['rl']['addHook'] = Plugins.addHook;
|
||||
window['rl']['settingsGet'] = Plugins.mainSettingsGet;
|
||||
window['rl']['remoteRequest'] = Plugins.remoteRequest;
|
||||
window['rl']['pluginSettingsGet'] = Plugins.settingsGet;
|
||||
window['rl']['addSettingsViewModel'] = Utils.addSettingsViewModel;
|
||||
window['rl']['createCommand'] = Utils.createCommand;
|
||||
|
||||
window['rl']['EmailModel'] = EmailModel;
|
||||
window['rl']['Enums'] = Enums;
|
||||
|
||||
window['__RLBOOT'] = function (fCall) {
|
||||
|
||||
// boot
|
||||
$(function () {
|
||||
|
||||
if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
|
||||
{
|
||||
this.oBoot.bootstart();
|
||||
$('#rl-templates').html(window['rainloopTEMPLATES'][0]);
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
RL.bootstart();
|
||||
|
||||
$html.removeClass('no-js rl-booted-trigger').addClass('rl-booted');
|
||||
}, 50);
|
||||
}
|
||||
else
|
||||
{
|
||||
fCall(false);
|
||||
}
|
||||
|
||||
return this;
|
||||
window['__RLBOOT'] = null;
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
kn = new Knoin();
|
||||
module.exports = new Knoin();
|
||||
|
||||
}(module));
|
||||
22
dev/Knoin/KnoinAbstractBoot.js
Normal file
22
dev/Knoin/KnoinAbstractBoot.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function KnoinAbstractBoot()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
KnoinAbstractBoot.prototype.bootstart = function ()
|
||||
{
|
||||
|
||||
};
|
||||
|
||||
module.exports = KnoinAbstractBoot;
|
||||
|
||||
}(module));
|
||||
90
dev/Knoin/KnoinAbstractScreen.js
Normal file
90
dev/Knoin/KnoinAbstractScreen.js
Normal file
|
|
@ -0,0 +1,90 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
crossroads = require('../External/crossroads.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {string} sScreenName
|
||||
* @param {?=} aViewModels = []
|
||||
* @constructor
|
||||
*/
|
||||
function KnoinAbstractScreen(sScreenName, aViewModels)
|
||||
{
|
||||
this.sScreenName = sScreenName;
|
||||
this.aViewModels = Utils.isArray(aViewModels) ? aViewModels : [];
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.oCross = null;
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.sScreenName = '';
|
||||
|
||||
/**
|
||||
* @type {Array}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.aViewModels = [];
|
||||
|
||||
/**
|
||||
* @return {Array}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.viewModels = function ()
|
||||
{
|
||||
return this.aViewModels;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.screenName = function ()
|
||||
{
|
||||
return this.sScreenName;
|
||||
};
|
||||
|
||||
KnoinAbstractScreen.prototype.routes = function ()
|
||||
{
|
||||
return null;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {?Object}
|
||||
*/
|
||||
KnoinAbstractScreen.prototype.__cross = function ()
|
||||
{
|
||||
return this.oCross;
|
||||
};
|
||||
|
||||
KnoinAbstractScreen.prototype.__start = function ()
|
||||
{
|
||||
var
|
||||
aRoutes = this.routes(),
|
||||
oRoute = null,
|
||||
fMatcher = null
|
||||
;
|
||||
|
||||
if (Utils.isNonEmptyArray(aRoutes))
|
||||
{
|
||||
fMatcher = _.bind(this.onRoute || Utils.emptyFunction, this);
|
||||
oRoute = crossroads.create();
|
||||
|
||||
_.each(aRoutes, function (aItem) {
|
||||
oRoute.addRoute(aItem[0], fMatcher).rules = aItem[1];
|
||||
});
|
||||
|
||||
this.oCross = oRoute;
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = KnoinAbstractScreen;
|
||||
|
||||
}(module));
|
||||
109
dev/Knoin/KnoinAbstractViewModel.js
Normal file
109
dev/Knoin/KnoinAbstractViewModel.js
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
$window = require('../External/$window.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
Enums = require('../Common/Enums.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {string=} sPosition = ''
|
||||
* @param {string=} sTemplate = ''
|
||||
* @constructor
|
||||
*/
|
||||
function KnoinAbstractViewModel(sPosition, sTemplate)
|
||||
{
|
||||
this.bDisabeCloseOnEsc = false;
|
||||
this.sPosition = Utils.pString(sPosition);
|
||||
this.sTemplate = Utils.pString(sTemplate);
|
||||
|
||||
this.sDefaultKeyScope = Enums.KeyState.None;
|
||||
this.sCurrentKeyScope = this.sDefaultKeyScope;
|
||||
|
||||
this.viewModelName = '';
|
||||
this.viewModelVisibility = ko.observable(false);
|
||||
this.modalVisibility = ko.observable(false).extend({'rateLimit': 0});
|
||||
|
||||
this.viewModelDom = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.sPosition = '';
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.sTemplate = '';
|
||||
|
||||
/**
|
||||
* @type {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelName = '';
|
||||
|
||||
/**
|
||||
* @type {?}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelDom = null;
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelTemplate = function ()
|
||||
{
|
||||
return this.sTemplate;
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
KnoinAbstractViewModel.prototype.viewModelPosition = function ()
|
||||
{
|
||||
return this.sPosition;
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function ()
|
||||
{
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
|
||||
{
|
||||
this.sCurrentKeyScope = RL.data().keyScope(); // TODO cjs
|
||||
RL.data().keyScope(this.sDefaultKeyScope); // TODO cjs
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
|
||||
{
|
||||
RL.data().keyScope(this.sCurrentKeyScope); // TODO cjs
|
||||
};
|
||||
|
||||
KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()
|
||||
{
|
||||
var self = this;
|
||||
$window.on('keydown', function (oEvent) {
|
||||
if (oEvent && self.modalVisibility && self.modalVisibility())
|
||||
{
|
||||
if (!this.bDisabeCloseOnEsc && Enums.EventKeyCode.Esc === oEvent.keyCode)
|
||||
{
|
||||
Utils.delegateRun(self, 'cancelCommand');
|
||||
return false;
|
||||
}
|
||||
else if (Enums.EventKeyCode.Backspace === oEvent.keyCode && !Utils.inFocus())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = KnoinAbstractViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,13 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {string} sEmail
|
||||
* @param {boolean=} bCanBeDelete = true
|
||||
|
|
@ -19,5 +27,9 @@ AccountModel.prototype.email = '';
|
|||
*/
|
||||
AccountModel.prototype.changeAccountLink = function ()
|
||||
{
|
||||
return RL.link().change(this.email);
|
||||
return RL.link().change(this.email); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = AccountModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
Globals = require('../Common/Globals.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -107,7 +117,7 @@ AttachmentModel.prototype.isPdf = function ()
|
|||
*/
|
||||
AttachmentModel.prototype.linkDownload = function ()
|
||||
{
|
||||
return RL.link().attachmentDownload(this.download);
|
||||
return RL.link().attachmentDownload(this.download); // TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -115,7 +125,7 @@ AttachmentModel.prototype.linkDownload = function ()
|
|||
*/
|
||||
AttachmentModel.prototype.linkPreview = function ()
|
||||
{
|
||||
return RL.link().attachmentPreview(this.download);
|
||||
return RL.link().attachmentPreview(this.download); // TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -235,3 +245,7 @@ AttachmentModel.prototype.iconClass = function ()
|
|||
|
||||
return sClass;
|
||||
};
|
||||
|
||||
module.exports = AttachmentModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @param {string} sId
|
||||
|
|
@ -61,3 +70,7 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
|
|||
|
||||
return bResult;
|
||||
};
|
||||
|
||||
module.exports = ComposeAttachmentModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,16 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -87,7 +98,7 @@ ContactModel.prototype.parse = function (oItem)
|
|||
*/
|
||||
ContactModel.prototype.srcAttr = function ()
|
||||
{
|
||||
return RL.link().emptyContactPic();
|
||||
return RL.link().emptyContactPic(); // TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -123,3 +134,7 @@ ContactModel.prototype.lineAsCcc = function ()
|
|||
|
||||
return aResult.join(' ');
|
||||
};
|
||||
|
||||
module.exports = ContactModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {number=} iType = Enums.ContactPropertyType.Unknown
|
||||
* @param {string=} sTypeStr = ''
|
||||
|
|
@ -26,5 +36,8 @@ function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
|||
this.largeValue = ko.computed(function () {
|
||||
return Enums.ContactPropertyType.Note === this.type();
|
||||
}, this);
|
||||
|
||||
}
|
||||
|
||||
module.exports = ContactPropertyModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -43,3 +52,7 @@ ContactTagModel.prototype.toLine = function (bEncodeHtml)
|
|||
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
|
||||
Utils.encodeHtml(this.name()) : this.name();
|
||||
};
|
||||
|
||||
module.exports = ContactTagModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {string=} sEmail
|
||||
* @param {string=} sName
|
||||
|
|
@ -363,3 +372,7 @@ EmailModel.prototype.inputoTagLine = function ()
|
|||
{
|
||||
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
|
||||
};
|
||||
|
||||
module.exports = EmailModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,6 +1,16 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Enums = require('../Common/Enums.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {*} oKoList
|
||||
* @constructor
|
||||
*/
|
||||
function FilterConditionModel(oKoList)
|
||||
|
|
@ -46,3 +56,7 @@ FilterConditionModel.prototype.removeSelf = function ()
|
|||
{
|
||||
this.parentList.remove(this);
|
||||
};
|
||||
|
||||
module.exports = FilterConditionModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,16 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
FilterConditionModel = require('./FilterConditionModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -77,3 +88,7 @@ FilterModel.prototype.parse = function (oItem)
|
|||
|
||||
return bResult;
|
||||
};
|
||||
|
||||
module.exports = FilterModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,18 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('./External/ko.js'),
|
||||
$window = require('../External/$window.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Globals = require('../Common/Globals.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -139,7 +152,7 @@ FolderModel.prototype.initComputed = function ()
|
|||
|
||||
if (Enums.FolderType.Inbox === iType)
|
||||
{
|
||||
RL.data().foldersInboxUnreadCount(iUnread);
|
||||
RL.data().foldersInboxUnreadCount(iUnread); // TODO cjs
|
||||
}
|
||||
|
||||
if (0 < iCount)
|
||||
|
|
@ -331,3 +344,7 @@ FolderModel.prototype.printableFullName = function ()
|
|||
{
|
||||
return this.fullName.split(this.delimiter).join(' / ');
|
||||
};
|
||||
|
||||
module.exports = FolderModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,14 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Utils = require('../Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {string} sId
|
||||
* @param {string} sEmail
|
||||
|
|
@ -35,3 +44,7 @@ IdentityModel.prototype.formattedNameForEmail = function ()
|
|||
var sName = this.name();
|
||||
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
|
||||
};
|
||||
|
||||
module.exports = IdentityModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,25 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
$ = require('../External/jquery.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
moment = require('../External/moment.js'),
|
||||
$window = require('../External/$window.js'),
|
||||
$div = require('../External/$div.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
EmailModel = require('./EmailModel.js'),
|
||||
AttachmentModel = require('./AttachmentModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -421,7 +441,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
|||
|
||||
this.proxy = !!oJsonMessage.ExternalProxy;
|
||||
|
||||
if (RL.data().capaOpenPGP())
|
||||
if (RL.data().capaOpenPGP()) // TODO cjs
|
||||
{
|
||||
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
||||
|
|
@ -627,7 +647,6 @@ MessageModel.prototype.hasVisibleAttachments = function ()
|
|||
return !!_.find(this.attachments(), function (oAttachment) {
|
||||
return !oAttachment.isLinked;
|
||||
});
|
||||
// return 0 < this.attachments().length;
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -711,7 +730,7 @@ MessageModel.prototype.fromAsSingleEmail = function ()
|
|||
*/
|
||||
MessageModel.prototype.viewLink = function ()
|
||||
{
|
||||
return RL.link().messageViewLink(this.requestHash);
|
||||
return RL.link().messageViewLink(this.requestHash);// TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -719,7 +738,7 @@ MessageModel.prototype.viewLink = function ()
|
|||
*/
|
||||
MessageModel.prototype.downloadLink = function ()
|
||||
{
|
||||
return RL.link().messageDownloadLink(this.requestHash);
|
||||
return RL.link().messageDownloadLink(this.requestHash);// TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -896,12 +915,6 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
|||
this.moment(oMessage.moment());
|
||||
|
||||
this.body = null;
|
||||
// this.isHtml(false);
|
||||
// this.hasImages(false);
|
||||
// this.attachments([]);
|
||||
|
||||
// this.isPgpSigned(false);
|
||||
// this.isPgpEncrypted(false);
|
||||
|
||||
this.priority(Enums.MessagePriority.Normal);
|
||||
this.aDraftInfo = [];
|
||||
|
|
@ -1065,7 +1078,7 @@ MessageModel.prototype.storeDataToDom = function ()
|
|||
|
||||
this.body.data('rl-plain-raw', this.plainRaw);
|
||||
|
||||
if (RL.data().capaOpenPGP())
|
||||
if (RL.data().capaOpenPGP()) // TODO cjs
|
||||
{
|
||||
this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned());
|
||||
this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
|
||||
|
|
@ -1077,7 +1090,7 @@ MessageModel.prototype.storeDataToDom = function ()
|
|||
|
||||
MessageModel.prototype.storePgpVerifyDataToDom = function ()
|
||||
{
|
||||
if (this.body && RL.data().capaOpenPGP())
|
||||
if (this.body && RL.data().capaOpenPGP()) // TODO cjs
|
||||
{
|
||||
this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
|
||||
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
|
||||
|
|
@ -1093,7 +1106,7 @@ MessageModel.prototype.fetchDataToDom = function ()
|
|||
|
||||
this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
|
||||
|
||||
if (RL.data().capaOpenPGP())
|
||||
if (RL.data().capaOpenPGP()) // TODO cjs
|
||||
{
|
||||
this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
|
||||
this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
|
||||
|
|
@ -1118,7 +1131,7 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
|||
aRes = [],
|
||||
mPgpMessage = null,
|
||||
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
|
||||
aPublicKeys = RL.data().findPublicKeysByEmail(sFrom),
|
||||
aPublicKeys = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs
|
||||
oValidKey = null,
|
||||
oValidSysKey = null,
|
||||
sPlain = ''
|
||||
|
|
@ -1144,7 +1157,7 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
|||
|
||||
if (oValidKey)
|
||||
{
|
||||
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
|
||||
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
|
||||
if (oValidSysKey)
|
||||
{
|
||||
sPlain = mPgpMessage.getText();
|
||||
|
|
@ -1153,12 +1166,12 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
|||
this.pgpSignedVerifyUser(oValidSysKey.user);
|
||||
|
||||
sPlain =
|
||||
$proxyDiv.empty().append(
|
||||
$div.empty().append(
|
||||
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
||||
).html()
|
||||
;
|
||||
|
||||
$proxyDiv.empty();
|
||||
$div.empty();
|
||||
|
||||
this.replacePlaneTextBody(sPlain);
|
||||
}
|
||||
|
|
@ -1181,8 +1194,8 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
|||
mPgpMessage = null,
|
||||
mPgpMessageDecrypted = null,
|
||||
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
|
||||
aPublicKey = RL.data().findPublicKeysByEmail(sFrom),
|
||||
oPrivateKey = RL.data().findSelfPrivateKey(sPassword),
|
||||
aPublicKey = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs
|
||||
oPrivateKey = RL.data().findSelfPrivateKey(sPassword), // TODO cjs
|
||||
oValidKey = null,
|
||||
oValidSysKey = null,
|
||||
sPlain = ''
|
||||
|
|
@ -1215,7 +1228,7 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
|||
|
||||
if (oValidKey)
|
||||
{
|
||||
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
|
||||
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
|
||||
if (oValidSysKey)
|
||||
{
|
||||
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
|
||||
|
|
@ -1227,12 +1240,12 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
|||
sPlain = mPgpMessageDecrypted.getText();
|
||||
|
||||
sPlain =
|
||||
$proxyDiv.empty().append(
|
||||
$div.empty().append(
|
||||
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
||||
).html()
|
||||
;
|
||||
|
||||
$proxyDiv.empty();
|
||||
$div.empty();
|
||||
|
||||
this.replacePlaneTextBody(sPlain);
|
||||
}
|
||||
|
|
@ -1260,3 +1273,7 @@ MessageModel.prototype.flagHash = function ()
|
|||
return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
|
||||
this.isReadReceipt()].join('');
|
||||
};
|
||||
|
||||
module.exports = MessageModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,13 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('./ko.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {string} iIndex
|
||||
* @param {string} sGuID
|
||||
|
|
@ -30,3 +38,7 @@ OpenPgpKeyModel.prototype.user = '';
|
|||
OpenPgpKeyModel.prototype.email = '';
|
||||
OpenPgpKeyModel.prototype.armor = '';
|
||||
OpenPgpKeyModel.prototype.isPrivate = false;
|
||||
|
||||
module.exports = OpenPgpKeyModel;
|
||||
|
||||
}(module));
|
||||
7
dev/RL.js
Normal file
7
dev/RL.js
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
module.exports = function () {
|
||||
return require('./Knoin/Knoin.js').rl();
|
||||
};
|
||||
10
dev/RainLoopBoot.js
Normal file
10
dev/RainLoopBoot.js
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
kn = require('./Knoin/Knoin.js'),
|
||||
RL = require('./Boots/RainLoopApp.js')
|
||||
;
|
||||
|
||||
kn.bootstart(RL);
|
||||
|
|
@ -1,5 +1,19 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
$ = require('./External/jquery.js'),
|
||||
_ = require('./External/underscore.js'),
|
||||
ko = require('./External/ko.js'),
|
||||
Globals = require('./Common/Globals.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
kn = require('./Knoin/Knoin.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {Array} aViewModels
|
||||
* @constructor
|
||||
|
|
@ -27,21 +41,21 @@ AbstractSettings.prototype.onRoute = function (sSubName)
|
|||
oViewModelDom = null
|
||||
;
|
||||
|
||||
RoutedSettingsViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
|
||||
RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||
});
|
||||
|
||||
if (RoutedSettingsViewModel)
|
||||
{
|
||||
if (_.find(ViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||
if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
RoutedSettingsViewModel = null;
|
||||
}
|
||||
|
||||
if (RoutedSettingsViewModel && _.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||
}))
|
||||
{
|
||||
|
|
@ -66,7 +80,7 @@ AbstractSettings.prototype.onRoute = function (sSubName)
|
|||
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||
oViewModelDom.appendTo(oViewModelPlace);
|
||||
|
||||
oSettingsScreen.data = RL.data();
|
||||
oSettingsScreen.data = RL.data(); // TODO cjs
|
||||
oSettingsScreen.viewModelDom = oViewModelDom;
|
||||
|
||||
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
||||
|
|
@ -122,7 +136,7 @@ AbstractSettings.prototype.onRoute = function (sSubName)
|
|||
}
|
||||
else
|
||||
{
|
||||
kn.setHash(RL.link().settings(), false, true);
|
||||
kn.setHash(RL.link().settings(), false, true); // TODO cjs
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -137,9 +151,9 @@ AbstractSettings.prototype.onHide = function ()
|
|||
|
||||
AbstractSettings.prototype.onBuild = function ()
|
||||
{
|
||||
_.each(ViewModels['settings'], function (SettingsViewModel) {
|
||||
_.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||
!_.find(ViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||
!_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||
}))
|
||||
{
|
||||
|
|
@ -147,7 +161,7 @@ AbstractSettings.prototype.onBuild = function ()
|
|||
'route': SettingsViewModel.__rlSettingsData.Route,
|
||||
'label': SettingsViewModel.__rlSettingsData.Label,
|
||||
'selected': ko.observable(false),
|
||||
'disabled': !!_.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
'disabled': !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||
})
|
||||
});
|
||||
|
|
@ -160,7 +174,7 @@ AbstractSettings.prototype.onBuild = function ()
|
|||
AbstractSettings.prototype.routes = function ()
|
||||
{
|
||||
var
|
||||
DefaultViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
|
||||
DefaultViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
|
||||
}),
|
||||
sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
|
||||
|
|
@ -179,3 +193,7 @@ AbstractSettings.prototype.routes = function ()
|
|||
['', oRules]
|
||||
];
|
||||
};
|
||||
|
||||
module.exports = AbstractSettings;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
|
||||
AdminLoginViewModel = require('./ViewModels/AdminLoginViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
|
|
@ -13,5 +23,9 @@ _.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
|
|||
|
||||
AdminLoginScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle('');
|
||||
RL.setTitle(''); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = AdminLoginScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,16 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
AbstractSettings = require('./Screens/AbstractSettings.js'),
|
||||
AdminMenuViewModel = require('./ViewModels/AdminMenuViewModel.js'),
|
||||
AdminPaneViewModel = require('./ViewModels/AdminPaneViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
|
|
@ -16,5 +27,9 @@ _.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
|
|||
|
||||
AdminSettingsScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle('');
|
||||
RL.setTitle(''); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
|
||||
LoginViewModel = require('./ViewModels/LoginViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
|
|
@ -13,5 +23,9 @@ _.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
|
|||
|
||||
LoginScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle('');
|
||||
RL.setTitle(''); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = LoginScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,21 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
$html = require('./External/$html.js'),
|
||||
Enums = require('./Common/Enums.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
|
||||
MailBoxSystemDropDownViewModel = require('./ViewModels/MailBoxSystemDropDownViewModel.js'),
|
||||
MailBoxFolderListViewModel = require('./ViewModels/MailBoxFolderListViewModel.js'),
|
||||
MailBoxMessageListViewModel = require('./ViewModels/MailBoxMessageListViewModel.js'),
|
||||
MailBoxMessageViewViewModel = require('./ViewModels/MailBoxMessageViewViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractScreen
|
||||
|
|
@ -26,10 +42,10 @@ MailBoxScreen.prototype.oLastRoute = {};
|
|||
MailBoxScreen.prototype.setNewTitle = function ()
|
||||
{
|
||||
var
|
||||
sEmail = RL.data().accountEmail(),
|
||||
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount()
|
||||
sEmail = RL.data().accountEmail(), // TODO cjs
|
||||
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount() // TODO cjs
|
||||
;
|
||||
|
||||
// TODO cjs
|
||||
RL.setTitle(('' === sEmail ? '' :
|
||||
(0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
|
||||
};
|
||||
|
|
@ -37,7 +53,7 @@ MailBoxScreen.prototype.setNewTitle = function ()
|
|||
MailBoxScreen.prototype.onShow = function ()
|
||||
{
|
||||
this.setNewTitle();
|
||||
RL.data().keyScope(Enums.KeyState.MessageList);
|
||||
RL.data().keyScope(Enums.KeyState.MessageList);// TODO cjs
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
@ -50,17 +66,17 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
|
|||
{
|
||||
if (Utils.isUnd(bPreview) ? false : !!bPreview)
|
||||
{
|
||||
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())
|
||||
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())// TODO cjs
|
||||
{
|
||||
RL.historyBack();
|
||||
RL.historyBack();// TODO cjs
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
var
|
||||
oData = RL.data(),
|
||||
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),
|
||||
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)
|
||||
oData = RL.data(),// TODO cjs
|
||||
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),// TODO cjs
|
||||
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)// TODO cjs
|
||||
;
|
||||
|
||||
if (oFolder)
|
||||
|
|
@ -76,7 +92,7 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
|
|||
oData.message(null);
|
||||
}
|
||||
|
||||
RL.reloadMessageList();
|
||||
RL.reloadMessageList();// TODO cjs
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -84,30 +100,30 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
|
|||
MailBoxScreen.prototype.onStart = function ()
|
||||
{
|
||||
var
|
||||
oData = RL.data(),
|
||||
oData = RL.data(),// TODO cjs
|
||||
fResizeFunction = function () {
|
||||
Utils.windowResize();
|
||||
}
|
||||
;
|
||||
|
||||
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))
|
||||
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))// TODO cjs
|
||||
{
|
||||
RL.accountsAndIdentities();
|
||||
RL.accountsAndIdentities();// TODO cjs
|
||||
}
|
||||
|
||||
_.delay(function () {
|
||||
if ('INBOX' !== oData.currentFolderFullNameRaw())
|
||||
{
|
||||
RL.folderInformation('INBOX');
|
||||
RL.folderInformation('INBOX');// TODO cjs
|
||||
}
|
||||
}, 1000);
|
||||
|
||||
_.delay(function () {
|
||||
RL.quota();
|
||||
RL.quota();// TODO cjs
|
||||
}, 5000);
|
||||
|
||||
_.delay(function () {
|
||||
RL.remote().appDelayStart(Utils.emptyFunction);
|
||||
RL.remote().appDelayStart(Utils.emptyFunction);// TODO cjs
|
||||
}, 35000);
|
||||
|
||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
|
||||
|
|
@ -169,3 +185,7 @@ MailBoxScreen.prototype.routes = function ()
|
|||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||
];
|
||||
};
|
||||
|
||||
module.exports = MailBoxScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,19 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
Enums = require('./Common/Enums.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
AbstractSettings = require('./Screens/AbstractSettings.js'),
|
||||
SettingsSystemDropDownViewModel = require('./ViewModels/SettingsSystemDropDownViewModel.js'),
|
||||
SettingsMenuViewModel = require('./ViewModels/SettingsMenuViewModel.js'),
|
||||
SettingsPaneViewModel = require('./ViewModels/SettingsPaneViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSettings
|
||||
|
|
@ -15,7 +29,7 @@ function SettingsScreen()
|
|||
Utils.initOnStartOrLangChange(function () {
|
||||
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
|
||||
}, this, function () {
|
||||
RL.setTitle(this.sSettingsTitle);
|
||||
RL.setTitle(this.sSettingsTitle); // TODO cjs
|
||||
});
|
||||
}
|
||||
|
||||
|
|
@ -23,6 +37,10 @@ _.extend(SettingsScreen.prototype, AbstractSettings.prototype);
|
|||
|
||||
SettingsScreen.prototype.onShow = function ()
|
||||
{
|
||||
RL.setTitle(this.sSettingsTitle);
|
||||
RL.data().keyScope(Enums.KeyState.Settings);
|
||||
RL.setTitle(this.sSettingsTitle); // TODO cjs
|
||||
RL.data().keyScope(Enums.KeyState.Settings); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = SettingsScreen;
|
||||
|
||||
}(module));
|
||||
|
|
@ -68,7 +68,7 @@ SettingsGeneral.prototype.onBuild = function ()
|
|||
'dataType': 'script',
|
||||
'cache': true
|
||||
}).done(function() {
|
||||
Utils.i18nToDoc();
|
||||
Utils.i18nReload();
|
||||
self.languageTrigger(Enums.SaveSettingsStep.TrueResult);
|
||||
}).fail(function() {
|
||||
self.languageTrigger(Enums.SaveSettingsStep.FalseResult);
|
||||
|
|
|
|||
|
|
@ -1,283 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractAjaxRemoteStorage()
|
||||
{
|
||||
this.oRequests = {};
|
||||
}
|
||||
|
||||
AbstractAjaxRemoteStorage.prototype.oRequests = {};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sRequestAction
|
||||
* @param {string} sType
|
||||
* @param {?AjaxJsonDefaultResponse} oData
|
||||
* @param {boolean} bCached
|
||||
* @param {*=} oRequestParameters
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
|
||||
{
|
||||
var
|
||||
fCall = function () {
|
||||
if (Enums.StorageResultType.Success !== sType && Globals.bUnload)
|
||||
{
|
||||
sType = Enums.StorageResultType.Unload;
|
||||
}
|
||||
|
||||
if (Enums.StorageResultType.Success === sType && oData && !oData.Result)
|
||||
{
|
||||
if (oData && -1 < Utils.inArray(oData.ErrorCode, [
|
||||
Enums.Notification.AuthError, Enums.Notification.AccessError,
|
||||
Enums.Notification.ConnectionError, Enums.Notification.DomainNotAllowed, Enums.Notification.AccountNotAllowed,
|
||||
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
||||
]))
|
||||
{
|
||||
Globals.iAjaxErrorCount++;
|
||||
}
|
||||
|
||||
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
|
||||
{
|
||||
Globals.iTokenErrorCount++;
|
||||
}
|
||||
|
||||
if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
|
||||
{
|
||||
RL.loginAndLogoutReload(true);
|
||||
}
|
||||
|
||||
if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
|
||||
{
|
||||
if (window.__rlah_clear)
|
||||
{
|
||||
window.__rlah_clear();
|
||||
}
|
||||
|
||||
RL.loginAndLogoutReload(true);
|
||||
}
|
||||
}
|
||||
else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
|
||||
{
|
||||
Globals.iAjaxErrorCount = 0;
|
||||
Globals.iTokenErrorCount = 0;
|
||||
}
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
Plugins.runHook('ajax-default-response', [sRequestAction, Enums.StorageResultType.Success === sType ? oData : null, sType, bCached, oRequestParameters]);
|
||||
|
||||
fCallback(
|
||||
sType,
|
||||
Enums.StorageResultType.Success === sType ? oData : null,
|
||||
bCached,
|
||||
sRequestAction,
|
||||
oRequestParameters
|
||||
);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
switch (sType)
|
||||
{
|
||||
case 'success':
|
||||
sType = Enums.StorageResultType.Success;
|
||||
break;
|
||||
case 'abort':
|
||||
sType = Enums.StorageResultType.Abort;
|
||||
break;
|
||||
default:
|
||||
sType = Enums.StorageResultType.Error;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Enums.StorageResultType.Error === sType)
|
||||
{
|
||||
_.delay(fCall, 300);
|
||||
}
|
||||
else
|
||||
{
|
||||
fCall();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fResultCallback
|
||||
* @param {Object} oParameters
|
||||
* @param {?number=} iTimeOut = 20000
|
||||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
* @return {jQuery.jqXHR}
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
bPost = '' === sGetAdd,
|
||||
oHeaders = {},
|
||||
iStart = (new window.Date()).getTime(),
|
||||
oDefAjax = null,
|
||||
sAction = ''
|
||||
;
|
||||
|
||||
oParameters = oParameters || {};
|
||||
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
|
||||
sGetAdd = Utils.isUnd(sGetAdd) ? '' : Utils.pString(sGetAdd);
|
||||
aAbortActions = Utils.isArray(aAbortActions) ? aAbortActions : [];
|
||||
|
||||
sAction = oParameters.Action || '';
|
||||
|
||||
if (sAction && 0 < aAbortActions.length)
|
||||
{
|
||||
_.each(aAbortActions, function (sActionToAbort) {
|
||||
if (self.oRequests[sActionToAbort])
|
||||
{
|
||||
self.oRequests[sActionToAbort].__aborted = true;
|
||||
if (self.oRequests[sActionToAbort].abort)
|
||||
{
|
||||
self.oRequests[sActionToAbort].abort();
|
||||
}
|
||||
self.oRequests[sActionToAbort] = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (bPost)
|
||||
{
|
||||
oParameters['XToken'] = RL.settingsGet('Token');
|
||||
}
|
||||
|
||||
oDefAjax = $.ajax({
|
||||
'type': bPost ? 'POST' : 'GET',
|
||||
'url': RL.link().ajax(sGetAdd),
|
||||
'async': true,
|
||||
'dataType': 'json',
|
||||
'data': bPost ? oParameters : {},
|
||||
'headers': oHeaders,
|
||||
'timeout': iTimeOut,
|
||||
'global': true
|
||||
});
|
||||
|
||||
oDefAjax.always(function (oData, sType) {
|
||||
|
||||
var bCached = false;
|
||||
if (oData && oData['Time'])
|
||||
{
|
||||
bCached = Utils.pInt(oData['Time']) > (new window.Date()).getTime() - iStart;
|
||||
}
|
||||
|
||||
if (sAction && self.oRequests[sAction])
|
||||
{
|
||||
if (self.oRequests[sAction].__aborted)
|
||||
{
|
||||
sType = 'abort';
|
||||
}
|
||||
|
||||
self.oRequests[sAction] = null;
|
||||
}
|
||||
|
||||
self.defaultResponse(fResultCallback, sAction, sType, oData, bCached, oParameters);
|
||||
});
|
||||
|
||||
if (sAction && 0 < aAbortActions.length && -1 < Utils.inArray(sAction, aAbortActions))
|
||||
{
|
||||
if (this.oRequests[sAction])
|
||||
{
|
||||
this.oRequests[sAction].__aborted = true;
|
||||
if (this.oRequests[sAction].abort)
|
||||
{
|
||||
this.oRequests[sAction].abort();
|
||||
}
|
||||
this.oRequests[sAction] = null;
|
||||
}
|
||||
|
||||
this.oRequests[sAction] = oDefAjax;
|
||||
}
|
||||
|
||||
return oDefAjax;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sAction
|
||||
* @param {Object=} oParameters
|
||||
* @param {?number=} iTimeout
|
||||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||
{
|
||||
oParameters = oParameters || {};
|
||||
oParameters.Action = sAction;
|
||||
|
||||
sGetAdd = Utils.pString(sGetAdd);
|
||||
|
||||
Plugins.runHook('ajax-default-request', [sAction, oParameters, sGetAdd]);
|
||||
|
||||
this.ajaxRequest(fCallback, oParameters,
|
||||
Utils.isUnd(iTimeout) ? Consts.Defaults.DefaultAjaxTimeout : Utils.pInt(iTimeout), sGetAdd, aAbortActions);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.noop = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Noop');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sMessage
|
||||
* @param {string} sFileName
|
||||
* @param {number} iLineNo
|
||||
* @param {string} sLocation
|
||||
* @param {string} sHtmlCapa
|
||||
* @param {number} iTime
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'JsError', {
|
||||
'Message': sMessage,
|
||||
'FileName': sFileName,
|
||||
'LineNo': iLineNo,
|
||||
'Location': sLocation,
|
||||
'HtmlCapa': sHtmlCapa,
|
||||
'TimeOnPage': iTime
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sType
|
||||
* @param {Array=} mData = null
|
||||
* @param {boolean=} bIsError = false
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'JsInfo', {
|
||||
'Type': sType,
|
||||
'Data': mData,
|
||||
'IsError': (Utils.isUnd(bIsError) ? false : !!bIsError) ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.getPublicKey = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'GetPublicKey');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sVersion
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Version', {
|
||||
'Version': sVersion
|
||||
});
|
||||
};
|
||||
301
dev/Storages/AbstractAjaxRemoteStorage.js
Normal file
301
dev/Storages/AbstractAjaxRemoteStorage.js
Normal file
|
|
@ -0,0 +1,301 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('./External/window.js'),
|
||||
$ = require('./External/jquery.js'),
|
||||
Consts = require('./Common/Consts.js'),
|
||||
Enums = require('./Common/Enums.js'),
|
||||
Globals = require('./Common/Globals.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
Plugins = require('./Common/Plugins.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractAjaxRemoteStorage()
|
||||
{
|
||||
this.oRequests = {};
|
||||
}
|
||||
|
||||
AbstractAjaxRemoteStorage.prototype.oRequests = {};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sRequestAction
|
||||
* @param {string} sType
|
||||
* @param {?AjaxJsonDefaultResponse} oData
|
||||
* @param {boolean} bCached
|
||||
* @param {*=} oRequestParameters
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.defaultResponse = function (fCallback, sRequestAction, sType, oData, bCached, oRequestParameters)
|
||||
{
|
||||
var
|
||||
fCall = function () {
|
||||
if (Enums.StorageResultType.Success !== sType && Globals.bUnload)
|
||||
{
|
||||
sType = Enums.StorageResultType.Unload;
|
||||
}
|
||||
|
||||
if (Enums.StorageResultType.Success === sType && oData && !oData.Result)
|
||||
{
|
||||
if (oData && -1 < Utils.inArray(oData.ErrorCode, [
|
||||
Enums.Notification.AuthError, Enums.Notification.AccessError,
|
||||
Enums.Notification.ConnectionError, Enums.Notification.DomainNotAllowed, Enums.Notification.AccountNotAllowed,
|
||||
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
||||
]))
|
||||
{
|
||||
Globals.iAjaxErrorCount++;
|
||||
}
|
||||
|
||||
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
|
||||
{
|
||||
Globals.iTokenErrorCount++;
|
||||
}
|
||||
|
||||
if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
|
||||
{
|
||||
RL.loginAndLogoutReload(true); // TODO cjs
|
||||
}
|
||||
|
||||
if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
|
||||
{
|
||||
if (window.__rlah_clear)
|
||||
{
|
||||
window.__rlah_clear();
|
||||
}
|
||||
|
||||
RL.loginAndLogoutReload(true); // TODO cjs
|
||||
}
|
||||
}
|
||||
else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
|
||||
{
|
||||
Globals.iAjaxErrorCount = 0;
|
||||
Globals.iTokenErrorCount = 0;
|
||||
}
|
||||
|
||||
if (fCallback)
|
||||
{
|
||||
Plugins.runHook('ajax-default-response', [sRequestAction, Enums.StorageResultType.Success === sType ? oData : null, sType, bCached, oRequestParameters]);
|
||||
|
||||
fCallback(
|
||||
sType,
|
||||
Enums.StorageResultType.Success === sType ? oData : null,
|
||||
bCached,
|
||||
sRequestAction,
|
||||
oRequestParameters
|
||||
);
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
switch (sType)
|
||||
{
|
||||
case 'success':
|
||||
sType = Enums.StorageResultType.Success;
|
||||
break;
|
||||
case 'abort':
|
||||
sType = Enums.StorageResultType.Abort;
|
||||
break;
|
||||
default:
|
||||
sType = Enums.StorageResultType.Error;
|
||||
break;
|
||||
}
|
||||
|
||||
if (Enums.StorageResultType.Error === sType)
|
||||
{
|
||||
_.delay(fCall, 300);
|
||||
}
|
||||
else
|
||||
{
|
||||
fCall();
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fResultCallback
|
||||
* @param {Object} oParameters
|
||||
* @param {?number=} iTimeOut = 20000
|
||||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
* @return {jQuery.jqXHR}
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.ajaxRequest = function (fResultCallback, oParameters, iTimeOut, sGetAdd, aAbortActions)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
bPost = '' === sGetAdd,
|
||||
oHeaders = {},
|
||||
iStart = (new window.Date()).getTime(),
|
||||
oDefAjax = null,
|
||||
sAction = ''
|
||||
;
|
||||
|
||||
oParameters = oParameters || {};
|
||||
iTimeOut = Utils.isNormal(iTimeOut) ? iTimeOut : 20000;
|
||||
sGetAdd = Utils.isUnd(sGetAdd) ? '' : Utils.pString(sGetAdd);
|
||||
aAbortActions = Utils.isArray(aAbortActions) ? aAbortActions : [];
|
||||
|
||||
sAction = oParameters.Action || '';
|
||||
|
||||
if (sAction && 0 < aAbortActions.length)
|
||||
{
|
||||
_.each(aAbortActions, function (sActionToAbort) {
|
||||
if (self.oRequests[sActionToAbort])
|
||||
{
|
||||
self.oRequests[sActionToAbort].__aborted = true;
|
||||
if (self.oRequests[sActionToAbort].abort)
|
||||
{
|
||||
self.oRequests[sActionToAbort].abort();
|
||||
}
|
||||
self.oRequests[sActionToAbort] = null;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (bPost)
|
||||
{
|
||||
oParameters['XToken'] = RL.settingsGet('Token'); // TODO cjs
|
||||
}
|
||||
|
||||
oDefAjax = $.ajax({
|
||||
'type': bPost ? 'POST' : 'GET',
|
||||
'url': RL.link().ajax(sGetAdd), // TODO cjs
|
||||
'async': true,
|
||||
'dataType': 'json',
|
||||
'data': bPost ? oParameters : {},
|
||||
'headers': oHeaders,
|
||||
'timeout': iTimeOut,
|
||||
'global': true
|
||||
});
|
||||
|
||||
oDefAjax.always(function (oData, sType) {
|
||||
|
||||
var bCached = false;
|
||||
if (oData && oData['Time'])
|
||||
{
|
||||
bCached = Utils.pInt(oData['Time']) > (new window.Date()).getTime() - iStart;
|
||||
}
|
||||
|
||||
if (sAction && self.oRequests[sAction])
|
||||
{
|
||||
if (self.oRequests[sAction].__aborted)
|
||||
{
|
||||
sType = 'abort';
|
||||
}
|
||||
|
||||
self.oRequests[sAction] = null;
|
||||
}
|
||||
|
||||
self.defaultResponse(fResultCallback, sAction, sType, oData, bCached, oParameters);
|
||||
});
|
||||
|
||||
if (sAction && 0 < aAbortActions.length && -1 < Utils.inArray(sAction, aAbortActions))
|
||||
{
|
||||
if (this.oRequests[sAction])
|
||||
{
|
||||
this.oRequests[sAction].__aborted = true;
|
||||
if (this.oRequests[sAction].abort)
|
||||
{
|
||||
this.oRequests[sAction].abort();
|
||||
}
|
||||
this.oRequests[sAction] = null;
|
||||
}
|
||||
|
||||
this.oRequests[sAction] = oDefAjax;
|
||||
}
|
||||
|
||||
return oDefAjax;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sAction
|
||||
* @param {Object=} oParameters
|
||||
* @param {?number=} iTimeout
|
||||
* @param {string=} sGetAdd = ''
|
||||
* @param {Array=} aAbortActions = []
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.defaultRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||
{
|
||||
oParameters = oParameters || {};
|
||||
oParameters.Action = sAction;
|
||||
|
||||
sGetAdd = Utils.pString(sGetAdd);
|
||||
|
||||
Plugins.runHook('ajax-default-request', [sAction, oParameters, sGetAdd]);
|
||||
|
||||
this.ajaxRequest(fCallback, oParameters,
|
||||
Utils.isUnd(iTimeout) ? Consts.Defaults.DefaultAjaxTimeout : Utils.pInt(iTimeout), sGetAdd, aAbortActions);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.noop = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Noop');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sMessage
|
||||
* @param {string} sFileName
|
||||
* @param {number} iLineNo
|
||||
* @param {string} sLocation
|
||||
* @param {string} sHtmlCapa
|
||||
* @param {number} iTime
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.jsError = function (fCallback, sMessage, sFileName, iLineNo, sLocation, sHtmlCapa, iTime)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'JsError', {
|
||||
'Message': sMessage,
|
||||
'FileName': sFileName,
|
||||
'LineNo': iLineNo,
|
||||
'Location': sLocation,
|
||||
'HtmlCapa': sHtmlCapa,
|
||||
'TimeOnPage': iTime
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sType
|
||||
* @param {Array=} mData = null
|
||||
* @param {boolean=} bIsError = false
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.jsInfo = function (fCallback, sType, mData, bIsError)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'JsInfo', {
|
||||
'Type': sType,
|
||||
'Data': mData,
|
||||
'IsError': (Utils.isUnd(bIsError) ? false : !!bIsError) ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.getPublicKey = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'GetPublicKey');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sVersion
|
||||
*/
|
||||
AbstractAjaxRemoteStorage.prototype.jsVersion = function (fCallback, sVersion)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'Version', {
|
||||
'Version': sVersion
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = AbstractAjaxRemoteStorage;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,34 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractCacheStorage()
|
||||
{
|
||||
this.bCapaGravatar = RL.capa(Enums.Capa.Gravatar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
AbstractCacheStorage.prototype.oServices = {};
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
AbstractCacheStorage.prototype.bCapaGravatar = false;
|
||||
|
||||
AbstractCacheStorage.prototype.clear = function ()
|
||||
{
|
||||
this.bCapaGravatar = !!this.bCapaGravatar; // TODO
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sEmail
|
||||
* @return {string}
|
||||
*/
|
||||
AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
|
||||
{
|
||||
sEmail = Utils.trim(sEmail);
|
||||
fCallback(this.bCapaGravatar && '' !== sEmail ? RL.link().avatarLink(sEmail) : '', sEmail);
|
||||
};
|
||||
48
dev/Storages/AbstractCacheStorage.js
Normal file
48
dev/Storages/AbstractCacheStorage.js
Normal file
|
|
@ -0,0 +1,48 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Enums = require('./Common/Enums.js'),
|
||||
Utils = require('./Common/Utils.js'),
|
||||
RL = require('./RL.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AbstractCacheStorage()
|
||||
{
|
||||
this.bCapaGravatar = RL().capa(Enums.Capa.Gravatar);
|
||||
}
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
*/
|
||||
AbstractCacheStorage.prototype.oServices = {};
|
||||
|
||||
/**
|
||||
* @type {boolean}
|
||||
*/
|
||||
AbstractCacheStorage.prototype.bCapaGravatar = false;
|
||||
|
||||
AbstractCacheStorage.prototype.clear = function ()
|
||||
{
|
||||
this.bCapaGravatar = !!this.bCapaGravatar; // TODO
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} sEmail
|
||||
* @return {string}
|
||||
*/
|
||||
AbstractCacheStorage.prototype.getUserPic = function (sEmail, fCallback)
|
||||
{
|
||||
sEmail = Utils.trim(sEmail);
|
||||
fCallback(this.bCapaGravatar && '' !== sEmail ? RL().link().avatarLink(sEmail) : '', sEmail);
|
||||
};
|
||||
|
||||
module.exports = AbstractCacheStorage;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,17 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('./External/ko.js'),
|
||||
key = require('./External/key.js'),
|
||||
Enums = require('./Common/Enums.js'),
|
||||
Globals = require('./Common/Globals.js'),
|
||||
Utils = require('./Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -46,7 +58,7 @@ function AbstractData()
|
|||
});
|
||||
|
||||
this.leftPanelDisabled.subscribe(function (bValue) {
|
||||
RL.pub('left-panel.' + (bValue ? 'off' : 'on'));
|
||||
RL.pub('left-panel.' + (bValue ? 'off' : 'on')); // TODO cjs
|
||||
});
|
||||
|
||||
Globals.dropdownVisibility.subscribe(function (bValue) {
|
||||
|
|
@ -67,7 +79,7 @@ function AbstractData()
|
|||
AbstractData.prototype.populateDataOnStart = function()
|
||||
{
|
||||
var
|
||||
mLayout = Utils.pInt(RL.settingsGet('Layout')),
|
||||
mLayout = Utils.pInt(RL.settingsGet('Layout')), // TODO cjs
|
||||
aLanguages = RL.settingsGet('Languages'),
|
||||
aThemes = RL.settingsGet('Themes')
|
||||
;
|
||||
|
|
@ -132,3 +144,7 @@ AbstractData.prototype.populateDataOnStart = function()
|
|||
|
||||
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
|
||||
};
|
||||
|
||||
module.exports = AbstractData;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,262 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractAjaxRemoteStorage
|
||||
*/
|
||||
function AdminAjaxRemoteStorage()
|
||||
{
|
||||
AbstractAjaxRemoteStorage.call(this);
|
||||
|
||||
this.oRequests = {};
|
||||
}
|
||||
|
||||
_.extend(AdminAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype);
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sLogin
|
||||
* @param {string} sPassword
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogin', {
|
||||
'Login': sLogin,
|
||||
'Password': sPassword
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.adminLogout = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogout');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.saveAdminConfig = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domainList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.pluginList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.packagesList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackagesList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.coreData = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminCoreData');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.updateCoreData = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.packageInstall = function (fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageInstall', {
|
||||
'Id': oPackage.id,
|
||||
'Type': oPackage.type,
|
||||
'File': oPackage.file
|
||||
}, 60000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.packageDelete = function (fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageDelete', {
|
||||
'Id': oPackage.id
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domain = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.plugin = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domainDelete = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainDelete', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminDomainDisable', {
|
||||
'Name': sName,
|
||||
'Disabled': !!bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oConfig
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {boolean} bForce
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.licensing = function (fCallback, bForce)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensing', {
|
||||
'Force' : bForce ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sDomain
|
||||
* @param {string} sKey
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
|
||||
'Domain' : sDomain,
|
||||
'Key' : sKey
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginDisable', {
|
||||
'Name': sName,
|
||||
'Disabled': !!bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
AdminAjaxRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
|
||||
bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin,
|
||||
sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, sWhiteList)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainSave', {
|
||||
'Create': bCreate ? '1' : '0',
|
||||
'Name': sName,
|
||||
'IncHost': sIncHost,
|
||||
'IncPort': iIncPort,
|
||||
'IncSecure': sIncSecure,
|
||||
'IncShortLogin': bIncShortLogin ? '1' : '0',
|
||||
'OutHost': sOutHost,
|
||||
'OutPort': iOutPort,
|
||||
'OutSecure': sOutSecure,
|
||||
'OutShortLogin': bOutShortLogin ? '1' : '0',
|
||||
'OutAuth': bOutAuth ? '1' : '0',
|
||||
'WhiteList': sWhiteList
|
||||
});
|
||||
};
|
||||
|
||||
AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
|
||||
sIncHost, iIncPort, sIncSecure,
|
||||
sOutHost, iOutPort, sOutSecure, bOutAuth)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainTest', {
|
||||
'Name': sName,
|
||||
'IncHost': sIncHost,
|
||||
'IncPort': iIncPort,
|
||||
'IncSecure': sIncSecure,
|
||||
'OutHost': sOutHost,
|
||||
'OutPort': iOutPort,
|
||||
'OutSecure': sOutSecure,
|
||||
'OutAuth': bOutAuth ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.testContacts = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminContactsTest', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPing');
|
||||
};
|
||||
275
dev/Storages/AdminAjaxRemoteStorage.js
Normal file
275
dev/Storages/AdminAjaxRemoteStorage.js
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
AbstractAjaxRemoteStorage = require('./Storages/AbstractAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractAjaxRemoteStorage
|
||||
*/
|
||||
function AdminAjaxRemoteStorage()
|
||||
{
|
||||
AbstractAjaxRemoteStorage.call(this);
|
||||
|
||||
this.oRequests = {};
|
||||
}
|
||||
|
||||
_.extend(AdminAjaxRemoteStorage.prototype, AbstractAjaxRemoteStorage.prototype);
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sLogin
|
||||
* @param {string} sPassword
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.adminLogin = function (fCallback, sLogin, sPassword)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogin', {
|
||||
'Login': sLogin,
|
||||
'Password': sPassword
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.adminLogout = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminLogout');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.saveAdminConfig = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminSettingsUpdate', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domainList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.pluginList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.packagesList = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackagesList');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.coreData = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminCoreData');
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.updateCoreData = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminUpdateCoreData', {}, 90000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.packageInstall = function (fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageInstall', {
|
||||
'Id': oPackage.id,
|
||||
'Type': oPackage.type,
|
||||
'File': oPackage.file
|
||||
}, 60000);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oPackage
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.packageDelete = function (fCallback, oPackage)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPackageDelete', {
|
||||
'Id': oPackage.id
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domain = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.plugin = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPluginLoad', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domainDelete = function (fCallback, sName)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainDelete', {
|
||||
'Name': sName
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.domainDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminDomainDisable', {
|
||||
'Name': sName,
|
||||
'Disabled': !!bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {Object} oConfig
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.pluginSettingsUpdate = function (fCallback, oConfig)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginSettingsUpdate', oConfig);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {boolean} bForce
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.licensing = function (fCallback, bForce)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensing', {
|
||||
'Force' : bForce ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sDomain
|
||||
* @param {string} sKey
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.licensingActivate = function (fCallback, sDomain, sKey)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminLicensingActivate', {
|
||||
'Domain' : sDomain,
|
||||
'Key' : sKey
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {string} sName
|
||||
* @param {boolean} bDisabled
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.pluginDisable = function (fCallback, sName, bDisabled)
|
||||
{
|
||||
return this.defaultRequest(fCallback, 'AdminPluginDisable', {
|
||||
'Name': sName,
|
||||
'Disabled': !!bDisabled ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
AdminAjaxRemoteStorage.prototype.createOrUpdateDomain = function (fCallback,
|
||||
bCreate, sName, sIncHost, iIncPort, sIncSecure, bIncShortLogin,
|
||||
sOutHost, iOutPort, sOutSecure, bOutShortLogin, bOutAuth, sWhiteList)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainSave', {
|
||||
'Create': bCreate ? '1' : '0',
|
||||
'Name': sName,
|
||||
'IncHost': sIncHost,
|
||||
'IncPort': iIncPort,
|
||||
'IncSecure': sIncSecure,
|
||||
'IncShortLogin': bIncShortLogin ? '1' : '0',
|
||||
'OutHost': sOutHost,
|
||||
'OutPort': iOutPort,
|
||||
'OutSecure': sOutSecure,
|
||||
'OutShortLogin': bOutShortLogin ? '1' : '0',
|
||||
'OutAuth': bOutAuth ? '1' : '0',
|
||||
'WhiteList': sWhiteList
|
||||
});
|
||||
};
|
||||
|
||||
AdminAjaxRemoteStorage.prototype.testConnectionForDomain = function (fCallback, sName,
|
||||
sIncHost, iIncPort, sIncSecure,
|
||||
sOutHost, iOutPort, sOutSecure, bOutAuth)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminDomainTest', {
|
||||
'Name': sName,
|
||||
'IncHost': sIncHost,
|
||||
'IncPort': iIncPort,
|
||||
'IncSecure': sIncSecure,
|
||||
'OutHost': sOutHost,
|
||||
'OutPort': iOutPort,
|
||||
'OutSecure': sOutSecure,
|
||||
'OutAuth': bOutAuth ? '1' : '0'
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.testContacts = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminContactsTest', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
* @param {?} oData
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.saveNewAdminPassword = function (fCallback, oData)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPasswordUpdate', oData);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {?Function} fCallback
|
||||
*/
|
||||
AdminAjaxRemoteStorage.prototype.adminPing = function (fCallback)
|
||||
{
|
||||
this.defaultRequest(fCallback, 'AdminPing');
|
||||
};
|
||||
|
||||
module.exports = AdminAjaxRemoteStorage;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,12 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractCacheStorage
|
||||
*/
|
||||
function AdminCacheStorage()
|
||||
{
|
||||
AbstractCacheStorage.call(this);
|
||||
}
|
||||
|
||||
_.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype);
|
||||
25
dev/Storages/AdminCacheStorage.js
Normal file
25
dev/Storages/AdminCacheStorage.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
AbstractCacheStorage = require('./Storages/AbstractCacheStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractCacheStorage
|
||||
*/
|
||||
function AdminCacheStorage()
|
||||
{
|
||||
AbstractCacheStorage.call(this);
|
||||
}
|
||||
|
||||
_.extend(AdminCacheStorage.prototype, AbstractCacheStorage.prototype);
|
||||
|
||||
module.exports = AdminCacheStorage;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractData
|
||||
*/
|
||||
function AdminDataStorage()
|
||||
{
|
||||
AbstractData.call(this);
|
||||
|
||||
this.domainsLoading = ko.observable(false).extend({'throttle': 100});
|
||||
this.domains = ko.observableArray([]);
|
||||
|
||||
this.pluginsLoading = ko.observable(false).extend({'throttle': 100});
|
||||
this.plugins = ko.observableArray([]);
|
||||
|
||||
this.packagesReal = ko.observable(true);
|
||||
this.packagesMainUpdatable = ko.observable(true);
|
||||
this.packagesLoading = ko.observable(false).extend({'throttle': 100});
|
||||
this.packages = ko.observableArray([]);
|
||||
|
||||
this.coreReal = ko.observable(true);
|
||||
this.coreUpdatable = ko.observable(true);
|
||||
this.coreAccess = ko.observable(true);
|
||||
this.coreChecking = ko.observable(false).extend({'throttle': 100});
|
||||
this.coreUpdating = ko.observable(false).extend({'throttle': 100});
|
||||
this.coreRemoteVersion = ko.observable('');
|
||||
this.coreRemoteRelease = ko.observable('');
|
||||
this.coreVersionCompare = ko.observable(-2);
|
||||
|
||||
this.licensing = ko.observable(false);
|
||||
this.licensingProcess = ko.observable(false);
|
||||
this.licenseValid = ko.observable(false);
|
||||
this.licenseExpired = ko.observable(0);
|
||||
this.licenseError = ko.observable('');
|
||||
|
||||
this.licenseTrigger = ko.observable(false);
|
||||
|
||||
this.adminManLoading = ko.computed(function () {
|
||||
return '000' !== [this.domainsLoading() ? '1' : '0', this.pluginsLoading() ? '1' : '0', this.packagesLoading() ? '1' : '0'].join('');
|
||||
}, this);
|
||||
|
||||
this.adminManLoadingVisibility = ko.computed(function () {
|
||||
return this.adminManLoading() ? 'visible' : 'hidden';
|
||||
}, this).extend({'rateLimit': 300});
|
||||
}
|
||||
|
||||
_.extend(AdminDataStorage.prototype, AbstractData.prototype);
|
||||
|
||||
AdminDataStorage.prototype.populateDataOnStart = function()
|
||||
{
|
||||
AbstractData.prototype.populateDataOnStart.call(this);
|
||||
};
|
||||
67
dev/Storages/AdminDataStorage.js
Normal file
67
dev/Storages/AdminDataStorage.js
Normal file
|
|
@ -0,0 +1,67 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
ko = require('./External/ko.js'),
|
||||
AbstractData = require('./Storages/AbstractData.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractData
|
||||
*/
|
||||
function AdminDataStorage()
|
||||
{
|
||||
AbstractData.call(this);
|
||||
|
||||
this.domainsLoading = ko.observable(false).extend({'throttle': 100});
|
||||
this.domains = ko.observableArray([]);
|
||||
|
||||
this.pluginsLoading = ko.observable(false).extend({'throttle': 100});
|
||||
this.plugins = ko.observableArray([]);
|
||||
|
||||
this.packagesReal = ko.observable(true);
|
||||
this.packagesMainUpdatable = ko.observable(true);
|
||||
this.packagesLoading = ko.observable(false).extend({'throttle': 100});
|
||||
this.packages = ko.observableArray([]);
|
||||
|
||||
this.coreReal = ko.observable(true);
|
||||
this.coreUpdatable = ko.observable(true);
|
||||
this.coreAccess = ko.observable(true);
|
||||
this.coreChecking = ko.observable(false).extend({'throttle': 100});
|
||||
this.coreUpdating = ko.observable(false).extend({'throttle': 100});
|
||||
this.coreRemoteVersion = ko.observable('');
|
||||
this.coreRemoteRelease = ko.observable('');
|
||||
this.coreVersionCompare = ko.observable(-2);
|
||||
|
||||
this.licensing = ko.observable(false);
|
||||
this.licensingProcess = ko.observable(false);
|
||||
this.licenseValid = ko.observable(false);
|
||||
this.licenseExpired = ko.observable(0);
|
||||
this.licenseError = ko.observable('');
|
||||
|
||||
this.licenseTrigger = ko.observable(false);
|
||||
|
||||
this.adminManLoading = ko.computed(function () {
|
||||
return '000' !== [this.domainsLoading() ? '1' : '0', this.pluginsLoading() ? '1' : '0', this.packagesLoading() ? '1' : '0'].join('');
|
||||
}, this);
|
||||
|
||||
this.adminManLoadingVisibility = ko.computed(function () {
|
||||
return this.adminManLoading() ? 'visible' : 'hidden';
|
||||
}, this).extend({'rateLimit': 300});
|
||||
}
|
||||
|
||||
_.extend(AdminDataStorage.prototype, AbstractData.prototype);
|
||||
|
||||
AdminDataStorage.prototype.populateDataOnStart = function()
|
||||
{
|
||||
AbstractData.prototype.populateDataOnStart.call(this);
|
||||
};
|
||||
|
||||
module.exports = AdminDataStorage;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,16 +1,22 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('./External/underscore.js'),
|
||||
CookieDriver = require('./Storages/LocalStorages/CookieDriver.js'),
|
||||
LocalStorageDriver = require('./Storages/LocalStorages/LocalStorageDriver.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LocalStorage()
|
||||
{
|
||||
var
|
||||
sStorages = [
|
||||
LocalStorageDriver,
|
||||
CookieDriver
|
||||
],
|
||||
NextStorageDriver = _.find(sStorages, function (NextStorageDriver) {
|
||||
NextStorageDriver = _.find([LocalStorageDriver, CookieDriver], function (NextStorageDriver) {
|
||||
return NextStorageDriver.supported();
|
||||
})
|
||||
;
|
||||
|
|
@ -42,3 +48,7 @@ LocalStorage.prototype.get = function (iKey)
|
|||
{
|
||||
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
|
||||
};
|
||||
|
||||
module.exports = LocalStorage;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,16 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
$ = require('./External/jquery.js'),
|
||||
JSON = require('./External/JSON.js'),
|
||||
Consts = require('./Common/Consts.js'),
|
||||
Utils = require('./Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -73,3 +84,7 @@ CookieDriver.prototype.get = function (sKey)
|
|||
|
||||
return mResult;
|
||||
};
|
||||
|
||||
module.exports = CookieDriver;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,16 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('./External/window.js'),
|
||||
JSON = require('./External/JSON.js'),
|
||||
Consts = require('./Common/Consts.js'),
|
||||
Utils = require('./Common/Utils.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
|
|
@ -70,3 +81,7 @@ LocalStorageDriver.prototype.get = function (sKey)
|
|||
|
||||
return mResult;
|
||||
};
|
||||
|
||||
module.exports = LocalStorageDriver;
|
||||
|
||||
}(module));
|
||||
File diff suppressed because it is too large
Load diff
1287
dev/Storages/WebMailDataStorage.js
Normal file
1287
dev/Storages/WebMailDataStorage.js
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -320,7 +320,7 @@ LoginViewModel.prototype.onBuild = function ()
|
|||
'cache': true
|
||||
}).done(function() {
|
||||
self.bSendLanguage = true;
|
||||
Utils.i18nToDoc();
|
||||
Utils.i18nReload();
|
||||
$.cookie('rllang', RL.data().language(), {'expires': 30});
|
||||
}).always(function() {
|
||||
self.langRequest(false);
|
||||
|
|
|
|||
|
|
@ -1,5 +1,20 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
key = require('../External/key.js'),
|
||||
$html = require('../External/$html.js'),
|
||||
Consts = require('../Common/Consts.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
|
|
@ -222,7 +237,7 @@ function MailBoxMessageViewViewModel()
|
|||
RL.pub('mailbox.message-list.selector.go-down');
|
||||
});
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('MailBoxMessageViewViewModel', MailBoxMessageViewViewModel);
|
||||
|
|
@ -691,3 +706,7 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
|
|||
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = MailBoxMessageViewViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSystemDropDownViewModel
|
||||
|
|
@ -7,7 +17,11 @@
|
|||
function MailBoxSystemDropDownViewModel()
|
||||
{
|
||||
AbstractSystemDropDownViewModel.call(this);
|
||||
Knoin.constructorEnd(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
|
||||
|
||||
module.exports = MailBoxSystemDropDownViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
|
|||
|
|
@ -1,5 +1,15 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @param {?} oScreen
|
||||
*
|
||||
|
|
@ -10,21 +20,25 @@ function SettingsMenuViewModel(oScreen)
|
|||
{
|
||||
KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
|
||||
|
||||
this.leftPanelDisabled = RL.data().leftPanelDisabled;
|
||||
this.leftPanelDisabled = RL.data().leftPanelDisabled; // TODO cjs
|
||||
|
||||
this.menu = oScreen.menu;
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('SettingsMenuViewModel', SettingsMenuViewModel);
|
||||
|
||||
SettingsMenuViewModel.prototype.link = function (sRoute)
|
||||
{
|
||||
return RL.link().settings(sRoute);
|
||||
return RL.link().settings(sRoute);// TODO cjs
|
||||
};
|
||||
|
||||
SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
|
||||
{
|
||||
kn.setHash(RL.link().inbox());
|
||||
kn.setHash(RL.link().inbox()); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = SettingsMenuViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,17 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
key = require('../External/key.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends KnoinAbstractViewModel
|
||||
|
|
@ -8,7 +20,7 @@ function SettingsPaneViewModel()
|
|||
{
|
||||
KnoinAbstractViewModel.call(this, 'Right', 'SettingsPane');
|
||||
|
||||
Knoin.constructorEnd(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('SettingsPaneViewModel', SettingsPaneViewModel);
|
||||
|
|
@ -23,10 +35,14 @@ SettingsPaneViewModel.prototype.onBuild = function ()
|
|||
|
||||
SettingsPaneViewModel.prototype.onShow = function ()
|
||||
{
|
||||
RL.data().message(null);
|
||||
RL.data().message(null); // TODO cjs
|
||||
};
|
||||
|
||||
SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
|
||||
{
|
||||
kn.setHash(RL.link().inbox());
|
||||
kn.setHash(RL.link().inbox()); // TODO cjs
|
||||
};
|
||||
|
||||
module.exports = SettingsPaneViewModel;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,5 +1,15 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('./Knoin/Knoin.js'),
|
||||
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSystemDropDownViewModel
|
||||
|
|
@ -7,7 +17,11 @@
|
|||
function SettingsSystemDropDownViewModel()
|
||||
{
|
||||
AbstractSystemDropDownViewModel.call(this);
|
||||
Knoin.constructorEnd(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
|
||||
|
||||
module.exports = SettingsSystemDropDownViewModel;
|
||||
|
||||
}(module));
|
||||
15
gulpfile.js
15
gulpfile.js
|
|
@ -608,3 +608,18 @@ gulp.task('b', ['rainloop']);
|
|||
gulp.task('b+', ['rainloop+']);
|
||||
|
||||
gulp.task('own', ['owncloud']);
|
||||
|
||||
var browserify = require('browserify');
|
||||
var source = require('vinyl-source-stream');
|
||||
|
||||
gulp.task('bro', function() {
|
||||
return browserify({
|
||||
'basedir': './dev/',
|
||||
'detectGlobals': false,
|
||||
'debug': false
|
||||
})
|
||||
.add('./RainLoopBoot.js')
|
||||
.bundle()
|
||||
.pipe(source('bro.js'))
|
||||
.pipe(gulp.dest(cfg.paths.staticJS));
|
||||
});
|
||||
|
|
|
|||
|
|
@ -46,6 +46,9 @@
|
|||
"node-fs": "*",
|
||||
"jshint-summary": "*",
|
||||
|
||||
"browserify": "*",
|
||||
"vinyl-source-stream": "latest",
|
||||
|
||||
"gulp": "*",
|
||||
"gulp-util": "*",
|
||||
"gulp-uglify": "*",
|
||||
|
|
|
|||
6484
rainloop/v/0.0.0/static/js/bro.js
Normal file
6484
rainloop/v/0.0.0/static/js/bro.js
Normal file
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue