CommonJS (research/3)

This commit is contained in:
RainLoop Team 2014-08-22 19:08:56 +04:00
parent 586abbb802
commit 06bb124379
99 changed files with 51037 additions and 42961 deletions

View file

@ -6,7 +6,9 @@
var var
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
Data = require('../Storages/AdminDataStorage.js') AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'),
RL = require('../Boots/AdminApp.js')
; ;
/** /**
@ -14,8 +16,8 @@
*/ */
function AdminSettingsAbout() function AdminSettingsAbout()
{ {
this.version = ko.observable(RL.settingsGet('Version')); this.version = ko.observable(AppSettings.settingsGet('Version'));
this.access = ko.observable(!!RL.settingsGet('CoreAccess')); this.access = ko.observable(!!AppSettings.settingsGet('CoreAccess'));
this.errorDesc = ko.observable(''); this.errorDesc = ko.observable('');
this.coreReal = Data.coreReal; this.coreReal = Data.coreReal;
@ -64,8 +66,6 @@
}, this); }, this);
} }
kn.addSettingsViewModel(AdminSettingsAbout, 'AdminSettingsAbout', 'About', 'about');
AdminSettingsAbout.prototype.onBuild = function () AdminSettingsAbout.prototype.onBuild = function ()
{ {
if (this.access()) if (this.access())

View file

@ -7,9 +7,11 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
AppSettings = require('..Storages/AppSettings.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js') Remote = require('../Storages/AdminAjaxRemoteStorage.js')
; ;
@ -18,24 +20,22 @@
*/ */
function AdminSettingsBranding() function AdminSettingsBranding()
{ {
this.title = ko.observable(RL.settingsGet('Title')); this.title = ko.observable(AppSettings.settingsGet('Title'));
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle); this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.loadingDesc = ko.observable(RL.settingsGet('LoadingDescription')); this.loadingDesc = ko.observable(AppSettings.settingsGet('LoadingDescription'));
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle); this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.loginLogo = ko.observable(RL.settingsGet('LoginLogo')); this.loginLogo = ko.observable(AppSettings.settingsGet('LoginLogo'));
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle); this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.loginDescription = ko.observable(RL.settingsGet('LoginDescription')); this.loginDescription = ko.observable(AppSettings.settingsGet('LoginDescription'));
this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle); this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.loginCss = ko.observable(RL.settingsGet('LoginCss')); this.loginCss = ko.observable(AppSettings.settingsGet('LoginCss'));
this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle); this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
} }
kn.addSettingsViewModel(AdminSettingsBranding, 'AdminSettingsBranding', 'Branding', 'branding');
AdminSettingsBranding.prototype.onBuild = function () AdminSettingsBranding.prototype.onBuild = function ()
{ {
var self = this; var self = this;

View file

@ -7,8 +7,11 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
AppSettings = require('../Storages/AppSettings.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js') Remote = require('../Storages/AdminAjaxRemoteStorage.js')
; ;
@ -18,9 +21,9 @@
function AdminSettingsContacts() function AdminSettingsContacts()
{ {
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender; this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
this.enableContacts = ko.observable(!!RL.settingsGet('ContactsEnable')); this.enableContacts = ko.observable(!!AppSettings.settingsGet('ContactsEnable'));
this.contactsSharing = ko.observable(!!RL.settingsGet('ContactsSharing')); this.contactsSharing = ko.observable(!!AppSettings.settingsGet('ContactsSharing'));
this.contactsSync = ko.observable(!!RL.settingsGet('ContactsSync')); this.contactsSync = ko.observable(!!AppSettings.settingsGet('ContactsSync'));
var var
aTypes = ['sqlite', 'mysql', 'pgsql'], aTypes = ['sqlite', 'mysql', 'pgsql'],
@ -43,15 +46,15 @@
} }
; ;
if (!!RL.settingsGet('SQLiteIsSupported')) if (!!AppSettings.settingsGet('SQLiteIsSupported'))
{ {
aSupportedTypes.push('sqlite'); aSupportedTypes.push('sqlite');
} }
if (!!RL.settingsGet('MySqlIsSupported')) if (!!AppSettings.settingsGet('MySqlIsSupported'))
{ {
aSupportedTypes.push('mysql'); aSupportedTypes.push('mysql');
} }
if (!!RL.settingsGet('PostgreSqlIsSupported')) if (!!AppSettings.settingsGet('PostgreSqlIsSupported'))
{ {
aSupportedTypes.push('pgsql'); aSupportedTypes.push('pgsql');
} }
@ -99,9 +102,9 @@
this.testContactsErrorMessage(''); this.testContactsErrorMessage('');
}, this); }, this);
this.pdoDsn = ko.observable(RL.settingsGet('ContactsPdoDsn')); this.pdoDsn = ko.observable(AppSettings.settingsGet('ContactsPdoDsn'));
this.pdoUser = ko.observable(RL.settingsGet('ContactsPdoUser')); this.pdoUser = ko.observable(AppSettings.settingsGet('ContactsPdoUser'));
this.pdoPassword = ko.observable(RL.settingsGet('ContactsPdoPassword')); this.pdoPassword = ko.observable(AppSettings.settingsGet('ContactsPdoPassword'));
this.pdoDsnTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.pdoDsnTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.pdoUserTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.pdoUserTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
@ -131,13 +134,11 @@
return '' !== this.pdoDsn() && '' !== this.pdoUser(); return '' !== this.pdoDsn() && '' !== this.pdoUser();
}); });
this.contactsType(RL.settingsGet('ContactsPdoType')); this.contactsType(AppSettings.settingsGet('ContactsPdoType'));
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this); this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
} }
kn.addSettingsViewModel(AdminSettingsContacts, 'AdminSettingsContacts', 'Contacts', 'contacts');
AdminSettingsContacts.prototype.onTestContactsResponse = function (sResult, oData) AdminSettingsContacts.prototype.onTestContactsResponse = function (sResult, oData)
{ {
this.testContactsSuccess(false); this.testContactsSuccess(false);
@ -225,7 +226,7 @@
}); });
}); });
self.contactsType(RL.settingsGet('ContactsPdoType')); self.contactsType(AppSettings.settingsGet('ContactsPdoType'));
}, 50); }, 50);
}; };

View file

@ -11,6 +11,8 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
RL = require('../Boots/AdminApp.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js') Remote = require('../Storages/AdminAjaxRemoteStorage.js')
; ;
@ -45,8 +47,6 @@
]}); ]});
} }
kn.addSettingsViewModel(AdminSettingsDomains, 'AdminSettingsDomains', 'Domains', 'domains');
AdminSettingsDomains.prototype.startDomainForDeletionTimeout = function () AdminSettingsDomains.prototype.startDomainForDeletionTimeout = function ()
{ {
var self = this; var self = this;

View file

@ -14,6 +14,7 @@
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js'), Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
@ -37,8 +38,8 @@
this.capaAdditionalAccounts = Data.capaAdditionalAccounts; this.capaAdditionalAccounts = Data.capaAdditionalAccounts;
this.capaAdditionalIdentities = Data.capaAdditionalIdentities; this.capaAdditionalIdentities = Data.capaAdditionalIdentities;
this.mainAttachmentLimit = ko.observable(Utils.pInt(RL.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25}); this.mainAttachmentLimit = ko.observable(Utils.pInt(AppSettings.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25});
this.uploadData = RL.settingsGet('PhpUploadSizes'); this.uploadData = AppSettings.settingsGet('PhpUploadSizes');
this.uploadDataDesc = this.uploadData && (this.uploadData['upload_max_filesize'] || this.uploadData['post_max_size']) ? this.uploadDataDesc = this.uploadData && (this.uploadData['upload_max_filesize'] || this.uploadData['post_max_size']) ?
[ [
this.uploadData['upload_max_filesize'] ? 'upload_max_filesize = ' + this.uploadData['upload_max_filesize'] + '; ' : '', this.uploadData['upload_max_filesize'] ? 'upload_max_filesize = ' + this.uploadData['upload_max_filesize'] + '; ' : '',
@ -59,15 +60,13 @@
return Utils.convertLangName(this.mainLanguage()); return Utils.convertLangName(this.mainLanguage());
}, this); }, this);
this.weakPassword = !!RL.settingsGet('WeakPassword'); this.weakPassword = !!AppSettings.settingsGet('WeakPassword');
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
} }
kn.addSettingsViewModel(AdminSettingsGeneral, 'AdminSettingsGeneral', 'General', 'general', true);
AdminSettingsGeneral.prototype.onBuild = function () AdminSettingsGeneral.prototype.onBuild = function ()
{ {
var self = this; var self = this;

View file

@ -8,8 +8,11 @@
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
moment = require('../External/moment.js'), moment = require('../External/moment.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
RL = require('../Boots/AdminApp.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
PopupsActivateViewModel = require('../ViewModels/Popups/PopupsActivateViewModel.js') PopupsActivateViewModel = require('../ViewModels/Popups/PopupsActivateViewModel.js')
; ;
@ -27,7 +30,7 @@
this.licenseTrigger = Data.licenseTrigger; this.licenseTrigger = Data.licenseTrigger;
this.adminDomain = ko.observable(''); this.adminDomain = ko.observable('');
this.subscriptionEnabled = ko.observable(!!RL.settingsGet('SubscriptionEnabled')); this.subscriptionEnabled = ko.observable(!!AppSettings.settingsGet('SubscriptionEnabled'));
this.licenseTrigger.subscribe(function () { this.licenseTrigger.subscribe(function () {
if (this.subscriptionEnabled()) if (this.subscriptionEnabled())
@ -37,8 +40,6 @@
}, this); }, this);
} }
kn.addSettingsViewModel(AdminSettingsLicensing, 'AdminSettingsLicensing', 'Licensing', 'licensing');
AdminSettingsLicensing.prototype.onBuild = function () AdminSettingsLicensing.prototype.onBuild = function ()
{ {
if (this.subscriptionEnabled()) if (this.subscriptionEnabled())
@ -49,7 +50,7 @@
AdminSettingsLicensing.prototype.onShow = function () AdminSettingsLicensing.prototype.onShow = function ()
{ {
this.adminDomain(RL.settingsGet('AdminDomain')); this.adminDomain(AppSettings.settingsGet('AdminDomain'));
}; };
AdminSettingsLicensing.prototype.showActivationForm = function () AdminSettingsLicensing.prototype.showActivationForm = function ()

View file

@ -10,6 +10,7 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js') Remote = require('../Storages/AdminAjaxRemoteStorage.js')
; ;
@ -22,14 +23,12 @@
this.determineUserLanguage = Data.determineUserLanguage; this.determineUserLanguage = Data.determineUserLanguage;
this.determineUserDomain = Data.determineUserDomain; this.determineUserDomain = Data.determineUserDomain;
this.defaultDomain = ko.observable(RL.settingsGet('LoginDefaultDomain')); this.defaultDomain = ko.observable(AppSettings.settingsGet('LoginDefaultDomain'));
this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin; this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
} }
kn.addSettingsViewModel(AdminSettingsLogin, 'AdminSettingsLogin', 'Login', 'login');
AdminSettingsLogin.prototype.onBuild = function () AdminSettingsLogin.prototype.onBuild = function ()
{ {
var self = this; var self = this;

View file

@ -11,6 +11,8 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
RL = require('../Boots/AdminApp.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js') Remote = require('../Storages/AdminAjaxRemoteStorage.js')
; ;
@ -44,8 +46,6 @@
}, this); }, this);
} }
kn.addSettingsViewModel(AdminSettingsPackages, 'AdminSettingsPackages', 'Packages', 'packages');
AdminSettingsPackages.prototype.onShow = function () AdminSettingsPackages.prototype.onShow = function ()
{ {
this.packagesError(''); this.packagesError('');

View file

@ -11,9 +11,12 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js'), Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
RL = require('../Boots/AdminApp.js'),
PopupsPluginViewModel = require('../ViewModels/Popups/PopupsPluginViewModel.js') PopupsPluginViewModel = require('../ViewModels/Popups/PopupsPluginViewModel.js')
; ;
@ -22,7 +25,7 @@
*/ */
function AdminSettingsPlugins() function AdminSettingsPlugins()
{ {
this.enabledPlugins = ko.observable(!!RL.settingsGet('EnabledPlugins')); this.enabledPlugins = ko.observable(!!AppSettings.settingsGet('EnabledPlugins'));
this.pluginsError = ko.observable(''); this.pluginsError = ko.observable('');
@ -37,8 +40,6 @@
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this); this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
} }
kn.addSettingsViewModel(AdminSettingsPlugins, 'AdminSettingsPlugins', 'Plugins', 'plugins');
AdminSettingsPlugins.prototype.disablePlugin = function (oPlugin) AdminSettingsPlugins.prototype.disablePlugin = function (oPlugin)
{ {
oPlugin.disabled(!oPlugin.disabled()); oPlugin.disabled(!oPlugin.disabled());

View file

@ -12,6 +12,7 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js') Remote = require('../Storages/AdminAjaxRemoteStorage.js')
; ;
@ -23,10 +24,10 @@
{ {
this.useLocalProxyForExternalImages = Data.useLocalProxyForExternalImages; this.useLocalProxyForExternalImages = Data.useLocalProxyForExternalImages;
this.capaOpenPGP = ko.observable(RL.capa(Enums.Capa.OpenPGP)); this.capaOpenPGP = ko.observable(AppSettings.capa(Enums.Capa.OpenPGP));
this.capaTwoFactorAuth = ko.observable(RL.capa(Enums.Capa.TwoFactor)); this.capaTwoFactorAuth = ko.observable(AppSettings.capa(Enums.Capa.TwoFactor));
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin')); this.adminLogin = ko.observable(AppSettings.settingsGet('AdminLogin'));
this.adminPassword = ko.observable(''); this.adminPassword = ko.observable('');
this.adminPasswordNew = ko.observable(''); this.adminPasswordNew = ko.observable('');
this.adminPasswordNew2 = ko.observable(''); this.adminPasswordNew2 = ko.observable('');
@ -75,8 +76,6 @@
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this); this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
} }
kn.addSettingsViewModel(AdminSettingsSecurity, 'AdminSettingsSecurity', 'Security', 'security');
AdminSettingsSecurity.prototype.onNewAdminPasswordResponse = function (sResult, oData) AdminSettingsSecurity.prototype.onNewAdminPasswordResponse = function (sResult, oData)
{ {
if (Enums.StorageResultType.Success === sResult && oData && oData.Result) if (Enums.StorageResultType.Success === sResult && oData && oData.Result)

View file

@ -46,8 +46,6 @@
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle); this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
} }
kn.addSettingsViewModel(AdminSettingsSocial, 'AdminSettingsSocial', 'Social', 'social');
AdminSettingsSocial.prototype.onBuild = function () AdminSettingsSocial.prototype.onBuild = function ()
{ {
var self = this; var self = this;

View file

@ -1,11 +0,0 @@
/* 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'),
Remote = require('./Storages/AdminAjaxRemoteStorage.js')
;
kn.bootstart(RL, Remote);

View file

@ -7,46 +7,33 @@
var var
$ = require('../External/jquery.js'), $ = require('../External/jquery.js'),
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
ko = require('../External/ko.js'),
window = require('../External/window.js'), window = require('../External/window.js'),
$html = require('../External/$html.js'), $html = require('../External/$html.js'),
$window = require('../External/$window.js'), $window = require('../External/$window.js'),
$doc = require('../External/$doc.js'), $doc = require('../External/$doc.js'),
AppData = require('../External/AppData.js'),
Globals = require('../Common/Globals.js'), Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
Plugins = require('../Common/Plugins.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
Events = require('../Common/Events.js'),
Remote = require('../Remote.js'), AppSettings = require('../Storages/AppSettings.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractBoot = require('../Knoin/KnoinAbstractBoot.js') KnoinAbstractBoot = require('../Knoin/KnoinAbstractBoot.js')
; ;
/** /**
* @param {*} Remote
* @constructor * @constructor
* @extends KnoinAbstractBoot * @extends KnoinAbstractBoot
*/ */
function AbstractApp() function AbstractApp(Remote)
{ {
KnoinAbstractBoot.call(this); KnoinAbstractBoot.call(this);
this.oSettings = null;
this.oPlugins = null;
this.oLocal = null;
this.oLink = null;
this.oSubs = {};
this.isLocalAutocomplete = true; this.isLocalAutocomplete = true;
this.popupVisibilityNames = ko.observableArray([]);
this.popupVisibility = ko.computed(function () {
return 0 < this.popupVisibilityNames().length;
}, this);
this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body'); this.iframe = $('<iframe style="display:none" src="javascript:;" />').appendTo('body');
$window.on('error', function (oEvent) { $window.on('error', function (oEvent) {
@ -55,7 +42,7 @@
'Script error.', 'Uncaught Error: Error calling method on NPObject.' 'Script error.', 'Uncaught Error: Error calling method on NPObject.'
])) ]))
{ {
Remote().jsError( Remote.jsError(
Utils.emptyFunction, Utils.emptyFunction,
oEvent.originalEvent.message, oEvent.originalEvent.message,
oEvent.originalEvent.filename, oEvent.originalEvent.filename,
@ -82,11 +69,20 @@
_.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype); _.extend(AbstractApp.prototype, KnoinAbstractBoot.prototype);
AbstractApp.prototype.oSettings = null; AbstractApp.prototype.remote = function ()
AbstractApp.prototype.oPlugins = null; {
AbstractApp.prototype.oLocal = null; return null;
AbstractApp.prototype.oLink = null; };
AbstractApp.prototype.oSubs = {};
AbstractApp.prototype.data = function ()
{
return null;
};
AbstractApp.prototype.setupSettings = function ()
{
return true;
};
/** /**
* @param {string} sLink * @param {string} sLink
@ -131,38 +127,10 @@
return true; return true;
}; };
/**
* @param {string} sName
* @return {?}
*/
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)
{
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 + ' - ' : '') + sTitle = ((Utils.isNormal(sTitle) && 0 < sTitle.length) ? sTitle + ' - ' : '') +
this.settingsGet('Title') || ''; AppSettings.settingsGet('Title') || '';
window.document.title = '_'; window.document.title = '_';
window.document.title = sTitle; window.document.title = sTitle;
@ -175,8 +143,8 @@
AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose) AbstractApp.prototype.loginAndLogoutReload = function (bLogout, bClose)
{ {
var var
sCustomLogoutLink = Utils.pString(this.settingsGet('CustomLogoutLink')), sCustomLogoutLink = Utils.pString(AppSettings.settingsGet('CustomLogoutLink')),
bInIframe = !!this.settingsGet('InIframe') bInIframe = !!AppSettings.settingsGet('InIframe')
; ;
bLogout = Utils.isUnd(bLogout) ? false : !!bLogout; bLogout = Utils.isUnd(bLogout) ? false : !!bLogout;
@ -233,61 +201,11 @@
fCallback([], sQuery); fCallback([], sQuery);
}; };
/**
* @param {string} sName
* @param {Function} fFunc
* @param {Object=} oContext
* @return {AbstractApp}
*/
AbstractApp.prototype.sub = function (sName, fFunc, oContext)
{
if (Utils.isUnd(this.oSubs[sName]))
{
this.oSubs[sName] = [];
}
this.oSubs[sName].push([fFunc, oContext]);
return this;
};
/**
* @param {string} sName
* @param {Array=} aArgs
* @return {AbstractApp}
*/
AbstractApp.prototype.pub = function (sName, aArgs)
{
Plugins.runHook('rl-pub', [sName, aArgs]);
if (!Utils.isUnd(this.oSubs[sName]))
{
_.each(this.oSubs[sName], function (aItem) {
if (aItem[0])
{
aItem[0].apply(aItem[1] || null, aArgs || []);
}
});
}
return this;
};
/**
* @param {string} sName
* @return {boolean}
*/
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 () AbstractApp.prototype.bootstart = function ()
{ {
var Events.pub('rl.bootstart');
self = this,
ssm = require('../External/ssm.js') var ssm = require('../External/ssm.js');
;
Utils.initOnStartOrLangChange(function () { Utils.initOnStartOrLangChange(function () {
Utils.initNotificationLanguage(); Utils.initNotificationLanguage();
@ -302,11 +220,11 @@
'maxWidth': 767, 'maxWidth': 767,
'onEnter': function() { 'onEnter': function() {
$html.addClass('ssm-state-mobile'); $html.addClass('ssm-state-mobile');
self.pub('ssm.mobile-enter'); Events.pub('ssm.mobile-enter');
}, },
'onLeave': function() { 'onLeave': function() {
$html.removeClass('ssm-state-mobile'); $html.removeClass('ssm-state-mobile');
self.pub('ssm.mobile-leave'); Events.pub('ssm.mobile-leave');
} }
}); });
@ -345,15 +263,15 @@
} }
}); });
this.sub('ssm.mobile-enter', function () { Events.sub('ssm.mobile-enter', function () {
RL.data().leftPanelDisabled(true); // TODO cjs Globals.leftPanelDisabled(true);
}); });
this.sub('ssm.mobile-leave', function () { Events.sub('ssm.mobile-leave', function () {
RL.data().leftPanelDisabled(false); // TODO cjs Globals.leftPanelDisabled(false);
}); });
RL.data().leftPanelDisabled.subscribe(function (bValue) { // TODO cjs Globals.leftPanelDisabled.subscribe(function (bValue) {
$html.toggleClass('rl-left-panel-disabled', bValue); $html.toggleClass('rl-left-panel-disabled', bValue);
}); });

View file

@ -15,9 +15,13 @@
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'), Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js'), Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
AdminSettingsScreen = require('../Screens/AdminSettingsScreen.js'),
AdminLoginScreen = require('../Screens/AdminLoginScreen.js'),
AbstractApp = require('./AbstractApp.js') AbstractApp = require('./AbstractApp.js')
; ;
@ -27,49 +31,80 @@
*/ */
function AdminApp() function AdminApp()
{ {
AbstractApp.call(this); AbstractApp.call(this, Remote);
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;
/**
* @return {AdminDataStorage}
*/
AdminApp.prototype.data = function ()
{
if (null === this.oData)
{
this.oData = new AdminDataStorage(); // TODO cjs
}
return this.oData;
};
/**
* @return {AdminAjaxRemoteStorage}
*/
AdminApp.prototype.remote = function () AdminApp.prototype.remote = function ()
{ {
if (null === this.oRemote) return Remote;
};
AdminApp.prototype.data = function ()
{ {
this.oRemote = new AdminAjaxRemoteStorage(); // TODO cjs return Data;
};
AdminApp.prototype.setupSettings = function ()
{
var
AdminSettingsGeneral = require('../Admin/AdminSettingsGeneral.js'),
AdminSettingsLogin = require('../Admin/AdminSettingsLogin.js'),
AdminSettingsBranding = require('../Admin/AdminSettingsBranding.js'),
AdminSettingsContacts = require('../Admin/AdminSettingsContacts.js'),
AdminSettingsDomains = require('../Admin/AdminSettingsDomains.js'),
AdminSettingsSecurity = require('../Admin/AdminSettingsSecurity.js'),
AdminSettingsSocial = require('../Admin/AdminSettingsSocial.js'),
AdminSettingsPlugins = require('../Admin/AdminSettingsPlugins.js'),
AdminSettingsPackages = require('../Admin/AdminSettingsPackages.js'),
AdminSettingsLicensing = require('../Admin/AdminSettingsLicensing.js'),
AdminSettingsAbout = require('../Admin/AdminSettingsAbout.js')
;
kn.addSettingsViewModel(AdminSettingsGeneral,
'AdminSettingsGeneral', 'General', 'general', true);
kn.addSettingsViewModel(AdminSettingsLogin,
'AdminSettingsLogin', 'Login', 'login');
if (AppSettings.capa(Enums.Capa.Prem))
{
kn.addSettingsViewModel(AdminSettingsBranding,
'AdminSettingsBranding', 'Branding', 'branding');
} }
return this.oRemote; kn.addSettingsViewModel(AdminSettingsContacts,
'AdminSettingsContacts', 'Contacts', 'contacts');
kn.addSettingsViewModel(AdminSettingsDomains,
'AdminSettingsDomains', 'Domains', 'domains');
kn.addSettingsViewModel(AdminSettingsSecurity,
'AdminSettingsSecurity', 'Security', 'security');
kn.addSettingsViewModel(AdminSettingsSocial,
'AdminSettingsSocial', 'Social', 'social');
kn.addSettingsViewModel(AdminSettingsPlugins,
'AdminSettingsPlugins', 'Plugins', 'plugins');
kn.addSettingsViewModel(AdminSettingsPackages,
'AdminSettingsPackages', 'Packages', 'packages');
kn.addSettingsViewModel(AdminSettingsLicensing,
'AdminSettingsLicensing', 'Licensing', 'licensing');
kn.addSettingsViewModel(AdminSettingsAbout,
'AdminSettingsAbout', 'About', 'about');
return true;
}; };
AdminApp.prototype.reloadDomainList = function () AdminApp.prototype.reloadDomainList = function ()
{ {
// TODO cjs
Data.domainsLoading(true); Data.domainsLoading(true);
Remote.domainList(function (sResult, oData) { Remote.domainList(function (sResult, oData) {
Data.domainsLoading(false); Data.domainsLoading(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result) if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
@ -89,10 +124,11 @@
AdminApp.prototype.reloadPluginList = function () AdminApp.prototype.reloadPluginList = function ()
{ {
// TODO cjs
Data.pluginsLoading(true); Data.pluginsLoading(true);
Remote.pluginList(function (sResult, oData) { Remote.pluginList(function (sResult, oData) {
Data.pluginsLoading(false); Data.pluginsLoading(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result) if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{ {
var aList = _.map(oData.Result, function (oItem) { var aList = _.map(oData.Result, function (oItem) {
@ -110,7 +146,6 @@
AdminApp.prototype.reloadPackagesList = function () AdminApp.prototype.reloadPackagesList = function ()
{ {
// TODO cjs
Data.packagesLoading(true); Data.packagesLoading(true);
Data.packagesReal(true); Data.packagesReal(true);
@ -215,7 +250,6 @@
{ {
bForce = Utils.isUnd(bForce) ? false : !!bForce; bForce = Utils.isUnd(bForce) ? false : !!bForce;
// TODO cjs
Data.licensingProcess(true); Data.licensingProcess(true);
Data.licenseError(''); Data.licenseError('');
@ -263,7 +297,7 @@
kn.hideLoading(); kn.hideLoading();
if (!RL.settingsGet('AllowAdminPanel')) if (!AppSettings.settingsGet('AllowAdminPanel'))
{ {
kn.routeOff(); kn.routeOff();
kn.setHash(LinkBuilder.root(), true); kn.setHash(LinkBuilder.root(), true);
@ -275,21 +309,8 @@
} }
else else
{ {
// kn.removeSettingsViewModel(AdminAbout); if (!!AppSettings.settingsGet('Auth'))
if (!RL.capa(Enums.Capa.Prem))
{ {
kn.removeSettingsViewModel(AdminBranding);
}
if (!!RL.settingsGet('Auth'))
{
// TODO
// if (!RL.settingsGet('AllowPackages') && AdminPackages)
// {
// kn.disableSettingsViewModel(AdminPackages);
// }
kn.startScreens([AdminSettingsScreen]); kn.startScreens([AdminSettingsScreen]);
} }
else else

77
dev/Boots/Boot.js Normal file
View file

@ -0,0 +1,77 @@
/* 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'),
$window = require('../External/$window.js'),
$html = require('../External/$html.js'),
Globals = require('../Common/Globals.js'),
Plugins = require('../Common/Plugins.js'),
Utils = require('../Common/Utils.js')
;
module.exports = function (RL) {
Globals.__RL = RL;
RL.setupSettings();
Plugins.__boot = RL;
Plugins.__remote = RL.remote();
Plugins.__data = RL.data();
$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']['createCommand'] = Utils.createCommand;
window['rl']['EmailModel'] = require('../Models/EmailModel.js');
window['rl']['Enums'] = require('../Common/Enums.js');
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);
}
window['__RLBOOT'] = null;
});
};
};
}(module));

File diff suppressed because it is too large Load diff

66
dev/Common/Events.js Normal file
View file

@ -0,0 +1,66 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (module) {
'use strict';
var
_ = require('../External/underscore.js'),
Utils = require('./Utils.js'),
Plugins = require('./Plugins.js')
;
/**
* @constructor
*/
function Events()
{
this.oSubs = {};
}
Events.prototype.oSubs = {};
/**
* @param {string} sName
* @param {Function} fFunc
* @param {Object=} oContext
* @return {Events}
*/
Events.prototype.sub = function (sName, fFunc, oContext)
{
if (Utils.isUnd(this.oSubs[sName]))
{
this.oSubs[sName] = [];
}
this.oSubs[sName].push([fFunc, oContext]);
return this;
};
/**
* @param {string} sName
* @param {Array=} aArgs
* @return {Events}
*/
Events.prototype.pub = function (sName, aArgs)
{
Plugins.runHook('rl-pub', [sName, aArgs]);
if (!Utils.isUnd(this.oSubs[sName]))
{
_.each(this.oSubs[sName], function (aItem) {
if (aItem[0])
{
aItem[0].apply(aItem[1] || null, aArgs || []);
}
});
}
return this;
};
module.exports = new Events();
}(module));

View file

@ -8,7 +8,10 @@
Globals = {}, Globals = {},
window = require('../External/window.js'), window = require('../External/window.js'),
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
$html = require('../External/$html.js') key = require('../External/key.js'),
$html = require('../External/$html.js'),
Enums = require('../Common/Enums.js')
; ;
/** /**
@ -36,6 +39,11 @@
*/ */
Globals.langChangeTrigger = ko.observable(true); Globals.langChangeTrigger = ko.observable(true);
/**
* @type {boolean}
*/
Globals.useKeyboardShortcuts = ko.observable(true);
/** /**
* @type {number} * @type {number}
*/ */
@ -101,6 +109,11 @@
*/ */
Globals.sAnimationType = ''; Globals.sAnimationType = '';
/**
* @type {*}
*/
Globals.__RL = null;
/** /**
* @type {Object} * @type {Object}
*/ */
@ -167,11 +180,11 @@
}); });
} }
Globals.oI18N = {}, Globals.oI18N = window['rainloopI18N'] || {};
Globals.oNotificationI18N = {}, Globals.oNotificationI18N = {};
Globals.aBootstrapDropdowns = [], Globals.aBootstrapDropdowns = [];
Globals.aViewModels = { Globals.aViewModels = {
'settings': [], 'settings': [],
@ -179,6 +192,85 @@
'settings-disabled': [] 'settings-disabled': []
}; };
Globals.leftPanelDisabled = ko.observable(false);
// popups
Globals.popupVisibilityNames = ko.observableArray([]);
Globals.popupVisibility = ko.computed(function () {
return 0 < Globals.popupVisibilityNames().length;
}, this);
// keys
Globals.keyScopeReal = ko.observable(Enums.KeyState.All);
Globals.keyScopeFake = ko.observable(Enums.KeyState.All);
Globals.keyScope = ko.computed({
'owner': this,
'read': function () {
return Globals.keyScopeFake();
},
'write': function (sValue) {
if (Enums.KeyState.Menu !== sValue)
{
if (Enums.KeyState.Compose === sValue)
{
// disableKeyFilter
key.filter = function () {
return Globals.useKeyboardShortcuts();
};
}
else
{
// restoreKeyFilter
key.filter = function (event) {
if (Globals.useKeyboardShortcuts())
{
var
oElement = event.target || event.srcElement,
sTagName = oElement ? oElement.tagName : ''
;
sTagName = sTagName.toUpperCase();
return !(sTagName === 'INPUT' || sTagName === 'SELECT' || sTagName === 'TEXTAREA' ||
(oElement && sTagName === 'DIV' && 'editorHtmlArea' === oElement.className && oElement.contentEditable)
);
}
return false;
};
}
Globals.keyScopeFake(sValue);
if (Globals.dropdownVisibility())
{
sValue = Enums.KeyState.Menu;
}
}
Globals.keyScopeReal(sValue);
}
});
Globals.keyScopeReal.subscribe(function (sValue) {
// window.console.log(sValue);
key.setScope(sValue);
});
Globals.dropdownVisibility.subscribe(function (bValue) {
if (bValue)
{
Globals.tooltipTrigger(!Globals.tooltipTrigger());
Globals.keyScope(Enums.KeyState.Menu);
}
else if (Enums.KeyState.Menu === key.getScope())
{
Globals.keyScope(Globals.keyScopeFake());
}
});
module.exports = Globals; module.exports = Globals;
}(module)); }(module));

View file

@ -6,7 +6,8 @@
var var
window = require('../External/window.js'), window = require('../External/window.js'),
Utils = require('./Utils.js') Utils = require('./Utils.js'),
AppSettings = require('../Storages/AppSettings.js')
; ;
/** /**
@ -16,9 +17,9 @@
{ {
this.sBase = '#/'; this.sBase = '#/';
this.sServer = './?'; this.sServer = './?';
this.sVersion = RL.settingsGet('Version'); this.sVersion = AppSettings.settingsGet('Version');
this.sSpecSuffix = RL.settingsGet('AuthAccountHash') || '0'; this.sSpecSuffix = AppSettings.settingsGet('AuthAccountHash') || '0';
this.sStaticPrefix = RL.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/'; this.sStaticPrefix = AppSettings.settingsGet('StaticPrefix') || 'rainloop/v/' + this.sVersion + '/static/';
} }
/** /**

View file

@ -6,7 +6,8 @@
var var
window = require('../External/window.js'), window = require('../External/window.js'),
Globals = require('./Globals.js') Globals = require('./Globals.js'),
AppSettings = require('../Storages/AppSettings.js')
; ;
/** /**
@ -164,8 +165,8 @@
var var
oConfig = Globals.oHtmlEditorDefaultConfig, oConfig = Globals.oHtmlEditorDefaultConfig,
sLanguage = RL.settingsGet('Language'), // TODO cjs sLanguage = AppSettings.settingsGet('Language'),
bSource = !!RL.settingsGet('AllowHtmlEditorSourceButton') bSource = !!AppSettings.settingsGet('AllowHtmlEditorSourceButton')
; ;
if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited) if (bSource && oConfig.toolbarGroups && !oConfig.toolbarGroups.__SourceInited)

View file

@ -5,10 +5,13 @@
'use strict'; 'use strict';
var var
Plugins = {}, Plugins = {
Utils = require('./Utils.js'), __boot: null,
Remote = require('../Remote.js'), __remote: null,
RL = require('../RL.js') __data: null
},
_ = require('../External/underscore.js'),
Utils = require('./Utils.js')
; ;
/** /**
@ -72,7 +75,12 @@
*/ */
Plugins.mainSettingsGet = function (sName) Plugins.mainSettingsGet = function (sName)
{ {
return RL ? RL().settingsGet(sName) : null; if (Plugins.__boot)
{
return Plugins.__boot.settingsGet(sName);
}
return null;
}; };
/** /**
@ -85,9 +93,9 @@
*/ */
Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions) Plugins.remoteRequest = function (fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions)
{ {
if (Remote) if (Plugins.__remote)
{ {
Remote().defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions); Plugins.__remote.defaultRequest(fCallback, sAction, oParameters, iTimeout, sGetAdd, aAbortActions);
} }
}; };

View file

@ -10,17 +10,14 @@
$ = require('../External/jquery.js'), $ = require('../External/jquery.js'),
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
key = require('../External/key.js'),
window = require('../External/window.js'), window = require('../External/window.js'),
$window = require('../External/$window.js'), $window = require('../External/$window.js'),
$html = require('../External/$html.js'),
$doc = require('../External/$doc.js'), $doc = require('../External/$doc.js'),
NotificationClass = require('../External/NotificationClass.js'), NotificationClass = require('../External/NotificationClass.js'),
LocalStorage = require('../Storages/LocalStorage.js'),
kn = require('../Knoin/Knoin.js'),
Enums = require('./Enums.js'), Enums = require('./Enums.js'),
Consts = require('./Consts.js'),
Globals = require('./Globals.js') Globals = require('./Globals.js')
; ;
@ -154,24 +151,24 @@
Utils.exportPath = function (sPath, oObject, oObjectToExportTo) Utils.exportPath = function (sPath, oObject, oObjectToExportTo)
{ {
var var
part = null, sPart = null,
parts = sPath.split('.'), aParts = sPath.split('.'),
cur = oObjectToExportTo || window oCur = oObjectToExportTo || window
; ;
for (; parts.length && (part = parts.shift());) for (; aParts.length && (sPart = aParts.shift());)
{ {
if (!parts.length && !Utils.isUnd(oObject)) if (!aParts.length && !Utils.isUnd(oObject))
{ {
cur[part] = oObject; oCur[sPart] = oObject;
} }
else if (cur[part]) else if (oCur[sPart])
{ {
cur = cur[part]; oCur = oCur[sPart];
} }
else else
{ {
cur = cur[part] = {}; oCur = oCur[sPart] = {};
} }
} }
}; };
@ -694,7 +691,7 @@
*/ */
Utils.roundNumber = function (iNum, iDec) Utils.roundNumber = function (iNum, iDec)
{ {
return Math.round(iNum * Math.pow(10, iDec)) / Math.pow(10, iDec); return window.Math.round(iNum * window.Math.pow(10, iDec)) / window.Math.pow(10, iDec);
}; };
/** /**
@ -1241,112 +1238,6 @@
}, oObject); }, oObject);
}; };
/**
* @param {string} sFullNameHash
* @return {boolean}
*/
Utils.isFolderExpanded = function (sFullNameHash)
{
var aExpandedList = /** @type {Array|null} */ LocalStorage.get(Enums.ClientSideKeyName.ExpandedFolders);
return _.isArray(aExpandedList) && -1 !== _.indexOf(aExpandedList, sFullNameHash);
};
/**
* @param {string} sFullNameHash
* @param {boolean} bExpanded
*/
Utils.setExpandedFolder = function (sFullNameHash, bExpanded)
{
var aExpandedList = /** @type {Array|null} */ LocalStorage.get(Enums.ClientSideKeyName.ExpandedFolders);
if (!_.isArray(aExpandedList))
{
aExpandedList = [];
}
if (bExpanded)
{
aExpandedList.push(sFullNameHash);
aExpandedList = _.uniq(aExpandedList);
}
else
{
aExpandedList = _.without(aExpandedList, sFullNameHash);
}
LocalStorage.set(Enums.ClientSideKeyName.ExpandedFolders, aExpandedList);
};
Utils.initLayoutResizer = function (sLeft, sRight, sClientSideKeyName)
{
var
iDisabledWidth = 60,
iMinWidth = 155,
oLeft = $(sLeft),
oRight = $(sRight),
mLeftWidth = LocalStorage.get(sClientSideKeyName) || null,
fSetWidth = function (iWidth) {
if (iWidth)
{
oLeft.css({
'width': '' + iWidth + 'px'
});
oRight.css({
'left': '' + iWidth + 'px'
});
}
},
fDisable = function (bDisable) {
if (bDisable)
{
oLeft.resizable('disable');
fSetWidth(iDisabledWidth);
}
else
{
oLeft.resizable('enable');
var iWidth = Utils.pInt(LocalStorage.get(sClientSideKeyName)) || iMinWidth;
fSetWidth(iWidth > iMinWidth ? iWidth : iMinWidth);
}
},
fResizeFunction = function (oEvent, oObject) {
if (oObject && oObject.size && oObject.size.width)
{
LocalStorage.set(sClientSideKeyName, oObject.size.width);
oRight.css({
'left': '' + oObject.size.width + 'px'
});
}
}
;
if (null !== mLeftWidth)
{
fSetWidth(mLeftWidth > iMinWidth ? mLeftWidth : iMinWidth);
}
oLeft.resizable({
'helper': 'ui-resizable-helper',
'minWidth': iMinWidth,
'maxWidth': 350,
'handles': 'e',
'stop': fResizeFunction
});
RL.sub('left-panel.off', function () {
fDisable(true);
});
RL.sub('left-panel.on', function () {
fDisable(false);
});
};
/** /**
* @param {Object} oMessageTextBody * @param {Object} oMessageTextBody
*/ */
@ -1526,7 +1417,10 @@
Utils.i18nToNode(oBody); Utils.i18nToNode(oBody);
kn.applyExternal(oViewModel, $('#rl-content', oBody)[0]); if (oViewModel && $('#rl-content', oBody)[0])
{
ko.applyBindings(oViewModel, $('#rl-content', oBody)[0]);
}
window[sFunc] = null; window[sFunc] = null;
@ -1863,6 +1757,135 @@
oTempImg.src = sUrl; oTempImg.src = sUrl;
}; };
/**
* @param {Array} aSystem
* @param {Array} aList
* @param {Array=} aDisabled
* @param {Array=} aHeaderLines
* @param {?number=} iUnDeep
* @param {Function=} fDisableCallback
* @param {Function=} fVisibleCallback
* @param {Function=} fRenameCallback
* @param {boolean=} bSystem
* @param {boolean=} bBuildUnvisible
* @return {Array}
*/
Utils.folderListOptionsBuilder = function (aSystem, aList, aDisabled, aHeaderLines, iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible)
{
var
/**
* @type {?FolderModel}
*/
oItem = null,
bSep = false,
iIndex = 0,
iLen = 0,
sDeepPrefix = '\u00A0\u00A0\u00A0',
aResult = []
;
bSystem = !Utils.isNormal(bSystem) ? 0 < aSystem.length : bSystem;
bBuildUnvisible = Utils.isUnd(bBuildUnvisible) ? false : !!bBuildUnvisible;
iUnDeep = !Utils.isNormal(iUnDeep) ? 0 : iUnDeep;
fDisableCallback = Utils.isNormal(fDisableCallback) ? fDisableCallback : null;
fVisibleCallback = Utils.isNormal(fVisibleCallback) ? fVisibleCallback : null;
fRenameCallback = Utils.isNormal(fRenameCallback) ? fRenameCallback : null;
if (!Utils.isArray(aDisabled))
{
aDisabled = [];
}
if (!Utils.isArray(aHeaderLines))
{
aHeaderLines = [];
}
for (iIndex = 0, iLen = aHeaderLines.length; iIndex < iLen; iIndex++)
{
aResult.push({
'id': aHeaderLines[iIndex][0],
'name': aHeaderLines[iIndex][1],
'system': false,
'seporator': false,
'disabled': false
});
}
bSep = true;
for (iIndex = 0, iLen = aSystem.length; iIndex < iLen; iIndex++)
{
oItem = aSystem[iIndex];
if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
{
if (bSep && 0 < aResult.length)
{
aResult.push({
'id': '---',
'name': '---',
'system': false,
'seporator': true,
'disabled': true
});
}
bSep = false;
aResult.push({
'id': oItem.fullNameRaw,
'name': fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name(),
'system': true,
'seporator': false,
'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) ||
(fDisableCallback ? fDisableCallback.call(null, oItem) : false)
});
}
}
bSep = true;
for (iIndex = 0, iLen = aList.length; iIndex < iLen; iIndex++)
{
oItem = aList[iIndex];
if (oItem.subScribed() || !oItem.existen)
{
if (fVisibleCallback ? fVisibleCallback.call(null, oItem) : true)
{
if (Enums.FolderType.User === oItem.type() || !bSystem || 0 < oItem.subFolders().length)
{
if (bSep && 0 < aResult.length)
{
aResult.push({
'id': '---',
'name': '---',
'system': false,
'seporator': true,
'disabled': true
});
}
bSep = false;
aResult.push({
'id': oItem.fullNameRaw,
'name': (new window.Array(oItem.deep + 1 - iUnDeep)).join(sDeepPrefix) +
(fRenameCallback ? fRenameCallback.call(null, oItem) : oItem.name()),
'system': false,
'seporator': false,
'disabled': !oItem.selectable || -1 < Utils.inArray(oItem.fullNameRaw, aDisabled) ||
(fDisableCallback ? fDisableCallback.call(null, oItem) : false)
});
}
}
}
if (oItem.subScribed() && 0 < oItem.subFolders().length)
{
aResult = aResult.concat(Utils.folderListOptionsBuilder([], oItem.subFolders(), aDisabled, [],
iUnDeep, fDisableCallback, fVisibleCallback, fRenameCallback, bSystem, bBuildUnvisible));
}
}
return aResult;
};
Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount) Utils.computedPagenatorHelper = function (koCurrentPage, koPageCount)
{ {
return function() { return function() {
@ -1949,7 +1972,7 @@
} }
else if (3 < iPrev) else if (3 < iPrev)
{ {
fAdd(Math.round((iPrev - 1) / 2), false, '...'); fAdd(window.Math.round((iPrev - 1) / 2), false, '...');
} }
if (iPageCount - 2 === iNext) if (iPageCount - 2 === iNext)
@ -1958,7 +1981,7 @@
} }
else if (iPageCount - 2 > iNext) else if (iPageCount - 2 > iNext)
{ {
fAdd(Math.round((iPageCount + iNext) / 2), true, '...'); fAdd(window.Math.round((iPageCount + iNext) / 2), true, '...');
} }
// first and last // first and last
@ -1984,53 +2007,19 @@
{ {
var sel = window.getSelection(); var sel = window.getSelection();
sel.removeAllRanges(); sel.removeAllRanges();
var range = document.createRange(); var range = window.document.createRange();
range.selectNodeContents(element); range.selectNodeContents(element);
sel.addRange(range); sel.addRange(range);
} }
else if (document.selection) else if (window.document.selection)
{ {
var textRange = document.body.createTextRange(); var textRange = window.document.body.createTextRange();
textRange.moveToElementText(element); textRange.moveToElementText(element);
textRange.select(); textRange.select();
} }
/* jshint onevar: true */ /* jshint onevar: true */
}; };
Utils.disableKeyFilter = function ()
{
if (window.key)
{
key.filter = function () {
return RL.data().useKeyboardShortcuts();
};
}
};
Utils.restoreKeyFilter = function ()
{
if (window.key)
{
key.filter = function (event) {
if (RL.data().useKeyboardShortcuts())
{
var
element = event.target || event.srcElement,
tagName = element ? element.tagName : ''
;
tagName = tagName.toUpperCase();
return !(tagName === 'INPUT' || tagName === 'SELECT' || tagName === 'TEXTAREA' ||
(element && tagName === 'DIV' && 'editorHtmlArea' === element.className && element.contentEditable)
);
}
return false;
};
}
};
Utils.detectDropdownVisibility = _.debounce(function () { Utils.detectDropdownVisibility = _.debounce(function () {
Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) { Globals.dropdownVisibility(!!_.find(Globals.aBootstrapDropdowns, function (oItem) {
return oItem.hasClass('open'); return oItem.hasClass('open');

View file

@ -2,8 +2,5 @@
'use strict'; 'use strict';
var var window = require('./window.js');
window = require('./window.js')
;
module.exports = window.Notification && window.Notification.requestPermission ? window.Notification : null; module.exports = window.Notification && window.Notification.requestPermission ? window.Notification : null;

118
dev/External/ko.js vendored
View file

@ -5,20 +5,21 @@
'use strict'; 'use strict';
var var
$ = require('./jquery.js'),
_ = require('./underscore.js'),
window = require('./window.js'), window = require('./window.js'),
_ = require('./underscore.js'),
$ = require('./jquery.js'),
$window = require('./$window.js'), $window = require('./$window.js'),
$doc = require('./$doc.js'), $doc = require('./$doc.js')
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js'),
RL = require('../RL.js')
; ;
ko.bindingHandlers.tooltip = { ko.bindingHandlers.tooltip = {
'init': function (oElement, fValueAccessor) { 'init': function (oElement, fValueAccessor) {
var
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js')
;
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
{ {
var var
@ -56,7 +57,8 @@
var var
$oEl = $(oElement), $oEl = $(oElement),
sClass = $oEl.data('tooltip-class') || '', sClass = $oEl.data('tooltip-class') || '',
sPlacement = $oEl.data('tooltip-placement') || 'top' sPlacement = $oEl.data('tooltip-placement') || 'top',
Globals = require('../Common/Globals.js')
; ;
$oEl.tooltip({ $oEl.tooltip({
@ -84,7 +86,10 @@
ko.bindingHandlers.tooltip3 = { ko.bindingHandlers.tooltip3 = {
'init': function (oElement) { 'init': function (oElement) {
var $oEl = $(oElement); var
$oEl = $(oElement),
Globals = require('../Common/Globals.js')
;
$oEl.tooltip({ $oEl.tooltip({
'container': 'body', 'container': 'body',
@ -117,6 +122,11 @@
ko.bindingHandlers.registrateBootstrapDropdown = { ko.bindingHandlers.registrateBootstrapDropdown = {
'init': function (oElement) { 'init': function (oElement) {
var
Globals = require('../Common/Globals.js')
;
Globals.aBootstrapDropdowns.push($(oElement)); Globals.aBootstrapDropdowns.push($(oElement));
} }
}; };
@ -125,7 +135,11 @@
'update': function (oElement, fValueAccessor) { 'update': function (oElement, fValueAccessor) {
if (ko.utils.unwrapObservable(fValueAccessor())) if (ko.utils.unwrapObservable(fValueAccessor()))
{ {
var $el = $(oElement); var
$el = $(oElement),
Utils = require('../Common/Utils.js')
;
if (!$el.hasClass('open')) if (!$el.hasClass('open'))
{ {
$el.find('.dropdown-toggle').dropdown('toggle'); $el.find('.dropdown-toggle').dropdown('toggle');
@ -153,6 +167,11 @@
ko.bindingHandlers.csstext = { ko.bindingHandlers.csstext = {
'init': function (oElement, fValueAccessor) { 'init': function (oElement, fValueAccessor) {
var
Utils = require('../Common/Utils.js')
;
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText)) if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
{ {
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor()); oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
@ -163,6 +182,11 @@
} }
}, },
'update': function (oElement, fValueAccessor) { 'update': function (oElement, fValueAccessor) {
var
Utils = require('../Common/Utils.js')
;
if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText)) if (oElement && oElement.styleSheet && !Utils.isUnd(oElement.styleSheet.cssText))
{ {
oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor()); oElement.styleSheet.cssText = ko.utils.unwrapObservable(fValueAccessor());
@ -229,6 +253,11 @@
ko.bindingHandlers.modal = { ko.bindingHandlers.modal = {
'init': function (oElement, fValueAccessor) { 'init': function (oElement, fValueAccessor) {
var
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js')
;
$(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({ $(oElement).toggleClass('fade', !Globals.bMobileDevice).modal({
'keyboard': false, 'keyboard': false,
'show': ko.utils.unwrapObservable(fValueAccessor()) 'show': ko.utils.unwrapObservable(fValueAccessor())
@ -247,12 +276,18 @@
ko.bindingHandlers.i18nInit = { ko.bindingHandlers.i18nInit = {
'init': function (oElement) { 'init': function (oElement) {
var
Utils = require('../Common/Utils.js')
;
Utils.i18nToNode(oElement); Utils.i18nToNode(oElement);
} }
}; };
ko.bindingHandlers.i18nUpdate = { ko.bindingHandlers.i18nUpdate = {
'update': function (oElement, fValueAccessor) { 'update': function (oElement, fValueAccessor) {
var
Utils = require('../Common/Utils.js')
;
ko.utils.unwrapObservable(fValueAccessor()); ko.utils.unwrapObservable(fValueAccessor());
Utils.i18nToNode(oElement); Utils.i18nToNode(oElement);
} }
@ -292,6 +327,7 @@
}, },
'update': function (oElement, fValueAccessor) { 'update': function (oElement, fValueAccessor) {
var var
Utils = require('../Common/Utils.js'),
aValues = ko.utils.unwrapObservable(fValueAccessor()), aValues = ko.utils.unwrapObservable(fValueAccessor()),
iValue = Utils.pInt(aValues[1]), iValue = Utils.pInt(aValues[1]),
iSize = 0, iSize = 0,
@ -325,6 +361,11 @@
ko.bindingHandlers.draggable = { ko.bindingHandlers.draggable = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
var
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js')
;
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
{ {
var var
@ -406,6 +447,10 @@
ko.bindingHandlers.droppable = { ko.bindingHandlers.droppable = {
'init': function (oElement, fValueAccessor, fAllBindingsAccessor) { 'init': function (oElement, fValueAccessor, fAllBindingsAccessor) {
var
Globals = require('../Common/Globals.js')
;
if (!Globals.bMobileDevice) if (!Globals.bMobileDevice)
{ {
var var
@ -447,6 +492,11 @@
ko.bindingHandlers.nano = { ko.bindingHandlers.nano = {
'init': function (oElement) { 'init': function (oElement) {
var
Globals = require('../Common/Globals.js')
;
if (!Globals.bDisableNanoScroll) if (!Globals.bDisableNanoScroll)
{ {
$(oElement) $(oElement)
@ -540,10 +590,14 @@
}; };
ko.bindingHandlers.emailsTags = { ko.bindingHandlers.emailsTags = {
'init': function(oElement, fValueAccessor) { 'init': function(oElement, fValueAccessor, fAllBindingsAccessor) {
var var
Utils = require('../Common/Utils.js'),
$oEl = $(oElement), $oEl = $(oElement),
fValue = fValueAccessor(), fValue = fValueAccessor(),
fAllBindings = fAllBindingsAccessor(),
fAutoCompleteSource = fAllBindings['autoCompleteSource'] || null,
fFocusCallback = function (bValue) { fFocusCallback = function (bValue) {
if (fValue && fValue.focusTrigger) if (fValue && fValue.focusTrigger)
{ {
@ -557,13 +611,7 @@
'allowDragAndDrop': true, 'allowDragAndDrop': true,
'focusCallback': fFocusCallback, 'focusCallback': fFocusCallback,
'inputDelimiters': [',', ';'], 'inputDelimiters': [',', ';'],
'autoCompleteSource': function (oData, fResponse) { 'autoCompleteSource': fAutoCompleteSource,
RL().getAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oEmailItem) {
return oEmailItem.toLine(false);
}));
});
},
'parseHook': function (aInput) { 'parseHook': function (aInput) {
return _.map(aInput, function (sInputValue) { return _.map(aInput, function (sInputValue) {
@ -615,9 +663,13 @@
ko.bindingHandlers.contactTags = { ko.bindingHandlers.contactTags = {
'init': function(oElement, fValueAccessor) { 'init': function(oElement, fValueAccessor) {
var var
Utils = require('../Common/Utils.js'),
$oEl = $(oElement), $oEl = $(oElement),
fValue = fValueAccessor(), fValue = fValueAccessor(),
fAllBindings = fAllBindingsAccessor(),
fAutoCompleteSource = fAllBindings['autoCompleteSource'] || null,
fFocusCallback = function (bValue) { fFocusCallback = function (bValue) {
if (fValue && fValue.focusTrigger) if (fValue && fValue.focusTrigger)
{ {
@ -632,13 +684,7 @@
'focusCallback': fFocusCallback, 'focusCallback': fFocusCallback,
'inputDelimiters': [',', ';'], 'inputDelimiters': [',', ';'],
'outputDelimiter': ',', 'outputDelimiter': ',',
'autoCompleteSource': function (oData, fResponse) { 'autoCompleteSource': fAutoCompleteSource,
RL().getContactTagsAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oTagItem) {
return oTagItem.toLine(false);
}));
});
},
'parseHook': function (aInput) { 'parseHook': function (aInput) {
return _.map(aInput, function (sInputValue) { return _.map(aInput, function (sInputValue) {
@ -731,13 +777,16 @@
ko.extenders.trimmer = function (oTarget) ko.extenders.trimmer = function (oTarget)
{ {
var oResult = ko.computed({ var
Utils = require('../Common/Utils.js'),
oResult = ko.computed({
'read': oTarget, 'read': oTarget,
'write': function (sNewValue) { 'write': function (sNewValue) {
oTarget(Utils.trim(sNewValue.toString())); oTarget(Utils.trim(sNewValue.toString()));
}, },
'owner': this 'owner': this
}); })
;
oResult(oTarget()); oResult(oTarget());
return oResult; return oResult;
@ -745,7 +794,9 @@
ko.extenders.posInterer = function (oTarget, iDefault) ko.extenders.posInterer = function (oTarget, iDefault)
{ {
var oResult = ko.computed({ var
Utils = require('../Common/Utils.js'),
oResult = ko.computed({
'read': oTarget, 'read': oTarget,
'write': function (sNewValue) { 'write': function (sNewValue) {
var iNew = Utils.pInt(sNewValue.toString(), iDefault); var iNew = Utils.pInt(sNewValue.toString(), iDefault);
@ -761,7 +812,8 @@
oTarget(iNew); oTarget(iNew);
} }
}); })
;
oResult(oTarget()); oResult(oTarget());
return oResult; return oResult;
@ -799,6 +851,8 @@
ko.extenders.falseTimeout = function (oTarget, iOption) ko.extenders.falseTimeout = function (oTarget, iOption)
{ {
var Utils = require('../Common/Utils.js');
oTarget.iTimeout = 0; oTarget.iTimeout = 0;
oTarget.subscribe(function (bValue) { oTarget.subscribe(function (bValue) {
if (bValue) if (bValue)
@ -822,6 +876,7 @@
ko.observable.fn.validateEmail = function () ko.observable.fn.validateEmail = function ()
{ {
var Utils = require('../Common/Utils.js');
this.hasError = ko.observable(false); this.hasError = ko.observable(false);
this.subscribe(function (sValue) { this.subscribe(function (sValue) {
@ -835,6 +890,8 @@
ko.observable.fn.validateSimpleEmail = function () ko.observable.fn.validateSimpleEmail = function ()
{ {
var Utils = require('../Common/Utils.js');
this.hasError = ko.observable(false); this.hasError = ko.observable(false);
this.subscribe(function (sValue) { this.subscribe(function (sValue) {
@ -848,6 +905,7 @@
ko.observable.fn.validateFunc = function (fFunc) ko.observable.fn.validateFunc = function (fFunc)
{ {
var Utils = require('../Common/Utils.js');
this.hasFuncError = ko.observable(false); this.hasFuncError = ko.observable(false);
if (Utils.isFunc(fFunc)) if (Utils.isFunc(fFunc))

View file

@ -2,4 +2,4 @@
'use strict'; 'use strict';
module.exports = window; module.exports = _;

View file

@ -11,10 +11,11 @@
hasher = require('../External/hasher.js'), hasher = require('../External/hasher.js'),
crossroads = require('../External/crossroads.js'), crossroads = require('../External/crossroads.js'),
$html = require('../External/$html.js'), $html = require('../External/$html.js'),
Globals = require('../Common/Globals.js'), Globals = require('../Common/Globals.js'),
Enums = require('../Common/Enums.js'),
Plugins = require('../Common/Plugins.js'), Plugins = require('../Common/Plugins.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
; ;
@ -25,24 +26,11 @@
{ {
this.sDefaultScreenName = ''; this.sDefaultScreenName = '';
this.oScreens = {}; this.oScreens = {};
this.oBoot = null;
this.oCurrentScreen = null; this.oCurrentScreen = null;
} }
/**
* @param {Object} thisObject
*/
Knoin.constructorEnd = function (thisObject)
{
if (Utils.isFunc(thisObject['__constructor_end']))
{
thisObject['__constructor_end'].call(thisObject);
}
};
Knoin.prototype.sDefaultScreenName = ''; Knoin.prototype.sDefaultScreenName = '';
Knoin.prototype.oScreens = {}; Knoin.prototype.oScreens = {};
Knoin.prototype.oBoot = null;
Knoin.prototype.oCurrentScreen = null; Knoin.prototype.oCurrentScreen = null;
Knoin.prototype.hideLoading = function () Knoin.prototype.hideLoading = function ()
@ -50,16 +38,6 @@
$('#rl-loading').hide(); $('#rl-loading').hide();
}; };
Knoin.prototype.rl = function ()
{
return this.oBoot;
};
Knoin.prototype.remote = function ()
{
return this.oRemote;
};
/** /**
* @param {Object} thisObject * @param {Object} thisObject
*/ */
@ -154,6 +132,7 @@
if (ViewModelClass && !ViewModelClass.__builded) if (ViewModelClass && !ViewModelClass.__builded)
{ {
var var
kn = this,
oViewModel = new ViewModelClass(oScreen), oViewModel = new ViewModelClass(oScreen),
sPosition = oViewModel.viewModelPosition(), sPosition = oViewModel.viewModelPosition(),
oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()), oViewModelPlace = $('#rl-content #rl-' + sPosition.toLowerCase()),
@ -162,7 +141,6 @@
ViewModelClass.__builded = true; ViewModelClass.__builded = true;
ViewModelClass.__vm = oViewModel; ViewModelClass.__vm = oViewModel;
oViewModel.data = RL.data(); // TODO cjs
oViewModel.viewModelName = ViewModelClass.__name; oViewModel.viewModelName = ViewModelClass.__name;
@ -177,7 +155,7 @@
if ('Popups' === sPosition) if ('Popups' === sPosition)
{ {
oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () { oViewModel.cancelCommand = oViewModel.closeCommand = Utils.createCommand(oViewModel, function () {
kn.hideScreenPopup(ViewModelClass); // TODO cjs kn.hideScreenPopup(ViewModelClass);
}); });
oViewModel.modalVisibility.subscribe(function (bValue) { oViewModel.modalVisibility.subscribe(function (bValue) {
@ -188,8 +166,8 @@
this.viewModelDom.show(); this.viewModelDom.show();
this.storeAndSetKeyScope(); this.storeAndSetKeyScope();
RL.popupVisibilityNames.push(this.viewModelName); // TODO cjs Globals.popupVisibilityNames.push(this.viewModelName);
oViewModel.viewModelDom.css('z-index', 3000 + RL.popupVisibilityNames().length + 10); // TODO cjs oViewModel.viewModelDom.css('z-index', 3000 + Globals.popupVisibilityNames().length + 10);
Utils.delegateRun(this, 'onFocus', [], 500); Utils.delegateRun(this, 'onFocus', [], 500);
} }
@ -198,7 +176,7 @@
Utils.delegateRun(this, 'onHide'); Utils.delegateRun(this, 'onHide');
this.restoreKeyScope(); this.restoreKeyScope();
RL.popupVisibilityNames.remove(this.viewModelName); // TODO cjs Globals.popupVisibilityNames.remove(this.viewModelName);
oViewModel.viewModelDom.css('z-index', 2000); oViewModel.viewModelDom.css('z-index', 2000);
Globals.tooltipTrigger(!Globals.tooltipTrigger()); Globals.tooltipTrigger(!Globals.tooltipTrigger());
@ -211,7 +189,7 @@
}, oViewModel); }, oViewModel);
} }
Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs Plugins.runHook('view-model-pre-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
ko.applyBindingAccessorsToNode(oViewModelDom[0], { ko.applyBindingAccessorsToNode(oViewModelDom[0], {
'i18nInit': true, 'i18nInit': true,
@ -224,7 +202,7 @@
oViewModel.registerPopupKeyDown(); oViewModel.registerPopupKeyDown();
} }
Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]); // TODO cjs Plugins.runHook('view-model-post-build', [ViewModelClass.__name, oViewModel, oViewModelDom]);
} }
else else
{ {
@ -235,18 +213,6 @@
return ViewModelClass ? ViewModelClass.__vm : null; return ViewModelClass ? ViewModelClass.__vm : null;
}; };
/**
* @param {Object} oViewModel
* @param {Object} oViewModelDom
*/
Knoin.prototype.applyExternal = function (oViewModel, oViewModelDom)
{
if (oViewModel && oViewModelDom)
{
ko.applyBindings(oViewModel, oViewModelDom);
}
};
/** /**
* @param {Function} ViewModelClassToHide * @param {Function} ViewModelClassToHide
*/ */
@ -255,7 +221,7 @@
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom) if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
{ {
ViewModelClassToHide.__vm.modalVisibility(false); ViewModelClassToHide.__vm.modalVisibility(false);
Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]); // TODO cjs Plugins.runHook('view-model-on-hide', [ViewModelClassToHide.__name, ViewModelClassToHide.__vm]);
} }
}; };
@ -273,7 +239,7 @@
{ {
ViewModelClassToShow.__vm.modalVisibility(true); ViewModelClassToShow.__vm.modalVisibility(true);
Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []); Utils.delegateRun(ViewModelClassToShow.__vm, 'onShow', aParameters || []);
Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]); // TODO cjs Plugins.runHook('view-model-on-show', [ViewModelClassToShow.__name, ViewModelClassToShow.__vm, aParameters || []]);
} }
} }
}; };
@ -364,7 +330,7 @@
{ {
Utils.delegateRun(self.oCurrentScreen, 'onShow'); Utils.delegateRun(self.oCurrentScreen, 'onShow');
Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]); // TODO cjs Plugins.runHook('screen-on-show', [self.oCurrentScreen.screenName(), self.oCurrentScreen]);
if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels())) if (Utils.isNonEmptyArray(self.oCurrentScreen.viewModels()))
{ {
@ -378,7 +344,7 @@
Utils.delegateRun(ViewModelClass.__vm, 'onShow'); Utils.delegateRun(ViewModelClass.__vm, 'onShow');
Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200); Utils.delegateRun(ViewModelClass.__vm, 'onFocus', [], 200);
Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]); // TODO cjs Plugins.runHook('view-model-on-show', [ViewModelClass.__name, ViewModelClass.__vm]);
} }
}, self); }, self);
@ -431,9 +397,9 @@
oScreen.__started = true; oScreen.__started = true;
oScreen.__start(); oScreen.__start();
Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]); // TODO cjs Plugins.runHook('screen-pre-start', [oScreen.screenName(), oScreen]);
Utils.delegateRun(oScreen, 'onStart'); Utils.delegateRun(oScreen, 'onStart');
Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]); // TODO cjs Plugins.runHook('screen-post-start', [oScreen.screenName(), oScreen]);
} }
}, this); }, this);
@ -479,71 +445,6 @@
} }
}; };
/**
* @return {Knoin}
*/
Knoin.prototype.bootstart = function (RL, Remote)
{
this.oBoot = RL;
this.oRemote = Remote;
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'] = _.bind(this.addSettingsViewModel, this);
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);
}
window['__RLBOOT'] = null;
});
};
};
module.exports = new Knoin(); module.exports = new Knoin();
}(module)); }(module));

View file

@ -7,8 +7,10 @@
var var
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
$window = require('../External/$window.js'), $window = require('../External/$window.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
Enums = require('../Common/Enums.js') Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js')
; ;
/** /**
@ -68,19 +70,18 @@
return this.sPosition; return this.sPosition;
}; };
KnoinAbstractViewModel.prototype.cancelCommand = KnoinAbstractViewModel.prototype.closeCommand = function () KnoinAbstractViewModel.prototype.cancelCommand = function () {};
{ KnoinAbstractViewModel.prototype.closeCommand = function () {};
};
KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function () KnoinAbstractViewModel.prototype.storeAndSetKeyScope = function ()
{ {
this.sCurrentKeyScope = RL.data().keyScope(); // TODO cjs this.sCurrentKeyScope = Globals.keyScope();
RL.data().keyScope(this.sDefaultKeyScope); // TODO cjs Globals.keyScope(this.sDefaultKeyScope);
}; };
KnoinAbstractViewModel.prototype.restoreKeyScope = function () KnoinAbstractViewModel.prototype.restoreKeyScope = function ()
{ {
RL.data().keyScope(this.sCurrentKeyScope); // TODO cjs Globals.keyScope(this.sCurrentKeyScope);
}; };
KnoinAbstractViewModel.prototype.registerPopupKeyDown = function () KnoinAbstractViewModel.prototype.registerPopupKeyDown = function ()

View file

@ -118,7 +118,7 @@
*/ */
AttachmentModel.prototype.linkDownload = function () AttachmentModel.prototype.linkDownload = function ()
{ {
return LinkBuilder.attachmentDownload(this.download); // TODO cjs return LinkBuilder.attachmentDownload(this.download);
}; };
/** /**
@ -126,7 +126,7 @@
*/ */
AttachmentModel.prototype.linkPreview = function () AttachmentModel.prototype.linkPreview = function ()
{ {
return LinkBuilder.attachmentPreview(this.download); // TODO cjs return LinkBuilder.attachmentPreview(this.download);
}; };
/** /**

View file

@ -6,11 +6,13 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
ko = require('./External/ko.js'), ko = require('../External/ko.js'),
$window = require('../External/$window.js'), $window = require('../External/$window.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'), Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js') Utils = require('../Common/Utils.js'),
Events = require('../Common/Events.js')
; ;
/** /**
@ -43,17 +45,6 @@
this.nameForEdit = ko.observable(''); this.nameForEdit = ko.observable('');
this.name.subscribe(function (sValue) {
this.nameForEdit(sValue);
}, this);
this.edited.subscribe(function (bValue) {
if (bValue)
{
this.nameForEdit(this.name());
}
}, this);
this.privateMessageCountAll = ko.observable(0); this.privateMessageCountAll = ko.observable(0);
this.privateMessageCountUnread = ko.observable(0); this.privateMessageCountUnread = ko.observable(0);
@ -150,11 +141,6 @@
iType = this.type() iType = this.type()
; ;
if (Enums.FolderType.Inbox === iType)
{
RL.data().foldersInboxUnreadCount(iUnread); // TODO cjs
}
if (0 < iCount) if (0 < iCount)
{ {
if (Enums.FolderType.Draft === iType) if (Enums.FolderType.Draft === iType)
@ -290,6 +276,25 @@
}); });
}, this); }, this);
// subscribe
this.name.subscribe(function (sValue) {
this.nameForEdit(sValue);
}, this);
this.edited.subscribe(function (bValue) {
if (bValue)
{
this.nameForEdit(this.name());
}
}, this);
this.messageCountUnread.subscribe(function (iUnread) {
if (Enums.FolderType.Inbox === this.type())
{
Events.pub('mailbox.inbox-unread-count', [iUnread]);
}
}, this);
return this; return this;
}; };

View file

@ -347,8 +347,9 @@
MessageModel.prototype.computeSenderEmail = function () MessageModel.prototype.computeSenderEmail = function ()
{ {
var var
sSent = RL.data().sentFolder(), Data = require('../Storages/WebMailDataStorage.js'),
sDraft = RL.data().draftFolder() sSent = Data.sentFolder(),
sDraft = Data.draftFolder()
; ;
this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ? this.senderEmailsString(this.folderFullNameRaw === sSent || this.folderFullNameRaw === sDraft ?
@ -424,6 +425,7 @@
MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage) MessageModel.prototype.initUpdateByMessageJson = function (oJsonMessage)
{ {
var var
Data = require('../Storages/WebMailDataStorage.js'),
bResult = false, bResult = false,
iPriority = Enums.MessagePriority.Normal iPriority = Enums.MessagePriority.Normal
; ;
@ -442,7 +444,7 @@
this.proxy = !!oJsonMessage.ExternalProxy; this.proxy = !!oJsonMessage.ExternalProxy;
if (RL.data().capaOpenPGP()) // TODO cjs if (Data.capaOpenPGP())
{ {
this.isPgpSigned(!!oJsonMessage.PgpSigned); this.isPgpSigned(!!oJsonMessage.PgpSigned);
this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted); this.isPgpEncrypted(!!oJsonMessage.PgpEncrypted);
@ -731,7 +733,7 @@
*/ */
MessageModel.prototype.viewLink = function () MessageModel.prototype.viewLink = function ()
{ {
return LinkBuilder.messageViewLink(this.requestHash);// TODO cjs return LinkBuilder.messageViewLink(this.requestHash);
}; };
/** /**
@ -739,7 +741,7 @@
*/ */
MessageModel.prototype.downloadLink = function () MessageModel.prototype.downloadLink = function ()
{ {
return LinkBuilder.messageDownloadLink(this.requestHash);// TODO cjs return LinkBuilder.messageDownloadLink(this.requestHash);
}; };
/** /**
@ -1079,7 +1081,7 @@
this.body.data('rl-plain-raw', this.plainRaw); this.body.data('rl-plain-raw', this.plainRaw);
if (RL.data().capaOpenPGP()) // TODO cjs if (Data.capaOpenPGP())
{ {
this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned()); this.body.data('rl-plain-pgp-signed', !!this.isPgpSigned());
this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted()); this.body.data('rl-plain-pgp-encrypted', !!this.isPgpEncrypted());
@ -1091,7 +1093,7 @@
MessageModel.prototype.storePgpVerifyDataToDom = function () MessageModel.prototype.storePgpVerifyDataToDom = function ()
{ {
if (this.body && RL.data().capaOpenPGP()) // TODO cjs if (this.body && Data.capaOpenPGP())
{ {
this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus()); this.body.data('rl-pgp-verify-status', this.pgpSignedVerifyStatus());
this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser()); this.body.data('rl-pgp-verify-user', this.pgpSignedVerifyUser());
@ -1107,7 +1109,7 @@
this.plainRaw = Utils.pString(this.body.data('rl-plain-raw')); this.plainRaw = Utils.pString(this.body.data('rl-plain-raw'));
if (RL.data().capaOpenPGP()) // TODO cjs if (Data.capaOpenPGP())
{ {
this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed')); this.isPgpSigned(!!this.body.data('rl-plain-pgp-signed'));
this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted')); this.isPgpEncrypted(!!this.body.data('rl-plain-pgp-encrypted'));
@ -1132,7 +1134,7 @@
aRes = [], aRes = [],
mPgpMessage = null, mPgpMessage = null,
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '', sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
aPublicKeys = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs aPublicKeys = Data.findPublicKeysByEmail(sFrom),
oValidKey = null, oValidKey = null,
oValidSysKey = null, oValidSysKey = null,
sPlain = '' sPlain = ''
@ -1158,7 +1160,7 @@
if (oValidKey) if (oValidKey)
{ {
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
if (oValidSysKey) if (oValidSysKey)
{ {
sPlain = mPgpMessage.getText(); sPlain = mPgpMessage.getText();
@ -1195,8 +1197,8 @@
mPgpMessage = null, mPgpMessage = null,
mPgpMessageDecrypted = null, mPgpMessageDecrypted = null,
sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '', sFrom = this.from && this.from[0] && this.from[0].email ? this.from[0].email : '',
aPublicKey = RL.data().findPublicKeysByEmail(sFrom), // TODO cjs aPublicKey = Data.findPublicKeysByEmail(sFrom),
oPrivateKey = RL.data().findSelfPrivateKey(sPassword), // TODO cjs oPrivateKey = Data.findSelfPrivateKey(sPassword),
oValidKey = null, oValidKey = null,
oValidSysKey = null, oValidSysKey = null,
sPlain = '' sPlain = ''
@ -1229,7 +1231,7 @@
if (oValidKey) if (oValidKey)
{ {
oValidSysKey = RL.data().findPublicKeyByHex(oValidKey.keyid.toHex()); // TODO cjs oValidSysKey = Data.findPublicKeyByHex(oValidKey.keyid.toHex());
if (oValidSysKey) if (oValidSysKey)
{ {
this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success); this.pgpSignedVerifyStatus(Enums.SignedVerifyStatus.Success);

View file

@ -1,11 +0,0 @@
/* 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'),
Remote = require('./Storages/WebMailAjaxRemoteStorage.js')
;
kn.bootstart(RL, Remote);

View file

@ -83,7 +83,6 @@
oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide(); oViewModelDom = $('<div></div>').addClass('rl-settings-view-model').hide();
oViewModelDom.appendTo(oViewModelPlace); oViewModelDom.appendTo(oViewModelPlace);
oSettingsScreen.data = RL.data(); // TODO cjs
oSettingsScreen.viewModelDom = oViewModelDom; oSettingsScreen.viewModelDom = oViewModelDom;
oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData; oSettingsScreen.__rlSettingsData = RoutedSettingsViewModel.__rlSettingsData;
@ -139,7 +138,7 @@
} }
else else
{ {
kn.setHash(LinkBuilder.settings(), false, true); // TODO cjs kn.setHash(LinkBuilder.settings(), false, true);
} }
}; };

View file

@ -6,8 +6,7 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js'), KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js')
AdminLoginViewModel = require('../ViewModels/AdminLoginViewModel.js')
; ;
/** /**
@ -16,6 +15,7 @@
*/ */
function AdminLoginScreen() function AdminLoginScreen()
{ {
var AdminLoginViewModel = require('../ViewModels/AdminLoginViewModel.js');
KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]); KnoinAbstractScreen.call(this, 'login', [AdminLoginViewModel]);
} }
@ -23,7 +23,8 @@
AdminLoginScreen.prototype.onShow = function () AdminLoginScreen.prototype.onShow = function ()
{ {
RL.setTitle(''); // TODO cjs var RL = require('../Boots/AdminApp.js');
RL.setTitle('');
}; };
module.exports = AdminLoginScreen; module.exports = AdminLoginScreen;

View file

@ -6,9 +6,7 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
AbstractSettings = require('./AbstractSettings.js'), AbstractSettings = require('./AbstractSettings.js')
AdminMenuViewModel = require('../ViewModels/AdminMenuViewModel.js'),
AdminPaneViewModel = require('../ViewModels/AdminPaneViewModel.js')
; ;
/** /**
@ -17,6 +15,11 @@
*/ */
function AdminSettingsScreen() function AdminSettingsScreen()
{ {
var
AdminMenuViewModel = require('../ViewModels/AdminMenuViewModel.js'),
AdminPaneViewModel = require('../ViewModels/AdminPaneViewModel.js')
;
AbstractSettings.call(this, [ AbstractSettings.call(this, [
AdminMenuViewModel, AdminMenuViewModel,
AdminPaneViewModel AdminPaneViewModel
@ -27,7 +30,8 @@
AdminSettingsScreen.prototype.onShow = function () AdminSettingsScreen.prototype.onShow = function ()
{ {
RL.setTitle(''); // TODO cjs var RL = require('../Boots/AdminApp.js');
RL.setTitle('');
}; };
module.exports = AdminSettingsScreen; module.exports = AdminSettingsScreen;

View file

@ -6,8 +6,7 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js'), KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js')
LoginViewModel = require('../ViewModels/LoginViewModel.js')
; ;
/** /**
@ -16,6 +15,7 @@
*/ */
function LoginScreen() function LoginScreen()
{ {
var LoginViewModel = require('../ViewModels/LoginViewModel.js');
KnoinAbstractScreen.call(this, 'login', [LoginViewModel]); KnoinAbstractScreen.call(this, 'login', [LoginViewModel]);
} }
@ -23,7 +23,8 @@
LoginScreen.prototype.onShow = function () LoginScreen.prototype.onShow = function ()
{ {
RL.setTitle(''); // TODO cjs var RL = require('../Boots/RainLoopApp.js');
RL.setTitle('');
}; };
module.exports = LoginScreen; module.exports = LoginScreen;

View file

@ -9,17 +9,16 @@
$html = require('../External/$html.js'), $html = require('../External/$html.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
Events = require('../Common/Events.js'),
KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js'), KnoinAbstractScreen = require('../Knoin/KnoinAbstractScreen.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Cache = require('../Storages/WebMailCacheStorage.js'), Cache = require('../Storages/WebMailCacheStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
MailBoxSystemDropDownViewModel = require('../ViewModels/MailBoxSystemDropDownViewModel.js'),
MailBoxFolderListViewModel = require('../ViewModels/MailBoxFolderListViewModel.js'),
MailBoxMessageListViewModel = require('../ViewModels/MailBoxMessageListViewModel.js'),
MailBoxMessageViewViewModel = require('../ViewModels/MailBoxMessageViewViewModel.js')
; ;
/** /**
@ -28,6 +27,13 @@
*/ */
function MailBoxScreen() function MailBoxScreen()
{ {
var
MailBoxSystemDropDownViewModel = require('../ViewModels/MailBoxSystemDropDownViewModel.js'),
MailBoxFolderListViewModel = require('../ViewModels/MailBoxFolderListViewModel.js'),
MailBoxMessageListViewModel = require('../ViewModels/MailBoxMessageListViewModel.js'),
MailBoxMessageViewViewModel = require('../ViewModels/MailBoxMessageViewViewModel.js')
;
KnoinAbstractScreen.call(this, 'mailbox', [ KnoinAbstractScreen.call(this, 'mailbox', [
MailBoxSystemDropDownViewModel, MailBoxSystemDropDownViewModel,
MailBoxFolderListViewModel, MailBoxFolderListViewModel,
@ -48,18 +54,19 @@
MailBoxScreen.prototype.setNewTitle = function () MailBoxScreen.prototype.setNewTitle = function ()
{ {
var var
sEmail = RL.data().accountEmail(), // TODO cjs RL = require('../Boots/RainLoopApp.js'),
ifoldersInboxUnreadCount = RL.data().foldersInboxUnreadCount() // TODO cjs sEmail = Data.accountEmail(),
nFoldersInboxUnreadCount = Data.foldersInboxUnreadCount()
; ;
// TODO cjs
RL.setTitle(('' === sEmail ? '' : RL.setTitle(('' === sEmail ? '' :
(0 < ifoldersInboxUnreadCount ? '(' + ifoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX')); (0 < nFoldersInboxUnreadCount ? '(' + nFoldersInboxUnreadCount + ') ' : ' ') + sEmail + ' - ') + Utils.i18n('TITLES/MAILBOX'));
}; };
MailBoxScreen.prototype.onShow = function () MailBoxScreen.prototype.onShow = function ()
{ {
this.setNewTitle(); this.setNewTitle();
RL.data().keyScope(Enums.KeyState.MessageList);// TODO cjs Globals.keyScope(Enums.KeyState.MessageList);
}; };
/** /**
@ -70,35 +77,35 @@
*/ */
MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview) MailBoxScreen.prototype.onRoute = function (sFolderHash, iPage, sSearch, bPreview)
{ {
var RL = require('../Boots/RainLoopApp.js');
if (Utils.isUnd(bPreview) ? false : !!bPreview) if (Utils.isUnd(bPreview) ? false : !!bPreview)
{ {
if (Enums.Layout.NoPreview === RL.data().layout() && !RL.data().message())// TODO cjs if (Enums.Layout.NoPreview === Data.layout() && !Data.message())
{ {
RL.historyBack();// TODO cjs RL.historyBack();
} }
} }
else else
{ {
var var
oData = RL.data(),// TODO cjs
sFolderFullNameRaw = Cache.getFolderFullNameRaw(sFolderHash), sFolderFullNameRaw = Cache.getFolderFullNameRaw(sFolderHash),
oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw) oFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw)
; ;
if (oFolder) if (oFolder)
{ {
oData Data
.currentFolder(oFolder) .currentFolder(oFolder)
.messageListPage(iPage) .messageListPage(iPage)
.messageListSearch(sSearch) .messageListSearch(sSearch)
; ;
if (Enums.Layout.NoPreview === oData.layout() && oData.message()) if (Enums.Layout.NoPreview === Data.layout() && Data.message())
{ {
oData.message(null); Data.message(null);
} }
RL.reloadMessageList();// TODO cjs RL.reloadMessageList();
} }
} }
}; };
@ -106,43 +113,47 @@
MailBoxScreen.prototype.onStart = function () MailBoxScreen.prototype.onStart = function ()
{ {
var var
oData = RL.data(),// TODO cjs RL = require('../Boots/RainLoopApp.js'),
fResizeFunction = function () { fResizeFunction = function () {
Utils.windowResize(); Utils.windowResize();
} }
; ;
if (RL.capa(Enums.Capa.AdditionalAccounts) || RL.capa(Enums.Capa.AdditionalIdentities))// TODO cjs if (AppSettings.capa(Enums.Capa.AdditionalAccounts) || AppSettings.capa(Enums.Capa.AdditionalIdentities))
{ {
RL.accountsAndIdentities();// TODO cjs RL.accountsAndIdentities();
} }
_.delay(function () { _.delay(function () {
if ('INBOX' !== oData.currentFolderFullNameRaw()) if ('INBOX' !== Data.currentFolderFullNameRaw())
{ {
RL.folderInformation('INBOX');// TODO cjs RL.folderInformation('INBOX');
} }
}, 1000); }, 1000);
_.delay(function () { _.delay(function () {
RL.quota();// TODO cjs RL.quota();
}, 5000); }, 5000);
_.delay(function () { _.delay(function () {
Remote.appDelayStart(Utils.emptyFunction); Remote.appDelayStart(Utils.emptyFunction);
}, 35000); }, 35000);
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === oData.layout()); $html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === Data.layout());
oData.folderList.subscribe(fResizeFunction); Data.folderList.subscribe(fResizeFunction);
oData.messageList.subscribe(fResizeFunction); Data.messageList.subscribe(fResizeFunction);
oData.message.subscribe(fResizeFunction); Data.message.subscribe(fResizeFunction);
oData.layout.subscribe(function (nValue) { Data.layout.subscribe(function (nValue) {
$html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue); $html.toggleClass('rl-no-preview-pane', Enums.Layout.NoPreview === nValue);
}); });
oData.foldersInboxUnreadCount.subscribe(function () { Events.sub('mailbox.inbox-unread-count', function (nCount) {
Data.foldersInboxUnreadCount(nCount)
});
Data.foldersInboxUnreadCount.subscribe(function () {
this.setNewTitle(); this.setNewTitle();
}, this); }, this);
}; };

View file

@ -6,12 +6,12 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
AbstractSettings = require('../AbstractSettings.js'), Globals = require('../Common/Globals.js'),
SettingsSystemDropDownViewModel = require('../ViewModels/SettingsSystemDropDownViewModel.js'),
SettingsMenuViewModel = require('../ViewModels/SettingsMenuViewModel.js'), AbstractSettings = require('./AbstractSettings.js')
SettingsPaneViewModel = require('../ViewModels/SettingsPaneViewModel.js')
; ;
/** /**
@ -20,6 +20,14 @@
*/ */
function SettingsScreen() function SettingsScreen()
{ {
var
RL = require('../Boots/RainLoopApp.js'),
SettingsSystemDropDownViewModel = require('../ViewModels/SettingsSystemDropDownViewModel.js'),
SettingsMenuViewModel = require('../ViewModels/SettingsMenuViewModel.js'),
SettingsPaneViewModel = require('../ViewModels/SettingsPaneViewModel.js')
;
AbstractSettings.call(this, [ AbstractSettings.call(this, [
SettingsSystemDropDownViewModel, SettingsSystemDropDownViewModel,
SettingsMenuViewModel, SettingsMenuViewModel,
@ -29,7 +37,7 @@
Utils.initOnStartOrLangChange(function () { Utils.initOnStartOrLangChange(function () {
this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS'); this.sSettingsTitle = Utils.i18n('TITLES/SETTINGS');
}, this, function () { }, this, function () {
RL.setTitle(this.sSettingsTitle); // TODO cjs RL.setTitle(this.sSettingsTitle);
}); });
} }
@ -37,8 +45,10 @@
SettingsScreen.prototype.onShow = function () SettingsScreen.prototype.onShow = function ()
{ {
RL.setTitle(this.sSettingsTitle); // TODO cjs var RL = require('../Boots/RainLoopApp.js');
RL.data().keyScope(Enums.KeyState.Settings); // TODO cjs
RL.setTitle(this.sSettingsTitle);
Globals.keyScope(Enums.KeyState.Settings);
}; };
module.exports = SettingsScreen; module.exports = SettingsScreen;

View file

@ -13,6 +13,7 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
@ -24,12 +25,10 @@
*/ */
function SettingsAccounts() function SettingsAccounts()
{ {
var oData = RL.data(); this.accounts = Data.accounts;
this.accounts = oData.accounts;
this.processText = ko.computed(function () { this.processText = ko.computed(function () {
return oData.accountsLoading() ? Utils.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : ''; return Data.accountsLoading() ? Utils.i18n('SETTINGS_ACCOUNTS/LOADING_PROCESS') : '';
}, this); }, this);
this.visibility = ko.computed(function () { this.visibility = ko.computed(function () {
@ -51,8 +50,6 @@
]}); ]});
} }
kn.addSettingsViewModel(SettingsAccounts, 'SettingsAccounts', 'SETTINGS_LABELS/LABEL_ACCOUNTS_NAME', 'accounts');
SettingsAccounts.prototype.addNewAccount = function () SettingsAccounts.prototype.addNewAccount = function ()
{ {
kn.showScreenPopup(PopupsAddAccountViewModel); kn.showScreenPopup(PopupsAddAccountViewModel);
@ -68,6 +65,7 @@
this.accountForDeletion(null); this.accountForDeletion(null);
var var
RL = require('../Boots/RainLoopApp.js'),
fRemoveAccount = function (oAccount) { fRemoveAccount = function (oAccount) {
return oAccountToRemove === oAccount; return oAccountToRemove === oAccount;
} }

View file

@ -77,8 +77,6 @@
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this); this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
} }
kn.addSettingsViewModel(SettingsChangePassword, 'SettingsChangePassword', 'SETTINGS_LABELS/LABEL_CHANGE_PASSWORD_NAME', 'change-password');
SettingsChangePassword.prototype.onHide = function () SettingsChangePassword.prototype.onHide = function ()
{ {
this.changeProcess(false); this.changeProcess(false);

View file

@ -9,7 +9,9 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js') Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
Data = require('../Storages/WebMailDataStorage.js')
; ;
/** /**
@ -17,15 +19,13 @@
*/ */
function SettingsContacts() function SettingsContacts()
{ {
var oData = RL.data(); this.contactsAutosave = Data.contactsAutosave;
this.contactsAutosave = oData.contactsAutosave; this.allowContactsSync = Data.allowContactsSync;
this.enableContactsSync = Data.enableContactsSync;
this.allowContactsSync = oData.allowContactsSync; this.contactsSyncUrl = Data.contactsSyncUrl;
this.enableContactsSync = oData.enableContactsSync; this.contactsSyncUser = Data.contactsSyncUser;
this.contactsSyncUrl = oData.contactsSyncUrl; this.contactsSyncPass = Data.contactsSyncPass;
this.contactsSyncUser = oData.contactsSyncUser;
this.contactsSyncPass = oData.contactsSyncPass;
this.saveTrigger = ko.computed(function () { this.saveTrigger = ko.computed(function () {
return [ return [
@ -46,11 +46,9 @@
}, this); }, this);
} }
kn.addSettingsViewModel(SettingsContacts, 'SettingsContacts', 'SETTINGS_LABELS/LABEL_CONTACTS_NAME', 'contacts');
SettingsContacts.prototype.onBuild = function () SettingsContacts.prototype.onBuild = function ()
{ {
RL.data().contactsAutosave.subscribe(function (bValue) { Data.contactsAutosave.subscribe(function (bValue) {
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'ContactsAutosave': bValue ? '1' : '0' 'ContactsAutosave': bValue ? '1' : '0'
}); });

View file

@ -7,6 +7,7 @@
var var
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
PopupsFilterViewModel = require('../ViewModels/Popups/PopupsFilterViewModel.js') PopupsFilterViewModel = require('../ViewModels/Popups/PopupsFilterViewModel.js')
; ;
@ -23,8 +24,6 @@
}); });
} }
kn.addSettingsViewModel(SettingsFilters, 'SettingsFilters', 'SETTINGS_LABELS/LABEL_FILTERS_NAME', 'filters');
SettingsFilters.prototype.deleteFilter = function (oFilter) SettingsFilters.prototype.deleteFilter = function (oFilter)
{ {
this.filters.remove(oFilter); this.filters.remove(oFilter);

View file

@ -9,10 +9,16 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
AppSettings = require('../Storages/AppSettings.js'),
LocalStorage = require('../Storages/LocalStorage.js'), LocalStorage = require('../Storages/LocalStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Cache = require('../Storages/WebMailCacheStorage.js'), Cache = require('../Storages/WebMailCacheStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
PopupsFolderCreateViewModel = require('../ViewModels/Popups/PopupsFolderCreateViewModel.js'), PopupsFolderCreateViewModel = require('../ViewModels/Popups/PopupsFolderCreateViewModel.js'),
PopupsFolderSystemViewModel = require('../ViewModels/Popups/PopupsFolderSystemViewModel.js') PopupsFolderSystemViewModel = require('../ViewModels/Popups/PopupsFolderSystemViewModel.js')
; ;
@ -22,19 +28,16 @@
*/ */
function SettingsFolders() function SettingsFolders()
{ {
var oData = RL.data(); this.foldersListError = Data.foldersListError;
this.folderList = Data.folderList;
this.foldersListError = oData.foldersListError;
this.folderList = oData.folderList;
this.processText = ko.computed(function () { this.processText = ko.computed(function () {
var var
oData = RL.data(), bLoading = Data.foldersLoading(),
bLoading = oData.foldersLoading(), bCreating = Data.foldersCreating(),
bCreating = oData.foldersCreating(), bDeleting = Data.foldersDeleting(),
bDeleting = oData.foldersDeleting(), bRenaming = Data.foldersRenaming()
bRenaming = oData.foldersRenaming()
; ;
if (bCreating) if (bCreating)
@ -90,11 +93,9 @@
} }
]}); ]});
this.useImapSubscribe = !!RL.settingsGet('UseImapSubscribe'); this.useImapSubscribe = !!AppSettings.settingsGet('UseImapSubscribe');
} }
kn.addSettingsViewModel(SettingsFolders, 'SettingsFolders', 'SETTINGS_LABELS/LABEL_FOLDERS_NAME', 'folders');
SettingsFolders.prototype.folderEditOnEnter = function (oFolder) SettingsFolders.prototype.folderEditOnEnter = function (oFolder)
{ {
var sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : ''; var sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : '';
@ -102,13 +103,13 @@
{ {
LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, ''); LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
RL.data().foldersRenaming(true); Data.foldersRenaming(true);
Remote.folderRename(function (sResult, oData) { Remote.folderRename(function (sResult, oData) {
RL.data().foldersRenaming(false); Data.foldersRenaming(false);
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result) if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{ {
RL.data().foldersListError( Data.foldersListError(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER')); oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_RENAME_FOLDER'));
} }
@ -134,7 +135,7 @@
SettingsFolders.prototype.onShow = function () SettingsFolders.prototype.onShow = function ()
{ {
RL.data().foldersListError(''); Data.foldersListError('');
}; };
SettingsFolders.prototype.createFolder = function () SettingsFolders.prototype.createFolder = function ()
@ -171,15 +172,15 @@
{ {
LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, ''); LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, '');
RL.data().folderList.remove(fRemoveFolder); Data.folderList.remove(fRemoveFolder);
RL.data().foldersDeleting(true); Data.foldersDeleting(true);
Remote.folderDelete(function (sResult, oData) { Remote.folderDelete(function (sResult, oData) {
RL.data().foldersDeleting(false); Data.foldersDeleting(false);
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result) if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
{ {
RL.data().foldersListError( Data.foldersListError(
oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER')); oData && oData.ErrorCode ? Utils.getNotification(oData.ErrorCode) : Utils.i18n('NOTIFICATIONS/CANT_DELETE_FOLDER'));
} }
@ -192,7 +193,7 @@
} }
else if (0 < oFolderToRemove.privateMessageCountAll()) else if (0 < oFolderToRemove.privateMessageCountAll())
{ {
RL.data().foldersListError(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder)); Data.foldersListError(Utils.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
} }
}; };

View file

@ -5,6 +5,7 @@
'use strict'; 'use strict';
var var
$ = require('../External/jquery.js'),
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
@ -13,6 +14,7 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
@ -24,30 +26,28 @@
*/ */
function SettingsGeneral() function SettingsGeneral()
{ {
var oData = RL.data(); this.mainLanguage = Data.mainLanguage;
this.mainMessagesPerPage = Data.mainMessagesPerPage;
this.mainLanguage = oData.mainLanguage;
this.mainMessagesPerPage = oData.mainMessagesPerPage;
this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray; this.mainMessagesPerPageArray = Consts.Defaults.MessagesPerPageArray;
this.editorDefaultType = oData.editorDefaultType; this.editorDefaultType = Data.editorDefaultType;
this.showImages = oData.showImages; this.showImages = Data.showImages;
this.interfaceAnimation = oData.interfaceAnimation; this.interfaceAnimation = Data.interfaceAnimation;
this.useDesktopNotifications = oData.useDesktopNotifications; this.useDesktopNotifications = Data.useDesktopNotifications;
this.threading = oData.threading; this.threading = Data.threading;
this.useThreads = oData.useThreads; this.useThreads = Data.useThreads;
this.replySameFolder = oData.replySameFolder; this.replySameFolder = Data.replySameFolder;
this.layout = oData.layout; this.layout = Data.layout;
this.usePreviewPane = oData.usePreviewPane; this.usePreviewPane = Data.usePreviewPane;
this.useCheckboxesInList = oData.useCheckboxesInList; this.useCheckboxesInList = Data.useCheckboxesInList;
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings; this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
this.isDesktopNotificationsSupported = ko.computed(function () { this.isDesktopNotificationsSupported = ko.computed(function () {
return Enums.DesktopNotifications.NotSupported !== oData.desktopNotificationsPermisions(); return Enums.DesktopNotifications.NotSupported !== Data.desktopNotificationsPermisions();
}); });
this.isDesktopNotificationsDenied = ko.computed(function () { this.isDesktopNotificationsDenied = ko.computed(function () {
return Enums.DesktopNotifications.NotSupported === oData.desktopNotificationsPermisions() || return Enums.DesktopNotifications.NotSupported === Data.desktopNotificationsPermisions() ||
Enums.DesktopNotifications.Denied === oData.desktopNotificationsPermisions(); Enums.DesktopNotifications.Denied === Data.desktopNotificationsPermisions();
}); });
this.mainLanguageFullName = ko.computed(function () { this.mainLanguageFullName = ko.computed(function () {
@ -60,8 +60,6 @@
this.isAnimationSupported = Globals.bAnimationSupported; this.isAnimationSupported = Globals.bAnimationSupported;
} }
kn.addSettingsViewModel(SettingsGeneral, 'SettingsGeneral', 'SETTINGS_LABELS/LABEL_GENERAL_NAME', 'general', true);
SettingsGeneral.prototype.toggleLayout = function () SettingsGeneral.prototype.toggleLayout = function ()
{ {
this.layout(Enums.Layout.NoPreview === this.layout() ? Enums.Layout.SidePreview : Enums.Layout.NoPreview); this.layout(Enums.Layout.NoPreview === this.layout() ? Enums.Layout.SidePreview : Enums.Layout.NoPreview);
@ -74,11 +72,10 @@
_.delay(function () { _.delay(function () {
var var
oData = RL.data(),
f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self) f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self)
; ;
oData.language.subscribe(function (sValue) { Data.language.subscribe(function (sValue) {
self.languageTrigger(Enums.SaveSettingsStep.Animate); self.languageTrigger(Enums.SaveSettingsStep.Animate);
@ -102,31 +99,31 @@
}); });
}); });
oData.editorDefaultType.subscribe(function (sValue) { Data.editorDefaultType.subscribe(function (sValue) {
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'EditorDefaultType': sValue 'EditorDefaultType': sValue
}); });
}); });
oData.messagesPerPage.subscribe(function (iValue) { Data.messagesPerPage.subscribe(function (iValue) {
Remote.saveSettings(f1, { Remote.saveSettings(f1, {
'MPP': iValue 'MPP': iValue
}); });
}); });
oData.showImages.subscribe(function (bValue) { Data.showImages.subscribe(function (bValue) {
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'ShowImages': bValue ? '1' : '0' 'ShowImages': bValue ? '1' : '0'
}); });
}); });
oData.interfaceAnimation.subscribe(function (sValue) { Data.interfaceAnimation.subscribe(function (sValue) {
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'InterfaceAnimation': sValue 'InterfaceAnimation': sValue
}); });
}); });
oData.useDesktopNotifications.subscribe(function (bValue) { Data.useDesktopNotifications.subscribe(function (bValue) {
Utils.timeOutAction('SaveDesktopNotifications', function () { Utils.timeOutAction('SaveDesktopNotifications', function () {
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'DesktopNotifications': bValue ? '1' : '0' 'DesktopNotifications': bValue ? '1' : '0'
@ -134,7 +131,7 @@
}, 3000); }, 3000);
}); });
oData.replySameFolder.subscribe(function (bValue) { Data.replySameFolder.subscribe(function (bValue) {
Utils.timeOutAction('SaveReplySameFolder', function () { Utils.timeOutAction('SaveReplySameFolder', function () {
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'ReplySameFolder': bValue ? '1' : '0' 'ReplySameFolder': bValue ? '1' : '0'
@ -142,25 +139,25 @@
}, 3000); }, 3000);
}); });
oData.useThreads.subscribe(function (bValue) { Data.useThreads.subscribe(function (bValue) {
oData.messageList([]); Data.messageList([]);
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'UseThreads': bValue ? '1' : '0' 'UseThreads': bValue ? '1' : '0'
}); });
}); });
oData.layout.subscribe(function (nValue) { Data.layout.subscribe(function (nValue) {
oData.messageList([]); Data.messageList([]);
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'Layout': nValue 'Layout': nValue
}); });
}); });
oData.useCheckboxesInList.subscribe(function (bValue) { Data.useCheckboxesInList.subscribe(function (bValue) {
Remote.saveSettings(Utils.emptyFunction, { Remote.saveSettings(Utils.emptyFunction, {
'UseCheckboxesInList': bValue ? '1' : '0' 'UseCheckboxesInList': bValue ? '1' : '0'
}); });
@ -171,7 +168,7 @@
SettingsGeneral.prototype.onShow = function () SettingsGeneral.prototype.onShow = function ()
{ {
RL.data().desktopNotifications.valueHasMutated(); Data.desktopNotifications.valueHasMutated();
}; };
SettingsGeneral.prototype.selectLanguage = function () SettingsGeneral.prototype.selectLanguage = function ()

View file

@ -9,9 +9,13 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
PopupsIdentityViewModel = require('../ViewModels/Popups/PopupsIdentityViewModel.js') PopupsIdentityViewModel = require('../ViewModels/Popups/PopupsIdentityViewModel.js')
; ;
@ -21,16 +25,14 @@
*/ */
function SettingsIdentities() function SettingsIdentities()
{ {
var oData = RL.data();
this.editor = null; this.editor = null;
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender; this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
this.accountEmail = oData.accountEmail; this.accountEmail = Data.accountEmail;
this.displayName = oData.displayName; this.displayName = Data.displayName;
this.signature = oData.signature; this.signature = Data.signature;
this.signatureToAll = oData.signatureToAll; this.signatureToAll = Data.signatureToAll;
this.replyTo = oData.replyTo; this.replyTo = Data.replyTo;
this.signatureDom = ko.observable(null); this.signatureDom = ko.observable(null);
@ -39,8 +41,8 @@
this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.replyTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
this.identities = oData.identities; this.identities = Data.identities;
this.defaultIdentityID = oData.defaultIdentityID; this.defaultIdentityID = Data.defaultIdentityID;
this.identitiesOptions = ko.computed(function () { this.identitiesOptions = ko.computed(function () {
@ -77,7 +79,7 @@
}, this); }, this);
this.processText = ko.computed(function () { this.processText = ko.computed(function () {
return oData.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : ''; return Data.identitiesLoading() ? Utils.i18n('SETTINGS_IDENTITIES/LOADING_PROCESS') : '';
}, this); }, this);
this.visibility = ko.computed(function () { this.visibility = ko.computed(function () {
@ -99,8 +101,6 @@
]}); ]});
} }
kn.addSettingsViewModel(SettingsIdentities, 'SettingsIdentities', 'SETTINGS_LABELS/LABEL_IDENTITIES_NAME', 'identities');
/** /**
* *
* @return {string} * @return {string}
@ -157,11 +157,11 @@
{ {
var var
self = this, self = this,
sSignature = RL.data().signature() sSignature = Data.signature()
; ;
this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () { this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () {
RL.data().signature( Data.signature(
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData() (self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
); );
}, function () { }, function () {
@ -194,38 +194,37 @@
_.delay(function () { _.delay(function () {
var var
oData = RL.data(),
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self), f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self), f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self), f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self),
f4 = Utils.settingsSaveHelperSimpleFunction(self.defaultIdentityIDTrigger, self) f4 = Utils.settingsSaveHelperSimpleFunction(self.defaultIdentityIDTrigger, self)
; ;
oData.defaultIdentityID.subscribe(function (sValue) { Data.defaultIdentityID.subscribe(function (sValue) {
Remote.saveSettings(f4, { Remote.saveSettings(f4, {
'DefaultIdentityID': sValue 'DefaultIdentityID': sValue
}); });
}); });
oData.displayName.subscribe(function (sValue) { Data.displayName.subscribe(function (sValue) {
Remote.saveSettings(f1, { Remote.saveSettings(f1, {
'DisplayName': sValue 'DisplayName': sValue
}); });
}); });
oData.replyTo.subscribe(function (sValue) { Data.replyTo.subscribe(function (sValue) {
Remote.saveSettings(f2, { Remote.saveSettings(f2, {
'ReplyTo': sValue 'ReplyTo': sValue
}); });
}); });
oData.signature.subscribe(function (sValue) { Data.signature.subscribe(function (sValue) {
Remote.saveSettings(f3, { Remote.saveSettings(f3, {
'Signature': sValue 'Signature': sValue
}); });
}); });
oData.signatureToAll.subscribe(function (bValue) { Data.signatureToAll.subscribe(function (bValue) {
Remote.saveSettings(null, { Remote.saveSettings(null, {
'SignatureToAll': bValue ? '1' : '0' 'SignatureToAll': bValue ? '1' : '0'
}); });

View file

@ -9,7 +9,9 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
NewHtmlEditorWrapper = require('../Common/NewHtmlEditorWrapper.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js') Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
; ;
@ -18,14 +20,12 @@
*/ */
function SettingsIdentity() function SettingsIdentity()
{ {
var oData = RL.data();
this.editor = null; this.editor = null;
this.displayName = oData.displayName; this.displayName = Data.displayName;
this.signature = oData.signature; this.signature = Data.signature;
this.signatureToAll = oData.signatureToAll; this.signatureToAll = Data.signatureToAll;
this.replyTo = oData.replyTo; this.replyTo = Data.replyTo;
this.signatureDom = ko.observable(null); this.signatureDom = ko.observable(null);
@ -34,19 +34,17 @@
this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.signatureTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
} }
kn.addSettingsViewModel(SettingsIdentity, 'SettingsIdentity', 'SETTINGS_LABELS/LABEL_IDENTITY_NAME', 'identity');
SettingsIdentity.prototype.onFocus = function () SettingsIdentity.prototype.onFocus = function ()
{ {
if (!this.editor && this.signatureDom()) if (!this.editor && this.signatureDom())
{ {
var var
self = this, self = this,
sSignature = RL.data().signature() sSignature = Data.signature()
; ;
this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () { this.editor = new NewHtmlEditorWrapper(self.signatureDom(), function () {
RL.data().signature( Data.signature(
(self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData() (self.editor.isHtml() ? ':HTML:' : '') + self.editor.getData()
); );
}, function () { }, function () {
@ -68,31 +66,30 @@
_.delay(function () { _.delay(function () {
var var
oData = RL.data(),
f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self), f1 = Utils.settingsSaveHelperSimpleFunction(self.displayNameTrigger, self),
f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self), f2 = Utils.settingsSaveHelperSimpleFunction(self.replyTrigger, self),
f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self) f3 = Utils.settingsSaveHelperSimpleFunction(self.signatureTrigger, self)
; ;
oData.displayName.subscribe(function (sValue) { Data.displayName.subscribe(function (sValue) {
Remote.saveSettings(f1, { Remote.saveSettings(f1, {
'DisplayName': sValue 'DisplayName': sValue
}); });
}); });
oData.replyTo.subscribe(function (sValue) { Data.replyTo.subscribe(function (sValue) {
Remote.saveSettings(f2, { Remote.saveSettings(f2, {
'ReplyTo': sValue 'ReplyTo': sValue
}); });
}); });
oData.signature.subscribe(function (sValue) { Data.signature.subscribe(function (sValue) {
Remote.saveSettings(f3, { Remote.saveSettings(f3, {
'Signature': sValue 'Signature': sValue
}); });
}); });
oData.signatureToAll.subscribe(function (bValue) { Data.signatureToAll.subscribe(function (bValue) {
Remote.saveSettings(null, { Remote.saveSettings(null, {
'SignatureToAll': bValue ? '1' : '0' 'SignatureToAll': bValue ? '1' : '0'
}); });

View file

@ -6,7 +6,12 @@
var var
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
Utils = require('../Common/Utils.js'),
kn = require('../Knoin/Knoin.js'),
Data = require('../Storages/WebMailDataStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
PopupsAddOpenPgpKeyViewModel = require('../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js'), PopupsAddOpenPgpKeyViewModel = require('../ViewModels/Popups/PopupsAddOpenPgpKeyViewModel.js'),
PopupsGenerateNewOpenPgpKeyViewModel = require('../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js'), PopupsGenerateNewOpenPgpKeyViewModel = require('../ViewModels/Popups/PopupsGenerateNewOpenPgpKeyViewModel.js'),
@ -18,9 +23,9 @@
*/ */
function SettingsOpenPGP() function SettingsOpenPGP()
{ {
this.openpgpkeys = RL.data().openpgpkeys; this.openpgpkeys = Data.openpgpkeys;
this.openpgpkeysPublic = RL.data().openpgpkeysPublic; this.openpgpkeysPublic = Data.openpgpkeysPublic;
this.openpgpkeysPrivate = RL.data().openpgpkeysPrivate; this.openpgpkeysPrivate = Data.openpgpkeysPrivate;
this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this, this.openPgpKeyForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend({'toggleSubscribe': [this,
function (oPrev) { function (oPrev) {
@ -37,8 +42,6 @@
]}); ]});
} }
kn.addSettingsViewModel(SettingsOpenPGP, 'SettingsOpenPGP', 'SETTINGS_LABELS/LABEL_OPEN_PGP_NAME', 'openpgp');
SettingsOpenPGP.prototype.addOpenPgpKey = function () SettingsOpenPGP.prototype.addOpenPgpKey = function ()
{ {
kn.showScreenPopup(PopupsAddOpenPgpKeyViewModel); kn.showScreenPopup(PopupsAddOpenPgpKeyViewModel);
@ -66,16 +69,16 @@
{ {
this.openPgpKeyForDeletion(null); this.openPgpKeyForDeletion(null);
if (oOpenPgpKeyToRemove && RL.data().openpgpKeyring) if (oOpenPgpKeyToRemove && Data.openpgpKeyring)
{ {
this.openpgpkeys.remove(function (oOpenPgpKey) { this.openpgpkeys.remove(function (oOpenPgpKey) {
return oOpenPgpKeyToRemove === oOpenPgpKey; return oOpenPgpKeyToRemove === oOpenPgpKey;
}); });
RL.data().openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys'] Data.openpgpKeyring[oOpenPgpKeyToRemove.isPrivate ? 'privateKeys' : 'publicKeys']
.removeForId(oOpenPgpKeyToRemove.guid); .removeForId(oOpenPgpKeyToRemove.guid);
RL.data().openpgpKeyring.store(); Data.openpgpKeyring.store();
RL.reloadOpenPgpKeys(); RL.reloadOpenPgpKeys();
} }

View file

@ -7,7 +7,7 @@
var var
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
Enums = require('../Common/Utils.js'), Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'), Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
@ -50,8 +50,6 @@
this.onSecretResult = _.bind(this.onSecretResult, this); this.onSecretResult = _.bind(this.onSecretResult, this);
} }
kn.addSettingsViewModel(SettingsSecurity, 'SettingsSecurity', 'SETTINGS_LABELS/LABEL_SECURITY_NAME', 'security');
SettingsSecurity.prototype.showSecret = function () SettingsSecurity.prototype.showSecret = function ()
{ {
this.secreting(true); this.secreting(true);

View file

@ -5,7 +5,11 @@
'use strict'; 'use strict';
var var
Utils = require('../Common/Utils.js') Utils = require('../Common/Utils.js'),
Data = require('../Storages/WebMailDataStorage.js'),
RL = require('../Boots/RainLoopApp.js')
; ;
/** /**
@ -13,25 +17,23 @@
*/ */
function SettingsSocial() function SettingsSocial()
{ {
var oData = RL.data(); this.googleEnable = Data.googleEnable;
this.googleEnable = oData.googleEnable; this.googleActions = Data.googleActions;
this.googleLoggined = Data.googleLoggined;
this.googleUserName = Data.googleUserName;
this.googleActions = oData.googleActions; this.facebookEnable = Data.facebookEnable;
this.googleLoggined = oData.googleLoggined;
this.googleUserName = oData.googleUserName;
this.facebookEnable = oData.facebookEnable; this.facebookActions = Data.facebookActions;
this.facebookLoggined = Data.facebookLoggined;
this.facebookUserName = Data.facebookUserName;
this.facebookActions = oData.facebookActions; this.twitterEnable = Data.twitterEnable;
this.facebookLoggined = oData.facebookLoggined;
this.facebookUserName = oData.facebookUserName;
this.twitterEnable = oData.twitterEnable; this.twitterActions = Data.twitterActions;
this.twitterLoggined = Data.twitterLoggined;
this.twitterActions = oData.twitterActions; this.twitterUserName = Data.twitterUserName;
this.twitterLoggined = oData.twitterLoggined;
this.twitterUserName = oData.twitterUserName;
this.connectGoogle = Utils.createCommand(this, function () { this.connectGoogle = Utils.createCommand(this, function () {
if (!this.googleLoggined()) if (!this.googleLoggined())
@ -73,8 +75,6 @@
}); });
} }
kn.addSettingsViewModel(SettingsSocial, 'SettingsSocial', 'SETTINGS_LABELS/LABEL_SOCIAL_NAME', 'social');
module.exports = SettingsSocial; module.exports = SettingsSocial;
}(module)); }(module));

View file

@ -13,6 +13,7 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js') Remote = require('../Storages/WebMailAjaxRemoteStorage.js')
; ;
@ -21,12 +22,9 @@
*/ */
function SettingsThemes() function SettingsThemes()
{ {
var var self = this;
self = this,
oData = RL.data()
;
this.mainTheme = oData.mainTheme; this.mainTheme = Data.mainTheme;
this.themesObjects = ko.observableArray([]); this.themesObjects = ko.observableArray([]);
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100}); this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
@ -34,7 +32,7 @@
this.oLastAjax = null; this.oLastAjax = null;
this.iTimer = 0; this.iTimer = 0;
RL.data().theme.subscribe(function (sValue) { Data.theme.subscribe(function (sValue) {
_.each(this.themesObjects(), function (oTheme) { _.each(this.themesObjects(), function (oTheme) {
oTheme.selected(sValue === oTheme.name); oTheme.selected(sValue === oTheme.name);
@ -116,12 +114,10 @@
}, this); }, this);
} }
kn.addSettingsViewModel(SettingsThemes, 'SettingsThemes', 'SETTINGS_LABELS/LABEL_THEMES_NAME', 'themes');
SettingsThemes.prototype.onBuild = function () SettingsThemes.prototype.onBuild = function ()
{ {
var sCurrentTheme = RL.data().theme(); var sCurrentTheme = Data.theme();
this.themesObjects(_.map(RL.data().themes(), function (sTheme) { this.themesObjects(_.map(Data.themes(), function (sTheme) {
return { return {
'name': sTheme, 'name': sTheme,
'nameDisplay': Utils.convertThemeName(sTheme), 'nameDisplay': Utils.convertThemeName(sTheme),

View file

@ -15,7 +15,7 @@
Plugins = require('../Common/Plugins.js'), Plugins = require('../Common/Plugins.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
RL = require('../RL.js') AppSettings = require('./AppSettings.js')
; ;
/** /**
@ -63,7 +63,10 @@
if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount) if (Consts.Values.TokenErrorLimit < Globals.iTokenErrorCount)
{ {
RL().loginAndLogoutReload(true); if (Globals.__RL)
{
Globals.__RL.loginAndLogoutReload(true);
}
} }
if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount) if (oData.Logout || Consts.Values.AjaxErrorLimit < Globals.iAjaxErrorCount)
@ -73,7 +76,10 @@
window.__rlah_clear(); window.__rlah_clear();
} }
RL().loginAndLogoutReload(true); if (Globals.__RL)
{
Globals.__RL.loginAndLogoutReload(true);
}
} }
} }
else if (Enums.StorageResultType.Success === sType && oData && oData.Result) else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
@ -163,7 +169,7 @@
if (bPost) if (bPost)
{ {
oParameters['XToken'] = RL.settingsGet('Token'); // TODO cjs oParameters['XToken'] = AppSettings.settingsGet('Token');
} }
oDefAjax = $.ajax({ oDefAjax = $.ajax({

View file

@ -5,11 +5,10 @@
'use strict'; 'use strict';
var var
ko = require('../External/ko.js'),
key = require('../External/key.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'), Utils = require('../Common/Utils.js'),
Utils = require('../Common/Utils.js')
AppSettings = require('./AppSettings.js')
; ;
/** /**
@ -17,71 +16,15 @@
*/ */
function AbstractData() function AbstractData()
{ {
this.leftPanelDisabled = ko.observable(false);
this.useKeyboardShortcuts = ko.observable(true);
this.keyScopeReal = ko.observable(Enums.KeyState.All);
this.keyScopeFake = ko.observable(Enums.KeyState.All);
this.keyScope = ko.computed({
'owner': this,
'read': function () {
return this.keyScopeFake();
},
'write': function (sValue) {
if (Enums.KeyState.Menu !== sValue)
{
if (Enums.KeyState.Compose === sValue)
{
Utils.disableKeyFilter();
}
else
{
Utils.restoreKeyFilter();
}
this.keyScopeFake(sValue);
if (Globals.dropdownVisibility())
{
sValue = Enums.KeyState.Menu;
}
}
this.keyScopeReal(sValue);
}
});
this.keyScopeReal.subscribe(function (sValue) {
// window.console.log(sValue);
key.setScope(sValue);
});
this.leftPanelDisabled.subscribe(function (bValue) {
RL.pub('left-panel.' + (bValue ? 'off' : 'on')); // TODO cjs
});
Globals.dropdownVisibility.subscribe(function (bValue) {
if (bValue)
{
Globals.tooltipTrigger(!Globals.tooltipTrigger());
this.keyScope(Enums.KeyState.Menu);
}
else if (Enums.KeyState.Menu === key.getScope())
{
this.keyScope(this.keyScopeFake());
}
}, this);
Utils.initDataConstructorBySettings(this); Utils.initDataConstructorBySettings(this);
} }
AbstractData.prototype.populateDataOnStart = function() AbstractData.prototype.populateDataOnStart = function()
{ {
var var
mLayout = Utils.pInt(RL.settingsGet('Layout')), // TODO cjs mLayout = Utils.pInt(AppSettings.settingsGet('Layout')),
aLanguages = RL.settingsGet('Languages'), aLanguages = AppSettings.settingsGet('Languages'),
aThemes = RL.settingsGet('Themes') aThemes = AppSettings.settingsGet('Themes')
; ;
if (Utils.isArray(aLanguages)) if (Utils.isArray(aLanguages))
@ -94,55 +37,55 @@
this.themes(aThemes); this.themes(aThemes);
} }
this.mainLanguage(RL.settingsGet('Language')); this.mainLanguage(AppSettings.settingsGet('Language'));
this.mainTheme(RL.settingsGet('Theme')); this.mainTheme(AppSettings.settingsGet('Theme'));
this.capaAdditionalAccounts(RL.capa(Enums.Capa.AdditionalAccounts)); this.capaAdditionalAccounts(AppSettings.capa(Enums.Capa.AdditionalAccounts));
this.capaAdditionalIdentities(RL.capa(Enums.Capa.AdditionalIdentities)); this.capaAdditionalIdentities(AppSettings.capa(Enums.Capa.AdditionalIdentities));
this.capaGravatar(RL.capa(Enums.Capa.Gravatar)); this.capaGravatar(AppSettings.capa(Enums.Capa.Gravatar));
this.determineUserLanguage(!!RL.settingsGet('DetermineUserLanguage')); this.determineUserLanguage(!!AppSettings.settingsGet('DetermineUserLanguage'));
this.determineUserDomain(!!RL.settingsGet('DetermineUserDomain')); this.determineUserDomain(!!AppSettings.settingsGet('DetermineUserDomain'));
this.capaThemes(RL.capa(Enums.Capa.Themes)); this.capaThemes(AppSettings.capa(Enums.Capa.Themes));
this.allowLanguagesOnLogin(!!RL.settingsGet('AllowLanguagesOnLogin')); this.allowLanguagesOnLogin(!!AppSettings.settingsGet('AllowLanguagesOnLogin'));
this.allowLanguagesOnSettings(!!RL.settingsGet('AllowLanguagesOnSettings')); this.allowLanguagesOnSettings(!!AppSettings.settingsGet('AllowLanguagesOnSettings'));
this.useLocalProxyForExternalImages(!!RL.settingsGet('UseLocalProxyForExternalImages')); this.useLocalProxyForExternalImages(!!AppSettings.settingsGet('UseLocalProxyForExternalImages'));
this.editorDefaultType(RL.settingsGet('EditorDefaultType')); this.editorDefaultType(AppSettings.settingsGet('EditorDefaultType'));
this.showImages(!!RL.settingsGet('ShowImages')); this.showImages(!!AppSettings.settingsGet('ShowImages'));
this.contactsAutosave(!!RL.settingsGet('ContactsAutosave')); this.contactsAutosave(!!AppSettings.settingsGet('ContactsAutosave'));
this.interfaceAnimation(RL.settingsGet('InterfaceAnimation')); this.interfaceAnimation(AppSettings.settingsGet('InterfaceAnimation'));
this.mainMessagesPerPage(RL.settingsGet('MPP')); this.mainMessagesPerPage(AppSettings.settingsGet('MPP'));
this.desktopNotifications(!!RL.settingsGet('DesktopNotifications')); this.desktopNotifications(!!AppSettings.settingsGet('DesktopNotifications'));
this.useThreads(!!RL.settingsGet('UseThreads')); this.useThreads(!!AppSettings.settingsGet('UseThreads'));
this.replySameFolder(!!RL.settingsGet('ReplySameFolder')); this.replySameFolder(!!AppSettings.settingsGet('ReplySameFolder'));
this.useCheckboxesInList(!!RL.settingsGet('UseCheckboxesInList')); this.useCheckboxesInList(!!AppSettings.settingsGet('UseCheckboxesInList'));
this.layout(Enums.Layout.SidePreview); this.layout(Enums.Layout.SidePreview);
if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview])) if (-1 < Utils.inArray(mLayout, [Enums.Layout.NoPreview, Enums.Layout.SidePreview, Enums.Layout.BottomPreview]))
{ {
this.layout(mLayout); this.layout(mLayout);
} }
this.facebookSupported(!!RL.settingsGet('SupportedFacebookSocial')); this.facebookSupported(!!AppSettings.settingsGet('SupportedFacebookSocial'));
this.facebookEnable(!!RL.settingsGet('AllowFacebookSocial')); this.facebookEnable(!!AppSettings.settingsGet('AllowFacebookSocial'));
this.facebookAppID(RL.settingsGet('FacebookAppID')); this.facebookAppID(AppSettings.settingsGet('FacebookAppID'));
this.facebookAppSecret(RL.settingsGet('FacebookAppSecret')); this.facebookAppSecret(AppSettings.settingsGet('FacebookAppSecret'));
this.twitterEnable(!!RL.settingsGet('AllowTwitterSocial')); this.twitterEnable(!!AppSettings.settingsGet('AllowTwitterSocial'));
this.twitterConsumerKey(RL.settingsGet('TwitterConsumerKey')); this.twitterConsumerKey(AppSettings.settingsGet('TwitterConsumerKey'));
this.twitterConsumerSecret(RL.settingsGet('TwitterConsumerSecret')); this.twitterConsumerSecret(AppSettings.settingsGet('TwitterConsumerSecret'));
this.googleEnable(!!RL.settingsGet('AllowGoogleSocial')); this.googleEnable(!!AppSettings.settingsGet('AllowGoogleSocial'));
this.googleClientID(RL.settingsGet('GoogleClientID')); this.googleClientID(AppSettings.settingsGet('GoogleClientID'));
this.googleClientSecret(RL.settingsGet('GoogleClientSecret')); this.googleClientSecret(AppSettings.settingsGet('GoogleClientSecret'));
this.googleApiKey(RL.settingsGet('GoogleApiKey')); this.googleApiKey(AppSettings.settingsGet('GoogleApiKey'));
this.dropboxEnable(!!RL.settingsGet('AllowDropboxSocial')); this.dropboxEnable(!!AppSettings.settingsGet('AllowDropboxSocial'));
this.dropboxApiKey(RL.settingsGet('DropboxApiKey')); this.dropboxApiKey(AppSettings.settingsGet('DropboxApiKey'));
this.contactsIsAllowed(!!RL.settingsGet('ContactsIsAllowed')); this.contactsIsAllowed(!!AppSettings.settingsGet('ContactsIsAllowed'));
}; };
module.exports = AbstractData; module.exports = AbstractData;

View file

@ -6,6 +6,7 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js') AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js')
; ;

View file

@ -0,0 +1,64 @@
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
(function (module) {
'use strict';
var
AppData = require('../External/AppData.js'),
Utils = require('../Common/Utils.js')
;
/**
* @constructor
*/
function AppSettings()
{
this.oSettings = null;
}
AppSettings.prototype.oSettings = null;
/**
* @param {string} sName
* @return {?}
*/
AppSettings.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
*/
AppSettings.prototype.settingsSet = function (sName, mValue)
{
if (null === this.oSettings)
{
this.oSettings = Utils.isNormal(AppData) ? AppData : {};
}
this.oSettings[sName] = mValue;
};
/**
* @param {string} sName
* @return {boolean}
*/
AppSettings.prototype.capa = function (sName)
{
var mCapa = this.settingsGet('Capa');
return Utils.isArray(mCapa) && Utils.isNormal(sName) && -1 < Utils.inArray(sName, mCapa);
};
module.exports = new AppSettings();
}(module));

View file

@ -6,6 +6,7 @@
var var
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
CookieDriver = require('./LocalStorages/CookieDriver.js'), CookieDriver = require('./LocalStorages/CookieDriver.js'),
LocalStorageDriver = require('./LocalStorages/LocalStorageDriver.js') LocalStorageDriver = require('./LocalStorages/LocalStorageDriver.js')
; ;

View file

@ -8,8 +8,13 @@
_ = require('../External/underscore.js'), _ = require('../External/underscore.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
Consts = require('../Common/Consts.js'),
Globals = require('../Common/Globals.js'),
Base64 = require('../Common/Base64.js'),
Cache = require('../Storages/WebMailCacheStorage.js'), AppSettings = require('./AppSettings.js'),
Cache = require('./WebMailCacheStorage.js'),
Data = require('./WebMailDataStorage.js'),
AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js') AbstractAjaxRemoteStorage = require('./AbstractAjaxRemoteStorage.js')
; ;
@ -33,11 +38,11 @@
WebMailAjaxRemoteStorage.prototype.folders = function (fCallback) WebMailAjaxRemoteStorage.prototype.folders = function (fCallback)
{ {
this.defaultRequest(fCallback, 'Folders', { this.defaultRequest(fCallback, 'Folders', {
'SentFolder': RL.settingsGet('SentFolder'), 'SentFolder': AppSettings.settingsGet('SentFolder'),
'DraftFolder': RL.settingsGet('DraftFolder'), 'DraftFolder': AppSettings.settingsGet('DraftFolder'),
'SpamFolder': RL.settingsGet('SpamFolder'), 'SpamFolder': AppSettings.settingsGet('SpamFolder'),
'TrashFolder': RL.settingsGet('TrashFolder'), 'TrashFolder': AppSettings.settingsGet('TrashFolder'),
'ArchiveFolder': RL.settingsGet('ArchiveFolder') 'ArchiveFolder': AppSettings.settingsGet('ArchiveFolder')
}, null, '', ['Folders']); }, null, '', ['Folders']);
}; };
@ -228,7 +233,6 @@
sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw); sFolderFullNameRaw = Utils.pString(sFolderFullNameRaw);
var var
oData = RL.data(),
sFolderHash = Cache.getFolderHash(sFolderFullNameRaw) sFolderHash = Cache.getFolderHash(sFolderFullNameRaw)
; ;
@ -246,11 +250,11 @@
iOffset, iOffset,
iLimit, iLimit,
sSearch, sSearch,
oData.projectHash(), Data.projectHash(),
sFolderHash, sFolderHash,
'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '', 'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '',
oData.threading() && oData.useThreads() ? '1' : '0', Data.threading() && Data.useThreads() ? '1' : '0',
oData.threading() && sFolderFullNameRaw === oData.messageListThreadFolder() ? oData.messageListThreadUids().join(',') : '' Data.threading() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : ''
].join(String.fromCharCode(0))), bSilent ? [] : ['MessageList']); ].join(String.fromCharCode(0))), bSilent ? [] : ['MessageList']);
} }
else else
@ -261,8 +265,8 @@
'Limit': iLimit, 'Limit': iLimit,
'Search': sSearch, 'Search': sSearch,
'UidNext': 'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '', 'UidNext': 'INBOX' === sFolderFullNameRaw ? Cache.getFolderUidNext(sFolderFullNameRaw) : '',
'UseThreads': RL.data().threading() && RL.data().useThreads() ? '1' : '0', 'UseThreads': Data.threading() && Data.useThreads() ? '1' : '0',
'ExpandedThreadUid': oData.threading() && sFolderFullNameRaw === oData.messageListThreadFolder() ? oData.messageListThreadUids().join(',') : '' 'ExpandedThreadUid': Data.threading() && sFolderFullNameRaw === Data.messageListThreadFolder() ? Data.messageListThreadUids().join(',') : ''
}, '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout, '', bSilent ? [] : ['MessageList']); }, '' === sSearch ? Consts.Defaults.DefaultAjaxTimeout : Consts.Defaults.SearchAjaxTimeout, '', bSilent ? [] : ['MessageList']);
} }
}; };
@ -295,8 +299,8 @@
'Message/' + Base64.urlsafe_encode([ 'Message/' + Base64.urlsafe_encode([
sFolderFullNameRaw, sFolderFullNameRaw,
iUid, iUid,
RL.data().projectHash(), Data.projectHash(),
RL.data().threading() && RL.data().useThreads() ? '1' : '0' Data.threading() && Data.useThreads() ? '1' : '0'
].join(String.fromCharCode(0))), ['Message']); ].join(String.fromCharCode(0))), ['Message']);
return true; return true;
@ -375,9 +379,12 @@
'UidNext': 'INBOX' === sFolder ? Cache.getFolderUidNext(sFolder) : '' 'UidNext': 'INBOX' === sFolder ? Cache.getFolderUidNext(sFolder) : ''
}); });
} }
else if (RL.data().useThreads()) else if (Data.useThreads())
{ {
RL.reloadFlagsCurrentMessageListAndMessageFromCache(); if (Globals.__RL)
{
Globals.__RL.reloadFlagsCurrentMessageListAndMessageFromCache();
}
} }
}; };

View file

@ -11,7 +11,7 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
RL = require('../RL.js') AppSettings = require('./AppSettings.js')
; ;
/** /**
@ -28,7 +28,7 @@
this.oNewMessage = {}; this.oNewMessage = {};
this.oRequestedMessage = {}; this.oRequestedMessage = {};
this.bCapaGravatar = RL().capa(Enums.Capa.Gravatar); this.bCapaGravatar = AppSettings.capa(Enums.Capa.Gravatar);
} }
/** /**

View file

@ -19,8 +19,8 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
Cache = require('../Storages/WebMailCacheStorage.js'), AppSettings = require('./AppSettings.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Cache = require('./WebMailCacheStorage.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
@ -41,7 +41,7 @@
var var
fRemoveSystemFolderType = function (observable) { fRemoveSystemFolderType = function (observable) {
return function () { return function () {
var oFolder = Cache.getFolderFromCacheList(observable()); // TODO cjs var oFolder = Cache.getFolderFromCacheList(observable());
if (oFolder) if (oFolder)
{ {
oFolder.type(Enums.FolderType.User); oFolder.type(Enums.FolderType.User);
@ -50,7 +50,7 @@
}, },
fSetSystemFolderType = function (iType) { fSetSystemFolderType = function (iType) {
return function (sValue) { return function (sValue) {
var oFolder = Cache.getFolderFromCacheList(sValue); // TODO cjs var oFolder = Cache.getFolderFromCacheList(sValue);
if (oFolder) if (oFolder)
{ {
oFolder.type(iType); oFolder.type(iType);
@ -127,11 +127,11 @@
this.contactsSyncUser = ko.observable(''); this.contactsSyncUser = ko.observable('');
this.contactsSyncPass = ko.observable(''); this.contactsSyncPass = ko.observable('');
this.allowContactsSync = ko.observable(!!RL.settingsGet('ContactsSyncIsAllowed')); // TODO cjs this.allowContactsSync = ko.observable(!!AppSettings.settingsGet('ContactsSyncIsAllowed'));
this.enableContactsSync = ko.observable(!!RL.settingsGet('EnableContactsSync')); this.enableContactsSync = ko.observable(!!AppSettings.settingsGet('EnableContactsSync'));
this.contactsSyncUrl = ko.observable(RL.settingsGet('ContactsSyncUrl')); this.contactsSyncUrl = ko.observable(AppSettings.settingsGet('ContactsSyncUrl'));
this.contactsSyncUser = ko.observable(RL.settingsGet('ContactsSyncUser')); this.contactsSyncUser = ko.observable(AppSettings.settingsGet('ContactsSyncUser'));
this.contactsSyncPass = ko.observable(RL.settingsGet('ContactsSyncPassword')); this.contactsSyncPass = ko.observable(AppSettings.settingsGet('ContactsSyncPassword'));
// folders // folders
this.namespace = ''; this.namespace = '';
@ -229,12 +229,12 @@
this.folderListSystem = ko.computed(function () { this.folderListSystem = ko.computed(function () {
return _.compact(_.map(this.folderListSystemNames(), function (sName) { return _.compact(_.map(this.folderListSystemNames(), function (sName) {
return Cache.getFolderFromCacheList(sName); // TODO cjs return Cache.getFolderFromCacheList(sName);
})); }));
}, this); }, this);
this.folderMenuForMove = ko.computed(function () { this.folderMenuForMove = ko.computed(function () {
return RL.folderListOptionsBuilder(this.folderListSystem(), this.folderList(), [// TODO cjs return Utils.folderListOptionsBuilder(this.folderListSystem(), this.folderList(), [
this.currentFolderFullNameRaw() this.currentFolderFullNameRaw()
], null, null, null, null, function (oItem) { ], null, null, null, null, function (oItem) {
return oItem ? oItem.localName() : ''; return oItem ? oItem.localName() : '';
@ -273,7 +273,7 @@
this.mainMessageListSearch = ko.computed({ this.mainMessageListSearch = ko.computed({
'read': this.messageListSearch, 'read': this.messageListSearch,
'write': function (sValue) { 'write': function (sValue) {
kn.setHash(LinkBuilder.mailBox( // TODO cjs kn.setHash(LinkBuilder.mailBox(
this.currentFolderFullNameHash(), 1, Utils.trim(sValue.toString()) this.currentFolderFullNameHash(), 1, Utils.trim(sValue.toString())
)); ));
}, },
@ -308,7 +308,7 @@
}, 500)); }, 500));
// message preview // message preview
this.staticMessageList = new MessageModel();// TODO cjs this.staticMessageList = new MessageModel();
this.message = ko.observable(null); this.message = ko.observable(null);
this.messageLoading = ko.observable(false); this.messageLoading = ko.observable(false);
this.messageLoadingThrottle = ko.observable(false).extend({'throttle': 50}); this.messageLoadingThrottle = ko.observable(false).extend({'throttle': 50});
@ -322,7 +322,7 @@
this.messageFullScreenMode(false); this.messageFullScreenMode(false);
this.hideMessageBodies(); this.hideMessageBodies();
if (Enums.Layout.NoPreview === RL.data().layout() &&// TODO cjs if (Enums.Layout.NoPreview === this.layout() &&
-1 < window.location.hash.indexOf('message-preview')) -1 < window.location.hash.indexOf('message-preview'))
{ {
RL.historyBack(); // TODO cjs RL.historyBack(); // TODO cjs
@ -338,17 +338,17 @@
if (bValue) if (bValue)
{ {
this.folderList.focused(false); this.folderList.focused(false);
this.keyScope(Enums.KeyState.MessageView); Globals.keyScope(Enums.KeyState.MessageView);
} }
else if (Enums.KeyState.MessageView === RL.data().keyScope())// TODO cjs else if (Enums.KeyState.MessageView === Globals.keyScope())
{ {
if (Enums.Layout.NoPreview === RL.data().layout() && this.message())// TODO cjs if (Enums.Layout.NoPreview === this.layout() && this.message())
{ {
this.keyScope(Enums.KeyState.MessageView); Globals.keyScope(Enums.KeyState.MessageView);
} }
else else
{ {
this.keyScope(Enums.KeyState.MessageList); Globals.keyScope(Enums.KeyState.MessageList);
} }
} }
}, this); }, this);
@ -356,11 +356,11 @@
this.folderList.focused.subscribe(function (bValue) { this.folderList.focused.subscribe(function (bValue) {
if (bValue) if (bValue)
{ {
RL.data().keyScope(Enums.KeyState.FolderList);// TODO cjs Globals.keyScope(Enums.KeyState.FolderList);
} }
else if (Enums.KeyState.FolderList === RL.data().keyScope())// TODO cjs else if (Enums.KeyState.FolderList === Globals.keyScope())
{ {
RL.data().keyScope(Enums.KeyState.MessageList);// TODO cjs Globals.keyScope(Enums.KeyState.MessageList);
} }
}); });
@ -510,25 +510,25 @@
{ {
AbstractData.prototype.populateDataOnStart.call(this); AbstractData.prototype.populateDataOnStart.call(this);
this.accountEmail(RL.settingsGet('Email'));// TODO cjs this.accountEmail(AppSettings.settingsGet('Email'));
this.accountIncLogin(RL.settingsGet('IncLogin')); this.accountIncLogin(AppSettings.settingsGet('IncLogin'));
this.accountOutLogin(RL.settingsGet('OutLogin')); this.accountOutLogin(AppSettings.settingsGet('OutLogin'));
this.projectHash(RL.settingsGet('ProjectHash')); this.projectHash(AppSettings.settingsGet('ProjectHash'));
this.defaultIdentityID(RL.settingsGet('DefaultIdentityID')); this.defaultIdentityID(AppSettings.settingsGet('DefaultIdentityID'));
this.displayName(RL.settingsGet('DisplayName')); this.displayName(AppSettings.settingsGet('DisplayName'));
this.replyTo(RL.settingsGet('ReplyTo')); this.replyTo(AppSettings.settingsGet('ReplyTo'));
this.signature(RL.settingsGet('Signature')); this.signature(AppSettings.settingsGet('Signature'));
this.signatureToAll(!!RL.settingsGet('SignatureToAll')); this.signatureToAll(!!AppSettings.settingsGet('SignatureToAll'));
this.enableTwoFactor(!!RL.settingsGet('EnableTwoFactor')); this.enableTwoFactor(!!AppSettings.settingsGet('EnableTwoFactor'));
this.lastFoldersHash = LocalStorage.get(Enums.ClientSideKeyName.FoldersLashHash) || ''; this.lastFoldersHash = LocalStorage.get(Enums.ClientSideKeyName.FoldersLashHash) || '';
this.remoteSuggestions = !!RL.settingsGet('RemoteSuggestions'); this.remoteSuggestions = !!AppSettings.settingsGet('RemoteSuggestions');
this.devEmail = RL.settingsGet('DevEmail'); this.devEmail = AppSettings.settingsGet('DevEmail');
this.devPassword = RL.settingsGet('DevPassword'); this.devPassword = AppSettings.settingsGet('DevPassword');
}; };
WebMailDataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages) WebMailDataStorage.prototype.initUidNextAndNewMessages = function (sFolder, sUidNext, aNewMessages)
@ -538,12 +538,13 @@
if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length) if (Utils.isArray(aNewMessages) && 0 < aNewMessages.length)
{ {
var var
self = this,
iIndex = 0, iIndex = 0,
iLen = aNewMessages.length, iLen = aNewMessages.length,
fNotificationHelper = function (sImageSrc, sTitle, sText) fNotificationHelper = function (sImageSrc, sTitle, sText)
{ {
var oNotification = null; var oNotification = null;
if (NotificationClass && RL.data().useDesktopNotifications()) if (NotificationClass && self.useDesktopNotifications())
{ {
oNotification = new NotificationClass(sTitle, { oNotification = new NotificationClass(sTitle, {
'body': sText, 'body': sText,
@ -582,7 +583,7 @@
{ {
fNotificationHelper( fNotificationHelper(
LinkBuilder.notificationMailIcon(), LinkBuilder.notificationMailIcon(),
RL.data().accountEmail(), this.accountEmail(),
Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', { Utils.i18n('MESSAGE_LIST/NEW_MESSAGE_NOTIFICATION', {
'COUNT': iLen 'COUNT': iLen
}) })
@ -605,146 +606,6 @@
} }
}; };
/**
* @param {string} sNamespace
* @param {Array} aFolders
* @return {Array}
*/
WebMailDataStorage.prototype.folderResponseParseRec = function (sNamespace, aFolders)
{
var
iIndex = 0,
iLen = 0,
oFolder = null,
oCacheFolder = null,
sFolderFullNameRaw = '',
aSubFolders = [],
aList = []
;
for (iIndex = 0, iLen = aFolders.length; iIndex < iLen; iIndex++)
{
oFolder = aFolders[iIndex];
if (oFolder)
{
sFolderFullNameRaw = oFolder.FullNameRaw;
oCacheFolder = Cache.getFolderFromCacheList(sFolderFullNameRaw);// TODO cjs
if (!oCacheFolder)
{
oCacheFolder = FolderModel.newInstanceFromJson(oFolder);// TODO cjs
if (oCacheFolder)
{
Cache.setFolderToCacheList(sFolderFullNameRaw, oCacheFolder);// TODO cjs
Cache.setFolderFullNameRaw(oCacheFolder.fullNameHash, sFolderFullNameRaw);// TODO cjs
}
}
if (oCacheFolder)
{
oCacheFolder.collapsed(!Utils.isFolderExpanded(oCacheFolder.fullNameHash));
if (oFolder.Extended)
{
if (oFolder.Extended.Hash)
{
Cache.setFolderHash(oCacheFolder.fullNameRaw, oFolder.Extended.Hash);// TODO cjs
}
if (Utils.isNormal(oFolder.Extended.MessageCount))
{
oCacheFolder.messageCountAll(oFolder.Extended.MessageCount);
}
if (Utils.isNormal(oFolder.Extended.MessageUnseenCount))
{
oCacheFolder.messageCountUnread(oFolder.Extended.MessageUnseenCount);
}
}
aSubFolders = oFolder['SubFolders'];
if (aSubFolders && 'Collection/FolderCollection' === aSubFolders['@Object'] &&
aSubFolders['@Collection'] && Utils.isArray(aSubFolders['@Collection']))
{
oCacheFolder.subFolders(
this.folderResponseParseRec(sNamespace, aSubFolders['@Collection']));
}
aList.push(oCacheFolder);
}
}
}
return aList;
};
/**
* @param {*} oData
*/
WebMailDataStorage.prototype.setFolders = function (oData)
{
var
aList = [],
bUpdate = false,
oRLData = RL.data(),// TODO cjs
fNormalizeFolder = function (sFolderFullNameRaw) {
return ('' === sFolderFullNameRaw || Consts.Values.UnuseOptionValue === sFolderFullNameRaw ||
null !== Cache.getFolderFromCacheList(sFolderFullNameRaw)) ? sFolderFullNameRaw : '';// TODO cjs
}
;
if (oData && oData.Result && 'Collection/FolderCollection' === oData.Result['@Object'] &&
oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
{
if (!Utils.isUnd(oData.Result.Namespace))
{
oRLData.namespace = oData.Result.Namespace;
}
this.threading(!!RL.settingsGet('UseImapThread') && oData.Result.IsThreadsSupported && true);// TODO cjs
aList = this.folderResponseParseRec(oRLData.namespace, oData.Result['@Collection']);
oRLData.folderList(aList);
// TODO cjs
if (oData.Result['SystemFolders'] &&
'' === '' + RL.settingsGet('SentFolder') + RL.settingsGet('DraftFolder') +
RL.settingsGet('SpamFolder') + RL.settingsGet('TrashFolder') + RL.settingsGet('ArchiveFolder') +
RL.settingsGet('NullFolder'))
{
// TODO Magic Numbers
RL.settingsSet('SentFolder', oData.Result['SystemFolders'][2] || null);
RL.settingsSet('DraftFolder', oData.Result['SystemFolders'][3] || null);
RL.settingsSet('SpamFolder', oData.Result['SystemFolders'][4] || null);
RL.settingsSet('TrashFolder', oData.Result['SystemFolders'][5] || null);
RL.settingsSet('ArchiveFolder', oData.Result['SystemFolders'][12] || null);
bUpdate = true;
}
// TODO cjs
oRLData.sentFolder(fNormalizeFolder(RL.settingsGet('SentFolder')));
oRLData.draftFolder(fNormalizeFolder(RL.settingsGet('DraftFolder')));
oRLData.spamFolder(fNormalizeFolder(RL.settingsGet('SpamFolder')));
oRLData.trashFolder(fNormalizeFolder(RL.settingsGet('TrashFolder')));
oRLData.archiveFolder(fNormalizeFolder(RL.settingsGet('ArchiveFolder')));
if (bUpdate)
{
Remote.saveSystemFolders(Utils.emptyFunction, {
'SentFolder': oRLData.sentFolder(),
'DraftFolder': oRLData.draftFolder(),
'SpamFolder': oRLData.spamFolder(),
'TrashFolder': oRLData.trashFolder(),
'ArchiveFolder': oRLData.archiveFolder(),
'NullFolder': 'NullFolder'
});
}
LocalStorage.set(Enums.ClientSideKeyName.FoldersLashHash, oData.Result.FoldersHash);
}
};
WebMailDataStorage.prototype.hideMessageBodies = function () WebMailDataStorage.prototype.hideMessageBodies = function ()
{ {
var oMessagesBodiesDom = this.messagesBodiesDom(); var oMessagesBodiesDom = this.messagesBodiesDom();
@ -802,7 +663,7 @@
}); });
_.find(aTimeouts, function (aItem) { _.find(aTimeouts, function (aItem) {
var oFolder = Cache.getFolderFromCacheList(aItem[1]);// TODO cjs var oFolder = Cache.getFolderFromCacheList(aItem[1]);
if (oFolder) if (oFolder)
{ {
oFolder.interval = iUtc; oFolder.interval = iUtc;
@ -832,13 +693,13 @@
}); });
var var
self = this,
iUnseenCount = 0, iUnseenCount = 0,
oData = RL.data(),// TODO cjs aMessageList = this.messageList(),
aMessageList = oData.messageList(),
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw), oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''), oToFolder = '' === sToFolderFullNameRaw ? null : Cache.getFolderFromCacheList(sToFolderFullNameRaw || ''),
sCurrentFolderFullNameRaw = oData.currentFolderFullNameRaw(), sCurrentFolderFullNameRaw = this.currentFolderFullNameRaw(),
oCurrentMessage = oData.message(), oCurrentMessage = this.message(),
aMessages = sCurrentFolderFullNameRaw === sFromFolderFullNameRaw ? _.filter(aMessageList, function (oMessage) { aMessages = sCurrentFolderFullNameRaw === sFromFolderFullNameRaw ? _.filter(aMessageList, function (oMessage) {
return oMessage && -1 < Utils.inArray(Utils.pInt(oMessage.uid), aUidForRemove); return oMessage && -1 < Utils.inArray(Utils.pInt(oMessage.uid), aUidForRemove);
}) : [] }) : []
@ -884,13 +745,13 @@
} }
else else
{ {
oData.messageListIsNotCompleted(true); this.messageListIsNotCompleted(true);
_.each(aMessages, function (oMessage) { _.each(aMessages, function (oMessage) {
if (oCurrentMessage && oCurrentMessage.hash === oMessage.hash) if (oCurrentMessage && oCurrentMessage.hash === oMessage.hash)
{ {
oCurrentMessage = null; oCurrentMessage = null;
oData.message(null); self.message(null);
} }
oMessage.deleted(true); oMessage.deleted(true);
@ -898,7 +759,7 @@
_.delay(function () { _.delay(function () {
_.each(aMessages, function (oMessage) { _.each(aMessages, function (oMessage) {
oData.messageList.remove(oMessage); self.messageList.remove(oMessage);
}); });
}, 400); }, 400);
} }
@ -937,7 +798,7 @@
this.messageError(''); this.messageError('');
oMessage.initUpdateByMessageJson(oData.Result); oMessage.initUpdateByMessageJson(oData.Result);
Cache.addRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);// TODO cjs Cache.addRequestedMessage(oMessage.folderFullNameRaw, oMessage.uid);
if (!bCached) if (!bCached)
{ {
@ -967,7 +828,7 @@
bIsHtml = false; bIsHtml = false;
sResultHtml = Utils.plainToHtml(oData.Result.Plain.toString(), false); sResultHtml = Utils.plainToHtml(oData.Result.Plain.toString(), false);
if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) && RL.data().capaOpenPGP()) if ((oMessage.isPgpSigned() || oMessage.isPgpEncrypted()) && this.capaOpenPGP())
{ {
oMessage.plainRaw = Utils.pString(oData.Result.Plain); oMessage.plainRaw = Utils.pString(oData.Result.Plain);
@ -1079,137 +940,6 @@
}).join('|'); }).join('|');
}; };
WebMailDataStorage.prototype.setMessageList = function (oData, bCached)
{
if (oData && oData.Result && 'Collection/MessageCollection' === oData.Result['@Object'] &&
oData.Result['@Collection'] && Utils.isArray(oData.Result['@Collection']))
{
var
oRainLoopData = RL.data(),
mLastCollapsedThreadUids = null,
iIndex = 0,
iLen = 0,
iCount = 0,
iOffset = 0,
aList = [],
iUtc = moment().unix(),
aStaticList = oRainLoopData.staticMessageList,
oJsonMessage = null,
oMessage = null,
oFolder = null,
iNewCount = 0,
bUnreadCountChange = false
;
iCount = Utils.pInt(oData.Result.MessageResultCount);
iOffset = Utils.pInt(oData.Result.Offset);
if (Utils.isNonEmptyArray(oData.Result.LastCollapsedThreadUids))
{
mLastCollapsedThreadUids = oData.Result.LastCollapsedThreadUids;
}
oFolder = Cache.getFolderFromCacheList(
Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
if (oFolder && !bCached)
{
oFolder.interval = iUtc;
Cache.setFolderHash(oData.Result.Folder, oData.Result.FolderHash);
if (Utils.isNormal(oData.Result.MessageCount))
{
oFolder.messageCountAll(oData.Result.MessageCount);
}
if (Utils.isNormal(oData.Result.MessageUnseenCount))
{
if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oData.Result.MessageUnseenCount))
{
bUnreadCountChange = true;
}
oFolder.messageCountUnread(oData.Result.MessageUnseenCount);
}
this.initUidNextAndNewMessages(oFolder.fullNameRaw, oData.Result.UidNext, oData.Result.NewMessages);
}
if (bUnreadCountChange && oFolder)
{
Cache.clearMessageFlagsFromCacheByFolder(oFolder.fullNameRaw);
}
for (iIndex = 0, iLen = oData.Result['@Collection'].length; iIndex < iLen; iIndex++)
{
oJsonMessage = oData.Result['@Collection'][iIndex];
if (oJsonMessage && 'Object/Message' === oJsonMessage['@Object'])
{
oMessage = aStaticList[iIndex];
if (!oMessage || !oMessage.initByJson(oJsonMessage))
{
oMessage = MessageModel.newInstanceFromJson(oJsonMessage);
}
if (oMessage)
{
if (Cache.hasNewMessageAndRemoveFromCache(oMessage.folderFullNameRaw, oMessage.uid) && 5 >= iNewCount)
{
iNewCount++;
oMessage.newForAnimation(true);
}
oMessage.deleted(false);
if (bCached)
{
Cache.initMessageFlagsFromCache(oMessage);
}
else
{
Cache.storeMessageFlagsToCache(oMessage);
}
oMessage.lastInCollapsedThread(mLastCollapsedThreadUids && -1 < Utils.inArray(Utils.pInt(oMessage.uid), mLastCollapsedThreadUids) ? true : false);
aList.push(oMessage);
}
}
}
oRainLoopData.messageListCount(iCount);
oRainLoopData.messageListSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
oRainLoopData.messageListPage(Math.ceil((iOffset / oRainLoopData.messagesPerPage()) + 1));
oRainLoopData.messageListEndFolder(Utils.isNormal(oData.Result.Folder) ? oData.Result.Folder : '');
oRainLoopData.messageListEndSearch(Utils.isNormal(oData.Result.Search) ? oData.Result.Search : '');
oRainLoopData.messageListEndPage(oRainLoopData.messageListPage());
oRainLoopData.messageList(aList);
oRainLoopData.messageListIsNotCompleted(false);
if (aStaticList.length < aList.length)
{
oRainLoopData.staticMessageList = aList;
}
Cache.clearNewMessageCache();
if (oFolder && (bCached || bUnreadCountChange || RL.data().useThreads()))
{
RL.folderInformation(oFolder.fullNameRaw, aList);
}
}
else
{
RL.data().messageListCount(0);
RL.data().messageList([]);
RL.data().messageListError(Utils.getNotification(
oData && oData.ErrorCode ? oData.ErrorCode : Enums.Notification.CantGetMessageList
));
}
};
WebMailDataStorage.prototype.findPublicKeyByHex = function (sHash) WebMailDataStorage.prototype.findPublicKeyByHex = function (sHash)
{ {
return _.find(this.openpgpkeysPublic(), function (oItem) { return _.find(this.openpgpkeysPublic(), function (oItem) {

View file

@ -14,8 +14,15 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
PopupsKeyboardShortcutsHelpViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'),
PopupsAddAccountViewModel = require('../ViewModels/Popups/PopupsKeyboardShortcutsHelpViewModel.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
; ;
@ -28,15 +35,13 @@
{ {
KnoinAbstractViewModel.call(this, 'Right', 'SystemDropDown'); KnoinAbstractViewModel.call(this, 'Right', 'SystemDropDown');
var oData = RL.data(); this.accounts = Data.accounts;
this.accountEmail = Data.accountEmail;
this.accounts = oData.accounts; this.accountsLoading = Data.accountsLoading;
this.accountEmail = oData.accountEmail;
this.accountsLoading = oData.accountsLoading;
this.accountMenuDropdownTrigger = ko.observable(false); this.accountMenuDropdownTrigger = ko.observable(false);
this.capaAdditionalAccounts = RL.capa(Enums.Capa.AdditionalAccounts); this.capaAdditionalAccounts = AppSettings.capa(Enums.Capa.AdditionalAccounts);
this.loading = ko.computed(function () { this.loading = ko.computed(function () {
return this.accountsLoading(); return this.accountsLoading();
@ -63,7 +68,7 @@
AbstractSystemDropDownViewModel.prototype.emailTitle = function () AbstractSystemDropDownViewModel.prototype.emailTitle = function ()
{ {
return RL.data().accountEmail(); return Data.accountEmail();
}; };
AbstractSystemDropDownViewModel.prototype.settingsClick = function () AbstractSystemDropDownViewModel.prototype.settingsClick = function ()
@ -92,7 +97,7 @@
window.__rlah_clear(); window.__rlah_clear();
} }
RL.loginAndLogoutReload(true, RL.settingsGet('ParentEmail') && 0 < RL.settingsGet('ParentEmail').length); RL.loginAndLogoutReload(true, AppSettings.settingsGet('ParentEmail') && 0 < AppSettings.settingsGet('ParentEmail').length);
}); });
}; };
@ -116,6 +121,6 @@
}); });
}; };
module.exports = new AbstractSystemDropDownViewModel(); module.exports = AbstractSystemDropDownViewModel;
}(module)); }(module));

View file

@ -13,6 +13,8 @@
Remote = require('../Storages/AdminAjaxRemoteStorage.js'), Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
RL = require('../Boots/AdminApp.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
; ;
@ -116,6 +118,6 @@
this.submitCommand(); this.submitCommand();
}; };
module.exports = new AdminLoginViewModel(); module.exports = AdminLoginViewModel;
}(module)); }(module));

View file

@ -5,7 +5,8 @@
'use strict'; 'use strict';
var var
kn = require('../External/kn.js'), kn = require('../Knoin/Knoin.js'),
Globals = require('../Common/Globals.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
; ;
@ -19,7 +20,7 @@
{ {
KnoinAbstractViewModel.call(this, 'Left', 'AdminMenu'); KnoinAbstractViewModel.call(this, 'Left', 'AdminMenu');
this.leftPanelDisabled = RL.data().leftPanelDisabled; this.leftPanelDisabled = Globals.leftPanelDisabled;
this.menu = oScreen.menu; this.menu = oScreen.menu;
@ -33,6 +34,6 @@
return '#/' + sRoute; return '#/' + sRoute;
}; };
module.exports = new AdminMenuViewModel(); module.exports = AdminMenuViewModel;
}(module)); }(module));

View file

@ -7,8 +7,12 @@
var var
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/AdminDataStorage.js'),
Remote = require('../Storages/AdminAjaxRemoteStorage.js'), Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
RL = require('../Boots/AdminApp.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
; ;
@ -21,10 +25,10 @@
{ {
KnoinAbstractViewModel.call(this, 'Right', 'AdminPane'); KnoinAbstractViewModel.call(this, 'Right', 'AdminPane');
this.adminDomain = ko.observable(RL.settingsGet('AdminDomain')); this.adminDomain = ko.observable(AppSettings.settingsGet('AdminDomain'));
this.version = ko.observable(RL.settingsGet('Version')); this.version = ko.observable(AppSettings.settingsGet('Version'));
this.adminManLoadingVisibility = RL.data().adminManLoadingVisibility; this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
kn.constructorEnd(this); kn.constructorEnd(this);
} }
@ -38,6 +42,6 @@
}); });
}; };
module.exports = new AdminPaneViewModel(); module.exports = AdminPaneViewModel;
}(module)); }(module));

View file

@ -14,10 +14,16 @@
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
AppSettings = require('../Storages/AppSettings.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'),
PopupsLanguagesViewModel = require('../ViewModels/Popups/PopupsLanguagesViewModel.js')
; ;
/** /**
@ -28,8 +34,6 @@
{ {
KnoinAbstractViewModel.call(this, 'Center', 'Login'); KnoinAbstractViewModel.call(this, 'Center', 'Login');
var oData = RL.data();
this.email = ko.observable(''); this.email = ko.observable('');
this.password = ko.observable(''); this.password = ko.observable('');
this.signMe = ko.observable(false); this.signMe = ko.observable(false);
@ -40,9 +44,9 @@
this.additionalCode.visibility = ko.observable(false); this.additionalCode.visibility = ko.observable(false);
this.additionalCodeSignMe = ko.observable(false); this.additionalCodeSignMe = ko.observable(false);
this.logoImg = Utils.trim(RL.settingsGet('LoginLogo')); this.logoImg = Utils.trim(AppSettings.settingsGet('LoginLogo'));
this.loginDescription = Utils.trim(RL.settingsGet('LoginDescription')); this.loginDescription = Utils.trim(AppSettings.settingsGet('LoginDescription'));
this.logoCss = Utils.trim(RL.settingsGet('LoginCss')); this.logoCss = Utils.trim(AppSettings.settingsGet('LoginCss'));
this.emailError = ko.observable(false); this.emailError = ko.observable(false);
this.passwordError = ko.observable(false); this.passwordError = ko.observable(false);
@ -71,10 +75,10 @@
this.submitRequest = ko.observable(false); this.submitRequest = ko.observable(false);
this.submitError = ko.observable(''); this.submitError = ko.observable('');
this.allowLanguagesOnLogin = oData.allowLanguagesOnLogin; this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
this.langRequest = ko.observable(false); this.langRequest = ko.observable(false);
this.mainLanguage = oData.mainLanguage; this.mainLanguage = Data.mainLanguage;
this.bSendLanguage = false; this.bSendLanguage = false;
this.mainLanguageFullName = ko.computed(function () { this.mainLanguageFullName = ko.computed(function () {
@ -164,7 +168,7 @@
}, this) }, this)
; ;
if (!!RL.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported) if (!!AppSettings.settingsGet('UseRsaEncryption') && Utils.rsaEncode.supported)
{ {
Remote.getPublicKey(_.bind(function (sResult, oData) { Remote.getPublicKey(_.bind(function (sResult, oData) {
@ -203,7 +207,8 @@
this.facebookCommand = Utils.createCommand(this, function () { this.facebookCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialFacebook(), 'Facebook', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'); window.open(LinkBuilder.socialFacebook(), 'Facebook',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true; return true;
}, function () { }, function () {
@ -214,7 +219,8 @@
this.googleCommand = Utils.createCommand(this, function () { this.googleCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialGoogle(), 'Google', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'); window.open(LinkBuilder.socialGoogle(), 'Google',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true; return true;
}, function () { }, function () {
@ -225,7 +231,8 @@
this.twitterCommand = Utils.createCommand(this, function () { this.twitterCommand = Utils.createCommand(this, function () {
window.open(LinkBuilder.socialTwitter(), 'Twitter', 'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes'); window.open(LinkBuilder.socialTwitter(), 'Twitter',
'left=200,top=100,width=650,height=335,menubar=no,status=no,resizable=yes,scrollbars=yes');
return true; return true;
}, function () { }, function () {
@ -262,9 +269,9 @@
this.emailFocus(true); this.emailFocus(true);
} }
if (RL.settingsGet('UserLanguage')) if (AppSettings.settingsGet('UserLanguage'))
{ {
$.cookie('rllang', RL.data().language(), {'expires': 30}); $.cookie('rllang', Data.language(), {'expires': 30});
} }
}, this), 100); }, this), 100);
@ -280,7 +287,7 @@
{ {
var var
self = this, self = this,
sJsHash = RL.settingsGet('JsHash'), sJsHash = AppSettings.settingsGet('JsHash'),
fSocial = function (iErrorCode) { fSocial = function (iErrorCode) {
iErrorCode = Utils.pInt(iErrorCode); iErrorCode = Utils.pInt(iErrorCode);
if (0 === iErrorCode) if (0 === iErrorCode)
@ -295,11 +302,11 @@
} }
; ;
this.facebookLoginEnabled(!!RL.settingsGet('AllowFacebookSocial')); this.facebookLoginEnabled(!!AppSettings.settingsGet('AllowFacebookSocial'));
this.twitterLoginEnabled(!!RL.settingsGet('AllowTwitterSocial')); this.twitterLoginEnabled(!!AppSettings.settingsGet('AllowTwitterSocial'));
this.googleLoginEnabled(!!RL.settingsGet('AllowGoogleSocial')); this.googleLoginEnabled(!!AppSettings.settingsGet('AllowGoogleSocial'));
switch ((RL.settingsGet('SignMe') || 'unused').toLowerCase()) switch ((AppSettings.settingsGet('SignMe') || 'unused').toLowerCase())
{ {
case Enums.LoginSignMeTypeAsString.DefaultOff: case Enums.LoginSignMeTypeAsString.DefaultOff:
this.signMeType(Enums.LoginSignMeType.DefaultOff); this.signMeType(Enums.LoginSignMeType.DefaultOff);
@ -313,8 +320,8 @@
break; break;
} }
this.email(RL.data().devEmail); this.email(Data.devEmail);
this.password(RL.data().devPassword); this.password(Data.devPassword);
if (this.googleLoginEnabled()) if (this.googleLoginEnabled())
{ {
@ -332,7 +339,7 @@
} }
_.delay(function () { _.delay(function () {
RL.data().language.subscribe(function (sValue) { Data.language.subscribe(function (sValue) {
self.langRequest(true); self.langRequest(true);
$.ajax({ $.ajax({
'url': LinkBuilder.langLink(sValue), 'url': LinkBuilder.langLink(sValue),
@ -341,7 +348,7 @@
}).done(function() { }).done(function() {
self.bSendLanguage = true; self.bSendLanguage = true;
Utils.i18nReload(); Utils.i18nReload();
$.cookie('rllang', RL.data().language(), {'expires': 30}); $.cookie('rllang', Data.language(), {'expires': 30});
}).always(function() { }).always(function() {
self.langRequest(false); self.langRequest(false);
}); });
@ -361,6 +368,6 @@
kn.showScreenPopup(PopupsLanguagesViewModel); kn.showScreenPopup(PopupsLanguagesViewModel);
}; };
module.exports = new LoginViewModel(); module.exports = LoginViewModel;
}(module)); }(module));

View file

@ -13,9 +13,18 @@
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
AppSettings = require('../Storages/AppSettings.js'),
Cache = require('../Storages/WebMailCacheStorage.js'), Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
PopupsComposeViewModel = require('./Popups/PopupsComposeViewModel.js'),
PopupsFolderCreateViewModel = require('./Popups/PopupsFolderCreateViewModel.js'),
PopupsContactsViewModel = require('./Popups/PopupsContactsViewModel.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
@ -29,21 +38,19 @@
{ {
KnoinAbstractViewModel.call(this, 'Left', 'MailFolderList'); KnoinAbstractViewModel.call(this, 'Left', 'MailFolderList');
var oData = RL.data();
this.oContentVisible = null; this.oContentVisible = null;
this.oContentScrollable = null; this.oContentScrollable = null;
this.messageList = oData.messageList; this.messageList = Data.messageList;
this.folderList = oData.folderList; this.folderList = Data.folderList;
this.folderListSystem = oData.folderListSystem; this.folderListSystem = Data.folderListSystem;
this.foldersChanging = oData.foldersChanging; this.foldersChanging = Data.foldersChanging;
this.leftPanelDisabled = oData.leftPanelDisabled; this.leftPanelDisabled = Globals.leftPanelDisabled;
this.iDropOverTimer = 0; this.iDropOverTimer = 0;
this.allowContacts = !!RL.settingsGet('ContactsIsAllowed'); this.allowContacts = !!AppSettings.settingsGet('ContactsIsAllowed');
kn.constructorEnd(this); kn.constructorEnd(this);
} }
@ -68,7 +75,7 @@
if (oFolder && oEvent) if (oFolder && oEvent)
{ {
bCollapsed = oFolder.collapsed(); bCollapsed = oFolder.collapsed();
Utils.setExpandedFolder(oFolder.fullNameHash, bCollapsed); RL.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
oFolder.collapsed(!bCollapsed); oFolder.collapsed(!bCollapsed);
oEvent.preventDefault(); oEvent.preventDefault();
@ -80,18 +87,17 @@
oEvent.preventDefault(); oEvent.preventDefault();
var var
oData = RL.data(),
oFolder = ko.dataFor(this) oFolder = ko.dataFor(this)
; ;
if (oFolder) if (oFolder)
{ {
if (Enums.Layout.NoPreview === oData.layout()) if (Enums.Layout.NoPreview === Data.layout())
{ {
oData.message(null); Data.message(null);
} }
if (oFolder.fullNameRaw === oData.currentFolderFullNameRaw()) if (oFolder.fullNameRaw === Data.currentFolderFullNameRaw())
{ {
Cache.setFolderHash(oFolder.fullNameRaw, ''); Cache.setFolderHash(oFolder.fullNameRaw, '');
} }
@ -152,7 +158,7 @@
if (oFolder) if (oFolder)
{ {
bCollapsed = oFolder.collapsed(); bCollapsed = oFolder.collapsed();
Utils.setExpandedFolder(oFolder.fullNameHash, bCollapsed); RL.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
oFolder.collapsed(!bCollapsed); oFolder.collapsed(!bCollapsed);
} }
} }
@ -181,7 +187,7 @@
{ {
this.iDropOverTimer = window.setTimeout(function () { this.iDropOverTimer = window.setTimeout(function () {
oFolder.collapsed(false); oFolder.collapsed(false);
Utils.setExpandedFolder(oFolder.fullNameHash, true); RL.setExpandedFolder(oFolder.fullNameHash, true);
Utils.windowResize(); Utils.windowResize();
}, 500); }, 500);
} }
@ -269,6 +275,6 @@
} }
}; };
module.exports = new MailBoxFolderListViewModel(); module.exports = MailBoxFolderListViewModel;
}(module)); }(module));

View file

@ -17,10 +17,16 @@
Consts = require('../Common/Consts.js'), Consts = require('../Common/Consts.js'),
Globals = require('../Common/Globals.js'), Globals = require('../Common/Globals.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
Events = require('../Common/Events.js'),
Selector = require('../Common/Selector.js'),
AppSettings = require('../Storages/AppSettings.js'),
Cache = require('../Storages/WebMailCacheStorage.js'), Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'), KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js'),
@ -39,38 +45,36 @@
this.bPrefetch = false; this.bPrefetch = false;
this.emptySubjectValue = ''; this.emptySubjectValue = '';
this.hideDangerousActions = !!RL.settingsGet('HideDangerousActions'); this.hideDangerousActions = !!AppSettings.settingsGet('HideDangerousActions');
var oData = RL.data(); this.popupVisibility = Globals.popupVisibility;
this.popupVisibility = RL.popupVisibility; this.message = Data.message;
this.messageList = Data.messageList;
this.folderList = Data.folderList;
this.currentMessage = Data.currentMessage;
this.isMessageSelected = Data.isMessageSelected;
this.messageListSearch = Data.messageListSearch;
this.messageListError = Data.messageListError;
this.folderMenuForMove = Data.folderMenuForMove;
this.message = oData.message; this.useCheckboxesInList = Data.useCheckboxesInList;
this.messageList = oData.messageList;
this.folderList = oData.folderList;
this.currentMessage = oData.currentMessage;
this.isMessageSelected = oData.isMessageSelected;
this.messageListSearch = oData.messageListSearch;
this.messageListError = oData.messageListError;
this.folderMenuForMove = oData.folderMenuForMove;
this.useCheckboxesInList = oData.useCheckboxesInList; this.mainMessageListSearch = Data.mainMessageListSearch;
this.messageListEndFolder = Data.messageListEndFolder;
this.mainMessageListSearch = oData.mainMessageListSearch; this.messageListChecked = Data.messageListChecked;
this.messageListEndFolder = oData.messageListEndFolder; this.messageListCheckedOrSelected = Data.messageListCheckedOrSelected;
this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListChecked = oData.messageListChecked; this.messageListCompleteLoadingThrottle = Data.messageListCompleteLoadingThrottle;
this.messageListCheckedOrSelected = oData.messageListCheckedOrSelected;
this.messageListCheckedOrSelectedUidsWithSubMails = oData.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCompleteLoadingThrottle = oData.messageListCompleteLoadingThrottle;
Utils.initOnStartOrLangChange(function () { Utils.initOnStartOrLangChange(function () {
this.emptySubjectValue = Utils.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT'); this.emptySubjectValue = Utils.i18n('MESSAGE_LIST/EMPTY_SUBJECT_TEXT');
}, this); }, this);
this.userQuota = oData.userQuota; this.userQuota = Data.userQuota;
this.userUsageSize = oData.userUsageSize; this.userUsageSize = Data.userUsageSize;
this.userUsageProc = oData.userUsageProc; this.userUsageProc = Data.userUsageProc;
this.moveDropdownTrigger = ko.observable(false); this.moveDropdownTrigger = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false); this.moreDropdownTrigger = ko.observable(false);
@ -82,25 +86,25 @@
this.dragOverBodyArea = ko.observable(null); this.dragOverBodyArea = ko.observable(null);
this.messageListItemTemplate = ko.computed(function () { this.messageListItemTemplate = ko.computed(function () {
return Enums.Layout.NoPreview !== oData.layout() ? return Enums.Layout.NoPreview !== Data.layout() ?
'MailMessageListItem' : 'MailMessageListItemNoPreviewPane'; 'MailMessageListItem' : 'MailMessageListItemNoPreviewPane';
}); });
this.messageListSearchDesc = ko.computed(function () { this.messageListSearchDesc = ko.computed(function () {
var sValue = oData.messageListEndSearch(); var sValue = Data.messageListEndSearch();
return '' === sValue ? '' : Utils.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue}); return '' === sValue ? '' : Utils.i18n('MESSAGE_LIST/SEARCH_RESULT_FOR', {'SEARCH': sValue});
}); });
this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(oData.messageListPage, oData.messageListPageCount)); this.messageListPagenator = ko.computed(Utils.computedPagenatorHelper(Data.messageListPage, Data.messageListPageCount));
this.checkAll = ko.computed({ this.checkAll = ko.computed({
'read': function () { 'read': function () {
return 0 < RL.data().messageListChecked().length; return 0 < Data.messageListChecked().length;
}, },
'write': function (bValue) { 'write': function (bValue) {
bValue = !!bValue; bValue = !!bValue;
_.each(RL.data().messageList(), function (oMessage) { _.each(Data.messageList(), function (oMessage) {
oMessage.checked(bValue); oMessage.checked(bValue);
}); });
} }
@ -119,8 +123,8 @@
this.isIncompleteChecked = ko.computed(function () { this.isIncompleteChecked = ko.computed(function () {
var var
iM = RL.data().messageList().length, iM = Data.messageList().length,
iC = RL.data().messageListChecked().length iC = Data.messageListChecked().length
; ;
return 0 < iM && 0 < iC && iM > iC; return 0 < iM && 0 < iC && iM > iC;
}, this); }, this);
@ -134,82 +138,82 @@
}, this); }, this);
this.isSpamFolder = ko.computed(function () { this.isSpamFolder = ko.computed(function () {
return oData.spamFolder() === this.messageListEndFolder() && return Data.spamFolder() === this.messageListEndFolder() &&
'' !== oData.spamFolder(); '' !== Data.spamFolder();
}, this); }, this);
this.isSpamDisabled = ko.computed(function () { this.isSpamDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === oData.spamFolder(); return Consts.Values.UnuseOptionValue === Data.spamFolder();
}, this); }, this);
this.isTrashFolder = ko.computed(function () { this.isTrashFolder = ko.computed(function () {
return oData.trashFolder() === this.messageListEndFolder() && return Data.trashFolder() === this.messageListEndFolder() &&
'' !== oData.trashFolder(); '' !== Data.trashFolder();
}, this); }, this);
this.isDraftFolder = ko.computed(function () { this.isDraftFolder = ko.computed(function () {
return oData.draftFolder() === this.messageListEndFolder() && return Data.draftFolder() === this.messageListEndFolder() &&
'' !== oData.draftFolder(); '' !== Data.draftFolder();
}, this); }, this);
this.isSentFolder = ko.computed(function () { this.isSentFolder = ko.computed(function () {
return oData.sentFolder() === this.messageListEndFolder() && return Data.sentFolder() === this.messageListEndFolder() &&
'' !== oData.sentFolder(); '' !== Data.sentFolder();
}, this); }, this);
this.isArchiveFolder = ko.computed(function () { this.isArchiveFolder = ko.computed(function () {
return oData.archiveFolder() === this.messageListEndFolder() && return Data.archiveFolder() === this.messageListEndFolder() &&
'' !== oData.archiveFolder(); '' !== Data.archiveFolder();
}, this); }, this);
this.isArchiveDisabled = ko.computed(function () { this.isArchiveDisabled = ko.computed(function () {
return Consts.Values.UnuseOptionValue === RL.data().archiveFolder(); return Consts.Values.UnuseOptionValue === Data.archiveFolder();
}, this); }, this);
this.canBeMoved = this.hasCheckedOrSelectedLines; this.canBeMoved = this.hasCheckedOrSelectedLines;
this.clearCommand = Utils.createCommand(this, function () { this.clearCommand = Utils.createCommand(this, function () {
kn.showScreenPopup(PopupsFolderClearViewModel, [RL.data().currentFolder()]); kn.showScreenPopup(PopupsFolderClearViewModel, [Data.currentFolder()]);
}); });
this.multyForwardCommand = Utils.createCommand(this, function () { this.multyForwardCommand = Utils.createCommand(this, function () {
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.ForwardAsAttachment, RL.data().messageListCheckedOrSelected()]); kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.ForwardAsAttachment, Data.messageListCheckedOrSelected()]);
}, this.canBeMoved); }, this.canBeMoved);
this.deleteWithoutMoveCommand = Utils.createCommand(this, function () { this.deleteWithoutMoveCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Trash, RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
RL.data().currentFolderFullNameRaw(), Data.currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), false); Data.messageListCheckedOrSelectedUidsWithSubMails(), false);
}, this.canBeMoved); }, this.canBeMoved);
this.deleteCommand = Utils.createCommand(this, function () { this.deleteCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Trash, RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
RL.data().currentFolderFullNameRaw(), Data.currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved); }, this.canBeMoved);
this.archiveCommand = Utils.createCommand(this, function () { this.archiveCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Archive, RL.deleteMessagesFromFolder(Enums.FolderType.Archive,
RL.data().currentFolderFullNameRaw(), Data.currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved); }, this.canBeMoved);
this.spamCommand = Utils.createCommand(this, function () { this.spamCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.Spam, RL.deleteMessagesFromFolder(Enums.FolderType.Spam,
RL.data().currentFolderFullNameRaw(), Data.currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved); }, this.canBeMoved);
this.notSpamCommand = Utils.createCommand(this, function () { this.notSpamCommand = Utils.createCommand(this, function () {
RL.deleteMessagesFromFolder(Enums.FolderType.NotSpam, RL.deleteMessagesFromFolder(Enums.FolderType.NotSpam,
RL.data().currentFolderFullNameRaw(), Data.currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), true); Data.messageListCheckedOrSelectedUidsWithSubMails(), true);
}, this.canBeMoved); }, this.canBeMoved);
this.moveCommand = Utils.createCommand(this, Utils.emptyFunction, this.canBeMoved); this.moveCommand = Utils.createCommand(this, Utils.emptyFunction, this.canBeMoved);
this.reloadCommand = Utils.createCommand(this, function () { this.reloadCommand = Utils.createCommand(this, function () {
if (!RL.data().messageListCompleteLoadingThrottle()) if (!Data.messageListCompleteLoadingThrottle())
{ {
RL.reloadMessageList(false, true); RL.reloadMessageList(false, true);
} }
@ -224,18 +228,18 @@
this.selector.on('onItemSelect', _.bind(function (oMessage) { this.selector.on('onItemSelect', _.bind(function (oMessage) {
if (oMessage) if (oMessage)
{ {
oData.message(oData.staticMessageList.populateByMessageListItem(oMessage)); Data.message(Data.staticMessageList.populateByMessageListItem(oMessage));
this.populateMessageBody(oData.message()); this.populateMessageBody(Data.message());
if (Enums.Layout.NoPreview === oData.layout()) if (Enums.Layout.NoPreview === Data.layout())
{ {
kn.setHash(LinkBuilder.messagePreview(), true); kn.setHash(LinkBuilder.messagePreview(), true);
oData.message.focused(true); Data.message.focused(true);
} }
} }
else else
{ {
oData.message(null); Data.message(null);
} }
}, this)); }, this));
@ -243,17 +247,17 @@
return oMessage ? oMessage.generateUid() : ''; return oMessage ? oMessage.generateUid() : '';
}); });
oData.messageListEndHash.subscribe(function () { Data.messageListEndHash.subscribe(function () {
this.selector.scrollToTop(); this.selector.scrollToTop();
}, this); }, this);
oData.layout.subscribe(function (mValue) { Data.layout.subscribe(function (mValue) {
this.selector.autoSelect(Enums.Layout.NoPreview !== mValue); this.selector.autoSelect(Enums.Layout.NoPreview !== mValue);
}, this); }, this);
oData.layout.valueHasMutated(); Data.layout.valueHasMutated();
RL Events
.sub('mailbox.message-list.selector.go-down', function () { .sub('mailbox.message-list.selector.go-down', function () {
this.selector.goDown(true); this.selector.goDown(true);
}, this) }, this)
@ -302,8 +306,8 @@
if (this.canBeMoved()) if (this.canBeMoved())
{ {
RL.moveMessagesToFolder( RL.moveMessagesToFolder(
RL.data().currentFolderFullNameRaw(), Data.currentFolderFullNameRaw(),
RL.data().messageListCheckedOrSelectedUidsWithSubMails(), sToFolderFullNameRaw, bCopy); Data.messageListCheckedOrSelectedUidsWithSubMails(), sToFolderFullNameRaw, bCopy);
} }
return false; return false;
@ -318,15 +322,15 @@
var var
oEl = Utils.draggeblePlace(), oEl = Utils.draggeblePlace(),
aUids = RL.data().messageListCheckedOrSelectedUidsWithSubMails() aUids = Data.messageListCheckedOrSelectedUidsWithSubMails()
; ;
oEl.data('rl-folder', RL.data().currentFolderFullNameRaw()); oEl.data('rl-folder', Data.currentFolderFullNameRaw());
oEl.data('rl-uids', aUids); oEl.data('rl-uids', aUids);
oEl.find('.text').text('' + aUids.length); oEl.find('.text').text('' + aUids.length);
_.defer(function () { _.defer(function () {
var aUids = RL.data().messageListCheckedOrSelectedUidsWithSubMails(); var aUids = Data.messageListCheckedOrSelectedUidsWithSubMails();
oEl.data('rl-uids', aUids); oEl.data('rl-uids', aUids);
oEl.find('.text').text('' + aUids.length); oEl.find('.text').text('' + aUids.length);
@ -342,24 +346,22 @@
*/ */
MailBoxMessageListViewModel.prototype.onMessageResponse = function (sResult, oData, bCached) MailBoxMessageListViewModel.prototype.onMessageResponse = function (sResult, oData, bCached)
{ {
var oRainLoopData = RL.data(); Data.hideMessageBodies();
Data.messageLoading(false);
oRainLoopData.hideMessageBodies();
oRainLoopData.messageLoading(false);
if (Enums.StorageResultType.Success === sResult && oData && oData.Result) if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
{ {
oRainLoopData.setMessage(oData, bCached); Data.setMessage(oData, bCached);
} }
else if (Enums.StorageResultType.Unload === sResult) else if (Enums.StorageResultType.Unload === sResult)
{ {
oRainLoopData.message(null); Data.message(null);
oRainLoopData.messageError(''); Data.messageError('');
} }
else if (Enums.StorageResultType.Abort !== sResult) else if (Enums.StorageResultType.Abort !== sResult)
{ {
oRainLoopData.message(null); Data.message(null);
oRainLoopData.messageError((oData && oData.ErrorCode ? Data.messageError((oData && oData.ErrorCode ?
Utils.getNotification(oData.ErrorCode) : Utils.getNotification(oData.ErrorCode) :
Utils.getNotification(Enums.Notification.UnknownError))); Utils.getNotification(Enums.Notification.UnknownError)));
} }
@ -371,7 +373,7 @@
{ {
if (Remote.message(this.onMessageResponse, oMessage.folderFullNameRaw, oMessage.uid)) if (Remote.message(this.onMessageResponse, oMessage.folderFullNameRaw, oMessage.uid))
{ {
RL.data().messageLoading(true); Data.messageLoading(true);
} }
else else
{ {
@ -395,7 +397,7 @@
if (Utils.isUnd(aMessages)) if (Utils.isUnd(aMessages))
{ {
aMessages = RL.data().messageListChecked(); aMessages = Data.messageListChecked();
} }
aUids = _.map(aMessages, function (oMessage) { aUids = _.map(aMessages, function (oMessage) {
@ -470,7 +472,7 @@
{ {
var var
oFolder = null, oFolder = null,
aMessages = RL.data().messageList() aMessages = Data.messageList()
; ;
if ('' !== sFolderFullNameRaw) if ('' !== sFolderFullNameRaw)
@ -516,27 +518,27 @@
MailBoxMessageListViewModel.prototype.listSetSeen = function () MailBoxMessageListViewModel.prototype.listSetSeen = function ()
{ {
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen, RL.data().messageListCheckedOrSelected()); this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen, Data.messageListCheckedOrSelected());
}; };
MailBoxMessageListViewModel.prototype.listSetAllSeen = function () MailBoxMessageListViewModel.prototype.listSetAllSeen = function ()
{ {
this.setActionForAll(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen); this.setActionForAll(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetSeen);
}; };
MailBoxMessageListViewModel.prototype.listUnsetSeen = function () MailBoxMessageListViewModel.prototype.listUnsetSeen = function ()
{ {
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetSeen, RL.data().messageListCheckedOrSelected()); this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetSeen, Data.messageListCheckedOrSelected());
}; };
MailBoxMessageListViewModel.prototype.listSetFlags = function () MailBoxMessageListViewModel.prototype.listSetFlags = function ()
{ {
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.SetFlag, RL.data().messageListCheckedOrSelected()); this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.SetFlag, Data.messageListCheckedOrSelected());
}; };
MailBoxMessageListViewModel.prototype.listUnsetFlags = function () MailBoxMessageListViewModel.prototype.listUnsetFlags = function ()
{ {
this.setAction(RL.data().currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, RL.data().messageListCheckedOrSelected()); this.setAction(Data.currentFolderFullNameRaw(), Enums.MessageSetAction.UnsetFlag, Data.messageListCheckedOrSelected());
}; };
MailBoxMessageListViewModel.prototype.flagMessages = function (oCurrentMessage) MailBoxMessageListViewModel.prototype.flagMessages = function (oCurrentMessage)
@ -623,8 +625,7 @@
MailBoxMessageListViewModel.prototype.onBuild = function (oDom) MailBoxMessageListViewModel.prototype.onBuild = function (oDom)
{ {
var var
self = this, self = this
oData = RL.data()
; ;
this.oContentVisible = $('.b-content', oDom); this.oContentVisible = $('.b-content', oDom);
@ -638,9 +639,9 @@
if (oMessage && !oMessage.lastInCollapsedThreadLoading()) if (oMessage && !oMessage.lastInCollapsedThreadLoading())
{ {
RL.data().messageListThreadFolder(oMessage.folderFullNameRaw); Data.messageListThreadFolder(oMessage.folderFullNameRaw);
aList = RL.data().messageListThreadUids(); aList = Data.messageListThreadUids();
if (oMessage.lastInCollapsedThread()) if (oMessage.lastInCollapsedThread())
{ {
@ -651,7 +652,7 @@
aList = _.without(aList, 0 < oMessage.parentUid() ? oMessage.parentUid() : oMessage.uid); aList = _.without(aList, 0 < oMessage.parentUid() ? oMessage.parentUid() : oMessage.uid);
} }
RL.data().messageListThreadUids(_.uniq(aList)); Data.messageListThreadUids(_.uniq(aList));
oMessage.lastInCollapsedThreadLoading(true); oMessage.lastInCollapsedThreadLoading(true);
oMessage.lastInCollapsedThread(!oMessage.lastInCollapsedThread()); oMessage.lastInCollapsedThread(!oMessage.lastInCollapsedThread());
@ -675,9 +676,9 @@
if (oPage) if (oPage)
{ {
kn.setHash(LinkBuilder.mailBox( kn.setHash(LinkBuilder.mailBox(
oData.currentFolderFullNameHash(), Data.currentFolderFullNameHash(),
oPage.value, oPage.value,
oData.messageListSearch() Data.messageListSearch()
)); ));
} }
}) })
@ -692,7 +693,7 @@
this.initUploaderForAppend(); this.initUploaderForAppend();
this.initShortcuts(); this.initShortcuts();
if (!Globals.bMobileDevice && RL.capa(Enums.Capa.Prefetch) && ifvisible) if (!Globals.bMobileDevice && AppSettings.capa(Enums.Capa.Prefetch) && ifvisible)
{ {
ifvisible.setIdleDuration(10); ifvisible.setIdleDuration(10);
@ -721,7 +722,7 @@
key('delete, shift+delete, shift+3', Enums.KeyState.MessageList, function (event, handler) { key('delete, shift+delete, shift+3', Enums.KeyState.MessageList, function (event, handler) {
if (event) if (event)
{ {
if (0 < RL.data().messageListCheckedOrSelected().length) if (0 < Data.messageListCheckedOrSelected().length)
{ {
if (handler && 'shift+delete' === handler.shortcut) if (handler && 'shift+delete' === handler.shortcut)
{ {
@ -880,7 +881,7 @@
MailBoxMessageListViewModel.prototype.initUploaderForAppend = function () MailBoxMessageListViewModel.prototype.initUploaderForAppend = function ()
{ {
if (!RL.settingsGet('AllowAppendMessage') || !this.dragOverArea()) if (!AppSettings.settingsGet('AllowAppendMessage') || !this.dragOverArea())
{ {
return false; return false;
} }
@ -893,7 +894,7 @@
'disableFolderDragAndDrop': true, 'disableFolderDragAndDrop': true,
'hidden': { 'hidden': {
'Folder': function () { 'Folder': function () {
return RL.data().currentFolderFullNameRaw(); return Data.currentFolderFullNameRaw();
} }
}, },
'dragAndDropElement': this.dragOverArea(), 'dragAndDropElement': this.dragOverArea(),
@ -916,7 +917,7 @@
.on('onSelect', _.bind(function (sUid, oData) { .on('onSelect', _.bind(function (sUid, oData) {
if (sUid && oData && 'message/rfc822' === oData['Type']) if (sUid && oData && 'message/rfc822' === oData['Type'])
{ {
RL.data().messageListLoading(true); Data.messageListLoading(true);
return true; return true;
} }
@ -930,6 +931,6 @@
return !!oJua; return !!oJua;
}; };
module.exports = new MailBoxMessageListViewModel(); module.exports = MailBoxMessageListViewModel;
}(module)); }(module));

View file

@ -5,17 +5,23 @@
'use strict'; 'use strict';
var var
$ = require('../External/jquery.js'),
ko = require('../External/ko.js'), ko = require('../External/ko.js'),
key = require('../External/key.js'), key = require('../External/key.js'),
$html = require('../External/$html.js'), $html = require('../External/$html.js'),
Consts = require('../Common/Consts.js'), Consts = require('../Common/Consts.js'),
Enums = require('../Common/Enums.js'), Enums = require('../Common/Enums.js'),
Globals = require('../Common/Globals.js'),
Utils = require('../Common/Utils.js'), Utils = require('../Common/Utils.js'),
Events = require('../Common/Events.js'),
Cache = require('../Storages/WebMailCacheStorage.js'), Cache = require('../Storages/WebMailCacheStorage.js'),
Data = require('../Storages/WebMailDataStorage.js'),
Remote = require('../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../Boots/RainLoopApp.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
; ;
@ -31,7 +37,6 @@
var var
self = this, self = this,
sLastEmail = '', sLastEmail = '',
oData = RL.data(),
createCommandHelper = function (sType) { createCommandHelper = function (sType) {
return Utils.createCommand(self, function () { return Utils.createCommand(self, function () {
this.replyOrforward(sType); this.replyOrforward(sType);
@ -41,24 +46,23 @@
this.oMessageScrollerDom = null; this.oMessageScrollerDom = null;
this.keyScope = oData.keyScope; this.message = Data.message;
this.message = oData.message; this.currentMessage = Data.currentMessage;
this.currentMessage = oData.currentMessage; this.messageListChecked = Data.messageListChecked;
this.messageListChecked = oData.messageListChecked; this.hasCheckedMessages = Data.hasCheckedMessages;
this.hasCheckedMessages = oData.hasCheckedMessages; this.messageListCheckedOrSelectedUidsWithSubMails = Data.messageListCheckedOrSelectedUidsWithSubMails;
this.messageListCheckedOrSelectedUidsWithSubMails = oData.messageListCheckedOrSelectedUidsWithSubMails; this.messageLoading = Data.messageLoading;
this.messageLoading = oData.messageLoading; this.messageLoadingThrottle = Data.messageLoadingThrottle;
this.messageLoadingThrottle = oData.messageLoadingThrottle; this.messagesBodiesDom = Data.messagesBodiesDom;
this.messagesBodiesDom = oData.messagesBodiesDom; this.useThreads = Data.useThreads;
this.useThreads = oData.useThreads; this.replySameFolder = Data.replySameFolder;
this.replySameFolder = oData.replySameFolder; this.layout = Data.layout;
this.layout = oData.layout; this.usePreviewPane = Data.usePreviewPane;
this.usePreviewPane = oData.usePreviewPane; this.isMessageSelected = Data.isMessageSelected;
this.isMessageSelected = oData.isMessageSelected; this.messageActiveDom = Data.messageActiveDom;
this.messageActiveDom = oData.messageActiveDom; this.messageError = Data.messageError;
this.messageError = oData.messageError;
this.fullScreenMode = oData.messageFullScreenMode; this.fullScreenMode = Data.messageFullScreenMode;
this.showFullInfo = ko.observable(false); this.showFullInfo = ko.observable(false);
this.moreDropdownTrigger = ko.observable(false); this.moreDropdownTrigger = ko.observable(false);
@ -79,7 +83,7 @@
// commands // commands
this.closeMessage = Utils.createCommand(this, function () { this.closeMessage = Utils.createCommand(this, function () {
oData.message(null); Data.message(null);
}); });
this.replyCommand = createCommandHelper(Enums.ComposeType.Reply); this.replyCommand = createCommandHelper(Enums.ComposeType.Reply);
@ -107,7 +111,7 @@
if (this.message()) if (this.message())
{ {
RL.deleteMessagesFromFolder(Enums.FolderType.Trash, RL.deleteMessagesFromFolder(Enums.FolderType.Trash,
RL.data().currentFolderFullNameRaw(), Data.currentFolderFullNameRaw(),
[this.message().uid], false); [this.message().uid], false);
} }
}, this.messageVisibility); }, this.messageVisibility);
@ -235,11 +239,11 @@
}); });
this.goUpCommand = Utils.createCommand(this, function () { this.goUpCommand = Utils.createCommand(this, function () {
RL.pub('mailbox.message-list.selector.go-up'); Events.pub('mailbox.message-list.selector.go-up');
}); });
this.goDownCommand = Utils.createCommand(this, function () { this.goDownCommand = Utils.createCommand(this, function () {
RL.pub('mailbox.message-list.selector.go-down'); Events.pub('mailbox.message-list.selector.go-down');
}); });
kn.constructorEnd(this); kn.constructorEnd(this);
@ -331,14 +335,13 @@
*/ */
MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType) MailBoxMessageViewViewModel.prototype.replyOrforward = function (sType)
{ {
kn.showScreenPopup(PopupsComposeViewModel, [sType, RL.data().message()]); kn.showScreenPopup(PopupsComposeViewModel, [sType, Data.message()]);
}; };
MailBoxMessageViewViewModel.prototype.onBuild = function (oDom) MailBoxMessageViewViewModel.prototype.onBuild = function (oDom)
{ {
var var
self = this, self = this
oData = RL.data()
; ;
this.fullScreenMode.subscribe(function (bValue) { this.fullScreenMode.subscribe(function (bValue) {
@ -358,10 +361,10 @@
}, },
'callbacks': { 'callbacks': {
'open': function() { 'open': function() {
oData.useKeyboardShortcuts(false); Globals.useKeyboardShortcuts(false);
}, },
'close': function() { 'close': function() {
oData.useKeyboardShortcuts(true); Globals.useKeyboardShortcuts(true);
} }
}, },
'mainClass': 'mfp-fade', 'mainClass': 'mfp-fade',
@ -370,7 +373,7 @@
oDom oDom
.on('click', '.messageView .messageItem .messageItemHeader', function () { .on('click', '.messageView .messageItem .messageItemHeader', function () {
if (oData.useKeyboardShortcuts() && self.message()) if (Globals.useKeyboardShortcuts() && self.message())
{ {
self.message.focused(true); self.message.focused(true);
} }
@ -407,13 +410,13 @@
}, this); }, this);
this.messageDomFocused.subscribe(function (bValue) { this.messageDomFocused.subscribe(function (bValue) {
if (!bValue && Enums.KeyState.MessageView === this.keyScope()) if (!bValue && Enums.KeyState.MessageView === Globals.keyScope())
{ {
this.message.focused(false); this.message.focused(false);
} }
}, this); }, this);
this.keyScope.subscribe(function (sValue) { Globals.keyScope.subscribe(function (sValue) {
if (Enums.KeyState.MessageView === sValue && this.message.focused()) if (Enums.KeyState.MessageView === sValue && this.message.focused())
{ {
this.messageDomFocused(true); this.messageDomFocused(true);
@ -437,7 +440,7 @@
{ {
this.fullScreenMode(false); this.fullScreenMode(false);
} }
else if (Enums.Layout.NoPreview === RL.data().layout()) else if (Enums.Layout.NoPreview === Data.layout())
{ {
this.message(null); this.message(null);
} }
@ -453,8 +456,7 @@
MailBoxMessageViewViewModel.prototype.initShortcuts = function () MailBoxMessageViewViewModel.prototype.initShortcuts = function ()
{ {
var var
self = this, self = this
oData = RL.data()
; ;
// exit fullscreen, back // exit fullscreen, back
@ -467,7 +469,7 @@
}); });
key('enter', Enums.KeyState.MessageList, function () { key('enter', Enums.KeyState.MessageList, function () {
if (Enums.Layout.NoPreview !== oData.layout() && self.message()) if (Enums.Layout.NoPreview !== Data.layout() && self.message())
{ {
self.toggleFullScreen(); self.toggleFullScreen();
return false; return false;
@ -482,7 +484,7 @@
// reply // reply
key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { key('r', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message()) if (Data.message())
{ {
self.replyCommand(); self.replyCommand();
return false; return false;
@ -491,7 +493,7 @@
// replaAll // replaAll
key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { key('a', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message()) if (Data.message())
{ {
self.replyAllCommand(); self.replyAllCommand();
return false; return false;
@ -500,7 +502,7 @@
// forward // forward
key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { key('f', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message()) if (Data.message())
{ {
self.forwardCommand(); self.forwardCommand();
return false; return false;
@ -518,9 +520,9 @@
// toggle message blockquotes // toggle message blockquotes
key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () { key('b', [Enums.KeyState.MessageList, Enums.KeyState.MessageView], function () {
if (oData.message() && oData.message().body) if (Data.message() && Data.message().body)
{ {
Utils.toggleMessageBlockquote(oData.message().body); Utils.toggleMessageBlockquote(Data.message().body);
return false; return false;
} }
}); });
@ -564,7 +566,7 @@
// change focused state // change focused state
key('tab, shift+tab, left', Enums.KeyState.MessageView, function () { key('tab, shift+tab, left', Enums.KeyState.MessageView, function () {
if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== oData.layout()) if (!self.fullScreenMode() && self.message() && Enums.Layout.NoPreview !== Data.layout())
{ {
self.message.focused(false); self.message.focused(false);
} }
@ -578,7 +580,7 @@
*/ */
MailBoxMessageViewViewModel.prototype.isDraftFolder = function () MailBoxMessageViewViewModel.prototype.isDraftFolder = function ()
{ {
return RL.data().message() && RL.data().draftFolder() === RL.data().message().folderFullNameRaw; return Data.message() && Data.draftFolder() === Data.message().folderFullNameRaw;
}; };
/** /**
@ -586,7 +588,7 @@
*/ */
MailBoxMessageViewViewModel.prototype.isSentFolder = function () MailBoxMessageViewViewModel.prototype.isSentFolder = function ()
{ {
return RL.data().message() && RL.data().sentFolder() === RL.data().message().folderFullNameRaw; return Data.message() && Data.sentFolder() === Data.message().folderFullNameRaw;
}; };
/** /**
@ -594,7 +596,7 @@
*/ */
MailBoxMessageViewViewModel.prototype.isSpamFolder = function () MailBoxMessageViewViewModel.prototype.isSpamFolder = function ()
{ {
return RL.data().message() && RL.data().spamFolder() === RL.data().message().folderFullNameRaw; return Data.message() && Data.spamFolder() === Data.message().folderFullNameRaw;
}; };
/** /**
@ -602,7 +604,7 @@
*/ */
MailBoxMessageViewViewModel.prototype.isSpamDisabled = function () MailBoxMessageViewViewModel.prototype.isSpamDisabled = function ()
{ {
return RL.data().message() && RL.data().spamFolder() === Consts.Values.UnuseOptionValue; return Data.message() && Data.spamFolder() === Consts.Values.UnuseOptionValue;
}; };
/** /**
@ -610,7 +612,7 @@
*/ */
MailBoxMessageViewViewModel.prototype.isArchiveFolder = function () MailBoxMessageViewViewModel.prototype.isArchiveFolder = function ()
{ {
return RL.data().message() && RL.data().archiveFolder() === RL.data().message().folderFullNameRaw; return Data.message() && Data.archiveFolder() === Data.message().folderFullNameRaw;
}; };
/** /**
@ -618,7 +620,7 @@
*/ */
MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function () MailBoxMessageViewViewModel.prototype.isArchiveDisabled = function ()
{ {
return RL.data().message() && RL.data().archiveFolder() === Consts.Values.UnuseOptionValue; return Data.message() && Data.archiveFolder() === Consts.Values.UnuseOptionValue;
}; };
/** /**
@ -636,9 +638,9 @@
MailBoxMessageViewViewModel.prototype.editMessage = function () MailBoxMessageViewViewModel.prototype.editMessage = function ()
{ {
if (RL.data().message()) if (Data.message())
{ {
kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, RL.data().message()]); kn.showScreenPopup(PopupsComposeViewModel, [Enums.ComposeType.Draft, Data.message()]);
} }
}; };
@ -703,7 +705,7 @@
Remote.sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid, Remote.sendReadReceiptMessage(Utils.emptyFunction, oMessage.folderFullNameRaw, oMessage.uid,
oMessage.readReceipt(), oMessage.readReceipt(),
Utils.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}), Utils.i18n('READ_RECEIPT/SUBJECT', {'SUBJECT': oMessage.subject()}),
Utils.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': RL.data().accountEmail()})); Utils.i18n('READ_RECEIPT/BODY', {'READ-RECEIPT': Data.accountEmail()}));
oMessage.isReadReceipt(true); oMessage.isReadReceipt(true);

View file

@ -9,6 +9,7 @@
Enums = require('../../Common/Enums.js'), Enums = require('../../Common/Enums.js'),
Utils = require('../../Common/Utils.js'), Utils = require('../../Common/Utils.js'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/AdminDataStorage.js'), Data = require('../../Storages/AdminDataStorage.js'),
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'), Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
@ -106,7 +107,7 @@
PopupsActivateViewModel.prototype.onShow = function () PopupsActivateViewModel.prototype.onShow = function ()
{ {
this.domain(RL.settingsGet('AdminDomain')); this.domain(AppSettings.settingsGet('AdminDomain'));
if (!this.activateProcess()) if (!this.activateProcess())
{ {
this.key(''); this.key('');
@ -133,6 +134,6 @@
return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue)); return '' === sValue || !!/^RL[\d]+-[A-Z0-9\-]+Z$/.test(Utils.trim(sValue));
}; };
module.exports = new PopupsActivateViewModel(); module.exports = PopupsActivateViewModel;
}(module)); }(module));

View file

@ -12,6 +12,8 @@
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -110,6 +112,6 @@
this.emailFocus(true); this.emailFocus(true);
}; };
module.exports = new PopupsAddAccountViewModel(); module.exports = PopupsAddAccountViewModel;
}(module)); }(module));

View file

@ -11,6 +11,8 @@
Data = require('../../Storages/WebMailDataStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -104,6 +106,6 @@
this.key.focus(true); this.key.focus(true);
}; };
module.exports = new PopupsAddOpenPgpKeyViewModel(); module.exports = PopupsAddOpenPgpKeyViewModel;
}(module)); }(module));

View file

@ -152,6 +152,6 @@
this.fromFocus(true); this.fromFocus(true);
}; };
module.exports = new PopupsAdvancedSearchViewModel(); module.exports = PopupsAdvancedSearchViewModel;
}(module)); }(module));

View file

@ -123,6 +123,6 @@
}, this)); }, this));
}; };
module.exports = new PopupsAskViewModel(); module.exports = PopupsAskViewModel;
}(module)); }(module));

View file

@ -257,6 +257,6 @@
this.text(sText); this.text(sText);
}; };
module.exports = new PopupsComposeOpenPgpViewModel(); module.exports = PopupsComposeOpenPgpViewModel;
}(module)); }(module));

View file

@ -5,6 +5,7 @@
'use strict'; 'use strict';
var var
window = require('../../External/window.js'),
$ = require('../../External/jquery.js'), $ = require('../../External/jquery.js'),
_ = require('../../External/underscore.js'), _ = require('../../External/underscore.js'),
ko = require('../../External/ko.js'), ko = require('../../External/ko.js'),
@ -13,12 +14,20 @@
Enums = require('../../Common/Enums.js'), Enums = require('../../Common/Enums.js'),
Consts = require('../../Common/Consts.js'), Consts = require('../../Common/Consts.js'),
Utils = require('../../Common/Utils.js'), Utils = require('../../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), Globals = require('../../Common/Globals.js'),
LinkBuilder = require('../../Common/LinkBuilder.js'),
Events = require('../../Common/Events.js'),
NewHtmlEditorWrapper = require('../../Common/NewHtmlEditorWrapper.js'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/WebMailDataStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'),
Cache = require('../../Storages/WebMailCacheStorage.js'), Cache = require('../../Storages/WebMailCacheStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
PopupsComposeOpenPgpViewModel = require('./PopupsComposeOpenPgpViewModel.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -38,7 +47,7 @@
this.bSkipNext = false; this.bSkipNext = false;
this.sReferences = ''; this.sReferences = '';
this.bCapaAdditionalIdentities = RL.capa(Enums.Capa.AdditionalIdentities); this.bCapaAdditionalIdentities = AppSettings.capa(Enums.Capa.AdditionalIdentities);
var var
self = this, self = this,
@ -330,7 +339,7 @@
}, this.canBeSendedOrSaved); }, this.canBeSendedOrSaved);
RL.sub('interval.1m', function () { Events.sub('interval.1m', function () {
if (this.modalVisibility() && !Data.draftFolderNotEnabled() && !this.isEmptyForm(false) && if (this.modalVisibility() && !Data.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
!this.bSkipNext && !this.saving() && !this.sending() && !this.savedError()) !this.bSkipNext && !this.saving() && !this.sending() && !this.savedError())
{ {
@ -343,7 +352,7 @@
this.triggerForResize(); this.triggerForResize();
}, this); }, this);
this.dropboxEnabled = ko.observable(!!RL.settingsGet('DropboxApiKey')); this.dropboxEnabled = ko.observable(!!AppSettings.settingsGet('DropboxApiKey'));
this.dropboxCommand = Utils.createCommand(this, function () { this.dropboxCommand = Utils.createCommand(this, function () {
@ -370,7 +379,7 @@
}); });
this.driveEnabled = ko.observable(Globals.bXMLHttpRequestSupported && this.driveEnabled = ko.observable(Globals.bXMLHttpRequestSupported &&
!!RL.settingsGet('GoogleClientID') && !!RL.settingsGet('GoogleApiKey')); !!AppSettings.settingsGet('GoogleClientID') && !!AppSettings.settingsGet('GoogleApiKey'));
this.driveVisible = ko.observable(false); this.driveVisible = ko.observable(false);
@ -390,11 +399,22 @@
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200); this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), 200);
this.emailsSource = _.bind(this.emailsSource, this);
kn.constructorEnd(this); kn.constructorEnd(this);
} }
kn.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel); kn.extendAsViewModel('PopupsComposeViewModel', PopupsComposeViewModel);
PopupsComposeViewModel.prototype.emailsSource = function (oData, fResponse)
{
RL.getAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oEmailItem) {
return oEmailItem.toLine(false);
}));
});
};
PopupsComposeViewModel.prototype.openOpenPgpPopup = function () PopupsComposeViewModel.prototype.openOpenPgpPopup = function ()
{ {
if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml()) if (this.capaOpenPGP() && this.oEditor && !this.oEditor.isHtml())
@ -1037,7 +1057,7 @@
oScript = document.createElement('script'); oScript = document.createElement('script');
oScript.type = 'text/javascript'; oScript.type = 'text/javascript';
oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js'; oScript.src = 'https://www.dropbox.com/static/api/1/dropins.js';
$(oScript).attr('id', 'dropboxjs').attr('data-app-key', RL.settingsGet('DropboxApiKey')); $(oScript).attr('id', 'dropboxjs').attr('data-app-key', AppSettings.settingsGet('DropboxApiKey'));
document.body.appendChild(oScript); document.body.appendChild(oScript);
} }
@ -1136,7 +1156,7 @@
new window.google.picker.DocsView() new window.google.picker.DocsView()
.setIncludeFolders(true) .setIncludeFolders(true)
) )
.setAppId(RL.settingsGet('GoogleClientID')) .setAppId(AppSettings.settingsGet('GoogleClientID'))
.setOAuthToken(oOauthToken.access_token) .setOAuthToken(oOauthToken.access_token)
.setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token)) .setCallback(_.bind(self.driveCallback, self, oOauthToken.access_token))
.enableFeature(window.google.picker.Feature.NAV_HIDDEN) .enableFeature(window.google.picker.Feature.NAV_HIDDEN)
@ -1161,7 +1181,7 @@
if (!oAuthToken) if (!oAuthToken)
{ {
window.gapi.auth.authorize({ window.gapi.auth.authorize({
'client_id': RL.settingsGet('GoogleClientID'), 'client_id': AppSettings.settingsGet('GoogleClientID'),
'scope': 'https://www.googleapis.com/auth/drive.readonly', 'scope': 'https://www.googleapis.com/auth/drive.readonly',
'immediate': true 'immediate': true
}, function (oAuthResult) { }, function (oAuthResult) {
@ -1176,7 +1196,7 @@
else else
{ {
window.gapi.auth.authorize({ window.gapi.auth.authorize({
'client_id': RL.settingsGet('GoogleClientID'), 'client_id': AppSettings.settingsGet('GoogleClientID'),
'scope': 'https://www.googleapis.com/auth/drive.readonly', 'scope': 'https://www.googleapis.com/auth/drive.readonly',
'immediate': false 'immediate': false
}, function (oAuthResult) { }, function (oAuthResult) {
@ -1229,7 +1249,7 @@
{ {
var var
oUploadCache = {}, oUploadCache = {},
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')), iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
oJua = new Jua({ oJua = new Jua({
'action': LinkBuilder.upload(), 'action': LinkBuilder.upload(),
'name': 'uploader', 'name': 'uploader',
@ -1478,7 +1498,7 @@
}); });
}; };
}, },
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')), iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
mSize = oDropboxFile['bytes'] mSize = oDropboxFile['bytes']
; ;
@ -1539,7 +1559,7 @@
}); });
}; };
}, },
iAttachmentSizeLimit = Utils.pInt(RL.settingsGet('AttachmentLimit')), iAttachmentSizeLimit = Utils.pInt(AppSettings.settingsGet('AttachmentLimit')),
oAttachment = null, oAttachment = null,
mSize = oDriveFile['fileSize'] ? Utils.pInt(oDriveFile['fileSize']) : 0 mSize = oDriveFile['fileSize'] ? Utils.pInt(oDriveFile['fileSize']) : 0
; ;
@ -1751,6 +1771,6 @@
this.editorResizeThrottle(); this.editorResizeThrottle();
}; };
module.exports = new PopupsComposeViewModel(); module.exports = PopupsComposeViewModel;
}(module)); }(module));

View file

@ -15,11 +15,14 @@
Consts = require('../../Common/Consts.js'), Consts = require('../../Common/Consts.js'),
Globals = require('../../Common/Globals.js'), Globals = require('../../Common/Globals.js'),
Utils = require('../../Common/Utils.js'), Utils = require('../../Common/Utils.js'),
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../../Common/LinkBuilder.js'),
Selector = require('../../Common/Selector.js'),
Data = require('../../Storages/WebMailDataStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -380,11 +383,22 @@
this.sDefaultKeyScope = Enums.KeyState.ContactList; this.sDefaultKeyScope = Enums.KeyState.ContactList;
this.contactTagsSource = _.bind(this.contactTagsSource, this);
kn.constructorEnd(this); kn.constructorEnd(this);
} }
kn.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel); kn.extendAsViewModel('PopupsContactsViewModel', PopupsContactsViewModel);
PopupsContactsViewModel.prototype.contactTagsSource = function (oData, fResponse)
{
RL.getContactTagsAutocomplete(oData.term, function (aData) {
fResponse(_.map(aData, function (oTagItem) {
return oTagItem.toLine(false);
}));
});
};
PopupsContactsViewModel.prototype.getPropertyPlceholder = function (sType) PopupsContactsViewModel.prototype.getPropertyPlceholder = function (sType)
{ {
var sResult = ''; var sResult = '';
@ -763,6 +777,6 @@
this.contacts([]); this.contacts([]);
}; };
module.exports = new PopupsContactsViewModel(); module.exports = PopupsContactsViewModel;
}(module)); }(module));

View file

@ -14,6 +14,8 @@
Remote = require('../../Storages/AdminAjaxRemoteStorage.js'), Remote = require('../../Storages/AdminAjaxRemoteStorage.js'),
RL = require('../../Boots/AdminApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -313,6 +315,6 @@
this.whiteList(''); this.whiteList('');
}; };
module.exports = new PopupsDomainViewModel(); module.exports = PopupsDomainViewModel;
}(module)); }(module));

View file

@ -47,11 +47,6 @@
this.filter(oFilter); this.filter(oFilter);
}; };
// PopupsFilterViewModel.prototype.onFocus = function () module.exports = PopupsFilterViewModel;
// {
//
// };
module.exports = new PopupsFilterViewModel();
}(module)); }(module));

View file

@ -15,6 +15,8 @@
Cache = require('../../Storages/WebMailCacheStorage.js'), Cache = require('../../Storages/WebMailCacheStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -115,6 +117,6 @@
} }
}; };
module.exports = new PopupsFolderClearViewModel(); module.exports = PopupsFolderClearViewModel;
}(module)); }(module));

View file

@ -14,6 +14,8 @@
Data = require('../../Storages/WebMailDataStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -57,7 +59,7 @@
}; };
} }
return RL.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback); return Utils.folderListOptionsBuilder([], aList, [], aTop, null, fDisableCallback, fVisibleCallback, fRenameCallback);
}, this); }, this);
@ -123,6 +125,6 @@
this.folderName.focused(true); this.folderName.focused(true);
}; };
module.exports = new PopupsFolderCreateViewModel(); module.exports = PopupsFolderCreateViewModel;
}(module)); }(module));

View file

@ -11,9 +11,12 @@
Consts = require('../../Common/Consts.js'), Consts = require('../../Common/Consts.js'),
Utils = require('../../Common/Utils.js'), Utils = require('../../Common/Utils.js'),
AppSettings = require('../../Storages/AppSettings.js'),
Data = require('../../Storages/WebMailDataStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'),
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -34,7 +37,7 @@
this.notification = ko.observable(''); this.notification = ko.observable('');
this.folderSelectList = ko.computed(function () { this.folderSelectList = ko.computed(function () {
return RL.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [ return Utils.folderListOptionsBuilder([], Data.folderList(), Data.folderListSystemNames(), [
['', this.sChooseOnText], ['', this.sChooseOnText],
[Consts.Values.UnuseOptionValue, this.sUnuseText] [Consts.Values.UnuseOptionValue, this.sUnuseText]
]); ]);
@ -54,11 +57,11 @@
fSaveSystemFolders = _.debounce(function () { fSaveSystemFolders = _.debounce(function () {
RL.settingsSet('SentFolder', self.sentFolder()); AppSettings.settingsSet('SentFolder', self.sentFolder());
RL.settingsSet('DraftFolder', self.draftFolder()); AppSettings.settingsSet('DraftFolder', self.draftFolder());
RL.settingsSet('SpamFolder', self.spamFolder()); AppSettings.settingsSet('SpamFolder', self.spamFolder());
RL.settingsSet('TrashFolder', self.trashFolder()); AppSettings.settingsSet('TrashFolder', self.trashFolder());
RL.settingsSet('ArchiveFolder', self.archiveFolder()); AppSettings.settingsSet('ArchiveFolder', self.archiveFolder());
Remote.saveSystemFolders(Utils.emptyFunction, { Remote.saveSystemFolders(Utils.emptyFunction, {
'SentFolder': self.sentFolder(), 'SentFolder': self.sentFolder(),
@ -73,11 +76,11 @@
fCallback = function () { fCallback = function () {
RL.settingsSet('SentFolder', self.sentFolder()); AppSettings.settingsSet('SentFolder', self.sentFolder());
RL.settingsSet('DraftFolder', self.draftFolder()); AppSettings.settingsSet('DraftFolder', self.draftFolder());
RL.settingsSet('SpamFolder', self.spamFolder()); AppSettings.settingsSet('SpamFolder', self.spamFolder());
RL.settingsSet('TrashFolder', self.trashFolder()); AppSettings.settingsSet('TrashFolder', self.trashFolder());
RL.settingsSet('ArchiveFolder', self.archiveFolder()); AppSettings.settingsSet('ArchiveFolder', self.archiveFolder());
fSaveSystemFolders(); fSaveSystemFolders();
}; };
@ -129,6 +132,6 @@
this.notification(sNotification); this.notification(sNotification);
}; };
module.exports = new PopupsFolderSystemViewModel(); module.exports = PopupsFolderSystemViewModel;
}(module)); }(module));

View file

@ -12,6 +12,8 @@
Data = require('../../Storages/WebMailDataStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
kn = require('../../Knoin/Knoin.js'), kn = require('../../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -110,6 +112,6 @@
this.email.focus(true); this.email.focus(true);
}; };
module.exports = new PopupsGenerateNewOpenPgpKeyViewModel(); module.exports = PopupsGenerateNewOpenPgpKeyViewModel;
}(module)); }(module));

View file

@ -14,6 +14,8 @@
Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'), Remote = require('../../Storages/WebMailAjaxRemoteStorage.js'),
Data = require('../../Storages/WebMailDataStorage.js'), Data = require('../../Storages/WebMailDataStorage.js'),
RL = require('../../Boots/RainLoopApp.js'),
KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../../Knoin/KnoinAbstractViewModel.js')
; ;
@ -165,6 +167,6 @@
} }
}; };
module.exports = new PopupsIdentityViewModel(); module.exports = PopupsIdentityViewModel;
}(module)); }(module));

View file

@ -58,6 +58,6 @@
}, this)); }, this));
}; };
module.exports = new AdminPaneViewModel(); module.exports = PopupsKeyboardShortcutsHelpViewModel;
}(module)); }(module));

View file

@ -76,6 +76,6 @@
this.cancelCommand(); this.cancelCommand();
}; };
module.exports = new PopupsLanguagesViewModel(); module.exports = PopupsLanguagesViewModel;
}(module)); }(module));

View file

@ -160,6 +160,6 @@
}, this)); }, this));
}; };
module.exports = new PopupsPluginViewModel(); module.exports = PopupsPluginViewModel;
}(module)); }(module));

View file

@ -70,6 +70,6 @@
this.code.focused(true); this.code.focused(true);
}; };
module.exports = new PopupsTwoFactorTestViewModel(); module.exports = PopupsTwoFactorTestViewModel;
}(module)); }(module));

View file

@ -51,6 +51,6 @@
} }
}; };
module.exports = new PopupsViewOpenPgpKeyViewModel(); module.exports = PopupsViewOpenPgpKeyViewModel;
}(module)); }(module));

View file

@ -6,8 +6,7 @@
var var
LinkBuilder = require('../Common/LinkBuilder.js'), LinkBuilder = require('../Common/LinkBuilder.js'),
Globals = require('../Common/Globals.js'),
Data = require('../Storages/WebMailDataStorage.js'),
kn = require('../Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js') KnoinAbstractViewModel = require('../Knoin/KnoinAbstractViewModel.js')
@ -23,7 +22,7 @@
{ {
KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu'); KnoinAbstractViewModel.call(this, 'Left', 'SettingsMenu');
this.leftPanelDisabled = Data.leftPanelDisabled; this.leftPanelDisabled = Globals.leftPanelDisabled;
this.menu = oScreen.menu; this.menu = oScreen.menu;

View file

@ -5,7 +5,7 @@
'use strict'; 'use strict';
var var
kn = require('./Knoin/Knoin.js'), kn = require('../Knoin/Knoin.js'),
AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js') AbstractSystemDropDownViewModel = require('./AbstractSystemDropDownViewModel.js')
; ;

View file

@ -2,6 +2,5 @@
'use strict'; 'use strict';
module.exports = function () { var boot = require('./Boots/Boot.js');
return require('./Knoin/Knoin.js').rl(); boot(require('./Boots/AdminApp.js'));
};

View file

@ -2,6 +2,5 @@
'use strict'; 'use strict';
module.exports = function () { var boot = require('./Boots/Boot.js');
return require('./Knoin/Knoin.js').remote(); boot(require('./Boots/RainLoopApp.js'));
};

View file

@ -610,6 +610,7 @@ gulp.task('b+', ['rainloop+']);
gulp.task('own', ['owncloud']); gulp.task('own', ['owncloud']);
var browserify = require('browserify'); var browserify = require('browserify');
var streamify = require('gulp-streamify');
var source = require('vinyl-source-stream'); var source = require('vinyl-source-stream');
gulp.task('bro', function() { gulp.task('bro', function() {
@ -618,8 +619,14 @@ gulp.task('bro', function() {
'detectGlobals': false, 'detectGlobals': false,
'debug': false 'debug': false
}) })
.add('./RainLoopBoot.js') .add('./_RainLoopBoot.js')
.bundle() .bundle()
.pipe(source('bro.js')) .pipe(source('app.js'))
// .pipe(rename('app.min.js'))
// .pipe(streamify(uglify(cfg.uglify)))
.pipe(gulp.dest(cfg.paths.staticJS)); .pipe(gulp.dest(cfg.paths.staticJS));
}); });
gulp.task('ww', ['bro'], function() {
gulp.watch('dev/**/*.js', {interval: 1000}, ['bro']);
});

View file

@ -59,6 +59,7 @@
"gulp-rename": "*", "gulp-rename": "*",
"gulp-header": "*", "gulp-header": "*",
"gulp-footer": "*", "gulp-footer": "*",
"gulp-streamify": "*",
"gulp-minify-css": "*", "gulp-minify-css": "*",
"gulp-concat-util": "*" "gulp-concat-util": "*"

View file

@ -57,7 +57,7 @@
</label> </label>
</div> </div>
<div class="e-cell e-value"> <div class="e-cell e-value">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: to, emailsTagsFilter: to.focusTrigger" /> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: to, emailsTagsFilter: to.focusTrigger, autoCompleteSource: emailsSource" />
<span class="help-block error-desc" data-bind="visible: emptyToError"> <span class="help-block error-desc" data-bind="visible: emptyToError">
<span class="i18n" data-i18n-text="COMPOSE/EMPTY_TO_ERROR_DESC"></span> <span class="i18n" data-i18n-text="COMPOSE/EMPTY_TO_ERROR_DESC"></span>
</span> </span>
@ -68,7 +68,7 @@
<span class="i18n" data-i18n-text="COMPOSE/TITLE_CC"></span> <span class="i18n" data-i18n-text="COMPOSE/TITLE_CC"></span>
</div> </div>
<div class="e-cell e-value"> <div class="e-cell e-value">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: cc" /> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: cc, autoCompleteSource: emailsSource" />
</div> </div>
</div> </div>
<div class="e-row bcc-row" data-bind="visible: showCcAndBcc"> <div class="e-row bcc-row" data-bind="visible: showCcAndBcc">
@ -76,7 +76,7 @@
<span class="i18n" data-i18n-text="COMPOSE/TITLE_BCC"></span> <span class="i18n" data-i18n-text="COMPOSE/TITLE_BCC"></span>
</div> </div>
<div class="e-cell e-value"> <div class="e-cell e-value">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: bcc" /> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: bcc, autoCompleteSource: emailsSource" />
</div> </div>
</div> </div>
<div class="e-row reply-to-row" data-bind="visible: false"> <div class="e-row reply-to-row" data-bind="visible: false">
@ -84,7 +84,7 @@
<span class="i18n" data-i18n-text="COMPOSE/TITLE_REPLY_TO"></span> <span class="i18n" data-i18n-text="COMPOSE/TITLE_REPLY_TO"></span>
</div> </div>
<div class="e-cell e-value"> <div class="e-cell e-value">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: replyTo" /> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="emailsTags: replyTo, autoCompleteSource: emailsSource" />
</div> </div>
</div> </div>
<div class="e-row"> <div class="e-row">

View file

@ -270,7 +270,7 @@
<div class="controls fix-width"> <div class="controls fix-width">
<div class="property-line"> <div class="property-line">
<div class="tags-property-container"> <div class="tags-property-container">
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="contactTags: viewTags, contactTagsFilter: viewTags.focusTrigger" /> <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" data-bind="contactTags: viewTags, contactTagsFilter: viewTags.focusTrigger, autoCompleteSource: contactTagsSource" />
</div> </div>
</div> </div>
</div> </div>

File diff suppressed because it is too large Load diff

11
rainloop/v/0.0.0/static/js/_app.min.js vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load diff