mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 20:49:20 +03:00
eslint (additional rules)
This commit is contained in:
parent
77a1d3f3df
commit
8e8a041032
150 changed files with 21911 additions and 23106 deletions
|
|
@ -1,34 +1,27 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function AboutUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Center', 'About');
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView')
|
||||
;
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function AboutUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Center', 'About');
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
kn.extendAsViewModel(['View/User/About', 'View/App/About', 'AboutViewModel'], AboutUserView);
|
||||
_.extend(AboutUserView.prototype, AbstractView.prototype);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/About', 'View/App/About', 'AboutViewModel'], AboutUserView);
|
||||
_.extend(AboutUserView.prototype, AbstractView.prototype);
|
||||
|
||||
module.exports = AboutUserView;
|
||||
|
||||
}());
|
||||
module.exports = AboutUserView;
|
||||
|
|
|
|||
|
|
@ -1,144 +1,137 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
key = require('key'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Events = require('Common/Events'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
key = require('key'),
|
||||
AppStore = require('Stores/User/App'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Events = require('Common/Events'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function AbstractSystemDropDownUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Right', 'SystemDropDown');
|
||||
|
||||
AbstractView = require('Knoin/AbstractView')
|
||||
;
|
||||
this.logoImg = Utils.trim(Settings.settingsGet('UserLogo'));
|
||||
this.logoTitle = Utils.trim(Settings.settingsGet('UserLogoTitle'));
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function AbstractSystemDropDownUserView()
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
||||
|
||||
this.allowSettings = !!Settings.capa(Enums.Capa.Settings);
|
||||
this.allowHelp = !!Settings.capa(Enums.Capa.Help);
|
||||
|
||||
this.currentAudio = AppStore.currentAudio;
|
||||
|
||||
this.accountEmail = AccountStore.email;
|
||||
|
||||
this.accounts = AccountStore.accounts;
|
||||
this.accountsUnreadCount = AccountStore.accountsUnreadCount;
|
||||
|
||||
this.accountMenuDropdownTrigger = ko.observable(false);
|
||||
this.capaAdditionalAccounts = ko.observable(Settings.capa(Enums.Capa.AdditionalAccounts));
|
||||
|
||||
this.accountClick = _.bind(this.accountClick, this);
|
||||
|
||||
this.accountClick = _.bind(this.accountClick, this);
|
||||
|
||||
Events.sub('audio.stop', function() {
|
||||
AppStore.currentAudio('');
|
||||
});
|
||||
|
||||
Events.sub('audio.start', function(sName) {
|
||||
AppStore.currentAudio(sName);
|
||||
});
|
||||
}
|
||||
|
||||
_.extend(AbstractSystemDropDownUserView.prototype, AbstractView.prototype);
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.stopPlay = function()
|
||||
{
|
||||
Events.pub('audio.api.stop');
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.accountClick = function(oAccount, oEvent)
|
||||
{
|
||||
if (oAccount && oEvent && !Utils.isUnd(oEvent.which) && 1 === oEvent.which)
|
||||
{
|
||||
AbstractView.call(this, 'Right', 'SystemDropDown');
|
||||
AccountStore.accounts.loading(true);
|
||||
|
||||
this.logoImg = Utils.trim(Settings.settingsGet('UserLogo'));
|
||||
this.logoTitle = Utils.trim(Settings.settingsGet('UserLogoTitle'));
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
||||
|
||||
this.allowSettings = !!Settings.capa(Enums.Capa.Settings);
|
||||
this.allowHelp = !!Settings.capa(Enums.Capa.Help);
|
||||
|
||||
this.currentAudio = AppStore.currentAudio;
|
||||
|
||||
this.accountEmail = AccountStore.email;
|
||||
|
||||
this.accounts = AccountStore.accounts;
|
||||
this.accountsUnreadCount = AccountStore.accountsUnreadCount;
|
||||
|
||||
this.accountMenuDropdownTrigger = ko.observable(false);
|
||||
this.capaAdditionalAccounts = ko.observable(Settings.capa(Enums.Capa.AdditionalAccounts));
|
||||
|
||||
this.accountClick = _.bind(this.accountClick, this);
|
||||
|
||||
this.accountClick = _.bind(this.accountClick, this);
|
||||
|
||||
Events.sub('audio.stop', function () {
|
||||
AppStore.currentAudio('');
|
||||
});
|
||||
|
||||
Events.sub('audio.start', function (sName) {
|
||||
AppStore.currentAudio(sName);
|
||||
});
|
||||
_.delay(function() {
|
||||
AccountStore.accounts.loading(false);
|
||||
}, 1000);
|
||||
}
|
||||
|
||||
_.extend(AbstractSystemDropDownUserView.prototype, AbstractView.prototype);
|
||||
return true;
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.stopPlay = function ()
|
||||
{
|
||||
Events.pub('audio.api.stop');
|
||||
};
|
||||
AbstractSystemDropDownUserView.prototype.emailTitle = function()
|
||||
{
|
||||
return AccountStore.email();
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.accountClick = function (oAccount, oEvent)
|
||||
AbstractSystemDropDownUserView.prototype.settingsClick = function()
|
||||
{
|
||||
if (Settings.capa(Enums.Capa.Settings))
|
||||
{
|
||||
if (oAccount && oEvent && !Utils.isUnd(oEvent.which) && 1 === oEvent.which)
|
||||
require('Knoin/Knoin').setHash(Links.settings());
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.settingsHelp = function()
|
||||
{
|
||||
if (Settings.capa(Enums.Capa.Help))
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.addAccountClick = function()
|
||||
{
|
||||
if (this.capaAdditionalAccounts())
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'));
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.logoutClick = function()
|
||||
{
|
||||
require('App/User').default.logout();
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.onBuild = function()
|
||||
{
|
||||
var self = this;
|
||||
key('`', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function() {
|
||||
if (self.viewModelVisibility())
|
||||
{
|
||||
AccountStore.accounts.loading(true);
|
||||
MessageStore.messageFullScreenMode(false);
|
||||
|
||||
_.delay(function () {
|
||||
AccountStore.accounts.loading(false);
|
||||
}, 1000);
|
||||
self.accountMenuDropdownTrigger(true);
|
||||
}
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.emailTitle = function ()
|
||||
{
|
||||
return AccountStore.email();
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.settingsClick = function ()
|
||||
{
|
||||
if (Settings.capa(Enums.Capa.Settings))
|
||||
{
|
||||
require('Knoin/Knoin').setHash(Links.settings());
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.settingsHelp = function ()
|
||||
{
|
||||
if (Settings.capa(Enums.Capa.Help))
|
||||
// shortcuts help
|
||||
key('shift+/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function() {
|
||||
if (self.viewModelVisibility())
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.addAccountClick = function ()
|
||||
{
|
||||
if (this.capaAdditionalAccounts())
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'));
|
||||
}
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.logoutClick = function ()
|
||||
{
|
||||
require('App/User').default.logout();
|
||||
};
|
||||
|
||||
AbstractSystemDropDownUserView.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
key('`', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function () {
|
||||
if (self.viewModelVisibility())
|
||||
{
|
||||
MessageStore.messageFullScreenMode(false);
|
||||
|
||||
self.accountMenuDropdownTrigger(true);
|
||||
}
|
||||
});
|
||||
|
||||
// shortcuts help
|
||||
key('shift+/', [Enums.KeyState.MessageList, Enums.KeyState.MessageView, Enums.KeyState.Settings], function () {
|
||||
if (self.viewModelVisibility())
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = AbstractSystemDropDownUserView;
|
||||
|
||||
}());
|
||||
module.exports = AbstractSystemDropDownUserView;
|
||||
|
|
|
|||
|
|
@ -1,520 +1,511 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Plugins = require('Common/Plugins'),
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
LanguageStore = require('Stores/Language'),
|
||||
AppStore = require('Stores/User/App'),
|
||||
|
||||
Plugins = require('Common/Plugins'),
|
||||
Local = require('Storage/Client'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
LanguageStore = require('Stores/Language'),
|
||||
AppStore = require('Stores/User/App'),
|
||||
Remote = require('Remote/User/Ajax'),
|
||||
|
||||
Local = require('Storage/Client'),
|
||||
Settings = require('Storage/Settings'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
|
||||
Remote = require('Remote/User/Ajax'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function LoginUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Center', 'Login');
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView')
|
||||
;
|
||||
this.welcome = ko.observable(!!Settings.settingsGet('UseLoginWelcomePage'));
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function LoginUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Center', 'Login');
|
||||
this.email = ko.observable('');
|
||||
this.password = ko.observable('');
|
||||
this.signMe = ko.observable(false);
|
||||
|
||||
this.welcome = ko.observable(!!Settings.settingsGet('UseLoginWelcomePage'));
|
||||
this.additionalCode = ko.observable('');
|
||||
this.additionalCode.error = ko.observable(false);
|
||||
this.additionalCode.errorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
this.additionalCode.focused = ko.observable(false);
|
||||
this.additionalCode.visibility = ko.observable(false);
|
||||
this.additionalCodeSignMe = ko.observable(false);
|
||||
|
||||
this.email = ko.observable('');
|
||||
this.password = ko.observable('');
|
||||
this.signMe = ko.observable(false);
|
||||
this.logoImg = Utils.trim(Settings.settingsGet('LoginLogo'));
|
||||
this.logoPowered = !!Settings.settingsGet('LoginPowered');
|
||||
this.loginDescription = Utils.trim(Settings.settingsGet('LoginDescription'));
|
||||
|
||||
this.additionalCode = ko.observable('');
|
||||
this.additionalCode.error = ko.observable(false);
|
||||
this.additionalCode.errorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
this.additionalCode.focused = ko.observable(false);
|
||||
this.additionalCode.visibility = ko.observable(false);
|
||||
this.additionalCodeSignMe = ko.observable(false);
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
||||
|
||||
this.logoImg = Utils.trim(Settings.settingsGet('LoginLogo'));
|
||||
this.logoPowered = !!Settings.settingsGet('LoginPowered');
|
||||
this.loginDescription = Utils.trim(Settings.settingsGet('LoginDescription'));
|
||||
this.forgotPasswordLinkUrl = Settings.appSettingsGet('forgotPasswordLinkUrl');
|
||||
this.registrationLinkUrl = Settings.appSettingsGet('registrationLinkUrl');
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
||||
this.emailError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
|
||||
this.forgotPasswordLinkUrl = Settings.appSettingsGet('forgotPasswordLinkUrl');
|
||||
this.registrationLinkUrl = Settings.appSettingsGet('registrationLinkUrl');
|
||||
this.emailErrorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
|
||||
this.emailError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
this.formHidden = ko.observable(false);
|
||||
|
||||
this.emailErrorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
this.formError = ko.computed(function() {
|
||||
return this.emailErrorAnimation() || this.passwordErrorAnimation() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.errorAnimation());
|
||||
}, this);
|
||||
|
||||
this.formHidden = ko.observable(false);
|
||||
this.emailFocus = ko.observable(false);
|
||||
this.passwordFocus = ko.observable(false);
|
||||
this.submitFocus = ko.observable(false);
|
||||
|
||||
this.formError = ko.computed(function () {
|
||||
return this.emailErrorAnimation() || this.passwordErrorAnimation() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.errorAnimation());
|
||||
}, this);
|
||||
this.email.subscribe(function() {
|
||||
this.emailError(false);
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(false);
|
||||
}, this);
|
||||
|
||||
this.emailFocus = ko.observable(false);
|
||||
this.passwordFocus = ko.observable(false);
|
||||
this.submitFocus = ko.observable(false);
|
||||
this.password.subscribe(function() {
|
||||
this.passwordError(false);
|
||||
}, this);
|
||||
|
||||
this.email.subscribe(function () {
|
||||
this.emailError(false);
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(false);
|
||||
}, this);
|
||||
this.additionalCode.subscribe(function() {
|
||||
this.additionalCode.error(false);
|
||||
}, this);
|
||||
|
||||
this.password.subscribe(function () {
|
||||
this.passwordError(false);
|
||||
}, this);
|
||||
this.additionalCode.visibility.subscribe(function() {
|
||||
this.additionalCode.error(false);
|
||||
}, this);
|
||||
|
||||
this.additionalCode.subscribe(function () {
|
||||
this.emailError.subscribe(function(bV) {
|
||||
this.emailErrorAnimation(!!bV);
|
||||
}, this);
|
||||
|
||||
this.passwordError.subscribe(function(bV) {
|
||||
this.passwordErrorAnimation(!!bV);
|
||||
}, this);
|
||||
|
||||
this.additionalCode.error.subscribe(function(bV) {
|
||||
this.additionalCode.errorAnimation(!!bV);
|
||||
}, this);
|
||||
|
||||
this.submitRequest = ko.observable(false);
|
||||
this.submitError = ko.observable('');
|
||||
this.submitErrorAddidional = ko.observable('');
|
||||
|
||||
this.submitError.subscribe(function(sValue) {
|
||||
if ('' === sValue)
|
||||
{
|
||||
this.submitErrorAddidional('');
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.allowLanguagesOnLogin = AppStore.allowLanguagesOnLogin;
|
||||
|
||||
this.langRequest = ko.observable(false);
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
|
||||
this.bSendLanguage = false;
|
||||
|
||||
this.languageFullName = ko.computed(function() {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.signMeType = ko.observable(Enums.LoginSignMeType.Unused);
|
||||
|
||||
this.signMeType.subscribe(function(iValue) {
|
||||
this.signMe(Enums.LoginSignMeType.DefaultOn === iValue);
|
||||
}, this);
|
||||
|
||||
this.signMeVisibility = ko.computed(function() {
|
||||
return Enums.LoginSignMeType.Unused !== this.signMeType();
|
||||
}, this);
|
||||
|
||||
this.submitCommand = Utils.createCommand(this, function() {
|
||||
|
||||
Utils.triggerAutocompleteInputChange();
|
||||
|
||||
this.emailError(false);
|
||||
this.passwordError(false);
|
||||
|
||||
this.emailError('' === Utils.trim(this.email()));
|
||||
this.passwordError('' === Utils.trim(this.password()));
|
||||
|
||||
if (this.additionalCode.visibility())
|
||||
{
|
||||
this.additionalCode.error(false);
|
||||
}, this);
|
||||
this.additionalCode.error('' === Utils.trim(this.additionalCode()));
|
||||
}
|
||||
|
||||
this.additionalCode.visibility.subscribe(function () {
|
||||
this.additionalCode.error(false);
|
||||
}, this);
|
||||
|
||||
this.emailError.subscribe(function (bV) {
|
||||
this.emailErrorAnimation(!!bV);
|
||||
}, this);
|
||||
|
||||
this.passwordError.subscribe(function (bV) {
|
||||
this.passwordErrorAnimation(!!bV);
|
||||
}, this);
|
||||
|
||||
this.additionalCode.error.subscribe(function (bV) {
|
||||
this.additionalCode.errorAnimation(!!bV);
|
||||
}, this);
|
||||
|
||||
this.submitRequest = ko.observable(false);
|
||||
this.submitError = ko.observable('');
|
||||
this.submitErrorAddidional = ko.observable('');
|
||||
|
||||
this.submitError.subscribe(function (sValue) {
|
||||
if ('' === sValue)
|
||||
if (this.emailError() || this.passwordError() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.error()))
|
||||
{
|
||||
switch (true)
|
||||
{
|
||||
this.submitErrorAddidional('');
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.allowLanguagesOnLogin = AppStore.allowLanguagesOnLogin;
|
||||
|
||||
this.langRequest = ko.observable(false);
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
|
||||
this.bSendLanguage = false;
|
||||
|
||||
this.languageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.signMeType = ko.observable(Enums.LoginSignMeType.Unused);
|
||||
|
||||
this.signMeType.subscribe(function (iValue) {
|
||||
this.signMe(Enums.LoginSignMeType.DefaultOn === iValue);
|
||||
}, this);
|
||||
|
||||
this.signMeVisibility = ko.computed(function () {
|
||||
return Enums.LoginSignMeType.Unused !== this.signMeType();
|
||||
}, this);
|
||||
|
||||
this.submitCommand = Utils.createCommand(this, function () {
|
||||
|
||||
Utils.triggerAutocompleteInputChange();
|
||||
|
||||
this.emailError(false);
|
||||
this.passwordError(false);
|
||||
|
||||
this.emailError('' === Utils.trim(this.email()));
|
||||
this.passwordError('' === Utils.trim(this.password()));
|
||||
|
||||
if (this.additionalCode.visibility())
|
||||
{
|
||||
this.additionalCode.error(false);
|
||||
this.additionalCode.error('' === Utils.trim(this.additionalCode()));
|
||||
case this.emailError():
|
||||
this.emailFocus(true);
|
||||
break;
|
||||
case this.passwordError():
|
||||
this.passwordFocus(true);
|
||||
break;
|
||||
case this.additionalCode.visibility() && this.additionalCode.error():
|
||||
this.additionalCode.focused(true);
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
if (this.emailError() || this.passwordError() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.error()))
|
||||
{
|
||||
switch (true)
|
||||
{
|
||||
case this.emailError():
|
||||
this.emailFocus(true);
|
||||
break;
|
||||
case this.passwordError():
|
||||
this.passwordFocus(true);
|
||||
break;
|
||||
case this.additionalCode.visibility() && this.additionalCode.error():
|
||||
this.additionalCode.focused(true);
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
var
|
||||
iPluginResultCode = 0,
|
||||
sPluginResultMessage = '',
|
||||
fSubmitResult = function(iResultCode, sResultMessage) {
|
||||
iPluginResultCode = iResultCode || 0;
|
||||
sPluginResultMessage = sResultMessage || '';
|
||||
};
|
||||
|
||||
var
|
||||
iPluginResultCode = 0,
|
||||
sPluginResultMessage = '',
|
||||
fSubmitResult = function (iResultCode, sResultMessage) {
|
||||
iPluginResultCode = iResultCode || 0;
|
||||
sPluginResultMessage = sResultMessage || '';
|
||||
}
|
||||
;
|
||||
Plugins.runHook('user-login-submit', [fSubmitResult]);
|
||||
if (0 < iPluginResultCode)
|
||||
{
|
||||
this.submitError(Translator.getNotification(iPluginResultCode));
|
||||
return false;
|
||||
}
|
||||
else if ('' !== sPluginResultMessage)
|
||||
{
|
||||
this.submitError(sPluginResultMessage);
|
||||
return false;
|
||||
}
|
||||
|
||||
Plugins.runHook('user-login-submit', [fSubmitResult]);
|
||||
if (0 < iPluginResultCode)
|
||||
{
|
||||
this.submitError(Translator.getNotification(iPluginResultCode));
|
||||
return false;
|
||||
}
|
||||
else if ('' !== sPluginResultMessage)
|
||||
{
|
||||
this.submitError(sPluginResultMessage);
|
||||
return false;
|
||||
}
|
||||
this.submitRequest(true);
|
||||
|
||||
this.submitRequest(true);
|
||||
var
|
||||
self = this,
|
||||
sPassword = this.password(),
|
||||
|
||||
var
|
||||
self = this,
|
||||
sPassword = this.password(),
|
||||
fLoginRequest = _.bind(function(sLoginPassword) {
|
||||
|
||||
fLoginRequest = _.bind(function (sLoginPassword) {
|
||||
Remote.login(_.bind(function(sResult, oData) {
|
||||
|
||||
Remote.login(_.bind(function (sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
|
||||
if (Enums.StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
if (oData.TwoFactorAuth)
|
||||
{
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(true);
|
||||
this.submitRequest(false);
|
||||
|
||||
_.delay(function() {
|
||||
self.additionalCode.focused(true);
|
||||
}, 100);
|
||||
}
|
||||
else if (oData.Admin)
|
||||
{
|
||||
require('App/User').default.redirectToAdminPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
require('App/User').default.loginAndLogoutReload(false);
|
||||
}
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
if (oData.TwoFactorAuth)
|
||||
{
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(true);
|
||||
this.submitRequest(false);
|
||||
if (-1 < Utils.inArray(oData.ErrorCode, [Enums.Notification.InvalidInputArgument]))
|
||||
{
|
||||
oData.ErrorCode = Enums.Notification.AuthError;
|
||||
}
|
||||
|
||||
this.submitError(Translator.getNotificationFromResponse(oData));
|
||||
|
||||
if ('' === this.submitError())
|
||||
{
|
||||
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oData.ErrorMessageAdditional)
|
||||
{
|
||||
this.submitErrorAddidional(oData.ErrorMessageAdditional);
|
||||
}
|
||||
}
|
||||
_.delay(function() {
|
||||
self.additionalCode.focused(true);
|
||||
}, 100);
|
||||
}
|
||||
else if (oData.Admin)
|
||||
{
|
||||
require('App/User').default.redirectToAdminPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
require('App/User').default.loginAndLogoutReload(false);
|
||||
}
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
{
|
||||
this.submitRequest(false);
|
||||
if (-1 < Utils.inArray(oData.ErrorCode, [Enums.Notification.InvalidInputArgument]))
|
||||
{
|
||||
oData.ErrorCode = Enums.Notification.AuthError;
|
||||
}
|
||||
|
||||
this.submitError(Translator.getNotificationFromResponse(oData));
|
||||
|
||||
if ('' === this.submitError())
|
||||
{
|
||||
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oData.ErrorMessageAdditional)
|
||||
{
|
||||
this.submitErrorAddidional(oData.ErrorMessageAdditional);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
this.submitError(Translator.getNotification(Enums.Notification.UnknownError));
|
||||
}
|
||||
|
||||
}, this), this.email(), '', sLoginPassword, !!this.signMe(),
|
||||
this.bSendLanguage ? this.language() : '',
|
||||
this.additionalCode.visibility() ? this.additionalCode() : '',
|
||||
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
||||
);
|
||||
}, this), this.email(), '', sLoginPassword, !!this.signMe(),
|
||||
this.bSendLanguage ? this.language() : '',
|
||||
this.additionalCode.visibility() ? this.additionalCode() : '',
|
||||
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
||||
);
|
||||
|
||||
Local.set(Enums.ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
Local.set(Enums.ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
|
||||
}, this)
|
||||
;
|
||||
}, this);
|
||||
|
||||
if (Settings.appSettingsGet('rsaPublicKey') && Utils.rsaEncode.supported)
|
||||
{
|
||||
fLoginRequest(Utils.rsaEncode(sPassword, Settings.appSettingsGet('rsaPublicKey')));
|
||||
}
|
||||
else
|
||||
{
|
||||
fLoginRequest(sPassword);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
return !this.submitRequest();
|
||||
});
|
||||
|
||||
this.facebookLoginEnabled = ko.observable(false);
|
||||
|
||||
this.facebookCommand = Utils.createCommand(this, function () {
|
||||
|
||||
window.open(Links.socialFacebook(), 'Facebook',
|
||||
'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
return !this.submitRequest() && this.facebookLoginEnabled();
|
||||
});
|
||||
|
||||
this.googleLoginEnabled = ko.observable(false);
|
||||
this.googleFastLoginEnabled = ko.observable(false);
|
||||
|
||||
this.googleCommand = Utils.createCommand(this, function () {
|
||||
|
||||
window.open(Links.socialGoogle(), 'Google',
|
||||
'left=200,top=100,width=650,height=500,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
return !this.submitRequest() && this.googleLoginEnabled();
|
||||
});
|
||||
|
||||
this.googleFastCommand = Utils.createCommand(this, function () {
|
||||
|
||||
window.open(Links.socialGoogle(true), 'Google',
|
||||
'left=200,top=100,width=650,height=500,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
return !this.submitRequest() && this.googleFastLoginEnabled();
|
||||
});
|
||||
|
||||
this.twitterLoginEnabled = ko.observable(false);
|
||||
|
||||
this.twitterCommand = Utils.createCommand(this, function () {
|
||||
|
||||
window.open(Links.socialTwitter(), 'Twitter',
|
||||
'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
return !this.submitRequest() && this.twitterLoginEnabled();
|
||||
});
|
||||
|
||||
this.socialLoginEnabled = ko.computed(function () {
|
||||
|
||||
var
|
||||
bF = this.facebookLoginEnabled(),
|
||||
bG = this.googleLoginEnabled(),
|
||||
bT = this.twitterLoginEnabled()
|
||||
;
|
||||
|
||||
return bF || bG || bT;
|
||||
}, this);
|
||||
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError())
|
||||
if (Settings.appSettingsGet('rsaPublicKey') && Utils.rsaEncode.supported)
|
||||
{
|
||||
this.submitError(Settings.settingsGet('AdditionalLoginError'));
|
||||
}
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/Login', 'View/App/Login', 'LoginViewModel'], LoginUserView);
|
||||
_.extend(LoginUserView.prototype, AbstractView.prototype);
|
||||
|
||||
LoginUserView.prototype.displayMainForm = function ()
|
||||
{
|
||||
this.welcome(false);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onShow = function ()
|
||||
{
|
||||
kn.routeOff();
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onShowWithDelay = function ()
|
||||
{
|
||||
if ('' !== this.email() && '' !== this.password())
|
||||
{
|
||||
this.submitFocus(true);
|
||||
}
|
||||
else if ('' === this.email())
|
||||
{
|
||||
this.emailFocus(true);
|
||||
}
|
||||
else if ('' === this.password())
|
||||
{
|
||||
this.passwordFocus(true);
|
||||
fLoginRequest(Utils.rsaEncode(sPassword, Settings.appSettingsGet('rsaPublicKey')));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.emailFocus(true);
|
||||
}
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onHide = function ()
|
||||
{
|
||||
this.submitFocus(false);
|
||||
this.emailFocus(false);
|
||||
this.passwordFocus(false);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onBuild = function ()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
sSignMeLocal = Local.get(Enums.ClientSideKeyName.LastSignMe),
|
||||
sSignMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase(),
|
||||
sJsHash = Settings.appSettingsGet('jsHash'),
|
||||
fSocial = function (iErrorCode) {
|
||||
iErrorCode = Utils.pInt(iErrorCode);
|
||||
if (0 === iErrorCode)
|
||||
{
|
||||
self.submitRequest(true);
|
||||
require('App/User').default.loginAndLogoutReload(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.submitError(Translator.getNotification(iErrorCode));
|
||||
}
|
||||
}
|
||||
;
|
||||
|
||||
this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
|
||||
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
|
||||
this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') &&
|
||||
!!Settings.settingsGet('AllowGoogleSocialAuth'));
|
||||
this.googleFastLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') &&
|
||||
!!Settings.settingsGet('AllowGoogleSocialAuthFast'));
|
||||
|
||||
switch (sSignMe)
|
||||
{
|
||||
case Enums.LoginSignMeTypeAsString.DefaultOff:
|
||||
case Enums.LoginSignMeTypeAsString.DefaultOn:
|
||||
|
||||
this.signMeType(Enums.LoginSignMeTypeAsString.DefaultOn === sSignMe ?
|
||||
Enums.LoginSignMeType.DefaultOn : Enums.LoginSignMeType.DefaultOff);
|
||||
|
||||
switch (sSignMeLocal)
|
||||
{
|
||||
case '-1-':
|
||||
this.signMeType(Enums.LoginSignMeType.DefaultOn);
|
||||
break;
|
||||
case '-0-':
|
||||
this.signMeType(Enums.LoginSignMeType.DefaultOff);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
case Enums.LoginSignMeTypeAsString.Unused:
|
||||
this.signMeType(Enums.LoginSignMeType.Unused);
|
||||
break;
|
||||
}
|
||||
|
||||
this.email(AppStore.devEmail);
|
||||
this.password(AppStore.devPassword);
|
||||
|
||||
if (this.googleLoginEnabled() || this.googleFastLoginEnabled())
|
||||
{
|
||||
window['rl_' + sJsHash + '_google_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.facebookLoginEnabled())
|
||||
{
|
||||
window['rl_' + sJsHash + '_facebook_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.twitterLoginEnabled())
|
||||
{
|
||||
window['rl_' + sJsHash + '_twitter_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
LanguageStore.language.subscribe(function (sValue) {
|
||||
|
||||
self.langRequest(true);
|
||||
|
||||
Translator.reload(false, sValue).then(function() {
|
||||
self.langRequest(false);
|
||||
self.bSendLanguage = true;
|
||||
}, function() {
|
||||
self.langRequest(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}, 50);
|
||||
|
||||
Utils.triggerAutocompleteInputChange(true);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.submitForm = function ()
|
||||
{
|
||||
this.submitCommand();
|
||||
};
|
||||
|
||||
LoginUserView.prototype.selectLanguage = function ()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.selectLanguageOnTab = function (bShift)
|
||||
{
|
||||
if (!bShift)
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function () {
|
||||
self.emailFocus(true);
|
||||
}, 5);
|
||||
|
||||
return false;
|
||||
fLoginRequest(sPassword);
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
module.exports = LoginUserView;
|
||||
}, function() {
|
||||
return !this.submitRequest();
|
||||
});
|
||||
|
||||
}());
|
||||
this.facebookLoginEnabled = ko.observable(false);
|
||||
|
||||
this.facebookCommand = Utils.createCommand(this, function() {
|
||||
|
||||
window.open(Links.socialFacebook(), 'Facebook',
|
||||
'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function() {
|
||||
return !this.submitRequest() && this.facebookLoginEnabled();
|
||||
});
|
||||
|
||||
this.googleLoginEnabled = ko.observable(false);
|
||||
this.googleFastLoginEnabled = ko.observable(false);
|
||||
|
||||
this.googleCommand = Utils.createCommand(this, function() {
|
||||
|
||||
window.open(Links.socialGoogle(), 'Google',
|
||||
'left=200,top=100,width=650,height=500,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function() {
|
||||
return !this.submitRequest() && this.googleLoginEnabled();
|
||||
});
|
||||
|
||||
this.googleFastCommand = Utils.createCommand(this, function() {
|
||||
|
||||
window.open(Links.socialGoogle(true), 'Google',
|
||||
'left=200,top=100,width=650,height=500,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function() {
|
||||
return !this.submitRequest() && this.googleFastLoginEnabled();
|
||||
});
|
||||
|
||||
this.twitterLoginEnabled = ko.observable(false);
|
||||
|
||||
this.twitterCommand = Utils.createCommand(this, function() {
|
||||
|
||||
window.open(Links.socialTwitter(), 'Twitter',
|
||||
'left=200,top=100,width=650,height=450,menubar=no,status=no,resizable=yes,scrollbars=yes');
|
||||
|
||||
return true;
|
||||
|
||||
}, function() {
|
||||
return !this.submitRequest() && this.twitterLoginEnabled();
|
||||
});
|
||||
|
||||
this.socialLoginEnabled = ko.computed(function() {
|
||||
|
||||
var
|
||||
bF = this.facebookLoginEnabled(),
|
||||
bG = this.googleLoginEnabled(),
|
||||
bT = this.twitterLoginEnabled();
|
||||
|
||||
return bF || bG || bT;
|
||||
}, this);
|
||||
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError())
|
||||
{
|
||||
this.submitError(Settings.settingsGet('AdditionalLoginError'));
|
||||
}
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/Login', 'View/App/Login', 'LoginViewModel'], LoginUserView);
|
||||
_.extend(LoginUserView.prototype, AbstractView.prototype);
|
||||
|
||||
LoginUserView.prototype.displayMainForm = function()
|
||||
{
|
||||
this.welcome(false);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onShow = function()
|
||||
{
|
||||
kn.routeOff();
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onShowWithDelay = function()
|
||||
{
|
||||
if ('' !== this.email() && '' !== this.password())
|
||||
{
|
||||
this.submitFocus(true);
|
||||
}
|
||||
else if ('' === this.email())
|
||||
{
|
||||
this.emailFocus(true);
|
||||
}
|
||||
else if ('' === this.password())
|
||||
{
|
||||
this.passwordFocus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.emailFocus(true);
|
||||
}
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onHide = function()
|
||||
{
|
||||
this.submitFocus(false);
|
||||
this.emailFocus(false);
|
||||
this.passwordFocus(false);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
sSignMeLocal = Local.get(Enums.ClientSideKeyName.LastSignMe),
|
||||
sSignMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase(),
|
||||
sJsHash = Settings.appSettingsGet('jsHash'),
|
||||
fSocial = function(iErrorCode) {
|
||||
iErrorCode = Utils.pInt(iErrorCode);
|
||||
if (0 === iErrorCode)
|
||||
{
|
||||
self.submitRequest(true);
|
||||
require('App/User').default.loginAndLogoutReload(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.submitError(Translator.getNotification(iErrorCode));
|
||||
}
|
||||
};
|
||||
|
||||
this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
|
||||
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
|
||||
this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') &&
|
||||
!!Settings.settingsGet('AllowGoogleSocialAuth'));
|
||||
this.googleFastLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') &&
|
||||
!!Settings.settingsGet('AllowGoogleSocialAuthFast'));
|
||||
|
||||
switch (sSignMe)
|
||||
{
|
||||
case Enums.LoginSignMeTypeAsString.DefaultOff:
|
||||
case Enums.LoginSignMeTypeAsString.DefaultOn:
|
||||
|
||||
this.signMeType(Enums.LoginSignMeTypeAsString.DefaultOn === sSignMe ?
|
||||
Enums.LoginSignMeType.DefaultOn : Enums.LoginSignMeType.DefaultOff);
|
||||
|
||||
switch (sSignMeLocal)
|
||||
{
|
||||
case '-1-':
|
||||
this.signMeType(Enums.LoginSignMeType.DefaultOn);
|
||||
break;
|
||||
case '-0-':
|
||||
this.signMeType(Enums.LoginSignMeType.DefaultOff);
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
break;
|
||||
case Enums.LoginSignMeTypeAsString.Unused:
|
||||
default:
|
||||
this.signMeType(Enums.LoginSignMeType.Unused);
|
||||
break;
|
||||
}
|
||||
|
||||
this.email(AppStore.devEmail);
|
||||
this.password(AppStore.devPassword);
|
||||
|
||||
if (this.googleLoginEnabled() || this.googleFastLoginEnabled())
|
||||
{
|
||||
window['rl_' + sJsHash + '_google_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.facebookLoginEnabled())
|
||||
{
|
||||
window['rl_' + sJsHash + '_facebook_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.twitterLoginEnabled())
|
||||
{
|
||||
window['rl_' + sJsHash + '_twitter_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
_.delay(function() {
|
||||
|
||||
LanguageStore.language.subscribe(function(sValue) {
|
||||
|
||||
self.langRequest(true);
|
||||
|
||||
Translator.reload(false, sValue).then(function() {
|
||||
self.langRequest(false);
|
||||
self.bSendLanguage = true;
|
||||
}, function() {
|
||||
self.langRequest(false);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
}, 50);
|
||||
|
||||
Utils.triggerAutocompleteInputChange(true);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.submitForm = function()
|
||||
{
|
||||
this.submitCommand();
|
||||
};
|
||||
|
||||
LoginUserView.prototype.selectLanguage = function()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
|
||||
LoginUserView.prototype.selectLanguageOnTab = function(bShift)
|
||||
{
|
||||
if (!bShift)
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function() {
|
||||
self.emailFocus(true);
|
||||
}, 5);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
module.exports = LoginUserView;
|
||||
|
|
|
|||
|
|
@ -1,324 +1,310 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
key = require('key'),
|
||||
|
||||
'use strict';
|
||||
Utils = require('Common/Utils'),
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
Cache = require('Common/Cache'),
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function FolderListMailBoxUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Left', 'MailFolderList');
|
||||
|
||||
this.oContentVisible = null;
|
||||
this.oContentScrollable = null;
|
||||
|
||||
this.composeInEdit = AppStore.composeInEdit;
|
||||
|
||||
this.messageList = MessageStore.messageList;
|
||||
this.folderList = FolderStore.folderList;
|
||||
this.folderListSystem = FolderStore.folderListSystem;
|
||||
this.foldersChanging = FolderStore.foldersChanging;
|
||||
|
||||
this.foldersListWithSingleInboxRootFolder = FolderStore.foldersListWithSingleInboxRootFolder;
|
||||
|
||||
this.leftPanelDisabled = Globals.leftPanelDisabled;
|
||||
|
||||
this.iDropOverTimer = 0;
|
||||
|
||||
this.allowComposer = !!Settings.capa(Enums.Capa.Composer);
|
||||
this.allowContacts = !!AppStore.contactsIsAllowed();
|
||||
this.allowFolders = !!Settings.capa(Enums.Capa.Folders);
|
||||
|
||||
this.folderListFocused = ko.computed(function() {
|
||||
return Enums.Focused.FolderList === AppStore.focusedState();
|
||||
});
|
||||
|
||||
this.isInboxStarred = ko.computed(function() {
|
||||
return FolderStore.currentFolder() &&
|
||||
FolderStore.currentFolder().isInbox() &&
|
||||
-1 < Utils.trim(MessageStore.messageListSearch()).indexOf('is:flagged');
|
||||
});
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/MailBox/FolderList', 'View/App/MailBox/FolderList', 'MailBoxFolderListViewModel'], FolderListMailBoxUserView);
|
||||
_.extend(FolderListMailBoxUserView.prototype, AbstractView.prototype);
|
||||
|
||||
FolderListMailBoxUserView.prototype.onBuild = function(oDom)
|
||||
{
|
||||
this.oContentVisible = $('.b-content', oDom);
|
||||
this.oContentScrollable = $('.content', this.oContentVisible);
|
||||
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
key = require('key'),
|
||||
self = this,
|
||||
bMobile = Settings.appSettingsGet('mobile'),
|
||||
fSelectFolder = function(oEvent, bStarred) {
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Links = require('Common/Links'),
|
||||
if (bMobile)
|
||||
{
|
||||
Globals.leftPanelDisabled(true);
|
||||
}
|
||||
|
||||
Cache = require('Common/Cache'),
|
||||
oEvent.preventDefault();
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
if (bStarred)
|
||||
{
|
||||
oEvent.stopPropagation();
|
||||
}
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
var
|
||||
oFolder = ko.dataFor(this);
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function FolderListMailBoxUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Left', 'MailFolderList');
|
||||
|
||||
this.oContentVisible = null;
|
||||
this.oContentScrollable = null;
|
||||
|
||||
this.composeInEdit = AppStore.composeInEdit;
|
||||
|
||||
this.messageList = MessageStore.messageList;
|
||||
this.folderList = FolderStore.folderList;
|
||||
this.folderListSystem = FolderStore.folderListSystem;
|
||||
this.foldersChanging = FolderStore.foldersChanging;
|
||||
|
||||
this.foldersListWithSingleInboxRootFolder = FolderStore.foldersListWithSingleInboxRootFolder;
|
||||
|
||||
this.leftPanelDisabled = Globals.leftPanelDisabled;
|
||||
|
||||
this.iDropOverTimer = 0;
|
||||
|
||||
this.allowComposer = !!Settings.capa(Enums.Capa.Composer);
|
||||
this.allowContacts = !!AppStore.contactsIsAllowed();
|
||||
this.allowFolders = !!Settings.capa(Enums.Capa.Folders);
|
||||
|
||||
this.folderListFocused = ko.computed(function () {
|
||||
return Enums.Focused.FolderList === AppStore.focusedState();
|
||||
});
|
||||
|
||||
this.isInboxStarred = ko.computed(function () {
|
||||
return FolderStore.currentFolder() &&
|
||||
FolderStore.currentFolder().isInbox() &&
|
||||
-1 < Utils.trim(MessageStore.messageListSearch()).indexOf('is:flagged')
|
||||
;
|
||||
});
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/MailBox/FolderList', 'View/App/MailBox/FolderList', 'MailBoxFolderListViewModel'], FolderListMailBoxUserView);
|
||||
_.extend(FolderListMailBoxUserView.prototype, AbstractView.prototype);
|
||||
|
||||
FolderListMailBoxUserView.prototype.onBuild = function (oDom)
|
||||
{
|
||||
this.oContentVisible = $('.b-content', oDom);
|
||||
this.oContentScrollable = $('.content', this.oContentVisible);
|
||||
|
||||
var
|
||||
self = this,
|
||||
bMobile = Settings.appSettingsGet('mobile'),
|
||||
fSelectFolder = function (oEvent, bStarred) {
|
||||
|
||||
if (bMobile)
|
||||
if (oFolder)
|
||||
{
|
||||
if (Enums.Layout.NoPreview === SettingsStore.layout())
|
||||
{
|
||||
Globals.leftPanelDisabled(true);
|
||||
MessageStore.message(null);
|
||||
}
|
||||
|
||||
oEvent.preventDefault();
|
||||
if (oFolder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
||||
{
|
||||
Cache.setFolderHash(oFolder.fullNameRaw, '');
|
||||
}
|
||||
|
||||
if (bStarred)
|
||||
{
|
||||
oEvent.stopPropagation();
|
||||
kn.setHash(Links.mailBox(oFolder.fullNameHash, 1, 'is:flagged'));
|
||||
}
|
||||
|
||||
var
|
||||
oFolder = ko.dataFor(this)
|
||||
;
|
||||
|
||||
if (oFolder)
|
||||
else
|
||||
{
|
||||
if (Enums.Layout.NoPreview === SettingsStore.layout())
|
||||
{
|
||||
MessageStore.message(null);
|
||||
}
|
||||
|
||||
if (oFolder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
||||
{
|
||||
Cache.setFolderHash(oFolder.fullNameRaw, '');
|
||||
}
|
||||
|
||||
if (bStarred)
|
||||
{
|
||||
kn.setHash(Links.mailBox(oFolder.fullNameHash, 1, 'is:flagged'));
|
||||
}
|
||||
else
|
||||
{
|
||||
kn.setHash(Links.mailBox(oFolder.fullNameHash));
|
||||
}
|
||||
kn.setHash(Links.mailBox(oFolder.fullNameHash));
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
oDom
|
||||
.on('click', '.b-folders .e-item .e-link .e-collapsed-sign', function (oEvent) {
|
||||
|
||||
var
|
||||
oFolder = ko.dataFor(this),
|
||||
bCollapsed = false
|
||||
;
|
||||
|
||||
if (oFolder && oEvent)
|
||||
{
|
||||
bCollapsed = oFolder.collapsed();
|
||||
require('App/User').default.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
|
||||
|
||||
oFolder.collapsed(!bCollapsed);
|
||||
oEvent.preventDefault();
|
||||
oEvent.stopPropagation();
|
||||
}
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable .inbox-star-icon', function (oEvent) {
|
||||
fSelectFolder.call(this, oEvent, !self.isInboxStarred());
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable', function (oEvent) {
|
||||
fSelectFolder.call(this, oEvent, false);
|
||||
})
|
||||
;
|
||||
|
||||
key('up, down', Enums.KeyState.FolderList, function (event, handler) {
|
||||
oDom
|
||||
.on('click', '.b-folders .e-item .e-link .e-collapsed-sign', function(oEvent) {
|
||||
|
||||
var
|
||||
iIndex = -1,
|
||||
iKeyCode = handler && 'up' === handler.shortcut ? 38 : 40,
|
||||
$items = $('.b-folders .e-item .e-link:not(.hidden):visible', oDom)
|
||||
;
|
||||
oFolder = ko.dataFor(this),
|
||||
bCollapsed = false;
|
||||
|
||||
if (event && $items.length)
|
||||
if (oFolder && oEvent)
|
||||
{
|
||||
iIndex = $items.index($items.filter('.focused'));
|
||||
if (-1 < iIndex)
|
||||
{
|
||||
$items.eq(iIndex).removeClass('focused');
|
||||
}
|
||||
bCollapsed = oFolder.collapsed();
|
||||
require('App/User').default.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
|
||||
|
||||
if (iKeyCode === 38 && iIndex > 0)
|
||||
{
|
||||
iIndex--;
|
||||
}
|
||||
else if (iKeyCode === 40 && iIndex < $items.length - 1)
|
||||
{
|
||||
iIndex++;
|
||||
}
|
||||
|
||||
$items.eq(iIndex).addClass('focused');
|
||||
self.scrollToFocused();
|
||||
oFolder.collapsed(!bCollapsed);
|
||||
oEvent.preventDefault();
|
||||
oEvent.stopPropagation();
|
||||
}
|
||||
|
||||
return false;
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable .inbox-star-icon', function(oEvent) {
|
||||
fSelectFolder.call(this, oEvent, !self.isInboxStarred());
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable', function(oEvent) {
|
||||
fSelectFolder.call(this, oEvent, false);
|
||||
});
|
||||
|
||||
key('enter', Enums.KeyState.FolderList, function () {
|
||||
var $items = $('.b-folders .e-item .e-link:not(.hidden).focused', oDom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
$items.click();
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
key('space', Enums.KeyState.FolderList, function () {
|
||||
var bCollapsed = true, oFolder = null, $items = $('.b-folders .e-item .e-link:not(.hidden).focused', oDom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
oFolder = ko.dataFor($items[0]);
|
||||
if (oFolder)
|
||||
{
|
||||
bCollapsed = oFolder.collapsed();
|
||||
require('App/User').default.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
|
||||
oFolder.collapsed(!bCollapsed);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
key('esc, tab, shift+tab, right', Enums.KeyState.FolderList, function () {
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
return false;
|
||||
});
|
||||
|
||||
AppStore.focusedState.subscribe(function (mValue) {
|
||||
$('.b-folders .e-item .e-link.focused', oDom).removeClass('focused');
|
||||
if (Enums.Focused.FolderList === mValue)
|
||||
{
|
||||
$('.b-folders .e-item .e-link.selected', oDom).addClass('focused');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.messagesDropOver = function (oFolder)
|
||||
{
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
if (oFolder && oFolder.collapsed())
|
||||
{
|
||||
this.iDropOverTimer = window.setTimeout(function () {
|
||||
oFolder.collapsed(false);
|
||||
require('App/User').default.setExpandedFolder(oFolder.fullNameHash, true);
|
||||
Utils.windowResize();
|
||||
}, 500);
|
||||
}
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.messagesDropOut = function ()
|
||||
{
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.scrollToFocused = function ()
|
||||
{
|
||||
if (!this.oContentVisible || !this.oContentScrollable)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
key('up, down', Enums.KeyState.FolderList, function(event, handler) {
|
||||
|
||||
var
|
||||
iOffset = 20,
|
||||
oFocused = $('.e-item .e-link.focused', this.oContentScrollable),
|
||||
oPos = oFocused.position(),
|
||||
iVisibleHeight = this.oContentVisible.height(),
|
||||
iFocusedHeight = oFocused.outerHeight()
|
||||
;
|
||||
iIndex = -1,
|
||||
iKeyCode = handler && 'up' === handler.shortcut ? 38 : 40,
|
||||
$items = $('.b-folders .e-item .e-link:not(.hidden):visible', oDom);
|
||||
|
||||
if (oPos && (oPos.top < 0 || oPos.top + iFocusedHeight > iVisibleHeight))
|
||||
if (event && $items.length)
|
||||
{
|
||||
if (oPos.top < 0)
|
||||
iIndex = $items.index($items.filter('.focused'));
|
||||
if (-1 < iIndex)
|
||||
{
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iVisibleHeight + iFocusedHeight + iOffset);
|
||||
$items.eq(iIndex).removeClass('focused');
|
||||
}
|
||||
|
||||
return true;
|
||||
if (38 === iKeyCode && 0 < iIndex)
|
||||
{
|
||||
iIndex -= 1;
|
||||
}
|
||||
else if (40 === iKeyCode && iIndex < $items.length - 1)
|
||||
{
|
||||
iIndex += 1;
|
||||
}
|
||||
|
||||
$items.eq(iIndex).addClass('focused');
|
||||
self.scrollToFocused();
|
||||
}
|
||||
|
||||
return false;
|
||||
};
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {FolderModel} oToFolder
|
||||
* @param {{helper:jQuery}} oUi
|
||||
*/
|
||||
FolderListMailBoxUserView.prototype.messagesDrop = function (oToFolder, oUi)
|
||||
{
|
||||
if (oToFolder && oUi && oUi.helper)
|
||||
key('enter', Enums.KeyState.FolderList, function() {
|
||||
var $items = $('.b-folders .e-item .e-link:not(.hidden).focused', oDom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
var
|
||||
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
|
||||
bCopy = Globals.$html.hasClass('rl-ctrl-key-pressed'),
|
||||
aUids = oUi.helper.data('rl-uids')
|
||||
;
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
$items.click();
|
||||
}
|
||||
|
||||
if (Utils.isNormal(sFromFolderFullNameRaw) && '' !== sFromFolderFullNameRaw && Utils.isArray(aUids))
|
||||
return false;
|
||||
});
|
||||
|
||||
key('space', Enums.KeyState.FolderList, function() {
|
||||
var bCollapsed = true, oFolder = null, $items = $('.b-folders .e-item .e-link:not(.hidden).focused', oDom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
oFolder = ko.dataFor($items[0]);
|
||||
if (oFolder)
|
||||
{
|
||||
require('App/User').default.moveMessagesToFolder(sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw, bCopy);
|
||||
bCollapsed = oFolder.collapsed();
|
||||
require('App/User').default.setExpandedFolder(oFolder.fullNameHash, bCollapsed);
|
||||
oFolder.collapsed(!bCollapsed);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.composeClick = function ()
|
||||
{
|
||||
if (Settings.capa(Enums.Capa.Composer))
|
||||
return false;
|
||||
});
|
||||
|
||||
key('esc, tab, shift+tab, right', Enums.KeyState.FolderList, function() {
|
||||
AppStore.focusedState(Enums.Focused.MessageList);
|
||||
return false;
|
||||
});
|
||||
|
||||
AppStore.focusedState.subscribe(function(mValue) {
|
||||
$('.b-folders .e-item .e-link.focused', oDom).removeClass('focused');
|
||||
if (Enums.Focused.FolderList === mValue)
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/Compose'));
|
||||
$('.b-folders .e-item .e-link.selected', oDom).addClass('focused');
|
||||
}
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.createFolder = function ()
|
||||
FolderListMailBoxUserView.prototype.messagesDropOver = function(oFolder)
|
||||
{
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
if (oFolder && oFolder.collapsed())
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/FolderCreate'));
|
||||
};
|
||||
this.iDropOverTimer = window.setTimeout(function() {
|
||||
oFolder.collapsed(false);
|
||||
require('App/User').default.setExpandedFolder(oFolder.fullNameHash, true);
|
||||
Utils.windowResize();
|
||||
}, 500);
|
||||
}
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.configureFolders = function ()
|
||||
{
|
||||
kn.setHash(Links.settings('folders'));
|
||||
};
|
||||
FolderListMailBoxUserView.prototype.messagesDropOut = function()
|
||||
{
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.contactsClick = function ()
|
||||
FolderListMailBoxUserView.prototype.scrollToFocused = function()
|
||||
{
|
||||
if (!this.oContentVisible || !this.oContentScrollable)
|
||||
{
|
||||
if (this.allowContacts)
|
||||
return false;
|
||||
}
|
||||
|
||||
var
|
||||
iOffset = 20,
|
||||
oFocused = $('.e-item .e-link.focused', this.oContentScrollable),
|
||||
oPos = oFocused.position(),
|
||||
iVisibleHeight = this.oContentVisible.height(),
|
||||
iFocusedHeight = oFocused.outerHeight();
|
||||
|
||||
if (oPos && (0 > oPos.top || oPos.top + iFocusedHeight > iVisibleHeight))
|
||||
{
|
||||
if (0 > oPos.top)
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/Contacts'));
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iOffset);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + oPos.top - iVisibleHeight + iFocusedHeight + iOffset);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = FolderListMailBoxUserView;
|
||||
return true;
|
||||
}
|
||||
|
||||
}());
|
||||
return false;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {FolderModel} oToFolder
|
||||
* @param {{helper:jQuery}} oUi
|
||||
* @returns {void}
|
||||
*/
|
||||
FolderListMailBoxUserView.prototype.messagesDrop = function(oToFolder, oUi)
|
||||
{
|
||||
if (oToFolder && oUi && oUi.helper)
|
||||
{
|
||||
var
|
||||
sFromFolderFullNameRaw = oUi.helper.data('rl-folder'),
|
||||
bCopy = Globals.$html.hasClass('rl-ctrl-key-pressed'),
|
||||
aUids = oUi.helper.data('rl-uids');
|
||||
|
||||
if (Utils.isNormal(sFromFolderFullNameRaw) && '' !== sFromFolderFullNameRaw && Utils.isArray(aUids))
|
||||
{
|
||||
require('App/User').default.moveMessagesToFolder(sFromFolderFullNameRaw, aUids, oToFolder.fullNameRaw, bCopy);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.composeClick = function()
|
||||
{
|
||||
if (Settings.capa(Enums.Capa.Composer))
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/Compose'));
|
||||
}
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.createFolder = function()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/FolderCreate'));
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.configureFolders = function()
|
||||
{
|
||||
kn.setHash(Links.settings('folders'));
|
||||
};
|
||||
|
||||
FolderListMailBoxUserView.prototype.contactsClick = function()
|
||||
{
|
||||
if (this.allowContacts)
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/Contacts'));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = FolderListMailBoxUserView;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,28 +1,21 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractSystemDropDownViewModel = require('View/User/AbstractSystemDropDown');
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSystemDropDownViewModel
|
||||
*/
|
||||
function SystemDropDownMailBoxUserView()
|
||||
{
|
||||
AbstractSystemDropDownViewModel.call(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractSystemDropDownViewModel = require('View/User/AbstractSystemDropDown')
|
||||
;
|
||||
kn.extendAsViewModel(['View/User/MailBox/SystemDropDown', 'View/App/MailBox/SystemDropDown', 'MailBoxSystemDropDownViewModel'], SystemDropDownMailBoxUserView);
|
||||
_.extend(SystemDropDownMailBoxUserView.prototype, AbstractSystemDropDownViewModel.prototype);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSystemDropDownViewModel
|
||||
*/
|
||||
function SystemDropDownMailBoxUserView()
|
||||
{
|
||||
AbstractSystemDropDownViewModel.call(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/MailBox/SystemDropDown', 'View/App/MailBox/SystemDropDown', 'MailBoxSystemDropDownViewModel'], SystemDropDownMailBoxUserView);
|
||||
_.extend(SystemDropDownMailBoxUserView.prototype, AbstractSystemDropDownViewModel.prototype);
|
||||
|
||||
module.exports = SystemDropDownMailBoxUserView;
|
||||
|
||||
}());
|
||||
module.exports = SystemDropDownMailBoxUserView;
|
||||
|
|
|
|||
|
|
@ -1,102 +1,91 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
key = require('key'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
key = require('key'),
|
||||
Cache = require('Common/Cache'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Globals = require('Common/Globals'),
|
||||
Links = require('Common/Links'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
|
||||
Cache = require('Common/Cache'),
|
||||
Settings = require('Storage/Settings'),
|
||||
/**
|
||||
* @constructor
|
||||
* @param {Object} oScreen
|
||||
*/
|
||||
function MenuSettingsUserView(oScreen)
|
||||
{
|
||||
AbstractView.call(this, 'Left', 'SettingsMenu');
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView')
|
||||
;
|
||||
this.leftPanelDisabled = Globals.leftPanelDisabled;
|
||||
|
||||
/**
|
||||
* @param {?} oScreen
|
||||
*
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function MenuSettingsUserView(oScreen)
|
||||
{
|
||||
AbstractView.call(this, 'Left', 'SettingsMenu');
|
||||
this.mobile = Settings.appSettingsGet('mobile');
|
||||
|
||||
this.leftPanelDisabled = Globals.leftPanelDisabled;
|
||||
this.menu = oScreen.menu;
|
||||
|
||||
this.mobile = Settings.appSettingsGet('mobile');
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
this.menu = oScreen.menu;
|
||||
kn.extendAsViewModel(['View/User/Settings/Menu', 'View/App/Settings/Menu', 'SettingsMenuViewModel'], MenuSettingsUserView);
|
||||
_.extend(MenuSettingsUserView.prototype, AbstractView.prototype);
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/Settings/Menu', 'View/App/Settings/Menu', 'SettingsMenuViewModel'], MenuSettingsUserView);
|
||||
_.extend(MenuSettingsUserView.prototype, AbstractView.prototype);
|
||||
|
||||
MenuSettingsUserView.prototype.onBuild = function (oDom)
|
||||
{
|
||||
MenuSettingsUserView.prototype.onBuild = function(oDom)
|
||||
{
|
||||
// var self = this;
|
||||
// key('esc', Enums.KeyState.Settings, function () {
|
||||
// key('esc', Enums.KeyState.Settings, function() {
|
||||
// self.backToMailBoxClick();
|
||||
// });
|
||||
|
||||
if (this.mobile)
|
||||
if (this.mobile)
|
||||
{
|
||||
oDom
|
||||
.on('click', '.b-settings-menu .e-item.selectable', function() {
|
||||
Globals.leftPanelDisabled(true);
|
||||
});
|
||||
}
|
||||
|
||||
key('up, down', Enums.KeyState.Settings, _.throttle(function(event, handler) {
|
||||
|
||||
var
|
||||
sH = '',
|
||||
iIndex = -1,
|
||||
bUp = handler && 'up' === handler.shortcut,
|
||||
$items = $('.b-settings-menu .e-item', oDom);
|
||||
|
||||
if (event && $items.length)
|
||||
{
|
||||
oDom
|
||||
.on('click', '.b-settings-menu .e-item.selectable', function () {
|
||||
Globals.leftPanelDisabled(true);
|
||||
})
|
||||
;
|
||||
}
|
||||
|
||||
key('up, down', Enums.KeyState.Settings, _.throttle(function (event, handler) {
|
||||
|
||||
var
|
||||
sH = '',
|
||||
iIndex = -1,
|
||||
bUp = handler && 'up' === handler.shortcut,
|
||||
$items = $('.b-settings-menu .e-item', oDom)
|
||||
;
|
||||
|
||||
if (event && $items.length)
|
||||
iIndex = $items.index($items.filter('.selected'));
|
||||
if (bUp && 0 < iIndex)
|
||||
{
|
||||
iIndex = $items.index($items.filter('.selected'));
|
||||
if (bUp && iIndex > 0)
|
||||
{
|
||||
iIndex--;
|
||||
}
|
||||
else if (!bUp && iIndex < $items.length - 1)
|
||||
{
|
||||
iIndex++;
|
||||
}
|
||||
|
||||
sH = $items.eq(iIndex).attr('href');
|
||||
if (sH)
|
||||
{
|
||||
kn.setHash(sH, false, true);
|
||||
}
|
||||
iIndex -= 1;
|
||||
}
|
||||
else if (!bUp && iIndex < $items.length - 1)
|
||||
{
|
||||
iIndex += 1;
|
||||
}
|
||||
|
||||
}, 200));
|
||||
};
|
||||
sH = $items.eq(iIndex).attr('href');
|
||||
if (sH)
|
||||
{
|
||||
kn.setHash(sH, false, true);
|
||||
}
|
||||
}
|
||||
|
||||
MenuSettingsUserView.prototype.link = function (sRoute)
|
||||
{
|
||||
return Links.settings(sRoute);
|
||||
};
|
||||
}, 200));
|
||||
};
|
||||
|
||||
MenuSettingsUserView.prototype.backToMailBoxClick = function ()
|
||||
{
|
||||
kn.setHash(Links.inbox(Cache.getFolderInboxName()));
|
||||
};
|
||||
MenuSettingsUserView.prototype.link = function(sRoute)
|
||||
{
|
||||
return Links.settings(sRoute);
|
||||
};
|
||||
|
||||
module.exports = MenuSettingsUserView;
|
||||
MenuSettingsUserView.prototype.backToMailBoxClick = function()
|
||||
{
|
||||
kn.setHash(Links.inbox(Cache.getFolderInboxName()));
|
||||
};
|
||||
|
||||
}());
|
||||
module.exports = MenuSettingsUserView;
|
||||
|
|
|
|||
|
|
@ -1,76 +1,68 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
Globals = require('Common/Globals'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
Globals = require('Common/Globals'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView');
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function PaneSettingsUserView()
|
||||
{
|
||||
AbstractView.call(this, 'Right', 'SettingsPane');
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractView = require('Knoin/AbstractView')
|
||||
;
|
||||
this.mobile = Settings.appSettingsGet('mobile');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractView
|
||||
*/
|
||||
function PaneSettingsUserView()
|
||||
this.leftPanelDisabled = Globals.leftPanelDisabled;
|
||||
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/Settings/Pane', 'View/App/Settings/Pane', 'SettingsPaneViewModel'], PaneSettingsUserView);
|
||||
_.extend(PaneSettingsUserView.prototype, AbstractView.prototype);
|
||||
|
||||
PaneSettingsUserView.prototype.onShow = function()
|
||||
{
|
||||
require('Stores/User/Message').message(null);
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.hideLeft = function(oItem, oEvent)
|
||||
{
|
||||
oEvent.preventDefault();
|
||||
oEvent.stopPropagation();
|
||||
|
||||
Globals.leftPanelDisabled(true);
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.showLeft = function(oItem, oEvent)
|
||||
{
|
||||
oEvent.preventDefault();
|
||||
oEvent.stopPropagation();
|
||||
|
||||
Globals.leftPanelDisabled(false);
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.onBuild = function(oDom)
|
||||
{
|
||||
if (this.mobile)
|
||||
{
|
||||
AbstractView.call(this, 'Right', 'SettingsPane');
|
||||
|
||||
this.mobile = Settings.appSettingsGet('mobile');
|
||||
|
||||
this.leftPanelDisabled = Globals.leftPanelDisabled;
|
||||
|
||||
kn.constructorEnd(this);
|
||||
oDom
|
||||
.on('click', function() {
|
||||
Globals.leftPanelDisabled(true);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
kn.extendAsViewModel(['View/User/Settings/Pane', 'View/App/Settings/Pane', 'SettingsPaneViewModel'], PaneSettingsUserView);
|
||||
_.extend(PaneSettingsUserView.prototype, AbstractView.prototype);
|
||||
PaneSettingsUserView.prototype.backToMailBoxClick = function()
|
||||
{
|
||||
kn.setHash(require('Common/Links').inbox(
|
||||
require('Common/Cache').getFolderInboxName()));
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.onShow = function ()
|
||||
{
|
||||
require('Stores/User/Message').message(null);
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.hideLeft = function (oItem, oEvent)
|
||||
{
|
||||
oEvent.preventDefault();
|
||||
oEvent.stopPropagation();
|
||||
|
||||
Globals.leftPanelDisabled(true);
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.showLeft = function (oItem, oEvent)
|
||||
{
|
||||
oEvent.preventDefault();
|
||||
oEvent.stopPropagation();
|
||||
|
||||
Globals.leftPanelDisabled(false);
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.onBuild = function (oDom)
|
||||
{
|
||||
if (this.mobile)
|
||||
{
|
||||
oDom
|
||||
.on('click', function () {
|
||||
Globals.leftPanelDisabled(true);
|
||||
})
|
||||
;
|
||||
}
|
||||
};
|
||||
|
||||
PaneSettingsUserView.prototype.backToMailBoxClick = function ()
|
||||
{
|
||||
kn.setHash(require('Common/Links').inbox(
|
||||
require('Common/Cache').getFolderInboxName()));
|
||||
};
|
||||
|
||||
module.exports = PaneSettingsUserView;
|
||||
|
||||
}());
|
||||
module.exports = PaneSettingsUserView;
|
||||
|
|
|
|||
|
|
@ -1,28 +1,21 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractSystemDropDownUserView = require('View/User/AbstractSystemDropDown');
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSystemDropDownUserView
|
||||
*/
|
||||
function SystemDropDownSettingsUserView()
|
||||
{
|
||||
AbstractSystemDropDownUserView.call(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
AbstractSystemDropDownUserView = require('View/User/AbstractSystemDropDown')
|
||||
;
|
||||
kn.extendAsViewModel(['View/User/Settings/SystemDropDown', 'View/App/Settings/SystemDropDown', 'SettingsSystemDropDownViewModel'], SystemDropDownSettingsUserView);
|
||||
_.extend(SystemDropDownSettingsUserView.prototype, AbstractSystemDropDownUserView.prototype);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @extends AbstractSystemDropDownUserView
|
||||
*/
|
||||
function SystemDropDownSettingsUserView()
|
||||
{
|
||||
AbstractSystemDropDownUserView.call(this);
|
||||
kn.constructorEnd(this);
|
||||
}
|
||||
|
||||
kn.extendAsViewModel(['View/User/Settings/SystemDropDown', 'View/App/Settings/SystemDropDown', 'SettingsSystemDropDownViewModel'], SystemDropDownSettingsUserView);
|
||||
_.extend(SystemDropDownSettingsUserView.prototype, AbstractSystemDropDownUserView.prototype);
|
||||
|
||||
module.exports = SystemDropDownSettingsUserView;
|
||||
|
||||
}());
|
||||
module.exports = SystemDropDownSettingsUserView;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue