CommonJS (research)

This commit is contained in:
RainLoop Team 2014-08-20 19:03:12 +04:00
parent 2fa2cd191e
commit 56607de87c
91 changed files with 20220 additions and 12933 deletions

10
dev/AdminBoot.js Normal file
View 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);

View file

@ -1,11 +1,30 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
$ = require('../External/jquery.js'),
_ = require('../External/underscore.js'),
ko = require('../External/ko.js'),
window = require('../External/window.js'),
$html = require('../External/$html.js'),
$window = require('../External/$window.js'),
$doc = require('../External/$doc.js'),
AppData = require('../External/AppData.js'),
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js'),
KnoinAbstractBoot = require('../Knoin/KnoinAbstractBoot.js'),
RL = require('./RL.js')
;
/**
* @constructor
* @extends KnoinAbstractBoot
*/
function AbstractApp()
{
function AbstractApp()
{
KnoinAbstractBoot.call(this);
this.oSettings = null;
@ -25,24 +44,25 @@ function AbstractApp()
this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body');
$window.on('error', function (oEvent) {
if (RL && oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
-1 === Utils.inArray(oEvent.originalEvent.message, [
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
]))
{
// TODO cjs
RL.remote().jsError(
Utils.emptyFunction,
oEvent.originalEvent.message,
oEvent.originalEvent.filename,
oEvent.originalEvent.lineno,
location && location.toString ? location.toString() : '',
window.location && window.location.toString ? window.location.toString() : '',
$html.attr('class'),
Utils.microtime() - Globals.now
);
}
});
$document.on('keydown', function (oEvent) {
$doc.on('keydown', function (oEvent) {
if (oEvent && oEvent.ctrlKey)
{
$html.addClass('rl-ctrl-key-pressed');
@ -53,36 +73,36 @@ function AbstractApp()
$html.removeClass('rl-ctrl-key-pressed');
}
});
}
}
_.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
_.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
AbstractApp.prototype.oSettings = null;
AbstractApp.prototype.oPlugins = null;
AbstractApp.prototype.oLocal = null;
AbstractApp.prototype.oLink = null;
AbstractApp.prototype.oSubs = {};
AbstractApp.prototype.oSettings = null;
AbstractApp.prototype.oPlugins = null;
AbstractApp.prototype.oLocal = null;
AbstractApp.prototype.oLink = null;
AbstractApp.prototype.oSubs = {};
/**
/**
* @param {string} sLink
* @return {boolean}
*/
AbstractApp.prototype.download = function (sLink)
{
AbstractApp.prototype.download = function (sLink)
{
var
oLink = null,
oE = null,
sUserAgent = navigator.userAgent.toLowerCase()
oLink = null,
sUserAgent = window.navigator.userAgent.toLowerCase()
;
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
{
oLink = document.createElement('a');
oLink = window.document.createElement('a');
oLink['href'] = sLink;
if (document['createEvent'])
if (window.document['createEvent'])
{
oE = document['createEvent']('MouseEvents');
oE = window.document['createEvent']('MouseEvents');
if (oE && oE['initEvent'] && oLink['dispatchEvent'])
{
oE['initEvent']('click', true, true);
@ -100,86 +120,88 @@ AbstractApp.prototype.download = function (sLink)
else
{
this.iframe.attr('src', sLink);
// window.document.location.href = sLink;
// window.document.location.href = sLink;
}
return true;
};
};
/**
/**
* @return {LinkBuilder}
*/
AbstractApp.prototype.link = function ()
{
AbstractApp.prototype.link = function ()
{
if (null === this.oLink)
{
this.oLink = new LinkBuilder();
this.oLink = new LinkBuilder(); // TODO cjs
}
return this.oLink;
};
};
/**
/**
* @return {LocalStorage}
*/
AbstractApp.prototype.local = function ()
{
AbstractApp.prototype.local = function ()
{
if (null === this.oLocal)
{
this.oLocal = new LocalStorage();
this.oLocal = new LocalStorage(); // TODO cjs
}
return this.oLocal;
};
};
/**
/**
* @param {string} sName
* @return {?}
*/
AbstractApp.prototype.settingsGet = function (sName)
{
AbstractApp.prototype.settingsGet = function (sName)
{
if (null === this.oSettings)
{
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
}
return Utils.isUnd(this.oSettings[sName]) ? null : this.oSettings[sName];
};
};
/**
/**
* @param {string} sName
* @param {?} mValue
*/
AbstractApp.prototype.settingsSet = function (sName, mValue)
{
AbstractApp.prototype.settingsSet = function (sName, mValue)
{
if (null === this.oSettings)
{
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
}
this.oSettings[sName] = mValue;
};
};
AbstractApp.prototype.setTitle = function (sTitle)
{
AbstractApp.prototype.setTitle = function (sTitle)
{
sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
RL.settingsGet('Title') || '';
RL.settingsGet('Title') || ''; // TODO cjs
window.document.title = '_';
window.document.title = sTitle;
};
};
/**
/**
* @param {boolean=} bLogout = false
* @param {boolean=} bClose = false
*/
AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
{
AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
{
var
sCustomLogoutLink = Utils.pString(RL.settingsGet('CustomLogoutLink')),
bInIframe = !!RL.settingsGet('InIframe')
;
// TODO cjs
bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
bClose = Utils.isUnd(bClose) ? false : !!bClose;
@ -218,30 +240,30 @@ AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
}
}, 100);
}
};
};
AbstractApp.prototype.historyBack = function ()
{
AbstractApp.prototype.historyBack = function ()
{
window.history.back();
};
};
/**
/**
* @param {string} sQuery
* @param {Function} fCallback
*/
AbstractApp.prototype.getAutocomplete = function (sQuery, fCallback)
{
AbstractApp.prototype.getAutocomplete = function (sQuery, fCallback)
{
fCallback([], sQuery);
};
};
/**
/**
* @param {string} sName
* @param {Function} fFunc
* @param {Object=} oContext
* @return {AbstractApp}
*/
AbstractApp.prototype.sub = function (sName, fFunc, oContext)
{
AbstractApp.prototype.sub = function (sName, fFunc, oContext)
{
if (Utils.isUnd(this.oSubs[sName]))
{
this.oSubs[sName] = [];
@ -250,15 +272,15 @@ AbstractApp.prototype.sub = function (sName, fFunc, oContext)
this.oSubs[sName].push([fFunc, oContext]);
return this;
};
};
/**
/**
* @param {string} sName
* @param {Array=} aArgs
* @return {AbstractApp}
*/
AbstractApp.prototype.pub = function (sName, aArgs)
{
AbstractApp.prototype.pub = function (sName, aArgs)
{
Plugins.runHook('rl-pub', [sName, aArgs]);
if (!Utils.isUnd(this.oSubs[sName]))
{
@ -271,21 +293,21 @@ AbstractApp.prototype.pub = function (sName, aArgs)
}
return this;
};
};
/**
/**
* @param {string} sName
* @return {boolean}
*/
AbstractApp.prototype.capa = function (sName)
{
AbstractApp.prototype.capa = function (sName)
{
var mCapa = this.settingsGet('Capa');
return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
};
};
AbstractApp.prototype.bootstart = function ()
{
var self = this;
AbstractApp.prototype.bootstart = function ()
{
var ssm = require('../External/ssm.js');
Utils.initOnStartOrLangChange(function () {
Utils.initNotificationLanguage();
@ -300,11 +322,11 @@ AbstractApp.prototype.bootstart = function ()
'maxWidth': 767,
'onEnter': function() {
$html.addClass('ssm-state-mobile');
self.pub('ssm.mobile-enter');
RL.pub('ssm.mobile-enter');
},
'onLeave': function() {
$html.removeClass('ssm-state-mobile');
self.pub('ssm.mobile-leave');
RL.pub('ssm.mobile-leave');
}
});
@ -343,17 +365,21 @@ AbstractApp.prototype.bootstart = function ()
}
});
RL.sub('ssm.mobile-enter', function () {
RL.sub('ssm.mobile-enter', function () { // TODO cjs
RL.data().leftPanelDisabled(true);
});
RL.sub('ssm.mobile-leave', function () {
RL.sub('ssm.mobile-leave', function () { // TODO cjs
RL.data().leftPanelDisabled(false);
});
RL.data().leftPanelDisabled.subscribe(function (bValue) {
RL.data().leftPanelDisabled.subscribe(function (bValue) { // TODO cjs
$html.toggleClass('rl-left-panel-disabled', bValue);
});
ssm.ready();
};
};
module.exports = AbstractApp;
}(module));

View file

@ -1,65 +1,80 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('../External/ko.js'),
_ = require('../External/underscore.js'),
window = require('../External/window.js'),
Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
AbstractApp = require('./AbstractApp.js')
;
/**
* @constructor
* @extends AbstractApp
*/
function AdminApp()
{
function AdminApp()
{
AbstractApp.call(this);
this.oData = null;
this.oRemote = null;
this.oCache = null;
}
}
_.extend(AdminApp.prototype, AbstractApp.prototype);
_.extend(AdminApp.prototype, AbstractApp.prototype);
AdminApp.prototype.oData = null;
AdminApp.prototype.oRemote = null;
AdminApp.prototype.oCache = null;
AdminApp.prototype.oData = null;
AdminApp.prototype.oRemote = null;
AdminApp.prototype.oCache = null;
/**
/**
* @return {AdminDataStorage}
*/
AdminApp.prototype.data = function ()
{
AdminApp.prototype.data = function ()
{
if (null === this.oData)
{
this.oData = new AdminDataStorage();
this.oData = new AdminDataStorage(); // TODO cjs
}
return this.oData;
};
};
/**
/**
* @return {AdminAjaxRemoteStorage}
*/
AdminApp.prototype.remote = function ()
{
AdminApp.prototype.remote = function ()
{
if (null === this.oRemote)
{
this.oRemote = new AdminAjaxRemoteStorage();
this.oRemote = new AdminAjaxRemoteStorage(); // TODO cjs
}
return this.oRemote;
};
};
/**
/**
* @return {AdminCacheStorage}
*/
AdminApp.prototype.cache = function ()
{
AdminApp.prototype.cache = function ()
{
if (null === this.oCache)
{
this.oCache = new AdminCacheStorage();
this.oCache = new AdminCacheStorage(); // TODO cjs
}
return this.oCache;
};
};
AdminApp.prototype.reloadDomainList = function ()
{
AdminApp.prototype.reloadDomainList = function ()
{
// TODO cjs
RL.data().domainsLoading(true);
RL.remote().domainList(function (sResult, oData) {
RL.data().domainsLoading(false);
@ -76,10 +91,11 @@ AdminApp.prototype.reloadDomainList = function ()
RL.data().domains(aList);
}
});
};
};
AdminApp.prototype.reloadPluginList = function ()
{
AdminApp.prototype.reloadPluginList = function ()
{
// TODO cjs
RL.data().pluginsLoading(true);
RL.remote().pluginList(function (sResult, oData) {
RL.data().pluginsLoading(false);
@ -96,10 +112,11 @@ AdminApp.prototype.reloadPluginList = function ()
RL.data().plugins(aList);
}
});
};
};
AdminApp.prototype.reloadPackagesList = function ()
{
AdminApp.prototype.reloadPackagesList = function ()
{
// TODO cjs
RL.data().packagesLoading(true);
RL.data().packagesReal(true);
@ -143,10 +160,11 @@ AdminApp.prototype.reloadPackagesList = function ()
RL.data().packagesReal(false);
}
});
};
};
AdminApp.prototype.updateCoreData = function ()
{
AdminApp.prototype.updateCoreData = function ()
{
// TODO cjs
var oRainData = RL.data();
oRainData.coreUpdating(true);
@ -168,10 +186,10 @@ AdminApp.prototype.updateCoreData = function ()
}
});
};
};
AdminApp.prototype.reloadCoreData = function ()
{
AdminApp.prototype.reloadCoreData = function ()
{
var oRainData = RL.data();
oRainData.coreChecking(true);
@ -198,16 +216,17 @@ AdminApp.prototype.reloadCoreData = function ()
oRainData.coreVersionCompare(-2);
}
});
};
};
/**
/**
*
* @param {boolean=} bForce = false
*/
AdminApp.prototype.reloadLicensing = function (bForce)
{
AdminApp.prototype.reloadLicensing = function (bForce)
{
bForce = Utils.isUnd(bForce) ? false : !!bForce;
// TODO cjs
RL.data().licensingProcess(true);
RL.data().licenseError('');
@ -245,10 +264,10 @@ AdminApp.prototype.reloadLicensing = function (bForce)
}
}
}, bForce);
};
};
AdminApp.prototype.bootstart = function ()
{
AdminApp.prototype.bootstart = function ()
{
AbstractApp.prototype.bootstart.call(this);
RL.data().populateDataOnStart();
@ -267,7 +286,7 @@ AdminApp.prototype.bootstart = function ()
}
else
{
// Utils.removeSettingsViewModel(AdminAbout);
// Utils.removeSettingsViewModel(AdminAbout);
if (!RL.capa(Enums.Capa.Prem))
{
@ -276,11 +295,11 @@ AdminApp.prototype.bootstart = function ()
if (!!RL.settingsGet('Auth'))
{
// TODO
// if (!RL.settingsGet('AllowPackages') && AdminPackages)
// {
// Utils.disableSettingsViewModel(AdminPackages);
// }
// TODO
// if (!RL.settingsGet('AllowPackages') && AdminPackages)
// {
// Utils.disableSettingsViewModel(AdminPackages);
// }
kn.startScreens([AdminSettingsScreen]);
}
@ -294,9 +313,8 @@ AdminApp.prototype.bootstart = function ()
{
window.SimplePace.set(100);
}
};
};
/**
* @type {AdminApp}
*/
RL = new AdminApp();
module.exports = new AdminApp();
}(module));

View file

@ -1,11 +1,28 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
window = require('../External/window.js'),
$ = require('../External/jquery.js'),
_ = require('../External/underscore.js'),
Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
Consts = require('../Common/Consts.js'),
Plugins = require('../Common/Plugins.js'),
Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
AbstractApp = require('./AbstractApp.js')
;
/**
* @constructor
* @extends AbstractApp
*/
function RainLoopApp()
{
function RainLoopApp()
{
AbstractApp.call(this);
this.oData = null;
@ -63,69 +80,69 @@ function RainLoopApp()
}
}, RL.settingsGet('Version'));
}, {}, 60 * 60 * 1000);
}
}
_.extend(RainLoopApp.prototype, AbstractApp.prototype);
_.extend(RainLoopApp.prototype, AbstractApp.prototype);
RainLoopApp.prototype.oData = null;
RainLoopApp.prototype.oRemote = null;
RainLoopApp.prototype.oCache = null;
RainLoopApp.prototype.oData = null;
RainLoopApp.prototype.oRemote = null;
RainLoopApp.prototype.oCache = null;
/**
/**
* @return {WebMailDataStorage}
*/
RainLoopApp.prototype.data = function ()
{
RainLoopApp.prototype.data = function ()
{
if (null === this.oData)
{
this.oData = new WebMailDataStorage();
}
return this.oData;
};
};
/**
/**
* @return {WebMailAjaxRemoteStorage}
*/
RainLoopApp.prototype.remote = function ()
{
RainLoopApp.prototype.remote = function ()
{
if (null === this.oRemote)
{
this.oRemote = new WebMailAjaxRemoteStorage();
}
return this.oRemote;
};
};
/**
/**
* @return {WebMailCacheStorage}
*/
RainLoopApp.prototype.cache = function ()
{
RainLoopApp.prototype.cache = function ()
{
if (null === this.oCache)
{
this.oCache = new WebMailCacheStorage();
}
return this.oCache;
};
};
RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
{
RainLoopApp.prototype.reloadFlagsCurrentMessageListAndMessageFromCache = function ()
{
var oCache = RL.cache();
_.each(RL.data().messageList(), function (oMessage) {
oCache.initMessageFlagsFromCache(oMessage);
});
oCache.initMessageFlagsFromCache(RL.data().message());
};
};
/**
/**
* @param {boolean=} bDropPagePosition = false
* @param {boolean=} bDropCurrenFolderCache = false
*/
RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache)
{
RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurrenFolderCache)
{
var
oRLData = RL.data(),
iOffset = (oRLData.messageListPage() - 1) * oRLData.messagesPerPage()
@ -166,24 +183,24 @@ RainLoopApp.prototype.reloadMessageList = function (bDropPagePosition, bDropCurr
}
}, 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);
};
};
RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
{
RainLoopApp.prototype.reloadMessageListHelper = function (bEmptyList)
{
RL.reloadMessageList(bEmptyList);
};
};
/**
/**
* @param {Function} fResultFunc
* @returns {boolean}
*/
RainLoopApp.prototype.contactsSync = function (fResultFunc)
{
RainLoopApp.prototype.contactsSync = function (fResultFunc)
{
var oContacts = RL.data().contacts;
if (oContacts.importing() || oContacts.syncing() || !RL.data().enableContactsSync() || !RL.data().allowContactsSync())
{
@ -203,10 +220,10 @@ RainLoopApp.prototype.contactsSync = function (fResultFunc)
});
return true;
};
};
RainLoopApp.prototype.messagesMoveTrigger = function ()
{
RainLoopApp.prototype.messagesMoveTrigger = function ()
{
var
self = this,
sSpamFolder = RL.data().spamFolder()
@ -224,10 +241,10 @@ RainLoopApp.prototype.messagesMoveTrigger = function ()
});
this.oMoveCache = {};
};
};
RainLoopApp.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForMove)
{
RainLoopApp.prototype.messagesMoveHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForMove)
{
var sH = '$$' + sFromFolderFullNameRaw + '$$' + sToFolderFullNameRaw + '$$';
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.messagesMoveTrigger();
};
};
RainLoopApp.prototype.messagesCopyHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForCopy)
{
RainLoopApp.prototype.messagesCopyHelper = function (sFromFolderFullNameRaw, sToFolderFullNameRaw, aUidForCopy)
{
RL.remote().messagesCopy(
this.moveOrDeleteResponseHelper,
sFromFolderFullNameRaw,
sToFolderFullNameRaw,
aUidForCopy
);
};
};
RainLoopApp.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove)
{
RainLoopApp.prototype.messagesDeleteHelper = function (sFromFolderFullNameRaw, aUidForRemove)
{
RL.remote().messagesDelete(
this.moveOrDeleteResponseHelper,
sFromFolderFullNameRaw,
aUidForRemove
);
};
};
RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
{
RainLoopApp.prototype.moveOrDeleteResponseHelper = function (sResult, oData)
{
if (Enums.StorageResultType.Success === sResult && RL.data().currentFolder())
{
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.quotaDebounce();
}
};
};
/**
/**
* @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove
*/
RainLoopApp.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove)
{
RainLoopApp.prototype.deleteMessagesFromFolderWithoutCheck = function (sFromFolderFullNameRaw, aUidForRemove)
{
this.messagesDeleteHelper(sFromFolderFullNameRaw, aUidForRemove);
RL.data().removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove);
};
};
/**
/**
* @param {number} iDeleteType
* @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForRemove
* @param {boolean=} bUseFolder = true
*/
RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFolderFullNameRaw, aUidForRemove, bUseFolder)
{
RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFolderFullNameRaw, aUidForRemove, bUseFolder)
{
var
self = this,
oData = RL.data(),
@ -360,16 +377,16 @@ RainLoopApp.prototype.deleteMessagesFromFolder = function (iDeleteType, sFromFol
this.messagesMoveHelper(sFromFolderFullNameRaw, oMoveFolder.fullNameRaw, aUidForRemove);
oData.removeMessagesFromList(sFromFolderFullNameRaw, aUidForRemove, oMoveFolder.fullNameRaw);
}
};
};
/**
/**
* @param {string} sFromFolderFullNameRaw
* @param {Array} aUidForMove
* @param {string} sToFolderFullNameRaw
* @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)
{
var
@ -394,13 +411,13 @@ RainLoopApp.prototype.moveMessagesToFolder = function (sFromFolderFullNameRaw, a
}
return false;
};
};
/**
/**
* @param {Function=} fCallback
*/
RainLoopApp.prototype.folders = function (fCallback)
{
RainLoopApp.prototype.folders = function (fCallback)
{
this.data().foldersLoading(true);
this.remote().folders(_.bind(function (sResult, oData) {
@ -421,10 +438,10 @@ RainLoopApp.prototype.folders = function (fCallback)
}
}
}, this));
};
};
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
{
RainLoopApp.prototype.reloadOpenPgpKeys = function ()
{
if (RL.data().capaOpenPGP())
{
var
@ -464,10 +481,10 @@ RainLoopApp.prototype.reloadOpenPgpKeys = function ()
RL.data().openpgpkeys(aKeys);
}
};
};
RainLoopApp.prototype.accountsAndIdentities = function ()
{
RainLoopApp.prototype.accountsAndIdentities = function ()
{
var oRainLoopData = RL.data();
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) {
if (Enums.StorageResultType.Success === sResult && oData && oData.Result &&
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);
}
});
};
};
/**
/**
* @param {string} sFolder
* @param {Array=} aList = []
*/
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
{
RainLoopApp.prototype.folderInformation = function (sFolder, aList)
{
if ('' !== Utils.trim(sFolder))
{
this.remote().folderInformation(function (sResult, oData) {
@ -630,13 +647,13 @@ RainLoopApp.prototype.folderInformation = function (sFolder, aList)
}
}, sFolder, aList);
}
};
};
/**
/**
* @param {boolean=} bBoot = false
*/
RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
{
RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
{
bBoot = Utils.isUnd(bBoot) ? false : !!bBoot;
var
@ -718,10 +735,10 @@ RainLoopApp.prototype.folderInformationMultiply = function (bBoot)
}
}, aFolders);
}
};
};
RainLoopApp.prototype.setMessageSeen = function (oMessage)
{
RainLoopApp.prototype.setMessageSeen = function (oMessage)
{
if (oMessage.unseen())
{
oMessage.unseen(false);
@ -738,28 +755,28 @@ RainLoopApp.prototype.setMessageSeen = function (oMessage)
}
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');
};
};
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');
};
};
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');
};
};
/**
/**
* @param {boolean=} bFireAllActions
*/
RainLoopApp.prototype.socialUsers = function (bFireAllActions)
{
RainLoopApp.prototype.socialUsers = function (bFireAllActions)
{
var oRainLoopData = RL.data();
if (bFireAllActions)
@ -792,33 +809,33 @@ RainLoopApp.prototype.socialUsers = function (bFireAllActions)
oRainLoopData.facebookActions(false);
oRainLoopData.twitterActions(false);
});
};
};
RainLoopApp.prototype.googleDisconnect = function ()
{
RainLoopApp.prototype.googleDisconnect = function ()
{
RL.data().googleActions(true);
RL.remote().googleDisconnect(function () {
RL.socialUsers();
});
};
};
RainLoopApp.prototype.facebookDisconnect = function ()
{
RainLoopApp.prototype.facebookDisconnect = function ()
{
RL.data().facebookActions(true);
RL.remote().facebookDisconnect(function () {
RL.socialUsers();
});
};
};
RainLoopApp.prototype.twitterDisconnect = function ()
{
RainLoopApp.prototype.twitterDisconnect = function ()
{
RL.data().twitterActions(true);
RL.remote().twitterDisconnect(function () {
RL.socialUsers();
});
};
};
/**
/**
* @param {Array} aSystem
* @param {Array} aList
* @param {Array=} aDisabled
@ -831,8 +848,8 @@ RainLoopApp.prototype.twitterDisconnect = function ()
* @param {boolean=} bBuildUnvisible
* @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
iIndex = 0,
iLen = 0,
@ -945,14 +962,14 @@ RainLoopApp.prototype.folderListOptionsBuilder = function (aSystem, aList, aDisa
}
return aResult;
};
};
/**
/**
* @param {string} sQuery
* @param {Function} fCallback
*/
RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
{
RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
{
var
aData = []
;
@ -972,25 +989,25 @@ RainLoopApp.prototype.getAutocomplete = function (sQuery, fCallback)
}
}, sQuery);
};
};
/**
/**
* @param {string} sQuery
* @param {Function} fCallback
*/
RainLoopApp.prototype.getContactTagsAutocomplete = function (sQuery, fCallback)
{
RainLoopApp.prototype.getContactTagsAutocomplete = function (sQuery, fCallback)
{
fCallback(_.filter(RL.data().contactTags(), function (oContactTag) {
return oContactTag && oContactTag.filterHelper(sQuery);
}));
};
};
/**
/**
* @param {string} sMailToUrl
* @returns {boolean}
*/
RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
{
RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
{
if (sMailToUrl && 'mailto:' === sMailToUrl.toString().substr(0, 7).toLowerCase())
{
sMailToUrl = sMailToUrl.toString().substr(7);
@ -1018,10 +1035,10 @@ RainLoopApp.prototype.mailToHelper = function (sMailToUrl)
}
return false;
};
};
RainLoopApp.prototype.bootstart = function ()
{
RainLoopApp.prototype.bootstart = function ()
{
RL.pub('rl.bootstart');
AbstractApp.prototype.bootstart.call(this);
@ -1285,9 +1302,8 @@ RainLoopApp.prototype.bootstart = function ()
Plugins.runHook('rl-start-screens');
RL.pub('rl.bootstart-end');
};
};
/**
* @type {RainLoopApp}
*/
RL = new RainLoopApp();
module.exports = new RainLoopApp();
}(module));

View file

@ -1,8 +1,12 @@
/*jslint bitwise: true*/
// Base64 encode / decode
// http://www.webtoolkit.info/
Base64 = {
(function (module) {
'use strict';
/*jslint bitwise: true*/
var Base64 = {
// private property
_keyStr : 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=',
@ -159,6 +163,9 @@ Base64 = {
return string;
}
};
};
/*jslint bitwise: false*/
module.exports = Base64;
/*jslint bitwise: false*/
}(module));

View file

@ -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
View 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));

View file

@ -1,36 +1,42 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var Enums = {};
/**
* @enum {string}
*/
Enums.StorageResultType = {
Enums.StorageResultType = {
'Success': 'success',
'Abort': 'abort',
'Error': 'error',
'Unload': 'unload'
};
};
/**
/**
* @enum {number}
*/
Enums.State = {
Enums.State = {
'Empty': 10,
'Login': 20,
'Auth': 30
};
};
/**
/**
* @enum {number}
*/
Enums.StateType = {
Enums.StateType = {
'Webmail': 0,
'Admin': 1
};
};
/**
/**
* @enum {string}
*/
Enums.Capa = {
Enums.Capa = {
'Prem': 'PREM',
'TwoFactor': 'TWO_FACTOR',
'OpenPGP': 'OPEN_PGP',
@ -40,12 +46,12 @@ Enums.Capa = {
'Filters': 'FILTERS',
'AdditionalAccounts': 'ADDITIONAL_ACCOUNTS',
'AdditionalIdentities': 'ADDITIONAL_IDENTITIES'
};
};
/**
/**
* @enum {string}
*/
Enums.KeyState = {
Enums.KeyState = {
'All': 'all',
'None': 'none',
'ContactList': 'contact-list',
@ -58,12 +64,12 @@ Enums.KeyState = {
'PopupComposeOpenPGP': 'compose-open-pgp',
'PopupKeyboardShortcutsHelp': 'popup-keyboard-shortcuts-help',
'PopupAsk': 'popup-ask'
};
};
/**
/**
* @enum {number}
*/
Enums.FolderType = {
Enums.FolderType = {
'Inbox': 10,
'SentItems': 11,
'Draft': 12,
@ -72,30 +78,30 @@ Enums.FolderType = {
'Archive': 15,
'NotSpam': 80,
'User': 99
};
};
/**
/**
* @enum {string}
*/
Enums.LoginSignMeTypeAsString = {
Enums.LoginSignMeTypeAsString = {
'DefaultOff': 'defaultoff',
'DefaultOn': 'defaulton',
'Unused': 'unused'
};
};
/**
/**
* @enum {number}
*/
Enums.LoginSignMeType = {
Enums.LoginSignMeType = {
'DefaultOff': 0,
'DefaultOn': 1,
'Unused': 2
};
};
/**
/**
* @enum {string}
*/
Enums.ComposeType = {
Enums.ComposeType = {
'Empty': 'empty',
'Reply': 'reply',
'ReplyAll': 'replyall',
@ -103,12 +109,12 @@ Enums.ComposeType = {
'ForwardAsAttachment': 'forward-as-attachment',
'Draft': 'draft',
'EditAsNew': 'editasnew'
};
};
/**
/**
* @enum {number}
*/
Enums.UploadErrorCode = {
Enums.UploadErrorCode = {
'Normal': 0,
'FileIsTooBig': 1,
'FilePartiallyUploaded': 2,
@ -117,35 +123,35 @@ Enums.UploadErrorCode = {
'FileOnSaveingError': 5,
'FileType': 98,
'Unknown': 99
};
};
/**
/**
* @enum {number}
*/
Enums.SetSystemFoldersNotification = {
Enums.SetSystemFoldersNotification = {
'None': 0,
'Sent': 1,
'Draft': 2,
'Spam': 3,
'Trash': 4,
'Archive': 5
};
};
/**
/**
* @enum {number}
*/
Enums.ClientSideKeyName = {
Enums.ClientSideKeyName = {
'FoldersLashHash': 0,
'MessagesInboxLastHash': 1,
'MailBoxListSize': 2,
'ExpandedFolders': 3,
'FolderListSize': 4
};
};
/**
/**
* @enum {number}
*/
Enums.EventKeyCode = {
Enums.EventKeyCode = {
'Backspace': 8,
'Tab': 9,
'Enter': 13,
@ -163,22 +169,22 @@ Enums.EventKeyCode = {
'Delete': 46,
'A': 65,
'S': 83
};
};
/**
/**
* @enum {number}
*/
Enums.MessageSetAction = {
Enums.MessageSetAction = {
'SetSeen': 0,
'UnsetSeen': 1,
'SetFlag': 2,
'UnsetFlag': 3
};
};
/**
/**
* @enum {number}
*/
Enums.MessageSelectAction = {
Enums.MessageSelectAction = {
'All': 0,
'None': 1,
'Invert': 2,
@ -186,153 +192,153 @@ Enums.MessageSelectAction = {
'Seen': 4,
'Flagged': 5,
'Unflagged': 6
};
};
/**
/**
* @enum {number}
*/
Enums.DesktopNotifications = {
Enums.DesktopNotifications = {
'Allowed': 0,
'NotAllowed': 1,
'Denied': 2,
'NotSupported': 9
};
};
/**
/**
* @enum {number}
*/
Enums.MessagePriority = {
Enums.MessagePriority = {
'Low': 5,
'Normal': 3,
'High': 1
};
};
/**
/**
* @enum {string}
*/
Enums.EditorDefaultType = {
Enums.EditorDefaultType = {
'Html': 'Html',
'Plain': 'Plain'
};
};
/**
/**
* @enum {string}
*/
Enums.CustomThemeType = {
Enums.CustomThemeType = {
'Light': 'Light',
'Dark': 'Dark'
};
};
/**
/**
* @enum {number}
*/
Enums.ServerSecure = {
Enums.ServerSecure = {
'None': 0,
'SSL': 1,
'TLS': 2
};
};
/**
/**
* @enum {number}
*/
Enums.SearchDateType = {
Enums.SearchDateType = {
'All': -1,
'Days3': 3,
'Days7': 7,
'Month': 30
};
};
/**
/**
* @enum {number}
*/
Enums.EmailType = {
Enums.EmailType = {
'Defailt': 0,
'Facebook': 1,
'Google': 2
};
};
/**
/**
* @enum {number}
*/
Enums.SaveSettingsStep = {
Enums.SaveSettingsStep = {
'Animate': -2,
'Idle': -1,
'TrueResult': 1,
'FalseResult': 0
};
};
/**
/**
* @enum {string}
*/
Enums.InterfaceAnimation = {
Enums.InterfaceAnimation = {
'None': 'None',
'Normal': 'Normal',
'Full': 'Full'
};
};
/**
/**
* @enum {number}
*/
Enums.Layout = {
Enums.Layout = {
'NoPreview': 0,
'SidePreview': 1,
'BottomPreview': 2
};
};
/**
/**
* @enum {string}
*/
Enums.FilterConditionField = {
Enums.FilterConditionField = {
'From': 'From',
'To': 'To',
'Recipient': 'Recipient',
'Subject': 'Subject'
};
};
/**
/**
* @enum {string}
*/
Enums.FilterConditionType = {
Enums.FilterConditionType = {
'Contains': 'Contains',
'NotContains': 'NotContains',
'EqualTo': 'EqualTo',
'NotEqualTo': 'NotEqualTo'
};
};
/**
/**
* @enum {string}
*/
Enums.FiltersAction = {
Enums.FiltersAction = {
'None': 'None',
'Move': 'Move',
'Discard': 'Discard',
'Forward': 'Forward',
};
};
/**
/**
* @enum {string}
*/
Enums.FilterRulesType = {
Enums.FilterRulesType = {
'And': 'And',
'Or': 'Or'
};
};
/**
/**
* @enum {number}
*/
Enums.SignedVerifyStatus = {
Enums.SignedVerifyStatus = {
'UnknownPublicKeys': -4,
'UnknownPrivateKey': -3,
'Unverified': -2,
'Error': -1,
'None': 0,
'Success': 1
};
};
/**
/**
* @enum {number}
*/
Enums.ContactPropertyType = {
Enums.ContactPropertyType = {
'Unknown': 0,
@ -359,12 +365,12 @@ Enums.ContactPropertyType = {
'Note': 110,
'Custom': 250
};
};
/**
/**
* @enum {number}
*/
Enums.Notification = {
Enums.Notification = {
'InvalidToken': 101,
'AuthError': 102,
'AccessError': 103,
@ -427,4 +433,8 @@ Enums.Notification = {
'InvalidInputArgument': 903,
'UnknownNotification': 999,
'UnknownError': 999
};
};
module.exports = Enums;
}(module));

View file

@ -1,99 +1,110 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
Globals = {},
window = require('../External/window.js'),
ko = require('../External/ko.js'),
$html = require('../External/$html.js')
;
/**
* @type {?}
*/
Globals.now = (new Date()).getTime();
Globals.now = (new window.Date()).getTime();
/**
/**
* @type {?}
*/
Globals.momentTrigger = ko.observable(true);
Globals.momentTrigger = ko.observable(true);
/**
/**
* @type {?}
*/
Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
/**
/**
* @type {?}
*/
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
Globals.tooltipTrigger = ko.observable(false).extend({'rateLimit': 0});
/**
/**
* @type {?}
*/
Globals.langChangeTrigger = ko.observable(true);
Globals.langChangeTrigger = ko.observable(true);
/**
/**
* @type {number}
*/
Globals.iAjaxErrorCount = 0;
Globals.iAjaxErrorCount = 0;
/**
/**
* @type {number}
*/
Globals.iTokenErrorCount = 0;
Globals.iTokenErrorCount = 0;
/**
/**
* @type {number}
*/
Globals.iMessageBodyCacheCount = 0;
Globals.iMessageBodyCacheCount = 0;
/**
/**
* @type {boolean}
*/
Globals.bUnload = false;
Globals.bUnload = false;
/**
/**
* @type {string}
*/
Globals.sUserAgent = (navigator.userAgent || '').toLowerCase();
Globals.sUserAgent = (window.navigator.userAgent || '').toLowerCase();
/**
/**
* @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}
*/
Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
Globals.bIsAndroidDevice = -1 < Globals.sUserAgent.indexOf('android');
/**
/**
* @type {boolean}
*/
Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
Globals.bMobileDevice = Globals.bIsiOSDevice || Globals.bIsAndroidDevice;
/**
/**
* @type {boolean}
*/
Globals.bDisableNanoScroll = Globals.bMobileDevice;
Globals.bDisableNanoScroll = Globals.bMobileDevice;
/**
/**
* @type {boolean}
*/
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
/**
/**
* @type {boolean}
*/
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
Globals.bAnimationSupported = !Globals.bMobileDevice && $html.hasClass('csstransitions');
/**
/**
* @type {boolean}
*/
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
/**
/**
* @type {string}
*/
Globals.sAnimationType = '';
Globals.sAnimationType = '';
/**
/**
* @type {Object}
*/
Globals.oHtmlEditorDefaultConfig = {
Globals.oHtmlEditorDefaultConfig = {
'title': false,
'stylesSet': false,
'customConfig': '',
@ -107,7 +118,7 @@ Globals.oHtmlEditorDefaultConfig = {
{name: 'links'},
{name: 'insert'},
{name: 'others'}
// {name: 'document', groups: ['mode', 'document', 'doctools']}
// {name: 'document', groups: ['mode', 'document', 'doctools']}
],
'removePlugins': 'contextmenu', //blockquote
@ -122,12 +133,12 @@ Globals.oHtmlEditorDefaultConfig = {
'font_defaultLabel': 'Arial',
'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'
};
};
/**
/**
* @type {Object}
*/
Globals.oHtmlEditorLangsMap = {
Globals.oHtmlEditorLangsMap = {
'de': 'de',
'es': 'es',
'fr': 'fr',
@ -147,11 +158,27 @@ Globals.oHtmlEditorLangsMap = {
'ro': 'ro',
'zh': 'zh',
'zh-cn': 'zh-cn'
};
};
if (Globals.bAllowPdfPreview && navigator && navigator.mimeTypes)
{
Globals.bAllowPdfPreview = !!_.find(navigator.mimeTypes, function (oType) {
if (Globals.bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
{
Globals.bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
return oType && 'application/pdf' === oType.type;
});
}
}
Globals.oI18N = {},
Globals.oNotificationI18N = {},
Globals.aBootstrapDropdowns = [],
Globals.aViewModels = {
'settings': [],
'settings-removed': [],
'settings-disabled': []
};
module.exports = Globals;
}(module));

View file

@ -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(
'&nbsp;&nbsp;<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;
};

View file

@ -1,152 +1,161 @@
/* 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
*/
function LinkBuilder()
{
function LinkBuilder()
{
this.sBase = '#/';
this.sServer = './?';
this.sVersion = RL.settingsGet('Version');
this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0';
this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
}
}
/**
/**
* @return {string}
*/
LinkBuilder.prototype.root = function ()
{
LinkBuilder.prototype.root = function ()
{
return this.sBase;
};
};
/**
/**
* @param {string} sDownload
* @return {string}
*/
LinkBuilder.prototype.attachmentDownload = function (sDownload)
{
LinkBuilder.prototype.attachmentDownload = function (sDownload)
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sDownload;
};
};
/**
/**
* @param {string} sDownload
* @return {string}
*/
LinkBuilder.prototype.attachmentPreview = function (sDownload)
{
LinkBuilder.prototype.attachmentPreview = function (sDownload)
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/View/' + sDownload;
};
};
/**
/**
* @param {string} sDownload
* @return {string}
*/
LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
{
LinkBuilder.prototype.attachmentPreviewAsPlain = function (sDownload)
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sDownload;
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.upload = function ()
{
LinkBuilder.prototype.upload = function ()
{
return this.sServer + '/Upload/' + this.sSpecSuffix + '/';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.uploadContacts = function ()
{
LinkBuilder.prototype.uploadContacts = function ()
{
return this.sServer + '/UploadContacts/' + this.sSpecSuffix + '/';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.uploadBackground = function ()
{
LinkBuilder.prototype.uploadBackground = function ()
{
return this.sServer + '/UploadBackground/' + this.sSpecSuffix + '/';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.append = function ()
{
LinkBuilder.prototype.append = function ()
{
return this.sServer + '/Append/' + this.sSpecSuffix + '/';
};
};
/**
/**
* @param {string} sEmail
* @return {string}
*/
LinkBuilder.prototype.change = function (sEmail)
{
LinkBuilder.prototype.change = function (sEmail)
{
return this.sServer + '/Change/' + this.sSpecSuffix + '/' + window.encodeURIComponent(sEmail) + '/';
};
};
/**
/**
* @param {string=} sAdd
* @return {string}
*/
LinkBuilder.prototype.ajax = function (sAdd)
{
LinkBuilder.prototype.ajax = function (sAdd)
{
return this.sServer + '/Ajax/' + this.sSpecSuffix + '/' + sAdd;
};
};
/**
/**
* @param {string} sRequestHash
* @return {string}
*/
LinkBuilder.prototype.messageViewLink = function (sRequestHash)
{
LinkBuilder.prototype.messageViewLink = function (sRequestHash)
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ViewAsPlain/' + sRequestHash;
};
};
/**
/**
* @param {string} sRequestHash
* @return {string}
*/
LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
{
LinkBuilder.prototype.messageDownloadLink = function (sRequestHash)
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/Download/' + sRequestHash;
};
};
/**
/**
* @param {string} sEmail
* @return {string}
*/
LinkBuilder.prototype.avatarLink = function (sEmail)
{
LinkBuilder.prototype.avatarLink = function (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}
*/
LinkBuilder.prototype.inbox = function ()
{
LinkBuilder.prototype.inbox = function ()
{
return this.sBase + 'mailbox/Inbox';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.messagePreview = function ()
{
LinkBuilder.prototype.messagePreview = function ()
{
return this.sBase + 'mailbox/message-preview';
};
};
/**
/**
* @param {string=} sScreenName
* @return {string}
*/
LinkBuilder.prototype.settings = function (sScreenName)
{
LinkBuilder.prototype.settings = function (sScreenName)
{
var sResult = this.sBase + 'settings';
if (!Utils.isUnd(sScreenName) && '' !== sScreenName)
{
@ -154,14 +163,14 @@ LinkBuilder.prototype.settings = function (sScreenName)
}
return sResult;
};
};
/**
/**
* @param {string} sScreenName
* @return {string}
*/
LinkBuilder.prototype.admin = function (sScreenName)
{
LinkBuilder.prototype.admin = function (sScreenName)
{
var sResult = this.sBase;
switch (sScreenName) {
case 'AdminDomains':
@ -176,16 +185,16 @@ LinkBuilder.prototype.admin = function (sScreenName)
}
return sResult;
};
};
/**
/**
* @param {string} sFolder
* @param {number=} iPage = 1
* @param {string=} sSearch = ''
* @return {string}
*/
LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
{
LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
{
iPage = Utils.isNormal(iPage) ? Utils.pInt(iPage) : 1;
sSearch = Utils.pString(sSearch);
@ -206,64 +215,64 @@ LinkBuilder.prototype.mailBox = function (sFolder, iPage, sSearch)
}
return sResult;
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.phpInfo = function ()
{
LinkBuilder.prototype.phpInfo = function ()
{
return this.sServer + 'Info';
};
};
/**
/**
* @param {string} sLang
* @return {string}
*/
LinkBuilder.prototype.langLink = function (sLang)
{
LinkBuilder.prototype.langLink = function (sLang)
{
return this.sServer + '/Lang/0/' + encodeURI(sLang) + '/' + this.sVersion + '/';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.exportContactsVcf = function ()
{
LinkBuilder.prototype.exportContactsVcf = function ()
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsVcf/';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.exportContactsCsv = function ()
{
LinkBuilder.prototype.exportContactsCsv = function ()
{
return this.sServer + '/Raw/' + this.sSpecSuffix + '/ContactsCsv/';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.emptyContactPic = function ()
{
LinkBuilder.prototype.emptyContactPic = function ()
{
return this.sStaticPrefix + 'css/images/empty-contact.png';
};
};
/**
/**
* @param {string} sFileName
* @return {string}
*/
LinkBuilder.prototype.sound = function (sFileName)
{
LinkBuilder.prototype.sound = function (sFileName)
{
return this.sStaticPrefix + 'sounds/' + sFileName;
};
};
/**
/**
* @param {string} sTheme
* @return {string}
*/
LinkBuilder.prototype.themePreviewLink = function (sTheme)
{
LinkBuilder.prototype.themePreviewLink = function (sTheme)
{
var sPrefix = 'rainloop/v/' + this.sVersion + '/';
if ('@custom' === sTheme.substr(-7))
{
@ -272,44 +281,48 @@ LinkBuilder.prototype.themePreviewLink = function (sTheme)
}
return sPrefix + 'themes/' + encodeURI(sTheme) + '/images/preview.png';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.notificationMailIcon = function ()
{
LinkBuilder.prototype.notificationMailIcon = function ()
{
return this.sStaticPrefix + 'css/images/icom-message-notification.png';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.openPgpJs = function ()
{
LinkBuilder.prototype.openPgpJs = function ()
{
return this.sStaticPrefix + 'js/openpgp.min.js';
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.socialGoogle = function ()
{
LinkBuilder.prototype.socialGoogle = function ()
{
return this.sServer + 'SocialGoogle' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.socialTwitter = function ()
{
LinkBuilder.prototype.socialTwitter = function ()
{
return this.sServer + 'SocialTwitter' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
};
/**
/**
* @return {string}
*/
LinkBuilder.prototype.socialFacebook = function ()
{
LinkBuilder.prototype.socialFacebook = function ()
{
return this.sServer + 'SocialFacebook' + ('' !== this.sSpecSuffix ? '/' + this.sSpecSuffix + '/' : '');
};
};
module.exports = LinkBuilder;
}(module));

View file

@ -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
* @param {Object} oElement
* @param {Function=} fOnBlur
* @param {Function=} fOnReady
* @param {Function=} fOnModeChange
*/
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
{
function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
{
var self = this;
self.editor = null;
self.iBlurTimer = 0;
@ -20,10 +30,10 @@ function NewHtmlEditorWrapper(oElement, fOnBlur, fOnReady, fOnModeChange)
self.resize = _.throttle(_.bind(self.resize, self), 100);
self.init();
}
}
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
{
NewHtmlEditorWrapper.prototype.blurTrigger = function ()
{
if (this.fOnBlur)
{
var self = this;
@ -32,45 +42,45 @@ NewHtmlEditorWrapper.prototype.blurTrigger = function ()
self.fOnBlur();
}, 200);
}
};
};
NewHtmlEditorWrapper.prototype.focusTrigger = function ()
{
NewHtmlEditorWrapper.prototype.focusTrigger = function ()
{
if (this.fOnBlur)
{
window.clearTimeout(this.iBlurTimer);
}
};
};
/**
/**
* @return {boolean}
*/
NewHtmlEditorWrapper.prototype.isHtml = function ()
{
NewHtmlEditorWrapper.prototype.isHtml = function ()
{
return this.editor ? 'wysiwyg' === this.editor.mode : false;
};
};
/**
/**
* @return {boolean}
*/
NewHtmlEditorWrapper.prototype.checkDirty = function ()
{
NewHtmlEditorWrapper.prototype.checkDirty = function ()
{
return this.editor ? this.editor.checkDirty() : false;
};
};
NewHtmlEditorWrapper.prototype.resetDirty = function ()
{
NewHtmlEditorWrapper.prototype.resetDirty = function ()
{
if (this.editor)
{
this.editor.resetDirty();
}
};
};
/**
/**
* @return {string}
*/
NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
{
NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
{
if (this.editor)
{
if ('plain' === this.editor.mode && this.editor.plugins.plain && this.editor.__plain)
@ -84,10 +94,10 @@ NewHtmlEditorWrapper.prototype.getData = function (bWrapIsHtml)
}
return '';
};
};
NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
{
NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
{
if (this.editor)
{
if (bPlain)
@ -107,10 +117,10 @@ NewHtmlEditorWrapper.prototype.modeToggle = function (bPlain)
this.resize();
}
};
};
NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
{
NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
{
if (this.editor)
{
this.modeToggle(true);
@ -121,10 +131,10 @@ NewHtmlEditorWrapper.prototype.setHtml = function (sHtml, bFocus)
this.focus();
}
}
};
};
NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
{
NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
{
if (this.editor)
{
this.modeToggle(false);
@ -142,10 +152,10 @@ NewHtmlEditorWrapper.prototype.setPlain = function (sPlain, bFocus)
this.focus();
}
}
};
};
NewHtmlEditorWrapper.prototype.init = function ()
{
NewHtmlEditorWrapper.prototype.init = function ()
{
if (this.$element && this.$element[0])
{
var
@ -154,7 +164,7 @@ NewHtmlEditorWrapper.prototype.init = function ()
var
oConfig = Globals.oHtmlEditorDefaultConfig,
sLanguage = RL.settingsGet('Language'),
sLanguage = RL.settingsGet('Language'), // TODO cjs
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton')
;
@ -223,26 +233,26 @@ NewHtmlEditorWrapper.prototype.init = function ()
window.__initEditor = fInit;
}
}
};
};
NewHtmlEditorWrapper.prototype.focus = function ()
{
NewHtmlEditorWrapper.prototype.focus = function ()
{
if (this.editor)
{
this.editor.focus();
}
};
};
NewHtmlEditorWrapper.prototype.blur = function ()
{
NewHtmlEditorWrapper.prototype.blur = function ()
{
if (this.editor)
{
this.editor.focusManager.blur(true);
}
};
};
NewHtmlEditorWrapper.prototype.resize = function ()
{
NewHtmlEditorWrapper.prototype.resize = function ()
{
if (this.editor && this.__resizable)
{
try
@ -251,10 +261,14 @@ NewHtmlEditorWrapper.prototype.resize = function ()
}
catch (e) {}
}
};
};
NewHtmlEditorWrapper.prototype.clear = function (bFocus)
{
NewHtmlEditorWrapper.prototype.clear = function (bFocus)
{
this.setHtml('', bFocus);
};
};
module.exports = NewHtmlEditorWrapper;
}(module));

View file

@ -1,33 +1,42 @@
/* 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}
*/
Plugins.oViewModelsHooks = {};
Plugins.oViewModelsHooks = {};
/**
/**
* @type {Object}
*/
Plugins.oSimpleHooks = {};
Plugins.oSimpleHooks = {};
/**
/**
* @param {string} sName
* @param {Function} ViewModel
*/
Plugins.regViewModelHook = function (sName, ViewModel)
{
Plugins.regViewModelHook = function (sName, ViewModel)
{
if (ViewModel)
{
ViewModel.__hookName = sName;
}
};
};
/**
/**
* @param {string} sName
* @param {Function} fCallback
*/
Plugins.addHook = function (sName, fCallback)
{
Plugins.addHook = function (sName, fCallback)
{
if (Utils.isFunc(fCallback))
{
if (!Utils.isArray(Plugins.oSimpleHooks[sName]))
@ -37,14 +46,14 @@ Plugins.addHook = function (sName, fCallback)
Plugins.oSimpleHooks[sName].push(fCallback);
}
};
};
/**
/**
* @param {string} sName
* @param {Array=} aArguments
*/
Plugins.runHook = function (sName, aArguments)
{
Plugins.runHook = function (sName, aArguments)
{
if (Utils.isArray(Plugins.oSimpleHooks[sName]))
{
aArguments = aArguments || [];
@ -53,18 +62,18 @@ Plugins.runHook = function (sName, aArguments)
fCallback.apply(null, aArguments);
});
}
};
};
/**
/**
* @param {string} sName
* @return {?}
*/
Plugins.mainSettingsGet = function (sName)
{
return RL ? RL.settingsGet(sName) : null;
};
Plugins.mainSettingsGet = function (sName)
{
return RL ? RL.settingsGet(sName) : null; // TODO cjs
};
/**
/**
* @param {Function} fCallback
* @param {string} sAction
* @param {Object=} oParameters
@ -72,24 +81,26 @@ Plugins.mainSettingsGet = function (sName)
* @param {string=} sGetAdd = ''
* @param {Array=} aAbortActions = []
*/
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
{
if (RL)
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
{
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} sName
* @return {?}
*/
Plugins.settingsGet = function (sPluginSection, sName)
{
Plugins.settingsGet = function (sPluginSection, sName)
{
var oPlugin = Plugins.mainSettingsGet('Plugins');
oPlugin = oPlugin && Utils.isUnd(oPlugin[sPluginSection]) ? null : oPlugin[sPluginSection];
return oPlugin ? (Utils.isUnd(oPlugin[sName]) ? null : oPlugin[sName]) : null;
};
};
module.exports = Plugins;
}(module));

View file

@ -1,6 +1,20 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
$ = require('../External/jquery.js'),
_ = require('../External/underscore.js'),
ko = require('../External/ko.js'),
key = require('../External/key.js'),
Enums = require('./Enums.js'),
Utils = require('./Utils.js')
;
/**
* @constructor
* @param {koProperty} oKoList
* @param {koProperty} oKoSelectedItem
@ -9,9 +23,9 @@
* @param {string} sItemCheckedSelector
* @param {string} sItemFocusedSelector
*/
function Selector(oKoList, oKoSelectedItem,
function Selector(oKoList, oKoSelectedItem,
sItemSelector, sItemSelectedSelector, sItemCheckedSelector, sItemFocusedSelector)
{
{
this.list = oKoList;
this.listChecked = ko.computed(function () {
@ -248,10 +262,10 @@ function Selector(oKoList, oKoSelectedItem,
mSelected = null;
}, this);
}
}
Selector.prototype.itemSelected = function (oItem)
{
Selector.prototype.itemSelected = function (oItem)
{
if (this.isListChecked())
{
if (!oItem)
@ -266,20 +280,20 @@ Selector.prototype.itemSelected = function (oItem)
(this.oCallbacks['onItemSelect'] || this.emptyFunction)(oItem);
}
}
};
};
Selector.prototype.goDown = function (bForceSelect)
{
Selector.prototype.goDown = function (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);
};
};
Selector.prototype.init = function (oContentVisible, oContentScrollable, sKeyScope)
{
Selector.prototype.init = function (oContentVisible, oContentScrollable, sKeyScope)
{
this.oContentVisible = oContentVisible;
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;
};
};
/**
/**
* @param {Object} oItem
* @returns {string}
*/
Selector.prototype.getItemUid = function (oItem)
{
Selector.prototype.getItemUid = function (oItem)
{
var
sUid = '',
fGetItemUidCallback = this.oCallbacks['onItemGetUid'] || null
@ -399,15 +413,15 @@ Selector.prototype.getItemUid = function (oItem)
}
return sUid.toString();
};
};
/**
/**
* @param {number} iEventKeyCode
* @param {boolean} bShiftKey
* @param {boolean=} bForceSelect = false
*/
Selector.prototype.newSelectPosition = function (iEventKeyCode, bShiftKey, bForceSelect)
{
Selector.prototype.newSelectPosition = function (iEventKeyCode, bShiftKey, bForceSelect)
{
var
iIndex = 0,
iPageStep = 10,
@ -546,13 +560,13 @@ Selector.prototype.newSelectPosition = function (iEventKeyCode, bShiftKey, bForc
this.focusedItem(oFocused);
}
};
};
/**
/**
* @return {boolean}
*/
Selector.prototype.scrollToFocused = function ()
{
Selector.prototype.scrollToFocused = function ()
{
if (!this.oContentVisible || !this.oContentScrollable)
{
return false;
@ -581,14 +595,14 @@ Selector.prototype.scrollToFocused = function ()
}
return false;
};
};
/**
/**
* @param {boolean=} bFast = false
* @return {boolean}
*/
Selector.prototype.scrollToTop = function (bFast)
{
Selector.prototype.scrollToTop = function (bFast)
{
if (!this.oContentVisible || !this.oContentScrollable)
{
return false;
@ -604,10 +618,10 @@ Selector.prototype.scrollToTop = function (bFast)
}
return true;
};
};
Selector.prototype.eventClickFunction = function (oItem, oEvent)
{
Selector.prototype.eventClickFunction = function (oItem, oEvent)
{
var
sUid = this.getItemUid(oItem),
iIndex = 0,
@ -652,14 +666,14 @@ Selector.prototype.eventClickFunction = function (oItem, oEvent)
}
this.sLastUid = '' === sUid ? '' : sUid;
};
};
/**
/**
* @param {Object} oItem
* @param {Object=} oEvent
*/
Selector.prototype.actionClick = function (oItem, oEvent)
{
Selector.prototype.actionClick = function (oItem, oEvent)
{
if (oItem)
{
var
@ -704,9 +718,13 @@ Selector.prototype.actionClick = function (oItem, oEvent)
this.scrollToFocused();
}
}
};
};
Selector.prototype.on = function (sEventName, fCallback)
{
Selector.prototype.on = function (sEventName, fCallback)
{
this.oCallbacks[sEventName] = fCallback;
};
};
module.exports = Selector;
}(module));

File diff suppressed because it is too large Load diff

View file

@ -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
;

View file

@ -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*/

View file

@ -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*/

View file

@ -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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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
View 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(
'&nbsp;&nbsp;<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
View 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
View 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
View 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
View file

@ -0,0 +1,5 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
'use strict';
module.exports = window;

View file

@ -1,14 +0,0 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
* @constructor
*/
function KnoinAbstractBoot()
{
}
KnoinAbstractBoot.prototype.bootstart = function ()
{
};

View file

@ -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;
}
};

View file

@ -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;
});
};

View file

@ -1,76 +1,94 @@
/* 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
*/
function Knoin()
{
function Knoin()
{
this.sDefaultScreenName = '';
this.oScreens = {};
this.oBoot = null;
this.oCurrentScreen = null;
}
}
/**
/**
* @param {Object} thisObject
*/
Knoin.constructorEnd = function (thisObject)
{
Knoin.constructorEnd = function (thisObject)
{
if (Utils.isFunc(thisObject['__constructor_end']))
{
thisObject['__constructor_end'].call(thisObject);
}
};
};
Knoin.prototype.sDefaultScreenName = '';
Knoin.prototype.oScreens = {};
Knoin.prototype.oBoot = null;
Knoin.prototype.oCurrentScreen = null;
Knoin.prototype.sDefaultScreenName = '';
Knoin.prototype.oScreens = {};
Knoin.prototype.oBoot = null;
Knoin.prototype.oCurrentScreen = null;
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))
Knoin.prototype.hideLoading = function ()
{
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
* @return {?Object}
*/
Knoin.prototype.screen = function (sScreenName)
{
Knoin.prototype.screen = function (sScreenName)
{
return ('' !== sScreenName && !Utils.isUnd(this.oScreens[sScreenName])) ? this.oScreens[sScreenName] : null;
};
};
/**
/**
* @param {Function} ViewModelClass
* @param {Object=} oScreen
*/
Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
{
Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
{
if (ViewModelClass && !ViewModelClass.__builded)
{
var
@ -82,7 +100,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
ViewModelClass.__builded = true;
ViewModelClass.__vm = oViewModel;
oViewModel.data = RL.data();
oViewModel.data = RL.data(); // TODO cjs
oViewModel.viewModelName = ViewModelClass.__name;
@ -97,7 +115,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
if ('Popups' === sPosition)
{
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () {
kn.hideScreenPopup(ViewModelClass);
kn.hideScreenPopup(ViewModelClass); // TODO cjs
});
oViewModel.modalVisibility.subscribe(function (bValue) {
@ -108,8 +126,8 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
this.viewModelDom.show();
this.storeAndSetKeyScope();
RL.popupVisibilityNames.push(this.viewModelName);
oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10);
RL.popupVisibilityNames.push(this.viewModelName); // TODO cjs
oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10); // TODO cjs
Utils.delegateRun(this, 'onFocus', [], 500);
}
@ -118,7 +136,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
Utils.delegateRun(this, 'onHide');
this.restoreKeyScope();
RL.popupVisibilityNames.remove(this.viewModelName);
RL.popupVisibilityNames.remove(this.viewModelName); // TODO cjs
oViewModel.viewModelDom.css('z-index', 2000);
Globals.tooltipTrigger(!Globals.tooltipTrigger());
@ -131,7 +149,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
}, oViewModel);
}
Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs
ko.applyBindingAccessorsToNode(oViewModelDom[0], {
'i18nInit': true,
@ -144,7 +162,7 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
oViewModel.registerPopupKeyDown();
}
Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs
}
else
{
@ -153,38 +171,38 @@ Knoin.prototype.buildViewModel = function (ViewModelClass, oScreen)
}
return ViewModelClass ? ViewModelClass.__vm : null;
};
};
/**
/**
* @param {Object} oViewModel
* @param {Object} oViewModelDom
*/
Knoin.prototype.applyExternal = function (oViewModel, oViewModelDom)
{
Knoin.prototype.applyExternal = function (oViewModel, oViewModelDom)
{
if (oViewModel && oViewModelDom)
{
ko.applyBindings(oViewModel, oViewModelDom);
}
};
};
/**
/**
* @param {Function} ViewModelClassToHide
*/
Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
{
Knoin.prototype.hideScreenPopup = function (ViewModelClassToHide)
{
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
{
ViewModelClassToHide.__vm.modalVisibility(false);
Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]);
Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]); // TODO cjs
}
};
};
/**
/**
* @param {Function} ViewModelClassToShow
* @param {Array=} aParameters
*/
Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
{
Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
{
if (ViewModelClassToShow)
{
this.buildViewModel(ViewModelClassToShow);
@ -193,26 +211,26 @@ Knoin.prototype.showScreenPopup = function (ViewModelClassToShow, aParameters)
{
ViewModelClassToShow.__vm.modalVisibility(true);
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]); // TODO cjs
}
}
};
};
/**
/**
* @param {Function} ViewModelClassToShow
* @return {boolean}
*/
Knoin.prototype.isPopupVisible = function (ViewModelClassToShow)
{
Knoin.prototype.isPopupVisible = function (ViewModelClassToShow)
{
return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false;
};
};
/**
/**
* @param {string} sScreenName
* @param {string} sSubPart
*/
Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
{
Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
{
var
self = this,
oScreen = null,
@ -284,7 +302,7 @@ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
{
Utils.delegateRun(self.oCurrentScreen, 'onShow');
Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]);
Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]); // TODO cjs
if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
{
@ -298,7 +316,7 @@ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
Utils.delegateRun(ViewModelClass.__vm, 'onShow');
Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200);
Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]);
Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]); // TODO cjs
}
}, self);
@ -314,13 +332,13 @@ Knoin.prototype.screenOnRoute = function (sScreenName, sSubPart)
});
}
}
};
};
/**
/**
* @param {Array} aScreensClasses
*/
Knoin.prototype.startScreens = function (aScreensClasses)
{
Knoin.prototype.startScreens = function (aScreensClasses)
{
$('#rl-content').css({
'visibility': 'hidden'
});
@ -351,9 +369,9 @@ Knoin.prototype.startScreens = function (aScreensClasses)
oScreen.__started = true;
oScreen.__start();
Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]);
Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]); // TODO cjs
Utils.delegateRun(oScreen, 'onStart');
Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]);
Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]); // TODO cjs
}
}, this);
@ -371,15 +389,15 @@ Knoin.prototype.startScreens = function (aScreensClasses)
_.delay(function () {
$html.removeClass('rl-started-trigger').addClass('rl-started');
}, 50);
};
};
/**
/**
* @param {string} sHash
* @param {boolean=} bSilence = 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;
@ -397,19 +415,72 @@ Knoin.prototype.setHash = function (sHash, bSilence, bReplace)
hasher[bReplace ? 'replaceHash' : 'setHash'](sHash);
hasher.setHash(sHash);
}
};
};
/**
/**
* @return {Knoin}
*/
Knoin.prototype.bootstart = function ()
{
if (this.oBoot && this.oBoot.bootstart)
Knoin.prototype.bootstart = function (RL)
{
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));

View 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));

View 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));

View 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));

View file

@ -1,23 +1,35 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('../External/ko.js')
;
/**
* @param {string} sEmail
* @param {boolean=} bCanBeDelete = true
* @constructor
*/
function AccountModel(sEmail, bCanBeDelete)
{
function AccountModel(sEmail, bCanBeDelete)
{
this.email = sEmail;
this.deleteAccess = ko.observable(false);
this.canBeDalete = ko.observable(bCanBeDelete);
}
}
AccountModel.prototype.email = '';
AccountModel.prototype.email = '';
/**
/**
* @return {string}
*/
AccountModel.prototype.changeAccountLink = function ()
{
return RL.link().change(this.email);
};
AccountModel.prototype.changeAccountLink = function ()
{
return RL.link().change(this.email); // TODO cjs
};
module.exports = AccountModel;
}(module));

View file

@ -1,10 +1,20 @@
/* 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
*/
function AttachmentModel()
{
function AttachmentModel()
{
this.mimeType = '';
this.fileName = '';
this.estimatedSize = 0;
@ -18,38 +28,38 @@ function AttachmentModel()
this.folder = '';
this.uid = '';
this.mimeIndex = '';
}
}
/**
/**
* @static
* @param {AjaxJsonAttachment} oJsonAttachment
* @return {?AttachmentModel}
*/
AttachmentModel.newInstanceFromJson = function (oJsonAttachment)
{
AttachmentModel.newInstanceFromJson = function (oJsonAttachment)
{
var oAttachmentModel = new AttachmentModel();
return oAttachmentModel.initByJson(oJsonAttachment) ? oAttachmentModel : null;
};
};
AttachmentModel.prototype.mimeType = '';
AttachmentModel.prototype.fileName = '';
AttachmentModel.prototype.estimatedSize = 0;
AttachmentModel.prototype.friendlySize = '';
AttachmentModel.prototype.isInline = false;
AttachmentModel.prototype.isLinked = false;
AttachmentModel.prototype.cid = '';
AttachmentModel.prototype.cidWithOutTags = '';
AttachmentModel.prototype.contentLocation = '';
AttachmentModel.prototype.download = '';
AttachmentModel.prototype.folder = '';
AttachmentModel.prototype.uid = '';
AttachmentModel.prototype.mimeIndex = '';
AttachmentModel.prototype.mimeType = '';
AttachmentModel.prototype.fileName = '';
AttachmentModel.prototype.estimatedSize = 0;
AttachmentModel.prototype.friendlySize = '';
AttachmentModel.prototype.isInline = false;
AttachmentModel.prototype.isLinked = false;
AttachmentModel.prototype.cid = '';
AttachmentModel.prototype.cidWithOutTags = '';
AttachmentModel.prototype.contentLocation = '';
AttachmentModel.prototype.download = '';
AttachmentModel.prototype.folder = '';
AttachmentModel.prototype.uid = '';
AttachmentModel.prototype.mimeIndex = '';
/**
/**
* @param {AjaxJsonAttachment} oJsonAttachment
*/
AttachmentModel.prototype.initByJson = function (oJsonAttachment)
{
AttachmentModel.prototype.initByJson = function (oJsonAttachment)
{
var bResult = false;
if (oJsonAttachment && 'Object/Attachment' === oJsonAttachment['@Object'])
{
@ -73,64 +83,64 @@ AttachmentModel.prototype.initByJson = function (oJsonAttachment)
}
return bResult;
};
};
/**
/**
* @return {boolean}
*/
AttachmentModel.prototype.isImage = function ()
{
AttachmentModel.prototype.isImage = function ()
{
return -1 < Utils.inArray(this.mimeType.toLowerCase(),
['image/png', 'image/jpg', 'image/jpeg', 'image/gif']
);
};
};
/**
/**
* @return {boolean}
*/
AttachmentModel.prototype.isText = function ()
{
AttachmentModel.prototype.isText = function ()
{
return 'text/' === this.mimeType.substr(0, 5) &&
-1 === Utils.inArray(this.mimeType, ['text/html']);
};
};
/**
/**
* @return {boolean}
*/
AttachmentModel.prototype.isPdf = function ()
{
AttachmentModel.prototype.isPdf = function ()
{
return Globals.bAllowPdfPreview && 'application/pdf' === this.mimeType;
};
};
/**
/**
* @return {string}
*/
AttachmentModel.prototype.linkDownload = function ()
{
return RL.link().attachmentDownload(this.download);
};
AttachmentModel.prototype.linkDownload = function ()
{
return RL.link().attachmentDownload(this.download); // TODO cjs
};
/**
/**
* @return {string}
*/
AttachmentModel.prototype.linkPreview = function ()
{
return RL.link().attachmentPreview(this.download);
};
AttachmentModel.prototype.linkPreview = function ()
{
return RL.link().attachmentPreview(this.download); // TODO cjs
};
/**
/**
* @return {string}
*/
AttachmentModel.prototype.linkPreviewAsPlain = function ()
{
AttachmentModel.prototype.linkPreviewAsPlain = function ()
{
return RL.link().attachmentPreviewAsPlain(this.download);
};
};
/**
/**
* @return {string}
*/
AttachmentModel.prototype.generateTransferDownloadUrl = function ()
{
AttachmentModel.prototype.generateTransferDownloadUrl = function ()
{
var sLink = this.linkDownload();
if ('http' !== sLink.substr(0, 4))
{
@ -138,15 +148,15 @@ AttachmentModel.prototype.generateTransferDownloadUrl = function ()
}
return this.mimeType + ':' + this.fileName + ':' + sLink;
};
};
/**
/**
* @param {AttachmentModel} oAttachment
* @param {*} oEvent
* @return {boolean}
*/
AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
{
AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
{
var oLocalEvent = oEvent.originalEvent || oEvent;
if (oAttachment && oLocalEvent && oLocalEvent.dataTransfer && oLocalEvent.dataTransfer.setData)
{
@ -154,10 +164,10 @@ AttachmentModel.prototype.eventDragStart = function (oAttachment, oEvent)
}
return true;
};
};
AttachmentModel.prototype.iconClass = function ()
{
AttachmentModel.prototype.iconClass = function ()
{
var
aParts = this.mimeType.toLocaleString().split('/'),
sClass = 'icon-file'
@ -186,17 +196,17 @@ AttachmentModel.prototype.iconClass = function ()
{
sClass = 'icon-file-zip';
}
// else if (-1 < Utils.inArray(aParts[1],
// ['pdf', 'x-pdf']))
// {
// sClass = 'icon-file-pdf';
// }
// else if (-1 < Utils.inArray(aParts[1], [
// 'exe', 'x-exe', 'x-winexe', 'bat'
// ]))
// {
// sClass = 'icon-console';
// }
// else if (-1 < Utils.inArray(aParts[1],
// ['pdf', 'x-pdf']))
// {
// sClass = 'icon-file-pdf';
// }
// else if (-1 < Utils.inArray(aParts[1], [
// 'exe', 'x-exe', 'x-winexe', 'bat'
// ]))
// {
// sClass = 'icon-console';
// }
else if (-1 < Utils.inArray(aParts[1], [
'rtf', 'msword', 'vnd.msword', 'vnd.openxmlformats-officedocument.wordprocessingml.document',
'vnd.openxmlformats-officedocument.wordprocessingml.template',
@ -234,4 +244,8 @@ AttachmentModel.prototype.iconClass = function ()
}
return sClass;
};
};
module.exports = AttachmentModel;
}(module));

View file

@ -1,6 +1,15 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('../External/ko.js'),
Utils = require('../Common/Utils.js')
;
/**
* @constructor
* @param {string} sId
* @param {string} sFileName
@ -10,8 +19,8 @@
* @param {string=} sCID
* @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.isInline = Utils.isUnd(bInline) ? false : !!bInline;
this.isLinked = Utils.isUnd(bLinked) ? false : !!bLinked;
@ -33,21 +42,21 @@ function ComposeAttachmentModel(sId, sFileName, nSize, bInline, bLinked, sCID, s
var mSize = this.size();
return null === mSize ? '' : Utils.friendlySize(this.size());
}, this);
}
}
ComposeAttachmentModel.prototype.id = '';
ComposeAttachmentModel.prototype.isInline = false;
ComposeAttachmentModel.prototype.isLinked = false;
ComposeAttachmentModel.prototype.CID = '';
ComposeAttachmentModel.prototype.contentLocation = '';
ComposeAttachmentModel.prototype.fromMessage = false;
ComposeAttachmentModel.prototype.cancel = Utils.emptyFunction;
ComposeAttachmentModel.prototype.id = '';
ComposeAttachmentModel.prototype.isInline = false;
ComposeAttachmentModel.prototype.isLinked = false;
ComposeAttachmentModel.prototype.CID = '';
ComposeAttachmentModel.prototype.contentLocation = '';
ComposeAttachmentModel.prototype.fromMessage = false;
ComposeAttachmentModel.prototype.cancel = Utils.emptyFunction;
/**
/**
* @param {AjaxJsonComposeAttachment} oJsonAttachment
*/
ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
{
ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
{
var bResult = false;
if (oJsonAttachment)
{
@ -60,4 +69,8 @@ ComposeAttachmentModel.prototype.initByUploadJson = function (oJsonAttachment)
}
return bResult;
};
};
module.exports = ComposeAttachmentModel;
}(module));

View file

@ -1,10 +1,21 @@
/* 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
*/
function ContactModel()
{
function ContactModel()
{
this.idContact = 0;
this.display = '';
this.properties = [];
@ -15,13 +26,13 @@ function ContactModel()
this.selected = ko.observable(false);
this.checked = ko.observable(false);
this.deleted = ko.observable(false);
}
}
/**
/**
* @return {Array|null}
*/
ContactModel.prototype.getNameAndEmailHelper = function ()
{
ContactModel.prototype.getNameAndEmailHelper = function ()
{
var
sName = '',
sEmail = ''
@ -49,10 +60,10 @@ ContactModel.prototype.getNameAndEmailHelper = function ()
}
return '' === sEmail ? null : [sEmail, sName];
};
};
ContactModel.prototype.parse = function (oItem)
{
ContactModel.prototype.parse = function (oItem)
{
var bResult = false;
if (oItem && 'Object/Contact' === oItem['@Object'])
{
@ -80,29 +91,29 @@ ContactModel.prototype.parse = function (oItem)
}
return bResult;
};
};
/**
/**
* @return {string}
*/
ContactModel.prototype.srcAttr = function ()
{
return RL.link().emptyContactPic();
};
ContactModel.prototype.srcAttr = function ()
{
return RL.link().emptyContactPic(); // TODO cjs
};
/**
/**
* @return {string}
*/
ContactModel.prototype.generateUid = function ()
{
ContactModel.prototype.generateUid = function ()
{
return '' + this.idContact;
};
};
/**
/**
* @return string
*/
ContactModel.prototype.lineAsCcc = function ()
{
ContactModel.prototype.lineAsCcc = function ()
{
var aResult = [];
if (this.deleted())
{
@ -122,4 +133,8 @@ ContactModel.prototype.lineAsCcc = function ()
}
return aResult.join(' ');
};
};
module.exports = ContactModel;
}(module));

View file

@ -1,6 +1,16 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('../External/ko.js'),
Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js')
;
/**
* @param {number=} iType = Enums.ContactPropertyType.Unknown
* @param {string=} sTypeStr = ''
* @param {string=} sValue = ''
@ -9,8 +19,8 @@
*
* @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.typeStr = ko.observable(Utils.isUnd(sTypeStr) ? '' : sTypeStr);
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 () {
return Enums.ContactPropertyType.Note === this.type();
}, this);
}
}
module.exports = ContactPropertyModel;
}(module));

View file

@ -1,17 +1,26 @@
/* 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
*/
function ContactTagModel()
{
function ContactTagModel()
{
this.idContactTag = 0;
this.name = ko.observable('');
this.readOnly = false;
}
}
ContactTagModel.prototype.parse = function (oItem)
{
ContactTagModel.prototype.parse = function (oItem)
{
var bResult = false;
if (oItem && 'Object/Tag' === oItem['@Object'])
{
@ -23,23 +32,27 @@ ContactTagModel.prototype.parse = function (oItem)
}
return bResult;
};
};
/**
/**
* @param {string} sSearch
* @return {boolean}
*/
ContactTagModel.prototype.filterHelper = function (sSearch)
{
ContactTagModel.prototype.filterHelper = function (sSearch)
{
return this.name().toLowerCase().indexOf(sSearch.toLowerCase()) !== -1;
};
};
/**
/**
* @param {boolean=} bEncodeHtml = false
* @return {string}
*/
ContactTagModel.prototype.toLine = function (bEncodeHtml)
{
ContactTagModel.prototype.toLine = function (bEncodeHtml)
{
return (Utils.isUnd(bEncodeHtml) ? false : !!bEncodeHtml) ?
Utils.encodeHtml(this.name()) : this.name();
};
};
module.exports = ContactTagModel;
}(module));

View file

@ -1,83 +1,92 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js')
;
/**
* @param {string=} sEmail
* @param {string=} sName
*
* @constructor
*/
function EmailModel(sEmail, sName)
{
function EmailModel(sEmail, sName)
{
this.email = sEmail || '';
this.name = sName || '';
this.privateType = null;
this.clearDuplicateName();
}
}
/**
/**
* @static
* @param {AjaxJsonEmail} oJsonEmail
* @return {?EmailModel}
*/
EmailModel.newInstanceFromJson = function (oJsonEmail)
{
EmailModel.newInstanceFromJson = function (oJsonEmail)
{
var oEmailModel = new EmailModel();
return oEmailModel.initByJson(oJsonEmail) ? oEmailModel : null;
};
};
/**
/**
* @type {string}
*/
EmailModel.prototype.name = '';
EmailModel.prototype.name = '';
/**
/**
* @type {string}
*/
EmailModel.prototype.email = '';
EmailModel.prototype.email = '';
/**
/**
* @type {(number|null)}
*/
EmailModel.prototype.privateType = null;
EmailModel.prototype.privateType = null;
EmailModel.prototype.clear = function ()
{
EmailModel.prototype.clear = function ()
{
this.email = '';
this.name = '';
this.privateType = null;
};
};
/**
/**
* @returns {boolean}
*/
EmailModel.prototype.validate = function ()
{
EmailModel.prototype.validate = function ()
{
return '' !== this.name || '' !== this.email;
};
};
/**
/**
* @param {boolean} bWithoutName = false
* @return {string}
*/
EmailModel.prototype.hash = function (bWithoutName)
{
EmailModel.prototype.hash = function (bWithoutName)
{
return '#' + (bWithoutName ? '' : this.name) + '#' + this.email + '#';
};
};
EmailModel.prototype.clearDuplicateName = function ()
{
EmailModel.prototype.clearDuplicateName = function ()
{
if (this.name === this.email)
{
this.name = '';
}
};
};
/**
/**
* @return {number}
*/
EmailModel.prototype.type = function ()
{
EmailModel.prototype.type = function ()
{
if (null === this.privateType)
{
if (this.email && '@facebook.com' === this.email.substr(-13))
@ -92,22 +101,22 @@ EmailModel.prototype.type = function ()
}
return this.privateType;
};
};
/**
/**
* @param {string} sQuery
* @return {boolean}
*/
EmailModel.prototype.search = function (sQuery)
{
EmailModel.prototype.search = function (sQuery)
{
return -1 < (this.name + ' ' + this.email).toLowerCase().indexOf(sQuery.toLowerCase());
};
};
/**
/**
* @param {string} sString
*/
EmailModel.prototype.parse = function (sString)
{
EmailModel.prototype.parse = function (sString)
{
this.clear();
sString = Utils.trim(sString);
@ -129,14 +138,14 @@ EmailModel.prototype.parse = function (sString)
this.name = '';
this.email = sString;
}
};
};
/**
/**
* @param {AjaxJsonEmail} oJsonEmail
* @return {boolean}
*/
EmailModel.prototype.initByJson = function (oJsonEmail)
{
EmailModel.prototype.initByJson = function (oJsonEmail)
{
var bResult = false;
if (oJsonEmail && 'Object/Email' === oJsonEmail['@Object'])
{
@ -148,16 +157,16 @@ EmailModel.prototype.initByJson = function (oJsonEmail)
}
return bResult;
};
};
/**
/**
* @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false
* @param {boolean=} bEncodeHtml = false
* @return {string}
*/
EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtml)
{
EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtml)
{
var sResult = '';
if ('' !== this.email)
{
@ -197,14 +206,14 @@ EmailModel.prototype.toLine = function (bFriendlyView, bWrapWithLink, bEncodeHtm
}
return sResult;
};
};
/**
/**
* @param {string} $sEmailAddress
* @return {boolean}
*/
EmailModel.prototype.mailsoParse = function ($sEmailAddress)
{
EmailModel.prototype.mailsoParse = function ($sEmailAddress)
{
$sEmailAddress = Utils.trim($sEmailAddress);
if ('' === $sEmailAddress)
{
@ -354,12 +363,16 @@ EmailModel.prototype.mailsoParse = function ($sEmailAddress)
this.clearDuplicateName();
return true;
};
};
/**
/**
* @return {string}
*/
EmailModel.prototype.inputoTagLine = function ()
{
EmailModel.prototype.inputoTagLine = function ()
{
return 0 < this.name.length ? this.name + ' (' + this.email + ')' : this.email;
};
};
module.exports = EmailModel;
}(module));

View file

@ -1,10 +1,20 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('../External/ko.js'),
Enums = require('../Common/Enums.js')
;
/**
* @param {*} oKoList
* @constructor
*/
function FilterConditionModel(oKoList)
{
function FilterConditionModel(oKoList)
{
this.parentList = oKoList;
this.field = ko.observable(Enums.FilterConditionField.From);
@ -40,9 +50,13 @@ function FilterConditionModel(oKoList)
return sTemplate;
}, this);
}
}
FilterConditionModel.prototype.removeSelf = function ()
{
FilterConditionModel.prototype.removeSelf = function ()
{
this.parentList.remove(this);
};
};
module.exports = FilterConditionModel;
}(module));

View file

@ -1,10 +1,21 @@
/* 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
*/
function FilterModel()
{
function FilterModel()
{
this.new = ko.observable(true);
this.enabled = ko.observable(true);
@ -27,7 +38,7 @@ function FilterModel()
this.actionTypeOptions = [ // TODO i18n
{'id': Enums.FiltersAction.None, 'name': 'Action - None'},
{'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'}
];
@ -58,15 +69,15 @@ function FilterModel()
return sTemplate;
}, this);
}
}
FilterModel.prototype.addCondition = function ()
{
FilterModel.prototype.addCondition = function ()
{
this.conditions.push(new FilterConditionModel(this.conditions));
};
};
FilterModel.prototype.parse = function (oItem)
{
FilterModel.prototype.parse = function (oItem)
{
var bResult = false;
if (oItem && 'Object/Filter' === oItem['@Object'])
{
@ -76,4 +87,8 @@ FilterModel.prototype.parse = function (oItem)
}
return bResult;
};
};
module.exports = FilterModel;
}(module));

View file

@ -1,10 +1,23 @@
/* 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
*/
function FolderModel()
{
function FolderModel()
{
this.name = ko.observable('');
this.fullName = '';
this.fullNameRaw = '';
@ -45,24 +58,24 @@ function FolderModel()
this.privateMessageCountUnread = ko.observable(0);
this.collapsedPrivate = ko.observable(true);
}
}
/**
/**
* @static
* @param {AjaxJsonFolder} oJsonFolder
* @return {?FolderModel}
*/
FolderModel.newInstanceFromJson = function (oJsonFolder)
{
FolderModel.newInstanceFromJson = function (oJsonFolder)
{
var oFolderModel = new FolderModel();
return oFolderModel.initByJson(oJsonFolder) ? oFolderModel.initComputed() : null;
};
};
/**
/**
* @return {FolderModel}
*/
FolderModel.prototype.initComputed = function ()
{
FolderModel.prototype.initComputed = function ()
{
this.hasSubScribedSubfolders = ko.computed(function () {
return !!_.find(this.subFolders(), function (oFolder) {
return oFolder.subScribed() && !oFolder.isSystemFolder();
@ -139,7 +152,7 @@ FolderModel.prototype.initComputed = function ()
if (Enums.FolderType.Inbox === iType)
{
RL.data().foldersInboxUnreadCount(iUnread);
RL.data().foldersInboxUnreadCount(iUnread); // TODO cjs
}
if (0 < iCount)
@ -278,31 +291,31 @@ FolderModel.prototype.initComputed = function ()
}, this);
return this;
};
};
FolderModel.prototype.fullName = '';
FolderModel.prototype.fullNameRaw = '';
FolderModel.prototype.fullNameHash = '';
FolderModel.prototype.delimiter = '';
FolderModel.prototype.namespace = '';
FolderModel.prototype.deep = 0;
FolderModel.prototype.interval = 0;
FolderModel.prototype.fullName = '';
FolderModel.prototype.fullNameRaw = '';
FolderModel.prototype.fullNameHash = '';
FolderModel.prototype.delimiter = '';
FolderModel.prototype.namespace = '';
FolderModel.prototype.deep = 0;
FolderModel.prototype.interval = 0;
/**
/**
* @return {string}
*/
FolderModel.prototype.collapsedCss = function ()
{
FolderModel.prototype.collapsedCss = function ()
{
return this.hasSubScribedSubfolders() ?
(this.collapsed() ? 'icon-right-mini e-collapsed-sign' : 'icon-down-mini e-collapsed-sign') : 'icon-none e-collapsed-sign';
};
};
/**
/**
* @param {AjaxJsonFolder} oJsonFolder
* @return {boolean}
*/
FolderModel.prototype.initByJson = function (oJsonFolder)
{
FolderModel.prototype.initByJson = function (oJsonFolder)
{
var bResult = false;
if (oJsonFolder && 'Object/Folder' === oJsonFolder['@Object'])
{
@ -322,12 +335,16 @@ FolderModel.prototype.initByJson = function (oJsonFolder)
}
return bResult;
};
};
/**
/**
* @return {string}
*/
FolderModel.prototype.printableFullName = function ()
{
FolderModel.prototype.printableFullName = function ()
{
return this.fullName.split(this.delimiter).join(' / ');
};
};
module.exports = FolderModel;
}(module));

View file

@ -1,13 +1,22 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('../External/ko.js'),
Utils = require('../Common/Utils.js')
;
/**
* @param {string} sId
* @param {string} sEmail
* @param {boolean=} bCanBeDelete = true
* @constructor
*/
function IdentityModel(sId, sEmail, bCanBeDelete)
{
function IdentityModel(sId, sEmail, bCanBeDelete)
{
this.id = sId;
this.email = ko.observable(sEmail);
this.name = ko.observable('');
@ -16,22 +25,26 @@ function IdentityModel(sId, sEmail, bCanBeDelete)
this.deleteAccess = ko.observable(false);
this.canBeDalete = ko.observable(bCanBeDelete);
}
}
IdentityModel.prototype.formattedName = function ()
{
IdentityModel.prototype.formattedName = function ()
{
var sName = this.name();
return '' === sName ? this.email() : sName + ' <' + this.email() + '>';
};
};
IdentityModel.prototype.formattedNameForCompose = function ()
{
IdentityModel.prototype.formattedNameForCompose = function ()
{
var sName = this.name();
return '' === sName ? this.email() : sName + ' (' + this.email() + ')';
};
};
IdentityModel.prototype.formattedNameForEmail = function ()
{
IdentityModel.prototype.formattedNameForEmail = function ()
{
var sName = this.name();
return '' === sName ? this.email() : '"' + Utils.quoteName(sName) + '" <' + this.email() + '>';
};
};
module.exports = IdentityModel;
}(module));

View file

@ -1,10 +1,30 @@
/* 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
*/
function MessageModel()
{
function MessageModel()
{
this.folderFullNameRaw = '';
this.uid = '';
this.hash = '';
@ -68,9 +88,9 @@ function MessageModel()
case 'doc':
sClass = 'icon-file-text';
break;
// case 'pdf':
// sClass = 'icon-file-pdf';
// break;
// case 'pdf':
// sClass = 'icon-file-pdf';
// break;
}
}
return sClass;
@ -120,38 +140,38 @@ function MessageModel()
var iCount = this.threadsLen();
return 0 === this.parentUid() && 0 < iCount ? iCount + 1 : '';
}, this);
}
}
/**
/**
* @static
* @param {AjaxJsonMessage} oJsonMessage
* @return {?MessageModel}
*/
MessageModel.newInstanceFromJson = function (oJsonMessage)
{
MessageModel.newInstanceFromJson = function (oJsonMessage)
{
var oMessageModel = new MessageModel();
return oMessageModel.initByJson(oJsonMessage) ? oMessageModel : null;
};
};
/**
/**
* @static
* @param {number} iTimeStampInUTC
* @return {string}
*/
MessageModel.calculateFullFromatDateValue = function (iTimeStampInUTC)
{
MessageModel.calculateFullFromatDateValue = function (iTimeStampInUTC)
{
return 0 < iTimeStampInUTC ? moment.unix(iTimeStampInUTC).format('LLL') : '';
};
};
/**
/**
* @static
* @param {Array} aEmail
* @param {boolean=} bFriendlyView
* @param {boolean=} bWrapWithLink = false
* @return {string}
*/
MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
{
MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
{
var
aResult = [],
iIndex = 0,
@ -167,15 +187,15 @@ MessageModel.emailsToLine = function (aEmail, bFriendlyView, bWrapWithLink)
}
return aResult.join(', ');
};
};
/**
/**
* @static
* @param {Array} aEmail
* @return {string}
*/
MessageModel.emailsToLineClear = function (aEmail)
{
MessageModel.emailsToLineClear = function (aEmail)
{
var
aResult = [],
iIndex = 0,
@ -194,15 +214,15 @@ MessageModel.emailsToLineClear = function (aEmail)
}
return aResult.join(', ');
};
};
/**
/**
* @static
* @param {?Array} aJsonEmails
* @return {Array.<EmailModel>}
*/
MessageModel.initEmailsFromJson = function (aJsonEmails)
{
MessageModel.initEmailsFromJson = function (aJsonEmails)
{
var
iIndex = 0,
iLen = 0,
@ -223,16 +243,16 @@ MessageModel.initEmailsFromJson = function (aJsonEmails)
}
return aResult;
};
};
/**
/**
* @static
* @param {Array.<EmailModel>} aMessageEmails
* @param {Object} oLocalUnic
* @param {Array} aLocalEmails
*/
MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
{
MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
{
if (aMessageEmails && 0 < aMessageEmails.length)
{
var
@ -249,10 +269,10 @@ MessageModel.replyHelper = function (aMessageEmails, oLocalUnic, aLocalEmails)
}
}
}
};
};
MessageModel.prototype.clear = function ()
{
MessageModel.prototype.clear = function ()
{
this.folderFullNameRaw = '';
this.uid = '';
this.hash = '';
@ -321,10 +341,10 @@ MessageModel.prototype.clear = function ()
this.lastInCollapsedThread(false);
this.lastInCollapsedThreadLoading(false);
};
};
MessageModel.prototype.computeSenderEmail = function ()
{
MessageModel.prototype.computeSenderEmail = function ()
{
var
sSent = RL.data().sentFolder(),
sDraft = RL.data().draftFolder()
@ -335,14 +355,14 @@ MessageModel.prototype.computeSenderEmail = function ()
this.senderClearEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
this.toClearEmailsString() : this.fromClearEmailString());
};
};
/**
/**
* @param {AjaxJsonMessage} oJsonMessage
* @return {boolean}
*/
MessageModel.prototype.initByJson = function (oJsonMessage)
{
MessageModel.prototype.initByJson = function (oJsonMessage)
{
var bResult = false;
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
{
@ -394,14 +414,14 @@ MessageModel.prototype.initByJson = function (oJsonMessage)
}
return bResult;
};
};
/**
/**
* @param {AjaxJsonMessage} oJsonMessage
* @return {boolean}
*/
MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
{
MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
{
var
bResult = false,
iPriority = Enums.MessagePriority.Normal
@ -421,7 +441,7 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
this.proxy = !!oJsonMessage.ExternalProxy;
if (RL.data().capaOpenPGP())
if (RL.data().capaOpenPGP()) // TODO cjs
{
this.isPgpSigned(!!oJsonMessage.PgpSigned);
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
@ -441,14 +461,14 @@ MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
}
return bResult;
};
};
/**
/**
* @param {(AjaxJsonAttachment|null)} oJsonAttachments
* @return {Array}
*/
MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
{
MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
{
var
iIndex = 0,
iLen = 0,
@ -476,14 +496,14 @@ MessageModel.prototype.initAttachmentsFromJson = function (oJsonAttachments)
}
return aResult;
};
};
/**
/**
* @param {AjaxJsonMessage} oJsonMessage
* @return {boolean}
*/
MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
{
MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
{
var bResult = false;
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
@ -498,53 +518,53 @@ MessageModel.prototype.initFlagsByJson = function (oJsonMessage)
}
return bResult;
};
};
/**
/**
* @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false
* @return {string}
*/
MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
{
MessageModel.prototype.fromToLine = function (bFriendlyView, bWrapWithLink)
{
return MessageModel.emailsToLine(this.from, bFriendlyView, bWrapWithLink);
};
};
/**
/**
* @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false
* @return {string}
*/
MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
{
MessageModel.prototype.toToLine = function (bFriendlyView, bWrapWithLink)
{
return MessageModel.emailsToLine(this.to, bFriendlyView, bWrapWithLink);
};
};
/**
/**
* @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false
* @return {string}
*/
MessageModel.prototype.ccToLine = function (bFriendlyView, bWrapWithLink)
{
MessageModel.prototype.ccToLine = function (bFriendlyView, bWrapWithLink)
{
return MessageModel.emailsToLine(this.cc, bFriendlyView, bWrapWithLink);
};
};
/**
/**
* @param {boolean} bFriendlyView
* @param {boolean=} bWrapWithLink = false
* @return {string}
*/
MessageModel.prototype.bccToLine = function (bFriendlyView, bWrapWithLink)
{
MessageModel.prototype.bccToLine = function (bFriendlyView, bWrapWithLink)
{
return MessageModel.emailsToLine(this.bcc, bFriendlyView, bWrapWithLink);
};
};
/**
/**
* @return string
*/
MessageModel.prototype.lineAsCcc = function ()
{
MessageModel.prototype.lineAsCcc = function ()
{
var aResult = [];
if (this.deleted())
{
@ -617,25 +637,24 @@ MessageModel.prototype.lineAsCcc = function ()
}
return aResult.join(' ');
};
};
/**
/**
* @return {boolean}
*/
MessageModel.prototype.hasVisibleAttachments = function ()
{
MessageModel.prototype.hasVisibleAttachments = function ()
{
return !!_.find(this.attachments(), function (oAttachment) {
return !oAttachment.isLinked;
});
// return 0 < this.attachments().length;
};
};
/**
/**
* @param {string} sCid
* @return {*}
*/
MessageModel.prototype.findAttachmentByCid = function (sCid)
{
MessageModel.prototype.findAttachmentByCid = function (sCid)
{
var
oResult = null,
aAttachments = this.attachments()
@ -650,14 +669,14 @@ MessageModel.prototype.findAttachmentByCid = function (sCid)
}
return oResult || null;
};
};
/**
/**
* @param {string} sContentLocation
* @return {*}
*/
MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocation)
{
MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocation)
{
var
oResult = null,
aAttachments = this.attachments()
@ -671,63 +690,63 @@ MessageModel.prototype.findAttachmentByContentLocation = function (sContentLocat
}
return oResult || null;
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.messageId = function ()
{
MessageModel.prototype.messageId = function ()
{
return this.sMessageId;
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.inReplyTo = function ()
{
MessageModel.prototype.inReplyTo = function ()
{
return this.sInReplyTo;
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.references = function ()
{
MessageModel.prototype.references = function ()
{
return this.sReferences;
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.fromAsSingleEmail = function ()
{
MessageModel.prototype.fromAsSingleEmail = function ()
{
return Utils.isArray(this.from) && this.from[0] ? this.from[0].email : '';
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.viewLink = function ()
{
return RL.link().messageViewLink(this.requestHash);
};
MessageModel.prototype.viewLink = function ()
{
return RL.link().messageViewLink(this.requestHash);// TODO cjs
};
/**
/**
* @return {string}
*/
MessageModel.prototype.downloadLink = function ()
{
return RL.link().messageDownloadLink(this.requestHash);
};
MessageModel.prototype.downloadLink = function ()
{
return RL.link().messageDownloadLink(this.requestHash);// TODO cjs
};
/**
/**
* @param {Object} oExcludeEmails
* @return {Array}
*/
MessageModel.prototype.replyEmails = function (oExcludeEmails)
{
MessageModel.prototype.replyEmails = function (oExcludeEmails)
{
var
aResult = [],
oUnic = Utils.isUnd(oExcludeEmails) ? {} : oExcludeEmails
@ -740,14 +759,14 @@ MessageModel.prototype.replyEmails = function (oExcludeEmails)
}
return aResult;
};
};
/**
/**
* @param {Object} oExcludeEmails
* @return {Array.<Array>}
*/
MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
{
MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
{
var
aToResult = [],
aCcResult = [],
@ -764,33 +783,33 @@ MessageModel.prototype.replyAllEmails = function (oExcludeEmails)
MessageModel.replyHelper(this.cc, oUnic, aCcResult);
return [aToResult, aCcResult];
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.textBodyToString = function ()
{
MessageModel.prototype.textBodyToString = function ()
{
return this.body ? this.body.html() : '';
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.attachmentsToStringLine = function ()
{
MessageModel.prototype.attachmentsToStringLine = function ()
{
var aAttachLines = _.map(this.attachments(), function (oItem) {
return oItem.fileName + ' (' + oItem.friendlySize + ')';
});
return aAttachLines && 0 < aAttachLines.length ? aAttachLines.join(', ') : '';
};
};
/**
/**
* @return {Object}
*/
MessageModel.prototype.getDataForWindowPopup = function ()
{
MessageModel.prototype.getDataForWindowPopup = function ()
{
return {
'popupFrom': this.fromToLine(false),
'popupTo': this.toToLine(false),
@ -801,13 +820,13 @@ MessageModel.prototype.getDataForWindowPopup = function ()
'popupAttachments': this.attachmentsToStringLine(),
'popupBody': this.textBodyToString()
};
};
};
/**
/**
* @param {boolean=} bPrint = false
*/
MessageModel.prototype.viewPopupMessage = function (bPrint)
{
MessageModel.prototype.viewPopupMessage = function (bPrint)
{
Utils.windowPopupKnockout(this.getDataForWindowPopup(), 'PopupsWindowSimpleMessage', this.subject(), function (oPopupWin) {
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);
};
};
/**
/**
* @returns {string}
*/
MessageModel.prototype.generateUid = function ()
{
MessageModel.prototype.generateUid = function ()
{
return this.folderFullNameRaw + '/' + this.uid;
};
};
/**
/**
* @param {MessageModel} oMessage
* @return {MessageModel}
*/
MessageModel.prototype.populateByMessageListItem = function (oMessage)
{
MessageModel.prototype.populateByMessageListItem = function (oMessage)
{
this.folderFullNameRaw = oMessage.folderFullNameRaw;
this.uid = oMessage.uid;
this.hash = oMessage.hash;
@ -896,12 +915,6 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
this.moment(oMessage.moment());
this.body = null;
// this.isHtml(false);
// this.hasImages(false);
// this.attachments([]);
// this.isPgpSigned(false);
// this.isPgpEncrypted(false);
this.priority(Enums.MessagePriority.Normal);
this.aDraftInfo = [];
@ -916,10 +929,10 @@ MessageModel.prototype.populateByMessageListItem = function (oMessage)
this.computeSenderEmail();
return this;
};
};
MessageModel.prototype.showExternalImages = function (bLazy)
{
MessageModel.prototype.showExternalImages = function (bLazy)
{
if (this.body && this.body.data('rl-has-images'))
{
var sAttr = '';
@ -965,10 +978,10 @@ MessageModel.prototype.showExternalImages = function (bLazy)
Utils.windowResize(500);
}
};
};
MessageModel.prototype.showInternalImages = function (bLazy)
{
MessageModel.prototype.showInternalImages = function (bLazy)
{
if (this.body && !this.body.data('rl-init-internal-images'))
{
this.body.data('rl-init-internal-images', true);
@ -1054,10 +1067,10 @@ MessageModel.prototype.showInternalImages = function (bLazy)
Utils.windowResize(500);
}
};
};
MessageModel.prototype.storeDataToDom = function ()
{
MessageModel.prototype.storeDataToDom = function ()
{
if (this.body)
{
this.body.data('rl-is-html', !!this.isHtml());
@ -1065,7 +1078,7 @@ MessageModel.prototype.storeDataToDom = function ()
this.body.data('rl-plain-raw', this.plainRaw);
if (RL.data().capaOpenPGP())
if (RL.data().capaOpenPGP()) // TODO cjs
{
this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned());
this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
@ -1073,19 +1086,19 @@ MessageModel.prototype.storeDataToDom = function ()
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
}
}
};
};
MessageModel.prototype.storePgpVerifyDataToDom = function ()
{
if (this.body && RL.data().capaOpenPGP())
MessageModel.prototype.storePgpVerifyDataToDom = function ()
{
if (this.body && RL.data().capaOpenPGP()) // TODO cjs
{
this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
}
};
};
MessageModel.prototype.fetchDataToDom = function ()
{
MessageModel.prototype.fetchDataToDom = function ()
{
if (this.body)
{
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'));
if (RL.data().capaOpenPGP())
if (RL.data().capaOpenPGP()) // TODO cjs
{
this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
@ -1108,17 +1121,17 @@ MessageModel.prototype.fetchDataToDom = function ()
this.pgpSignedVerifyUser('');
}
}
};
};
MessageModel.prototype.verifyPgpSignedClearMessage = function ()
{
MessageModel.prototype.verifyPgpSignedClearMessage = function ()
{
if (this.isPgpSigned())
{
var
aRes = [],
mPgpMessage = null,
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
aPublicKeys = RL.data().findPublicKeysByEmail(sFrom),
aPublicKeys = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs
oValidKey = null,
oValidSysKey = null,
sPlain = ''
@ -1144,7 +1157,7 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
if (oValidKey)
{
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
if (oValidSysKey)
{
sPlain = mPgpMessage.getText();
@ -1153,12 +1166,12 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
this.pgpSignedVerifyUser(oValidSysKey.user);
sPlain =
$proxyDiv.empty().append(
$div.empty().append(
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
).html()
;
$proxyDiv.empty();
$div.empty();
this.replacePlaneTextBody(sPlain);
}
@ -1170,10 +1183,10 @@ MessageModel.prototype.verifyPgpSignedClearMessage = function ()
this.storePgpVerifyDataToDom();
}
};
};
MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
{
MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
{
if (this.isPgpEncrypted())
{
var
@ -1181,8 +1194,8 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
mPgpMessage = null,
mPgpMessageDecrypted = null,
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
aPublicKey = RL.data().findPublicKeysByEmail(sFrom),
oPrivateKey = RL.data().findSelfPrivateKey(sPassword),
aPublicKey = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs
oPrivateKey = RL.data().findSelfPrivateKey(sPassword), // TODO cjs
oValidKey = null,
oValidSysKey = null,
sPlain = ''
@ -1215,7 +1228,7 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
if (oValidKey)
{
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex());
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs
if (oValidSysKey)
{
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);
@ -1227,12 +1240,12 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
sPlain = mPgpMessageDecrypted.getText();
sPlain =
$proxyDiv.empty().append(
$div.empty().append(
$('<pre class="b-plain-openpgp signed verified"></pre>').text(sPlain)
).html()
;
$proxyDiv.empty();
$div.empty();
this.replacePlaneTextBody(sPlain);
}
@ -1242,21 +1255,25 @@ MessageModel.prototype.decryptPgpEncryptedMessage = function (sPassword)
this.storePgpVerifyDataToDom();
}
};
};
MessageModel.prototype.replacePlaneTextBody = function (sPlain)
{
MessageModel.prototype.replacePlaneTextBody = function (sPlain)
{
if (this.body)
{
this.body.html(sPlain).addClass('b-text-part plain');
}
};
};
/**
/**
* @return {string}
*/
MessageModel.prototype.flagHash = function ()
{
MessageModel.prototype.flagHash = function ()
{
return [this.deleted(), this.unseen(), this.flagged(), this.answered(), this.forwarded(),
this.isReadReceipt()].join('');
};
};
module.exports = MessageModel;
}(module));

View file

@ -1,6 +1,14 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('./ko.js')
;
/**
* @param {string} iIndex
* @param {string} sGuID
* @param {string} sID
@ -10,8 +18,8 @@
* @param {string} sArmor
* @constructor
*/
function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor)
{
function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor)
{
this.index = iIndex;
this.id = sID;
this.guid = sGuID;
@ -21,12 +29,16 @@ function OpenPgpKeyModel(iIndex, sGuID, sID, sUserID, sEmail, bIsPrivate, sArmor
this.isPrivate = !!bIsPrivate;
this.deleteAccess = ko.observable(false);
}
}
OpenPgpKeyModel.prototype.index = 0;
OpenPgpKeyModel.prototype.id = '';
OpenPgpKeyModel.prototype.guid = '';
OpenPgpKeyModel.prototype.user = '';
OpenPgpKeyModel.prototype.email = '';
OpenPgpKeyModel.prototype.armor = '';
OpenPgpKeyModel.prototype.isPrivate = false;
OpenPgpKeyModel.prototype.index = 0;
OpenPgpKeyModel.prototype.id = '';
OpenPgpKeyModel.prototype.guid = '';
OpenPgpKeyModel.prototype.user = '';
OpenPgpKeyModel.prototype.email = '';
OpenPgpKeyModel.prototype.armor = '';
OpenPgpKeyModel.prototype.isPrivate = false;
module.exports = OpenPgpKeyModel;
}(module));

7
dev/RL.js Normal file
View 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
View 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);

View file

@ -1,24 +1,38 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
$ = require('./External/jquery.js'),
_ = require('./External/underscore.js'),
ko = require('./External/ko.js'),
Globals = require('./Common/Globals.js'),
Utils = require('./Common/Utils.js'),
kn = require('./Knoin/Knoin.js'),
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js')
;
/**
* @param {Array} aViewModels
* @constructor
* @extends KnoinAbstractScreen
*/
function AbstractSettings(aViewModels)
{
function AbstractSettings(aViewModels)
{
KnoinAbstractScreen.call(this, 'settings', aViewModels);
this.menu = ko.observableArray([]);
this.oCurrentSubScreen = 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
self = this,
oSettingsScreen = null,
@ -27,21 +41,21 @@ AbstractSettings.prototype.onRoute = function (sSubName)
oViewModelDom = null
;
RoutedSettingsViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
RoutedSettingsViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
return SettingsViewModel && SettingsViewModel.__rlSettingsData &&
sSubName === SettingsViewModel.__rlSettingsData.Route;
});
if (RoutedSettingsViewModel)
{
if (_.find(ViewModels['settings-removed'], function (DisabledSettingsViewModel) {
if (_.find(Globals.aViewModels['settings-removed'], function (DisabledSettingsViewModel) {
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
}))
{
RoutedSettingsViewModel = null;
}
if (RoutedSettingsViewModel && _.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
if (RoutedSettingsViewModel && _.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
return DisabledSettingsViewModel && DisabledSettingsViewModel === RoutedSettingsViewModel;
}))
{
@ -66,7 +80,7 @@ AbstractSettings.prototype.onRoute = function (sSubName)
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
oViewModelDom.appendTo(oViewModelPlace);
oSettingsScreen.data = RL.data();
oSettingsScreen.data = RL.data(); // TODO cjs
oSettingsScreen.viewModelDom = oViewModelDom;
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
@ -122,24 +136,24 @@ AbstractSettings.prototype.onRoute = function (sSubName)
}
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)
{
Utils.delegateRun(this.oCurrentSubScreen, 'onHide');
this.oCurrentSubScreen.viewModelDom.hide();
}
};
};
AbstractSettings.prototype.onBuild = function ()
{
_.each(ViewModels['settings'], function (SettingsViewModel) {
AbstractSettings.prototype.onBuild = function ()
{
_.each(Globals.aViewModels['settings'], function (SettingsViewModel) {
if (SettingsViewModel && SettingsViewModel.__rlSettingsData &&
!_.find(ViewModels['settings-removed'], function (RemoveSettingsViewModel) {
!_.find(Globals.aViewModels['settings-removed'], function (RemoveSettingsViewModel) {
return RemoveSettingsViewModel && RemoveSettingsViewModel === SettingsViewModel;
}))
{
@ -147,7 +161,7 @@ AbstractSettings.prototype.onBuild = function ()
'route': SettingsViewModel.__rlSettingsData.Route,
'label': SettingsViewModel.__rlSettingsData.Label,
'selected': ko.observable(false),
'disabled': !!_.find(ViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
'disabled': !!_.find(Globals.aViewModels['settings-disabled'], function (DisabledSettingsViewModel) {
return DisabledSettingsViewModel && DisabledSettingsViewModel === SettingsViewModel;
})
});
@ -155,12 +169,12 @@ AbstractSettings.prototype.onBuild = function ()
}, this);
this.oViewModelPlace = $('#rl-content #rl-settings-subscreen');
};
};
AbstractSettings.prototype.routes = function ()
{
AbstractSettings.prototype.routes = function ()
{
var
DefaultViewModel = _.find(ViewModels['settings'], function (SettingsViewModel) {
DefaultViewModel = _.find(Globals.aViewModels['settings'], function (SettingsViewModel) {
return SettingsViewModel && SettingsViewModel.__rlSettingsData && SettingsViewModel.__rlSettingsData['IsDefault'];
}),
sDefaultRoute = DefaultViewModel ? DefaultViewModel.__rlSettingsData['Route'] : 'general',
@ -178,4 +192,8 @@ AbstractSettings.prototype.routes = function ()
['{subname}', oRules],
['', oRules]
];
};
};
module.exports = AbstractSettings;
}(module));

View file

@ -1,17 +1,31 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
_ = require('./External/underscore.js'),
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
AdminLoginViewModel = require('./ViewModels/AdminLoginViewModel.js')
;
/**
* @constructor
* @extends KnoinAbstractScreen
*/
function AdminLoginScreen()
{
function AdminLoginScreen()
{
KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
}
}
_.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
_.extend(AdminLoginScreen.prototype, KnoinAbstractScreen.prototype);
AdminLoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
AdminLoginScreen.prototype.onShow = function ()
{
RL.setTitle(''); // TODO cjs
};
module.exports = AdminLoginScreen;
}(module));

View file

@ -1,20 +1,35 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
_ = require('./External/underscore.js'),
AbstractSettings = require('./Screens/AbstractSettings.js'),
AdminMenuViewModel = require('./ViewModels/AdminMenuViewModel.js'),
AdminPaneViewModel = require('./ViewModels/AdminPaneViewModel.js')
;
/**
* @constructor
* @extends AbstractSettings
*/
function AdminSettingsScreen()
{
function AdminSettingsScreen()
{
AbstractSettings.call(this, [
AdminMenuViewModel,
AdminPaneViewModel
]);
}
}
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
_.extend(AdminSettingsScreen.prototype, AbstractSettings.prototype);
AdminSettingsScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
AdminSettingsScreen.prototype.onShow = function ()
{
RL.setTitle(''); // TODO cjs
};
module.exports = AdminSettingsScreen;
}(module));

View file

@ -1,17 +1,31 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
_ = require('./External/underscore.js'),
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
LoginViewModel = require('./ViewModels/LoginViewModel.js')
;
/**
* @constructor
* @extends KnoinAbstractScreen
*/
function LoginScreen()
{
function LoginScreen()
{
KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
}
}
_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
_.extend(LoginScreen.prototype, KnoinAbstractScreen.prototype);
LoginScreen.prototype.onShow = function ()
{
RL.setTitle('');
};
LoginScreen.prototype.onShow = function ()
{
RL.setTitle(''); // TODO cjs
};
module.exports = LoginScreen;
}(module));

View file

@ -1,11 +1,27 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
_ = require('./External/underscore.js'),
$html = require('./External/$html.js'),
Enums = require('./Common/Enums.js'),
Utils = require('./Common/Utils.js'),
KnoinAbstractScreen = require('./Knoin/KnoinAbstractScreen.js'),
MailBoxSystemDropDownViewModel = require('./ViewModels/MailBoxSystemDropDownViewModel.js'),
MailBoxFolderListViewModel = require('./ViewModels/MailBoxFolderListViewModel.js'),
MailBoxMessageListViewModel = require('./ViewModels/MailBoxMessageListViewModel.js'),
MailBoxMessageViewViewModel = require('./ViewModels/MailBoxMessageViewViewModel.js')
;
/**
* @constructor
* @extends KnoinAbstractScreen
*/
function MailBoxScreen()
{
function MailBoxScreen()
{
KnoinAbstractScreen.call(this, 'mailbox', [
MailBoxSystemDropDownViewModel,
MailBoxFolderListViewModel,
@ -14,53 +30,53 @@ function MailBoxScreen()
]);
this.oLastRoute = {};
}
}
_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
_.extend(MailBoxScreen.prototype, KnoinAbstractScreen.prototype);
/**
/**
* @type {Object}
*/
MailBoxScreen.prototype.oLastRoute = {};
MailBoxScreen.prototype.oLastRoute = {};
MailBoxScreen.prototype.setNewTitle = function ()
{
MailBoxScreen.prototype.setNewTitle = function ()
{
var
sEmail = RL.data().accountEmail(),
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount()
sEmail = RL.data().accountEmail(), // TODO cjs
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount() // TODO cjs
;
// TODO cjs
RL.setTitle(('' === sEmail ? '' :
(0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
};
};
MailBoxScreen.prototype.onShow = function ()
{
MailBoxScreen.prototype.onShow = function ()
{
this.setNewTitle();
RL.data().keyScope(Enums.KeyState.MessageList);
};
RL.data().keyScope(Enums.KeyState.MessageList);// TODO cjs
};
/**
/**
* @param {string} sFolderHash
* @param {number} iPage
* @param {string} sSearch
* @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 (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())// TODO cjs
{
RL.historyBack();
RL.historyBack();// TODO cjs
}
}
else
{
var
oData = RL.data(),
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)
oData = RL.data(),// TODO cjs
sFolderFullNameRaw = RL.cache().getFolderFullNameRaw(sFolderHash),// TODO cjs
oFolder = RL.cache().getFolderFromCacheList(sFolderFullNameRaw)// TODO cjs
;
if (oFolder)
@ -76,38 +92,38 @@ MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPrevie
oData.message(null);
}
RL.reloadMessageList();
RL.reloadMessageList();// TODO cjs
}
}
};
};
MailBoxScreen.prototype.onStart = function ()
{
MailBoxScreen.prototype.onStart = function ()
{
var
oData = RL.data(),
oData = RL.data(),// TODO cjs
fResizeFunction = function () {
Utils.windowResize();
}
;
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))// TODO cjs
{
RL.accountsAndIdentities();
RL.accountsAndIdentities();// TODO cjs
}
_.delay(function () {
if ('INBOX' !== oData.currentFolderFullNameRaw())
{
RL.folderInformation('INBOX');
RL.folderInformation('INBOX');// TODO cjs
}
}, 1000);
_.delay(function () {
RL.quota();
RL.quota();// TODO cjs
}, 5000);
_.delay(function () {
RL.remote().appDelayStart(Utils.emptyFunction);
RL.remote().appDelayStart(Utils.emptyFunction);// TODO cjs
}, 35000);
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout());
@ -123,13 +139,13 @@ MailBoxScreen.prototype.onStart = function ()
oData.foldersInboxUnreadCount.subscribe(function () {
this.setNewTitle();
}, this);
};
};
/**
/**
* @return {Array}
*/
MailBoxScreen.prototype.routes = function ()
{
MailBoxScreen.prototype.routes = function ()
{
var
fNormP = function () {
return ['Inbox', 1, '', true];
@ -168,4 +184,8 @@ MailBoxScreen.prototype.routes = function ()
[/^message-preview$/, {'normalize_': fNormP}],
[/^([^\/]*)$/, {'normalize_': fNormS}]
];
};
};
module.exports = MailBoxScreen;
}(module));

View file

@ -1,11 +1,25 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
_ = require('./External/underscore.js'),
Enums = require('./Common/Enums.js'),
Utils = require('./Common/Utils.js'),
AbstractSettings = require('./Screens/AbstractSettings.js'),
SettingsSystemDropDownViewModel = require('./ViewModels/SettingsSystemDropDownViewModel.js'),
SettingsMenuViewModel = require('./ViewModels/SettingsMenuViewModel.js'),
SettingsPaneViewModel = require('./ViewModels/SettingsPaneViewModel.js')
;
/**
* @constructor
* @extends AbstractSettings
*/
function SettingsScreen()
{
function SettingsScreen()
{
AbstractSettings.call(this, [
SettingsSystemDropDownViewModel,
SettingsMenuViewModel,
@ -15,14 +29,18 @@ function SettingsScreen()
Utils.initOnStartOrLangChange(function () {
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
}, 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 ()
{
RL.setTitle(this.sSettingsTitle);
RL.data().keyScope(Enums.KeyState.Settings);
};
SettingsScreen.prototype.onShow = function ()
{
RL.setTitle(this.sSettingsTitle); // TODO cjs
RL.data().keyScope(Enums.KeyState.Settings); // TODO cjs
};
module.exports = SettingsScreen;
}(module));

View file

@ -68,7 +68,7 @@ SettingsGeneral.prototype.onBuild = function ()
'dataType': 'script',
'cache': true
}).done(function() {
Utils.i18nToDoc();
Utils.i18nReload();
self.languageTrigger(Enums.SaveSettingsStep.TrueResult);
}).fail(function() {
self.languageTrigger(Enums.SaveSettingsStep.FalseResult);

View file

@ -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
});
};

View 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));

View file

@ -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);
};

View 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));

View file

@ -1,10 +1,22 @@
/* 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
*/
function AbstractData()
{
function AbstractData()
{
this.leftPanelDisabled = ko.observable(false);
this.useKeyboardShortcuts = ko.observable(true);
@ -41,12 +53,12 @@ function AbstractData()
});
this.keyScopeReal.subscribe(function (sValue) {
// window.console.log(sValue);
// window.console.log(sValue);
key.setScope(sValue);
});
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) {
@ -62,12 +74,12 @@ function AbstractData()
}, this);
Utils.initDataConstructorBySettings(this);
}
}
AbstractData.prototype.populateDataOnStart = function()
{
AbstractData.prototype.populateDataOnStart = function()
{
var
mLayout = Utils.pInt(RL.settingsGet('Layout')),
mLayout = Utils.pInt(RL.settingsGet('Layout')), // TODO cjs
aLanguages = RL.settingsGet('Languages'),
aThemes = RL.settingsGet('Themes')
;
@ -131,4 +143,8 @@ AbstractData.prototype.populateDataOnStart = function()
this.dropboxApiKey(RL.settingsGet('DropboxApiKey'));
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed'));
};
};
module.exports = AbstractData;
}(module));

View file

@ -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');
};

View 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));

View file

@ -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);

View 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));

View file

@ -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);
};

View 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));

View file

@ -1,16 +1,22 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
_ = require('./External/underscore.js'),
CookieDriver = require('./Storages/LocalStorages/CookieDriver.js'),
LocalStorageDriver = require('./Storages/LocalStorages/LocalStorageDriver.js')
;
/**
* @constructor
*/
function LocalStorage()
{
function LocalStorage()
{
var
sStorages = [
LocalStorageDriver,
CookieDriver
],
NextStorageDriver = _.find(sStorages, function (NextStorageDriver) {
NextStorageDriver = _.find([LocalStorageDriver, CookieDriver], function (NextStorageDriver) {
return NextStorageDriver.supported();
})
;
@ -20,25 +26,29 @@ function LocalStorage()
NextStorageDriver = /** @type {?Function} */ NextStorageDriver;
this.oDriver = new NextStorageDriver();
}
}
}
LocalStorage.prototype.oDriver = null;
LocalStorage.prototype.oDriver = null;
/**
/**
* @param {number} iKey
* @param {*} mData
* @return {boolean}
*/
LocalStorage.prototype.set = function (iKey, mData)
{
LocalStorage.prototype.set = function (iKey, mData)
{
return this.oDriver ? this.oDriver.set('p' + iKey, mData) : false;
};
};
/**
/**
* @param {number} iKey
* @return {*}
*/
LocalStorage.prototype.get = function (iKey)
{
LocalStorage.prototype.get = function (iKey)
{
return this.oDriver ? this.oDriver.get('p' + iKey) : null;
};
};
module.exports = LocalStorage;
}(module));

View file

@ -1,25 +1,36 @@
/* 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
*/
function CookieDriver()
{
function CookieDriver()
{
}
}
CookieDriver.supported = function ()
{
CookieDriver.supported = function ()
{
return true;
};
};
/**
/**
* @param {string} sKey
* @param {*} mData
* @returns {boolean}
*/
CookieDriver.prototype.set = function (sKey, mData)
{
CookieDriver.prototype.set = function (sKey, mData)
{
var
mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
bResult = false,
@ -44,14 +55,14 @@ CookieDriver.prototype.set = function (sKey, mData)
catch (oException) {}
return bResult;
};
};
/**
/**
* @param {string} sKey
* @returns {*}
*/
CookieDriver.prototype.get = function (sKey)
{
CookieDriver.prototype.get = function (sKey)
{
var
mCokieValue = $.cookie(Consts.Values.ClientSideCookieIndexName),
mResult = null
@ -72,4 +83,8 @@ CookieDriver.prototype.get = function (sKey)
catch (oException) {}
return mResult;
};
};
module.exports = CookieDriver;
}(module));

View file

@ -1,24 +1,35 @@
/* 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
*/
function LocalStorageDriver()
{
}
function LocalStorageDriver()
{
}
LocalStorageDriver.supported = function ()
{
LocalStorageDriver.supported = function ()
{
return !!window.localStorage;
};
};
/**
/**
* @param {string} sKey
* @param {*} mData
* @returns {boolean}
*/
LocalStorageDriver.prototype.set = function (sKey, mData)
{
LocalStorageDriver.prototype.set = function (sKey, mData)
{
var
mCookieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
bResult = false,
@ -41,14 +52,14 @@ LocalStorageDriver.prototype.set = function (sKey, mData)
catch (oException) {}
return bResult;
};
};
/**
/**
* @param {string} sKey
* @returns {*}
*/
LocalStorageDriver.prototype.get = function (sKey)
{
LocalStorageDriver.prototype.get = function (sKey)
{
var
mCokieValue = window.localStorage[Consts.Values.ClientSideCookieIndexName] || null,
mResult = null
@ -69,4 +80,8 @@ LocalStorageDriver.prototype.get = function (sKey)
catch (oException) {}
return mResult;
};
};
module.exports = LocalStorageDriver;
}(module));

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -320,7 +320,7 @@ LoginViewModel.prototype.onBuild = function ()
'cache': true
}).done(function() {
self.bSendLanguage = true;
Utils.i18nToDoc();
Utils.i18nReload();
$.cookie('rllang', RL.data().language(), {'expires': 30});
}).always(function() {
self.langRequest(false);

View file

@ -1,11 +1,26 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
ko = require('../External/ko.js'),
key = require('../External/key.js'),
$html = require('../External/$html.js'),
Consts = require('../Common/Consts.js'),
Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
;
/**
* @constructor
* @extends KnoinAbstractViewModel
*/
function MailBoxMessageViewViewModel()
{
function MailBoxMessageViewViewModel()
{
KnoinAbstractViewModel.call(this, 'Right', 'MailMessageView');
var
@ -222,28 +237,28 @@ function MailBoxMessageViewViewModel()
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();
};
};
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifyVisible = function ()
{
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifyVisible = function ()
{
return Enums.SignedVerifyStatus.None !== this.viewPgpSignedVerifyStatus();
};
};
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifySuccess = function ()
{
MailBoxMessageViewViewModel.prototype.isPgpStatusVerifySuccess = function ()
{
return Enums.SignedVerifyStatus.Success === this.viewPgpSignedVerifyStatus();
};
};
MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
{
MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
{
var sResult = '';
switch (this.viewPgpSignedVerifyStatus())
{
@ -267,55 +282,55 @@ MailBoxMessageViewViewModel.prototype.pgpStatusVerifyMessage = function ()
}
return sResult;
};
};
MailBoxMessageViewViewModel.prototype.scrollToTop = function ()
{
MailBoxMessageViewViewModel.prototype.scrollToTop = function ()
{
var oCont = $('.messageItem.nano .content', this.viewModelDom);
if (oCont && oCont[0])
{
// oCont.animate({'scrollTop': 0}, 300);
// oCont.animate({'scrollTop': 0}, 300);
oCont.scrollTop(0);
}
else
{
// $('.messageItem', this.viewModelDom).animate({'scrollTop': 0}, 300);
// $('.messageItem', this.viewModelDom).animate({'scrollTop': 0}, 300);
$('.messageItem', this.viewModelDom).scrollTop(0);
}
Utils.windowResize();
};
};
MailBoxMessageViewViewModel.prototype.fullScreen = function ()
{
MailBoxMessageViewViewModel.prototype.fullScreen = function ()
{
this.fullScreenMode(true);
Utils.windowResize();
};
};
MailBoxMessageViewViewModel.prototype.unFullScreen = function ()
{
MailBoxMessageViewViewModel.prototype.unFullScreen = function ()
{
this.fullScreenMode(false);
Utils.windowResize();
};
};
MailBoxMessageViewViewModel.prototype.toggleFullScreen = function ()
{
MailBoxMessageViewViewModel.prototype.toggleFullScreen = function ()
{
Utils.removeSelection();
this.fullScreenMode(!this.fullScreenMode());
Utils.windowResize();
};
};
/**
/**
* @param {string} sType
*/
MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType)
{
MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType)
{
kn.showScreenPopup(PopupsComposeViewModel, [sType, RL.data().message()]);
};
};
MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
{
MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
{
var
self = this,
oData = RL.data()
@ -404,13 +419,13 @@ MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
this.oMessageScrollerDom = this.oMessageScrollerDom && this.oMessageScrollerDom[0] ? this.oMessageScrollerDom : null;
this.initShortcuts();
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
{
MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
{
if (this.viewModelVisibility() && this.message())
{
if (this.fullScreenMode())
@ -428,10 +443,10 @@ MailBoxMessageViewViewModel.prototype.escShortcuts = function ()
return false;
}
};
};
MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
{
MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
{
var
self = this,
oData = RL.data()
@ -455,10 +470,10 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
});
// TODO // more toggle
// key('', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
// self.moreDropdownTrigger(true);
// return false;
// });
// key('', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
// self.moreDropdownTrigger(true);
// return false;
// });
// reply
key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
@ -488,13 +503,13 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
});
// message information
// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
// if (oData.message())
// {
// self.showFullInfo(!self.showFullInfo());
// return false;
// }
// });
// key('i', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
// if (oData.message())
// {
// self.showFullInfo(!self.showFullInfo());
// return false;
// }
// });
// toggle message blockquotes
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
@ -551,133 +566,133 @@ MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
return false;
});
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
{
MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
{
return RL.data().message() && RL.data().draftFolder() === RL.data().message().folderFullNameRaw;
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
{
MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
{
return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw;
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
{
MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
{
return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw;
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
{
MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
{
return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue;
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
{
MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
{
return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw;
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
{
MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
{
return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue;
};
};
/**
/**
* @return {boolean}
*/
MailBoxMessageViewViewModel.prototype.isDraftOrSentFolder = function ()
{
MailBoxMessageViewViewModel.prototype.isDraftOrSentFolder = function ()
{
return this.isDraftFolder() || this.isSentFolder();
};
};
MailBoxMessageViewViewModel.prototype.composeClick = function ()
{
MailBoxMessageViewViewModel.prototype.composeClick = function ()
{
kn.showScreenPopup(PopupsComposeViewModel);
};
};
MailBoxMessageViewViewModel.prototype.editMessage = function ()
{
MailBoxMessageViewViewModel.prototype.editMessage = function ()
{
if (RL.data().message())
{
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, RL.data().message()]);
}
};
};
MailBoxMessageViewViewModel.prototype.scrollMessageToTop = function ()
{
MailBoxMessageViewViewModel.prototype.scrollMessageToTop = function ()
{
if (this.oMessageScrollerDom)
{
this.oMessageScrollerDom.scrollTop(0);
}
};
};
/**
/**
* @param {MessageModel} oMessage
*/
MailBoxMessageViewViewModel.prototype.showImages = function (oMessage)
{
MailBoxMessageViewViewModel.prototype.showImages = function (oMessage)
{
if (oMessage && oMessage.showExternalImages)
{
oMessage.showExternalImages(true);
}
};
};
/**
/**
* @returns {string}
*/
MailBoxMessageViewViewModel.prototype.printableCheckedMessageCount = function ()
{
MailBoxMessageViewViewModel.prototype.printableCheckedMessageCount = function ()
{
var iCnt = this.messageListCheckedOrSelectedUidsWithSubMails().length;
return 0 < iCnt ? (100 > iCnt ? iCnt : '99+') : '';
};
};
/**
/**
* @param {MessageModel} oMessage
*/
MailBoxMessageViewViewModel.prototype.verifyPgpSignedClearMessage = function (oMessage)
{
MailBoxMessageViewViewModel.prototype.verifyPgpSignedClearMessage = function (oMessage)
{
if (oMessage)
{
oMessage.verifyPgpSignedClearMessage();
}
};
};
/**
/**
* @param {MessageModel} oMessage
*/
MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMessage)
{
MailBoxMessageViewViewModel.prototype.decryptPgpEncryptedMessage = function (oMessage)
{
if (oMessage)
{
oMessage.decryptPgpEncryptedMessage(this.viewPgpPassword());
}
};
};
/**
/**
* @param {MessageModel} oMessage
*/
MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
{
MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
{
if (oMessage && '' !== oMessage.readReceipt())
{
RL.remote().sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
@ -690,4 +705,8 @@ MailBoxMessageViewViewModel.prototype.readReceipt = function (oMessage)
RL.cache().storeMessageFlagsToCache(oMessage);
RL.reloadFlagsCurrentMessageListAndMessageFromCache();
}
};
};
module.exports = MailBoxMessageViewViewModel;
}(module));

View file

@ -1,13 +1,27 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
;
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
*/
function MailBoxSystemDropDownViewModel()
{
function MailBoxSystemDropDownViewModel()
{
AbstractSystemDropDownViewModel.call(this);
Knoin.constructorEnd(this);
}
kn.constructorEnd(this);
}
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
Utils.extendAsViewModel('MailBoxSystemDropDownViewModel', MailBoxSystemDropDownViewModel, AbstractSystemDropDownViewModel);
module.exports = MailBoxSystemDropDownViewModel;
}(module));

View file

@ -1,30 +1,44 @@
/* 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
*
* @constructor
* @extends KnoinAbstractViewModel
*/
function SettingsMenuViewModel(oScreen)
{
function SettingsMenuViewModel(oScreen)
{
KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
this.leftPanelDisabled = RL.data().leftPanelDisabled;
this.leftPanelDisabled = RL.data().leftPanelDisabled; // TODO cjs
this.menu = oScreen.menu;
Knoin.constructorEnd(this);
}
kn.constructorEnd(this);
}
Utils.extendAsViewModel('SettingsMenuViewModel', SettingsMenuViewModel);
Utils.extendAsViewModel('SettingsMenuViewModel', SettingsMenuViewModel);
SettingsMenuViewModel.prototype.link = function (sRoute)
{
return RL.link().settings(sRoute);
};
SettingsMenuViewModel.prototype.link = function (sRoute)
{
return RL.link().settings(sRoute);// TODO cjs
};
SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
SettingsMenuViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox()); // TODO cjs
};
module.exports = SettingsMenuViewModel;
}(module));

View file

@ -1,32 +1,48 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
key = require('../External/key.js'),
Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
;
/**
* @constructor
* @extends KnoinAbstractViewModel
*/
function SettingsPaneViewModel()
{
function SettingsPaneViewModel()
{
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;
key('esc', Enums.KeyState.Settings, function () {
self.backToMailBoxClick();
});
};
};
SettingsPaneViewModel.prototype.onShow = function ()
{
RL.data().message(null);
};
SettingsPaneViewModel.prototype.onShow = function ()
{
RL.data().message(null); // TODO cjs
};
SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox());
};
SettingsPaneViewModel.prototype.backToMailBoxClick = function ()
{
kn.setHash(RL.link().inbox()); // TODO cjs
};
module.exports = SettingsPaneViewModel;
}(module));

View file

@ -1,13 +1,27 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
/**
(function (module) {
'use strict';
var
Utils = require('../Common/Utils.js'),
kn = require('./Knoin/Knoin.js'),
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
;
/**
* @constructor
* @extends AbstractSystemDropDownViewModel
*/
function SettingsSystemDropDownViewModel()
{
function SettingsSystemDropDownViewModel()
{
AbstractSystemDropDownViewModel.call(this);
Knoin.constructorEnd(this);
}
kn.constructorEnd(this);
}
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
Utils.extendAsViewModel('SettingsSystemDropDownViewModel', SettingsSystemDropDownViewModel, AbstractSystemDropDownViewModel);
module.exports = SettingsSystemDropDownViewModel;
}(module));

View file

@ -608,3 +608,18 @@ gulp.task('b', ['rainloop']);
gulp.task('b+', ['rainloop+']);
gulp.task('own', ['owncloud']);
var browserify = require('browserify');
var source = require('vinyl-source-stream');
gulp.task('bro', function() {
return browserify({
'basedir': './dev/',
'detectGlobals': false,
'debug': false
})
.add('./RainLoopBoot.js')
.bundle()
.pipe(source('bro.js'))
.pipe(gulp.dest(cfg.paths.staticJS));
});

View file

@ -46,6 +46,9 @@
"node-fs": "*",
"jshint-summary": "*",
"browserify": "*",
"vinyl-source-stream": "latest",
"gulp": "*",
"gulp-util": "*",
"gulp-uglify": "*",

File diff suppressed because it is too large Load diff