mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
js -> jsx
This commit is contained in:
parent
3bcf23f8fa
commit
08ccf55577
43 changed files with 2342 additions and 2347 deletions
|
|
@ -1,8 +1,14 @@
|
||||||
|
|
||||||
import {window, _, $, key} from 'common';
|
import {window, _, $, key} from 'common';
|
||||||
import Globals from 'Common/Globals';
|
|
||||||
import * as Enums from 'Common/Enums';
|
import {
|
||||||
import Utils from 'Common/Utils';
|
$win, $html, $doc,
|
||||||
|
startMicrotime, leftPanelDisabled, leftPanelType,
|
||||||
|
sUserAgent, bMobileDevice, bAnimationSupported
|
||||||
|
} from 'Common/Globals';
|
||||||
|
|
||||||
|
import {KeyState} from 'Common/Enums';
|
||||||
|
import {noop, isNormal, pString, inArray, microtime, timestamp, detectDropdownVisibility, windowResizeCallback} from 'Common/Utils';
|
||||||
import Links from 'Common/Links';
|
import Links from 'Common/Links';
|
||||||
import Events from 'Common/Events';
|
import Events from 'Common/Events';
|
||||||
import Translator from 'Common/Translator';
|
import Translator from 'Common/Translator';
|
||||||
|
|
@ -15,6 +21,7 @@ class AbstractApp extends AbstractBoot
|
||||||
googlePreviewSupportedCache = null;
|
googlePreviewSupportedCache = null;
|
||||||
isLocalAutocomplete = true;
|
isLocalAutocomplete = true;
|
||||||
iframe = null;
|
iframe = null;
|
||||||
|
lastErrorTime = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param {RemoteStorage|AdminRemoteStorage} Remote
|
* @param {RemoteStorage|AdminRemoteStorage} Remote
|
||||||
|
|
@ -25,39 +32,47 @@ class AbstractApp extends AbstractBoot
|
||||||
|
|
||||||
this.iframe = $('<iframe class="internal-hiddden" />').appendTo('body');
|
this.iframe = $('<iframe class="internal-hiddden" />').appendTo('body');
|
||||||
|
|
||||||
Globals.$win.on('error', function (oEvent) {
|
$win.on('error', (event) => {
|
||||||
if (oEvent && oEvent.originalEvent && oEvent.originalEvent.message &&
|
if (event && event.originalEvent && event.originalEvent.message &&
|
||||||
-1 === Utils.inArray(oEvent.originalEvent.message, [
|
-1 === inArray(event.originalEvent.message, [
|
||||||
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
|
'Script error.', 'Uncaught Error: Error calling method on NPObject.'
|
||||||
]))
|
]))
|
||||||
{
|
{
|
||||||
|
const time = timestamp();
|
||||||
|
if (this.lastErrorTime >= time)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.lastErrorTime = time;
|
||||||
|
|
||||||
Remote.jsError(
|
Remote.jsError(
|
||||||
Utils.emptyFunction,
|
noop,
|
||||||
oEvent.originalEvent.message,
|
event.originalEvent.message,
|
||||||
oEvent.originalEvent.filename,
|
event.originalEvent.filename,
|
||||||
oEvent.originalEvent.lineno,
|
event.originalEvent.lineno,
|
||||||
window.location && window.location.toString ? window.location.toString() : '',
|
window.location && window.location.toString ? window.location.toString() : '',
|
||||||
Globals.$html.attr('class'),
|
$html.attr('class'),
|
||||||
Utils.microtime() - Globals.startMicrotime
|
microtime() - startMicrotime
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.$win.on('resize', function () {
|
$win.on('resize', function () {
|
||||||
Events.pub('window.resize');
|
Events.pub('window.resize');
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.sub('window.resize', _.throttle(function () {
|
Events.sub('window.resize', _.throttle(function () {
|
||||||
|
|
||||||
var
|
var
|
||||||
iH = Globals.$win.height(),
|
iH = $win.height(),
|
||||||
iW = Globals.$win.height()
|
iW = $win.height()
|
||||||
;
|
;
|
||||||
|
|
||||||
if (Globals.$win.__sizes[0] !== iH || Globals.$win.__sizes[1] !== iW)
|
if ($win.__sizes[0] !== iH || $win.__sizes[1] !== iW)
|
||||||
{
|
{
|
||||||
Globals.$win.__sizes[0] = iH;
|
$win.__sizes[0] = iH;
|
||||||
Globals.$win.__sizes[1] = iW;
|
$win.__sizes[1] = iW;
|
||||||
|
|
||||||
Events.pub('window.resize.real');
|
Events.pub('window.resize.real');
|
||||||
}
|
}
|
||||||
|
|
@ -74,24 +89,24 @@ class AbstractApp extends AbstractBoot
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
|
|
||||||
Globals.$doc.on('keydown', function (oEvent) {
|
$doc.on('keydown', function (oEvent) {
|
||||||
if (oEvent && oEvent.ctrlKey)
|
if (oEvent && oEvent.ctrlKey)
|
||||||
{
|
{
|
||||||
Globals.$html.addClass('rl-ctrl-key-pressed');
|
$html.addClass('rl-ctrl-key-pressed');
|
||||||
}
|
}
|
||||||
}).on('keyup', function (oEvent) {
|
}).on('keyup', function (oEvent) {
|
||||||
if (oEvent && !oEvent.ctrlKey)
|
if (oEvent && !oEvent.ctrlKey)
|
||||||
{
|
{
|
||||||
Globals.$html.removeClass('rl-ctrl-key-pressed');
|
$html.removeClass('rl-ctrl-key-pressed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.$doc.on('mousemove keypress click', _.debounce(function () {
|
$doc.on('mousemove keypress click', _.debounce(function () {
|
||||||
Events.pub('rl.auto-logout-refresh');
|
Events.pub('rl.auto-logout-refresh');
|
||||||
}, 5000));
|
}, 5000));
|
||||||
|
|
||||||
key('esc, enter', Enums.KeyState.All, _.bind(function () {
|
key('esc, enter', KeyState.All, _.bind(function () {
|
||||||
Utils.detectDropdownVisibility();
|
detectDropdownVisibility();
|
||||||
}, this));
|
}, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -113,7 +128,7 @@ class AbstractApp extends AbstractBoot
|
||||||
*/
|
*/
|
||||||
download(link) {
|
download(link) {
|
||||||
|
|
||||||
if (Globals.sUserAgent && (Globals.sUserAgent.indexOf('chrome') > -1 || Globals.sUserAgent.indexOf('chrome') > -1))
|
if (sUserAgent && (sUserAgent.indexOf('chrome') > -1 || sUserAgent.indexOf('chrome') > -1))
|
||||||
{
|
{
|
||||||
const oLink = window.document.createElement('a');
|
const oLink = window.document.createElement('a');
|
||||||
oLink.href = link;
|
oLink.href = link;
|
||||||
|
|
@ -130,7 +145,7 @@ class AbstractApp extends AbstractBoot
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Globals.bMobileDevice)
|
if (bMobileDevice)
|
||||||
{
|
{
|
||||||
window.open(link, '_self');
|
window.open(link, '_self');
|
||||||
window.focus();
|
window.focus();
|
||||||
|
|
@ -161,7 +176,7 @@ class AbstractApp extends AbstractBoot
|
||||||
* @param {string} title
|
* @param {string} title
|
||||||
*/
|
*/
|
||||||
setWindowTitle(title) {
|
setWindowTitle(title) {
|
||||||
title = ((Utils.isNormal(title) && 0 < title.length) ? '' + title : '');
|
title = ((isNormal(title) && 0 < title.length) ? '' + title : '');
|
||||||
if (Settings.settingsGet('Title'))
|
if (Settings.settingsGet('Title'))
|
||||||
{
|
{
|
||||||
title += (title ? ' - ' : '') + Settings.settingsGet('Title');
|
title += (title ? ' - ' : '') + Settings.settingsGet('Title');
|
||||||
|
|
@ -208,7 +223,7 @@ class AbstractApp extends AbstractBoot
|
||||||
inIframe = !!Settings.appSettingsGet('inIframe')
|
inIframe = !!Settings.appSettingsGet('inIframe')
|
||||||
;
|
;
|
||||||
|
|
||||||
let customLogoutLink = Utils.pString(Settings.appSettingsGet('customLogoutLink'));
|
let customLogoutLink = pString(Settings.appSettingsGet('customLogoutLink'));
|
||||||
|
|
||||||
if (logout)
|
if (logout)
|
||||||
{
|
{
|
||||||
|
|
@ -260,7 +275,7 @@ class AbstractApp extends AbstractBoot
|
||||||
|
|
||||||
bootstart() {
|
bootstart() {
|
||||||
|
|
||||||
// Utils.log('Ps' + 'ss, hac' + 'kers! The' + 're\'s not' + 'hing inte' + 'resting :' + ')');
|
// log('Ps' + 'ss, hac' + 'kers! The' + 're\'s not' + 'hing inte' + 'resting :' + ')');
|
||||||
|
|
||||||
Events.pub('rl.bootstart');
|
Events.pub('rl.bootstart');
|
||||||
|
|
||||||
|
|
@ -279,7 +294,7 @@ class AbstractApp extends AbstractBoot
|
||||||
ko.components.register('x-script', require('Component/Script'));
|
ko.components.register('x-script', require('Component/Script'));
|
||||||
// ko.components.register('svg-icon', require('Component/SvgIcon'));
|
// ko.components.register('svg-icon', require('Component/SvgIcon'));
|
||||||
|
|
||||||
if (Settings.appSettingsGet('materialDesign') && Globals.bAnimationSupported)
|
if (Settings.appSettingsGet('materialDesign') && bAnimationSupported)
|
||||||
{
|
{
|
||||||
ko.components.register('Checkbox', require('Component/MaterialDesign/Checkbox'));
|
ko.components.register('Checkbox', require('Component/MaterialDesign/Checkbox'));
|
||||||
ko.components.register('CheckboxSimple', require('Component/Checkbox'));
|
ko.components.register('CheckboxSimple', require('Component/Checkbox'));
|
||||||
|
|
@ -294,14 +309,14 @@ class AbstractApp extends AbstractBoot
|
||||||
|
|
||||||
Translator.initOnStartOrLangChange(Translator.initNotificationLanguage, Translator);
|
Translator.initOnStartOrLangChange(Translator.initNotificationLanguage, Translator);
|
||||||
|
|
||||||
_.delay(Utils.windowResizeCallback, 1000);
|
_.delay(windowResizeCallback, 1000);
|
||||||
|
|
||||||
Events.sub('ssm.mobile-enter', () => {
|
Events.sub('ssm.mobile-enter', () => {
|
||||||
Globals.leftPanelDisabled(true);
|
leftPanelDisabled(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
Events.sub('ssm.mobile-leave', () => {
|
Events.sub('ssm.mobile-leave', () => {
|
||||||
Globals.leftPanelDisabled(false);
|
leftPanelDisabled(false);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!mobile)
|
if (!mobile)
|
||||||
|
|
@ -310,11 +325,11 @@ class AbstractApp extends AbstractBoot
|
||||||
id: 'mobile',
|
id: 'mobile',
|
||||||
maxWidth: 767,
|
maxWidth: 767,
|
||||||
onEnter: () => {
|
onEnter: () => {
|
||||||
Globals.$html.addClass('ssm-state-mobile');
|
$html.addClass('ssm-state-mobile');
|
||||||
Events.pub('ssm.mobile-enter');
|
Events.pub('ssm.mobile-enter');
|
||||||
},
|
},
|
||||||
onLeave: () => {
|
onLeave: () => {
|
||||||
Globals.$html.removeClass('ssm-state-mobile');
|
$html.removeClass('ssm-state-mobile');
|
||||||
Events.pub('ssm.mobile-leave');
|
Events.pub('ssm.mobile-leave');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
@ -324,10 +339,10 @@ class AbstractApp extends AbstractBoot
|
||||||
minWidth: 768,
|
minWidth: 768,
|
||||||
maxWidth: 999,
|
maxWidth: 999,
|
||||||
onEnter: function() {
|
onEnter: function() {
|
||||||
Globals.$html.addClass('ssm-state-tablet');
|
$html.addClass('ssm-state-tablet');
|
||||||
},
|
},
|
||||||
onLeave: function() {
|
onLeave: function() {
|
||||||
Globals.$html.removeClass('ssm-state-tablet');
|
$html.removeClass('ssm-state-tablet');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -336,10 +351,10 @@ class AbstractApp extends AbstractBoot
|
||||||
minWidth: 1000,
|
minWidth: 1000,
|
||||||
maxWidth: 1400,
|
maxWidth: 1400,
|
||||||
onEnter: () => {
|
onEnter: () => {
|
||||||
Globals.$html.addClass('ssm-state-desktop');
|
$html.addClass('ssm-state-desktop');
|
||||||
},
|
},
|
||||||
onLeave: () => {
|
onLeave: () => {
|
||||||
Globals.$html.removeClass('ssm-state-desktop');
|
$html.removeClass('ssm-state-desktop');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -347,30 +362,30 @@ class AbstractApp extends AbstractBoot
|
||||||
id: 'desktop-large',
|
id: 'desktop-large',
|
||||||
minWidth: 1400,
|
minWidth: 1400,
|
||||||
onEnter: () => {
|
onEnter: () => {
|
||||||
Globals.$html.addClass('ssm-state-desktop-large');
|
$html.addClass('ssm-state-desktop-large');
|
||||||
},
|
},
|
||||||
onLeave: () => {
|
onLeave: () => {
|
||||||
Globals.$html.removeClass('ssm-state-desktop-large');
|
$html.removeClass('ssm-state-desktop-large');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Globals.$html.addClass('ssm-state-mobile').addClass('rl-mobile');
|
$html.addClass('ssm-state-mobile').addClass('rl-mobile');
|
||||||
Events.pub('ssm.mobile-enter');
|
Events.pub('ssm.mobile-enter');
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.leftPanelDisabled.subscribe((bValue) => {
|
leftPanelDisabled.subscribe((bValue) => {
|
||||||
Globals.$html.toggleClass('rl-left-panel-disabled', bValue);
|
$html.toggleClass('rl-left-panel-disabled', bValue);
|
||||||
Globals.$html.toggleClass('rl-left-panel-enabled', !bValue);
|
$html.toggleClass('rl-left-panel-enabled', !bValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.leftPanelType.subscribe((sValue) => {
|
leftPanelType.subscribe((sValue) => {
|
||||||
Globals.$html.toggleClass('rl-left-panel-none', 'none' === sValue);
|
$html.toggleClass('rl-left-panel-none', 'none' === sValue);
|
||||||
Globals.$html.toggleClass('rl-left-panel-short', 'short' === sValue);
|
$html.toggleClass('rl-left-panel-short', 'short' === sValue);
|
||||||
});
|
});
|
||||||
|
|
||||||
Globals.leftPanelDisabled.valueHasMutated();
|
leftPanelDisabled.valueHasMutated();
|
||||||
|
|
||||||
ssm.ready();
|
ssm.ready();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,10 @@ import {window, _} from 'common';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import progressJs from 'progressJs';
|
import progressJs from 'progressJs';
|
||||||
|
|
||||||
import * as Enums from 'Common/Enums';
|
|
||||||
import Utils from 'Common/Utils';
|
|
||||||
import Links from 'Common/Links';
|
import Links from 'Common/Links';
|
||||||
import Translator from 'Common/Translator';
|
import Translator from 'Common/Translator';
|
||||||
|
import {StorageResultType, Notification} from 'Common/Enums';
|
||||||
|
import {pInt, isNormal, isArray, inArray, isUnd} from 'Common/Utils';
|
||||||
|
|
||||||
import Settings from 'Storage/Settings';
|
import Settings from 'Storage/Settings';
|
||||||
|
|
||||||
|
|
@ -37,7 +37,7 @@ class AdminApp extends AbstractApp
|
||||||
DomainStore.domains.loading(true);
|
DomainStore.domains.loading(true);
|
||||||
Remote.domainList((result, data) => {
|
Remote.domainList((result, data) => {
|
||||||
DomainStore.domains.loading(false);
|
DomainStore.domains.loading(false);
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result)
|
if (StorageResultType.Success === result && data && data.Result)
|
||||||
{
|
{
|
||||||
DomainStore.domains(_.map(data.Result, (enabled, name) => {
|
DomainStore.domains(_.map(data.Result, (enabled, name) => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -54,7 +54,7 @@ class AdminApp extends AbstractApp
|
||||||
PluginStore.plugins.loading(true);
|
PluginStore.plugins.loading(true);
|
||||||
Remote.pluginList((result, data) => {
|
Remote.pluginList((result, data) => {
|
||||||
PluginStore.plugins.loading(false);
|
PluginStore.plugins.loading(false);
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result)
|
if (StorageResultType.Success === result && data && data.Result)
|
||||||
{
|
{
|
||||||
PluginStore.plugins(_.map(data.Result, (item) => {
|
PluginStore.plugins(_.map(data.Result, (item) => {
|
||||||
return {
|
return {
|
||||||
|
|
@ -72,7 +72,7 @@ class AdminApp extends AbstractApp
|
||||||
PackageStore.packagesReal(true);
|
PackageStore.packagesReal(true);
|
||||||
Remote.packagesList((result, data) => {
|
Remote.packagesList((result, data) => {
|
||||||
PackageStore.packages.loading(false);
|
PackageStore.packages.loading(false);
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result)
|
if (StorageResultType.Success === result && data && data.Result)
|
||||||
{
|
{
|
||||||
PackageStore.packagesReal(!!data.Result.Real);
|
PackageStore.packagesReal(!!data.Result.Real);
|
||||||
PackageStore.packagesMainUpdatable(!!data.Result.MainUpdatable);
|
PackageStore.packagesMainUpdatable(!!data.Result.MainUpdatable);
|
||||||
|
|
@ -89,12 +89,12 @@ class AdminApp extends AbstractApp
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Utils.isArray(data.Result.List))
|
if (isArray(data.Result.List))
|
||||||
{
|
{
|
||||||
list = _.compact(_.map(data.Result.List, (item) => {
|
list = _.compact(_.map(data.Result.List, (item) => {
|
||||||
if (item)
|
if (item)
|
||||||
{
|
{
|
||||||
item.loading = ko.observable(!Utils.isUnd(loading[item.file]));
|
item.loading = ko.observable(!isUnd(loading[item.file]));
|
||||||
return 'core' === item.type && !item.canBeInstalled ? null : item;
|
return 'core' === item.type && !item.canBeInstalled ? null : item;
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
|
@ -118,7 +118,7 @@ class AdminApp extends AbstractApp
|
||||||
CoreStore.coreRemoteVersion('');
|
CoreStore.coreRemoteVersion('');
|
||||||
CoreStore.coreRemoteRelease('');
|
CoreStore.coreRemoteRelease('');
|
||||||
CoreStore.coreVersionCompare(-2);
|
CoreStore.coreVersionCompare(-2);
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result)
|
if (StorageResultType.Success === result && data && data.Result)
|
||||||
{
|
{
|
||||||
CoreStore.coreReal(true);
|
CoreStore.coreReal(true);
|
||||||
window.location.reload();
|
window.location.reload();
|
||||||
|
|
@ -135,7 +135,7 @@ class AdminApp extends AbstractApp
|
||||||
CoreStore.coreReal(true);
|
CoreStore.coreReal(true);
|
||||||
Remote.coreData((result, data) => {
|
Remote.coreData((result, data) => {
|
||||||
CoreStore.coreChecking(false);
|
CoreStore.coreChecking(false);
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result)
|
if (StorageResultType.Success === result && data && data.Result)
|
||||||
{
|
{
|
||||||
CoreStore.coreReal(!!data.Result.Real);
|
CoreStore.coreReal(!!data.Result.Real);
|
||||||
CoreStore.coreChannel(data.Result.Channel || 'stable');
|
CoreStore.coreChannel(data.Result.Channel || 'stable');
|
||||||
|
|
@ -146,7 +146,7 @@ class AdminApp extends AbstractApp
|
||||||
CoreStore.coreVersion(data.Result.Version || '');
|
CoreStore.coreVersion(data.Result.Version || '');
|
||||||
CoreStore.coreRemoteVersion(data.Result.RemoteVersion || '');
|
CoreStore.coreRemoteVersion(data.Result.RemoteVersion || '');
|
||||||
CoreStore.coreRemoteRelease(data.Result.RemoteRelease || '');
|
CoreStore.coreRemoteRelease(data.Result.RemoteRelease || '');
|
||||||
CoreStore.coreVersionCompare(Utils.pInt(data.Result.VersionCompare));
|
CoreStore.coreVersionCompare(pInt(data.Result.VersionCompare));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -170,29 +170,29 @@ class AdminApp extends AbstractApp
|
||||||
LicenseStore.licenseError('');
|
LicenseStore.licenseError('');
|
||||||
Remote.licensing((result, data) => {
|
Remote.licensing((result, data) => {
|
||||||
LicenseStore.licensingProcess(false);
|
LicenseStore.licensingProcess(false);
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result && Utils.isNormal(data.Result.Expired))
|
if (StorageResultType.Success === result && data && data.Result && isNormal(data.Result.Expired))
|
||||||
{
|
{
|
||||||
LicenseStore.licenseValid(true);
|
LicenseStore.licenseValid(true);
|
||||||
LicenseStore.licenseExpired(Utils.pInt(data.Result.Expired));
|
LicenseStore.licenseExpired(pInt(data.Result.Expired));
|
||||||
LicenseStore.licenseError('');
|
LicenseStore.licenseError('');
|
||||||
LicenseStore.licensing(true);
|
LicenseStore.licensing(true);
|
||||||
AppStore.prem(true);
|
AppStore.prem(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (data && data.ErrorCode && -1 < Utils.inArray(Utils.pInt(data.ErrorCode), [
|
if (data && data.ErrorCode && -1 < inArray(pInt(data.ErrorCode), [
|
||||||
Enums.Notification.LicensingServerIsUnavailable,
|
Notification.LicensingServerIsUnavailable,
|
||||||
Enums.Notification.LicensingExpired
|
Notification.LicensingExpired
|
||||||
]))
|
]))
|
||||||
{
|
{
|
||||||
LicenseStore.licenseError(Translator.getNotification(Utils.pInt(data.ErrorCode)));
|
LicenseStore.licenseError(Translator.getNotification(pInt(data.ErrorCode)));
|
||||||
LicenseStore.licensing(true);
|
LicenseStore.licensing(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Enums.StorageResultType.Abort === result)
|
if (StorageResultType.Abort === result)
|
||||||
{
|
{
|
||||||
LicenseStore.licenseError(Translator.getNotification(Enums.Notification.LicensingServerIsUnavailable));
|
LicenseStore.licenseError(Translator.getNotification(Notification.LicensingServerIsUnavailable));
|
||||||
LicenseStore.licensing(true);
|
LicenseStore.licensing(true);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
235
dev/App/User.jsx
235
dev/App/User.jsx
|
|
@ -3,11 +3,24 @@ import {window, _, $} from 'common';
|
||||||
import progressJs from 'progressJs';
|
import progressJs from 'progressJs';
|
||||||
import Tinycon from 'Tinycon';
|
import Tinycon from 'Tinycon';
|
||||||
|
|
||||||
import * as Enums from 'Common/Enums';
|
import {
|
||||||
import * as Consts from 'Common/Consts';
|
noop, trim, log, isArray, inArray, isUnd, isNormal, isPosNumeric, isNonEmptyArray,
|
||||||
import Globals from 'Common/Globals';
|
pInt, pString, delegateRunOnDestroy, mailToHelper, windowResize
|
||||||
|
} from 'Common/Utils';
|
||||||
|
|
||||||
|
import {
|
||||||
|
Layout, Capa, StorageResultType, Notification, FolderType,
|
||||||
|
SetSystemFoldersNotification, MessageSetAction, ClientSideKeyName
|
||||||
|
} from 'Common/Enums';
|
||||||
|
|
||||||
|
import {
|
||||||
|
$html,
|
||||||
|
leftPanelWidth, leftPanelDisabled,
|
||||||
|
bAnimationSupported, bMobileDevice
|
||||||
|
} from 'Common/Globals';
|
||||||
|
|
||||||
|
import {UNUSED_OPTION_VALUE} from 'Common/Consts';
|
||||||
import Plugins from 'Common/Plugins';
|
import Plugins from 'Common/Plugins';
|
||||||
import Utils from 'Common/Utils';
|
|
||||||
import Links from 'Common/Links';
|
import Links from 'Common/Links';
|
||||||
import Events from 'Common/Events';
|
import Events from 'Common/Events';
|
||||||
import Translator from 'Common/Translator';
|
import Translator from 'Common/Translator';
|
||||||
|
|
@ -74,7 +87,7 @@ class AppUser extends AbstractApp
|
||||||
}
|
}
|
||||||
|
|
||||||
Remote.jsVersion((sResult, oData) => {
|
Remote.jsVersion((sResult, oData) => {
|
||||||
if (Enums.StorageResultType.Success === sResult && oData && !oData.Result)
|
if (StorageResultType.Success === sResult && oData && !oData.Result)
|
||||||
{
|
{
|
||||||
this.reload();
|
this.reload();
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +106,7 @@ class AppUser extends AbstractApp
|
||||||
$('#rl-bg')
|
$('#rl-bg')
|
||||||
.attr('style', 'background-image: none !important;')
|
.attr('style', 'background-image: none !important;')
|
||||||
.backstretch(Links.userBackground(Settings.settingsGet('UserBackgroundHash')), {
|
.backstretch(Links.userBackground(Settings.settingsGet('UserBackgroundHash')), {
|
||||||
fade: Globals.bAnimationSupported ? 1000 : 0,
|
fade: bAnimationSupported ? 1000 : 0,
|
||||||
centeredX: true,
|
centeredX: true,
|
||||||
centeredY: true
|
centeredY: true
|
||||||
})
|
})
|
||||||
|
|
@ -159,19 +172,19 @@ class AppUser extends AbstractApp
|
||||||
MessageStore.messageListLoading(true);
|
MessageStore.messageListLoading(true);
|
||||||
Remote.messageList((sResult, oData, bCached) => {
|
Remote.messageList((sResult, oData, bCached) => {
|
||||||
|
|
||||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
if (StorageResultType.Success === sResult && oData && oData.Result)
|
||||||
{
|
{
|
||||||
MessageStore.messageListError('');
|
MessageStore.messageListError('');
|
||||||
MessageStore.messageListLoading(false);
|
MessageStore.messageListLoading(false);
|
||||||
|
|
||||||
MessageStore.setMessageList(oData, bCached);
|
MessageStore.setMessageList(oData, bCached);
|
||||||
}
|
}
|
||||||
else if (Enums.StorageResultType.Unload === sResult)
|
else if (StorageResultType.Unload === sResult)
|
||||||
{
|
{
|
||||||
MessageStore.messageListError('');
|
MessageStore.messageListError('');
|
||||||
MessageStore.messageListLoading(false);
|
MessageStore.messageListLoading(false);
|
||||||
}
|
}
|
||||||
else if (Enums.StorageResultType.Abort !== sResult)
|
else if (StorageResultType.Abort !== sResult)
|
||||||
{
|
{
|
||||||
MessageStore.messageList([]);
|
MessageStore.messageList([]);
|
||||||
MessageStore.messageListLoading(false);
|
MessageStore.messageListLoading(false);
|
||||||
|
|
@ -185,7 +198,7 @@ class AppUser extends AbstractApp
|
||||||
}
|
}
|
||||||
|
|
||||||
recacheInboxMessageList() {
|
recacheInboxMessageList() {
|
||||||
Remote.messageList(Utils.emptyFunction, Cache.getFolderInboxName(), 0, SettingsStore.messagesPerPage(), '', '', true);
|
Remote.messageList(noop, Cache.getFolderInboxName(), 0, SettingsStore.messagesPerPage(), '', '', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -272,9 +285,9 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
moveOrDeleteResponseHelper(sResult, oData) {
|
moveOrDeleteResponseHelper(sResult, oData) {
|
||||||
|
|
||||||
if (Enums.StorageResultType.Success === sResult && FolderStore.currentFolder())
|
if (StorageResultType.Success === sResult && FolderStore.currentFolder())
|
||||||
{
|
{
|
||||||
if (oData && Utils.isArray(oData.Result) && 2 === oData.Result.length)
|
if (oData && isArray(oData.Result) && 2 === oData.Result.length)
|
||||||
{
|
{
|
||||||
Cache.setFolderHash(oData.Result[0], oData.Result[1]);
|
Cache.setFolderHash(oData.Result[0], oData.Result[1]);
|
||||||
}
|
}
|
||||||
|
|
@ -282,8 +295,8 @@ class AppUser extends AbstractApp
|
||||||
{
|
{
|
||||||
Cache.setFolderHash(FolderStore.currentFolderFullNameRaw(), '');
|
Cache.setFolderHash(FolderStore.currentFolderFullNameRaw(), '');
|
||||||
|
|
||||||
if (oData && -1 < Utils.inArray(oData.ErrorCode,
|
if (oData && -1 < inArray(oData.ErrorCode,
|
||||||
[Enums.Notification.CantMoveMessage, Enums.Notification.CantCopyMessage]))
|
[Notification.CantMoveMessage, Notification.CantCopyMessage]))
|
||||||
{
|
{
|
||||||
window.alert(Translator.getNotification(oData.ErrorCode));
|
window.alert(Translator.getNotification(oData.ErrorCode));
|
||||||
}
|
}
|
||||||
|
|
@ -318,29 +331,29 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
switch (iDeleteType)
|
switch (iDeleteType)
|
||||||
{
|
{
|
||||||
case Enums.FolderType.Spam:
|
case FolderType.Spam:
|
||||||
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.spamFolder());
|
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.spamFolder());
|
||||||
nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Spam;
|
nSetSystemFoldersNotification = SetSystemFoldersNotification.Spam;
|
||||||
break;
|
break;
|
||||||
case Enums.FolderType.NotSpam:
|
case FolderType.NotSpam:
|
||||||
oMoveFolder = Cache.getFolderFromCacheList(Cache.getFolderInboxName());
|
oMoveFolder = Cache.getFolderFromCacheList(Cache.getFolderInboxName());
|
||||||
break;
|
break;
|
||||||
case Enums.FolderType.Trash:
|
case FolderType.Trash:
|
||||||
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.trashFolder());
|
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.trashFolder());
|
||||||
nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Trash;
|
nSetSystemFoldersNotification = SetSystemFoldersNotification.Trash;
|
||||||
break;
|
break;
|
||||||
case Enums.FolderType.Archive:
|
case FolderType.Archive:
|
||||||
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.archiveFolder());
|
oMoveFolder = Cache.getFolderFromCacheList(FolderStore.archiveFolder());
|
||||||
nSetSystemFoldersNotification = Enums.SetSystemFoldersNotification.Archive;
|
nSetSystemFoldersNotification = SetSystemFoldersNotification.Archive;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bUseFolder = Utils.isUnd(bUseFolder) ? true : !!bUseFolder;
|
bUseFolder = isUnd(bUseFolder) ? true : !!bUseFolder;
|
||||||
if (bUseFolder)
|
if (bUseFolder)
|
||||||
{
|
{
|
||||||
if ((Enums.FolderType.Spam === iDeleteType && Consts.UNUSED_OPTION_VALUE === FolderStore.spamFolder()) ||
|
if ((FolderType.Spam === iDeleteType && UNUSED_OPTION_VALUE === FolderStore.spamFolder()) ||
|
||||||
(Enums.FolderType.Trash === iDeleteType && Consts.UNUSED_OPTION_VALUE === FolderStore.trashFolder()) ||
|
(FolderType.Trash === iDeleteType && UNUSED_OPTION_VALUE === FolderStore.trashFolder()) ||
|
||||||
(Enums.FolderType.Archive === iDeleteType && Consts.UNUSED_OPTION_VALUE === FolderStore.archiveFolder()))
|
(FolderType.Archive === iDeleteType && UNUSED_OPTION_VALUE === FolderStore.archiveFolder()))
|
||||||
{
|
{
|
||||||
bUseFolder = false;
|
bUseFolder = false;
|
||||||
}
|
}
|
||||||
|
|
@ -350,7 +363,7 @@ class AppUser extends AbstractApp
|
||||||
{
|
{
|
||||||
kn.showScreenPopup(require('View/Popup/FolderSystem'), [nSetSystemFoldersNotification]);
|
kn.showScreenPopup(require('View/Popup/FolderSystem'), [nSetSystemFoldersNotification]);
|
||||||
}
|
}
|
||||||
else if (!bUseFolder || (Enums.FolderType.Trash === iDeleteType &&
|
else if (!bUseFolder || (FolderType.Trash === iDeleteType &&
|
||||||
(sFromFolderFullNameRaw === FolderStore.spamFolder() || sFromFolderFullNameRaw === FolderStore.trashFolder())))
|
(sFromFolderFullNameRaw === FolderStore.spamFolder() || sFromFolderFullNameRaw === FolderStore.trashFolder())))
|
||||||
{
|
{
|
||||||
kn.showScreenPopup(require('View/Popup/Ask'), [Translator.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), () => {
|
kn.showScreenPopup(require('View/Popup/Ask'), [Translator.i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), () => {
|
||||||
|
|
@ -373,7 +386,7 @@ class AppUser extends AbstractApp
|
||||||
*/
|
*/
|
||||||
moveMessagesToFolder(sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy) {
|
moveMessagesToFolder(sFromFolderFullNameRaw, aUidForMove, sToFolderFullNameRaw, bCopy) {
|
||||||
|
|
||||||
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && Utils.isArray(aUidForMove) && 0 < aUidForMove.length)
|
if (sFromFolderFullNameRaw !== sToFolderFullNameRaw && isArray(aUidForMove) && 0 < aUidForMove.length)
|
||||||
{
|
{
|
||||||
const
|
const
|
||||||
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
|
oFromFolder = Cache.getFolderFromCacheList(sFromFolderFullNameRaw),
|
||||||
|
|
@ -382,7 +395,7 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
if (oFromFolder && oToFolder)
|
if (oFromFolder && oToFolder)
|
||||||
{
|
{
|
||||||
if (Utils.isUnd(bCopy) ? false : !!bCopy)
|
if (isUnd(bCopy) ? false : !!bCopy)
|
||||||
{
|
{
|
||||||
this.messagesCopyHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove);
|
this.messagesCopyHelper(oFromFolder.fullNameRaw, oToFolder.fullNameRaw, aUidForMove);
|
||||||
}
|
}
|
||||||
|
|
@ -486,7 +499,7 @@ class AppUser extends AbstractApp
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.delegateRunOnDestroy(PgpStore.openpgpkeys());
|
delegateRunOnDestroy(PgpStore.openpgpkeys());
|
||||||
PgpStore.openpgpkeys(aKeys);
|
PgpStore.openpgpkeys(aKeys);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -499,7 +512,7 @@ class AppUser extends AbstractApp
|
||||||
//
|
//
|
||||||
// AccountStore.accounts.loading(false);
|
// AccountStore.accounts.loading(false);
|
||||||
//
|
//
|
||||||
// if (Enums.StorageResultType.Success === sResult && oData.Result && oData.Result['Counts'])
|
// if (StorageResultType.Success === sResult && oData.Result && oData.Result['Counts'])
|
||||||
// {
|
// {
|
||||||
// var
|
// var
|
||||||
// sEmail = AccountStore.email(),
|
// sEmail = AccountStore.email(),
|
||||||
|
|
@ -514,7 +527,7 @@ class AppUser extends AbstractApp
|
||||||
//
|
//
|
||||||
// if (oAccount)
|
// if (oAccount)
|
||||||
// {
|
// {
|
||||||
// oAccount.count(Utils.pInt(oItem[1]));
|
// oAccount.count(pInt(oItem[1]));
|
||||||
// }
|
// }
|
||||||
// });
|
// });
|
||||||
// }
|
// }
|
||||||
|
|
@ -531,7 +544,7 @@ class AppUser extends AbstractApp
|
||||||
AccountStore.accounts.loading(false);
|
AccountStore.accounts.loading(false);
|
||||||
IdentityStore.identities.loading(false);
|
IdentityStore.identities.loading(false);
|
||||||
|
|
||||||
if (Enums.StorageResultType.Success === sResult && oData.Result)
|
if (StorageResultType.Success === sResult && oData.Result)
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
aCounts = {},
|
aCounts = {},
|
||||||
|
|
@ -541,40 +554,40 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail;
|
sParentEmail = '' === sParentEmail ? sAccountEmail : sParentEmail;
|
||||||
|
|
||||||
if (Utils.isArray(oData.Result.Accounts))
|
if (isArray(oData.Result.Accounts))
|
||||||
{
|
{
|
||||||
_.each(AccountStore.accounts(), (oAccount) => {
|
_.each(AccountStore.accounts(), (oAccount) => {
|
||||||
aCounts[oAccount.email] = oAccount.count();
|
aCounts[oAccount.email] = oAccount.count();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.delegateRunOnDestroy(AccountStore.accounts());
|
delegateRunOnDestroy(AccountStore.accounts());
|
||||||
|
|
||||||
AccountStore.accounts(_.map(oData.Result.Accounts,
|
AccountStore.accounts(_.map(oData.Result.Accounts,
|
||||||
(sValue) => new AccountModel(sValue, sValue !== sParentEmail, aCounts[sValue] || 0)));
|
(sValue) => new AccountModel(sValue, sValue !== sParentEmail, aCounts[sValue] || 0)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isUnd(bBoot) ? false : !!bBoot)
|
if (isUnd(bBoot) ? false : !!bBoot)
|
||||||
{
|
{
|
||||||
_.delay(() => this.accountsCounts(), 1000 * 5);
|
_.delay(() => this.accountsCounts(), 1000 * 5);
|
||||||
Events.sub('interval.10m-after5m', () => this.accountsCounts());
|
Events.sub('interval.10m-after5m', () => this.accountsCounts());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isArray(oData.Result.Identities))
|
if (isArray(oData.Result.Identities))
|
||||||
{
|
{
|
||||||
Utils.delegateRunOnDestroy(IdentityStore.identities());
|
delegateRunOnDestroy(IdentityStore.identities());
|
||||||
|
|
||||||
IdentityStore.identities(_.map(oData.Result.Identities, (oIdentityData) => {
|
IdentityStore.identities(_.map(oData.Result.Identities, (oIdentityData) => {
|
||||||
|
|
||||||
const
|
const
|
||||||
sId = Utils.pString(oIdentityData.Id),
|
sId = pString(oIdentityData.Id),
|
||||||
sEmail = Utils.pString(oIdentityData.Email),
|
sEmail = pString(oIdentityData.Email),
|
||||||
oIdentity = new IdentityModel(sId, sEmail)
|
oIdentity = new IdentityModel(sId, sEmail)
|
||||||
;
|
;
|
||||||
|
|
||||||
oIdentity.name(Utils.pString(oIdentityData.Name));
|
oIdentity.name(pString(oIdentityData.Name));
|
||||||
oIdentity.replyTo(Utils.pString(oIdentityData.ReplyTo));
|
oIdentity.replyTo(pString(oIdentityData.ReplyTo));
|
||||||
oIdentity.bcc(Utils.pString(oIdentityData.Bcc));
|
oIdentity.bcc(pString(oIdentityData.Bcc));
|
||||||
oIdentity.signature(Utils.pString(oIdentityData.Signature));
|
oIdentity.signature(pString(oIdentityData.Signature));
|
||||||
oIdentity.signatureInsertBefore(!!oIdentityData.SignatureInsertBefore);
|
oIdentity.signatureInsertBefore(!!oIdentityData.SignatureInsertBefore);
|
||||||
|
|
||||||
return oIdentity;
|
return oIdentity;
|
||||||
|
|
@ -592,10 +605,10 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
TemplateStore.templates.loading(false);
|
TemplateStore.templates.loading(false);
|
||||||
|
|
||||||
if (Enums.StorageResultType.Success === result && data.Result &&
|
if (StorageResultType.Success === result && data.Result &&
|
||||||
Utils.isArray(data.Result.Templates))
|
isArray(data.Result.Templates))
|
||||||
{
|
{
|
||||||
Utils.delegateRunOnDestroy(TemplateStore.templates());
|
delegateRunOnDestroy(TemplateStore.templates());
|
||||||
|
|
||||||
TemplateStore.templates(_.compact(_.map(data.Result.Templates, (templateData) => {
|
TemplateStore.templates(_.compact(_.map(data.Result.Templates, (templateData) => {
|
||||||
const template = new TemplateModel();
|
const template = new TemplateModel();
|
||||||
|
|
@ -607,12 +620,12 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
quota() {
|
quota() {
|
||||||
Remote.quota((result, data) => {
|
Remote.quota((result, data) => {
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result &&
|
if (StorageResultType.Success === result && data && data.Result &&
|
||||||
Utils.isArray(data.Result) && 1 < data.Result.length &&
|
isArray(data.Result) && 1 < data.Result.length &&
|
||||||
Utils.isPosNumeric(data.Result[0], true) && Utils.isPosNumeric(data.Result[1], true))
|
isPosNumeric(data.Result[0], true) && isPosNumeric(data.Result[1], true))
|
||||||
{
|
{
|
||||||
require('Stores/User/Quota').populateData(
|
require('Stores/User/Quota').populateData(
|
||||||
Utils.pInt(data.Result[1]), Utils.pInt(data.Result[0]));
|
pInt(data.Result[1]), pInt(data.Result[0]));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
@ -622,10 +635,10 @@ class AppUser extends AbstractApp
|
||||||
* @param {Array=} list = []
|
* @param {Array=} list = []
|
||||||
*/
|
*/
|
||||||
folderInformation(folder, list) {
|
folderInformation(folder, list) {
|
||||||
if ('' !== Utils.trim(folder))
|
if ('' !== trim(folder))
|
||||||
{
|
{
|
||||||
Remote.folderInformation((result, data) => {
|
Remote.folderInformation((result, data) => {
|
||||||
if (Enums.StorageResultType.Success === result)
|
if (StorageResultType.Success === result)
|
||||||
{
|
{
|
||||||
if (data && data.Result && data.Result.Hash && data.Result.Folder)
|
if (data && data.Result && data.Result.Hash && data.Result.Folder)
|
||||||
{
|
{
|
||||||
|
|
@ -645,14 +658,14 @@ class AppUser extends AbstractApp
|
||||||
Cache.setFolderHash(data.Result.Folder, data.Result.Hash);
|
Cache.setFolderHash(data.Result.Folder, data.Result.Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isNormal(data.Result.MessageCount))
|
if (isNormal(data.Result.MessageCount))
|
||||||
{
|
{
|
||||||
folderFromCache.messageCountAll(data.Result.MessageCount);
|
folderFromCache.messageCountAll(data.Result.MessageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isNormal(data.Result.MessageUnseenCount))
|
if (isNormal(data.Result.MessageUnseenCount))
|
||||||
{
|
{
|
||||||
if (Utils.pInt(folderFromCache.messageCountUnread()) !== Utils.pInt(data.Result.MessageUnseenCount))
|
if (pInt(folderFromCache.messageCountUnread()) !== pInt(data.Result.MessageUnseenCount))
|
||||||
{
|
{
|
||||||
unreadCountChange = true;
|
unreadCountChange = true;
|
||||||
}
|
}
|
||||||
|
|
@ -712,12 +725,12 @@ class AppUser extends AbstractApp
|
||||||
folderInformationMultiply(boot = false) {
|
folderInformationMultiply(boot = false) {
|
||||||
|
|
||||||
const folders = FolderStore.getNextFolderNames();
|
const folders = FolderStore.getNextFolderNames();
|
||||||
if (Utils.isNonEmptyArray(folders))
|
if (isNonEmptyArray(folders))
|
||||||
{
|
{
|
||||||
Remote.folderInformationMultiply((sResult, oData) => {
|
Remote.folderInformationMultiply((sResult, oData) => {
|
||||||
if (Enums.StorageResultType.Success === sResult)
|
if (StorageResultType.Success === sResult)
|
||||||
{
|
{
|
||||||
if (oData && oData.Result && oData.Result.List && Utils.isNonEmptyArray(oData.Result.List))
|
if (oData && oData.Result && oData.Result.List && isNonEmptyArray(oData.Result.List))
|
||||||
{
|
{
|
||||||
const utc = Momentor.momentNowUnix();
|
const utc = Momentor.momentNowUnix();
|
||||||
_.each(oData.Result.List, (oItem) => {
|
_.each(oData.Result.List, (oItem) => {
|
||||||
|
|
@ -737,14 +750,14 @@ class AppUser extends AbstractApp
|
||||||
Cache.setFolderHash(oItem.Folder, oItem.Hash);
|
Cache.setFolderHash(oItem.Folder, oItem.Hash);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isNormal(oItem.MessageCount))
|
if (isNormal(oItem.MessageCount))
|
||||||
{
|
{
|
||||||
oFolder.messageCountAll(oItem.MessageCount);
|
oFolder.messageCountAll(oItem.MessageCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Utils.isNormal(oItem.MessageUnseenCount))
|
if (isNormal(oItem.MessageUnseenCount))
|
||||||
{
|
{
|
||||||
if (Utils.pInt(oFolder.messageCountUnread()) !== Utils.pInt(oItem.MessageUnseenCount))
|
if (pInt(oFolder.messageCountUnread()) !== pInt(oItem.MessageUnseenCount))
|
||||||
{
|
{
|
||||||
bUnreadCountChange = true;
|
bUnreadCountChange = true;
|
||||||
}
|
}
|
||||||
|
|
@ -769,7 +782,7 @@ class AppUser extends AbstractApp
|
||||||
if (oFolder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
if (oFolder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
||||||
{
|
{
|
||||||
const aList = MessageStore.messageList();
|
const aList = MessageStore.messageList();
|
||||||
if (Utils.isNonEmptyArray(aList))
|
if (isNonEmptyArray(aList))
|
||||||
{
|
{
|
||||||
this.folderInformation(oFolder.fullNameRaw, aList);
|
this.folderInformation(oFolder.fullNameRaw, aList);
|
||||||
}
|
}
|
||||||
|
|
@ -802,7 +815,7 @@ class AppUser extends AbstractApp
|
||||||
iAlreadyUnread = 0
|
iAlreadyUnread = 0
|
||||||
;
|
;
|
||||||
|
|
||||||
if (Utils.isUnd(aMessages))
|
if (isUnd(aMessages))
|
||||||
{
|
{
|
||||||
aMessages = MessageStore.messageListChecked();
|
aMessages = MessageStore.messageListChecked();
|
||||||
}
|
}
|
||||||
|
|
@ -812,7 +825,7 @@ class AppUser extends AbstractApp
|
||||||
if ('' !== sFolderFullNameRaw && 0 < aRootUids.length)
|
if ('' !== sFolderFullNameRaw && 0 < aRootUids.length)
|
||||||
{
|
{
|
||||||
switch (iSetAction) {
|
switch (iSetAction) {
|
||||||
case Enums.MessageSetAction.SetSeen:
|
case MessageSetAction.SetSeen:
|
||||||
|
|
||||||
_.each(aRootUids, (sSubUid) => {
|
_.each(aRootUids, (sSubUid) => {
|
||||||
iAlreadyUnread += Cache.storeMessageFlagsToCacheBySetAction(
|
iAlreadyUnread += Cache.storeMessageFlagsToCacheBySetAction(
|
||||||
|
|
@ -825,10 +838,10 @@ class AppUser extends AbstractApp
|
||||||
oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread);
|
oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread);
|
||||||
}
|
}
|
||||||
|
|
||||||
Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, true);
|
Remote.messageSetSeen(noop, sFolderFullNameRaw, aRootUids, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Enums.MessageSetAction.UnsetSeen:
|
case MessageSetAction.UnsetSeen:
|
||||||
|
|
||||||
_.each(aRootUids, (sSubUid) => {
|
_.each(aRootUids, (sSubUid) => {
|
||||||
iAlreadyUnread += Cache.storeMessageFlagsToCacheBySetAction(
|
iAlreadyUnread += Cache.storeMessageFlagsToCacheBySetAction(
|
||||||
|
|
@ -841,27 +854,27 @@ class AppUser extends AbstractApp
|
||||||
oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread + aRootUids.length);
|
oFolder.messageCountUnread(oFolder.messageCountUnread() - iAlreadyUnread + aRootUids.length);
|
||||||
}
|
}
|
||||||
|
|
||||||
Remote.messageSetSeen(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, false);
|
Remote.messageSetSeen(noop, sFolderFullNameRaw, aRootUids, false);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Enums.MessageSetAction.SetFlag:
|
case MessageSetAction.SetFlag:
|
||||||
|
|
||||||
_.each(aRootUids, (sSubUid) => {
|
_.each(aRootUids, (sSubUid) => {
|
||||||
Cache.storeMessageFlagsToCacheBySetAction(
|
Cache.storeMessageFlagsToCacheBySetAction(
|
||||||
sFolderFullNameRaw, sSubUid, iSetAction);
|
sFolderFullNameRaw, sSubUid, iSetAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, true);
|
Remote.messageSetFlagged(noop, sFolderFullNameRaw, aRootUids, true);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Enums.MessageSetAction.UnsetFlag:
|
case MessageSetAction.UnsetFlag:
|
||||||
|
|
||||||
_.each(aRootUids, (sSubUid) => {
|
_.each(aRootUids, (sSubUid) => {
|
||||||
Cache.storeMessageFlagsToCacheBySetAction(
|
Cache.storeMessageFlagsToCacheBySetAction(
|
||||||
sFolderFullNameRaw, sSubUid, iSetAction);
|
sFolderFullNameRaw, sSubUid, iSetAction);
|
||||||
});
|
});
|
||||||
|
|
||||||
Remote.messageSetFlagged(Utils.emptyFunction, sFolderFullNameRaw, aRootUids, false);
|
Remote.messageSetFlagged(noop, sFolderFullNameRaw, aRootUids, false);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -895,7 +908,7 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
Remote.socialUsers((result, data) => {
|
Remote.socialUsers((result, data) => {
|
||||||
|
|
||||||
if (Enums.StorageResultType.Success === result && data && data.Result)
|
if (StorageResultType.Success === result && data && data.Result)
|
||||||
{
|
{
|
||||||
SocialStore.google.userName(data.Result.Google || '');
|
SocialStore.google.userName(data.Result.Google || '');
|
||||||
SocialStore.facebook.userName(data.Result.Facebook || '');
|
SocialStore.facebook.userName(data.Result.Facebook || '');
|
||||||
|
|
@ -935,12 +948,12 @@ class AppUser extends AbstractApp
|
||||||
*/
|
*/
|
||||||
getAutocomplete(query, callback) {
|
getAutocomplete(query, callback) {
|
||||||
Remote.suggestions((result, data) => {
|
Remote.suggestions((result, data) => {
|
||||||
if (Enums.StorageResultType.Success === result && data && Utils.isArray(data.Result))
|
if (StorageResultType.Success === result && data && isArray(data.Result))
|
||||||
{
|
{
|
||||||
callback(_.compact(_.map(data.Result,
|
callback(_.compact(_.map(data.Result,
|
||||||
(item) => item && item[0] ? new EmailModel(item[0], item[1]) : null)));
|
(item) => item && item[0] ? new EmailModel(item[0], item[1]) : null)));
|
||||||
}
|
}
|
||||||
else if (Enums.StorageResultType.Abort !== result)
|
else if (StorageResultType.Abort !== result)
|
||||||
{
|
{
|
||||||
callback([]);
|
callback([]);
|
||||||
}
|
}
|
||||||
|
|
@ -952,8 +965,8 @@ class AppUser extends AbstractApp
|
||||||
* @param {boolean} bExpanded
|
* @param {boolean} bExpanded
|
||||||
*/
|
*/
|
||||||
setExpandedFolder(sFullNameHash, bExpanded) {
|
setExpandedFolder(sFullNameHash, bExpanded) {
|
||||||
let aExpandedList = Local.get(Enums.ClientSideKeyName.ExpandedFolders);
|
let aExpandedList = Local.get(ClientSideKeyName.ExpandedFolders);
|
||||||
if (!Utils.isArray(aExpandedList))
|
if (!isArray(aExpandedList))
|
||||||
{
|
{
|
||||||
aExpandedList = [];
|
aExpandedList = [];
|
||||||
}
|
}
|
||||||
|
|
@ -968,7 +981,7 @@ class AppUser extends AbstractApp
|
||||||
aExpandedList = _.without(aExpandedList, sFullNameHash);
|
aExpandedList = _.without(aExpandedList, sFullNameHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
Local.set(Enums.ClientSideKeyName.ExpandedFolders, aExpandedList);
|
Local.set(ClientSideKeyName.ExpandedFolders, aExpandedList);
|
||||||
}
|
}
|
||||||
|
|
||||||
initHorizontalLayoutResizer(sClientSideKeyName) {
|
initHorizontalLayoutResizer(sClientSideKeyName) {
|
||||||
|
|
@ -1001,32 +1014,32 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
oResizableHandle
|
oResizableHandle
|
||||||
.on('mousedown', () => {
|
.on('mousedown', () => {
|
||||||
Globals.$html.addClass('rl-resizer');
|
$html.addClass('rl-resizer');
|
||||||
})
|
})
|
||||||
.on('mouseup', () => {
|
.on('mouseup', () => {
|
||||||
Globals.$html.removeClass('rl-resizer');
|
$html.removeClass('rl-resizer');
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
fResizeStartFunction = () => {
|
fResizeStartFunction = () => {
|
||||||
Globals.$html.addClass('rl-resizer');
|
$html.addClass('rl-resizer');
|
||||||
},
|
},
|
||||||
|
|
||||||
fResizeResizeFunction = _.debounce(() => {
|
fResizeResizeFunction = _.debounce(() => {
|
||||||
Globals.$html.addClass('rl-resizer');
|
$html.addClass('rl-resizer');
|
||||||
}, 500, true),
|
}, 500, true),
|
||||||
|
|
||||||
fResizeStopFunction = (oEvent, oObject) => {
|
fResizeStopFunction = (oEvent, oObject) => {
|
||||||
Globals.$html.removeClass('rl-resizer');
|
$html.removeClass('rl-resizer');
|
||||||
if (oObject && oObject.size && oObject.size.height)
|
if (oObject && oObject.size && oObject.size.height)
|
||||||
{
|
{
|
||||||
Local.set(sClientSideKeyName, oObject.size.height);
|
Local.set(sClientSideKeyName, oObject.size.height);
|
||||||
|
|
||||||
fSetHeight(oObject.size.height);
|
fSetHeight(oObject.size.height);
|
||||||
|
|
||||||
Utils.windowResize();
|
windowResize();
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -1057,7 +1070,7 @@ class AppUser extends AbstractApp
|
||||||
oBottom.removeAttr('style');
|
oBottom.removeAttr('style');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Globals.$html.hasClass('rl-bottom-preview-pane'))
|
else if ($html.hasClass('rl-bottom-preview-pane'))
|
||||||
{
|
{
|
||||||
oTop = $('.b-message-list-wrapper');
|
oTop = $('.b-message-list-wrapper');
|
||||||
oBottom = $('.b-message-view-wrapper');
|
oBottom = $('.b-message-view-wrapper');
|
||||||
|
|
@ -1067,7 +1080,7 @@ class AppUser extends AbstractApp
|
||||||
oTop.resizable(oOptions);
|
oTop.resizable(oOptions);
|
||||||
}
|
}
|
||||||
|
|
||||||
const iHeight = Utils.pInt(Local.get(sClientSideKeyName)) || 300;
|
const iHeight = pInt(Local.get(sClientSideKeyName)) || 300;
|
||||||
fSetHeight(iHeight > iMinHeight ? iHeight : iMinHeight);
|
fSetHeight(iHeight > iMinHeight ? iHeight : iMinHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1076,7 +1089,7 @@ class AppUser extends AbstractApp
|
||||||
fDisable(false);
|
fDisable(false);
|
||||||
|
|
||||||
Events.sub('layout', (layout) => {
|
Events.sub('layout', (layout) => {
|
||||||
fDisable(Enums.Layout.BottomPreview !== layout);
|
fDisable(Layout.BottomPreview !== layout);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1093,9 +1106,9 @@ class AppUser extends AbstractApp
|
||||||
fSetWidth = (iWidth) => {
|
fSetWidth = (iWidth) => {
|
||||||
if (iWidth)
|
if (iWidth)
|
||||||
{
|
{
|
||||||
Globals.leftPanelWidth(iWidth);
|
leftPanelWidth(iWidth);
|
||||||
|
|
||||||
Globals.$html.removeClass('rl-resizer');
|
$html.removeClass('rl-resizer');
|
||||||
|
|
||||||
oLeft.css({
|
oLeft.css({
|
||||||
width: '' + iWidth + 'px'
|
width: '' + iWidth + 'px'
|
||||||
|
|
@ -1116,7 +1129,7 @@ class AppUser extends AbstractApp
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
oLeft.resizable('enable');
|
oLeft.resizable('enable');
|
||||||
var iWidth = Utils.pInt(Local.get(sClientSideKeyName)) || iMinWidth;
|
var iWidth = pInt(Local.get(sClientSideKeyName)) || iMinWidth;
|
||||||
fSetWidth(iWidth > iMinWidth ? iWidth : iMinWidth);
|
fSetWidth(iWidth > iMinWidth ? iWidth : iMinWidth);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
@ -1126,27 +1139,27 @@ class AppUser extends AbstractApp
|
||||||
{
|
{
|
||||||
$(oEvent.target).find('.ui-resizable-handle')
|
$(oEvent.target).find('.ui-resizable-handle')
|
||||||
.on('mousedown', () => {
|
.on('mousedown', () => {
|
||||||
Globals.$html.addClass('rl-resizer');
|
$html.addClass('rl-resizer');
|
||||||
})
|
})
|
||||||
.on('mouseup', () => {
|
.on('mouseup', () => {
|
||||||
Globals.$html.removeClass('rl-resizer');
|
$html.removeClass('rl-resizer');
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
fResizeResizeFunction = _.debounce(() => {
|
fResizeResizeFunction = _.debounce(() => {
|
||||||
Globals.$html.addClass('rl-resizer');
|
$html.addClass('rl-resizer');
|
||||||
}, 500, true),
|
}, 500, true),
|
||||||
fResizeStartFunction = () => {
|
fResizeStartFunction = () => {
|
||||||
Globals.$html.addClass('rl-resizer');
|
$html.addClass('rl-resizer');
|
||||||
},
|
},
|
||||||
fResizeStopFunction = (oEvent, oObject) => {
|
fResizeStopFunction = (oEvent, oObject) => {
|
||||||
Globals.$html.removeClass('rl-resizer');
|
$html.removeClass('rl-resizer');
|
||||||
if (oObject && oObject.size && oObject.size.width)
|
if (oObject && oObject.size && oObject.size.width)
|
||||||
{
|
{
|
||||||
Local.set(sClientSideKeyName, oObject.size.width);
|
Local.set(sClientSideKeyName, oObject.size.width);
|
||||||
|
|
||||||
Globals.leftPanelWidth(oObject.size.width);
|
leftPanelWidth(oObject.size.width);
|
||||||
|
|
||||||
oRight.css({
|
oRight.css({
|
||||||
left: '' + oObject.size.width + 'px'
|
left: '' + oObject.size.width + 'px'
|
||||||
|
|
@ -1204,9 +1217,9 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
bootstartLoginScreen() {
|
bootstartLoginScreen() {
|
||||||
|
|
||||||
Globals.$html.removeClass('rl-user-auth').addClass('rl-user-no-auth');
|
$html.removeClass('rl-user-auth').addClass('rl-user-no-auth');
|
||||||
|
|
||||||
const customLoginLink = Utils.pString(Settings.appSettingsGet('customLoginLink'));
|
const customLoginLink = pString(Settings.appSettingsGet('customLoginLink'));
|
||||||
if (!customLoginLink)
|
if (!customLoginLink)
|
||||||
{
|
{
|
||||||
kn.startScreens([
|
kn.startScreens([
|
||||||
|
|
@ -1253,8 +1266,8 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
var
|
var
|
||||||
sJsHash = Settings.appSettingsGet('jsHash'),
|
sJsHash = Settings.appSettingsGet('jsHash'),
|
||||||
sStartupUrl = Utils.pString(Settings.settingsGet('StartupUrl')),
|
sStartupUrl = pString(Settings.settingsGet('StartupUrl')),
|
||||||
iContactsSyncInterval = Utils.pInt(Settings.settingsGet('ContactsSyncInterval')),
|
iContactsSyncInterval = pInt(Settings.settingsGet('ContactsSyncInterval')),
|
||||||
bGoogle = Settings.settingsGet('AllowGoogleSocial'),
|
bGoogle = Settings.settingsGet('AllowGoogleSocial'),
|
||||||
bFacebook = Settings.settingsGet('AllowFacebookSocial'),
|
bFacebook = Settings.settingsGet('AllowFacebookSocial'),
|
||||||
bTwitter = Settings.settingsGet('AllowTwitterSocial')
|
bTwitter = Settings.settingsGet('AllowTwitterSocial')
|
||||||
|
|
@ -1265,17 +1278,17 @@ class AppUser extends AbstractApp
|
||||||
progressJs.set(90);
|
progressJs.set(90);
|
||||||
}
|
}
|
||||||
|
|
||||||
Globals.leftPanelDisabled.subscribe((value) => {
|
leftPanelDisabled.subscribe((value) => {
|
||||||
Events.pub('left-panel.' + (value ? 'off' : 'on'));
|
Events.pub('left-panel.' + (value ? 'off' : 'on'));
|
||||||
});
|
});
|
||||||
|
|
||||||
this.setWindowTitle('');
|
this.setWindowTitle('');
|
||||||
if (Settings.settingsGet('Auth'))
|
if (Settings.settingsGet('Auth'))
|
||||||
{
|
{
|
||||||
Globals.$html.addClass('rl-user-auth');
|
$html.addClass('rl-user-auth');
|
||||||
|
|
||||||
if (Settings.capa(Enums.Capa.TwoFactor) &&
|
if (Settings.capa(Capa.TwoFactor) &&
|
||||||
Settings.capa(Enums.Capa.TwoFactorForce) &&
|
Settings.capa(Capa.TwoFactorForce) &&
|
||||||
Settings.settingsGet('RequireTwoFactor'))
|
Settings.settingsGet('RequireTwoFactor'))
|
||||||
{
|
{
|
||||||
this.bootend();
|
this.bootend();
|
||||||
|
|
@ -1300,7 +1313,7 @@ class AppUser extends AbstractApp
|
||||||
kn.routeOn();
|
kn.routeOn();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.jassl && window.crypto && window.crypto.getRandomValues && Settings.capa(Enums.Capa.OpenPGP))
|
if (window.jassl && window.crypto && window.crypto.getRandomValues && Settings.capa(Capa.OpenPGP))
|
||||||
{
|
{
|
||||||
const openpgpCallback = (openpgp) => {
|
const openpgpCallback = (openpgp) => {
|
||||||
|
|
||||||
|
|
@ -1314,7 +1327,7 @@ class AppUser extends AbstractApp
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
Utils.log(e);
|
log(e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1347,7 +1360,7 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
kn.startScreens([
|
kn.startScreens([
|
||||||
require('Screen/User/MailBox'),
|
require('Screen/User/MailBox'),
|
||||||
Settings.capa(Enums.Capa.Settings) ? require('Screen/User/Settings') : null
|
Settings.capa(Capa.Settings) ? require('Screen/User/Settings') : null
|
||||||
// false ? require('Screen/User/About') : null
|
// false ? require('Screen/User/About') : null
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -1388,7 +1401,7 @@ class AppUser extends AbstractApp
|
||||||
}, 1000);
|
}, 1000);
|
||||||
|
|
||||||
_.delay(() => this.quota(), 5000);
|
_.delay(() => this.quota(), 5000);
|
||||||
_.delay(() => Remote.appDelayStart(Utils.emptyFunction), 35000);
|
_.delay(() => Remote.appDelayStart(noop), 35000);
|
||||||
|
|
||||||
Events.sub('rl.auto-logout', () => this.logout());
|
Events.sub('rl.auto-logout', () => this.logout());
|
||||||
|
|
||||||
|
|
@ -1402,7 +1415,7 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
if (!!Settings.settingsGet('AccountSignMe') &&
|
if (!!Settings.settingsGet('AccountSignMe') &&
|
||||||
window.navigator.registerProtocolHandler &&
|
window.navigator.registerProtocolHandler &&
|
||||||
Settings.capa(Enums.Capa.Composer))
|
Settings.capa(Capa.Composer))
|
||||||
{
|
{
|
||||||
_.delay(() => {
|
_.delay(() => {
|
||||||
try {
|
try {
|
||||||
|
|
@ -1413,14 +1426,14 @@ class AppUser extends AbstractApp
|
||||||
|
|
||||||
if (Settings.settingsGet('MailToEmail'))
|
if (Settings.settingsGet('MailToEmail'))
|
||||||
{
|
{
|
||||||
Utils.mailToHelper(Settings.settingsGet('MailToEmail'), require('View/Popup/Compose'));
|
mailToHelper(Settings.settingsGet('MailToEmail'), require('View/Popup/Compose'));
|
||||||
}
|
}
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Globals.bMobileDevice)
|
if (!bMobileDevice)
|
||||||
{
|
{
|
||||||
_.defer(() => this.initVerticalLayoutResizer(Enums.ClientSideKeyName.FolderListSize));
|
_.defer(() => this.initVerticalLayoutResizer(ClientSideKeyName.FolderListSize));
|
||||||
|
|
||||||
if (Tinycon && Settings.appSettingsGet('faviconStatus') && !Settings.appSettingsGet('listPermanentFiltered'))
|
if (Tinycon && Settings.appSettingsGet('faviconStatus') && !Settings.appSettingsGet('listPermanentFiltered'))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
import {window, $} from 'common';
|
import {window, $} from 'common';
|
||||||
import Globals from 'Common/Globals';
|
import {bMobileDevice, bSafari} from 'Common/Globals';
|
||||||
import Utils from 'Common/Utils';
|
|
||||||
import Links from 'Common/Links';
|
import Links from 'Common/Links';
|
||||||
import Events from 'Common/Events';
|
import Events from 'Common/Events';
|
||||||
|
import {trim} from 'Common/Utils';
|
||||||
|
|
||||||
class Audio
|
class Audio
|
||||||
{
|
{
|
||||||
|
|
@ -20,7 +20,7 @@ class Audio
|
||||||
{
|
{
|
||||||
this.player = this.createNewObject();
|
this.player = this.createNewObject();
|
||||||
|
|
||||||
this.supported = !Globals.bMobileDevice && !Globals.bSafari && !!this.player && !!this.player.play;
|
this.supported = !bMobileDevice && !bSafari && !!this.player && !!this.player.play;
|
||||||
if (this.supported && this.player.canPlayType)
|
if (this.supported && this.player.canPlayType)
|
||||||
{
|
{
|
||||||
this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, '');
|
this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, '');
|
||||||
|
|
@ -78,10 +78,10 @@ class Audio
|
||||||
|
|
||||||
clearName(name = '', ext = '') {
|
clearName(name = '', ext = '') {
|
||||||
|
|
||||||
name = Utils.trim(name);
|
name = trim(name);
|
||||||
if (ext && '.' + ext === name.toLowerCase().substr((ext.length + 1) * -1))
|
if (ext && '.' + ext === name.toLowerCase().substr((ext.length + 1) * -1))
|
||||||
{
|
{
|
||||||
name = Utils.trim(name.substr(0, name.length - 4));
|
name = trim(name.substr(0, name.length - 4));
|
||||||
}
|
}
|
||||||
|
|
||||||
return '' === name ? 'audio' : name;
|
return '' === name ? 'audio' : name;
|
||||||
|
|
|
||||||
|
|
@ -146,11 +146,8 @@ function runMainBoot(withError, additionalError)
|
||||||
{
|
{
|
||||||
if (window.__APP_BOOT && !withError)
|
if (window.__APP_BOOT && !withError)
|
||||||
{
|
{
|
||||||
window.__APP_BOOT(function (bV) {
|
window.__APP_BOOT(() => {
|
||||||
if (!bV)
|
showError(additionalError);
|
||||||
{
|
|
||||||
showError(additionalError);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import {_} from 'common';
|
import {_} from 'common';
|
||||||
import {Capa, MessageSetAction} from 'Common/Enums';
|
import {Capa, MessageSetAction} from 'Common/Enums';
|
||||||
import Utils from 'Common/Utils';
|
import {trim, pInt, isArray} from 'Common/Utils';
|
||||||
import Links from 'Common/Links';
|
import Links from 'Common/Links';
|
||||||
import Settings from 'Storage/Settings';
|
import Settings from 'Storage/Settings';
|
||||||
|
|
||||||
|
|
@ -38,7 +38,7 @@ class CacheUserStorage
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
getUserPic(email, callback) {
|
getUserPic(email, callback) {
|
||||||
email = Utils.trim(email);
|
email = trim(email);
|
||||||
callback(this.bCapaGravatar && '' !== email ? Links.avatarLink(email) : '', email);
|
callback(this.bCapaGravatar && '' !== email ? Links.avatarLink(email) : '', email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -253,8 +253,8 @@ class CacheUserStorage
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
message.hasUnseenSubMessage(unseenSubUid && 0 < Utils.pInt(unseenSubUid));
|
message.hasUnseenSubMessage(unseenSubUid && 0 < pInt(unseenSubUid));
|
||||||
message.hasFlaggedSubMessage(flaggedSubUid && 0 < Utils.pInt(flaggedSubUid));
|
message.hasFlaggedSubMessage(flaggedSubUid && 0 < pInt(flaggedSubUid));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -279,7 +279,7 @@ class CacheUserStorage
|
||||||
* @param {Array} flags
|
* @param {Array} flags
|
||||||
*/
|
*/
|
||||||
storeMessageFlagsToCacheByFolderAndUid(folder, uid, flags) {
|
storeMessageFlagsToCacheByFolderAndUid(folder, uid, flags) {
|
||||||
if (Utils.isArray(flags) && 0 < flags.length)
|
if (isArray(flags) && 0 < flags.length)
|
||||||
{
|
{
|
||||||
this.setMessageFlagsToCache(folder, uid, flags);
|
this.setMessageFlagsToCache(folder, uid, flags);
|
||||||
}
|
}
|
||||||
|
|
@ -295,7 +295,7 @@ class CacheUserStorage
|
||||||
let unread = 0;
|
let unread = 0;
|
||||||
const flags = this.getMessageFlagsFromCache(folder, uid);
|
const flags = this.getMessageFlagsFromCache(folder, uid);
|
||||||
|
|
||||||
if (Utils.isArray(flags) && 0 < flags.length)
|
if (isArray(flags) && 0 < flags.length)
|
||||||
{
|
{
|
||||||
if (flags[0])
|
if (flags[0])
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import {window, JSON, $} from 'common';
|
import {window, JSON, $} from 'common';
|
||||||
import Utils from 'Common/Utils';
|
import {isUnd} from 'Common/Utils';
|
||||||
import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
|
import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
|
||||||
|
|
||||||
class CookieDriver
|
class CookieDriver
|
||||||
|
|
@ -60,7 +60,7 @@ class CookieDriver
|
||||||
storageResult = null === storageValue ? null : JSON.parse(storageValue)
|
storageResult = null === storageValue ? null : JSON.parse(storageValue)
|
||||||
;
|
;
|
||||||
|
|
||||||
result = (storageResult && !Utils.isUnd(storageResult[key])) ? storageResult[key] : null;
|
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import {window, JSON} from 'common';
|
import {window, JSON} from 'common';
|
||||||
import Utils from 'Common/Utils';
|
import {isUnd} from 'Common/Utils';
|
||||||
import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
|
import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
|
||||||
|
|
||||||
class LocalStorageDriver
|
class LocalStorageDriver
|
||||||
|
|
@ -57,7 +57,7 @@ class LocalStorageDriver
|
||||||
storageResult = null === storageValue ? null : JSON.parse(storageValue)
|
storageResult = null === storageValue ? null : JSON.parse(storageValue)
|
||||||
;
|
;
|
||||||
|
|
||||||
result = (storageResult && !Utils.isUnd(storageResult[key])) ? storageResult[key] : null;
|
result = (storageResult && !isUnd(storageResult[key])) ? storageResult[key] : null;
|
||||||
}
|
}
|
||||||
catch (e)
|
catch (e)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import {_} from 'common';
|
import {_} from 'common';
|
||||||
import Utils from 'Common/Utils';
|
import {isObject, isUnd} from 'Common/Utils';
|
||||||
import Plugins from 'Common/Plugins';
|
import Plugins from 'Common/Plugins';
|
||||||
|
|
||||||
class Events
|
class Events
|
||||||
|
|
@ -17,7 +17,7 @@ class Events
|
||||||
*/
|
*/
|
||||||
sub(name, func, context) {
|
sub(name, func, context) {
|
||||||
|
|
||||||
if (Utils.isObject(name))
|
if (isObject(name))
|
||||||
{
|
{
|
||||||
context = func || null;
|
context = func || null;
|
||||||
func = null;
|
func = null;
|
||||||
|
|
@ -28,7 +28,7 @@ class Events
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (Utils.isUnd(this.subs[name]))
|
if (isUnd(this.subs[name]))
|
||||||
{
|
{
|
||||||
this.subs[name] = [];
|
this.subs[name] = [];
|
||||||
}
|
}
|
||||||
|
|
@ -48,7 +48,7 @@ class Events
|
||||||
|
|
||||||
Plugins.runHook('rl-pub', [name, args]);
|
Plugins.runHook('rl-pub', [name, args]);
|
||||||
|
|
||||||
if (!Utils.isUnd(this.subs[name]))
|
if (!isUnd(this.subs[name]))
|
||||||
{
|
{
|
||||||
_.each(this.subs[name], (items) => {
|
_.each(this.subs[name], (items) => {
|
||||||
if (items[0])
|
if (items[0])
|
||||||
|
|
|
||||||
|
|
@ -1,303 +0,0 @@
|
||||||
|
|
||||||
/* global RL_COMMUNITY */
|
|
||||||
|
|
||||||
(function () {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var
|
|
||||||
Globals = {},
|
|
||||||
|
|
||||||
window = require('window'),
|
|
||||||
_ = require('_'),
|
|
||||||
$ = require('$'),
|
|
||||||
ko = require('ko'),
|
|
||||||
key = require('key'),
|
|
||||||
|
|
||||||
Enums = require('Common/Enums')
|
|
||||||
;
|
|
||||||
|
|
||||||
Globals.$win = $(window);
|
|
||||||
Globals.$doc = $(window.document);
|
|
||||||
Globals.$html = $('html');
|
|
||||||
Globals.$body = $('body');
|
|
||||||
Globals.$div = $('<div></div>');
|
|
||||||
|
|
||||||
Globals.$win.__sizes = [0, 0];
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {?}
|
|
||||||
*/
|
|
||||||
Globals.startMicrotime = (new window.Date()).getTime();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.community = RL_COMMUNITY;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {?}
|
|
||||||
*/
|
|
||||||
Globals.dropdownVisibility = ko.observable(false).extend({'rateLimit': 0});
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.useKeyboardShortcuts = ko.observable(true);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
Globals.iAjaxErrorCount = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
Globals.iTokenErrorCount = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {number}
|
|
||||||
*/
|
|
||||||
Globals.iMessageBodyCacheCount = 0;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bUnload = false;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {string}
|
|
||||||
*/
|
|
||||||
Globals.sUserAgent = 'navigator' in window && 'userAgent' in window.navigator &&
|
|
||||||
window.navigator.userAgent.toLowerCase() || '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bIE = Globals.sUserAgent.indexOf('msie') > -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bChrome = Globals.sUserAgent.indexOf('chrome') > -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bSafari = !Globals.bChrome && Globals.sUserAgent.indexOf('safari') > -1;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bMobileDevice =
|
|
||||||
/android/i.test(Globals.sUserAgent) ||
|
|
||||||
/iphone/i.test(Globals.sUserAgent) ||
|
|
||||||
/ipod/i.test(Globals.sUserAgent) ||
|
|
||||||
/ipad/i.test(Globals.sUserAgent) ||
|
|
||||||
/blackberry/i.test(Globals.sUserAgent)
|
|
||||||
;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bDisableNanoScroll = Globals.bMobileDevice;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bAllowPdfPreview = !Globals.bMobileDevice;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bAnimationSupported = !Globals.bMobileDevice &&
|
|
||||||
Globals.$html.hasClass('csstransitions') &&
|
|
||||||
Globals.$html.hasClass('cssanimations');
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
Globals.bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {*}
|
|
||||||
*/
|
|
||||||
Globals.__APP__ = null;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
Globals.oHtmlEditorDefaultConfig = {
|
|
||||||
'title': false,
|
|
||||||
'stylesSet': false,
|
|
||||||
'customConfig': '',
|
|
||||||
'contentsCss': '',
|
|
||||||
'toolbarGroups': [
|
|
||||||
{name: 'spec'},
|
|
||||||
{name: 'styles'},
|
|
||||||
{name: 'basicstyles', groups: ['basicstyles', 'cleanup', 'bidi']},
|
|
||||||
{name: 'colors'},
|
|
||||||
Globals.bMobileDevice ? {} : {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align']},
|
|
||||||
{name: 'links'},
|
|
||||||
{name: 'insert'},
|
|
||||||
{name: 'document', groups: ['mode', 'document', 'doctools']},
|
|
||||||
{name: 'others'}
|
|
||||||
],
|
|
||||||
|
|
||||||
'removePlugins': 'liststyle',
|
|
||||||
'removeButtons': 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll,Source',
|
|
||||||
'removeDialogTabs': 'link:advanced;link:target;image:advanced;images:advanced',
|
|
||||||
|
|
||||||
'extraPlugins': 'plain,signature',
|
|
||||||
|
|
||||||
'allowedContent': true,
|
|
||||||
'extraAllowedContent': true,
|
|
||||||
|
|
||||||
'fillEmptyBlocks': false,
|
|
||||||
'ignoreEmptyParagraph': true,
|
|
||||||
'disableNativeSpellChecker': false,
|
|
||||||
|
|
||||||
'font_defaultLabel': 'Arial',
|
|
||||||
'fontSize_defaultLabel': '13',
|
|
||||||
'fontSize_sizes': '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
Globals.oHtmlEditorLangsMap = {
|
|
||||||
'bg_bg': 'bg',
|
|
||||||
'de_de': 'de',
|
|
||||||
'el_gr': 'el',
|
|
||||||
'es_es': 'es',
|
|
||||||
'fr_fr': 'fr',
|
|
||||||
'hu_hu': 'hu',
|
|
||||||
'is_is': 'is',
|
|
||||||
'it_it': 'it',
|
|
||||||
'ja_jp': 'ja',
|
|
||||||
'ko_kr': 'ko',
|
|
||||||
'lt_lt': 'lt',
|
|
||||||
'lv_lv': 'lv',
|
|
||||||
'nl_nl': 'nl',
|
|
||||||
'bg_no': 'no',
|
|
||||||
'pl_pl': 'pl',
|
|
||||||
'pt_pt': 'pt',
|
|
||||||
'pt_br': 'pt-br',
|
|
||||||
'ro_ro': 'ro',
|
|
||||||
'ru_ru': 'ru',
|
|
||||||
'sk_sk': 'sk',
|
|
||||||
'sl_si': 'sl',
|
|
||||||
'sv_se': 'sv',
|
|
||||||
'tr_tr': 'tr',
|
|
||||||
'uk_ua': 'ru',
|
|
||||||
'zh_tw': 'zh',
|
|
||||||
'zh_cn': 'zh-cn'
|
|
||||||
};
|
|
||||||
|
|
||||||
if (Globals.bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
|
|
||||||
{
|
|
||||||
Globals.bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
|
|
||||||
return oType && 'application/pdf' === oType.type;
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!Globals.bAllowPdfPreview)
|
|
||||||
{
|
|
||||||
Globals.bAllowPdfPreview = (typeof window.navigator.mimeTypes['application/pdf'] !== 'undefined');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Globals.aBootstrapDropdowns = [];
|
|
||||||
|
|
||||||
Globals.aViewModels = {
|
|
||||||
'settings': [],
|
|
||||||
'settings-removed': [],
|
|
||||||
'settings-disabled': []
|
|
||||||
};
|
|
||||||
|
|
||||||
Globals.leftPanelDisabled = ko.observable(false);
|
|
||||||
Globals.leftPanelType = ko.observable('');
|
|
||||||
Globals.leftPanelWidth = ko.observable(0);
|
|
||||||
|
|
||||||
// popups
|
|
||||||
Globals.popupVisibilityNames = ko.observableArray([]);
|
|
||||||
|
|
||||||
Globals.popupVisibility = ko.computed(function () {
|
|
||||||
return 0 < Globals.popupVisibilityNames().length;
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
Globals.popupVisibility.subscribe(function (bValue) {
|
|
||||||
Globals.$html.toggleClass('rl-modal', bValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
// 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 || 'true' === '' + 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('keyScope=' + sValue); // DEBUG
|
|
||||||
key.setScope(sValue);
|
|
||||||
});
|
|
||||||
|
|
||||||
Globals.dropdownVisibility.subscribe(function (bValue) {
|
|
||||||
if (bValue)
|
|
||||||
{
|
|
||||||
Globals.keyScope(Enums.KeyState.Menu);
|
|
||||||
}
|
|
||||||
else if (Enums.KeyState.Menu === key.getScope())
|
|
||||||
{
|
|
||||||
Globals.keyScope(Globals.keyScopeFake());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
module.exports = Globals;
|
|
||||||
|
|
||||||
}());
|
|
||||||
276
dev/Common/Globals.jsx
Normal file
276
dev/Common/Globals.jsx
Normal file
|
|
@ -0,0 +1,276 @@
|
||||||
|
|
||||||
|
/* global RL_COMMUNITY */
|
||||||
|
import {window, _, $, key} from 'common';
|
||||||
|
import ko from 'ko';
|
||||||
|
import {KeyState} from 'Common/Enums';
|
||||||
|
|
||||||
|
const $win = $(window);
|
||||||
|
$win.__sizes = [0, 0];
|
||||||
|
|
||||||
|
export {$win};
|
||||||
|
|
||||||
|
export const $doc = $(window.document);
|
||||||
|
|
||||||
|
export const $html = $('html');
|
||||||
|
|
||||||
|
export const $body = $('body');
|
||||||
|
|
||||||
|
export const $div = $('<div></div>');
|
||||||
|
|
||||||
|
export const startMicrotime = (new window.Date()).getTime();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export const community = RL_COMMUNITY;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {?}
|
||||||
|
*/
|
||||||
|
export const dropdownVisibility = ko.observable(false).extend({rateLimit: 0});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export const useKeyboardShortcuts = ko.observable(true);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {string}
|
||||||
|
*/
|
||||||
|
export const sUserAgent = 'navigator' in window && 'userAgent' in window.navigator &&
|
||||||
|
window.navigator.userAgent.toLowerCase() || '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export const bIE = sUserAgent.indexOf('msie') > -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export const bChrome = sUserAgent.indexOf('chrome') > -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export const bSafari = !bChrome && sUserAgent.indexOf('safari') > -1;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export const bMobileDevice =
|
||||||
|
/android/i.test(sUserAgent) ||
|
||||||
|
/iphone/i.test(sUserAgent) ||
|
||||||
|
/ipod/i.test(sUserAgent) ||
|
||||||
|
/ipad/i.test(sUserAgent) ||
|
||||||
|
/blackberry/i.test(sUserAgent)
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export let bDisableNanoScroll = bMobileDevice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export let bAnimationSupported = !bMobileDevice &&
|
||||||
|
$html.hasClass('csstransitions') &&
|
||||||
|
$html.hasClass('cssanimations')
|
||||||
|
;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
export const bXMLHttpRequestSupported = !!window.XMLHttpRequest;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
export const oHtmlEditorDefaultConfig = {
|
||||||
|
title: false,
|
||||||
|
stylesSet: false,
|
||||||
|
customConfig: '',
|
||||||
|
contentsCss: '',
|
||||||
|
toolbarGroups: [
|
||||||
|
{name: 'spec'},
|
||||||
|
{name: 'styles'},
|
||||||
|
{name: 'basicstyles', groups: ['basicstyles', 'cleanup', 'bidi']},
|
||||||
|
{name: 'colors'},
|
||||||
|
bMobileDevice ? {} : {name: 'paragraph', groups: ['list', 'indent', 'blocks', 'align']},
|
||||||
|
{name: 'links'},
|
||||||
|
{name: 'insert'},
|
||||||
|
{name: 'document', groups: ['mode', 'document', 'doctools']},
|
||||||
|
{name: 'others'}
|
||||||
|
],
|
||||||
|
|
||||||
|
removePlugins: 'liststyle',
|
||||||
|
removeButtons: 'Format,Undo,Redo,Cut,Copy,Paste,Anchor,Strike,Subscript,Superscript,Image,SelectAll,Source',
|
||||||
|
removeDialogTabs: 'link:advanced;link:target;image:advanced;images:advanced',
|
||||||
|
|
||||||
|
extraPlugins: 'plain,signature',
|
||||||
|
|
||||||
|
allowedContent: true,
|
||||||
|
extraAllowedContent: true,
|
||||||
|
|
||||||
|
fillEmptyBlocks: false,
|
||||||
|
ignoreEmptyParagraph: true,
|
||||||
|
disableNativeSpellChecker: false,
|
||||||
|
|
||||||
|
font_defaultLabel: 'Arial',
|
||||||
|
fontSize_defaultLabel: '13',
|
||||||
|
fontSize_sizes: '10/10px;12/12px;13/13px;14/14px;16/16px;18/18px;20/20px;24/24px;28/28px;36/36px;48/48px'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {Object}
|
||||||
|
*/
|
||||||
|
export const oHtmlEditorLangsMap = {
|
||||||
|
bg_bg: 'bg',
|
||||||
|
de_de: 'de',
|
||||||
|
el_gr: 'el',
|
||||||
|
es_es: 'es',
|
||||||
|
fr_fr: 'fr',
|
||||||
|
hu_hu: 'hu',
|
||||||
|
is_is: 'is',
|
||||||
|
it_it: 'it',
|
||||||
|
ja_jp: 'ja',
|
||||||
|
ko_kr: 'ko',
|
||||||
|
lt_lt: 'lt',
|
||||||
|
lv_lv: 'lv',
|
||||||
|
nl_nl: 'nl',
|
||||||
|
bg_no: 'no',
|
||||||
|
pl_pl: 'pl',
|
||||||
|
pt_pt: 'pt',
|
||||||
|
pt_br: 'pt-br',
|
||||||
|
ro_ro: 'ro',
|
||||||
|
ru_ru: 'ru',
|
||||||
|
sk_sk: 'sk',
|
||||||
|
sl_si: 'sl',
|
||||||
|
sv_se: 'sv',
|
||||||
|
tr_tr: 'tr',
|
||||||
|
uk_ua: 'ru',
|
||||||
|
zh_tw: 'zh',
|
||||||
|
zh_cn: 'zh-cn'
|
||||||
|
};
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {boolean}
|
||||||
|
*/
|
||||||
|
let bAllowPdfPreview = !bMobileDevice;
|
||||||
|
|
||||||
|
if (bAllowPdfPreview && window.navigator && window.navigator.mimeTypes)
|
||||||
|
{
|
||||||
|
bAllowPdfPreview = !!_.find(window.navigator.mimeTypes, function (oType) {
|
||||||
|
return oType && 'application/pdf' === oType.type;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!bAllowPdfPreview)
|
||||||
|
{
|
||||||
|
bAllowPdfPreview = (typeof window.navigator.mimeTypes['application/pdf'] !== 'undefined');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export {bAllowPdfPreview};
|
||||||
|
|
||||||
|
export const aViewModels = {
|
||||||
|
settings: [],
|
||||||
|
'settings-removed': [],
|
||||||
|
'settings-disabled': []
|
||||||
|
};
|
||||||
|
|
||||||
|
export const leftPanelDisabled = ko.observable(false);
|
||||||
|
export const leftPanelType = ko.observable('');
|
||||||
|
export const leftPanelWidth = ko.observable(0);
|
||||||
|
|
||||||
|
// popups
|
||||||
|
export const popupVisibilityNames = ko.observableArray([]);
|
||||||
|
|
||||||
|
export const popupVisibility = ko.computed(() => {
|
||||||
|
return 0 < popupVisibilityNames().length;
|
||||||
|
});
|
||||||
|
|
||||||
|
popupVisibility.subscribe((bValue) => {
|
||||||
|
$html.toggleClass('rl-modal', bValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
// keys
|
||||||
|
export const keyScopeReal = ko.observable(KeyState.All);
|
||||||
|
export const keyScopeFake = ko.observable(KeyState.All);
|
||||||
|
|
||||||
|
export const keyScope = ko.computed({
|
||||||
|
owner: this,
|
||||||
|
read: () => {
|
||||||
|
return keyScopeFake();
|
||||||
|
},
|
||||||
|
write: function (sValue) {
|
||||||
|
|
||||||
|
if (KeyState.Menu !== sValue)
|
||||||
|
{
|
||||||
|
if (KeyState.Compose === sValue)
|
||||||
|
{
|
||||||
|
// disableKeyFilter
|
||||||
|
key.filter = function () {
|
||||||
|
return useKeyboardShortcuts();
|
||||||
|
};
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// restoreKeyFilter
|
||||||
|
key.filter = function (event) {
|
||||||
|
|
||||||
|
if (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 || 'true' === '' + oElement.contentEditable))
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
keyScopeFake(sValue);
|
||||||
|
if (dropdownVisibility())
|
||||||
|
{
|
||||||
|
sValue = KeyState.Menu;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
keyScopeReal(sValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
keyScopeReal.subscribe(function (sValue) {
|
||||||
|
// window.console.log('keyScope=' + sValue); // DEBUG
|
||||||
|
key.setScope(sValue);
|
||||||
|
});
|
||||||
|
|
||||||
|
dropdownVisibility.subscribe(function (bValue) {
|
||||||
|
if (bValue)
|
||||||
|
{
|
||||||
|
keyScope(KeyState.Menu);
|
||||||
|
}
|
||||||
|
else if (KeyState.Menu === key.getScope())
|
||||||
|
{
|
||||||
|
keyScope(keyScopeFake());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type {*}
|
||||||
|
*/
|
||||||
|
export const data = {
|
||||||
|
__APP__: null,
|
||||||
|
iAjaxErrorCount: 0,
|
||||||
|
iTokenErrorCount: 0,
|
||||||
|
aBootstrapDropdowns: [],
|
||||||
|
iMessageBodyCacheCount: 0,
|
||||||
|
bUnload: false
|
||||||
|
};
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import {window, _, $} from 'common';
|
import {window, _, $} from 'common';
|
||||||
import Globals from 'Common/Globals';
|
import {oHtmlEditorDefaultConfig, oHtmlEditorLangsMap} from 'Common/Globals';
|
||||||
import Settings from 'Storage/Settings';
|
import Settings from 'Storage/Settings';
|
||||||
|
|
||||||
class HtmlEditor
|
class HtmlEditor
|
||||||
|
|
@ -236,7 +236,7 @@ class HtmlEditor
|
||||||
initFunc = () => {
|
initFunc = () => {
|
||||||
|
|
||||||
const
|
const
|
||||||
config = Globals.oHtmlEditorDefaultConfig,
|
config = oHtmlEditorDefaultConfig,
|
||||||
language = Settings.settingsGet('Language'),
|
language = Settings.settingsGet('Language'),
|
||||||
allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'),
|
allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'),
|
||||||
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons')
|
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons')
|
||||||
|
|
@ -260,7 +260,7 @@ class HtmlEditor
|
||||||
config.enterMode = window.CKEDITOR.ENTER_BR;
|
config.enterMode = window.CKEDITOR.ENTER_BR;
|
||||||
config.shiftEnterMode = window.CKEDITOR.ENTER_P;
|
config.shiftEnterMode = window.CKEDITOR.ENTER_P;
|
||||||
|
|
||||||
config.language = Globals.oHtmlEditorLangsMap[language] || 'en';
|
config.language = oHtmlEditorLangsMap[language] || 'en';
|
||||||
if (window.CKEDITOR.env)
|
if (window.CKEDITOR.env)
|
||||||
{
|
{
|
||||||
window.CKEDITOR.env.isCompatible = true;
|
window.CKEDITOR.env.isCompatible = true;
|
||||||
|
|
|
||||||
|
|
@ -1,18 +1,19 @@
|
||||||
|
|
||||||
import {window} from 'common';
|
import {window} from 'common';
|
||||||
import Utils from 'Common/Utils';
|
import {pString, pInt, isUnd, isNormal, trim, encodeURIComponent} from 'Common/Utils';
|
||||||
import Settings from 'Storage/Settings';
|
import Settings from 'Storage/Settings';
|
||||||
|
|
||||||
class Links
|
class Links
|
||||||
{
|
{
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
this.sBase = '#/';
|
this.sHashPrefix = '#/';
|
||||||
this.sServer = './?';
|
this.sServerPrefix = './?';
|
||||||
|
|
||||||
this.sVersion = Settings.appSettingsGet('version');
|
this.sVersion = Settings.appSettingsGet('version');
|
||||||
this.sWebPrefix = Settings.appSettingsGet('webPath') || '';
|
this.sWebPrefix = Settings.appSettingsGet('webPath') || '';
|
||||||
this.sVersionPrefix = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + this.sVersion + '/';
|
this.sVersionPrefix = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + this.sVersion + '/';
|
||||||
|
this.bAminHostUse = !!Settings.appSettingsGet('adminHostUse');
|
||||||
this.sAdminPath = Settings.appSettingsGet('adminPath') || 'admin';
|
this.sAdminPath = Settings.appSettingsGet('adminPath') || 'admin';
|
||||||
|
|
||||||
this.sAuthSuffix = Settings.settingsGet('AuthAccountHash') || '0';
|
this.sAuthSuffix = Settings.settingsGet('AuthAccountHash') || '0';
|
||||||
|
|
@ -36,14 +37,14 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
root(startupUrl = '') {
|
root(startupUrl = '') {
|
||||||
return this.sBase + Utils.pString(startupUrl);
|
return this.sHashPrefix + pString(startupUrl);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
rootAdmin() {
|
rootAdmin() {
|
||||||
return this.sServer + this.sAdminPath;
|
return this.bAminHostUse ? './' : this.sServerPrefix + this.sAdminPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -60,8 +61,8 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
attachmentRaw(type, download, customSpecSuffix) {
|
attachmentRaw(type, download, customSpecSuffix) {
|
||||||
customSpecSuffix = Utils.isUnd(customSpecSuffix) ? this.sAuthSuffix : customSpecSuffix;
|
customSpecSuffix = isUnd(customSpecSuffix) ? this.sAuthSuffix : customSpecSuffix;
|
||||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + customSpecSuffix + '/' + type + '/' +
|
return this.sServerPrefix + '/Raw/' + this.subQueryPrefix() + '/' + customSpecSuffix + '/' + type + '/' +
|
||||||
this.subQueryPrefix() + '/' + download;
|
this.subQueryPrefix() + '/' + download;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -114,28 +115,28 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
upload() {
|
upload() {
|
||||||
return this.sServer + '/Upload/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
return this.sServerPrefix + '/Upload/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
uploadContacts() {
|
uploadContacts() {
|
||||||
return this.sServer + '/UploadContacts/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
return this.sServerPrefix + '/UploadContacts/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
uploadBackground() {
|
uploadBackground() {
|
||||||
return this.sServer + '/UploadBackground/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
return this.sServerPrefix + '/UploadBackground/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
append() {
|
append() {
|
||||||
return this.sServer + '/Append/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
return this.sServerPrefix + '/Append/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -143,7 +144,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
change(email) {
|
change(email) {
|
||||||
return this.sServer + '/Change/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' + Utils.encodeURIComponent(email) + '/';
|
return this.sServerPrefix + '/Change/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' + encodeURIComponent(email) + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -151,7 +152,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
ajax(add) {
|
ajax(add) {
|
||||||
return this.sServer + '/Ajax/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' + add;
|
return this.sServerPrefix + '/Ajax/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' + add;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -159,7 +160,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
messageViewLink(requestHash) {
|
messageViewLink(requestHash) {
|
||||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/ViewAsPlain/' + this.subQueryPrefix() + '/' + requestHash;
|
return this.sServerPrefix + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/ViewAsPlain/' + this.subQueryPrefix() + '/' + requestHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -167,7 +168,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
messageDownloadLink(requestHash) {
|
messageDownloadLink(requestHash) {
|
||||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/Download/' + this.subQueryPrefix() + '/' + requestHash;
|
return this.sServerPrefix + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/Download/' + this.subQueryPrefix() + '/' + requestHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -175,7 +176,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
avatarLink(email) {
|
avatarLink(email) {
|
||||||
return this.sServer + '/Raw/0/Avatar/' + Utils.encodeURIComponent(email) + '/';
|
return this.sServerPrefix + '/Raw/0/Avatar/' + encodeURIComponent(email) + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -183,7 +184,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
publicLink(hash) {
|
publicLink(hash) {
|
||||||
return this.sServer + '/Raw/0/Public/' + hash + '/';
|
return this.sServerPrefix + '/Raw/0/Public/' + hash + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -191,7 +192,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
userBackground(hash) {
|
userBackground(hash) {
|
||||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix +
|
return this.sServerPrefix + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix +
|
||||||
'/UserBackground/' + this.subQueryPrefix() + '/' + hash;
|
'/UserBackground/' + this.subQueryPrefix() + '/' + hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -200,7 +201,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
inbox(inboxFolderName = 'INBOX') {
|
inbox(inboxFolderName = 'INBOX') {
|
||||||
return this.sBase + 'mailbox/' + inboxFolderName;
|
return this.sHashPrefix + 'mailbox/' + inboxFolderName;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -208,14 +209,14 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
settings(screenName = '') {
|
settings(screenName = '') {
|
||||||
return this.sBase + 'settings' + (screenName ? '/' + screenName : '');
|
return this.sHashPrefix + 'settings' + (screenName ? '/' + screenName : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
about() {
|
about() {
|
||||||
return this.sBase + 'about';
|
return this.sHashPrefix + 'about';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -223,7 +224,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
admin (screenName) {
|
admin (screenName) {
|
||||||
let result = this.sBase;
|
let result = this.sHashPrefix;
|
||||||
switch (screenName) {
|
switch (screenName) {
|
||||||
case 'AdminDomains':
|
case 'AdminDomains':
|
||||||
result += 'domains';
|
result += 'domains';
|
||||||
|
|
@ -248,14 +249,14 @@ class Links
|
||||||
*/
|
*/
|
||||||
mailBox(folder, page = 1, search = '', threadUid = '') {
|
mailBox(folder, page = 1, search = '', threadUid = '') {
|
||||||
|
|
||||||
page = Utils.isNormal(page) ? Utils.pInt(page) : 1;
|
page = isNormal(page) ? pInt(page) : 1;
|
||||||
search = Utils.pString(search);
|
search = pString(search);
|
||||||
|
|
||||||
let result = this.sBase + 'mailbox/';
|
let result = this.sHashPrefix + 'mailbox/';
|
||||||
|
|
||||||
if ('' !== folder)
|
if ('' !== folder)
|
||||||
{
|
{
|
||||||
const resultThreadUid = Utils.pInt(threadUid);
|
const resultThreadUid = pInt(threadUid);
|
||||||
result += window.encodeURI(folder) + (0 < resultThreadUid ? '~' + resultThreadUid : '');
|
result += window.encodeURI(folder) + (0 < resultThreadUid ? '~' + resultThreadUid : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -278,7 +279,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
phpInfo() {
|
phpInfo() {
|
||||||
return this.sServer + 'Info';
|
return this.sServerPrefix + 'Info';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -287,21 +288,21 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
langLink(lang, admin) {
|
langLink(lang, admin) {
|
||||||
return this.sServer + '/Lang/0/' + (admin ? 'Admin' : 'App') + '/' + window.encodeURI(lang) + '/' + this.sVersion + '/';
|
return this.sServerPrefix + '/Lang/0/' + (admin ? 'Admin' : 'App') + '/' + window.encodeURI(lang) + '/' + this.sVersion + '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
exportContactsVcf() {
|
exportContactsVcf() {
|
||||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/ContactsVcf/';
|
return this.sServerPrefix + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/ContactsVcf/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
exportContactsCsv() {
|
exportContactsCsv() {
|
||||||
return this.sServer + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/ContactsCsv/';
|
return this.sServerPrefix + '/Raw/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/ContactsCsv/';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -327,7 +328,7 @@ class Links
|
||||||
let prefix = this.sVersionPrefix;
|
let prefix = this.sVersionPrefix;
|
||||||
if ('@custom' === theme.substr(-7))
|
if ('@custom' === theme.substr(-7))
|
||||||
{
|
{
|
||||||
theme = Utils.trim(theme.substring(0, theme.length - 7));
|
theme = trim(theme.substring(0, theme.length - 7));
|
||||||
prefix = this.sWebPrefix;
|
prefix = this.sWebPrefix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -367,7 +368,7 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
socialGoogle(xauth = false) {
|
socialGoogle(xauth = false) {
|
||||||
return this.sServer + 'SocialGoogle' + ('' !== this.sAuthSuffix ? '/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' : '') +
|
return this.sServerPrefix + 'SocialGoogle' + ('' !== this.sAuthSuffix ? '/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' : '') +
|
||||||
(xauth ? '&xauth=1' : '');
|
(xauth ? '&xauth=1' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -375,14 +376,14 @@ class Links
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
socialTwitter() {
|
socialTwitter() {
|
||||||
return this.sServer + 'SocialTwitter' + ('' !== this.sAuthSuffix ? '/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' : '');
|
return this.sServerPrefix + 'SocialTwitter' + ('' !== this.sAuthSuffix ? '/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' : '');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return {string}
|
* @return {string}
|
||||||
*/
|
*/
|
||||||
socialFacebook() {
|
socialFacebook() {
|
||||||
return this.sServer + 'SocialFacebook' + ('' !== this.sAuthSuffix ? '/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' : '');
|
return this.sServerPrefix + 'SocialFacebook' + ('' !== this.sAuthSuffix ? '/' + this.subQueryPrefix() + '/' + this.sAuthSuffix + '/' : '');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import {_} from 'common';
|
import {_} from 'common';
|
||||||
import Utils from 'Common/Utils';
|
import {isFunc, isArray, isUnd} from 'Common/Utils';
|
||||||
import Globals from 'Common/Globals';
|
import {data as GlobalsData} from 'Common/Globals';
|
||||||
import Settings from 'Storage/Settings';
|
import Settings from 'Storage/Settings';
|
||||||
|
|
||||||
class Plugins
|
class Plugins
|
||||||
|
|
@ -17,9 +17,9 @@ class Plugins
|
||||||
* @param {Function} callback
|
* @param {Function} callback
|
||||||
*/
|
*/
|
||||||
addHook(name, callback) {
|
addHook(name, callback) {
|
||||||
if (Utils.isFunc(callback))
|
if (isFunc(callback))
|
||||||
{
|
{
|
||||||
if (!Utils.isArray(this.oSimpleHooks[name]))
|
if (!isArray(this.oSimpleHooks[name]))
|
||||||
{
|
{
|
||||||
this.oSimpleHooks[name] = [];
|
this.oSimpleHooks[name] = [];
|
||||||
}
|
}
|
||||||
|
|
@ -33,7 +33,7 @@ class Plugins
|
||||||
* @param {Array=} args
|
* @param {Array=} args
|
||||||
*/
|
*/
|
||||||
runHook(name, args = []) {
|
runHook(name, args = []) {
|
||||||
if (Utils.isArray(this.oSimpleHooks[name]))
|
if (isArray(this.oSimpleHooks[name]))
|
||||||
{
|
{
|
||||||
_.each(this.oSimpleHooks[name], (callback) => {
|
_.each(this.oSimpleHooks[name], (callback) => {
|
||||||
callback.apply(null, args);
|
callback.apply(null, args);
|
||||||
|
|
@ -56,9 +56,9 @@ class Plugins
|
||||||
* @param {?number=} timeout
|
* @param {?number=} timeout
|
||||||
*/
|
*/
|
||||||
remoteRequest(callback, action, parameters, timeout) {
|
remoteRequest(callback, action, parameters, timeout) {
|
||||||
if (Globals.__APP__)
|
if (GlobalsData.__APP__)
|
||||||
{
|
{
|
||||||
Globals.__APP__.remote().defaultRequest(callback, 'Plugin' + action, parameters, timeout);
|
GlobalsData.__APP__.remote().defaultRequest(callback, 'Plugin' + action, parameters, timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -99,8 +99,8 @@ class Plugins
|
||||||
*/
|
*/
|
||||||
settingsGet(pluginSection, name) {
|
settingsGet(pluginSection, name) {
|
||||||
let plugins = Settings.settingsGet('Plugins');
|
let plugins = Settings.settingsGet('Plugins');
|
||||||
plugins = plugins && !Utils.isUnd(plugins[pluginSection]) ? plugins[pluginSection] : null;
|
plugins = plugins && !isUnd(plugins[pluginSection]) ? plugins[pluginSection] : null;
|
||||||
return plugins ? (Utils.isUnd(plugins[name]) ? null : plugins[name]) : null;
|
return plugins ? (isUnd(plugins[name]) ? null : plugins[name]) : null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
import {$, _, key} from 'common';
|
import {$, _, key} from 'common';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import {EventKeyCode} from 'Common/Enums';
|
import {EventKeyCode} from 'Common/Enums';
|
||||||
import Utils from 'Common/Utils';
|
import {isArray, inArray} from 'Common/Utils';
|
||||||
|
|
||||||
class Selector
|
class Selector
|
||||||
{
|
{
|
||||||
|
|
@ -137,7 +137,7 @@ class Selector
|
||||||
|
|
||||||
this.list.subscribe((items) => {
|
this.list.subscribe((items) => {
|
||||||
|
|
||||||
if (Utils.isArray(items))
|
if (isArray(items))
|
||||||
{
|
{
|
||||||
_.each(items, (item) => {
|
_.each(items, (item) => {
|
||||||
if (item)
|
if (item)
|
||||||
|
|
@ -179,7 +179,7 @@ class Selector
|
||||||
this.focusedItem(null);
|
this.focusedItem(null);
|
||||||
this.selectedItem(null);
|
this.selectedItem(null);
|
||||||
|
|
||||||
if (Utils.isArray(aItems))
|
if (isArray(aItems))
|
||||||
{
|
{
|
||||||
iLen = aCheckedCache.length;
|
iLen = aCheckedCache.length;
|
||||||
|
|
||||||
|
|
@ -194,7 +194,7 @@ class Selector
|
||||||
mFocused = null;
|
mFocused = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (0 < iLen && -1 < Utils.inArray(sUid, aCheckedCache))
|
if (0 < iLen && -1 < inArray(sUid, aCheckedCache))
|
||||||
{
|
{
|
||||||
bChecked = true;
|
bChecked = true;
|
||||||
oItem.checked(true);
|
oItem.checked(true);
|
||||||
|
|
@ -223,7 +223,7 @@ class Selector
|
||||||
{
|
{
|
||||||
bGetNext = false;
|
bGetNext = false;
|
||||||
mNextFocused = _.find(aCache, (sUid) => {
|
mNextFocused = _.find(aCache, (sUid) => {
|
||||||
if (bGetNext && -1 < Utils.inArray(sUid, aUids))
|
if (bGetNext && -1 < inArray(sUid, aUids))
|
||||||
{
|
{
|
||||||
return sUid;
|
return sUid;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@
|
||||||
import {window, $, _} from 'common';
|
import {window, $, _} from 'common';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import {Notification, UploadErrorCode} from 'Common/Enums';
|
import {Notification, UploadErrorCode} from 'Common/Enums';
|
||||||
import Utils from 'Common/Utils';
|
import {pInt, microtime, noop, inArray} from 'Common/Utils';
|
||||||
import Globals from 'Common/Globals';
|
import {$html, bAnimationSupported} from 'Common/Globals';
|
||||||
|
|
||||||
class Translator
|
class Translator
|
||||||
{
|
{
|
||||||
|
|
@ -94,7 +94,7 @@ class Translator
|
||||||
this.i18nToNode(item);
|
this.i18nToNode(item);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (animate && Globals.bAnimationSupported)
|
if (animate && bAnimationSupported)
|
||||||
{
|
{
|
||||||
$('.i18n-animation[data-i18n]', elements).letterfx({
|
$('.i18n-animation[data-i18n]', elements).letterfx({
|
||||||
fx: 'fall fade',
|
fx: 'fall fade',
|
||||||
|
|
@ -256,7 +256,7 @@ class Translator
|
||||||
*/
|
*/
|
||||||
getNotificationFromResponse(response, defCode = Notification.UnknownNotification) {
|
getNotificationFromResponse(response, defCode = Notification.UnknownNotification) {
|
||||||
return response && response.ErrorCode ?
|
return response && response.ErrorCode ?
|
||||||
this.getNotification(Utils.pInt(response.ErrorCode), response.ErrorMessage || '') :
|
this.getNotification(pInt(response.ErrorCode), response.ErrorMessage || '') :
|
||||||
this.getNotification(defCode);
|
this.getNotification(defCode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -303,40 +303,40 @@ class Translator
|
||||||
|
|
||||||
const
|
const
|
||||||
self = this,
|
self = this,
|
||||||
start = Utils.microtime()
|
start = microtime()
|
||||||
;
|
;
|
||||||
|
|
||||||
Globals.$html.addClass('rl-changing-language');
|
$html.addClass('rl-changing-language');
|
||||||
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: require('Common/Links').langLink(language, admin),
|
url: require('Common/Links').langLink(language, admin),
|
||||||
dataType: 'script',
|
dataType: 'script',
|
||||||
cache: true
|
cache: true
|
||||||
})
|
})
|
||||||
.fail(fail || Utils.emptyFunction)
|
.fail(fail || noop)
|
||||||
.done(function () {
|
.done(function () {
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
|
|
||||||
self.reloadData();
|
self.reloadData();
|
||||||
|
|
||||||
(done || Utils.emptyFunction)();
|
(done || noop)();
|
||||||
|
|
||||||
const isRtl = -1 < Utils.inArray(language, ['ar', 'ar_sa', 'he', 'he_he', 'ur', 'ur_ir']);
|
const isRtl = -1 < inArray(language, ['ar', 'ar_sa', 'he', 'he_he', 'ur', 'ur_ir']);
|
||||||
|
|
||||||
Globals.$html
|
$html
|
||||||
.removeClass('rl-changing-language')
|
.removeClass('rl-changing-language')
|
||||||
.removeClass('rl-rtl rl-ltr')
|
.removeClass('rl-rtl rl-ltr')
|
||||||
.addClass(isRtl ? 'rl-rtl' : 'rl-ltr')
|
.addClass(isRtl ? 'rl-rtl' : 'rl-ltr')
|
||||||
// .attr('dir', isRtl ? 'rtl' : 'ltr')
|
// .attr('dir', isRtl ? 'rtl' : 'ltr')
|
||||||
;
|
;
|
||||||
|
|
||||||
}, 500 < Utils.microtime() - start ? 1 : 500);
|
}, 500 < microtime() - start ? 1 : 500);
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
Globals.$html.addClass('rl-' + (Globals.$html.attr('dir') || 'ltr'));
|
$html.addClass('rl-' + ($html.attr('dir') || 'ltr'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
1641
dev/Common/Utils.js
1641
dev/Common/Utils.js
File diff suppressed because it is too large
Load diff
1623
dev/Common/Utils.jsx
Normal file
1623
dev/Common/Utils.jsx
Normal file
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import Utils from 'Common/Utils';
|
import {isUnd} from 'Common/Utils';
|
||||||
import {AbstractComponent} from 'Component/Abstract';
|
import {AbstractComponent} from 'Component/Abstract';
|
||||||
|
|
||||||
class AbstracCheckbox extends AbstractComponent
|
class AbstracCheckbox extends AbstractComponent
|
||||||
|
|
@ -13,30 +13,30 @@ class AbstracCheckbox extends AbstractComponent
|
||||||
super();
|
super();
|
||||||
|
|
||||||
this.value = params.value;
|
this.value = params.value;
|
||||||
if (Utils.isUnd(this.value) || !this.value.subscribe)
|
if (isUnd(this.value) || !this.value.subscribe)
|
||||||
{
|
{
|
||||||
this.value = ko.observable(Utils.isUnd(this.value) ? false : !!this.value);
|
this.value = ko.observable(isUnd(this.value) ? false : !!this.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.enable = params.enable;
|
this.enable = params.enable;
|
||||||
if (Utils.isUnd(this.enable) || !this.enable.subscribe)
|
if (isUnd(this.enable) || !this.enable.subscribe)
|
||||||
{
|
{
|
||||||
this.enable = ko.observable(Utils.isUnd(this.enable) ? true : !!this.enable);
|
this.enable = ko.observable(isUnd(this.enable) ? true : !!this.enable);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.disable = params.disable;
|
this.disable = params.disable;
|
||||||
if (Utils.isUnd(this.disable) || !this.disable.subscribe)
|
if (isUnd(this.disable) || !this.disable.subscribe)
|
||||||
{
|
{
|
||||||
this.disable = ko.observable(Utils.isUnd(this.disable) ? false : !!this.disable);
|
this.disable = ko.observable(isUnd(this.disable) ? false : !!this.disable);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.label = params.label || '';
|
this.label = params.label || '';
|
||||||
this.inline = Utils.isUnd(params.inline) ? false : params.inline;
|
this.inline = isUnd(params.inline) ? false : params.inline;
|
||||||
|
|
||||||
this.readOnly = Utils.isUnd(params.readOnly) ? false : !!params.readOnly;
|
this.readOnly = isUnd(params.readOnly) ? false : !!params.readOnly;
|
||||||
this.inverted = Utils.isUnd(params.inverted) ? false : !!params.inverted;
|
this.inverted = isUnd(params.inverted) ? false : !!params.inverted;
|
||||||
|
|
||||||
this.labeled = !Utils.isUnd(params.label);
|
this.labeled = !isUnd(params.label);
|
||||||
this.labelAnimated = !!params.labelAnimated;
|
this.labelAnimated = !!params.labelAnimated;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import {_} from 'common';
|
import {_} from 'common';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import Utils from 'Common/Utils';
|
import {isUnd} from 'Common/Utils';
|
||||||
import {AbstractComponent} from 'Component/Abstract';
|
import {AbstractComponent} from 'Component/Abstract';
|
||||||
|
|
||||||
class AbstracRadio extends AbstractComponent
|
class AbstracRadio extends AbstractComponent
|
||||||
|
|
@ -16,13 +16,13 @@ class AbstracRadio extends AbstractComponent
|
||||||
this.values = ko.observableArray([]);
|
this.values = ko.observableArray([]);
|
||||||
|
|
||||||
this.value = params.value;
|
this.value = params.value;
|
||||||
if (Utils.isUnd(this.value) || !this.value.subscribe)
|
if (isUnd(this.value) || !this.value.subscribe)
|
||||||
{
|
{
|
||||||
this.value = ko.observable('');
|
this.value = ko.observable('');
|
||||||
}
|
}
|
||||||
|
|
||||||
this.inline = Utils.isUnd(params.inline) ? false : params.inline;
|
this.inline = isUnd(params.inline) ? false : params.inline;
|
||||||
this.readOnly = Utils.isUnd(params.readOnly) ? false : !!params.readOnly;
|
this.readOnly = isUnd(params.readOnly) ? false : !!params.readOnly;
|
||||||
|
|
||||||
if (params.values)
|
if (params.values)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
|
|
||||||
import {$} from 'common';
|
import {$} from 'common';
|
||||||
|
import {isUnd} from 'Common/Utils';
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import Utils from 'Common/Utils';
|
|
||||||
|
|
||||||
class AbstractComponent
|
class AbstractComponent
|
||||||
{
|
{
|
||||||
|
|
@ -40,7 +40,7 @@ const componentExportHelper = (ClassObject, templateID = '') => {
|
||||||
|
|
||||||
require('Common/Translator').i18nToNodes(params.element);
|
require('Common/Translator').i18nToNodes(params.element);
|
||||||
|
|
||||||
if (!Utils.isUnd(params.inline) && ko.unwrap(params.inline))
|
if (!isUnd(params.inline) && ko.unwrap(params.inline))
|
||||||
{
|
{
|
||||||
params.element.css('display', 'inline-block');
|
params.element.css('display', 'inline-block');
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import Utils from 'Common/Utils';
|
import {isUnd, trim, pInt} from 'Common/Utils';
|
||||||
import {SaveSettingsStep} from 'Common/Enums';
|
import {SaveSettingsStep} from 'Common/Enums';
|
||||||
import {AbstractComponent} from 'Component/Abstract';
|
import {AbstractComponent} from 'Component/Abstract';
|
||||||
|
|
||||||
|
|
@ -17,13 +17,13 @@ class AbstractInput extends AbstractComponent
|
||||||
this.size = params.size || 0;
|
this.size = params.size || 0;
|
||||||
this.label = params.label || '';
|
this.label = params.label || '';
|
||||||
this.preLabel = params.preLabel || '';
|
this.preLabel = params.preLabel || '';
|
||||||
this.enable = Utils.isUnd(params.enable) ? true : params.enable;
|
this.enable = isUnd(params.enable) ? true : params.enable;
|
||||||
this.trigger = params.trigger && params.trigger.subscribe ? params.trigger : null;
|
this.trigger = params.trigger && params.trigger.subscribe ? params.trigger : null;
|
||||||
this.placeholder = params.placeholder || '';
|
this.placeholder = params.placeholder || '';
|
||||||
|
|
||||||
this.labeled = !Utils.isUnd(params.label);
|
this.labeled = !isUnd(params.label);
|
||||||
this.preLabeled = !Utils.isUnd(params.preLabel);
|
this.preLabeled = !isUnd(params.preLabel);
|
||||||
this.triggered = !Utils.isUnd(params.trigger) && !!this.trigger;
|
this.triggered = !isUnd(params.trigger) && !!this.trigger;
|
||||||
|
|
||||||
this.classForTrigger = ko.observable('');
|
this.classForTrigger = ko.observable('');
|
||||||
|
|
||||||
|
|
@ -32,14 +32,14 @@ class AbstractInput extends AbstractComponent
|
||||||
var
|
var
|
||||||
size = ko.unwrap(this.size),
|
size = ko.unwrap(this.size),
|
||||||
suffixValue = this.trigger ?
|
suffixValue = this.trigger ?
|
||||||
' ' + Utils.trim('settings-saved-trigger-input ' + this.classForTrigger()) : ''
|
' ' + trim('settings-saved-trigger-input ' + this.classForTrigger()) : ''
|
||||||
;
|
;
|
||||||
|
|
||||||
return (size > 0 ? 'span' + size : '') + suffixValue;
|
return (size > 0 ? 'span' + size : '') + suffixValue;
|
||||||
|
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
if (!Utils.isUnd(params.width) && params.element)
|
if (!isUnd(params.width) && params.element)
|
||||||
{
|
{
|
||||||
params.element.find('input,select,textarea').css('width', params.width);
|
params.element.find('input,select,textarea').css('width', params.width);
|
||||||
}
|
}
|
||||||
|
|
@ -57,7 +57,7 @@ class AbstractInput extends AbstractComponent
|
||||||
}
|
}
|
||||||
|
|
||||||
setTriggerState(value) {
|
setTriggerState(value) {
|
||||||
switch (Utils.pInt(value))
|
switch (pInt(value))
|
||||||
{
|
{
|
||||||
case SaveSettingsStep.TrueResult:
|
case SaveSettingsStep.TrueResult:
|
||||||
this.classForTrigger('success');
|
this.classForTrigger('success');
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
import Utils from 'Common/Utils';
|
import {pInt} from 'Common/Utils';
|
||||||
import {SaveSettingsStep} from 'Common/Enums';
|
import {SaveSettingsStep} from 'Common/Enums';
|
||||||
import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
|
import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
|
||||||
|
|
||||||
|
|
@ -41,7 +41,7 @@ class SaveTriggerComponent extends AbstractComponent
|
||||||
|
|
||||||
setState(value) {
|
setState(value) {
|
||||||
|
|
||||||
switch (Utils.pInt(value))
|
switch (pInt(value))
|
||||||
{
|
{
|
||||||
case SaveSettingsStep.TrueResult:
|
case SaveSettingsStep.TrueResult:
|
||||||
this.element
|
this.element
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import Utils from 'Common/Utils';
|
|
||||||
import Translator from 'Common/Translator';
|
import Translator from 'Common/Translator';
|
||||||
|
import {defautOptionsAfterRender} from 'Common/Utils';
|
||||||
import {componentExportHelper} from 'Component/Abstract';
|
import {componentExportHelper} from 'Component/Abstract';
|
||||||
import {AbstractInput} from 'Component/AbstractInput';
|
import {AbstractInput} from 'Component/AbstractInput';
|
||||||
|
|
||||||
|
|
@ -24,7 +24,7 @@ class SelectComponent extends AbstractInput
|
||||||
this.optionsCaption = Translator.i18n(this.optionsCaption);
|
this.optionsCaption = Translator.i18n(this.optionsCaption);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
this.defautOptionsAfterRender = defautOptionsAfterRender;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
import Utils from 'Common/Utils';
|
import {isUnd} from 'Common/Utils';
|
||||||
import {componentExportHelper} from 'Component/Abstract';
|
import {componentExportHelper} from 'Component/Abstract';
|
||||||
import {AbstractInput} from 'Component/AbstractInput';
|
import {AbstractInput} from 'Component/AbstractInput';
|
||||||
|
|
||||||
|
|
@ -13,7 +13,7 @@ class TextAreaComponent extends AbstractInput
|
||||||
super(params);
|
super(params);
|
||||||
|
|
||||||
this.rows = params.rows || 5;
|
this.rows = params.rows || 5;
|
||||||
this.spellcheck = Utils.isUnd(params.spellcheck) ? false : !!params.spellcheck;
|
this.spellcheck = isUnd(params.spellcheck) ? false : !!params.spellcheck;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
4
dev/External/ko.js
vendored
4
dev/External/ko.js
vendored
|
|
@ -284,9 +284,9 @@
|
||||||
ko.bindingHandlers.registrateBootstrapDropdown = {
|
ko.bindingHandlers.registrateBootstrapDropdown = {
|
||||||
'init': function (oElement) {
|
'init': function (oElement) {
|
||||||
var Globals = require('Common/Globals');
|
var Globals = require('Common/Globals');
|
||||||
if (Globals && Globals.aBootstrapDropdowns)
|
if (Globals && Globals.data.aBootstrapDropdowns)
|
||||||
{
|
{
|
||||||
Globals.aBootstrapDropdowns.push($(oElement));
|
Globals.data.aBootstrapDropdowns.push($(oElement));
|
||||||
|
|
||||||
$(oElement).click(function () {
|
$(oElement).click(function () {
|
||||||
require('Common/Utils').detectDropdownVisibility();
|
require('Common/Utils').detectDropdownVisibility();
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
|
|
||||||
import Utils from 'Common/Utils';
|
import {isNonEmptyArray, isUnd} from 'Common/Utils';
|
||||||
import EmailModel from 'Model/Email';
|
import EmailModel from 'Model/Email';
|
||||||
|
|
||||||
class MessageHelper
|
class MessageHelper
|
||||||
|
|
@ -20,7 +20,7 @@ class MessageHelper
|
||||||
len = 0
|
len = 0
|
||||||
;
|
;
|
||||||
|
|
||||||
if (Utils.isNonEmptyArray(emails))
|
if (isNonEmptyArray(emails))
|
||||||
{
|
{
|
||||||
for (index = 0, len = emails.length; index < len; index++)
|
for (index = 0, len = emails.length; index < len; index++)
|
||||||
{
|
{
|
||||||
|
|
@ -43,7 +43,7 @@ class MessageHelper
|
||||||
len = 0
|
len = 0
|
||||||
;
|
;
|
||||||
|
|
||||||
if (Utils.isNonEmptyArray(emails))
|
if (isNonEmptyArray(emails))
|
||||||
{
|
{
|
||||||
for (index = 0, len = emails.length; index < len; index++)
|
for (index = 0, len = emails.length; index < len; index++)
|
||||||
{
|
{
|
||||||
|
|
@ -70,7 +70,7 @@ class MessageHelper
|
||||||
result = []
|
result = []
|
||||||
;
|
;
|
||||||
|
|
||||||
if (Utils.isNonEmptyArray(json))
|
if (isNonEmptyArray(json))
|
||||||
{
|
{
|
||||||
for (index = 0, len = json.length; index < len; index++)
|
for (index = 0, len = json.length; index < len; index++)
|
||||||
{
|
{
|
||||||
|
|
@ -99,7 +99,7 @@ class MessageHelper
|
||||||
|
|
||||||
for (; index < len; index++)
|
for (; index < len; index++)
|
||||||
{
|
{
|
||||||
if (Utils.isUnd(unic[inputEmails[index].email]))
|
if (isUnd(unic[inputEmails[index].email]))
|
||||||
{
|
{
|
||||||
unic[inputEmails[index].email] = true;
|
unic[inputEmails[index].email] = true;
|
||||||
localEmails.push(inputEmails[index]);
|
localEmails.push(inputEmails[index]);
|
||||||
|
|
|
||||||
|
|
@ -180,7 +180,7 @@
|
||||||
*/
|
*/
|
||||||
AttachmentModel.prototype.isFramed = function ()
|
AttachmentModel.prototype.isFramed = function ()
|
||||||
{
|
{
|
||||||
return this.framed && (Globals.__APP__ && Globals.__APP__.googlePreviewSupported()) &&
|
return this.framed && (Globals.data.__APP__ && Globals.data.__APP__.googlePreviewSupported()) &&
|
||||||
!(this.isPdf() && Globals.bAllowPdfPreview) && !this.isText() && !this.isImage();
|
!(this.isPdf() && Globals.bAllowPdfPreview) && !this.isText() && !this.isImage();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -160,32 +160,32 @@
|
||||||
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
||||||
]))
|
]))
|
||||||
{
|
{
|
||||||
Globals.iAjaxErrorCount++;
|
Globals.data.iAjaxErrorCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Enums.Notification.InvalidToken === oErrorData.ErrorCode)
|
if (Enums.Notification.InvalidToken === oErrorData.ErrorCode)
|
||||||
{
|
{
|
||||||
Globals.iTokenErrorCount++;
|
Globals.data.iTokenErrorCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Consts.TOKEN_ERROR_LIMIT < Globals.iTokenErrorCount)
|
if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount)
|
||||||
{
|
{
|
||||||
if (Globals.__APP__ && Globals.__APP__.loginAndLogoutReload)
|
if (Globals.data.__APP__ && Globals.data.__APP__.loginAndLogoutReload)
|
||||||
{
|
{
|
||||||
Globals.__APP__.loginAndLogoutReload(false, true);
|
Globals.data.__APP__.loginAndLogoutReload(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oErrorData.ClearAuth || oErrorData.Logout || Consts.AJAX_ERROR_LIMIT < Globals.iAjaxErrorCount)
|
if (oErrorData.ClearAuth || oErrorData.Logout || Consts.AJAX_ERROR_LIMIT < Globals.data.iAjaxErrorCount)
|
||||||
{
|
{
|
||||||
if (Globals.__APP__ && Globals.__APP__.clearClientSideToken)
|
if (Globals.data.__APP__ && Globals.data.__APP__.clearClientSideToken)
|
||||||
{
|
{
|
||||||
Globals.__APP__.clearClientSideToken();
|
Globals.data.__APP__.clearClientSideToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Globals.__APP__ && !oErrorData.ClearAuth && Globals.__APP__.loginAndLogoutReload)
|
if (Globals.data.__APP__ && !oErrorData.ClearAuth && Globals.data.__APP__.loginAndLogoutReload)
|
||||||
{
|
{
|
||||||
Globals.__APP__.loginAndLogoutReload(false, true);
|
Globals.data.__APP__.loginAndLogoutReload(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@
|
||||||
{
|
{
|
||||||
var
|
var
|
||||||
fCall = function () {
|
fCall = function () {
|
||||||
if (Enums.StorageResultType.Success !== sType && Globals.bUnload)
|
if (Enums.StorageResultType.Success !== sType && Globals.data.bUnload)
|
||||||
{
|
{
|
||||||
sType = Enums.StorageResultType.Unload;
|
sType = Enums.StorageResultType.Unload;
|
||||||
}
|
}
|
||||||
|
|
@ -53,39 +53,39 @@
|
||||||
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
Enums.Notification.MailServerError, Enums.Notification.UnknownNotification, Enums.Notification.UnknownError
|
||||||
]))
|
]))
|
||||||
{
|
{
|
||||||
Globals.iAjaxErrorCount++;
|
Globals.data.iAjaxErrorCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
|
if (oData && Enums.Notification.InvalidToken === oData.ErrorCode)
|
||||||
{
|
{
|
||||||
Globals.iTokenErrorCount++;
|
Globals.data.iTokenErrorCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Consts.TOKEN_ERROR_LIMIT < Globals.iTokenErrorCount)
|
if (Consts.TOKEN_ERROR_LIMIT < Globals.data.iTokenErrorCount)
|
||||||
{
|
{
|
||||||
if (Globals.__APP__ && Globals.__APP__.loginAndLogoutReload)
|
if (Globals.data.__APP__ && Globals.data.__APP__.loginAndLogoutReload)
|
||||||
{
|
{
|
||||||
Globals.__APP__.loginAndLogoutReload(false, true);
|
Globals.data.__APP__.loginAndLogoutReload(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (oData.ClearAuth || oData.Logout || Consts.AJAX_ERROR_LIMIT < Globals.iAjaxErrorCount)
|
if (oData.ClearAuth || oData.Logout || Consts.AJAX_ERROR_LIMIT < Globals.data.iAjaxErrorCount)
|
||||||
{
|
{
|
||||||
if (Globals.__APP__ && Globals.__APP__.clearClientSideToken)
|
if (Globals.data.__APP__ && Globals.data.__APP__.clearClientSideToken)
|
||||||
{
|
{
|
||||||
Globals.__APP__.clearClientSideToken();
|
Globals.data.__APP__.clearClientSideToken();
|
||||||
|
|
||||||
if (!oData.ClearAuth && Globals.__APP__.loginAndLogoutReload)
|
if (!oData.ClearAuth && Globals.data.__APP__.loginAndLogoutReload)
|
||||||
{
|
{
|
||||||
Globals.__APP__.loginAndLogoutReload(false, true);
|
Globals.data.__APP__.loginAndLogoutReload(false, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
|
else if (Enums.StorageResultType.Success === sType && oData && oData.Result)
|
||||||
{
|
{
|
||||||
Globals.iAjaxErrorCount = 0;
|
Globals.data.iAjaxErrorCount = 0;
|
||||||
Globals.iTokenErrorCount = 0;
|
Globals.data.iTokenErrorCount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fCallback)
|
if (fCallback)
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
/* global RL_COMMUNITY */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
/* global RL_COMMUNITY */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
/* global RL_COMMUNITY */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
/* global RL_COMMUNITY */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import {window} from 'common';
|
import {window} from 'common';
|
||||||
import Utils from 'Common/Utils';
|
import {isUnd, isNormal, isArray, inArray} from 'Common/Utils';
|
||||||
|
|
||||||
class SettingsStorage
|
class SettingsStorage
|
||||||
{
|
{
|
||||||
|
|
@ -9,10 +9,10 @@ class SettingsStorage
|
||||||
|
|
||||||
constructor() {
|
constructor() {
|
||||||
this.settings = window.__rlah_data() || {};
|
this.settings = window.__rlah_data() || {};
|
||||||
this.settings = Utils.isNormal(this.settings) ? this.settings : {};
|
this.settings = isNormal(this.settings) ? this.settings : {};
|
||||||
|
|
||||||
this.appSettings = this.settings.System || null;
|
this.appSettings = this.settings.System || null;
|
||||||
this.appSettings = Utils.isNormal(this.appSettings) ? this.appSettings : {};
|
this.appSettings = isNormal(this.appSettings) ? this.appSettings : {};
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -20,7 +20,7 @@ class SettingsStorage
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
settingsGet(name) {
|
settingsGet(name) {
|
||||||
return Utils.isUnd(this.settings[name]) ? null : this.settings[name];
|
return isUnd(this.settings[name]) ? null : this.settings[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -36,7 +36,7 @@ class SettingsStorage
|
||||||
* @return {*}
|
* @return {*}
|
||||||
*/
|
*/
|
||||||
appSettingsGet(name) {
|
appSettingsGet(name) {
|
||||||
return Utils.isUnd(this.appSettings[name]) ? null : this.appSettings[name];
|
return isUnd(this.appSettings[name]) ? null : this.appSettings[name];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -45,7 +45,7 @@ class SettingsStorage
|
||||||
*/
|
*/
|
||||||
capa(name) {
|
capa(name) {
|
||||||
const values = this.settingsGet('Capa');
|
const values = this.settingsGet('Capa');
|
||||||
return Utils.isArray(values) && Utils.isNormal(name) && -1 < Utils.inArray(name, values);
|
return isArray(values) && isNormal(name) && -1 < inArray(name, values);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import Globals from 'Common/Globals';
|
import {$html, bMobileDevice} from 'Common/Globals';
|
||||||
import Settings from 'Storage/Settings';
|
import Settings from 'Storage/Settings';
|
||||||
|
|
||||||
class AbstractAppStore
|
class AbstractAppStore
|
||||||
|
|
@ -13,8 +13,8 @@ class AbstractAppStore
|
||||||
this.interfaceAnimation = ko.observable(true);
|
this.interfaceAnimation = ko.observable(true);
|
||||||
|
|
||||||
this.interfaceAnimation.subscribe(function (bValue) {
|
this.interfaceAnimation.subscribe(function (bValue) {
|
||||||
const bAnim = Globals.bMobileDevice || !bValue;
|
const bAnim = bMobileDevice || !bValue;
|
||||||
Globals.$html.toggleClass('rl-anim', !bAnim).toggleClass('no-rl-anim', bAnim);
|
$html.toggleClass('rl-anim', !bAnim).toggleClass('no-rl-anim', bAnim);
|
||||||
});
|
});
|
||||||
|
|
||||||
this.interfaceAnimation.valueHasMutated();
|
this.interfaceAnimation.valueHasMutated();
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
|
|
||||||
import ko from 'ko';
|
import ko from 'ko';
|
||||||
import {Focused, KeyState} from 'Common/Enums';
|
import {Focused, KeyState} from 'Common/Enums';
|
||||||
import Globals from 'Common/Globals';
|
import {keyScope} from 'Common/Globals';
|
||||||
import Utils from 'Common/Utils';
|
|
||||||
import Settings from 'Storage/Settings';
|
import Settings from 'Storage/Settings';
|
||||||
|
import {isNonEmptyArray} from 'Common/Utils';
|
||||||
|
|
||||||
import {AbstractAppStore} from 'Stores/AbstractApp';
|
import {AbstractAppStore} from 'Stores/AbstractApp';
|
||||||
|
|
||||||
|
|
@ -24,13 +24,13 @@ class AppUserStore extends AbstractAppStore
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
case Focused.MessageList:
|
case Focused.MessageList:
|
||||||
Globals.keyScope(KeyState.MessageList);
|
keyScope(KeyState.MessageList);
|
||||||
break;
|
break;
|
||||||
case Focused.MessageView:
|
case Focused.MessageView:
|
||||||
Globals.keyScope(KeyState.MessageView);
|
keyScope(KeyState.MessageView);
|
||||||
break;
|
break;
|
||||||
case Focused.FolderList:
|
case Focused.FolderList:
|
||||||
Globals.keyScope(KeyState.FolderList);
|
keyScope(KeyState.FolderList);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -64,7 +64,7 @@ class AppUserStore extends AbstractAppStore
|
||||||
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
|
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
|
||||||
|
|
||||||
const attachmentsActions = Settings.appSettingsGet('attachmentsActions');
|
const attachmentsActions = Settings.appSettingsGet('attachmentsActions');
|
||||||
this.attachmentsActions(Utils.isNonEmptyArray(attachmentsActions) ? attachmentsActions : []);
|
this.attachmentsActions(isNonEmptyArray(attachmentsActions) ? attachmentsActions : []);
|
||||||
|
|
||||||
this.devEmail = Settings.settingsGet('DevEmail');
|
this.devEmail = Settings.settingsGet('DevEmail');
|
||||||
this.devPassword = Settings.settingsGet('DevPassword');
|
this.devPassword = Settings.settingsGet('DevPassword');
|
||||||
|
|
|
||||||
|
|
@ -227,7 +227,7 @@
|
||||||
var
|
var
|
||||||
iCount = 0,
|
iCount = 0,
|
||||||
oMessagesDom = null,
|
oMessagesDom = null,
|
||||||
iEnd = Globals.iMessageBodyCacheCount - Consts.MESSAGE_BODY_CACHE_LIMIT
|
iEnd = Globals.data.iMessageBodyCacheCount - Consts.MESSAGE_BODY_CACHE_LIMIT
|
||||||
;
|
;
|
||||||
|
|
||||||
if (0 < iEnd)
|
if (0 < iEnd)
|
||||||
|
|
@ -642,7 +642,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
oBody = $('<div id="' + sId + '" ></div>').hide().addClass('rl-cache-class');
|
oBody = $('<div id="' + sId + '" ></div>').hide().addClass('rl-cache-class');
|
||||||
oBody.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
oBody.data('rl-cache-count', ++Globals.data.iMessageBodyCacheCount);
|
||||||
|
|
||||||
oBody
|
oBody
|
||||||
.html(Utils.findEmailAndLinks(sResultHtml))
|
.html(Utils.findEmailAndLinks(sResultHtml))
|
||||||
|
|
@ -677,7 +677,7 @@
|
||||||
oMessage.body = oTextBody;
|
oMessage.body = oTextBody;
|
||||||
if (oMessage.body)
|
if (oMessage.body)
|
||||||
{
|
{
|
||||||
oMessage.body.data('rl-cache-count', ++Globals.iMessageBodyCacheCount);
|
oMessage.body.data('rl-cache-count', ++Globals.data.iMessageBodyCacheCount);
|
||||||
oMessage.fetchDataFromDom();
|
oMessage.fetchDataFromDom();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,6 @@
|
||||||
|
|
||||||
|
/* global RL_COMMUNITY */
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
|
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
|
||||||
|
|
@ -1,79 +1,81 @@
|
||||||
|
|
||||||
|
import window from 'window';
|
||||||
|
import _ from '_';
|
||||||
|
import $ from '$';
|
||||||
|
import {kill_CtrlA_CtrlS, detectDropdownVisibility, createCommand} from 'Common/Utils';
|
||||||
|
import {$win, $html, data as GlobalsData, bMobileDevice} from 'Common/Globals';
|
||||||
|
import Plugins from 'Common/Plugins';
|
||||||
|
import Translator from 'Common/Translator';
|
||||||
|
import EmailModel from 'Model/Email';
|
||||||
|
import * as Enums from 'Common/Enums';
|
||||||
|
|
||||||
export default (App) => {
|
export default (App) => {
|
||||||
|
|
||||||
const
|
GlobalsData.__APP__ = App;
|
||||||
window = require('window'),
|
|
||||||
_ = require('_'),
|
|
||||||
$ = require('$'),
|
|
||||||
|
|
||||||
Globals = require('Common/Globals'),
|
$win
|
||||||
Plugins = require('Common/Plugins'),
|
.on('keydown', kill_CtrlA_CtrlS)
|
||||||
Utils = require('Common/Utils'),
|
.on('unload', () => {
|
||||||
Enums = require('Common/Enums'),
|
GlobalsData.bUnload = true;
|
||||||
Translator = require('Common/Translator'),
|
|
||||||
|
|
||||||
EmailModel = require('Model/Email')
|
|
||||||
;
|
|
||||||
|
|
||||||
Globals.__APP__ = App;
|
|
||||||
|
|
||||||
Globals.$win.on('keydown', Utils.kill_CtrlA_CtrlS);
|
|
||||||
|
|
||||||
Globals.$win.on('unload', function () {
|
|
||||||
Globals.bUnload = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
Globals.$html
|
|
||||||
.addClass(Globals.bMobileDevice ? 'mobile' : 'no-mobile')
|
|
||||||
.on('click.dropdown.data-api', function () {
|
|
||||||
Utils.detectDropdownVisibility();
|
|
||||||
})
|
})
|
||||||
;
|
;
|
||||||
|
|
||||||
// export
|
$html
|
||||||
/* eslint dot-notation: 0 */
|
.addClass(bMobileDevice ? 'mobile' : 'no-mobile')
|
||||||
window['rl'] = window['rl'] || {};
|
.on('click.dropdown.data-api', () => {
|
||||||
window['rl']['i18n'] = _.bind(Translator.i18n, Translator);
|
detectDropdownVisibility();
|
||||||
|
})
|
||||||
|
;
|
||||||
|
|
||||||
window['rl']['addHook'] = _.bind(Plugins.addHook, Plugins);
|
const rl = window.rl || {};
|
||||||
window['rl']['settingsGet'] = _.bind(Plugins.mainSettingsGet, Plugins);
|
|
||||||
window['rl']['createCommand'] = Utils.createCommand;
|
|
||||||
|
|
||||||
window['rl']['addSettingsViewModel'] = _.bind(Plugins.addSettingsViewModel, Plugins);
|
rl.i18n = _.bind(Translator.i18n, Translator);
|
||||||
window['rl']['addSettingsViewModelForAdmin'] = _.bind(Plugins.addSettingsViewModelForAdmin, Plugins);
|
|
||||||
|
|
||||||
window['rl']['pluginRemoteRequest'] = _.bind(Plugins.remoteRequest, Plugins);
|
rl.addHook = _.bind(Plugins.addHook, Plugins);
|
||||||
window['rl']['pluginSettingsGet'] = _.bind(Plugins.settingsGet, Plugins);
|
rl.settingsGet = _.bind(Plugins.mainSettingsGet, Plugins);
|
||||||
|
rl.createCommand = createCommand;
|
||||||
|
|
||||||
window['rl']['EmailModel'] = EmailModel;
|
rl.addSettingsViewModel = _.bind(Plugins.addSettingsViewModel, Plugins);
|
||||||
window['rl']['Enums'] = Enums;
|
rl.addSettingsViewModelForAdmin = _.bind(Plugins.addSettingsViewModelForAdmin, Plugins);
|
||||||
|
|
||||||
window.__APP_BOOT = function (fCall) {
|
rl.pluginRemoteRequest = _.bind(Plugins.remoteRequest, Plugins);
|
||||||
|
rl.pluginSettingsGet = _.bind(Plugins.settingsGet, Plugins);
|
||||||
|
|
||||||
$(_.delay(function () {
|
rl.EmailModel = EmailModel;
|
||||||
|
rl.Enums = Enums;
|
||||||
|
|
||||||
if (window['rainloopTEMPLATES'] && window['rainloopTEMPLATES'][0])
|
window.rl = rl;
|
||||||
{
|
|
||||||
$('#rl-templates').html(window['rainloopTEMPLATES'][0]);
|
|
||||||
|
|
||||||
_.delay(function () {
|
window.__APP_BOOT = (fErrorCallback) => {
|
||||||
|
|
||||||
App.bootstart();
|
$(() => {
|
||||||
|
|
||||||
Globals.$html
|
_.delay(() => {
|
||||||
.removeClass('no-js rl-booted-trigger')
|
|
||||||
.addClass('rl-booted')
|
|
||||||
;
|
|
||||||
|
|
||||||
}, 10);
|
if (window.rainloopTEMPLATES && window.rainloopTEMPLATES[0])
|
||||||
}
|
{
|
||||||
else
|
$('#rl-templates').html(window.rainloopTEMPLATES[0]);
|
||||||
{
|
|
||||||
fCall(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
window.__APP_BOOT = null;
|
_.delay(() => {
|
||||||
|
|
||||||
}, 10));
|
App.bootstart();
|
||||||
|
|
||||||
|
$html
|
||||||
|
.removeClass('no-js rl-booted-trigger')
|
||||||
|
.addClass('rl-booted')
|
||||||
|
;
|
||||||
|
|
||||||
|
}, 10);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
fErrorCallback();
|
||||||
|
}
|
||||||
|
|
||||||
|
window.__APP_BOOT = null;
|
||||||
|
|
||||||
|
}, 10);
|
||||||
|
|
||||||
|
});
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -705,6 +705,7 @@ gulp.task('build', ['rainloop']);
|
||||||
gulp.task('build+', ['rainloop+']);
|
gulp.task('build+', ['rainloop+']);
|
||||||
|
|
||||||
gulp.task('js:v', ['js:validate']);
|
gulp.task('js:v', ['js:validate']);
|
||||||
|
gulp.task('v', ['js:v']);
|
||||||
|
|
||||||
gulp.task('w', ['watch']);
|
gulp.task('w', ['watch']);
|
||||||
gulp.task('w+', ['watch+']);
|
gulp.task('w+', ['watch+']);
|
||||||
|
|
|
||||||
|
|
@ -1481,6 +1481,7 @@ class Actions
|
||||||
'rsaPublicKey' => $sRsaPublicKey,
|
'rsaPublicKey' => $sRsaPublicKey,
|
||||||
'openpgpPublicKeyServer' => $oConfig->Get('security', 'openpgp_public_key_server', '')
|
'openpgpPublicKeyServer' => $oConfig->Get('security', 'openpgp_public_key_server', '')
|
||||||
), $bAdmin ? array(
|
), $bAdmin ? array(
|
||||||
|
'adminHostUse' => '' !== $oConfig->Get('security', 'admin_panel_host', ''),
|
||||||
'adminPath' => \strtolower($oConfig->Get('security', 'admin_panel_key', 'admin')),
|
'adminPath' => \strtolower($oConfig->Get('security', 'admin_panel_key', 'admin')),
|
||||||
'allowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true),
|
'allowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true),
|
||||||
) : array());
|
) : array());
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
<div class="message-fixed-button-toolbar clearfix" data-bind="visible: message">
|
<div class="message-fixed-button-toolbar clearfix" data-bind="visible: message">
|
||||||
<nobr>
|
<nobr>
|
||||||
<div class="btn-group pull-right" style="margin-right: -8px;">
|
<div class="btn-group pull-right" style="margin-right: -11px;">
|
||||||
<div class="btn-group pull-right" data-bind="registrateBootstrapDropdown: true, visible: allowComposer || allowMessageListActions || allowMessageActions">
|
<div class="btn-group pull-right" data-bind="registrateBootstrapDropdown: true, visible: allowComposer || allowMessageListActions || allowMessageActions">
|
||||||
<a class="btn btn-thin-2 btn-transparent last btn-dark-disabled-border dropdown-toggle buttonMore" id="more-view-dropdown-id" href="#" tabindex="-1" data-toggle="dropdown" data-tooltip-join="bottom" style="margin-left: -4px; margin-right: 2px" data-bind="command: messageVisibilityCommand, tooltip: 'MESSAGE/BUTTON_MORE', css: {'first': !allowComposer}">
|
<a class="btn btn-thin-2 btn-transparent last btn-dark-disabled-border dropdown-toggle buttonMore" id="more-view-dropdown-id" href="#" tabindex="-1" data-toggle="dropdown" data-tooltip-join="bottom" style="margin-left: -4px; margin-right: 2px" data-bind="command: messageVisibilityCommand, tooltip: 'MESSAGE/BUTTON_MORE', css: {'first': !allowComposer}">
|
||||||
<span data-bind="visible: !allowComposer" class="icon-ellipsis-alt"></span>
|
<span data-bind="visible: !allowComposer" class="icon-ellipsis-alt"></span>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue