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,11 +1,30 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends KnoinAbstractBoot
|
* @extends KnoinAbstractBoot
|
||||||
*/
|
*/
|
||||||
function AbstractApp()
|
function AbstractApp()
|
||||||
{
|
{
|
||||||
KnoinAbstractBoot.call(this);
|
KnoinAbstractBoot.call(this);
|
||||||
|
|
||||||
this.oSettings = null;
|
this.oSettings = null;
|
||||||
|
|
@ -25,24 +44,25 @@ function AbstractApp()
|
||||||
this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body');
|
this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body');
|
||||||
|
|
||||||
$window.on('error', function (oEvent) {
|
$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, [
|
-1 === Utils.inArray(oEvent.originalEvent.message, [
|
||||||
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
|
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
|
||||||
]))
|
]))
|
||||||
{
|
{
|
||||||
|
// TODO cjs
|
||||||
RL.remote().jsError(
|
RL.remote().jsError(
|
||||||
Utils.emptyFunction,
|
Utils.emptyFunction,
|
||||||
oEvent.originalEvent.message,
|
oEvent.originalEvent.message,
|
||||||
oEvent.originalEvent.filename,
|
oEvent.originalEvent.filename,
|
||||||
oEvent.originalEvent.lineno,
|
oEvent.originalEvent.lineno,
|
||||||
location && location.toString ? location.toString() : '',
|
window.location && window.location.toString ? window.location.toString() : '',
|
||||||
$html.attr('class'),
|
$html.attr('class'),
|
||||||
Utils.microtime() - Globals.now
|
Utils.microtime() - Globals.now
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
$document.on('keydown', function (oEvent) {
|
$doc.on('keydown', function (oEvent) {
|
||||||
if (oEvent && oEvent.ctrlKey)
|
if (oEvent && oEvent.ctrlKey)
|
||||||
{
|
{
|
||||||
$html.addClass('rl-ctrl-key-pressed');
|
$html.addClass('rl-ctrl-key-pressed');
|
||||||
|
|
@ -53,36 +73,36 @@ function AbstractApp()
|
||||||
$html.removeClass('rl-ctrl-key-pressed');
|
$html.removeClass('rl-ctrl-key-pressed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
|
_.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
|
||||||
|
|
||||||
AbstractApp.prototype.oSettings = null;
|
AbstractApp.prototype.oSettings = null;
|
||||||
AbstractApp.prototype.oPlugins = null;
|
AbstractApp.prototype.oPlugins = null;
|
||||||
AbstractApp.prototype.oLocal = null;
|
AbstractApp.prototype.oLocal = null;
|
||||||
AbstractApp.prototype.oLink = null;
|
AbstractApp.prototype.oLink = null;
|
||||||
AbstractApp.prototype.oSubs = {};
|
AbstractApp.prototype.oSubs = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sLink
|
* @param {string} sLink
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.download = function (sLink)
|
AbstractApp.prototype.download = function (sLink)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oLink = null,
|
|
||||||
oE = null,
|
oE = null,
|
||||||
sUserAgent = navigator.userAgent.toLowerCase()
|
oLink = null,
|
||||||
|
sUserAgent = window.navigator.userAgent.toLowerCase()
|
||||||
;
|
;
|
||||||
|
|
||||||
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
|
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
|
||||||
{
|
{
|
||||||
oLink = document.createElement('a');
|
oLink = window.document.createElement('a');
|
||||||
oLink['href'] = sLink;
|
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'])
|
if (oE && oE['initEvent'] && oLink['dispatchEvent'])
|
||||||
{
|
{
|
||||||
oE['initEvent']('click', true, true);
|
oE['initEvent']('click', true, true);
|
||||||
|
|
@ -100,86 +120,88 @@ AbstractApp.prototype.download = function (sLink)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
this.iframe.attr('src', sLink);
|
this.iframe.attr('src', sLink);
|
||||||
// window.document.location.href = sLink;
|
// window.document.location.href = sLink;
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {LinkBuilder}
|
* @return {LinkBuilder}
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.link = function ()
|
AbstractApp.prototype.link = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oLink)
|
if (null === this.oLink)
|
||||||
{
|
{
|
||||||
this.oLink = new LinkBuilder();
|
this.oLink = new LinkBuilder(); // TODO cjs
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oLink;
|
return this.oLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {LocalStorage}
|
* @return {LocalStorage}
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.local = function ()
|
AbstractApp.prototype.local = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oLocal)
|
if (null === this.oLocal)
|
||||||
{
|
{
|
||||||
this.oLocal = new LocalStorage();
|
this.oLocal = new LocalStorage(); // TODO cjs
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oLocal;
|
return this.oLocal;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @return {?}
|
* @return {?}
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.settingsGet = function (sName)
|
AbstractApp.prototype.settingsGet = function (sName)
|
||||||
{
|
{
|
||||||
if (null === this.oSettings)
|
if (null === this.oSettings)
|
||||||
{
|
{
|
||||||
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
|
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
|
return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @param {?} mValue
|
* @param {?} mValue
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.settingsSet = function (sName, mValue)
|
AbstractApp.prototype.settingsSet = function (sName, mValue)
|
||||||
{
|
{
|
||||||
if (null === this.oSettings)
|
if (null === this.oSettings)
|
||||||
{
|
{
|
||||||
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
|
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
this.oSettings[sName] = mValue;
|
this.oSettings[sName] = mValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractApp.prototype.setTitle = function (sTitle)
|
AbstractApp.prototype.setTitle = function (sTitle)
|
||||||
{
|
{
|
||||||
sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
|
sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
|
||||||
RL.settingsGet('Title') || '';
|
RL.settingsGet('Title') || ''; // TODO cjs
|
||||||
|
|
||||||
window.document.title = '_';
|
window.document.title = '_';
|
||||||
window.document.title = sTitle;
|
window.document.title = sTitle;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean=} bLogout = false
|
* @param {boolean=} bLogout = false
|
||||||
* @param {boolean=} bClose = false
|
* @param {boolean=} bClose = false
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
|
AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sCustomLogoutLink = Utils.pString(RL.settingsGet('CustomLogoutLink')),
|
sCustomLogoutLink = Utils.pString(RL.settingsGet('CustomLogoutLink')),
|
||||||
bInIframe = !!RL.settingsGet('InIframe')
|
bInIframe = !!RL.settingsGet('InIframe')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
// TODO cjs
|
||||||
|
|
||||||
bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
|
bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
|
||||||
bClose = Utils.isUnd(bClose) ? false : !!bClose;
|
bClose = Utils.isUnd(bClose) ? false : !!bClose;
|
||||||
|
|
||||||
|
|
@ -218,30 +240,30 @@ AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
|
||||||
}
|
}
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractApp.prototype.historyBack = function ()
|
AbstractApp.prototype.historyBack = function ()
|
||||||
{
|
{
|
||||||
window.history.back();
|
window.history.back();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sQuery
|
* @param {string} sQuery
|
||||||
* @param {Function} fCallback
|
* @param {Function} fCallback
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.getAutocomplete = function (sQuery, fCallback)
|
AbstractApp.prototype.getAutocomplete = function (sQuery, fCallback)
|
||||||
{
|
{
|
||||||
fCallback([], sQuery);
|
fCallback([], sQuery);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @param {Function} fFunc
|
* @param {Function} fFunc
|
||||||
* @param {Object=} oContext
|
* @param {Object=} oContext
|
||||||
* @return {AbstractApp}
|
* @return {AbstractApp}
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.sub = function (sName, fFunc, oContext)
|
AbstractApp.prototype.sub = function (sName, fFunc, oContext)
|
||||||
{
|
{
|
||||||
if (Utils.isUnd(this.oSubs[sName]))
|
if (Utils.isUnd(this.oSubs[sName]))
|
||||||
{
|
{
|
||||||
this.oSubs[sName] = [];
|
this.oSubs[sName] = [];
|
||||||
|
|
@ -250,15 +272,15 @@ AbstractApp.prototype.sub = function (sName, fFunc, oContext)
|
||||||
this.oSubs[sName].push([fFunc, oContext]);
|
this.oSubs[sName].push([fFunc, oContext]);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @param {Array=} aArgs
|
* @param {Array=} aArgs
|
||||||
* @return {AbstractApp}
|
* @return {AbstractApp}
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.pub = function (sName, aArgs)
|
AbstractApp.prototype.pub = function (sName, aArgs)
|
||||||
{
|
{
|
||||||
Plugins.runHook('rl-pub', [sName, aArgs]);
|
Plugins.runHook('rl-pub', [sName, aArgs]);
|
||||||
if (!Utils.isUnd(this.oSubs[sName]))
|
if (!Utils.isUnd(this.oSubs[sName]))
|
||||||
{
|
{
|
||||||
|
|
@ -271,21 +293,21 @@ AbstractApp.prototype.pub = function (sName, aArgs)
|
||||||
}
|
}
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
AbstractApp.prototype.capa = function (sName)
|
AbstractApp.prototype.capa = function (sName)
|
||||||
{
|
{
|
||||||
var mCapa = this.settingsGet('Capa');
|
var mCapa = this.settingsGet('Capa');
|
||||||
return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
|
return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractApp.prototype.bootstart = function ()
|
AbstractApp.prototype.bootstart = function ()
|
||||||
{
|
{
|
||||||
var self = this;
|
var ssm = require('../External/ssm.js');
|
||||||
|
|
||||||
Utils.initOnStartOrLangChange(function () {
|
Utils.initOnStartOrLangChange(function () {
|
||||||
Utils.initNotificationLanguage();
|
Utils.initNotificationLanguage();
|
||||||
|
|
@ -300,11 +322,11 @@ AbstractApp.prototype.bootstart = function ()
|
||||||
'maxWidth': 767,
|
'maxWidth': 767,
|
||||||
'onEnter': function() {
|
'onEnter': function() {
|
||||||
$html.addClass('ssm-state-mobile');
|
$html.addClass('ssm-state-mobile');
|
||||||
self.pub('ssm.mobile-enter');
|
RL.pub('ssm.mobile-enter');
|
||||||
},
|
},
|
||||||
'onLeave': function() {
|
'onLeave': function() {
|
||||||
$html.removeClass('ssm-state-mobile');
|
$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.data().leftPanelDisabled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
RL.sub('ssm.mobile-leave', function () {
|
RL.sub('ssm.mobile-leave', function () { // TODO cjs
|
||||||
RL.data().leftPanelDisabled(false);
|
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);
|
$html.toggleClass('rl-left-panel-disabled', bValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
ssm.ready();
|
ssm.ready();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = AbstractApp;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,65 +1,80 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends AbstractApp
|
* @extends AbstractApp
|
||||||
*/
|
*/
|
||||||
function AdminApp()
|
function AdminApp()
|
||||||
{
|
{
|
||||||
AbstractApp.call(this);
|
AbstractApp.call(this);
|
||||||
|
|
||||||
this.oData = null;
|
this.oData = null;
|
||||||
this.oRemote = null;
|
this.oRemote = null;
|
||||||
this.oCache = null;
|
this.oCache = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(AdminApp.prototype, AbstractApp.prototype);
|
_.extend(AdminApp.prototype, AbstractApp.prototype);
|
||||||
|
|
||||||
AdminApp.prototype.oData = null;
|
AdminApp.prototype.oData = null;
|
||||||
AdminApp.prototype.oRemote = null;
|
AdminApp.prototype.oRemote = null;
|
||||||
AdminApp.prototype.oCache = null;
|
AdminApp.prototype.oCache = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {AdminDataStorage}
|
* @return {AdminDataStorage}
|
||||||
*/
|
*/
|
||||||
AdminApp.prototype.data = function ()
|
AdminApp.prototype.data = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oData)
|
if (null === this.oData)
|
||||||
{
|
{
|
||||||
this.oData = new AdminDataStorage();
|
this.oData = new AdminDataStorage(); // TODO cjs
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oData;
|
return this.oData;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {AdminAjaxRemoteStorage}
|
* @return {AdminAjaxRemoteStorage}
|
||||||
*/
|
*/
|
||||||
AdminApp.prototype.remote = function ()
|
AdminApp.prototype.remote = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oRemote)
|
if (null === this.oRemote)
|
||||||
{
|
{
|
||||||
this.oRemote = new AdminAjaxRemoteStorage();
|
this.oRemote = new AdminAjaxRemoteStorage(); // TODO cjs
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oRemote;
|
return this.oRemote;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {AdminCacheStorage}
|
* @return {AdminCacheStorage}
|
||||||
*/
|
*/
|
||||||
AdminApp.prototype.cache = function ()
|
AdminApp.prototype.cache = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oCache)
|
if (null === this.oCache)
|
||||||
{
|
{
|
||||||
this.oCache = new AdminCacheStorage();
|
this.oCache = new AdminCacheStorage(); // TODO cjs
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oCache;
|
return this.oCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminApp.prototype.reloadDomainList = function ()
|
AdminApp.prototype.reloadDomainList = function ()
|
||||||
{
|
{
|
||||||
|
// TODO cjs
|
||||||
RL.data().domainsLoading(true);
|
RL.data().domainsLoading(true);
|
||||||
RL.remote().domainList(function (sResult, oData) {
|
RL.remote().domainList(function (sResult, oData) {
|
||||||
RL.data().domainsLoading(false);
|
RL.data().domainsLoading(false);
|
||||||
|
|
@ -76,10 +91,11 @@ AdminApp.prototype.reloadDomainList = function ()
|
||||||
RL.data().domains(aList);
|
RL.data().domains(aList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminApp.prototype.reloadPluginList = function ()
|
AdminApp.prototype.reloadPluginList = function ()
|
||||||
{
|
{
|
||||||
|
// TODO cjs
|
||||||
RL.data().pluginsLoading(true);
|
RL.data().pluginsLoading(true);
|
||||||
RL.remote().pluginList(function (sResult, oData) {
|
RL.remote().pluginList(function (sResult, oData) {
|
||||||
RL.data().pluginsLoading(false);
|
RL.data().pluginsLoading(false);
|
||||||
|
|
@ -96,10 +112,11 @@ AdminApp.prototype.reloadPluginList = function ()
|
||||||
RL.data().plugins(aList);
|
RL.data().plugins(aList);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminApp.prototype.reloadPackagesList = function ()
|
AdminApp.prototype.reloadPackagesList = function ()
|
||||||
{
|
{
|
||||||
|
// TODO cjs
|
||||||
RL.data().packagesLoading(true);
|
RL.data().packagesLoading(true);
|
||||||
RL.data().packagesReal(true);
|
RL.data().packagesReal(true);
|
||||||
|
|
||||||
|
|
@ -143,10 +160,11 @@ AdminApp.prototype.reloadPackagesList = function ()
|
||||||
RL.data().packagesReal(false);
|
RL.data().packagesReal(false);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminApp.prototype.updateCoreData = function ()
|
AdminApp.prototype.updateCoreData = function ()
|
||||||
{
|
{
|
||||||
|
// TODO cjs
|
||||||
var oRainData = RL.data();
|
var oRainData = RL.data();
|
||||||
|
|
||||||
oRainData.coreUpdating(true);
|
oRainData.coreUpdating(true);
|
||||||
|
|
@ -168,10 +186,10 @@ AdminApp.prototype.updateCoreData = function ()
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminApp.prototype.reloadCoreData = function ()
|
AdminApp.prototype.reloadCoreData = function ()
|
||||||
{
|
{
|
||||||
var oRainData = RL.data();
|
var oRainData = RL.data();
|
||||||
|
|
||||||
oRainData.coreChecking(true);
|
oRainData.coreChecking(true);
|
||||||
|
|
@ -198,16 +216,17 @@ AdminApp.prototype.reloadCoreData = function ()
|
||||||
oRainData.coreVersionCompare(-2);
|
oRainData.coreVersionCompare(-2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param {boolean=} bForce = false
|
* @param {boolean=} bForce = false
|
||||||
*/
|
*/
|
||||||
AdminApp.prototype.reloadLicensing = function (bForce)
|
AdminApp.prototype.reloadLicensing = function (bForce)
|
||||||
{
|
{
|
||||||
bForce = Utils.isUnd(bForce) ? false : !!bForce;
|
bForce = Utils.isUnd(bForce) ? false : !!bForce;
|
||||||
|
|
||||||
|
// TODO cjs
|
||||||
RL.data().licensingProcess(true);
|
RL.data().licensingProcess(true);
|
||||||
RL.data().licenseError('');
|
RL.data().licenseError('');
|
||||||
|
|
||||||
|
|
@ -245,10 +264,10 @@ AdminApp.prototype.reloadLicensing = function (bForce)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, bForce);
|
}, bForce);
|
||||||
};
|
};
|
||||||
|
|
||||||
AdminApp.prototype.bootstart = function ()
|
AdminApp.prototype.bootstart = function ()
|
||||||
{
|
{
|
||||||
AbstractApp.prototype.bootstart.call(this);
|
AbstractApp.prototype.bootstart.call(this);
|
||||||
|
|
||||||
RL.data().populateDataOnStart();
|
RL.data().populateDataOnStart();
|
||||||
|
|
@ -267,7 +286,7 @@ AdminApp.prototype.bootstart = function ()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Utils.removeSettingsViewModel(AdminAbout);
|
// Utils.removeSettingsViewModel(AdminAbout);
|
||||||
|
|
||||||
if (!RL.capa(Enums.Capa.Prem))
|
if (!RL.capa(Enums.Capa.Prem))
|
||||||
{
|
{
|
||||||
|
|
@ -276,11 +295,11 @@ AdminApp.prototype.bootstart = function ()
|
||||||
|
|
||||||
if (!!RL.settingsGet('Auth'))
|
if (!!RL.settingsGet('Auth'))
|
||||||
{
|
{
|
||||||
// TODO
|
// TODO
|
||||||
// if (!RL.settingsGet('AllowPackages') && AdminPackages)
|
// if (!RL.settingsGet('AllowPackages') && AdminPackages)
|
||||||
// {
|
// {
|
||||||
// Utils.disableSettingsViewModel(AdminPackages);
|
// Utils.disableSettingsViewModel(AdminPackages);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
kn.startScreens([AdminSettingsScreen]);
|
kn.startScreens([AdminSettingsScreen]);
|
||||||
}
|
}
|
||||||
|
|
@ -294,9 +313,8 @@ AdminApp.prototype.bootstart = function ()
|
||||||
{
|
{
|
||||||
window.SimplePace.set(100);
|
window.SimplePace.set(100);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
module.exports = new AdminApp();
|
||||||
* @type {AdminApp}
|
|
||||||
*/
|
}(module));
|
||||||
RL = new AdminApp();
|
|
||||||
|
|
@ -1,11 +1,28 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends AbstractApp
|
* @extends AbstractApp
|
||||||
*/
|
*/
|
||||||
function RainLoopApp()
|
function RainLoopApp()
|
||||||
{
|
{
|
||||||
AbstractApp.call(this);
|
AbstractApp.call(this);
|
||||||
|
|
||||||
this.oData = null;
|
this.oData = null;
|
||||||
|
|
@ -63,69 +80,69 @@ function RainLoopApp()
|
||||||
}
|
}
|
||||||
}, RL.settingsGet('Version'));
|
}, RL.settingsGet('Version'));
|
||||||
}, {}, 60 * 60 * 1000);
|
}, {}, 60 * 60 * 1000);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(RainLoopApp.prototype, AbstractApp.prototype);
|
_.extend(RainLoopApp.prototype, AbstractApp.prototype);
|
||||||
|
|
||||||
RainLoopApp.prototype.oData = null;
|
RainLoopApp.prototype.oData = null;
|
||||||
RainLoopApp.prototype.oRemote = null;
|
RainLoopApp.prototype.oRemote = null;
|
||||||
RainLoopApp.prototype.oCache = null;
|
RainLoopApp.prototype.oCache = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {WebMailDataStorage}
|
* @return {WebMailDataStorage}
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.data = function ()
|
RainLoopApp.prototype.data = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oData)
|
if (null === this.oData)
|
||||||
{
|
{
|
||||||
this.oData = new WebMailDataStorage();
|
this.oData = new WebMailDataStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oData;
|
return this.oData;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {WebMailAjaxRemoteStorage}
|
* @return {WebMailAjaxRemoteStorage}
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.remote = function ()
|
RainLoopApp.prototype.remote = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oRemote)
|
if (null === this.oRemote)
|
||||||
{
|
{
|
||||||
this.oRemote = new WebMailAjaxRemoteStorage();
|
this.oRemote = new WebMailAjaxRemoteStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oRemote;
|
return this.oRemote;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {WebMailCacheStorage}
|
* @return {WebMailCacheStorage}
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.cache = function ()
|
RainLoopApp.prototype.cache = function ()
|
||||||
{
|
{
|
||||||
if (null === this.oCache)
|
if (null === this.oCache)
|
||||||
{
|
{
|
||||||
this.oCache = new WebMailCacheStorage();
|
this.oCache = new WebMailCacheStorage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.oCache;
|
return this.oCache;
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
|
RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
|
||||||
{
|
{
|
||||||
var oCache = RL.cache();
|
var oCache = RL.cache();
|
||||||
_.each(RL.data().messageList(), function (oMessage) {
|
_.each(RL.data().messageList(), function (oMessage) {
|
||||||
oCache.initMessageFlagsFromCache(oMessage);
|
oCache.initMessageFlagsFromCache(oMessage);
|
||||||
});
|
});
|
||||||
|
|
||||||
oCache.initMessageFlagsFromCache(RL.data().message());
|
oCache.initMessageFlagsFromCache(RL.data().message());
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean=} bDropPagePosition = false
|
* @param {boolean=} bDropPagePosition = false
|
||||||
* @param {boolean=} bDropCurrenFolderCache = false
|
* @param {boolean=} bDropCurrenFolderCache = false
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache)
|
RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oRLData = RL.data(),
|
oRLData = RL.data(),
|
||||||
iOffset = (oRLData.messageListPage() - 1) * oRLData.messagesPerPage()
|
iOffset = (oRLData.messageListPage() - 1) * oRLData.messagesPerPage()
|
||||||
|
|
@ -166,24 +183,24 @@ RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurr
|
||||||
}
|
}
|
||||||
|
|
||||||
}, oRLData.currentFolderFullNameRaw(), iOffset, oRLData.messagesPerPage(), oRLData.messageListSearch());
|
}, oRLData.currentFolderFullNameRaw(), iOffset, oRLData.messagesPerPage(), oRLData.messageListSearch());
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.recacheInboxMessageList = function ()
|
RainLoopApp.prototype.recacheInboxMessageList = function ()
|
||||||
{
|
{
|
||||||
RL.remote().messageList(Utils.emptyFunction, 'INBOX', 0, RL.data().messagesPerPage(), '', true);
|
RL.remote().messageList(Utils.emptyFunction, 'INBOX', 0, RL.data().messagesPerPage(), '', true);
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
|
RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
|
||||||
{
|
{
|
||||||
RL.reloadMessageList(bEmptyList);
|
RL.reloadMessageList(bEmptyList);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} fResultFunc
|
* @param {Function} fResultFunc
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.contactsSync = function (fResultFunc)
|
RainLoopApp.prototype.contactsSync = function (fResultFunc)
|
||||||
{
|
{
|
||||||
var oContacts = RL.data().contacts;
|
var oContacts = RL.data().contacts;
|
||||||
if (oContacts.importing() || oContacts.syncing() || !RL.data().enableContactsSync() || !RL.data().allowContactsSync())
|
if (oContacts.importing() || oContacts.syncing() || !RL.data().enableContactsSync() || !RL.data().allowContactsSync())
|
||||||
{
|
{
|
||||||
|
|
@ -203,10 +220,10 @@ RainLoopApp.prototype.contactsSync = function (fResultFunc)
|
||||||
});
|
});
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.messagesMoveTrigger = function ()
|
RainLoopApp.prototype.messagesMoveTrigger = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
sSpamFolder = RL.data().spamFolder()
|
sSpamFolder = RL.data().spamFolder()
|
||||||
|
|
@ -224,10 +241,10 @@ RainLoopApp.prototype.messagesMoveTrigger = function ()
|
||||||
});
|
});
|
||||||
|
|
||||||
this.oMoveCache = {};
|
this.oMoveCache = {};
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForMove)
|
RainLoopApp.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForMove)
|
||||||
{
|
{
|
||||||
var sH = '$$' + sFromFolderFullNameRaw + '$$' + sToFolderFullNameRaw + '$$';
|
var sH = '$$' + sFromFolderFullNameRaw + '$$' + sToFolderFullNameRaw + '$$';
|
||||||
if (!this.oMoveCache[sH])
|
if (!this.oMoveCache[sH])
|
||||||
{
|
{
|
||||||
|
|
@ -240,29 +257,29 @@ RainLoopApp.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sTo
|
||||||
|
|
||||||
this.oMoveCache[sH]['Uid'] = _.union(this.oMoveCache[sH]['Uid'], aUidForMove);
|
this.oMoveCache[sH]['Uid'] = _.union(this.oMoveCache[sH]['Uid'], aUidForMove);
|
||||||
this.messagesMoveTrigger();
|
this.messagesMoveTrigger();
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.messagesCopyHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForCopy)
|
RainLoopApp.prototype.messagesCopyHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForCopy)
|
||||||
{
|
{
|
||||||
RL.remote().messagesCopy(
|
RL.remote().messagesCopy(
|
||||||
this.moveOrDeleteResponseHelper,
|
this.moveOrDeleteResponseHelper,
|
||||||
sFromFolderFullNameRaw,
|
sFromFolderFullNameRaw,
|
||||||
sToFolderFullNameRaw,
|
sToFolderFullNameRaw,
|
||||||
aUidForCopy
|
aUidForCopy
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove)
|
RainLoopApp.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove)
|
||||||
{
|
{
|
||||||
RL.remote().messagesDelete(
|
RL.remote().messagesDelete(
|
||||||
this.moveOrDeleteResponseHelper,
|
this.moveOrDeleteResponseHelper,
|
||||||
sFromFolderFullNameRaw,
|
sFromFolderFullNameRaw,
|
||||||
aUidForRemove
|
aUidForRemove
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
|
RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
|
||||||
{
|
{
|
||||||
if (Enums.StorageResultType.Success === sResult && RL.data().currentFolder())
|
if (Enums.StorageResultType.Success === sResult && RL.data().currentFolder())
|
||||||
{
|
{
|
||||||
if (oData && Utils.isArray(oData.Result) && 2 === oData.Result.length)
|
if (oData && Utils.isArray(oData.Result) && 2 === oData.Result.length)
|
||||||
|
|
@ -283,26 +300,26 @@ RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
|
||||||
RL.reloadMessageListHelper(0 === RL.data().messageList().length);
|
RL.reloadMessageListHelper(0 === RL.data().messageList().length);
|
||||||
RL.quotaDebounce();
|
RL.quotaDebounce();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sFromFolderFullNameRaw
|
* @param {string} sFromFolderFullNameRaw
|
||||||
* @param {Array} aUidForRemove
|
* @param {Array} aUidForRemove
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove)
|
RainLoopApp.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove)
|
||||||
{
|
{
|
||||||
this.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
|
this.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
|
||||||
RL.data().removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
|
RL.data().removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} iDeleteType
|
* @param {number} iDeleteType
|
||||||
* @param {string} sFromFolderFullNameRaw
|
* @param {string} sFromFolderFullNameRaw
|
||||||
* @param {Array} aUidForRemove
|
* @param {Array} aUidForRemove
|
||||||
* @param {boolean=} bUseFolder = true
|
* @param {boolean=} bUseFolder = true
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFolderFullNameRaw, aUidForRemove, bUseFolder)
|
RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFolderFullNameRaw, aUidForRemove, bUseFolder)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
oData = RL.data(),
|
oData = RL.data(),
|
||||||
|
|
@ -360,16 +377,16 @@ RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFol
|
||||||
this.messagesMoveHelper(sFromFolderFullNameRaw, oMoveFolder.fullNameRaw, aUidForRemove);
|
this.messagesMoveHelper(sFromFolderFullNameRaw, oMoveFolder.fullNameRaw, aUidForRemove);
|
||||||
oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oMoveFolder.fullNameRaw);
|
oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oMoveFolder.fullNameRaw);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sFromFolderFullNameRaw
|
* @param {string} sFromFolderFullNameRaw
|
||||||
* @param {Array} aUidForMove
|
* @param {Array} aUidForMove
|
||||||
* @param {string} sToFolderFullNameRaw
|
* @param {string} sToFolderFullNameRaw
|
||||||
* @param {boolean=} bCopy = false
|
* @param {boolean=} bCopy = false
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy)
|
RainLoopApp.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy)
|
||||||
{
|
{
|
||||||
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForMove) && 0 < aUidForMove.length)
|
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForMove) && 0 < aUidForMove.length)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -394,13 +411,13 @@ RainLoopApp.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, a
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function=} fCallback
|
* @param {Function=} fCallback
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.folders = function (fCallback)
|
RainLoopApp.prototype.folders = function (fCallback)
|
||||||
{
|
{
|
||||||
this.data().foldersLoading(true);
|
this.data().foldersLoading(true);
|
||||||
this.remote().folders(_.bind(function (sResult, oData) {
|
this.remote().folders(_.bind(function (sResult, oData) {
|
||||||
|
|
||||||
|
|
@ -421,10 +438,10 @@ RainLoopApp.prototype.folders = function (fCallback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, this));
|
}, this));
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
||||||
{
|
{
|
||||||
if (RL.data().capaOpenPGP())
|
if (RL.data().capaOpenPGP())
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -464,10 +481,10 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
|
||||||
|
|
||||||
RL.data().openpgpkeys(aKeys);
|
RL.data().openpgpkeys(aKeys);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.accountsAndIdentities = function ()
|
RainLoopApp.prototype.accountsAndIdentities = function ()
|
||||||
{
|
{
|
||||||
var oRainLoopData = RL.data();
|
var oRainLoopData = RL.data();
|
||||||
|
|
||||||
oRainLoopData.accountsLoading(true);
|
oRainLoopData.accountsLoading(true);
|
||||||
|
|
@ -513,10 +530,10 @@ RainLoopApp.prototype.accountsAndIdentities = function ()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.quota = function ()
|
RainLoopApp.prototype.quota = function ()
|
||||||
{
|
{
|
||||||
this.remote().quota(function (sResult, oData) {
|
this.remote().quota(function (sResult, oData) {
|
||||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
|
if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
|
||||||
Utils.isArray(oData.Result) && 1 < oData.Result.length &&
|
Utils.isArray(oData.Result) && 1 < oData.Result.length &&
|
||||||
|
|
@ -526,14 +543,14 @@ RainLoopApp.prototype.quota = function ()
|
||||||
RL.data().userUsageSize(Utils.pInt(oData.Result[0]) * 1024);
|
RL.data().userUsageSize(Utils.pInt(oData.Result[0]) * 1024);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sFolder
|
* @param {string} sFolder
|
||||||
* @param {Array=} aList = []
|
* @param {Array=} aList = []
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
|
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
|
||||||
{
|
{
|
||||||
if ('' !== Utils.trim(sFolder))
|
if ('' !== Utils.trim(sFolder))
|
||||||
{
|
{
|
||||||
this.remote().folderInformation(function (sResult, oData) {
|
this.remote().folderInformation(function (sResult, oData) {
|
||||||
|
|
@ -630,13 +647,13 @@ RainLoopApp.prototype.folderInformation = function (sFolder, aList)
|
||||||
}
|
}
|
||||||
}, sFolder, aList);
|
}, sFolder, aList);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean=} bBoot = false
|
* @param {boolean=} bBoot = false
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
|
RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
|
||||||
{
|
{
|
||||||
bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
|
bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|
@ -718,10 +735,10 @@ RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
|
||||||
}
|
}
|
||||||
}, aFolders);
|
}, aFolders);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.setMessageSeen = function (oMessage)
|
RainLoopApp.prototype.setMessageSeen = function (oMessage)
|
||||||
{
|
{
|
||||||
if (oMessage.unseen())
|
if (oMessage.unseen())
|
||||||
{
|
{
|
||||||
oMessage.unseen(false);
|
oMessage.unseen(false);
|
||||||
|
|
@ -738,28 +755,28 @@ RainLoopApp.prototype.setMessageSeen = function (oMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
RL.remote().messageSetSeen(Utils.emptyFunction, oMessage.folderFullNameRaw, [oMessage.uid], true);
|
RL.remote().messageSetSeen(Utils.emptyFunction, oMessage.folderFullNameRaw, [oMessage.uid], true);
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.googleConnect = function ()
|
RainLoopApp.prototype.googleConnect = function ()
|
||||||
{
|
{
|
||||||
window.open(RL.link().socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
window.open(RL.link().socialGoogle(), 'Google', 'left=200,top=100,width=650,height=600,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.twitterConnect = function ()
|
RainLoopApp.prototype.twitterConnect = function ()
|
||||||
{
|
{
|
||||||
window.open(RL.link().socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
window.open(RL.link().socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=350,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.facebookConnect = function ()
|
RainLoopApp.prototype.facebookConnect = function ()
|
||||||
{
|
{
|
||||||
window.open(RL.link().socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
window.open(RL.link().socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean=} bFireAllActions
|
* @param {boolean=} bFireAllActions
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.socialUsers = function (bFireAllActions)
|
RainLoopApp.prototype.socialUsers = function (bFireAllActions)
|
||||||
{
|
{
|
||||||
var oRainLoopData = RL.data();
|
var oRainLoopData = RL.data();
|
||||||
|
|
||||||
if (bFireAllActions)
|
if (bFireAllActions)
|
||||||
|
|
@ -792,33 +809,33 @@ RainLoopApp.prototype.socialUsers = function (bFireAllActions)
|
||||||
oRainLoopData.facebookActions(false);
|
oRainLoopData.facebookActions(false);
|
||||||
oRainLoopData.twitterActions(false);
|
oRainLoopData.twitterActions(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.googleDisconnect = function ()
|
RainLoopApp.prototype.googleDisconnect = function ()
|
||||||
{
|
{
|
||||||
RL.data().googleActions(true);
|
RL.data().googleActions(true);
|
||||||
RL.remote().googleDisconnect(function () {
|
RL.remote().googleDisconnect(function () {
|
||||||
RL.socialUsers();
|
RL.socialUsers();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.facebookDisconnect = function ()
|
RainLoopApp.prototype.facebookDisconnect = function ()
|
||||||
{
|
{
|
||||||
RL.data().facebookActions(true);
|
RL.data().facebookActions(true);
|
||||||
RL.remote().facebookDisconnect(function () {
|
RL.remote().facebookDisconnect(function () {
|
||||||
RL.socialUsers();
|
RL.socialUsers();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.twitterDisconnect = function ()
|
RainLoopApp.prototype.twitterDisconnect = function ()
|
||||||
{
|
{
|
||||||
RL.data().twitterActions(true);
|
RL.data().twitterActions(true);
|
||||||
RL.remote().twitterDisconnect(function () {
|
RL.remote().twitterDisconnect(function () {
|
||||||
RL.socialUsers();
|
RL.socialUsers();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} aSystem
|
* @param {Array} aSystem
|
||||||
* @param {Array} aList
|
* @param {Array} aList
|
||||||
* @param {Array=} aDisabled
|
* @param {Array=} aDisabled
|
||||||
|
|
@ -831,8 +848,8 @@ RainLoopApp.prototype.twitterDisconnect = function ()
|
||||||
* @param {boolean=} bBuildUnvisible
|
* @param {boolean=} bBuildUnvisible
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.folderListOptionsBuilder = function (aSystem, aList, aDisabled, aHeaderLines, iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)
|
RainLoopApp.prototype.folderListOptionsBuilder = function (aSystem, aList, aDisabled, aHeaderLines, iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
iLen = 0,
|
iLen = 0,
|
||||||
|
|
@ -945,14 +962,14 @@ RainLoopApp.prototype.folderListOptionsBuilder = function (aSystem, aList, aDisa
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult;
|
return aResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sQuery
|
* @param {string} sQuery
|
||||||
* @param {Function} fCallback
|
* @param {Function} fCallback
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
|
RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aData = []
|
aData = []
|
||||||
;
|
;
|
||||||
|
|
@ -972,25 +989,25 @@ RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
}, sQuery);
|
}, sQuery);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sQuery
|
* @param {string} sQuery
|
||||||
* @param {Function} fCallback
|
* @param {Function} fCallback
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.getContactTagsAutocomplete = function (sQuery, fCallback)
|
RainLoopApp.prototype.getContactTagsAutocomplete = function (sQuery, fCallback)
|
||||||
{
|
{
|
||||||
fCallback(_.filter(RL.data().contactTags(), function (oContactTag) {
|
fCallback(_.filter(RL.data().contactTags(), function (oContactTag) {
|
||||||
return oContactTag && oContactTag.filterHelper(sQuery);
|
return oContactTag && oContactTag.filterHelper(sQuery);
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sMailToUrl
|
* @param {string} sMailToUrl
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
|
RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
|
||||||
{
|
{
|
||||||
if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase())
|
if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase())
|
||||||
{
|
{
|
||||||
sMailToUrl = sMailToUrl.toString().substr(7);
|
sMailToUrl = sMailToUrl.toString().substr(7);
|
||||||
|
|
@ -1018,10 +1035,10 @@ RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
RainLoopApp.prototype.bootstart = function ()
|
RainLoopApp.prototype.bootstart = function ()
|
||||||
{
|
{
|
||||||
RL.pub('rl.bootstart');
|
RL.pub('rl.bootstart');
|
||||||
AbstractApp.prototype.bootstart.call(this);
|
AbstractApp.prototype.bootstart.call(this);
|
||||||
|
|
||||||
|
|
@ -1285,9 +1302,8 @@ RainLoopApp.prototype.bootstart = function ()
|
||||||
|
|
||||||
Plugins.runHook('rl-start-screens');
|
Plugins.runHook('rl-start-screens');
|
||||||
RL.pub('rl.bootstart-end');
|
RL.pub('rl.bootstart-end');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
module.exports = new RainLoopApp();
|
||||||
* @type {RainLoopApp}
|
|
||||||
*/
|
}(module));
|
||||||
RL = new RainLoopApp();
|
|
||||||
|
|
@ -1,8 +1,12 @@
|
||||||
/*jslint bitwise: true*/
|
|
||||||
// Base64 encode / decode
|
// Base64 encode / decode
|
||||||
// http://www.webtoolkit.info/
|
// http://www.webtoolkit.info/
|
||||||
|
|
||||||
Base64 = {
|
(function (module) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
/*jslint bitwise: true*/
|
||||||
|
var Base64 = {
|
||||||
|
|
||||||
// private property
|
// private property
|
||||||
_keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
_keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
|
||||||
|
|
@ -159,6 +163,9 @@ Base64 = {
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/*jslint bitwise: false*/
|
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,36 +1,42 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||||
|
|
||||||
/**
|
(function (module) {
|
||||||
|
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
var Enums = {};
|
||||||
|
|
||||||
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.StorageResultType = {
|
Enums.StorageResultType = {
|
||||||
'Success': 'success',
|
'Success': 'success',
|
||||||
'Abort': 'abort',
|
'Abort': 'abort',
|
||||||
'Error': 'error',
|
'Error': 'error',
|
||||||
'Unload': 'unload'
|
'Unload': 'unload'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.State = {
|
Enums.State = {
|
||||||
'Empty': 10,
|
'Empty': 10,
|
||||||
'Login': 20,
|
'Login': 20,
|
||||||
'Auth': 30
|
'Auth': 30
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.StateType = {
|
Enums.StateType = {
|
||||||
'Webmail': 0,
|
'Webmail': 0,
|
||||||
'Admin': 1
|
'Admin': 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.Capa = {
|
Enums.Capa = {
|
||||||
'Prem': 'PREM',
|
'Prem': 'PREM',
|
||||||
'TwoFactor': 'TWO_FACTOR',
|
'TwoFactor': 'TWO_FACTOR',
|
||||||
'OpenPGP': 'OPEN_PGP',
|
'OpenPGP': 'OPEN_PGP',
|
||||||
|
|
@ -40,12 +46,12 @@ Enums.Capa = {
|
||||||
'Filters': 'FILTERS',
|
'Filters': 'FILTERS',
|
||||||
'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
|
'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
|
||||||
'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
|
'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.KeyState = {
|
Enums.KeyState = {
|
||||||
'All': 'all',
|
'All': 'all',
|
||||||
'None': 'none',
|
'None': 'none',
|
||||||
'ContactList': 'contact-list',
|
'ContactList': 'contact-list',
|
||||||
|
|
@ -58,12 +64,12 @@ Enums.KeyState = {
|
||||||
'PopupComposeOpenPGP': 'compose-open-pgp',
|
'PopupComposeOpenPGP': 'compose-open-pgp',
|
||||||
'PopupKeyboardShortcutsHelp': 'popup-keyboard-shortcuts-help',
|
'PopupKeyboardShortcutsHelp': 'popup-keyboard-shortcuts-help',
|
||||||
'PopupAsk': 'popup-ask'
|
'PopupAsk': 'popup-ask'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.FolderType = {
|
Enums.FolderType = {
|
||||||
'Inbox': 10,
|
'Inbox': 10,
|
||||||
'SentItems': 11,
|
'SentItems': 11,
|
||||||
'Draft': 12,
|
'Draft': 12,
|
||||||
|
|
@ -72,30 +78,30 @@ Enums.FolderType = {
|
||||||
'Archive': 15,
|
'Archive': 15,
|
||||||
'NotSpam': 80,
|
'NotSpam': 80,
|
||||||
'User': 99
|
'User': 99
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.LoginSignMeTypeAsString = {
|
Enums.LoginSignMeTypeAsString = {
|
||||||
'DefaultOff': 'defaultoff',
|
'DefaultOff': 'defaultoff',
|
||||||
'DefaultOn': 'defaulton',
|
'DefaultOn': 'defaulton',
|
||||||
'Unused': 'unused'
|
'Unused': 'unused'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.LoginSignMeType = {
|
Enums.LoginSignMeType = {
|
||||||
'DefaultOff': 0,
|
'DefaultOff': 0,
|
||||||
'DefaultOn': 1,
|
'DefaultOn': 1,
|
||||||
'Unused': 2
|
'Unused': 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.ComposeType = {
|
Enums.ComposeType = {
|
||||||
'Empty': 'empty',
|
'Empty': 'empty',
|
||||||
'Reply': 'reply',
|
'Reply': 'reply',
|
||||||
'ReplyAll': 'replyall',
|
'ReplyAll': 'replyall',
|
||||||
|
|
@ -103,12 +109,12 @@ Enums.ComposeType = {
|
||||||
'ForwardAsAttachment': 'forward-as-attachment',
|
'ForwardAsAttachment': 'forward-as-attachment',
|
||||||
'Draft': 'draft',
|
'Draft': 'draft',
|
||||||
'EditAsNew': 'editasnew'
|
'EditAsNew': 'editasnew'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.UploadErrorCode = {
|
Enums.UploadErrorCode = {
|
||||||
'Normal': 0,
|
'Normal': 0,
|
||||||
'FileIsTooBig': 1,
|
'FileIsTooBig': 1,
|
||||||
'FilePartiallyUploaded': 2,
|
'FilePartiallyUploaded': 2,
|
||||||
|
|
@ -117,35 +123,35 @@ Enums.UploadErrorCode = {
|
||||||
'FileOnSaveingError': 5,
|
'FileOnSaveingError': 5,
|
||||||
'FileType': 98,
|
'FileType': 98,
|
||||||
'Unknown': 99
|
'Unknown': 99
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.SetSystemFoldersNotification = {
|
Enums.SetSystemFoldersNotification = {
|
||||||
'None': 0,
|
'None': 0,
|
||||||
'Sent': 1,
|
'Sent': 1,
|
||||||
'Draft': 2,
|
'Draft': 2,
|
||||||
'Spam': 3,
|
'Spam': 3,
|
||||||
'Trash': 4,
|
'Trash': 4,
|
||||||
'Archive': 5
|
'Archive': 5
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.ClientSideKeyName = {
|
Enums.ClientSideKeyName = {
|
||||||
'FoldersLashHash': 0,
|
'FoldersLashHash': 0,
|
||||||
'MessagesInboxLastHash': 1,
|
'MessagesInboxLastHash': 1,
|
||||||
'MailBoxListSize': 2,
|
'MailBoxListSize': 2,
|
||||||
'ExpandedFolders': 3,
|
'ExpandedFolders': 3,
|
||||||
'FolderListSize': 4
|
'FolderListSize': 4
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.EventKeyCode = {
|
Enums.EventKeyCode = {
|
||||||
'Backspace': 8,
|
'Backspace': 8,
|
||||||
'Tab': 9,
|
'Tab': 9,
|
||||||
'Enter': 13,
|
'Enter': 13,
|
||||||
|
|
@ -163,22 +169,22 @@ Enums.EventKeyCode = {
|
||||||
'Delete': 46,
|
'Delete': 46,
|
||||||
'A': 65,
|
'A': 65,
|
||||||
'S': 83
|
'S': 83
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.MessageSetAction = {
|
Enums.MessageSetAction = {
|
||||||
'SetSeen': 0,
|
'SetSeen': 0,
|
||||||
'UnsetSeen': 1,
|
'UnsetSeen': 1,
|
||||||
'SetFlag': 2,
|
'SetFlag': 2,
|
||||||
'UnsetFlag': 3
|
'UnsetFlag': 3
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.MessageSelectAction = {
|
Enums.MessageSelectAction = {
|
||||||
'All': 0,
|
'All': 0,
|
||||||
'None': 1,
|
'None': 1,
|
||||||
'Invert': 2,
|
'Invert': 2,
|
||||||
|
|
@ -186,153 +192,153 @@ Enums.MessageSelectAction = {
|
||||||
'Seen': 4,
|
'Seen': 4,
|
||||||
'Flagged': 5,
|
'Flagged': 5,
|
||||||
'Unflagged': 6
|
'Unflagged': 6
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.DesktopNotifications = {
|
Enums.DesktopNotifications = {
|
||||||
'Allowed': 0,
|
'Allowed': 0,
|
||||||
'NotAllowed': 1,
|
'NotAllowed': 1,
|
||||||
'Denied': 2,
|
'Denied': 2,
|
||||||
'NotSupported': 9
|
'NotSupported': 9
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.MessagePriority = {
|
Enums.MessagePriority = {
|
||||||
'Low': 5,
|
'Low': 5,
|
||||||
'Normal': 3,
|
'Normal': 3,
|
||||||
'High': 1
|
'High': 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.EditorDefaultType = {
|
Enums.EditorDefaultType = {
|
||||||
'Html': 'Html',
|
'Html': 'Html',
|
||||||
'Plain': 'Plain'
|
'Plain': 'Plain'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.CustomThemeType = {
|
Enums.CustomThemeType = {
|
||||||
'Light': 'Light',
|
'Light': 'Light',
|
||||||
'Dark': 'Dark'
|
'Dark': 'Dark'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.ServerSecure = {
|
Enums.ServerSecure = {
|
||||||
'None': 0,
|
'None': 0,
|
||||||
'SSL': 1,
|
'SSL': 1,
|
||||||
'TLS': 2
|
'TLS': 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.SearchDateType = {
|
Enums.SearchDateType = {
|
||||||
'All': -1,
|
'All': -1,
|
||||||
'Days3': 3,
|
'Days3': 3,
|
||||||
'Days7': 7,
|
'Days7': 7,
|
||||||
'Month': 30
|
'Month': 30
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.EmailType = {
|
Enums.EmailType = {
|
||||||
'Defailt': 0,
|
'Defailt': 0,
|
||||||
'Facebook': 1,
|
'Facebook': 1,
|
||||||
'Google': 2
|
'Google': 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.SaveSettingsStep = {
|
Enums.SaveSettingsStep = {
|
||||||
'Animate': -2,
|
'Animate': -2,
|
||||||
'Idle': -1,
|
'Idle': -1,
|
||||||
'TrueResult': 1,
|
'TrueResult': 1,
|
||||||
'FalseResult': 0
|
'FalseResult': 0
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.InterfaceAnimation = {
|
Enums.InterfaceAnimation = {
|
||||||
'None': 'None',
|
'None': 'None',
|
||||||
'Normal': 'Normal',
|
'Normal': 'Normal',
|
||||||
'Full': 'Full'
|
'Full': 'Full'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.Layout = {
|
Enums.Layout = {
|
||||||
'NoPreview': 0,
|
'NoPreview': 0,
|
||||||
'SidePreview': 1,
|
'SidePreview': 1,
|
||||||
'BottomPreview': 2
|
'BottomPreview': 2
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionField = {
|
Enums.FilterConditionField = {
|
||||||
'From': 'From',
|
'From': 'From',
|
||||||
'To': 'To',
|
'To': 'To',
|
||||||
'Recipient': 'Recipient',
|
'Recipient': 'Recipient',
|
||||||
'Subject': 'Subject'
|
'Subject': 'Subject'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterConditionType = {
|
Enums.FilterConditionType = {
|
||||||
'Contains': 'Contains',
|
'Contains': 'Contains',
|
||||||
'NotContains': 'NotContains',
|
'NotContains': 'NotContains',
|
||||||
'EqualTo': 'EqualTo',
|
'EqualTo': 'EqualTo',
|
||||||
'NotEqualTo': 'NotEqualTo'
|
'NotEqualTo': 'NotEqualTo'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FiltersAction = {
|
Enums.FiltersAction = {
|
||||||
'None': 'None',
|
'None': 'None',
|
||||||
'Move': 'Move',
|
'Move': 'Move',
|
||||||
'Discard': 'Discard',
|
'Discard': 'Discard',
|
||||||
'Forward': 'Forward',
|
'Forward': 'Forward',
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {string}
|
* @enum {string}
|
||||||
*/
|
*/
|
||||||
Enums.FilterRulesType = {
|
Enums.FilterRulesType = {
|
||||||
'And': 'And',
|
'And': 'And',
|
||||||
'Or': 'Or'
|
'Or': 'Or'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.SignedVerifyStatus = {
|
Enums.SignedVerifyStatus = {
|
||||||
'UnknownPublicKeys': -4,
|
'UnknownPublicKeys': -4,
|
||||||
'UnknownPrivateKey': -3,
|
'UnknownPrivateKey': -3,
|
||||||
'Unverified': -2,
|
'Unverified': -2,
|
||||||
'Error': -1,
|
'Error': -1,
|
||||||
'None': 0,
|
'None': 0,
|
||||||
'Success': 1
|
'Success': 1
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.ContactPropertyType = {
|
Enums.ContactPropertyType = {
|
||||||
|
|
||||||
'Unknown': 0,
|
'Unknown': 0,
|
||||||
|
|
||||||
|
|
@ -359,12 +365,12 @@ Enums.ContactPropertyType = {
|
||||||
'Note': 110,
|
'Note': 110,
|
||||||
|
|
||||||
'Custom': 250
|
'Custom': 250
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @enum {number}
|
* @enum {number}
|
||||||
*/
|
*/
|
||||||
Enums.Notification = {
|
Enums.Notification = {
|
||||||
'InvalidToken': 101,
|
'InvalidToken': 101,
|
||||||
'AuthError': 102,
|
'AuthError': 102,
|
||||||
'AccessError': 103,
|
'AccessError': 103,
|
||||||
|
|
@ -427,4 +433,8 @@ Enums.Notification = {
|
||||||
'InvalidInputArgument': 903,
|
'InvalidInputArgument': 903,
|
||||||
'UnknownNotification': 999,
|
'UnknownNotification': 999,
|
||||||
'UnknownError': 999
|
'UnknownError': 999
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = Enums;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,99 +1,110 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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 {?}
|
* @type {?}
|
||||||
*/
|
*/
|
||||||
Globals.now = (new Date()).getTime();
|
Globals.now = (new window.Date()).getTime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {?}
|
* @type {?}
|
||||||
*/
|
*/
|
||||||
Globals.momentTrigger = ko.observable(true);
|
Globals.momentTrigger = ko.observable(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {?}
|
* @type {?}
|
||||||
*/
|
*/
|
||||||
Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
|
Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {?}
|
* @type {?}
|
||||||
*/
|
*/
|
||||||
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
|
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {?}
|
* @type {?}
|
||||||
*/
|
*/
|
||||||
Globals.langChangeTrigger = ko.observable(true);
|
Globals.langChangeTrigger = ko.observable(true);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
Globals.iAjaxErrorCount = 0;
|
Globals.iAjaxErrorCount = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
Globals.iTokenErrorCount = 0;
|
Globals.iTokenErrorCount = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {number}
|
* @type {number}
|
||||||
*/
|
*/
|
||||||
Globals.iMessageBodyCacheCount = 0;
|
Globals.iMessageBodyCacheCount = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bUnload = false;
|
Globals.bUnload = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
Globals.sUserAgent = (navigator.userAgent || '').toLowerCase();
|
Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad');
|
Globals.bIsiOSDevice = -1 < Globals.sUserAgent.indexOf('iphone') || -1 < Globals.sUserAgent.indexOf('ipod') || -1 < Globals.sUserAgent.indexOf('ipad');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
|
Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
|
Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
*/
|
*/
|
||||||
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
Globals.sAnimationType = '';
|
Globals.sAnimationType = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Globals.oHtmlEditorDefaultConfig = {
|
Globals.oHtmlEditorDefaultConfig = {
|
||||||
'title': false,
|
'title': false,
|
||||||
'stylesSet': false,
|
'stylesSet': false,
|
||||||
'customConfig': '',
|
'customConfig': '',
|
||||||
|
|
@ -107,7 +118,7 @@ Globals.oHtmlEditorDefaultConfig = {
|
||||||
{name: 'links'},
|
{name: 'links'},
|
||||||
{name: 'insert'},
|
{name: 'insert'},
|
||||||
{name: 'others'}
|
{name: 'others'}
|
||||||
// {name: 'document', groups: ['mode', 'document', 'doctools']}
|
// {name: 'document', groups: ['mode', 'document', 'doctools']}
|
||||||
],
|
],
|
||||||
|
|
||||||
'removePlugins': 'contextmenu', //blockquote
|
'removePlugins': 'contextmenu', //blockquote
|
||||||
|
|
@ -122,12 +133,12 @@ Globals.oHtmlEditorDefaultConfig = {
|
||||||
'font_defaultLabel': 'Arial',
|
'font_defaultLabel': 'Arial',
|
||||||
'fontSize_defaultLabel': '13',
|
'fontSize_defaultLabel': '13',
|
||||||
'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
|
'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Globals.oHtmlEditorLangsMap = {
|
Globals.oHtmlEditorLangsMap = {
|
||||||
'de': 'de',
|
'de': 'de',
|
||||||
'es': 'es',
|
'es': 'es',
|
||||||
'fr': 'fr',
|
'fr': 'fr',
|
||||||
|
|
@ -147,11 +158,27 @@ Globals.oHtmlEditorLangsMap = {
|
||||||
'ro': 'ro',
|
'ro': 'ro',
|
||||||
'zh': 'zh',
|
'zh': 'zh',
|
||||||
'zh-cn': 'zh-cn'
|
'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;
|
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,152 +1,161 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function LinkBuilder()
|
function LinkBuilder()
|
||||||
{
|
{
|
||||||
this.sBase = '#/';
|
this.sBase = '#/';
|
||||||
this.sServer = './?';
|
this.sServer = './?';
|
||||||
this.sVersion = RL.settingsGet('Version');
|
this.sVersion = RL.settingsGet('Version');
|
||||||
this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0';
|
this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0';
|
||||||
this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
|
this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.root = function ()
|
LinkBuilder.prototype.root = function ()
|
||||||
{
|
{
|
||||||
return this.sBase;
|
return this.sBase;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sDownload
|
* @param {string} sDownload
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.attachmentDownload = function (sDownload)
|
LinkBuilder.prototype.attachmentDownload = function (sDownload)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
|
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sDownload
|
* @param {string} sDownload
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.attachmentPreview = function (sDownload)
|
LinkBuilder.prototype.attachmentPreview = function (sDownload)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
|
return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sDownload
|
* @param {string} sDownload
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
|
LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
|
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.upload = function ()
|
LinkBuilder.prototype.upload = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
|
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.uploadContacts = function ()
|
LinkBuilder.prototype.uploadContacts = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
|
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.uploadBackground = function ()
|
LinkBuilder.prototype.uploadBackground = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
|
return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.append = function ()
|
LinkBuilder.prototype.append = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + '/Append/' + this.sSpecSuffix + '/';
|
return this.sServer + '/Append/' + this.sSpecSuffix + '/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sEmail
|
* @param {string} sEmail
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.change = function (sEmail)
|
LinkBuilder.prototype.change = function (sEmail)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
|
return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string=} sAdd
|
* @param {string=} sAdd
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.ajax = function (sAdd)
|
LinkBuilder.prototype.ajax = function (sAdd)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
|
return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sRequestHash
|
* @param {string} sRequestHash
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.messageViewLink = function (sRequestHash)
|
LinkBuilder.prototype.messageViewLink = function (sRequestHash)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
|
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sRequestHash
|
* @param {string} sRequestHash
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
|
LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
|
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sEmail
|
* @param {string} sEmail
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.avatarLink = function (sEmail)
|
LinkBuilder.prototype.avatarLink = function (sEmail)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
|
return this.sServer + '/Raw/0/Avatar/' + window.encodeURIComponent(sEmail) + '/';
|
||||||
// return '//secure.gravatar.com/avatar/' + Utils.md5(sEmail.toLowerCase()) + '.jpg?s=80&d=mm';
|
// return '//secure.gravatar.com/avatar/' + Utils.md5(sEmail.toLowerCase()) + '.jpg?s=80&d=mm';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.inbox = function ()
|
LinkBuilder.prototype.inbox = function ()
|
||||||
{
|
{
|
||||||
return this.sBase + 'mailbox/Inbox';
|
return this.sBase + 'mailbox/Inbox';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.messagePreview = function ()
|
LinkBuilder.prototype.messagePreview = function ()
|
||||||
{
|
{
|
||||||
return this.sBase + 'mailbox/message-preview';
|
return this.sBase + 'mailbox/message-preview';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string=} sScreenName
|
* @param {string=} sScreenName
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.settings = function (sScreenName)
|
LinkBuilder.prototype.settings = function (sScreenName)
|
||||||
{
|
{
|
||||||
var sResult = this.sBase + 'settings';
|
var sResult = this.sBase + 'settings';
|
||||||
if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
|
if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
|
||||||
{
|
{
|
||||||
|
|
@ -154,14 +163,14 @@ LinkBuilder.prototype.settings = function (sScreenName)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sResult;
|
return sResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sScreenName
|
* @param {string} sScreenName
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.admin = function (sScreenName)
|
LinkBuilder.prototype.admin = function (sScreenName)
|
||||||
{
|
{
|
||||||
var sResult = this.sBase;
|
var sResult = this.sBase;
|
||||||
switch (sScreenName) {
|
switch (sScreenName) {
|
||||||
case 'AdminDomains':
|
case 'AdminDomains':
|
||||||
|
|
@ -176,16 +185,16 @@ LinkBuilder.prototype.admin = function (sScreenName)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sResult;
|
return sResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sFolder
|
* @param {string} sFolder
|
||||||
* @param {number=} iPage = 1
|
* @param {number=} iPage = 1
|
||||||
* @param {string=} sSearch = ''
|
* @param {string=} sSearch = ''
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
|
LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
|
||||||
{
|
{
|
||||||
iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
|
iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
|
||||||
sSearch = Utils.pString(sSearch);
|
sSearch = Utils.pString(sSearch);
|
||||||
|
|
||||||
|
|
@ -206,64 +215,64 @@ LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sResult;
|
return sResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.phpInfo = function ()
|
LinkBuilder.prototype.phpInfo = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + 'Info';
|
return this.sServer + 'Info';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sLang
|
* @param {string} sLang
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.langLink = function (sLang)
|
LinkBuilder.prototype.langLink = function (sLang)
|
||||||
{
|
{
|
||||||
return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
|
return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.exportContactsVcf = function ()
|
LinkBuilder.prototype.exportContactsVcf = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
|
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.exportContactsCsv = function ()
|
LinkBuilder.prototype.exportContactsCsv = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
|
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.emptyContactPic = function ()
|
LinkBuilder.prototype.emptyContactPic = function ()
|
||||||
{
|
{
|
||||||
return this.sStaticPrefix + 'css/images/empty-contact.png';
|
return this.sStaticPrefix + 'css/images/empty-contact.png';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sFileName
|
* @param {string} sFileName
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.sound = function (sFileName)
|
LinkBuilder.prototype.sound = function (sFileName)
|
||||||
{
|
{
|
||||||
return this.sStaticPrefix + 'sounds/' + sFileName;
|
return this.sStaticPrefix + 'sounds/' + sFileName;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sTheme
|
* @param {string} sTheme
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.themePreviewLink = function (sTheme)
|
LinkBuilder.prototype.themePreviewLink = function (sTheme)
|
||||||
{
|
{
|
||||||
var sPrefix = 'rainloop/v/' + this.sVersion + '/';
|
var sPrefix = 'rainloop/v/' + this.sVersion + '/';
|
||||||
if ('@custom' === sTheme.substr(-7))
|
if ('@custom' === sTheme.substr(-7))
|
||||||
{
|
{
|
||||||
|
|
@ -272,44 +281,48 @@ LinkBuilder.prototype.themePreviewLink = function (sTheme)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
|
return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.notificationMailIcon = function ()
|
LinkBuilder.prototype.notificationMailIcon = function ()
|
||||||
{
|
{
|
||||||
return this.sStaticPrefix + 'css/images/icom-message-notification.png';
|
return this.sStaticPrefix + 'css/images/icom-message-notification.png';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.openPgpJs = function ()
|
LinkBuilder.prototype.openPgpJs = function ()
|
||||||
{
|
{
|
||||||
return this.sStaticPrefix + 'js/openpgp.min.js';
|
return this.sStaticPrefix + 'js/openpgp.min.js';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.socialGoogle = function ()
|
LinkBuilder.prototype.socialGoogle = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.socialTwitter = function ()
|
LinkBuilder.prototype.socialTwitter = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
LinkBuilder.prototype.socialFacebook = function ()
|
LinkBuilder.prototype.socialFacebook = function ()
|
||||||
{
|
{
|
||||||
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = LinkBuilder;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,13 +1,23 @@
|
||||||
|
/* 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
|
* @constructor
|
||||||
* @param {Object} oElement
|
* @param {Object} oElement
|
||||||
* @param {Function=} fOnBlur
|
* @param {Function=} fOnBlur
|
||||||
* @param {Function=} fOnReady
|
* @param {Function=} fOnReady
|
||||||
* @param {Function=} fOnModeChange
|
* @param {Function=} fOnModeChange
|
||||||
*/
|
*/
|
||||||
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
|
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
self.editor = null;
|
self.editor = null;
|
||||||
self.iBlurTimer = 0;
|
self.iBlurTimer = 0;
|
||||||
|
|
@ -20,10 +30,10 @@ function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
|
||||||
self.resize = _.throttle(_.bind(self.resize, self), 100);
|
self.resize = _.throttle(_.bind(self.resize, self), 100);
|
||||||
|
|
||||||
self.init();
|
self.init();
|
||||||
}
|
}
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
|
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
|
||||||
{
|
{
|
||||||
if (this.fOnBlur)
|
if (this.fOnBlur)
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
@ -32,45 +42,45 @@ NewHtmlEditorWrapper.prototype.blurTrigger = function ()
|
||||||
self.fOnBlur();
|
self.fOnBlur();
|
||||||
}, 200);
|
}, 200);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.focusTrigger = function ()
|
NewHtmlEditorWrapper.prototype.focusTrigger = function ()
|
||||||
{
|
{
|
||||||
if (this.fOnBlur)
|
if (this.fOnBlur)
|
||||||
{
|
{
|
||||||
window.clearTimeout(this.iBlurTimer);
|
window.clearTimeout(this.iBlurTimer);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
NewHtmlEditorWrapper.prototype.isHtml = function ()
|
NewHtmlEditorWrapper.prototype.isHtml = function ()
|
||||||
{
|
{
|
||||||
return this.editor ? 'wysiwyg' === this.editor.mode : false;
|
return this.editor ? 'wysiwyg' === this.editor.mode : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
NewHtmlEditorWrapper.prototype.checkDirty = function ()
|
NewHtmlEditorWrapper.prototype.checkDirty = function ()
|
||||||
{
|
{
|
||||||
return this.editor ? this.editor.checkDirty() : false;
|
return this.editor ? this.editor.checkDirty() : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.resetDirty = function ()
|
NewHtmlEditorWrapper.prototype.resetDirty = function ()
|
||||||
{
|
{
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
this.editor.resetDirty();
|
this.editor.resetDirty();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
|
NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
|
||||||
{
|
{
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
|
if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
|
||||||
|
|
@ -84,10 +94,10 @@ NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
|
||||||
}
|
}
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
|
NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
|
||||||
{
|
{
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
if (bPlain)
|
if (bPlain)
|
||||||
|
|
@ -107,10 +117,10 @@ NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
|
||||||
|
|
||||||
this.resize();
|
this.resize();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
|
NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
|
||||||
{
|
{
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
this.modeToggle(true);
|
this.modeToggle(true);
|
||||||
|
|
@ -121,10 +131,10 @@ NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
|
||||||
this.focus();
|
this.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
|
NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
|
||||||
{
|
{
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
this.modeToggle(false);
|
this.modeToggle(false);
|
||||||
|
|
@ -142,10 +152,10 @@ NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
|
||||||
this.focus();
|
this.focus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.init = function ()
|
NewHtmlEditorWrapper.prototype.init = function ()
|
||||||
{
|
{
|
||||||
if (this.$element && this.$element[0])
|
if (this.$element && this.$element[0])
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -154,7 +164,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
|
||||||
|
|
||||||
var
|
var
|
||||||
oConfig = Globals.oHtmlEditorDefaultConfig,
|
oConfig = Globals.oHtmlEditorDefaultConfig,
|
||||||
sLanguage = RL.settingsGet('Language'),
|
sLanguage = RL.settingsGet('Language'), // TODO cjs
|
||||||
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
|
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
@ -223,26 +233,26 @@ NewHtmlEditorWrapper.prototype.init = function ()
|
||||||
window.__initEditor = fInit;
|
window.__initEditor = fInit;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.focus = function ()
|
NewHtmlEditorWrapper.prototype.focus = function ()
|
||||||
{
|
{
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
this.editor.focus();
|
this.editor.focus();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.blur = function ()
|
NewHtmlEditorWrapper.prototype.blur = function ()
|
||||||
{
|
{
|
||||||
if (this.editor)
|
if (this.editor)
|
||||||
{
|
{
|
||||||
this.editor.focusManager.blur(true);
|
this.editor.focusManager.blur(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.resize = function ()
|
NewHtmlEditorWrapper.prototype.resize = function ()
|
||||||
{
|
{
|
||||||
if (this.editor && this.__resizable)
|
if (this.editor && this.__resizable)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
|
@ -251,10 +261,14 @@ NewHtmlEditorWrapper.prototype.resize = function ()
|
||||||
}
|
}
|
||||||
catch (e) {}
|
catch (e) {}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
NewHtmlEditorWrapper.prototype.clear = function (bFocus)
|
NewHtmlEditorWrapper.prototype.clear = function (bFocus)
|
||||||
{
|
{
|
||||||
this.setHtml('', bFocus);
|
this.setHtml('', bFocus);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = NewHtmlEditorWrapper;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,33 +1,42 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Plugins.oViewModelsHooks = {};
|
Plugins.oViewModelsHooks = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
Plugins.oSimpleHooks = {};
|
Plugins.oSimpleHooks = {};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @param {Function} ViewModel
|
* @param {Function} ViewModel
|
||||||
*/
|
*/
|
||||||
Plugins.regViewModelHook = function (sName, ViewModel)
|
Plugins.regViewModelHook = function (sName, ViewModel)
|
||||||
{
|
{
|
||||||
if (ViewModel)
|
if (ViewModel)
|
||||||
{
|
{
|
||||||
ViewModel.__hookName = sName;
|
ViewModel.__hookName = sName;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @param {Function} fCallback
|
* @param {Function} fCallback
|
||||||
*/
|
*/
|
||||||
Plugins.addHook = function (sName, fCallback)
|
Plugins.addHook = function (sName, fCallback)
|
||||||
{
|
{
|
||||||
if (Utils.isFunc(fCallback))
|
if (Utils.isFunc(fCallback))
|
||||||
{
|
{
|
||||||
if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
|
if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
|
||||||
|
|
@ -37,14 +46,14 @@ Plugins.addHook = function (sName, fCallback)
|
||||||
|
|
||||||
Plugins.oSimpleHooks[sName].push(fCallback);
|
Plugins.oSimpleHooks[sName].push(fCallback);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @param {Array=} aArguments
|
* @param {Array=} aArguments
|
||||||
*/
|
*/
|
||||||
Plugins.runHook = function (sName, aArguments)
|
Plugins.runHook = function (sName, aArguments)
|
||||||
{
|
{
|
||||||
if (Utils.isArray(Plugins.oSimpleHooks[sName]))
|
if (Utils.isArray(Plugins.oSimpleHooks[sName]))
|
||||||
{
|
{
|
||||||
aArguments = aArguments || [];
|
aArguments = aArguments || [];
|
||||||
|
|
@ -53,18 +62,18 @@ Plugins.runHook = function (sName, aArguments)
|
||||||
fCallback.apply(null, aArguments);
|
fCallback.apply(null, aArguments);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @return {?}
|
* @return {?}
|
||||||
*/
|
*/
|
||||||
Plugins.mainSettingsGet = function (sName)
|
Plugins.mainSettingsGet = function (sName)
|
||||||
{
|
{
|
||||||
return RL ? RL.settingsGet(sName) : null;
|
return RL ? RL.settingsGet(sName) : null; // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} fCallback
|
* @param {Function} fCallback
|
||||||
* @param {string} sAction
|
* @param {string} sAction
|
||||||
* @param {Object=} oParameters
|
* @param {Object=} oParameters
|
||||||
|
|
@ -72,24 +81,26 @@ Plugins.mainSettingsGet = function (sName)
|
||||||
* @param {string=} sGetAdd = ''
|
* @param {string=} sGetAdd = ''
|
||||||
* @param {Array=} aAbortActions = []
|
* @param {Array=} aAbortActions = []
|
||||||
*/
|
*/
|
||||||
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
|
||||||
{
|
|
||||||
if (RL)
|
|
||||||
{
|
{
|
||||||
RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
|
if (RL) // TODO cjs
|
||||||
|
{
|
||||||
|
RL.remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions); // TODO cjs
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sPluginSection
|
* @param {string} sPluginSection
|
||||||
* @param {string} sName
|
* @param {string} sName
|
||||||
* @return {?}
|
* @return {?}
|
||||||
*/
|
*/
|
||||||
Plugins.settingsGet = function (sPluginSection, sName)
|
Plugins.settingsGet = function (sPluginSection, sName)
|
||||||
{
|
{
|
||||||
var oPlugin = Plugins.mainSettingsGet('Plugins');
|
var oPlugin = Plugins.mainSettingsGet('Plugins');
|
||||||
oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
|
oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
|
||||||
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
|
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = Plugins;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,6 +1,20 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @param {koProperty} oKoList
|
* @param {koProperty} oKoList
|
||||||
* @param {koProperty} oKoSelectedItem
|
* @param {koProperty} oKoSelectedItem
|
||||||
|
|
@ -9,9 +23,9 @@
|
||||||
* @param {string} sItemCheckedSelector
|
* @param {string} sItemCheckedSelector
|
||||||
* @param {string} sItemFocusedSelector
|
* @param {string} sItemFocusedSelector
|
||||||
*/
|
*/
|
||||||
function Selector(oKoList, oKoSelectedItem,
|
function Selector(oKoList, oKoSelectedItem,
|
||||||
sItemSelector, sItemSelectedSelector, sItemCheckedSelector, sItemFocusedSelector)
|
sItemSelector, sItemSelectedSelector, sItemCheckedSelector, sItemFocusedSelector)
|
||||||
{
|
{
|
||||||
this.list = oKoList;
|
this.list = oKoList;
|
||||||
|
|
||||||
this.listChecked = ko.computed(function () {
|
this.listChecked = ko.computed(function () {
|
||||||
|
|
@ -248,10 +262,10 @@ function Selector(oKoList, oKoSelectedItem,
|
||||||
mSelected = null;
|
mSelected = null;
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Selector.prototype.itemSelected = function (oItem)
|
Selector.prototype.itemSelected = function (oItem)
|
||||||
{
|
{
|
||||||
if (this.isListChecked())
|
if (this.isListChecked())
|
||||||
{
|
{
|
||||||
if (!oItem)
|
if (!oItem)
|
||||||
|
|
@ -266,20 +280,20 @@ Selector.prototype.itemSelected = function (oItem)
|
||||||
(this.oCallbacks['onItemSelect'] || this.emptyFunction)(oItem);
|
(this.oCallbacks['onItemSelect'] || this.emptyFunction)(oItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector.prototype.goDown = function (bForceSelect)
|
Selector.prototype.goDown = function (bForceSelect)
|
||||||
{
|
{
|
||||||
this.newSelectPosition(Enums.EventKeyCode.Down, false, bForceSelect);
|
this.newSelectPosition(Enums.EventKeyCode.Down, false, bForceSelect);
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector.prototype.goUp = function (bForceSelect)
|
Selector.prototype.goUp = function (bForceSelect)
|
||||||
{
|
{
|
||||||
this.newSelectPosition(Enums.EventKeyCode.Up, false, bForceSelect);
|
this.newSelectPosition(Enums.EventKeyCode.Up, false, bForceSelect);
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector.prototype.init = function (oContentVisible, oContentScrollable, sKeyScope)
|
Selector.prototype.init = function (oContentVisible, oContentScrollable, sKeyScope)
|
||||||
{
|
{
|
||||||
this.oContentVisible = oContentVisible;
|
this.oContentVisible = oContentVisible;
|
||||||
this.oContentScrollable = oContentScrollable;
|
this.oContentScrollable = oContentScrollable;
|
||||||
|
|
||||||
|
|
@ -375,19 +389,19 @@ Selector.prototype.init = function (oContentVisible, oContentScrollable, sKeySco
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector.prototype.autoSelect = function (bValue)
|
Selector.prototype.autoSelect = function (bValue)
|
||||||
{
|
{
|
||||||
this.bAutoSelect = !!bValue;
|
this.bAutoSelect = !!bValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} oItem
|
* @param {Object} oItem
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
Selector.prototype.getItemUid = function (oItem)
|
Selector.prototype.getItemUid = function (oItem)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sUid = '',
|
sUid = '',
|
||||||
fGetItemUidCallback = this.oCallbacks['onItemGetUid'] || null
|
fGetItemUidCallback = this.oCallbacks['onItemGetUid'] || null
|
||||||
|
|
@ -399,15 +413,15 @@ Selector.prototype.getItemUid = function (oItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
return sUid.toString();
|
return sUid.toString();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} iEventKeyCode
|
* @param {number} iEventKeyCode
|
||||||
* @param {boolean} bShiftKey
|
* @param {boolean} bShiftKey
|
||||||
* @param {boolean=} bForceSelect = false
|
* @param {boolean=} bForceSelect = false
|
||||||
*/
|
*/
|
||||||
Selector.prototype.newSelectPosition = function (iEventKeyCode, bShiftKey, bForceSelect)
|
Selector.prototype.newSelectPosition = function (iEventKeyCode, bShiftKey, bForceSelect)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
iPageStep = 10,
|
iPageStep = 10,
|
||||||
|
|
@ -546,13 +560,13 @@ Selector.prototype.newSelectPosition = function (iEventKeyCode, bShiftKey, bForc
|
||||||
|
|
||||||
this.focusedItem(oFocused);
|
this.focusedItem(oFocused);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
Selector.prototype.scrollToFocused = function ()
|
Selector.prototype.scrollToFocused = function ()
|
||||||
{
|
{
|
||||||
if (!this.oContentVisible || !this.oContentScrollable)
|
if (!this.oContentVisible || !this.oContentScrollable)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -581,14 +595,14 @@ Selector.prototype.scrollToFocused = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean=} bFast = false
|
* @param {boolean=} bFast = false
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
Selector.prototype.scrollToTop = function (bFast)
|
Selector.prototype.scrollToTop = function (bFast)
|
||||||
{
|
{
|
||||||
if (!this.oContentVisible || !this.oContentScrollable)
|
if (!this.oContentVisible || !this.oContentScrollable)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
|
@ -604,10 +618,10 @@ Selector.prototype.scrollToTop = function (bFast)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector.prototype.eventClickFunction = function (oItem, oEvent)
|
Selector.prototype.eventClickFunction = function (oItem, oEvent)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sUid = this.getItemUid(oItem),
|
sUid = this.getItemUid(oItem),
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
|
|
@ -652,14 +666,14 @@ Selector.prototype.eventClickFunction = function (oItem, oEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sLastUid = '' === sUid ? '' : sUid;
|
this.sLastUid = '' === sUid ? '' : sUid;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} oItem
|
* @param {Object} oItem
|
||||||
* @param {Object=} oEvent
|
* @param {Object=} oEvent
|
||||||
*/
|
*/
|
||||||
Selector.prototype.actionClick = function (oItem, oEvent)
|
Selector.prototype.actionClick = function (oItem, oEvent)
|
||||||
{
|
{
|
||||||
if (oItem)
|
if (oItem)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -704,9 +718,13 @@ Selector.prototype.actionClick = function (oItem, oEvent)
|
||||||
this.scrollToFocused();
|
this.scrollToFocused();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Selector.prototype.on = function (sEventName, fCallback)
|
Selector.prototype.on = function (sEventName, fCallback)
|
||||||
{
|
{
|
||||||
this.oCallbacks[sEventName] = fCallback;
|
this.oCallbacks[sEventName] = fCallback;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = Selector;
|
||||||
|
|
||||||
|
}(module));
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -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,76 +1,94 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function Knoin()
|
function Knoin()
|
||||||
{
|
{
|
||||||
this.sDefaultScreenName = '';
|
this.sDefaultScreenName = '';
|
||||||
this.oScreens = {};
|
this.oScreens = {};
|
||||||
this.oBoot = null;
|
this.oBoot = null;
|
||||||
this.oCurrentScreen = null;
|
this.oCurrentScreen = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} thisObject
|
* @param {Object} thisObject
|
||||||
*/
|
*/
|
||||||
Knoin.constructorEnd = function (thisObject)
|
Knoin.constructorEnd = function (thisObject)
|
||||||
{
|
{
|
||||||
if (Utils.isFunc(thisObject['__constructor_end']))
|
if (Utils.isFunc(thisObject['__constructor_end']))
|
||||||
{
|
{
|
||||||
thisObject['__constructor_end'].call(thisObject);
|
thisObject['__constructor_end'].call(thisObject);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
Knoin.prototype.sDefaultScreenName = '';
|
Knoin.prototype.sDefaultScreenName = '';
|
||||||
Knoin.prototype.oScreens = {};
|
Knoin.prototype.oScreens = {};
|
||||||
Knoin.prototype.oBoot = null;
|
Knoin.prototype.oBoot = null;
|
||||||
Knoin.prototype.oCurrentScreen = null;
|
Knoin.prototype.oCurrentScreen = null;
|
||||||
|
|
||||||
Knoin.prototype.hideLoading = function ()
|
Knoin.prototype.hideLoading = function ()
|
||||||
{
|
|
||||||
$('#rl-loading').hide();
|
|
||||||
};
|
|
||||||
|
|
||||||
Knoin.prototype.routeOff = function ()
|
|
||||||
{
|
|
||||||
hasher.changed.active = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
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;
|
$('#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);
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return this;
|
Knoin.prototype.routeOff = function ()
|
||||||
};
|
{
|
||||||
|
hasher.changed.active = false;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
Knoin.prototype.routeOn = function ()
|
||||||
|
{
|
||||||
|
hasher.changed.active = true;
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
* @param {string} sScreenName
|
* @param {string} sScreenName
|
||||||
* @return {?Object}
|
* @return {?Object}
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.screen = function (sScreenName)
|
Knoin.prototype.screen = function (sScreenName)
|
||||||
{
|
{
|
||||||
return ('' !== sScreenName && !Utils.isUnd(this.oScreens[sScreenName])) ? this.oScreens[sScreenName] : null;
|
return ('' !== sScreenName && !Utils.isUnd(this.oScreens[sScreenName])) ? this.oScreens[sScreenName] : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} ViewModelClass
|
* @param {Function} ViewModelClass
|
||||||
* @param {Object=} oScreen
|
* @param {Object=} oScreen
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
{
|
{
|
||||||
if (ViewModelClass && !ViewModelClass.__builded)
|
if (ViewModelClass && !ViewModelClass.__builded)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -82,7 +100,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
|
|
||||||
ViewModelClass.__builded = true;
|
ViewModelClass.__builded = true;
|
||||||
ViewModelClass.__vm = oViewModel;
|
ViewModelClass.__vm = oViewModel;
|
||||||
oViewModel.data = RL.data();
|
oViewModel.data = RL.data(); // TODO cjs
|
||||||
|
|
||||||
oViewModel.viewModelName = ViewModelClass.__name;
|
oViewModel.viewModelName = ViewModelClass.__name;
|
||||||
|
|
||||||
|
|
@ -97,7 +115,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
if ('Popups' === sPosition)
|
if ('Popups' === sPosition)
|
||||||
{
|
{
|
||||||
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () {
|
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () {
|
||||||
kn.hideScreenPopup(ViewModelClass);
|
kn.hideScreenPopup(ViewModelClass); // TODO cjs
|
||||||
});
|
});
|
||||||
|
|
||||||
oViewModel.modalVisibility.subscribe(function (bValue) {
|
oViewModel.modalVisibility.subscribe(function (bValue) {
|
||||||
|
|
@ -108,8 +126,8 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
this.viewModelDom.show();
|
this.viewModelDom.show();
|
||||||
this.storeAndSetKeyScope();
|
this.storeAndSetKeyScope();
|
||||||
|
|
||||||
RL.popupVisibilityNames.push(this.viewModelName);
|
RL.popupVisibilityNames.push(this.viewModelName); // TODO cjs
|
||||||
oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10);
|
oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10); // TODO cjs
|
||||||
|
|
||||||
Utils.delegateRun(this, 'onFocus', [], 500);
|
Utils.delegateRun(this, 'onFocus', [], 500);
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +136,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
Utils.delegateRun(this, 'onHide');
|
Utils.delegateRun(this, 'onHide');
|
||||||
this.restoreKeyScope();
|
this.restoreKeyScope();
|
||||||
|
|
||||||
RL.popupVisibilityNames.remove(this.viewModelName);
|
RL.popupVisibilityNames.remove(this.viewModelName); // TODO cjs
|
||||||
oViewModel.viewModelDom.css('z-index', 2000);
|
oViewModel.viewModelDom.css('z-index', 2000);
|
||||||
|
|
||||||
Globals.tooltipTrigger(!Globals.tooltipTrigger());
|
Globals.tooltipTrigger(!Globals.tooltipTrigger());
|
||||||
|
|
@ -131,7 +149,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
}, oViewModel);
|
}, 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], {
|
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
|
||||||
'i18nInit': true,
|
'i18nInit': true,
|
||||||
|
|
@ -144,7 +162,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
oViewModel.registerPopupKeyDown();
|
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
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -153,38 +171,38 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
|
||||||
}
|
}
|
||||||
|
|
||||||
return ViewModelClass ? ViewModelClass.__vm : null;
|
return ViewModelClass ? ViewModelClass.__vm : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} oViewModel
|
* @param {Object} oViewModel
|
||||||
* @param {Object} oViewModelDom
|
* @param {Object} oViewModelDom
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.applyExternal = function (oViewModel, oViewModelDom)
|
Knoin.prototype.applyExternal = function (oViewModel, oViewModelDom)
|
||||||
{
|
{
|
||||||
if (oViewModel && oViewModelDom)
|
if (oViewModel && oViewModelDom)
|
||||||
{
|
{
|
||||||
ko.applyBindings(oViewModel, oViewModelDom);
|
ko.applyBindings(oViewModel, oViewModelDom);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} ViewModelClassToHide
|
* @param {Function} ViewModelClassToHide
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
|
Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
|
||||||
{
|
{
|
||||||
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
|
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
|
||||||
{
|
{
|
||||||
ViewModelClassToHide.__vm.modalVisibility(false);
|
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
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} ViewModelClassToShow
|
* @param {Function} ViewModelClassToShow
|
||||||
* @param {Array=} aParameters
|
* @param {Array=} aParameters
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
|
Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
|
||||||
{
|
{
|
||||||
if (ViewModelClassToShow)
|
if (ViewModelClassToShow)
|
||||||
{
|
{
|
||||||
this.buildViewModel(ViewModelClassToShow);
|
this.buildViewModel(ViewModelClassToShow);
|
||||||
|
|
@ -193,26 +211,26 @@ Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
|
||||||
{
|
{
|
||||||
ViewModelClassToShow.__vm.modalVisibility(true);
|
ViewModelClassToShow.__vm.modalVisibility(true);
|
||||||
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
|
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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Function} ViewModelClassToShow
|
* @param {Function} ViewModelClassToShow
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.isPopupVisible = function (ViewModelClassToShow)
|
Knoin.prototype.isPopupVisible = function (ViewModelClassToShow)
|
||||||
{
|
{
|
||||||
return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false;
|
return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sScreenName
|
* @param {string} sScreenName
|
||||||
* @param {string} sSubPart
|
* @param {string} sSubPart
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
|
Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
oScreen = null,
|
oScreen = null,
|
||||||
|
|
@ -284,7 +302,7 @@ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
|
||||||
{
|
{
|
||||||
Utils.delegateRun(self.oCurrentScreen, 'onShow');
|
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()))
|
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, 'onShow');
|
||||||
Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200);
|
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);
|
}, self);
|
||||||
|
|
@ -314,13 +332,13 @@ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Array} aScreensClasses
|
* @param {Array} aScreensClasses
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.startScreens = function (aScreensClasses)
|
Knoin.prototype.startScreens = function (aScreensClasses)
|
||||||
{
|
{
|
||||||
$('#rl-content').css({
|
$('#rl-content').css({
|
||||||
'visibility': 'hidden'
|
'visibility': 'hidden'
|
||||||
});
|
});
|
||||||
|
|
@ -351,9 +369,9 @@ Knoin.prototype.startScreens = function (aScreensClasses)
|
||||||
oScreen.__started = true;
|
oScreen.__started = true;
|
||||||
oScreen.__start();
|
oScreen.__start();
|
||||||
|
|
||||||
Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]);
|
Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]); // TODO cjs
|
||||||
Utils.delegateRun(oScreen, 'onStart');
|
Utils.delegateRun(oScreen, 'onStart');
|
||||||
Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]);
|
Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]); // TODO cjs
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
|
|
@ -371,15 +389,15 @@ Knoin.prototype.startScreens = function (aScreensClasses)
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
$html.removeClass('rl-started-trigger').addClass('rl-started');
|
$html.removeClass('rl-started-trigger').addClass('rl-started');
|
||||||
}, 50);
|
}, 50);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sHash
|
* @param {string} sHash
|
||||||
* @param {boolean=} bSilence = false
|
* @param {boolean=} bSilence = false
|
||||||
* @param {boolean=} bReplace = false
|
* @param {boolean=} bReplace = false
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.setHash = function (sHash, bSilence, bReplace)
|
Knoin.prototype.setHash = function (sHash, bSilence, bReplace)
|
||||||
{
|
{
|
||||||
sHash = '#' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
|
sHash = '#' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
|
||||||
sHash = '/' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
|
sHash = '/' === sHash.substr(0, 1) ? sHash.substr(1) : sHash;
|
||||||
|
|
||||||
|
|
@ -397,19 +415,72 @@ Knoin.prototype.setHash = function (sHash, bSilence, bReplace)
|
||||||
hasher[bReplace ? 'replaceHash' : 'setHash'](sHash);
|
hasher[bReplace ? 'replaceHash' : 'setHash'](sHash);
|
||||||
hasher.setHash(sHash);
|
hasher.setHash(sHash);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Knoin}
|
* @return {Knoin}
|
||||||
*/
|
*/
|
||||||
Knoin.prototype.bootstart = function ()
|
Knoin.prototype.bootstart = function (RL)
|
||||||
{
|
|
||||||
if (this.oBoot && this.oBoot.bootstart)
|
|
||||||
{
|
{
|
||||||
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])
|
||||||
|
{
|
||||||
|
$('#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,23 +1,35 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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 {string} sEmail
|
||||||
* @param {boolean=} bCanBeDelete = true
|
* @param {boolean=} bCanBeDelete = true
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function AccountModel(sEmail, bCanBeDelete)
|
function AccountModel(sEmail, bCanBeDelete)
|
||||||
{
|
{
|
||||||
this.email = sEmail;
|
this.email = sEmail;
|
||||||
this.deleteAccess = ko.observable(false);
|
this.deleteAccess = ko.observable(false);
|
||||||
this.canBeDalete = ko.observable(bCanBeDelete);
|
this.canBeDalete = ko.observable(bCanBeDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
AccountModel.prototype.email = '';
|
AccountModel.prototype.email = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
AccountModel.prototype.changeAccountLink = function ()
|
AccountModel.prototype.changeAccountLink = function ()
|
||||||
{
|
{
|
||||||
return RL.link().change(this.email);
|
return RL.link().change(this.email); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = AccountModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,10 +1,20 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function AttachmentModel()
|
function AttachmentModel()
|
||||||
{
|
{
|
||||||
this.mimeType = '';
|
this.mimeType = '';
|
||||||
this.fileName = '';
|
this.fileName = '';
|
||||||
this.estimatedSize = 0;
|
this.estimatedSize = 0;
|
||||||
|
|
@ -18,38 +28,38 @@ function AttachmentModel()
|
||||||
this.folder = '';
|
this.folder = '';
|
||||||
this.uid = '';
|
this.uid = '';
|
||||||
this.mimeIndex = '';
|
this.mimeIndex = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {AjaxJsonAttachment} oJsonAttachment
|
* @param {AjaxJsonAttachment} oJsonAttachment
|
||||||
* @return {?AttachmentModel}
|
* @return {?AttachmentModel}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.newInstanceFromJson = function (oJsonAttachment)
|
AttachmentModel.newInstanceFromJson = function (oJsonAttachment)
|
||||||
{
|
{
|
||||||
var oAttachmentModel = new AttachmentModel();
|
var oAttachmentModel = new AttachmentModel();
|
||||||
return oAttachmentModel.initByJson(oJsonAttachment) ? oAttachmentModel : null;
|
return oAttachmentModel.initByJson(oJsonAttachment) ? oAttachmentModel : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
AttachmentModel.prototype.mimeType = '';
|
AttachmentModel.prototype.mimeType = '';
|
||||||
AttachmentModel.prototype.fileName = '';
|
AttachmentModel.prototype.fileName = '';
|
||||||
AttachmentModel.prototype.estimatedSize = 0;
|
AttachmentModel.prototype.estimatedSize = 0;
|
||||||
AttachmentModel.prototype.friendlySize = '';
|
AttachmentModel.prototype.friendlySize = '';
|
||||||
AttachmentModel.prototype.isInline = false;
|
AttachmentModel.prototype.isInline = false;
|
||||||
AttachmentModel.prototype.isLinked = false;
|
AttachmentModel.prototype.isLinked = false;
|
||||||
AttachmentModel.prototype.cid = '';
|
AttachmentModel.prototype.cid = '';
|
||||||
AttachmentModel.prototype.cidWithOutTags = '';
|
AttachmentModel.prototype.cidWithOutTags = '';
|
||||||
AttachmentModel.prototype.contentLocation = '';
|
AttachmentModel.prototype.contentLocation = '';
|
||||||
AttachmentModel.prototype.download = '';
|
AttachmentModel.prototype.download = '';
|
||||||
AttachmentModel.prototype.folder = '';
|
AttachmentModel.prototype.folder = '';
|
||||||
AttachmentModel.prototype.uid = '';
|
AttachmentModel.prototype.uid = '';
|
||||||
AttachmentModel.prototype.mimeIndex = '';
|
AttachmentModel.prototype.mimeIndex = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AjaxJsonAttachment} oJsonAttachment
|
* @param {AjaxJsonAttachment} oJsonAttachment
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.initByJson = function (oJsonAttachment)
|
AttachmentModel.prototype.initByJson = function (oJsonAttachment)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oJsonAttachment && 'Object/Attachment' === oJsonAttachment['@Object'])
|
if (oJsonAttachment && 'Object/Attachment' === oJsonAttachment['@Object'])
|
||||||
{
|
{
|
||||||
|
|
@ -73,64 +83,64 @@ AttachmentModel.prototype.initByJson = function (oJsonAttachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.isImage = function ()
|
AttachmentModel.prototype.isImage = function ()
|
||||||
{
|
{
|
||||||
return -1 < Utils.inArray(this.mimeType.toLowerCase(),
|
return -1 < Utils.inArray(this.mimeType.toLowerCase(),
|
||||||
['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
|
['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.isText = function ()
|
AttachmentModel.prototype.isText = function ()
|
||||||
{
|
{
|
||||||
return 'text/' === this.mimeType.substr(0, 5) &&
|
return 'text/' === this.mimeType.substr(0, 5) &&
|
||||||
-1 === Utils.inArray(this.mimeType, ['text/html']);
|
-1 === Utils.inArray(this.mimeType, ['text/html']);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.isPdf = function ()
|
AttachmentModel.prototype.isPdf = function ()
|
||||||
{
|
{
|
||||||
return Globals.bAllowPdfPreview && 'application/pdf' === this.mimeType;
|
return Globals.bAllowPdfPreview && 'application/pdf' === this.mimeType;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.linkDownload = function ()
|
AttachmentModel.prototype.linkDownload = function ()
|
||||||
{
|
{
|
||||||
return RL.link().attachmentDownload(this.download);
|
return RL.link().attachmentDownload(this.download); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.linkPreview = function ()
|
AttachmentModel.prototype.linkPreview = function ()
|
||||||
{
|
{
|
||||||
return RL.link().attachmentPreview(this.download);
|
return RL.link().attachmentPreview(this.download); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.linkPreviewAsPlain = function ()
|
AttachmentModel.prototype.linkPreviewAsPlain = function ()
|
||||||
{
|
{
|
||||||
return RL.link().attachmentPreviewAsPlain(this.download);
|
return RL.link().attachmentPreviewAsPlain(this.download);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.generateTransferDownloadUrl = function ()
|
AttachmentModel.prototype.generateTransferDownloadUrl = function ()
|
||||||
{
|
{
|
||||||
var sLink = this.linkDownload();
|
var sLink = this.linkDownload();
|
||||||
if ('http' !== sLink.substr(0, 4))
|
if ('http' !== sLink.substr(0, 4))
|
||||||
{
|
{
|
||||||
|
|
@ -138,15 +148,15 @@ AttachmentModel.prototype.generateTransferDownloadUrl = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.mimeType + ':' + this.fileName + ':' + sLink;
|
return this.mimeType + ':' + this.fileName + ':' + sLink;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AttachmentModel} oAttachment
|
* @param {AttachmentModel} oAttachment
|
||||||
* @param {*} oEvent
|
* @param {*} oEvent
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
|
AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
|
||||||
{
|
{
|
||||||
var oLocalEvent = oEvent.originalEvent || oEvent;
|
var oLocalEvent = oEvent.originalEvent || oEvent;
|
||||||
if (oAttachment && oLocalEvent && oLocalEvent.dataTransfer && oLocalEvent.dataTransfer.setData)
|
if (oAttachment && oLocalEvent && oLocalEvent.dataTransfer && oLocalEvent.dataTransfer.setData)
|
||||||
{
|
{
|
||||||
|
|
@ -154,10 +164,10 @@ AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
AttachmentModel.prototype.iconClass = function ()
|
AttachmentModel.prototype.iconClass = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aParts = this.mimeType.toLocaleString().split('/'),
|
aParts = this.mimeType.toLocaleString().split('/'),
|
||||||
sClass = 'icon-file'
|
sClass = 'icon-file'
|
||||||
|
|
@ -186,17 +196,17 @@ AttachmentModel.prototype.iconClass = function ()
|
||||||
{
|
{
|
||||||
sClass = 'icon-file-zip';
|
sClass = 'icon-file-zip';
|
||||||
}
|
}
|
||||||
// else if (-1 < Utils.inArray(aParts[1],
|
// else if (-1 < Utils.inArray(aParts[1],
|
||||||
// ['pdf', 'x-pdf']))
|
// ['pdf', 'x-pdf']))
|
||||||
// {
|
// {
|
||||||
// sClass = 'icon-file-pdf';
|
// sClass = 'icon-file-pdf';
|
||||||
// }
|
// }
|
||||||
// else if (-1 < Utils.inArray(aParts[1], [
|
// else if (-1 < Utils.inArray(aParts[1], [
|
||||||
// 'exe', 'x-exe', 'x-winexe', 'bat'
|
// 'exe', 'x-exe', 'x-winexe', 'bat'
|
||||||
// ]))
|
// ]))
|
||||||
// {
|
// {
|
||||||
// sClass = 'icon-console';
|
// sClass = 'icon-console';
|
||||||
// }
|
// }
|
||||||
else if (-1 < Utils.inArray(aParts[1], [
|
else if (-1 < Utils.inArray(aParts[1], [
|
||||||
'rtf', 'msword', 'vnd.msword', 'vnd.openxmlformats-officedocument.wordprocessingml.document',
|
'rtf', 'msword', 'vnd.msword', 'vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||||
'vnd.openxmlformats-officedocument.wordprocessingml.template',
|
'vnd.openxmlformats-officedocument.wordprocessingml.template',
|
||||||
|
|
@ -234,4 +244,8 @@ AttachmentModel.prototype.iconClass = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return sClass;
|
return sClass;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = AttachmentModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,6 +1,15 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @param {string} sId
|
* @param {string} sId
|
||||||
* @param {string} sFileName
|
* @param {string} sFileName
|
||||||
|
|
@ -10,8 +19,8 @@
|
||||||
* @param {string=} sCID
|
* @param {string=} sCID
|
||||||
* @param {string=} sContentLocation
|
* @param {string=} sContentLocation
|
||||||
*/
|
*/
|
||||||
function ComposeAttachmentModel(sId, sFileName, nSize, bInline, bLinked, sCID, sContentLocation)
|
function ComposeAttachmentModel(sId, sFileName, nSize, bInline, bLinked, sCID, sContentLocation)
|
||||||
{
|
{
|
||||||
this.id = sId;
|
this.id = sId;
|
||||||
this.isInline = Utils.isUnd(bInline) ? false : !!bInline;
|
this.isInline = Utils.isUnd(bInline) ? false : !!bInline;
|
||||||
this.isLinked = Utils.isUnd(bLinked) ? false : !!bLinked;
|
this.isLinked = Utils.isUnd(bLinked) ? false : !!bLinked;
|
||||||
|
|
@ -33,21 +42,21 @@ function ComposeAttachmentModel(sId, sFileName, nSize, bInline, bLinked, sCID, s
|
||||||
var mSize = this.size();
|
var mSize = this.size();
|
||||||
return null === mSize ? '' : Utils.friendlySize(this.size());
|
return null === mSize ? '' : Utils.friendlySize(this.size());
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
ComposeAttachmentModel.prototype.id = '';
|
ComposeAttachmentModel.prototype.id = '';
|
||||||
ComposeAttachmentModel.prototype.isInline = false;
|
ComposeAttachmentModel.prototype.isInline = false;
|
||||||
ComposeAttachmentModel.prototype.isLinked = false;
|
ComposeAttachmentModel.prototype.isLinked = false;
|
||||||
ComposeAttachmentModel.prototype.CID = '';
|
ComposeAttachmentModel.prototype.CID = '';
|
||||||
ComposeAttachmentModel.prototype.contentLocation = '';
|
ComposeAttachmentModel.prototype.contentLocation = '';
|
||||||
ComposeAttachmentModel.prototype.fromMessage = false;
|
ComposeAttachmentModel.prototype.fromMessage = false;
|
||||||
ComposeAttachmentModel.prototype.cancel = Utils.emptyFunction;
|
ComposeAttachmentModel.prototype.cancel = Utils.emptyFunction;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AjaxJsonComposeAttachment} oJsonAttachment
|
* @param {AjaxJsonComposeAttachment} oJsonAttachment
|
||||||
*/
|
*/
|
||||||
ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
|
ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oJsonAttachment)
|
if (oJsonAttachment)
|
||||||
{
|
{
|
||||||
|
|
@ -60,4 +69,8 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = ComposeAttachmentModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,10 +1,21 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ContactModel()
|
function ContactModel()
|
||||||
{
|
{
|
||||||
this.idContact = 0;
|
this.idContact = 0;
|
||||||
this.display = '';
|
this.display = '';
|
||||||
this.properties = [];
|
this.properties = [];
|
||||||
|
|
@ -15,13 +26,13 @@ function ContactModel()
|
||||||
this.selected = ko.observable(false);
|
this.selected = ko.observable(false);
|
||||||
this.checked = ko.observable(false);
|
this.checked = ko.observable(false);
|
||||||
this.deleted = ko.observable(false);
|
this.deleted = ko.observable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Array|null}
|
* @return {Array|null}
|
||||||
*/
|
*/
|
||||||
ContactModel.prototype.getNameAndEmailHelper = function ()
|
ContactModel.prototype.getNameAndEmailHelper = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sName = '',
|
sName = '',
|
||||||
sEmail = ''
|
sEmail = ''
|
||||||
|
|
@ -49,10 +60,10 @@ ContactModel.prototype.getNameAndEmailHelper = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return '' === sEmail ? null : [sEmail, sName];
|
return '' === sEmail ? null : [sEmail, sName];
|
||||||
};
|
};
|
||||||
|
|
||||||
ContactModel.prototype.parse = function (oItem)
|
ContactModel.prototype.parse = function (oItem)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oItem && 'Object/Contact' === oItem['@Object'])
|
if (oItem && 'Object/Contact' === oItem['@Object'])
|
||||||
{
|
{
|
||||||
|
|
@ -80,29 +91,29 @@ ContactModel.prototype.parse = function (oItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
ContactModel.prototype.srcAttr = function ()
|
ContactModel.prototype.srcAttr = function ()
|
||||||
{
|
{
|
||||||
return RL.link().emptyContactPic();
|
return RL.link().emptyContactPic(); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
ContactModel.prototype.generateUid = function ()
|
ContactModel.prototype.generateUid = function ()
|
||||||
{
|
{
|
||||||
return '' + this.idContact;
|
return '' + this.idContact;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
ContactModel.prototype.lineAsCcc = function ()
|
ContactModel.prototype.lineAsCcc = function ()
|
||||||
{
|
{
|
||||||
var aResult = [];
|
var aResult = [];
|
||||||
if (this.deleted())
|
if (this.deleted())
|
||||||
{
|
{
|
||||||
|
|
@ -122,4 +133,8 @@ ContactModel.prototype.lineAsCcc = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult.join(' ');
|
return aResult.join(' ');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = ContactModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,6 +1,16 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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 {number=} iType = Enums.ContactPropertyType.Unknown
|
||||||
* @param {string=} sTypeStr = ''
|
* @param {string=} sTypeStr = ''
|
||||||
* @param {string=} sValue = ''
|
* @param {string=} sValue = ''
|
||||||
|
|
@ -9,8 +19,8 @@
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
||||||
{
|
{
|
||||||
this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
|
this.type = ko.observable(Utils.isUnd(iType) ? Enums.ContactPropertyType.Unknown : iType);
|
||||||
this.typeStr = ko.observable(Utils.isUnd(sTypeStr) ? '' : sTypeStr);
|
this.typeStr = ko.observable(Utils.isUnd(sTypeStr) ? '' : sTypeStr);
|
||||||
this.focused = ko.observable(Utils.isUnd(bFocused) ? false : !!bFocused);
|
this.focused = ko.observable(Utils.isUnd(bFocused) ? false : !!bFocused);
|
||||||
|
|
@ -26,5 +36,8 @@ function ContactPropertyModel(iType, sTypeStr, sValue, bFocused, sPlaceholder)
|
||||||
this.largeValue = ko.computed(function () {
|
this.largeValue = ko.computed(function () {
|
||||||
return Enums.ContactPropertyType.Note === this.type();
|
return Enums.ContactPropertyType.Note === this.type();
|
||||||
}, this);
|
}, this);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
module.exports = ContactPropertyModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,17 +1,26 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function ContactTagModel()
|
function ContactTagModel()
|
||||||
{
|
{
|
||||||
this.idContactTag = 0;
|
this.idContactTag = 0;
|
||||||
this.name = ko.observable('');
|
this.name = ko.observable('');
|
||||||
this.readOnly = false;
|
this.readOnly = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ContactTagModel.prototype.parse = function (oItem)
|
ContactTagModel.prototype.parse = function (oItem)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oItem && 'Object/Tag' === oItem['@Object'])
|
if (oItem && 'Object/Tag' === oItem['@Object'])
|
||||||
{
|
{
|
||||||
|
|
@ -23,23 +32,27 @@ ContactTagModel.prototype.parse = function (oItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sSearch
|
* @param {string} sSearch
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
ContactTagModel.prototype.filterHelper = function (sSearch)
|
ContactTagModel.prototype.filterHelper = function (sSearch)
|
||||||
{
|
{
|
||||||
return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
|
return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean=} bEncodeHtml = false
|
* @param {boolean=} bEncodeHtml = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
ContactTagModel.prototype.toLine = function (bEncodeHtml)
|
ContactTagModel.prototype.toLine = function (bEncodeHtml)
|
||||||
{
|
{
|
||||||
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
|
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
|
||||||
Utils.encodeHtml(this.name()) : this.name();
|
Utils.encodeHtml(this.name()) : this.name();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = ContactTagModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,83 +1,92 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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=} sEmail
|
||||||
* @param {string=} sName
|
* @param {string=} sName
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function EmailModel(sEmail, sName)
|
function EmailModel(sEmail, sName)
|
||||||
{
|
{
|
||||||
this.email = sEmail || '';
|
this.email = sEmail || '';
|
||||||
this.name = sName || '';
|
this.name = sName || '';
|
||||||
this.privateType = null;
|
this.privateType = null;
|
||||||
|
|
||||||
this.clearDuplicateName();
|
this.clearDuplicateName();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {AjaxJsonEmail} oJsonEmail
|
* @param {AjaxJsonEmail} oJsonEmail
|
||||||
* @return {?EmailModel}
|
* @return {?EmailModel}
|
||||||
*/
|
*/
|
||||||
EmailModel.newInstanceFromJson = function (oJsonEmail)
|
EmailModel.newInstanceFromJson = function (oJsonEmail)
|
||||||
{
|
{
|
||||||
var oEmailModel = new EmailModel();
|
var oEmailModel = new EmailModel();
|
||||||
return oEmailModel.initByJson(oJsonEmail) ? oEmailModel : null;
|
return oEmailModel.initByJson(oJsonEmail) ? oEmailModel : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.name = '';
|
EmailModel.prototype.name = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {string}
|
* @type {string}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.email = '';
|
EmailModel.prototype.email = '';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {(number|null)}
|
* @type {(number|null)}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.privateType = null;
|
EmailModel.prototype.privateType = null;
|
||||||
|
|
||||||
EmailModel.prototype.clear = function ()
|
EmailModel.prototype.clear = function ()
|
||||||
{
|
{
|
||||||
this.email = '';
|
this.email = '';
|
||||||
this.name = '';
|
this.name = '';
|
||||||
this.privateType = null;
|
this.privateType = null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.validate = function ()
|
EmailModel.prototype.validate = function ()
|
||||||
{
|
{
|
||||||
return '' !== this.name || '' !== this.email;
|
return '' !== this.name || '' !== this.email;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} bWithoutName = false
|
* @param {boolean} bWithoutName = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.hash = function (bWithoutName)
|
EmailModel.prototype.hash = function (bWithoutName)
|
||||||
{
|
{
|
||||||
return '#' + (bWithoutName ? '' : this.name) + '#' + this.email + '#';
|
return '#' + (bWithoutName ? '' : this.name) + '#' + this.email + '#';
|
||||||
};
|
};
|
||||||
|
|
||||||
EmailModel.prototype.clearDuplicateName = function ()
|
EmailModel.prototype.clearDuplicateName = function ()
|
||||||
{
|
{
|
||||||
if (this.name === this.email)
|
if (this.name === this.email)
|
||||||
{
|
{
|
||||||
this.name = '';
|
this.name = '';
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {number}
|
* @return {number}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.type = function ()
|
EmailModel.prototype.type = function ()
|
||||||
{
|
{
|
||||||
if (null === this.privateType)
|
if (null === this.privateType)
|
||||||
{
|
{
|
||||||
if (this.email && '@facebook.com' === this.email.substr(-13))
|
if (this.email && '@facebook.com' === this.email.substr(-13))
|
||||||
|
|
@ -92,22 +101,22 @@ EmailModel.prototype.type = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.privateType;
|
return this.privateType;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sQuery
|
* @param {string} sQuery
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.search = function (sQuery)
|
EmailModel.prototype.search = function (sQuery)
|
||||||
{
|
{
|
||||||
return -1 < (this.name + ' ' + this.email).toLowerCase().indexOf(sQuery.toLowerCase());
|
return -1 < (this.name + ' ' + this.email).toLowerCase().indexOf(sQuery.toLowerCase());
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sString
|
* @param {string} sString
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.parse = function (sString)
|
EmailModel.prototype.parse = function (sString)
|
||||||
{
|
{
|
||||||
this.clear();
|
this.clear();
|
||||||
|
|
||||||
sString = Utils.trim(sString);
|
sString = Utils.trim(sString);
|
||||||
|
|
@ -129,14 +138,14 @@ EmailModel.prototype.parse = function (sString)
|
||||||
this.name = '';
|
this.name = '';
|
||||||
this.email = sString;
|
this.email = sString;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AjaxJsonEmail} oJsonEmail
|
* @param {AjaxJsonEmail} oJsonEmail
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.initByJson = function (oJsonEmail)
|
EmailModel.prototype.initByJson = function (oJsonEmail)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oJsonEmail && 'Object/Email' === oJsonEmail['@Object'])
|
if (oJsonEmail && 'Object/Email' === oJsonEmail['@Object'])
|
||||||
{
|
{
|
||||||
|
|
@ -148,16 +157,16 @@ EmailModel.prototype.initByJson = function (oJsonEmail)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} bFriendlyView
|
* @param {boolean} bFriendlyView
|
||||||
* @param {boolean=} bWrapWithLink = false
|
* @param {boolean=} bWrapWithLink = false
|
||||||
* @param {boolean=} bEncodeHtml = false
|
* @param {boolean=} bEncodeHtml = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtml)
|
EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtml)
|
||||||
{
|
{
|
||||||
var sResult = '';
|
var sResult = '';
|
||||||
if ('' !== this.email)
|
if ('' !== this.email)
|
||||||
{
|
{
|
||||||
|
|
@ -197,14 +206,14 @@ EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtm
|
||||||
}
|
}
|
||||||
|
|
||||||
return sResult;
|
return sResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} $sEmailAddress
|
* @param {string} $sEmailAddress
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.mailsoParse = function ($sEmailAddress)
|
EmailModel.prototype.mailsoParse = function ($sEmailAddress)
|
||||||
{
|
{
|
||||||
$sEmailAddress = Utils.trim($sEmailAddress);
|
$sEmailAddress = Utils.trim($sEmailAddress);
|
||||||
if ('' === $sEmailAddress)
|
if ('' === $sEmailAddress)
|
||||||
{
|
{
|
||||||
|
|
@ -354,12 +363,16 @@ EmailModel.prototype.mailsoParse = function ($sEmailAddress)
|
||||||
|
|
||||||
this.clearDuplicateName();
|
this.clearDuplicateName();
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
EmailModel.prototype.inputoTagLine = function ()
|
EmailModel.prototype.inputoTagLine = function ()
|
||||||
{
|
{
|
||||||
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
|
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = EmailModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,10 +1,20 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function FilterConditionModel(oKoList)
|
function FilterConditionModel(oKoList)
|
||||||
{
|
{
|
||||||
this.parentList = oKoList;
|
this.parentList = oKoList;
|
||||||
|
|
||||||
this.field = ko.observable(Enums.FilterConditionField.From);
|
this.field = ko.observable(Enums.FilterConditionField.From);
|
||||||
|
|
@ -40,9 +50,13 @@ function FilterConditionModel(oKoList)
|
||||||
return sTemplate;
|
return sTemplate;
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterConditionModel.prototype.removeSelf = function ()
|
FilterConditionModel.prototype.removeSelf = function ()
|
||||||
{
|
{
|
||||||
this.parentList.remove(this);
|
this.parentList.remove(this);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = FilterConditionModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,10 +1,21 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function FilterModel()
|
function FilterModel()
|
||||||
{
|
{
|
||||||
this.new = ko.observable(true);
|
this.new = ko.observable(true);
|
||||||
this.enabled = ko.observable(true);
|
this.enabled = ko.observable(true);
|
||||||
|
|
||||||
|
|
@ -27,7 +38,7 @@ function FilterModel()
|
||||||
this.actionTypeOptions = [ // TODO i18n
|
this.actionTypeOptions = [ // TODO i18n
|
||||||
{'id': Enums.FiltersAction.None, 'name': 'Action - None'},
|
{'id': Enums.FiltersAction.None, 'name': 'Action - None'},
|
||||||
{'id': Enums.FiltersAction.Move, 'name': 'Action - Move to'},
|
{'id': Enums.FiltersAction.Move, 'name': 'Action - Move to'},
|
||||||
// {'id': Enums.FiltersAction.Forward, 'name': 'Action - Forward to'},
|
// {'id': Enums.FiltersAction.Forward, 'name': 'Action - Forward to'},
|
||||||
{'id': Enums.FiltersAction.Discard, 'name': 'Action - Discard'}
|
{'id': Enums.FiltersAction.Discard, 'name': 'Action - Discard'}
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
@ -58,15 +69,15 @@ function FilterModel()
|
||||||
return sTemplate;
|
return sTemplate;
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
FilterModel.prototype.addCondition = function ()
|
FilterModel.prototype.addCondition = function ()
|
||||||
{
|
{
|
||||||
this.conditions.push(new FilterConditionModel(this.conditions));
|
this.conditions.push(new FilterConditionModel(this.conditions));
|
||||||
};
|
};
|
||||||
|
|
||||||
FilterModel.prototype.parse = function (oItem)
|
FilterModel.prototype.parse = function (oItem)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oItem && 'Object/Filter' === oItem['@Object'])
|
if (oItem && 'Object/Filter' === oItem['@Object'])
|
||||||
{
|
{
|
||||||
|
|
@ -76,4 +87,8 @@ FilterModel.prototype.parse = function (oItem)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = FilterModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,10 +1,23 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function FolderModel()
|
function FolderModel()
|
||||||
{
|
{
|
||||||
this.name = ko.observable('');
|
this.name = ko.observable('');
|
||||||
this.fullName = '';
|
this.fullName = '';
|
||||||
this.fullNameRaw = '';
|
this.fullNameRaw = '';
|
||||||
|
|
@ -45,24 +58,24 @@ function FolderModel()
|
||||||
this.privateMessageCountUnread = ko.observable(0);
|
this.privateMessageCountUnread = ko.observable(0);
|
||||||
|
|
||||||
this.collapsedPrivate = ko.observable(true);
|
this.collapsedPrivate = ko.observable(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {AjaxJsonFolder} oJsonFolder
|
* @param {AjaxJsonFolder} oJsonFolder
|
||||||
* @return {?FolderModel}
|
* @return {?FolderModel}
|
||||||
*/
|
*/
|
||||||
FolderModel.newInstanceFromJson = function (oJsonFolder)
|
FolderModel.newInstanceFromJson = function (oJsonFolder)
|
||||||
{
|
{
|
||||||
var oFolderModel = new FolderModel();
|
var oFolderModel = new FolderModel();
|
||||||
return oFolderModel.initByJson(oJsonFolder) ? oFolderModel.initComputed() : null;
|
return oFolderModel.initByJson(oJsonFolder) ? oFolderModel.initComputed() : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {FolderModel}
|
* @return {FolderModel}
|
||||||
*/
|
*/
|
||||||
FolderModel.prototype.initComputed = function ()
|
FolderModel.prototype.initComputed = function ()
|
||||||
{
|
{
|
||||||
this.hasSubScribedSubfolders = ko.computed(function () {
|
this.hasSubScribedSubfolders = ko.computed(function () {
|
||||||
return !!_.find(this.subFolders(), function (oFolder) {
|
return !!_.find(this.subFolders(), function (oFolder) {
|
||||||
return oFolder.subScribed() && !oFolder.isSystemFolder();
|
return oFolder.subScribed() && !oFolder.isSystemFolder();
|
||||||
|
|
@ -139,7 +152,7 @@ FolderModel.prototype.initComputed = function ()
|
||||||
|
|
||||||
if (Enums.FolderType.Inbox === iType)
|
if (Enums.FolderType.Inbox === iType)
|
||||||
{
|
{
|
||||||
RL.data().foldersInboxUnreadCount(iUnread);
|
RL.data().foldersInboxUnreadCount(iUnread); // TODO cjs
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < iCount)
|
if (0 < iCount)
|
||||||
|
|
@ -278,31 +291,31 @@ FolderModel.prototype.initComputed = function ()
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
FolderModel.prototype.fullName = '';
|
FolderModel.prototype.fullName = '';
|
||||||
FolderModel.prototype.fullNameRaw = '';
|
FolderModel.prototype.fullNameRaw = '';
|
||||||
FolderModel.prototype.fullNameHash = '';
|
FolderModel.prototype.fullNameHash = '';
|
||||||
FolderModel.prototype.delimiter = '';
|
FolderModel.prototype.delimiter = '';
|
||||||
FolderModel.prototype.namespace = '';
|
FolderModel.prototype.namespace = '';
|
||||||
FolderModel.prototype.deep = 0;
|
FolderModel.prototype.deep = 0;
|
||||||
FolderModel.prototype.interval = 0;
|
FolderModel.prototype.interval = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
FolderModel.prototype.collapsedCss = function ()
|
FolderModel.prototype.collapsedCss = function ()
|
||||||
{
|
{
|
||||||
return this.hasSubScribedSubfolders() ?
|
return this.hasSubScribedSubfolders() ?
|
||||||
(this.collapsed() ? 'icon-right-mini e-collapsed-sign' : 'icon-down-mini e-collapsed-sign') : 'icon-none e-collapsed-sign';
|
(this.collapsed() ? 'icon-right-mini e-collapsed-sign' : 'icon-down-mini e-collapsed-sign') : 'icon-none e-collapsed-sign';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AjaxJsonFolder} oJsonFolder
|
* @param {AjaxJsonFolder} oJsonFolder
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
FolderModel.prototype.initByJson = function (oJsonFolder)
|
FolderModel.prototype.initByJson = function (oJsonFolder)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oJsonFolder && 'Object/Folder' === oJsonFolder['@Object'])
|
if (oJsonFolder && 'Object/Folder' === oJsonFolder['@Object'])
|
||||||
{
|
{
|
||||||
|
|
@ -322,12 +335,16 @@ FolderModel.prototype.initByJson = function (oJsonFolder)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
FolderModel.prototype.printableFullName = function ()
|
FolderModel.prototype.printableFullName = function ()
|
||||||
{
|
{
|
||||||
return this.fullName.split(this.delimiter).join(' / ');
|
return this.fullName.split(this.delimiter).join(' / ');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = FolderModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,13 +1,22 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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} sId
|
||||||
* @param {string} sEmail
|
* @param {string} sEmail
|
||||||
* @param {boolean=} bCanBeDelete = true
|
* @param {boolean=} bCanBeDelete = true
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function IdentityModel(sId, sEmail, bCanBeDelete)
|
function IdentityModel(sId, sEmail, bCanBeDelete)
|
||||||
{
|
{
|
||||||
this.id = sId;
|
this.id = sId;
|
||||||
this.email = ko.observable(sEmail);
|
this.email = ko.observable(sEmail);
|
||||||
this.name = ko.observable('');
|
this.name = ko.observable('');
|
||||||
|
|
@ -16,22 +25,26 @@ function IdentityModel(sId, sEmail, bCanBeDelete)
|
||||||
|
|
||||||
this.deleteAccess = ko.observable(false);
|
this.deleteAccess = ko.observable(false);
|
||||||
this.canBeDalete = ko.observable(bCanBeDelete);
|
this.canBeDalete = ko.observable(bCanBeDelete);
|
||||||
}
|
}
|
||||||
|
|
||||||
IdentityModel.prototype.formattedName = function ()
|
IdentityModel.prototype.formattedName = function ()
|
||||||
{
|
{
|
||||||
var sName = this.name();
|
var sName = this.name();
|
||||||
return '' === sName ? this.email() : sName + ' <' + this.email() + '>';
|
return '' === sName ? this.email() : sName + ' <' + this.email() + '>';
|
||||||
};
|
};
|
||||||
|
|
||||||
IdentityModel.prototype.formattedNameForCompose = function ()
|
IdentityModel.prototype.formattedNameForCompose = function ()
|
||||||
{
|
{
|
||||||
var sName = this.name();
|
var sName = this.name();
|
||||||
return '' === sName ? this.email() : sName + ' (' + this.email() + ')';
|
return '' === sName ? this.email() : sName + ' (' + this.email() + ')';
|
||||||
};
|
};
|
||||||
|
|
||||||
IdentityModel.prototype.formattedNameForEmail = function ()
|
IdentityModel.prototype.formattedNameForEmail = function ()
|
||||||
{
|
{
|
||||||
var sName = this.name();
|
var sName = this.name();
|
||||||
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
|
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = IdentityModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,10 +1,30 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function MessageModel()
|
function MessageModel()
|
||||||
{
|
{
|
||||||
this.folderFullNameRaw = '';
|
this.folderFullNameRaw = '';
|
||||||
this.uid = '';
|
this.uid = '';
|
||||||
this.hash = '';
|
this.hash = '';
|
||||||
|
|
@ -68,9 +88,9 @@ function MessageModel()
|
||||||
case 'doc':
|
case 'doc':
|
||||||
sClass = 'icon-file-text';
|
sClass = 'icon-file-text';
|
||||||
break;
|
break;
|
||||||
// case 'pdf':
|
// case 'pdf':
|
||||||
// sClass = 'icon-file-pdf';
|
// sClass = 'icon-file-pdf';
|
||||||
// break;
|
// break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return sClass;
|
return sClass;
|
||||||
|
|
@ -120,38 +140,38 @@ function MessageModel()
|
||||||
var iCount = this.threadsLen();
|
var iCount = this.threadsLen();
|
||||||
return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : '';
|
return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : '';
|
||||||
}, this);
|
}, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {AjaxJsonMessage} oJsonMessage
|
* @param {AjaxJsonMessage} oJsonMessage
|
||||||
* @return {?MessageModel}
|
* @return {?MessageModel}
|
||||||
*/
|
*/
|
||||||
MessageModel.newInstanceFromJson = function (oJsonMessage)
|
MessageModel.newInstanceFromJson = function (oJsonMessage)
|
||||||
{
|
{
|
||||||
var oMessageModel = new MessageModel();
|
var oMessageModel = new MessageModel();
|
||||||
return oMessageModel.initByJson(oJsonMessage) ? oMessageModel : null;
|
return oMessageModel.initByJson(oJsonMessage) ? oMessageModel : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {number} iTimeStampInUTC
|
* @param {number} iTimeStampInUTC
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.calculateFullFromatDateValue = function (iTimeStampInUTC)
|
MessageModel.calculateFullFromatDateValue = function (iTimeStampInUTC)
|
||||||
{
|
{
|
||||||
return 0 < iTimeStampInUTC ? moment.unix(iTimeStampInUTC).format('LLL') : '';
|
return 0 < iTimeStampInUTC ? moment.unix(iTimeStampInUTC).format('LLL') : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {Array} aEmail
|
* @param {Array} aEmail
|
||||||
* @param {boolean=} bFriendlyView
|
* @param {boolean=} bFriendlyView
|
||||||
* @param {boolean=} bWrapWithLink = false
|
* @param {boolean=} bWrapWithLink = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
|
MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aResult = [],
|
aResult = [],
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
|
|
@ -167,15 +187,15 @@ MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult.join(', ');
|
return aResult.join(', ');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {Array} aEmail
|
* @param {Array} aEmail
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.emailsToLineClear = function (aEmail)
|
MessageModel.emailsToLineClear = function (aEmail)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aResult = [],
|
aResult = [],
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
|
|
@ -194,15 +214,15 @@ MessageModel.emailsToLineClear = function (aEmail)
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult.join(', ');
|
return aResult.join(', ');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {?Array} aJsonEmails
|
* @param {?Array} aJsonEmails
|
||||||
* @return {Array.<EmailModel>}
|
* @return {Array.<EmailModel>}
|
||||||
*/
|
*/
|
||||||
MessageModel.initEmailsFromJson = function (aJsonEmails)
|
MessageModel.initEmailsFromJson = function (aJsonEmails)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
iLen = 0,
|
iLen = 0,
|
||||||
|
|
@ -223,16 +243,16 @@ MessageModel.initEmailsFromJson = function (aJsonEmails)
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult;
|
return aResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @static
|
* @static
|
||||||
* @param {Array.<EmailModel>} aMessageEmails
|
* @param {Array.<EmailModel>} aMessageEmails
|
||||||
* @param {Object} oLocalUnic
|
* @param {Object} oLocalUnic
|
||||||
* @param {Array} aLocalEmails
|
* @param {Array} aLocalEmails
|
||||||
*/
|
*/
|
||||||
MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
|
MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
|
||||||
{
|
{
|
||||||
if (aMessageEmails && 0 < aMessageEmails.length)
|
if (aMessageEmails && 0 < aMessageEmails.length)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -249,10 +269,10 @@ MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.clear = function ()
|
MessageModel.prototype.clear = function ()
|
||||||
{
|
{
|
||||||
this.folderFullNameRaw = '';
|
this.folderFullNameRaw = '';
|
||||||
this.uid = '';
|
this.uid = '';
|
||||||
this.hash = '';
|
this.hash = '';
|
||||||
|
|
@ -321,10 +341,10 @@ MessageModel.prototype.clear = function ()
|
||||||
|
|
||||||
this.lastInCollapsedThread(false);
|
this.lastInCollapsedThread(false);
|
||||||
this.lastInCollapsedThreadLoading(false);
|
this.lastInCollapsedThreadLoading(false);
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.computeSenderEmail = function ()
|
MessageModel.prototype.computeSenderEmail = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sSent = RL.data().sentFolder(),
|
sSent = RL.data().sentFolder(),
|
||||||
sDraft = RL.data().draftFolder()
|
sDraft = RL.data().draftFolder()
|
||||||
|
|
@ -335,14 +355,14 @@ MessageModel.prototype.computeSenderEmail = function ()
|
||||||
|
|
||||||
this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
|
this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
|
||||||
this.toClearEmailsString() : this.fromClearEmailString());
|
this.toClearEmailsString() : this.fromClearEmailString());
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AjaxJsonMessage} oJsonMessage
|
* @param {AjaxJsonMessage} oJsonMessage
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.initByJson = function (oJsonMessage)
|
MessageModel.prototype.initByJson = function (oJsonMessage)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
|
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
|
||||||
{
|
{
|
||||||
|
|
@ -394,14 +414,14 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AjaxJsonMessage} oJsonMessage
|
* @param {AjaxJsonMessage} oJsonMessage
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
bResult = false,
|
bResult = false,
|
||||||
iPriority = Enums.MessagePriority.Normal
|
iPriority = Enums.MessagePriority.Normal
|
||||||
|
|
@ -421,7 +441,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
||||||
|
|
||||||
this.proxy = !!oJsonMessage.ExternalProxy;
|
this.proxy = !!oJsonMessage.ExternalProxy;
|
||||||
|
|
||||||
if (RL.data().capaOpenPGP())
|
if (RL.data().capaOpenPGP()) // TODO cjs
|
||||||
{
|
{
|
||||||
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
this.isPgpSigned(!!oJsonMessage.PgpSigned);
|
||||||
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
|
||||||
|
|
@ -441,14 +461,14 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {(AjaxJsonAttachment|null)} oJsonAttachments
|
* @param {(AjaxJsonAttachment|null)} oJsonAttachments
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
|
MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
iIndex = 0,
|
iIndex = 0,
|
||||||
iLen = 0,
|
iLen = 0,
|
||||||
|
|
@ -476,14 +496,14 @@ MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult;
|
return aResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {AjaxJsonMessage} oJsonMessage
|
* @param {AjaxJsonMessage} oJsonMessage
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
|
MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
|
||||||
{
|
{
|
||||||
var bResult = false;
|
var bResult = false;
|
||||||
|
|
||||||
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
|
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
|
||||||
|
|
@ -498,53 +518,53 @@ MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
|
||||||
}
|
}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} bFriendlyView
|
* @param {boolean} bFriendlyView
|
||||||
* @param {boolean=} bWrapWithLink = false
|
* @param {boolean=} bWrapWithLink = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
|
MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
|
||||||
{
|
{
|
||||||
return MessageModel.emailsToLine(this.from, bFriendlyView, bWrapWithLink);
|
return MessageModel.emailsToLine(this.from, bFriendlyView, bWrapWithLink);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} bFriendlyView
|
* @param {boolean} bFriendlyView
|
||||||
* @param {boolean=} bWrapWithLink = false
|
* @param {boolean=} bWrapWithLink = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
|
MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
|
||||||
{
|
{
|
||||||
return MessageModel.emailsToLine(this.to, bFriendlyView, bWrapWithLink);
|
return MessageModel.emailsToLine(this.to, bFriendlyView, bWrapWithLink);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} bFriendlyView
|
* @param {boolean} bFriendlyView
|
||||||
* @param {boolean=} bWrapWithLink = false
|
* @param {boolean=} bWrapWithLink = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.ccToLine = function (bFriendlyView, bWrapWithLink)
|
MessageModel.prototype.ccToLine = function (bFriendlyView, bWrapWithLink)
|
||||||
{
|
{
|
||||||
return MessageModel.emailsToLine(this.cc, bFriendlyView, bWrapWithLink);
|
return MessageModel.emailsToLine(this.cc, bFriendlyView, bWrapWithLink);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean} bFriendlyView
|
* @param {boolean} bFriendlyView
|
||||||
* @param {boolean=} bWrapWithLink = false
|
* @param {boolean=} bWrapWithLink = false
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.bccToLine = function (bFriendlyView, bWrapWithLink)
|
MessageModel.prototype.bccToLine = function (bFriendlyView, bWrapWithLink)
|
||||||
{
|
{
|
||||||
return MessageModel.emailsToLine(this.bcc, bFriendlyView, bWrapWithLink);
|
return MessageModel.emailsToLine(this.bcc, bFriendlyView, bWrapWithLink);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.lineAsCcc = function ()
|
MessageModel.prototype.lineAsCcc = function ()
|
||||||
{
|
{
|
||||||
var aResult = [];
|
var aResult = [];
|
||||||
if (this.deleted())
|
if (this.deleted())
|
||||||
{
|
{
|
||||||
|
|
@ -617,25 +637,24 @@ MessageModel.prototype.lineAsCcc = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult.join(' ');
|
return aResult.join(' ');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.hasVisibleAttachments = function ()
|
MessageModel.prototype.hasVisibleAttachments = function ()
|
||||||
{
|
{
|
||||||
return !!_.find(this.attachments(), function (oAttachment) {
|
return !!_.find(this.attachments(), function (oAttachment) {
|
||||||
return !oAttachment.isLinked;
|
return !oAttachment.isLinked;
|
||||||
});
|
});
|
||||||
// return 0 < this.attachments().length;
|
};
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sCid
|
* @param {string} sCid
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.findAttachmentByCid = function (sCid)
|
MessageModel.prototype.findAttachmentByCid = function (sCid)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oResult = null,
|
oResult = null,
|
||||||
aAttachments = this.attachments()
|
aAttachments = this.attachments()
|
||||||
|
|
@ -650,14 +669,14 @@ MessageModel.prototype.findAttachmentByCid = function (sCid)
|
||||||
}
|
}
|
||||||
|
|
||||||
return oResult || null;
|
return oResult || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sContentLocation
|
* @param {string} sContentLocation
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocation)
|
MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocation)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oResult = null,
|
oResult = null,
|
||||||
aAttachments = this.attachments()
|
aAttachments = this.attachments()
|
||||||
|
|
@ -671,63 +690,63 @@ MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocat
|
||||||
}
|
}
|
||||||
|
|
||||||
return oResult || null;
|
return oResult || null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.messageId = function ()
|
MessageModel.prototype.messageId = function ()
|
||||||
{
|
{
|
||||||
return this.sMessageId;
|
return this.sMessageId;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.inReplyTo = function ()
|
MessageModel.prototype.inReplyTo = function ()
|
||||||
{
|
{
|
||||||
return this.sInReplyTo;
|
return this.sInReplyTo;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.references = function ()
|
MessageModel.prototype.references = function ()
|
||||||
{
|
{
|
||||||
return this.sReferences;
|
return this.sReferences;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.fromAsSingleEmail = function ()
|
MessageModel.prototype.fromAsSingleEmail = function ()
|
||||||
{
|
{
|
||||||
return Utils.isArray(this.from) && this.from[0] ? this.from[0].email : '';
|
return Utils.isArray(this.from) && this.from[0] ? this.from[0].email : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.viewLink = function ()
|
MessageModel.prototype.viewLink = function ()
|
||||||
{
|
{
|
||||||
return RL.link().messageViewLink(this.requestHash);
|
return RL.link().messageViewLink(this.requestHash);// TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.downloadLink = function ()
|
MessageModel.prototype.downloadLink = function ()
|
||||||
{
|
{
|
||||||
return RL.link().messageDownloadLink(this.requestHash);
|
return RL.link().messageDownloadLink(this.requestHash);// TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} oExcludeEmails
|
* @param {Object} oExcludeEmails
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.replyEmails = function (oExcludeEmails)
|
MessageModel.prototype.replyEmails = function (oExcludeEmails)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aResult = [],
|
aResult = [],
|
||||||
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
|
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
|
||||||
|
|
@ -740,14 +759,14 @@ MessageModel.prototype.replyEmails = function (oExcludeEmails)
|
||||||
}
|
}
|
||||||
|
|
||||||
return aResult;
|
return aResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {Object} oExcludeEmails
|
* @param {Object} oExcludeEmails
|
||||||
* @return {Array.<Array>}
|
* @return {Array.<Array>}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
|
MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aToResult = [],
|
aToResult = [],
|
||||||
aCcResult = [],
|
aCcResult = [],
|
||||||
|
|
@ -764,33 +783,33 @@ MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
|
||||||
MessageModel.replyHelper(this.cc, oUnic, aCcResult);
|
MessageModel.replyHelper(this.cc, oUnic, aCcResult);
|
||||||
|
|
||||||
return [aToResult, aCcResult];
|
return [aToResult, aCcResult];
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.textBodyToString = function ()
|
MessageModel.prototype.textBodyToString = function ()
|
||||||
{
|
{
|
||||||
return this.body ? this.body.html() : '';
|
return this.body ? this.body.html() : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.attachmentsToStringLine = function ()
|
MessageModel.prototype.attachmentsToStringLine = function ()
|
||||||
{
|
{
|
||||||
var aAttachLines = _.map(this.attachments(), function (oItem) {
|
var aAttachLines = _.map(this.attachments(), function (oItem) {
|
||||||
return oItem.fileName + ' (' + oItem.friendlySize + ')';
|
return oItem.fileName + ' (' + oItem.friendlySize + ')';
|
||||||
});
|
});
|
||||||
|
|
||||||
return aAttachLines && 0 < aAttachLines.length ? aAttachLines.join(', ') : '';
|
return aAttachLines && 0 < aAttachLines.length ? aAttachLines.join(', ') : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Object}
|
* @return {Object}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.getDataForWindowPopup = function ()
|
MessageModel.prototype.getDataForWindowPopup = function ()
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
'popupFrom': this.fromToLine(false),
|
'popupFrom': this.fromToLine(false),
|
||||||
'popupTo': this.toToLine(false),
|
'popupTo': this.toToLine(false),
|
||||||
|
|
@ -801,13 +820,13 @@ MessageModel.prototype.getDataForWindowPopup = function ()
|
||||||
'popupAttachments': this.attachmentsToStringLine(),
|
'popupAttachments': this.attachmentsToStringLine(),
|
||||||
'popupBody': this.textBodyToString()
|
'popupBody': this.textBodyToString()
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {boolean=} bPrint = false
|
* @param {boolean=} bPrint = false
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.viewPopupMessage = function (bPrint)
|
MessageModel.prototype.viewPopupMessage = function (bPrint)
|
||||||
{
|
{
|
||||||
Utils.windowPopupKnockout(this.getDataForWindowPopup(), 'PopupsWindowSimpleMessage', this.subject(), function (oPopupWin) {
|
Utils.windowPopupKnockout(this.getDataForWindowPopup(), 'PopupsWindowSimpleMessage', this.subject(), function (oPopupWin) {
|
||||||
if (oPopupWin && oPopupWin.document && oPopupWin.document.body)
|
if (oPopupWin && oPopupWin.document && oPopupWin.document.body)
|
||||||
{
|
{
|
||||||
|
|
@ -833,27 +852,27 @@ MessageModel.prototype.viewPopupMessage = function (bPrint)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.printMessage = function ()
|
MessageModel.prototype.printMessage = function ()
|
||||||
{
|
{
|
||||||
this.viewPopupMessage(true);
|
this.viewPopupMessage(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.generateUid = function ()
|
MessageModel.prototype.generateUid = function ()
|
||||||
{
|
{
|
||||||
return this.folderFullNameRaw + '/' + this.uid;
|
return this.folderFullNameRaw + '/' + this.uid;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MessageModel} oMessage
|
* @param {MessageModel} oMessage
|
||||||
* @return {MessageModel}
|
* @return {MessageModel}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
||||||
{
|
{
|
||||||
this.folderFullNameRaw = oMessage.folderFullNameRaw;
|
this.folderFullNameRaw = oMessage.folderFullNameRaw;
|
||||||
this.uid = oMessage.uid;
|
this.uid = oMessage.uid;
|
||||||
this.hash = oMessage.hash;
|
this.hash = oMessage.hash;
|
||||||
|
|
@ -896,12 +915,6 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
||||||
this.moment(oMessage.moment());
|
this.moment(oMessage.moment());
|
||||||
|
|
||||||
this.body = null;
|
this.body = null;
|
||||||
// this.isHtml(false);
|
|
||||||
// this.hasImages(false);
|
|
||||||
// this.attachments([]);
|
|
||||||
|
|
||||||
// this.isPgpSigned(false);
|
|
||||||
// this.isPgpEncrypted(false);
|
|
||||||
|
|
||||||
this.priority(Enums.MessagePriority.Normal);
|
this.priority(Enums.MessagePriority.Normal);
|
||||||
this.aDraftInfo = [];
|
this.aDraftInfo = [];
|
||||||
|
|
@ -916,10 +929,10 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
|
||||||
this.computeSenderEmail();
|
this.computeSenderEmail();
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.showExternalImages = function (bLazy)
|
MessageModel.prototype.showExternalImages = function (bLazy)
|
||||||
{
|
{
|
||||||
if (this.body && this.body.data('rl-has-images'))
|
if (this.body && this.body.data('rl-has-images'))
|
||||||
{
|
{
|
||||||
var sAttr = '';
|
var sAttr = '';
|
||||||
|
|
@ -965,10 +978,10 @@ MessageModel.prototype.showExternalImages = function (bLazy)
|
||||||
|
|
||||||
Utils.windowResize(500);
|
Utils.windowResize(500);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.showInternalImages = function (bLazy)
|
MessageModel.prototype.showInternalImages = function (bLazy)
|
||||||
{
|
{
|
||||||
if (this.body && !this.body.data('rl-init-internal-images'))
|
if (this.body && !this.body.data('rl-init-internal-images'))
|
||||||
{
|
{
|
||||||
this.body.data('rl-init-internal-images', true);
|
this.body.data('rl-init-internal-images', true);
|
||||||
|
|
@ -1054,10 +1067,10 @@ MessageModel.prototype.showInternalImages = function (bLazy)
|
||||||
|
|
||||||
Utils.windowResize(500);
|
Utils.windowResize(500);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.storeDataToDom = function ()
|
MessageModel.prototype.storeDataToDom = function ()
|
||||||
{
|
{
|
||||||
if (this.body)
|
if (this.body)
|
||||||
{
|
{
|
||||||
this.body.data('rl-is-html', !!this.isHtml());
|
this.body.data('rl-is-html', !!this.isHtml());
|
||||||
|
|
@ -1065,7 +1078,7 @@ MessageModel.prototype.storeDataToDom = function ()
|
||||||
|
|
||||||
this.body.data('rl-plain-raw', this.plainRaw);
|
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-signed', !!this.isPgpSigned());
|
||||||
this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
|
this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
|
||||||
|
|
@ -1073,19 +1086,19 @@ MessageModel.prototype.storeDataToDom = function ()
|
||||||
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
|
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.storePgpVerifyDataToDom = 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-status', this.pgpSignedVerifyStatus());
|
||||||
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
|
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.fetchDataToDom = function ()
|
MessageModel.prototype.fetchDataToDom = function ()
|
||||||
{
|
{
|
||||||
if (this.body)
|
if (this.body)
|
||||||
{
|
{
|
||||||
this.isHtml(!!this.body.data('rl-is-html'));
|
this.isHtml(!!this.body.data('rl-is-html'));
|
||||||
|
|
@ -1093,7 +1106,7 @@ MessageModel.prototype.fetchDataToDom = function ()
|
||||||
|
|
||||||
this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
|
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.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
|
||||||
this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
|
this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
|
||||||
|
|
@ -1108,17 +1121,17 @@ MessageModel.prototype.fetchDataToDom = function ()
|
||||||
this.pgpSignedVerifyUser('');
|
this.pgpSignedVerifyUser('');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
||||||
{
|
{
|
||||||
if (this.isPgpSigned())
|
if (this.isPgpSigned())
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aRes = [],
|
aRes = [],
|
||||||
mPgpMessage = null,
|
mPgpMessage = null,
|
||||||
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
|
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,
|
oValidKey = null,
|
||||||
oValidSysKey = null,
|
oValidSysKey = null,
|
||||||
sPlain = ''
|
sPlain = ''
|
||||||
|
|
@ -1144,7 +1157,7 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
||||||
|
|
||||||
if (oValidKey)
|
if (oValidKey)
|
||||||
{
|
{
|
||||||
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
|
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
|
||||||
if (oValidSysKey)
|
if (oValidSysKey)
|
||||||
{
|
{
|
||||||
sPlain = mPgpMessage.getText();
|
sPlain = mPgpMessage.getText();
|
||||||
|
|
@ -1153,12 +1166,12 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
||||||
this.pgpSignedVerifyUser(oValidSysKey.user);
|
this.pgpSignedVerifyUser(oValidSysKey.user);
|
||||||
|
|
||||||
sPlain =
|
sPlain =
|
||||||
$proxyDiv.empty().append(
|
$div.empty().append(
|
||||||
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
||||||
).html()
|
).html()
|
||||||
;
|
;
|
||||||
|
|
||||||
$proxyDiv.empty();
|
$div.empty();
|
||||||
|
|
||||||
this.replacePlaneTextBody(sPlain);
|
this.replacePlaneTextBody(sPlain);
|
||||||
}
|
}
|
||||||
|
|
@ -1170,10 +1183,10 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
|
||||||
|
|
||||||
this.storePgpVerifyDataToDom();
|
this.storePgpVerifyDataToDom();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
||||||
{
|
{
|
||||||
if (this.isPgpEncrypted())
|
if (this.isPgpEncrypted())
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
|
|
@ -1181,8 +1194,8 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
||||||
mPgpMessage = null,
|
mPgpMessage = null,
|
||||||
mPgpMessageDecrypted = null,
|
mPgpMessageDecrypted = null,
|
||||||
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
|
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
|
||||||
aPublicKey = RL.data().findPublicKeysByEmail(sFrom),
|
aPublicKey = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs
|
||||||
oPrivateKey = RL.data().findSelfPrivateKey(sPassword),
|
oPrivateKey = RL.data().findSelfPrivateKey(sPassword), // TODO cjs
|
||||||
oValidKey = null,
|
oValidKey = null,
|
||||||
oValidSysKey = null,
|
oValidSysKey = null,
|
||||||
sPlain = ''
|
sPlain = ''
|
||||||
|
|
@ -1215,7 +1228,7 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
||||||
|
|
||||||
if (oValidKey)
|
if (oValidKey)
|
||||||
{
|
{
|
||||||
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
|
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
|
||||||
if (oValidSysKey)
|
if (oValidSysKey)
|
||||||
{
|
{
|
||||||
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
|
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
|
||||||
|
|
@ -1227,12 +1240,12 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
||||||
sPlain = mPgpMessageDecrypted.getText();
|
sPlain = mPgpMessageDecrypted.getText();
|
||||||
|
|
||||||
sPlain =
|
sPlain =
|
||||||
$proxyDiv.empty().append(
|
$div.empty().append(
|
||||||
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
|
||||||
).html()
|
).html()
|
||||||
;
|
;
|
||||||
|
|
||||||
$proxyDiv.empty();
|
$div.empty();
|
||||||
|
|
||||||
this.replacePlaneTextBody(sPlain);
|
this.replacePlaneTextBody(sPlain);
|
||||||
}
|
}
|
||||||
|
|
@ -1242,21 +1255,25 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
|
||||||
|
|
||||||
this.storePgpVerifyDataToDom();
|
this.storePgpVerifyDataToDom();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MessageModel.prototype.replacePlaneTextBody = function (sPlain)
|
MessageModel.prototype.replacePlaneTextBody = function (sPlain)
|
||||||
{
|
{
|
||||||
if (this.body)
|
if (this.body)
|
||||||
{
|
{
|
||||||
this.body.html(sPlain).addClass('b-text-part plain');
|
this.body.html(sPlain).addClass('b-text-part plain');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
MessageModel.prototype.flagHash = function ()
|
MessageModel.prototype.flagHash = function ()
|
||||||
{
|
{
|
||||||
return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
|
return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
|
||||||
this.isReadReceipt()].join('');
|
this.isReadReceipt()].join('');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = MessageModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,6 +1,14 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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} iIndex
|
||||||
* @param {string} sGuID
|
* @param {string} sGuID
|
||||||
* @param {string} sID
|
* @param {string} sID
|
||||||
|
|
@ -10,8 +18,8 @@
|
||||||
* @param {string} sArmor
|
* @param {string} sArmor
|
||||||
* @constructor
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor)
|
function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor)
|
||||||
{
|
{
|
||||||
this.index = iIndex;
|
this.index = iIndex;
|
||||||
this.id = sID;
|
this.id = sID;
|
||||||
this.guid = sGuID;
|
this.guid = sGuID;
|
||||||
|
|
@ -21,12 +29,16 @@ function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor
|
||||||
this.isPrivate = !!bIsPrivate;
|
this.isPrivate = !!bIsPrivate;
|
||||||
|
|
||||||
this.deleteAccess = ko.observable(false);
|
this.deleteAccess = ko.observable(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
OpenPgpKeyModel.prototype.index = 0;
|
OpenPgpKeyModel.prototype.index = 0;
|
||||||
OpenPgpKeyModel.prototype.id = '';
|
OpenPgpKeyModel.prototype.id = '';
|
||||||
OpenPgpKeyModel.prototype.guid = '';
|
OpenPgpKeyModel.prototype.guid = '';
|
||||||
OpenPgpKeyModel.prototype.user = '';
|
OpenPgpKeyModel.prototype.user = '';
|
||||||
OpenPgpKeyModel.prototype.email = '';
|
OpenPgpKeyModel.prototype.email = '';
|
||||||
OpenPgpKeyModel.prototype.armor = '';
|
OpenPgpKeyModel.prototype.armor = '';
|
||||||
OpenPgpKeyModel.prototype.isPrivate = false;
|
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,24 +1,38 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @param {Array} aViewModels
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends KnoinAbstractScreen
|
* @extends KnoinAbstractScreen
|
||||||
*/
|
*/
|
||||||
function AbstractSettings(aViewModels)
|
function AbstractSettings(aViewModels)
|
||||||
{
|
{
|
||||||
KnoinAbstractScreen.call(this, 'settings', aViewModels);
|
KnoinAbstractScreen.call(this, 'settings', aViewModels);
|
||||||
|
|
||||||
this.menu = ko.observableArray([]);
|
this.menu = ko.observableArray([]);
|
||||||
|
|
||||||
this.oCurrentSubScreen = null;
|
this.oCurrentSubScreen = null;
|
||||||
this.oViewModelPlace = null;
|
this.oViewModelPlace = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
|
_.extend(AbstractSettings.prototype, KnoinAbstractScreen.prototype);
|
||||||
|
|
||||||
AbstractSettings.prototype.onRoute = function (sSubName)
|
AbstractSettings.prototype.onRoute = function (sSubName)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
oSettingsScreen = null,
|
oSettingsScreen = null,
|
||||||
|
|
@ -27,21 +41,21 @@ AbstractSettings.prototype.onRoute = function (sSubName)
|
||||||
oViewModelDom = null
|
oViewModelDom = null
|
||||||
;
|
;
|
||||||
|
|
||||||
RoutedSettingsViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
|
RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||||
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
sSubName === SettingsViewModel.__rlSettingsData.Route;
|
||||||
});
|
});
|
||||||
|
|
||||||
if (RoutedSettingsViewModel)
|
if (RoutedSettingsViewModel)
|
||||||
{
|
{
|
||||||
if (_.find(ViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
|
||||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
RoutedSettingsViewModel = null;
|
RoutedSettingsViewModel = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (RoutedSettingsViewModel && _.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
|
|
@ -66,7 +80,7 @@ AbstractSettings.prototype.onRoute = function (sSubName)
|
||||||
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
|
||||||
oViewModelDom.appendTo(oViewModelPlace);
|
oViewModelDom.appendTo(oViewModelPlace);
|
||||||
|
|
||||||
oSettingsScreen.data = RL.data();
|
oSettingsScreen.data = RL.data(); // TODO cjs
|
||||||
oSettingsScreen.viewModelDom = oViewModelDom;
|
oSettingsScreen.viewModelDom = oViewModelDom;
|
||||||
|
|
||||||
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
|
||||||
|
|
@ -122,24 +136,24 @@ AbstractSettings.prototype.onRoute = function (sSubName)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
kn.setHash(RL.link().settings(), false, true);
|
kn.setHash(RL.link().settings(), false, true); // TODO cjs
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractSettings.prototype.onHide = function ()
|
AbstractSettings.prototype.onHide = function ()
|
||||||
{
|
{
|
||||||
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
if (this.oCurrentSubScreen && this.oCurrentSubScreen.viewModelDom)
|
||||||
{
|
{
|
||||||
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
|
||||||
this.oCurrentSubScreen.viewModelDom.hide();
|
this.oCurrentSubScreen.viewModelDom.hide();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractSettings.prototype.onBuild = function ()
|
AbstractSettings.prototype.onBuild = function ()
|
||||||
{
|
{
|
||||||
_.each(ViewModels['settings'], function (SettingsViewModel) {
|
_.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||||
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
|
||||||
!_.find(ViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
!_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
|
||||||
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
|
|
@ -147,7 +161,7 @@ AbstractSettings.prototype.onBuild = function ()
|
||||||
'route': SettingsViewModel.__rlSettingsData.Route,
|
'route': SettingsViewModel.__rlSettingsData.Route,
|
||||||
'label': SettingsViewModel.__rlSettingsData.Label,
|
'label': SettingsViewModel.__rlSettingsData.Label,
|
||||||
'selected': ko.observable(false),
|
'selected': ko.observable(false),
|
||||||
'disabled': !!_.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
'disabled': !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
|
||||||
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|
@ -155,12 +169,12 @@ AbstractSettings.prototype.onBuild = function ()
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
|
||||||
};
|
};
|
||||||
|
|
||||||
AbstractSettings.prototype.routes = function ()
|
AbstractSettings.prototype.routes = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
DefaultViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
|
DefaultViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
|
||||||
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
|
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
|
||||||
}),
|
}),
|
||||||
sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
|
sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
|
||||||
|
|
@ -178,4 +192,8 @@ AbstractSettings.prototype.routes = function ()
|
||||||
['{subname}', oRules],
|
['{subname}', oRules],
|
||||||
['', oRules]
|
['', oRules]
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = AbstractSettings;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,17 +1,31 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends KnoinAbstractScreen
|
* @extends KnoinAbstractScreen
|
||||||
*/
|
*/
|
||||||
function AdminLoginScreen()
|
function AdminLoginScreen()
|
||||||
{
|
{
|
||||||
KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
|
KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
|
_.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
|
||||||
|
|
||||||
AdminLoginScreen.prototype.onShow = function ()
|
AdminLoginScreen.prototype.onShow = function ()
|
||||||
{
|
{
|
||||||
RL.setTitle('');
|
RL.setTitle(''); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = AdminLoginScreen;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,20 +1,35 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends AbstractSettings
|
* @extends AbstractSettings
|
||||||
*/
|
*/
|
||||||
function AdminSettingsScreen()
|
function AdminSettingsScreen()
|
||||||
{
|
{
|
||||||
AbstractSettings.call(this, [
|
AbstractSettings.call(this, [
|
||||||
AdminMenuViewModel,
|
AdminMenuViewModel,
|
||||||
AdminPaneViewModel
|
AdminPaneViewModel
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
|
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
|
||||||
|
|
||||||
AdminSettingsScreen.prototype.onShow = function ()
|
AdminSettingsScreen.prototype.onShow = function ()
|
||||||
{
|
{
|
||||||
RL.setTitle('');
|
RL.setTitle(''); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = AdminSettingsScreen;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,17 +1,31 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends KnoinAbstractScreen
|
* @extends KnoinAbstractScreen
|
||||||
*/
|
*/
|
||||||
function LoginScreen()
|
function LoginScreen()
|
||||||
{
|
{
|
||||||
KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
|
KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
|
_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
|
||||||
|
|
||||||
LoginScreen.prototype.onShow = function ()
|
LoginScreen.prototype.onShow = function ()
|
||||||
{
|
{
|
||||||
RL.setTitle('');
|
RL.setTitle(''); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = LoginScreen;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,11 +1,27 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends KnoinAbstractScreen
|
* @extends KnoinAbstractScreen
|
||||||
*/
|
*/
|
||||||
function MailBoxScreen()
|
function MailBoxScreen()
|
||||||
{
|
{
|
||||||
KnoinAbstractScreen.call(this, 'mailbox', [
|
KnoinAbstractScreen.call(this, 'mailbox', [
|
||||||
MailBoxSystemDropDownViewModel,
|
MailBoxSystemDropDownViewModel,
|
||||||
MailBoxFolderListViewModel,
|
MailBoxFolderListViewModel,
|
||||||
|
|
@ -14,53 +30,53 @@ function MailBoxScreen()
|
||||||
]);
|
]);
|
||||||
|
|
||||||
this.oLastRoute = {};
|
this.oLastRoute = {};
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
|
_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Object}
|
* @type {Object}
|
||||||
*/
|
*/
|
||||||
MailBoxScreen.prototype.oLastRoute = {};
|
MailBoxScreen.prototype.oLastRoute = {};
|
||||||
|
|
||||||
MailBoxScreen.prototype.setNewTitle = function ()
|
MailBoxScreen.prototype.setNewTitle = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sEmail = RL.data().accountEmail(),
|
sEmail = RL.data().accountEmail(), // TODO cjs
|
||||||
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount()
|
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount() // TODO cjs
|
||||||
;
|
;
|
||||||
|
// TODO cjs
|
||||||
RL.setTitle(('' === sEmail ? '' :
|
RL.setTitle(('' === sEmail ? '' :
|
||||||
(0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
|
(0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxScreen.prototype.onShow = function ()
|
MailBoxScreen.prototype.onShow = function ()
|
||||||
{
|
{
|
||||||
this.setNewTitle();
|
this.setNewTitle();
|
||||||
RL.data().keyScope(Enums.KeyState.MessageList);
|
RL.data().keyScope(Enums.KeyState.MessageList);// TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sFolderHash
|
* @param {string} sFolderHash
|
||||||
* @param {number} iPage
|
* @param {number} iPage
|
||||||
* @param {string} sSearch
|
* @param {string} sSearch
|
||||||
* @param {boolean=} bPreview = false
|
* @param {boolean=} bPreview = false
|
||||||
*/
|
*/
|
||||||
MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview)
|
MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview)
|
||||||
{
|
{
|
||||||
if (Utils.isUnd(bPreview) ? false : !!bPreview)
|
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
|
else
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oData = RL.data(),
|
oData = RL.data(),// TODO cjs
|
||||||
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),
|
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),// TODO cjs
|
||||||
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)
|
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)// TODO cjs
|
||||||
;
|
;
|
||||||
|
|
||||||
if (oFolder)
|
if (oFolder)
|
||||||
|
|
@ -76,38 +92,38 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
|
||||||
oData.message(null);
|
oData.message(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
RL.reloadMessageList();
|
RL.reloadMessageList();// TODO cjs
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxScreen.prototype.onStart = function ()
|
MailBoxScreen.prototype.onStart = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
oData = RL.data(),
|
oData = RL.data(),// TODO cjs
|
||||||
fResizeFunction = function () {
|
fResizeFunction = function () {
|
||||||
Utils.windowResize();
|
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 () {
|
_.delay(function () {
|
||||||
if ('INBOX' !== oData.currentFolderFullNameRaw())
|
if ('INBOX' !== oData.currentFolderFullNameRaw())
|
||||||
{
|
{
|
||||||
RL.folderInformation('INBOX');
|
RL.folderInformation('INBOX');// TODO cjs
|
||||||
}
|
}
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
RL.quota();
|
RL.quota();// TODO cjs
|
||||||
}, 5000);
|
}, 5000);
|
||||||
|
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
RL.remote().appDelayStart(Utils.emptyFunction);
|
RL.remote().appDelayStart(Utils.emptyFunction);// TODO cjs
|
||||||
}, 35000);
|
}, 35000);
|
||||||
|
|
||||||
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
|
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
|
||||||
|
|
@ -123,13 +139,13 @@ MailBoxScreen.prototype.onStart = function ()
|
||||||
oData.foldersInboxUnreadCount.subscribe(function () {
|
oData.foldersInboxUnreadCount.subscribe(function () {
|
||||||
this.setNewTitle();
|
this.setNewTitle();
|
||||||
}, this);
|
}, this);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {Array}
|
* @return {Array}
|
||||||
*/
|
*/
|
||||||
MailBoxScreen.prototype.routes = function ()
|
MailBoxScreen.prototype.routes = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
fNormP = function () {
|
fNormP = function () {
|
||||||
return ['Inbox', 1, '', true];
|
return ['Inbox', 1, '', true];
|
||||||
|
|
@ -168,4 +184,8 @@ MailBoxScreen.prototype.routes = function ()
|
||||||
[/^message-preview$/, {'normalize_': fNormP}],
|
[/^message-preview$/, {'normalize_': fNormP}],
|
||||||
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
[/^([^\/]*)$/, {'normalize_': fNormS}]
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = MailBoxScreen;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,11 +1,25 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends AbstractSettings
|
* @extends AbstractSettings
|
||||||
*/
|
*/
|
||||||
function SettingsScreen()
|
function SettingsScreen()
|
||||||
{
|
{
|
||||||
AbstractSettings.call(this, [
|
AbstractSettings.call(this, [
|
||||||
SettingsSystemDropDownViewModel,
|
SettingsSystemDropDownViewModel,
|
||||||
SettingsMenuViewModel,
|
SettingsMenuViewModel,
|
||||||
|
|
@ -15,14 +29,18 @@ function SettingsScreen()
|
||||||
Utils.initOnStartOrLangChange(function () {
|
Utils.initOnStartOrLangChange(function () {
|
||||||
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
|
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
|
||||||
}, this, function () {
|
}, this, function () {
|
||||||
RL.setTitle(this.sSettingsTitle);
|
RL.setTitle(this.sSettingsTitle); // TODO cjs
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
_.extend(SettingsScreen.prototype, AbstractSettings.prototype);
|
_.extend(SettingsScreen.prototype, AbstractSettings.prototype);
|
||||||
|
|
||||||
SettingsScreen.prototype.onShow = function ()
|
SettingsScreen.prototype.onShow = function ()
|
||||||
{
|
{
|
||||||
RL.setTitle(this.sSettingsTitle);
|
RL.setTitle(this.sSettingsTitle); // TODO cjs
|
||||||
RL.data().keyScope(Enums.KeyState.Settings);
|
RL.data().keyScope(Enums.KeyState.Settings); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = SettingsScreen;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -68,7 +68,7 @@ SettingsGeneral.prototype.onBuild = function ()
|
||||||
'dataType': 'script',
|
'dataType': 'script',
|
||||||
'cache': true
|
'cache': true
|
||||||
}).done(function() {
|
}).done(function() {
|
||||||
Utils.i18nToDoc();
|
Utils.i18nReload();
|
||||||
self.languageTrigger(Enums.SaveSettingsStep.TrueResult);
|
self.languageTrigger(Enums.SaveSettingsStep.TrueResult);
|
||||||
}).fail(function() {
|
}).fail(function() {
|
||||||
self.languageTrigger(Enums.SaveSettingsStep.FalseResult);
|
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,10 +1,22 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function AbstractData()
|
function AbstractData()
|
||||||
{
|
{
|
||||||
this.leftPanelDisabled = ko.observable(false);
|
this.leftPanelDisabled = ko.observable(false);
|
||||||
this.useKeyboardShortcuts = ko.observable(true);
|
this.useKeyboardShortcuts = ko.observable(true);
|
||||||
|
|
||||||
|
|
@ -41,12 +53,12 @@ function AbstractData()
|
||||||
});
|
});
|
||||||
|
|
||||||
this.keyScopeReal.subscribe(function (sValue) {
|
this.keyScopeReal.subscribe(function (sValue) {
|
||||||
// window.console.log(sValue);
|
// window.console.log(sValue);
|
||||||
key.setScope(sValue);
|
key.setScope(sValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.leftPanelDisabled.subscribe(function (bValue) {
|
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) {
|
Globals.dropdownVisibility.subscribe(function (bValue) {
|
||||||
|
|
@ -62,12 +74,12 @@ function AbstractData()
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
Utils.initDataConstructorBySettings(this);
|
Utils.initDataConstructorBySettings(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
AbstractData.prototype.populateDataOnStart = function()
|
AbstractData.prototype.populateDataOnStart = function()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
mLayout = Utils.pInt(RL.settingsGet('Layout')),
|
mLayout = Utils.pInt(RL.settingsGet('Layout')), // TODO cjs
|
||||||
aLanguages = RL.settingsGet('Languages'),
|
aLanguages = RL.settingsGet('Languages'),
|
||||||
aThemes = RL.settingsGet('Themes')
|
aThemes = RL.settingsGet('Themes')
|
||||||
;
|
;
|
||||||
|
|
@ -131,4 +143,8 @@ AbstractData.prototype.populateDataOnStart = function()
|
||||||
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
|
||||||
|
|
||||||
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
|
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 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function LocalStorage()
|
function LocalStorage()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
sStorages = [
|
NextStorageDriver = _.find([LocalStorageDriver, CookieDriver], function (NextStorageDriver) {
|
||||||
LocalStorageDriver,
|
|
||||||
CookieDriver
|
|
||||||
],
|
|
||||||
NextStorageDriver = _.find(sStorages, function (NextStorageDriver) {
|
|
||||||
return NextStorageDriver.supported();
|
return NextStorageDriver.supported();
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
@ -20,25 +26,29 @@ function LocalStorage()
|
||||||
NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
|
NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
|
||||||
this.oDriver = new NextStorageDriver();
|
this.oDriver = new NextStorageDriver();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalStorage.prototype.oDriver = null;
|
LocalStorage.prototype.oDriver = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} iKey
|
* @param {number} iKey
|
||||||
* @param {*} mData
|
* @param {*} mData
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
LocalStorage.prototype.set = function (iKey, mData)
|
LocalStorage.prototype.set = function (iKey, mData)
|
||||||
{
|
{
|
||||||
return this.oDriver ? this.oDriver.set('p' + iKey, mData) : false;
|
return this.oDriver ? this.oDriver.set('p' + iKey, mData) : false;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {number} iKey
|
* @param {number} iKey
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
LocalStorage.prototype.get = function (iKey)
|
LocalStorage.prototype.get = function (iKey)
|
||||||
{
|
{
|
||||||
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
|
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = LocalStorage;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,25 +1,36 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function CookieDriver()
|
function CookieDriver()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CookieDriver.supported = function ()
|
CookieDriver.supported = function ()
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sKey
|
* @param {string} sKey
|
||||||
* @param {*} mData
|
* @param {*} mData
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
CookieDriver.prototype.set = function (sKey, mData)
|
CookieDriver.prototype.set = function (sKey, mData)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
|
mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
|
||||||
bResult = false,
|
bResult = false,
|
||||||
|
|
@ -44,14 +55,14 @@ CookieDriver.prototype.set = function (sKey, mData)
|
||||||
catch (oException) {}
|
catch (oException) {}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sKey
|
* @param {string} sKey
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
CookieDriver.prototype.get = function (sKey)
|
CookieDriver.prototype.get = function (sKey)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
|
mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
|
||||||
mResult = null
|
mResult = null
|
||||||
|
|
@ -72,4 +83,8 @@ CookieDriver.prototype.get = function (sKey)
|
||||||
catch (oException) {}
|
catch (oException) {}
|
||||||
|
|
||||||
return mResult;
|
return mResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = CookieDriver;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,24 +1,35 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
*/
|
*/
|
||||||
function LocalStorageDriver()
|
function LocalStorageDriver()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
LocalStorageDriver.supported = function ()
|
LocalStorageDriver.supported = function ()
|
||||||
{
|
{
|
||||||
return !!window.localStorage;
|
return !!window.localStorage;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sKey
|
* @param {string} sKey
|
||||||
* @param {*} mData
|
* @param {*} mData
|
||||||
* @returns {boolean}
|
* @returns {boolean}
|
||||||
*/
|
*/
|
||||||
LocalStorageDriver.prototype.set = function (sKey, mData)
|
LocalStorageDriver.prototype.set = function (sKey, mData)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
mCookieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
|
mCookieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
|
||||||
bResult = false,
|
bResult = false,
|
||||||
|
|
@ -41,14 +52,14 @@ LocalStorageDriver.prototype.set = function (sKey, mData)
|
||||||
catch (oException) {}
|
catch (oException) {}
|
||||||
|
|
||||||
return bResult;
|
return bResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sKey
|
* @param {string} sKey
|
||||||
* @returns {*}
|
* @returns {*}
|
||||||
*/
|
*/
|
||||||
LocalStorageDriver.prototype.get = function (sKey)
|
LocalStorageDriver.prototype.get = function (sKey)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
mCokieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
|
mCokieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
|
||||||
mResult = null
|
mResult = null
|
||||||
|
|
@ -69,4 +80,8 @@ LocalStorageDriver.prototype.get = function (sKey)
|
||||||
catch (oException) {}
|
catch (oException) {}
|
||||||
|
|
||||||
return mResult;
|
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
|
'cache': true
|
||||||
}).done(function() {
|
}).done(function() {
|
||||||
self.bSendLanguage = true;
|
self.bSendLanguage = true;
|
||||||
Utils.i18nToDoc();
|
Utils.i18nReload();
|
||||||
$.cookie('rllang', RL.data().language(), {'expires': 30});
|
$.cookie('rllang', RL.data().language(), {'expires': 30});
|
||||||
}).always(function() {
|
}).always(function() {
|
||||||
self.langRequest(false);
|
self.langRequest(false);
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,26 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends KnoinAbstractViewModel
|
* @extends KnoinAbstractViewModel
|
||||||
*/
|
*/
|
||||||
function MailBoxMessageViewViewModel()
|
function MailBoxMessageViewViewModel()
|
||||||
{
|
{
|
||||||
KnoinAbstractViewModel.call(this, 'Right', 'MailMessageView');
|
KnoinAbstractViewModel.call(this, 'Right', 'MailMessageView');
|
||||||
|
|
||||||
var
|
var
|
||||||
|
|
@ -222,28 +237,28 @@ function MailBoxMessageViewViewModel()
|
||||||
RL.pub('mailbox.message-list.selector.go-down');
|
RL.pub('mailbox.message-list.selector.go-down');
|
||||||
});
|
});
|
||||||
|
|
||||||
Knoin.constructorEnd(this);
|
kn.constructorEnd(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.extendAsViewModel('MailBoxMessageViewViewModel', MailBoxMessageViewViewModel);
|
Utils.extendAsViewModel('MailBoxMessageViewViewModel', MailBoxMessageViewViewModel);
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.isPgpActionVisible = function ()
|
MailBoxMessageViewViewModel.prototype.isPgpActionVisible = function ()
|
||||||
{
|
{
|
||||||
return Enums.SignedVerifyStatus.Success !== this.viewPgpSignedVerifyStatus();
|
return Enums.SignedVerifyStatus.Success !== this.viewPgpSignedVerifyStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifyVisible = function ()
|
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifyVisible = function ()
|
||||||
{
|
{
|
||||||
return Enums.SignedVerifyStatus.None !== this.viewPgpSignedVerifyStatus();
|
return Enums.SignedVerifyStatus.None !== this.viewPgpSignedVerifyStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifySuccess = function ()
|
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifySuccess = function ()
|
||||||
{
|
{
|
||||||
return Enums.SignedVerifyStatus.Success === this.viewPgpSignedVerifyStatus();
|
return Enums.SignedVerifyStatus.Success === this.viewPgpSignedVerifyStatus();
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
|
MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
|
||||||
{
|
{
|
||||||
var sResult = '';
|
var sResult = '';
|
||||||
switch (this.viewPgpSignedVerifyStatus())
|
switch (this.viewPgpSignedVerifyStatus())
|
||||||
{
|
{
|
||||||
|
|
@ -267,55 +282,55 @@ MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
|
||||||
}
|
}
|
||||||
|
|
||||||
return sResult;
|
return sResult;
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.scrollToTop = function ()
|
MailBoxMessageViewViewModel.prototype.scrollToTop = function ()
|
||||||
{
|
{
|
||||||
var oCont = $('.messageItem.nano .content', this.viewModelDom);
|
var oCont = $('.messageItem.nano .content', this.viewModelDom);
|
||||||
if (oCont && oCont[0])
|
if (oCont && oCont[0])
|
||||||
{
|
{
|
||||||
// oCont.animate({'scrollTop': 0}, 300);
|
// oCont.animate({'scrollTop': 0}, 300);
|
||||||
oCont.scrollTop(0);
|
oCont.scrollTop(0);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// $('.messageItem', this.viewModelDom).animate({'scrollTop': 0}, 300);
|
// $('.messageItem', this.viewModelDom).animate({'scrollTop': 0}, 300);
|
||||||
$('.messageItem', this.viewModelDom).scrollTop(0);
|
$('.messageItem', this.viewModelDom).scrollTop(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.fullScreen = function ()
|
MailBoxMessageViewViewModel.prototype.fullScreen = function ()
|
||||||
{
|
{
|
||||||
this.fullScreenMode(true);
|
this.fullScreenMode(true);
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.unFullScreen = function ()
|
MailBoxMessageViewViewModel.prototype.unFullScreen = function ()
|
||||||
{
|
{
|
||||||
this.fullScreenMode(false);
|
this.fullScreenMode(false);
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.toggleFullScreen = function ()
|
MailBoxMessageViewViewModel.prototype.toggleFullScreen = function ()
|
||||||
{
|
{
|
||||||
Utils.removeSelection();
|
Utils.removeSelection();
|
||||||
|
|
||||||
this.fullScreenMode(!this.fullScreenMode());
|
this.fullScreenMode(!this.fullScreenMode());
|
||||||
Utils.windowResize();
|
Utils.windowResize();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {string} sType
|
* @param {string} sType
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType)
|
MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType)
|
||||||
{
|
{
|
||||||
kn.showScreenPopup(PopupsComposeViewModel, [sType, RL.data().message()]);
|
kn.showScreenPopup(PopupsComposeViewModel, [sType, RL.data().message()]);
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
|
MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
oData = RL.data()
|
oData = RL.data()
|
||||||
|
|
@ -404,13 +419,13 @@ MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
|
||||||
this.oMessageScrollerDom = this.oMessageScrollerDom && this.oMessageScrollerDom[0] ? this.oMessageScrollerDom : null;
|
this.oMessageScrollerDom = this.oMessageScrollerDom && this.oMessageScrollerDom[0] ? this.oMessageScrollerDom : null;
|
||||||
|
|
||||||
this.initShortcuts();
|
this.initShortcuts();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
|
MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
|
||||||
{
|
{
|
||||||
if (this.viewModelVisibility() && this.message())
|
if (this.viewModelVisibility() && this.message())
|
||||||
{
|
{
|
||||||
if (this.fullScreenMode())
|
if (this.fullScreenMode())
|
||||||
|
|
@ -428,10 +443,10 @@ MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
|
MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
self = this,
|
self = this,
|
||||||
oData = RL.data()
|
oData = RL.data()
|
||||||
|
|
@ -455,10 +470,10 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
|
||||||
});
|
});
|
||||||
|
|
||||||
// TODO // more toggle
|
// TODO // more toggle
|
||||||
// key('', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
// key('', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||||
// self.moreDropdownTrigger(true);
|
// self.moreDropdownTrigger(true);
|
||||||
// return false;
|
// return false;
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// reply
|
// reply
|
||||||
key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||||
|
|
@ -488,13 +503,13 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
|
||||||
});
|
});
|
||||||
|
|
||||||
// message information
|
// message information
|
||||||
// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||||
// if (oData.message())
|
// if (oData.message())
|
||||||
// {
|
// {
|
||||||
// self.showFullInfo(!self.showFullInfo());
|
// self.showFullInfo(!self.showFullInfo());
|
||||||
// return false;
|
// return false;
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
// toggle message blockquotes
|
// toggle message blockquotes
|
||||||
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
|
||||||
|
|
@ -551,133 +566,133 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
|
MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
|
||||||
{
|
{
|
||||||
return RL.data().message() && RL.data().draftFolder() === RL.data().message().folderFullNameRaw;
|
return RL.data().message() && RL.data().draftFolder() === RL.data().message().folderFullNameRaw;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
|
MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
|
||||||
{
|
{
|
||||||
return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw;
|
return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
|
MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
|
||||||
{
|
{
|
||||||
return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw;
|
return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
|
MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
|
||||||
{
|
{
|
||||||
return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue;
|
return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
|
MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
|
||||||
{
|
{
|
||||||
return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw;
|
return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
|
MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
|
||||||
{
|
{
|
||||||
return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue;
|
return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {boolean}
|
* @return {boolean}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.isDraftOrSentFolder = function ()
|
MailBoxMessageViewViewModel.prototype.isDraftOrSentFolder = function ()
|
||||||
{
|
{
|
||||||
return this.isDraftFolder() || this.isSentFolder();
|
return this.isDraftFolder() || this.isSentFolder();
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.composeClick = function ()
|
MailBoxMessageViewViewModel.prototype.composeClick = function ()
|
||||||
{
|
{
|
||||||
kn.showScreenPopup(PopupsComposeViewModel);
|
kn.showScreenPopup(PopupsComposeViewModel);
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.editMessage = function ()
|
MailBoxMessageViewViewModel.prototype.editMessage = function ()
|
||||||
{
|
{
|
||||||
if (RL.data().message())
|
if (RL.data().message())
|
||||||
{
|
{
|
||||||
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, RL.data().message()]);
|
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, RL.data().message()]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MailBoxMessageViewViewModel.prototype.scrollMessageToTop = function ()
|
MailBoxMessageViewViewModel.prototype.scrollMessageToTop = function ()
|
||||||
{
|
{
|
||||||
if (this.oMessageScrollerDom)
|
if (this.oMessageScrollerDom)
|
||||||
{
|
{
|
||||||
this.oMessageScrollerDom.scrollTop(0);
|
this.oMessageScrollerDom.scrollTop(0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MessageModel} oMessage
|
* @param {MessageModel} oMessage
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.showImages = function (oMessage)
|
MailBoxMessageViewViewModel.prototype.showImages = function (oMessage)
|
||||||
{
|
{
|
||||||
if (oMessage && oMessage.showExternalImages)
|
if (oMessage && oMessage.showExternalImages)
|
||||||
{
|
{
|
||||||
oMessage.showExternalImages(true);
|
oMessage.showExternalImages(true);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @returns {string}
|
* @returns {string}
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.printableCheckedMessageCount = function ()
|
MailBoxMessageViewViewModel.prototype.printableCheckedMessageCount = function ()
|
||||||
{
|
{
|
||||||
var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
|
var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
|
||||||
return 0 < iCnt ? (100 > iCnt ? iCnt : '99+') : '';
|
return 0 < iCnt ? (100 > iCnt ? iCnt : '99+') : '';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MessageModel} oMessage
|
* @param {MessageModel} oMessage
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.verifyPgpSignedClearMessage = function (oMessage)
|
MailBoxMessageViewViewModel.prototype.verifyPgpSignedClearMessage = function (oMessage)
|
||||||
{
|
{
|
||||||
if (oMessage)
|
if (oMessage)
|
||||||
{
|
{
|
||||||
oMessage.verifyPgpSignedClearMessage();
|
oMessage.verifyPgpSignedClearMessage();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MessageModel} oMessage
|
* @param {MessageModel} oMessage
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMessage)
|
MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMessage)
|
||||||
{
|
{
|
||||||
if (oMessage)
|
if (oMessage)
|
||||||
{
|
{
|
||||||
oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword());
|
oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {MessageModel} oMessage
|
* @param {MessageModel} oMessage
|
||||||
*/
|
*/
|
||||||
MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
|
MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
|
||||||
{
|
{
|
||||||
if (oMessage && '' !== oMessage.readReceipt())
|
if (oMessage && '' !== oMessage.readReceipt())
|
||||||
{
|
{
|
||||||
RL.remote().sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
|
RL.remote().sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
|
||||||
|
|
@ -690,4 +705,8 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
|
||||||
RL.cache().storeMessageFlagsToCache(oMessage);
|
RL.cache().storeMessageFlagsToCache(oMessage);
|
||||||
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
|
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = MailBoxMessageViewViewModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,13 +1,27 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends AbstractSystemDropDownViewModel
|
* @extends AbstractSystemDropDownViewModel
|
||||||
*/
|
*/
|
||||||
function MailBoxSystemDropDownViewModel()
|
function MailBoxSystemDropDownViewModel()
|
||||||
{
|
{
|
||||||
AbstractSystemDropDownViewModel.call(this);
|
AbstractSystemDropDownViewModel.call(this);
|
||||||
Knoin.constructorEnd(this);
|
kn.constructorEnd(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
|
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
|
||||||
|
|
||||||
|
module.exports = MailBoxSystemDropDownViewModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
|
||||||
|
|
@ -1,30 +1,44 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @param {?} oScreen
|
||||||
*
|
*
|
||||||
* @constructor
|
* @constructor
|
||||||
* @extends KnoinAbstractViewModel
|
* @extends KnoinAbstractViewModel
|
||||||
*/
|
*/
|
||||||
function SettingsMenuViewModel(oScreen)
|
function SettingsMenuViewModel(oScreen)
|
||||||
{
|
{
|
||||||
KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
|
KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
|
||||||
|
|
||||||
this.leftPanelDisabled = RL.data().leftPanelDisabled;
|
this.leftPanelDisabled = RL.data().leftPanelDisabled; // TODO cjs
|
||||||
|
|
||||||
this.menu = oScreen.menu;
|
this.menu = oScreen.menu;
|
||||||
|
|
||||||
Knoin.constructorEnd(this);
|
kn.constructorEnd(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.extendAsViewModel('SettingsMenuViewModel', SettingsMenuViewModel);
|
Utils.extendAsViewModel('SettingsMenuViewModel', SettingsMenuViewModel);
|
||||||
|
|
||||||
SettingsMenuViewModel.prototype.link = function (sRoute)
|
SettingsMenuViewModel.prototype.link = function (sRoute)
|
||||||
{
|
{
|
||||||
return RL.link().settings(sRoute);
|
return RL.link().settings(sRoute);// TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
|
SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
|
||||||
{
|
{
|
||||||
kn.setHash(RL.link().inbox());
|
kn.setHash(RL.link().inbox()); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = SettingsMenuViewModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,32 +1,48 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends KnoinAbstractViewModel
|
* @extends KnoinAbstractViewModel
|
||||||
*/
|
*/
|
||||||
function SettingsPaneViewModel()
|
function SettingsPaneViewModel()
|
||||||
{
|
{
|
||||||
KnoinAbstractViewModel.call(this, 'Right', 'SettingsPane');
|
KnoinAbstractViewModel.call(this, 'Right', 'SettingsPane');
|
||||||
|
|
||||||
Knoin.constructorEnd(this);
|
kn.constructorEnd(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.extendAsViewModel('SettingsPaneViewModel', SettingsPaneViewModel);
|
Utils.extendAsViewModel('SettingsPaneViewModel', SettingsPaneViewModel);
|
||||||
|
|
||||||
SettingsPaneViewModel.prototype.onBuild = function ()
|
SettingsPaneViewModel.prototype.onBuild = function ()
|
||||||
{
|
{
|
||||||
var self = this;
|
var self = this;
|
||||||
key('esc', Enums.KeyState.Settings, function () {
|
key('esc', Enums.KeyState.Settings, function () {
|
||||||
self.backToMailBoxClick();
|
self.backToMailBoxClick();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPaneViewModel.prototype.onShow = function ()
|
SettingsPaneViewModel.prototype.onShow = function ()
|
||||||
{
|
{
|
||||||
RL.data().message(null);
|
RL.data().message(null); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
|
SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
|
||||||
{
|
{
|
||||||
kn.setHash(RL.link().inbox());
|
kn.setHash(RL.link().inbox()); // TODO cjs
|
||||||
};
|
};
|
||||||
|
|
||||||
|
module.exports = SettingsPaneViewModel;
|
||||||
|
|
||||||
|
}(module));
|
||||||
|
|
@ -1,13 +1,27 @@
|
||||||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
/* 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
|
* @constructor
|
||||||
* @extends AbstractSystemDropDownViewModel
|
* @extends AbstractSystemDropDownViewModel
|
||||||
*/
|
*/
|
||||||
function SettingsSystemDropDownViewModel()
|
function SettingsSystemDropDownViewModel()
|
||||||
{
|
{
|
||||||
AbstractSystemDropDownViewModel.call(this);
|
AbstractSystemDropDownViewModel.call(this);
|
||||||
Knoin.constructorEnd(this);
|
kn.constructorEnd(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
|
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('b+', ['rainloop+']);
|
||||||
|
|
||||||
gulp.task('own', ['owncloud']);
|
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": "*",
|
"node-fs": "*",
|
||||||
"jshint-summary": "*",
|
"jshint-summary": "*",
|
||||||
|
|
||||||
|
"browserify": "*",
|
||||||
|
"vinyl-source-stream": "latest",
|
||||||
|
|
||||||
"gulp": "*",
|
"gulp": "*",
|
||||||
"gulp-util": "*",
|
"gulp-util": "*",
|
||||||
"gulp-uglify": "*",
|
"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