mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 12:39:20 +03:00
prettier --write
This commit is contained in:
parent
450528ff00
commit
8a0be3212d
164 changed files with 7053 additions and 9008 deletions
|
|
@ -1,31 +1,27 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import _ from '_';
|
||||
|
||||
import {
|
||||
trim, triggerAutocompleteInputChange
|
||||
} from 'Common/Utils';
|
||||
import { trim, triggerAutocompleteInputChange } from 'Common/Utils';
|
||||
|
||||
import {StorageResultType, Notification, Magics} from 'Common/Enums';
|
||||
import {getNotification} from 'Common/Translator';
|
||||
import {$win} from 'Common/Globals';
|
||||
import { StorageResultType, Notification, Magics } from 'Common/Enums';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
import { $win } from 'Common/Globals';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import {view, command, ViewType, routeOff} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, command, ViewType, routeOff } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/Admin/Login',
|
||||
type: ViewType.Center,
|
||||
templateID: 'AdminLogin'
|
||||
})
|
||||
class LoginAdminView extends AbstractViewNext
|
||||
{
|
||||
class LoginAdminView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -42,8 +38,8 @@ class LoginAdminView extends AbstractViewNext
|
|||
this.loginError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
|
||||
this.loginErrorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({'falseTimeout': 500});
|
||||
this.loginErrorAnimation = ko.observable(false).extend({ 'falseTimeout': 500 });
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({ 'falseTimeout': 500 });
|
||||
|
||||
this.loginFocus = ko.observable(false);
|
||||
|
||||
|
|
@ -67,7 +63,6 @@ class LoginAdminView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest())
|
||||
submitCommand() {
|
||||
|
||||
triggerAutocompleteInputChange();
|
||||
|
||||
this.loginError(false);
|
||||
|
|
@ -76,38 +71,33 @@ class LoginAdminView extends AbstractViewNext
|
|||
this.loginError('' === trim(this.login()));
|
||||
this.passwordError('' === trim(this.password()));
|
||||
|
||||
if (this.loginError() || this.passwordError())
|
||||
{
|
||||
if (this.loginError() || this.passwordError()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.submitRequest(true);
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
|
||||
Remote.adminLogin((sResult, oData) => {
|
||||
Remote.adminLogin(
|
||||
(sResult, oData) => {
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
$win.trigger('rl.tooltips.activate');
|
||||
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
$win.trigger('rl.tooltips.activate');
|
||||
|
||||
if (StorageResultType.Success === sResult && oData && 'AdminLogin' === oData.Action)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
getApp().loginAndLogoutReload(true);
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
{
|
||||
if (StorageResultType.Success === sResult && oData && 'AdminLogin' === oData.Action) {
|
||||
if (oData.Result) {
|
||||
getApp().loginAndLogoutReload(true);
|
||||
} else if (oData.ErrorCode) {
|
||||
this.submitRequest(false);
|
||||
this.submitError(getNotification(oData.ErrorCode));
|
||||
}
|
||||
} else {
|
||||
this.submitRequest(false);
|
||||
this.submitError(getNotification(oData.ErrorCode));
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
|
||||
}, this.login(), this.password());
|
||||
},
|
||||
this.login(),
|
||||
this.password()
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -133,4 +123,4 @@ class LoginAdminView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {LoginAdminView, LoginAdminView as default};
|
||||
export { LoginAdminView, LoginAdminView as default };
|
||||
|
|
|
|||
|
|
@ -1,25 +1,22 @@
|
|||
|
||||
import $ from '$';
|
||||
import key from 'key';
|
||||
|
||||
import {leftPanelDisabled} from 'Common/Globals';
|
||||
import {KeyState} from 'Common/Enums';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
|
||||
import {view, ViewType, settingsMenuKeysHandler} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType, settingsMenuKeysHandler } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/Admin/Settings/Menu',
|
||||
type: ViewType.Left,
|
||||
templateID: 'AdminMenu'
|
||||
})
|
||||
class MenuSettingsAdminView extends AbstractViewNext
|
||||
{
|
||||
class MenuSettingsAdminView extends AbstractViewNext {
|
||||
/**
|
||||
* @param {?} screen
|
||||
*/
|
||||
constructor(screen) {
|
||||
|
||||
super();
|
||||
|
||||
this.leftPanelDisabled = leftPanelDisabled;
|
||||
|
|
@ -36,4 +33,4 @@ class MenuSettingsAdminView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {MenuSettingsAdminView, MenuSettingsAdminView as default};
|
||||
export { MenuSettingsAdminView, MenuSettingsAdminView as default };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
|
@ -9,18 +8,17 @@ import DomainStore from 'Stores/Admin/Domain';
|
|||
import PluginStore from 'Stores/Admin/Plugin';
|
||||
import PackageStore from 'Stores/Admin/Package';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/Admin/Settings/Pane',
|
||||
type: ViewType.Right,
|
||||
templateID: 'AdminPane'
|
||||
})
|
||||
class PaneSettingsAdminView extends AbstractViewNext
|
||||
{
|
||||
class PaneSettingsAdminView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -31,16 +29,18 @@ class PaneSettingsAdminView extends AbstractViewNext
|
|||
this.community = RL_COMMUNITY;
|
||||
|
||||
this.adminManLoading = ko.computed(
|
||||
() => '000' !== [
|
||||
DomainStore.domains.loading() ? '1' : '0',
|
||||
PluginStore.plugins.loading() ? '1' : '0',
|
||||
PackageStore.packages.loading() ? '1' : '0'
|
||||
].join('')
|
||||
() =>
|
||||
'000' !==
|
||||
[
|
||||
DomainStore.domains.loading() ? '1' : '0',
|
||||
PluginStore.plugins.loading() ? '1' : '0',
|
||||
PackageStore.packages.loading() ? '1' : '0'
|
||||
].join('')
|
||||
);
|
||||
|
||||
this.adminManLoadingVisibility = ko.computed(
|
||||
() => (this.adminManLoading() ? 'visible' : 'hidden')
|
||||
).extend({rateLimit: 300});
|
||||
this.adminManLoadingVisibility = ko
|
||||
.computed(() => (this.adminManLoading() ? 'visible' : 'hidden'))
|
||||
.extend({ rateLimit: 300 });
|
||||
}
|
||||
|
||||
logoutClick() {
|
||||
|
|
@ -50,4 +50,4 @@ class PaneSettingsAdminView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {PaneSettingsAdminView, PaneSettingsAdminView as default};
|
||||
export { PaneSettingsAdminView, PaneSettingsAdminView as default };
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {trim} from 'Common/Utils';
|
||||
import {getNotification} from 'Common/Translator';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { trim } from 'Common/Utils';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Account',
|
||||
templateID: 'PopupsAccount'
|
||||
})
|
||||
class AccountPopupView extends AbstractViewNext
|
||||
{
|
||||
class AccountPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -46,45 +44,40 @@ class AccountPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest())
|
||||
addAccountCommand() {
|
||||
|
||||
this.emailError('' === trim(this.email()));
|
||||
this.passwordError('' === trim(this.password()));
|
||||
|
||||
if (this.emailError() || this.passwordError())
|
||||
{
|
||||
if (this.emailError() || this.passwordError()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.submitRequest(true);
|
||||
|
||||
Remote.accountSetup((result, data) => {
|
||||
Remote.accountSetup(
|
||||
(result, data) => {
|
||||
this.submitRequest(false);
|
||||
if (StorageResultType.Success === result && data) {
|
||||
if (data.Result) {
|
||||
getApp().accountsAndIdentities();
|
||||
this.cancelCommand();
|
||||
} else {
|
||||
this.submitError(
|
||||
data.ErrorCode ? getNotification(data.ErrorCode) : getNotification(Notification.UnknownError)
|
||||
);
|
||||
|
||||
this.submitRequest(false);
|
||||
if (StorageResultType.Success === result && data)
|
||||
{
|
||||
if (data.Result)
|
||||
{
|
||||
getApp().accountsAndIdentities();
|
||||
this.cancelCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitError(data.ErrorCode ? getNotification(data.ErrorCode) :
|
||||
getNotification(Notification.UnknownError));
|
||||
|
||||
if (data.ErrorMessageAdditional)
|
||||
{
|
||||
this.submitErrorAdditional(data.ErrorMessageAdditional);
|
||||
if (data.ErrorMessageAdditional) {
|
||||
this.submitErrorAdditional(data.ErrorMessageAdditional);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
this.submitErrorAdditional('');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
this.submitErrorAdditional('');
|
||||
}
|
||||
|
||||
}, this.email(), this.password(), this.isNew());
|
||||
},
|
||||
this.email(),
|
||||
this.password(),
|
||||
this.isNew()
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -105,8 +98,7 @@ class AccountPopupView extends AbstractViewNext
|
|||
|
||||
onShow(account) {
|
||||
this.clearPopup();
|
||||
if (account && account.canBeEdit())
|
||||
{
|
||||
if (account && account.canBeEdit()) {
|
||||
this.isNew(false);
|
||||
this.email(account.email);
|
||||
}
|
||||
|
|
@ -117,4 +109,4 @@ class AccountPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {AccountPopupView, AccountPopupView as default};
|
||||
export { AccountPopupView, AccountPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,25 +1,23 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {trim, isUnd} from 'Common/Utils';
|
||||
import {RAINLOOP_TRIAL_KEY} from 'Common/Consts';
|
||||
import {i18n, getNotification} from 'Common/Translator';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { trim, isUnd } from 'Common/Utils';
|
||||
import { RAINLOOP_TRIAL_KEY } from 'Common/Consts';
|
||||
import { i18n, getNotification } from 'Common/Translator';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
import LicenseStore from 'Stores/Admin/License';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Activate',
|
||||
templateID: 'PopupsActivate'
|
||||
})
|
||||
class ActivatePopupView extends AbstractViewNext
|
||||
{
|
||||
class ActivatePopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -34,7 +32,7 @@ class ActivatePopupView extends AbstractViewNext
|
|||
this.activateText = ko.observable('');
|
||||
this.activateText.isError = ko.observable(false);
|
||||
|
||||
this.htmlDescription = ko.computed(() => i18n('POPUPS_ACTIVATE/HTML_DESC', {'DOMAIN': this.domain()}));
|
||||
this.htmlDescription = ko.computed(() => i18n('POPUPS_ACTIVATE/HTML_DESC', { 'DOMAIN': this.domain() }));
|
||||
|
||||
this.key.subscribe(() => {
|
||||
this.activateText('');
|
||||
|
|
@ -42,54 +40,45 @@ class ActivatePopupView extends AbstractViewNext
|
|||
});
|
||||
|
||||
this.activationSuccessed.subscribe((value) => {
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
this.licenseTrigger(!this.licenseTrigger());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@command((self) => !self.activateProcess() && '' !== self.domain() && '' !== self.key() && !self.activationSuccessed())
|
||||
@command(
|
||||
(self) => !self.activateProcess() && '' !== self.domain() && '' !== self.key() && !self.activationSuccessed()
|
||||
)
|
||||
activateCommand() {
|
||||
|
||||
this.activateProcess(true);
|
||||
if (this.validateSubscriptionKey())
|
||||
{
|
||||
Remote.licensingActivate((sResult, oData) => {
|
||||
|
||||
this.activateProcess(false);
|
||||
if (StorageResultType.Success === sResult && oData.Result)
|
||||
{
|
||||
if (true === oData.Result)
|
||||
{
|
||||
this.activationSuccessed(true);
|
||||
this.activateText(i18n('POPUPS_ACTIVATE/SUBS_KEY_ACTIVATED'));
|
||||
this.activateText.isError(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.activateText(oData.Result);
|
||||
if (this.validateSubscriptionKey()) {
|
||||
Remote.licensingActivate(
|
||||
(sResult, oData) => {
|
||||
this.activateProcess(false);
|
||||
if (StorageResultType.Success === sResult && oData.Result) {
|
||||
if (true === oData.Result) {
|
||||
this.activationSuccessed(true);
|
||||
this.activateText(i18n('POPUPS_ACTIVATE/SUBS_KEY_ACTIVATED'));
|
||||
this.activateText.isError(false);
|
||||
} else {
|
||||
this.activateText(oData.Result);
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
} else if (oData.ErrorCode) {
|
||||
this.activateText(getNotification(oData.ErrorCode));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
} else {
|
||||
this.activateText(getNotification(Notification.UnknownError));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
{
|
||||
this.activateText(getNotification(oData.ErrorCode));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.activateText(getNotification(Notification.UnknownError));
|
||||
this.activateText.isError(true);
|
||||
this.key.focus(true);
|
||||
}
|
||||
|
||||
}, this.domain(), this.key().replace(/[^A-Z0-9\-]/gi, ''));
|
||||
}
|
||||
else
|
||||
{
|
||||
},
|
||||
this.domain(),
|
||||
this.key().replace(/[^A-Z0-9-]/gi, '')
|
||||
);
|
||||
} else {
|
||||
this.activateProcess(false);
|
||||
this.activateText(i18n('POPUPS_ACTIVATE/ERROR_INVALID_SUBS_KEY'));
|
||||
this.activateText.isError(true);
|
||||
|
|
@ -99,8 +88,7 @@ class ActivatePopupView extends AbstractViewNext
|
|||
|
||||
onShow(isTrial) {
|
||||
this.domain(Settings.settingsGet('AdminDomain'));
|
||||
if (!this.activateProcess())
|
||||
{
|
||||
if (!this.activateProcess()) {
|
||||
isTrial = isUnd(isTrial) ? false : !!isTrial;
|
||||
|
||||
this.key(isTrial ? RAINLOOP_TRIAL_KEY : '');
|
||||
|
|
@ -111,8 +99,7 @@ class ActivatePopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (!this.activateProcess())
|
||||
{
|
||||
if (!this.activateProcess()) {
|
||||
this.key.focus(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -122,8 +109,12 @@ class ActivatePopupView extends AbstractViewNext
|
|||
*/
|
||||
validateSubscriptionKey() {
|
||||
const value = this.key();
|
||||
return '' === value || RAINLOOP_TRIAL_KEY === value || !!(/^RL[\d]+-[A-Z0-9\-]+Z$/).test(trim(value).replace(/[^A-Z0-9\-]/gi, ''));
|
||||
return (
|
||||
'' === value ||
|
||||
RAINLOOP_TRIAL_KEY === value ||
|
||||
!!/^RL[\d]+-[A-Z0-9-]+Z$/.test(trim(value).replace(/[^A-Z0-9-]/gi, ''))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export {ActivatePopupView, ActivatePopupView as default};
|
||||
export { ActivatePopupView, ActivatePopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import {trim, delegateRun, log} from 'Common/Utils';
|
||||
import { trim, delegateRun, log } from 'Common/Utils';
|
||||
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/AddOpenPgpKey',
|
||||
templateID: 'PopupsAddOpenPgpKey'
|
||||
})
|
||||
class AddOpenPgpKeyPopupView extends AbstractViewNext
|
||||
{
|
||||
class AddOpenPgpKeyPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -31,50 +29,39 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
|
|||
|
||||
@command()
|
||||
addOpenPgpKeyCommand() {
|
||||
|
||||
const
|
||||
reg = /[\-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}[\s\S]+?[\-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[\-]{3,6}/gi,
|
||||
// eslint-disable-next-line max-len
|
||||
const reg = /[-]{3,6}BEGIN[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}[\s\S]+?[-]{3,6}END[\s]PGP[\s](PRIVATE|PUBLIC)[\s]KEY[\s]BLOCK[-]{3,6}/gi,
|
||||
openpgpKeyring = PgpStore.openpgpKeyring;
|
||||
|
||||
let keyTrimmed = trim(this.key());
|
||||
|
||||
if ((/[\n]/).test(keyTrimmed))
|
||||
{
|
||||
if (/[\n]/.test(keyTrimmed)) {
|
||||
keyTrimmed = keyTrimmed.replace(/[\r]+/g, '').replace(/[\n]{2,}/g, '\n\n');
|
||||
}
|
||||
|
||||
this.key.error('' === keyTrimmed);
|
||||
this.key.errorMessage('');
|
||||
|
||||
if (!openpgpKeyring || this.key.error())
|
||||
{
|
||||
if (!openpgpKeyring || this.key.error()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let
|
||||
match = null,
|
||||
let match = null,
|
||||
count = 30,
|
||||
done = false;
|
||||
|
||||
do
|
||||
{
|
||||
do {
|
||||
match = reg.exec(keyTrimmed);
|
||||
if (match && 0 < count)
|
||||
{
|
||||
if (match[0] && match[1] && match[2] && match[1] === match[2])
|
||||
{
|
||||
if (match && 0 < count) {
|
||||
if (match[0] && match[1] && match[2] && match[1] === match[2]) {
|
||||
let err = null;
|
||||
if ('PRIVATE' === match[1])
|
||||
{
|
||||
if ('PRIVATE' === match[1]) {
|
||||
err = openpgpKeyring.privateKeys.importKey(match[0]);
|
||||
}
|
||||
else if ('PUBLIC' === match[1])
|
||||
{
|
||||
} else if ('PUBLIC' === match[1]) {
|
||||
err = openpgpKeyring.publicKeys.importKey(match[0]);
|
||||
}
|
||||
|
||||
if (err)
|
||||
{
|
||||
if (err) {
|
||||
this.key.error(true);
|
||||
this.key.errorMessage(err && err[0] ? '' + err[0] : '');
|
||||
log(err);
|
||||
|
|
@ -83,20 +70,16 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
|
|||
|
||||
count -= 1;
|
||||
done = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
done = true;
|
||||
}
|
||||
}
|
||||
while (!done);
|
||||
} while (!done);
|
||||
|
||||
openpgpKeyring.store();
|
||||
|
||||
getApp().reloadOpenPgpKeys();
|
||||
|
||||
if (this.key.error())
|
||||
{
|
||||
if (this.key.error()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -119,4 +102,4 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default};
|
||||
export { AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {trim} from 'Common/Utils';
|
||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||
import {searchSubtractFormatDateHelper} from 'Common/Momentor';
|
||||
import { trim } from 'Common/Utils';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
import { searchSubtractFormatDateHelper } from 'Common/Momentor';
|
||||
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/AdvancedSearch',
|
||||
templateID: 'PopupsAdvancedSearch'
|
||||
})
|
||||
class AdvancedSearchPopupView extends AbstractViewNext
|
||||
{
|
||||
class AdvancedSearchPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -35,13 +33,13 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
this.selectedDates = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return [
|
||||
{id: -1, name: i18n('SEARCH/LABEL_ADV_DATE_ALL')},
|
||||
{id: 3, name: i18n('SEARCH/LABEL_ADV_DATE_3_DAYS')},
|
||||
{id: 7, name: i18n('SEARCH/LABEL_ADV_DATE_7_DAYS')},
|
||||
{id: 30, name: i18n('SEARCH/LABEL_ADV_DATE_MONTH')},
|
||||
{id: 90, name: i18n('SEARCH/LABEL_ADV_DATE_3_MONTHS')},
|
||||
{id: 180, name: i18n('SEARCH/LABEL_ADV_DATE_6_MONTHS')},
|
||||
{id: 365, name: i18n('SEARCH/LABEL_ADV_DATE_YEAR')}
|
||||
{ id: -1, name: i18n('SEARCH/LABEL_ADV_DATE_ALL') },
|
||||
{ id: 3, name: i18n('SEARCH/LABEL_ADV_DATE_3_DAYS') },
|
||||
{ id: 7, name: i18n('SEARCH/LABEL_ADV_DATE_7_DAYS') },
|
||||
{ id: 30, name: i18n('SEARCH/LABEL_ADV_DATE_MONTH') },
|
||||
{ id: 90, name: i18n('SEARCH/LABEL_ADV_DATE_3_MONTHS') },
|
||||
{ id: 180, name: i18n('SEARCH/LABEL_ADV_DATE_6_MONTHS') },
|
||||
{ id: 365, name: i18n('SEARCH/LABEL_ADV_DATE_YEAR') }
|
||||
];
|
||||
});
|
||||
}
|
||||
|
|
@ -49,8 +47,7 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
@command()
|
||||
searchCommand() {
|
||||
const search = this.buildSearchString();
|
||||
if ('' !== search)
|
||||
{
|
||||
if ('' !== search) {
|
||||
MessageStore.mainMessageListSearch(search);
|
||||
}
|
||||
|
||||
|
|
@ -60,14 +57,13 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
parseSearchStringValue(search) {
|
||||
const parts = (search || '').split(/[\s]+/g);
|
||||
_.each(parts, (part) => {
|
||||
switch (part)
|
||||
{
|
||||
switch (part) {
|
||||
case 'has:attachment':
|
||||
this.hasAttachment(true);
|
||||
break;
|
||||
case 'is:unseen,flagged':
|
||||
this.starred(true);
|
||||
/* falls through */
|
||||
/* falls through */
|
||||
case 'is:unseen':
|
||||
this.unseen(true);
|
||||
break;
|
||||
|
|
@ -77,16 +73,14 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
buildSearchStringValue(value) {
|
||||
if (-1 < value.indexOf(' '))
|
||||
{
|
||||
if (-1 < value.indexOf(' ')) {
|
||||
value = '"' + value + '"';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
buildSearchString() {
|
||||
const
|
||||
result = [],
|
||||
const result = [],
|
||||
from_ = trim(this.from()),
|
||||
to = trim(this.to()),
|
||||
subject = trim(this.subject()),
|
||||
|
|
@ -94,53 +88,43 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
isPart = [],
|
||||
hasPart = [];
|
||||
|
||||
if (from_ && '' !== from_)
|
||||
{
|
||||
if (from_ && '' !== from_) {
|
||||
result.push('from:' + this.buildSearchStringValue(from_));
|
||||
}
|
||||
|
||||
if (to && '' !== to)
|
||||
{
|
||||
if (to && '' !== to) {
|
||||
result.push('to:' + this.buildSearchStringValue(to));
|
||||
}
|
||||
|
||||
if (subject && '' !== subject)
|
||||
{
|
||||
if (subject && '' !== subject) {
|
||||
result.push('subject:' + this.buildSearchStringValue(subject));
|
||||
}
|
||||
|
||||
if (this.hasAttachment())
|
||||
{
|
||||
if (this.hasAttachment()) {
|
||||
hasPart.push('attachment');
|
||||
}
|
||||
|
||||
if (this.unseen())
|
||||
{
|
||||
if (this.unseen()) {
|
||||
isPart.push('unseen');
|
||||
}
|
||||
|
||||
if (this.starred())
|
||||
{
|
||||
if (this.starred()) {
|
||||
isPart.push('flagged');
|
||||
}
|
||||
|
||||
if (0 < hasPart.length)
|
||||
{
|
||||
if (0 < hasPart.length) {
|
||||
result.push('has:' + hasPart.join(','));
|
||||
}
|
||||
|
||||
if (0 < isPart.length)
|
||||
{
|
||||
if (0 < isPart.length) {
|
||||
result.push('is:' + isPart.join(','));
|
||||
}
|
||||
|
||||
if (-1 < this.selectedDateValue())
|
||||
{
|
||||
if (-1 < this.selectedDateValue()) {
|
||||
result.push('date:' + searchSubtractFormatDateHelper(this.selectedDateValue()) + '/');
|
||||
}
|
||||
|
||||
if (text && '' !== text)
|
||||
{
|
||||
if (text && '' !== text) {
|
||||
result.push('text:' + this.buildSearchStringValue(text));
|
||||
}
|
||||
|
||||
|
|
@ -171,4 +155,4 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {AdvancedSearchPopupView, AdvancedSearchPopupView as default};
|
||||
export { AdvancedSearchPopupView, AdvancedSearchPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import {KeyState} from 'Common/Enums';
|
||||
import {isFunc} from 'Common/Utils';
|
||||
import {i18n} from 'Common/Translator';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { isFunc } from 'Common/Utils';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
import {popup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Ask',
|
||||
templateID: 'PopupsAsk'
|
||||
})
|
||||
class AskPopupView extends AbstractViewNext
|
||||
{
|
||||
class AskPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -48,8 +46,7 @@ class AskPopupView extends AbstractViewNext
|
|||
yesClick() {
|
||||
this.cancelCommand();
|
||||
|
||||
if (isFunc(this.fYesAction))
|
||||
{
|
||||
if (isFunc(this.fYesAction)) {
|
||||
this.fYesAction.call(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -57,8 +54,7 @@ class AskPopupView extends AbstractViewNext
|
|||
noClick() {
|
||||
this.cancelCommand();
|
||||
|
||||
if (isFunc(this.fNoAction))
|
||||
{
|
||||
if (isFunc(this.fNoAction)) {
|
||||
this.fNoAction.call(null);
|
||||
}
|
||||
}
|
||||
|
|
@ -73,7 +69,6 @@ class AskPopupView extends AbstractViewNext
|
|||
* @returns {void}
|
||||
*/
|
||||
onShow(askDesc, fYesFunc = null, fNoFunc = null, yesButton = '', noButton = '', isFocusYesOnShow = true) {
|
||||
|
||||
this.clearPopup();
|
||||
|
||||
this.fYesAction = fYesFunc || null;
|
||||
|
|
@ -81,13 +76,11 @@ class AskPopupView extends AbstractViewNext
|
|||
|
||||
this.askDesc(askDesc || '');
|
||||
|
||||
if (yesButton)
|
||||
{
|
||||
if (yesButton) {
|
||||
this.yesButton(yesButton);
|
||||
}
|
||||
|
||||
if (noButton)
|
||||
{
|
||||
if (noButton) {
|
||||
this.noButton(noButton);
|
||||
}
|
||||
|
||||
|
|
@ -95,20 +88,16 @@ class AskPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (this.bFocusYesOnShow)
|
||||
{
|
||||
if (this.bFocusYesOnShow) {
|
||||
this.yesFocus(true);
|
||||
}
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
key('tab, shift+tab, right, left', KeyState.PopupAsk, () => {
|
||||
if (this.yesFocus())
|
||||
{
|
||||
if (this.yesFocus()) {
|
||||
this.noFocus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.yesFocus(true);
|
||||
}
|
||||
return false;
|
||||
|
|
@ -121,4 +110,4 @@ class AskPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {AskPopupView, AskPopupView as default};
|
||||
export { AskPopupView, AskPopupView as default };
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
|
|
@ -1,23 +1,19 @@
|
|||
|
||||
import _ from '_';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import {
|
||||
inArray, pString, log, isUnd, trim,
|
||||
defautOptionsAfterRender
|
||||
} from 'Common/Utils';
|
||||
import { inArray, pString, log, isUnd, trim, defautOptionsAfterRender } from 'Common/Utils';
|
||||
|
||||
import {Magics, KeyState} from 'Common/Enums';
|
||||
import {i18n} from 'Common/Translator';
|
||||
import { Magics, KeyState } from 'Common/Enums';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
|
||||
import {EmailModel} from 'Model/Email';
|
||||
import { EmailModel } from 'Model/Email';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const KEY_NAME_SUBSTR = -8;
|
||||
|
||||
|
|
@ -25,8 +21,7 @@ const KEY_NAME_SUBSTR = -8;
|
|||
name: 'View/Popup/ComposeOpenPgp',
|
||||
templateID: 'PopupsComposeOpenPgp'
|
||||
})
|
||||
class ComposeOpenPgpPopupView extends AbstractViewNext
|
||||
{
|
||||
class ComposeOpenPgpPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -49,14 +44,11 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
this.signKey = ko.observable(null);
|
||||
this.encryptKeys = ko.observableArray([]);
|
||||
|
||||
this.encryptKeysView = ko.computed(
|
||||
() => _.compact(_.map(this.encryptKeys(), (oKey) => (oKey ? oKey.key : null)))
|
||||
);
|
||||
this.encryptKeysView = ko.computed(() => _.compact(_.map(this.encryptKeys(), (oKey) => (oKey ? oKey.key : null))));
|
||||
|
||||
this.privateKeysOptions = ko.computed(() => {
|
||||
const opts = _.map(PgpStore.openpgpkeysPrivate(), (oKey, iIndex) => {
|
||||
if (this.signKey() && this.signKey().key.id === oKey.id)
|
||||
{
|
||||
if (this.signKey() && this.signKey().key.id === oKey.id) {
|
||||
return null;
|
||||
}
|
||||
return _.map(oKey.users, (user) => ({
|
||||
|
|
@ -72,8 +64,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
this.publicKeysOptions = ko.computed(() => {
|
||||
const opts = _.map(PgpStore.openpgpkeysPublic(), (oKey, index) => {
|
||||
if (-1 < inArray(oKey, this.encryptKeysView()))
|
||||
{
|
||||
if (-1 < inArray(oKey, this.encryptKeysView())) {
|
||||
return null;
|
||||
}
|
||||
return _.map(oKey.users, (user) => ({
|
||||
|
|
@ -91,16 +82,14 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
this.resultCallback = null;
|
||||
|
||||
this.selectedPrivateKey.subscribe((value) => {
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
this.selectCommand();
|
||||
this.updateCommand();
|
||||
}
|
||||
});
|
||||
|
||||
this.selectedPublicKey.subscribe((value) => {
|
||||
if (value)
|
||||
{
|
||||
if (value) {
|
||||
this.addCommand();
|
||||
}
|
||||
});
|
||||
|
|
@ -110,11 +99,9 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
this.defautOptionsAfterRender = defautOptionsAfterRender;
|
||||
|
||||
this.addOptionClass = (domOption, item) => {
|
||||
|
||||
this.defautOptionsAfterRender(domOption, item);
|
||||
|
||||
if (item && !isUnd(item.class) && domOption)
|
||||
{
|
||||
if (item && !isUnd(item.class) && domOption) {
|
||||
$(domOption).addClass(item.class);
|
||||
}
|
||||
};
|
||||
|
|
@ -124,155 +111,130 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest() && (self.sign() || self.encrypt()))
|
||||
doCommand() {
|
||||
|
||||
let
|
||||
result = true,
|
||||
let result = true,
|
||||
privateKey = null,
|
||||
aPublicKeys = [];
|
||||
|
||||
this.submitRequest(true);
|
||||
|
||||
if (result && this.sign())
|
||||
{
|
||||
if (!this.signKey())
|
||||
{
|
||||
if (result && this.sign()) {
|
||||
if (!this.signKey()) {
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
|
||||
result = false;
|
||||
}
|
||||
else if (!this.signKey().key)
|
||||
{
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
|
||||
'EMAIL': this.signKey().email
|
||||
}));
|
||||
} else if (!this.signKey().key) {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND_FOR', {
|
||||
'EMAIL': this.signKey().email
|
||||
})
|
||||
);
|
||||
|
||||
result = false;
|
||||
}
|
||||
|
||||
if (result)
|
||||
{
|
||||
if (result) {
|
||||
const privateKeys = this.signKey().key.getNativeKeys();
|
||||
privateKey = privateKeys[0] || null;
|
||||
|
||||
try
|
||||
{
|
||||
if (privateKey)
|
||||
{
|
||||
try {
|
||||
if (privateKey) {
|
||||
privateKey.decrypt(pString(this.password()));
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
} catch (e) {
|
||||
privateKey = null;
|
||||
}
|
||||
|
||||
if (!privateKey)
|
||||
{
|
||||
if (!privateKey) {
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result && this.encrypt())
|
||||
{
|
||||
if (0 === this.encryptKeys().length)
|
||||
{
|
||||
if (result && this.encrypt()) {
|
||||
if (0 === this.encryptKeys().length) {
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
|
||||
result = false;
|
||||
}
|
||||
else if (this.encryptKeys())
|
||||
{
|
||||
} else if (this.encryptKeys()) {
|
||||
aPublicKeys = [];
|
||||
|
||||
_.each(this.encryptKeys(), (oKey) => {
|
||||
if (oKey && oKey.key)
|
||||
{
|
||||
if (oKey && oKey.key) {
|
||||
aPublicKeys = aPublicKeys.concat(_.compact(_.flatten(oKey.key.getNativeKeys())));
|
||||
}
|
||||
else if (oKey && oKey.email)
|
||||
{
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
|
||||
'EMAIL': oKey.email
|
||||
}));
|
||||
} else if (oKey && oKey.email) {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND_FOR', {
|
||||
'EMAIL': oKey.email
|
||||
})
|
||||
);
|
||||
|
||||
result = false;
|
||||
}
|
||||
});
|
||||
|
||||
if (result && (0 === aPublicKeys.length || this.encryptKeys().length !== aPublicKeys.length))
|
||||
{
|
||||
if (result && (0 === aPublicKeys.length || this.encryptKeys().length !== aPublicKeys.length)) {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (result && this.resultCallback)
|
||||
{
|
||||
if (result && this.resultCallback) {
|
||||
_.delay(() => {
|
||||
|
||||
let pgpPromise = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (privateKey && 0 === aPublicKeys.length)
|
||||
{
|
||||
try {
|
||||
if (privateKey && 0 === aPublicKeys.length) {
|
||||
pgpPromise = PgpStore.openpgp.sign({
|
||||
data: this.text(),
|
||||
privateKeys: [privateKey]
|
||||
});
|
||||
}
|
||||
else if (privateKey && 0 < aPublicKeys.length)
|
||||
{
|
||||
} else if (privateKey && 0 < aPublicKeys.length) {
|
||||
pgpPromise = PgpStore.openpgp.encrypt({
|
||||
data: this.text(),
|
||||
publicKeys: aPublicKeys,
|
||||
privateKeys: [privateKey]
|
||||
});
|
||||
}
|
||||
else if (!privateKey && 0 < aPublicKeys.length)
|
||||
{
|
||||
} else if (!privateKey && 0 < aPublicKeys.length) {
|
||||
pgpPromise = PgpStore.openpgp.encrypt({
|
||||
data: this.text(),
|
||||
publicKeys: aPublicKeys
|
||||
});
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
} catch (e) {
|
||||
log(e);
|
||||
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
}));
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
if (pgpPromise)
|
||||
{
|
||||
try
|
||||
{
|
||||
pgpPromise.then((mData) => {
|
||||
this.resultCallback(mData.data);
|
||||
this.cancelCommand();
|
||||
}).catch((e) => {
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
if (pgpPromise) {
|
||||
try {
|
||||
pgpPromise
|
||||
.then((mData) => {
|
||||
this.resultCallback(mData.data);
|
||||
this.cancelCommand();
|
||||
})
|
||||
.catch((e) => {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
})
|
||||
);
|
||||
});
|
||||
} catch (e) {
|
||||
this.notification(
|
||||
i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
}));
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
this.notification(i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
|
||||
'ERROR': '' + e
|
||||
}));
|
||||
})
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
this.submitRequest(false);
|
||||
|
||||
}, Magics.Time20ms);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.submitRequest(false);
|
||||
}
|
||||
|
||||
|
|
@ -281,12 +243,10 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
@command()
|
||||
selectCommand() {
|
||||
const
|
||||
keyId = this.selectedPrivateKey(),
|
||||
const keyId = this.selectedPrivateKey(),
|
||||
option = keyId ? _.find(this.privateKeysOptions(), (item) => item && keyId === item.id) : null;
|
||||
|
||||
if (option)
|
||||
{
|
||||
if (option) {
|
||||
this.signKey({
|
||||
'empty': !option.key,
|
||||
'selected': ko.observable(!!option.key),
|
||||
|
|
@ -299,14 +259,11 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
@command()
|
||||
addCommand() {
|
||||
|
||||
const
|
||||
keyId = this.selectedPublicKey(),
|
||||
const keyId = this.selectedPublicKey(),
|
||||
keys = this.encryptKeys(),
|
||||
option = keyId ? _.find(this.publicKeysOptions(), (item) => (item && keyId === item.id)) : null;
|
||||
option = keyId ? _.find(this.publicKeysOptions(), (item) => item && keyId === item.id) : null;
|
||||
|
||||
if (option)
|
||||
{
|
||||
if (option) {
|
||||
keys.push({
|
||||
'empty': !option.key,
|
||||
'selected': ko.observable(!!option.key),
|
||||
|
|
@ -350,8 +307,7 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
onBuild() {
|
||||
key('tab,shift+tab', KeyState.PopupComposeOpenPGP, () => {
|
||||
switch (true)
|
||||
{
|
||||
switch (true) {
|
||||
case this.password.focus():
|
||||
this.buttonFocus(true);
|
||||
break;
|
||||
|
|
@ -369,58 +325,50 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (this.sign())
|
||||
{
|
||||
if (this.sign()) {
|
||||
this.password.focus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.buttonFocus(true);
|
||||
}
|
||||
}
|
||||
|
||||
onShow(fCallback, sText, identity, sTo, sCc, sBcc) {
|
||||
|
||||
this.clearPopup();
|
||||
|
||||
let
|
||||
rec = [],
|
||||
let rec = [],
|
||||
emailLine = '';
|
||||
|
||||
const email = new EmailModel();
|
||||
|
||||
this.resultCallback = fCallback;
|
||||
|
||||
if ('' !== sTo)
|
||||
{
|
||||
if ('' !== sTo) {
|
||||
rec.push(sTo);
|
||||
}
|
||||
|
||||
if ('' !== sCc)
|
||||
{
|
||||
if ('' !== sCc) {
|
||||
rec.push(sCc);
|
||||
}
|
||||
|
||||
if ('' !== sBcc)
|
||||
{
|
||||
if ('' !== sBcc) {
|
||||
rec.push(sBcc);
|
||||
}
|
||||
|
||||
rec = rec.join(', ').split(',');
|
||||
rec = _.compact(_.map(rec, (value) => {
|
||||
email.clear();
|
||||
email.parse(trim(value));
|
||||
return '' === email.email ? false : email.email;
|
||||
}));
|
||||
rec = _.compact(
|
||||
_.map(rec, (value) => {
|
||||
email.clear();
|
||||
email.parse(trim(value));
|
||||
return '' === email.email ? false : email.email;
|
||||
})
|
||||
);
|
||||
|
||||
if (identity && identity.email())
|
||||
{
|
||||
if (identity && identity.email()) {
|
||||
emailLine = identity.email();
|
||||
rec.unshift(emailLine);
|
||||
|
||||
const keys = PgpStore.findAllPrivateKeysByEmailNotNative(emailLine);
|
||||
if (keys && keys[0])
|
||||
{
|
||||
if (keys && keys[0]) {
|
||||
this.signKey({
|
||||
'users': keys[0].users || [emailLine],
|
||||
'hash': keys[0].id.substr(KEY_NAME_SUBSTR).toUpperCase(),
|
||||
|
|
@ -429,27 +377,38 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
if (this.signKey())
|
||||
{
|
||||
if (this.signKey()) {
|
||||
this.sign(true);
|
||||
}
|
||||
|
||||
if (rec && 0 < rec.length)
|
||||
{
|
||||
this.encryptKeys(_.uniq(_.compact(_.flatten(_.map(rec, (recEmail) => {
|
||||
const keys = PgpStore.findAllPublicKeysByEmailNotNative(recEmail);
|
||||
return keys ? _.map(keys, (publicKey) => ({
|
||||
'empty': !publicKey,
|
||||
'selected': ko.observable(!!publicKey),
|
||||
'removable': ko.observable(!this.sign() || !this.signKey() || this.signKey().key.id !== publicKey.id),
|
||||
'users': publicKey ? (publicKey.users || [recEmail]) : [recEmail],
|
||||
'hash': publicKey ? publicKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() : '',
|
||||
'key': publicKey
|
||||
})) : [];
|
||||
}), true)), (encryptKey) => encryptKey.hash));
|
||||
if (rec && 0 < rec.length) {
|
||||
this.encryptKeys(
|
||||
_.uniq(
|
||||
_.compact(
|
||||
_.flatten(
|
||||
_.map(rec, (recEmail) => {
|
||||
const keys = PgpStore.findAllPublicKeysByEmailNotNative(recEmail);
|
||||
return keys
|
||||
? _.map(keys, (publicKey) => ({
|
||||
'empty': !publicKey,
|
||||
'selected': ko.observable(!!publicKey),
|
||||
'removable': ko.observable(
|
||||
!this.sign() || !this.signKey() || this.signKey().key.id !== publicKey.id
|
||||
),
|
||||
'users': publicKey ? publicKey.users || [recEmail] : [recEmail],
|
||||
'hash': publicKey ? publicKey.id.substr(KEY_NAME_SUBSTR).toUpperCase() : '',
|
||||
'key': publicKey
|
||||
}))
|
||||
: [];
|
||||
}),
|
||||
true
|
||||
)
|
||||
),
|
||||
(encryptKey) => encryptKey.hash
|
||||
)
|
||||
);
|
||||
|
||||
if (0 < this.encryptKeys().length)
|
||||
{
|
||||
if (0 < this.encryptKeys().length) {
|
||||
this.encrypt(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -458,4 +417,4 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {ComposeOpenPgpPopupView, ComposeOpenPgpPopupView as default};
|
||||
export { ComposeOpenPgpPopupView, ComposeOpenPgpPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import window from 'window';
|
||||
import _ from '_';
|
||||
import $ from '$';
|
||||
|
|
@ -7,22 +6,34 @@ import key from 'key';
|
|||
import Jua from 'Jua';
|
||||
|
||||
import {
|
||||
SaveSettingsStep, ContactPropertyType, ComposeType,
|
||||
Capa, Magics, StorageResultType, Notification, KeyState
|
||||
SaveSettingsStep,
|
||||
ContactPropertyType,
|
||||
ComposeType,
|
||||
Capa,
|
||||
Magics,
|
||||
StorageResultType,
|
||||
Notification,
|
||||
KeyState
|
||||
} from 'Common/Enums';
|
||||
|
||||
import {
|
||||
delegateRunOnDestroy, computedPagenatorHelper,
|
||||
inArray, trim, windowResizeCallback,
|
||||
isNonEmptyArray, fakeMd5, pInt, isUnd
|
||||
delegateRunOnDestroy,
|
||||
computedPagenatorHelper,
|
||||
inArray,
|
||||
trim,
|
||||
windowResizeCallback,
|
||||
isNonEmptyArray,
|
||||
fakeMd5,
|
||||
pInt,
|
||||
isUnd
|
||||
} from 'Common/Utils';
|
||||
|
||||
import {CONTACTS_PER_PAGE} from 'Common/Consts';
|
||||
import {bMobileDevice} from 'Common/Globals';
|
||||
import { CONTACTS_PER_PAGE } from 'Common/Consts';
|
||||
import { bMobileDevice } from 'Common/Globals';
|
||||
|
||||
import {Selector} from 'Common/Selector';
|
||||
import {exportContactsVcf, exportContactsCsv, uploadContacts} from 'Common/Links';
|
||||
import {i18n, getNotification} from 'Common/Translator';
|
||||
import { Selector } from 'Common/Selector';
|
||||
import { exportContactsVcf, exportContactsCsv, uploadContacts } from 'Common/Links';
|
||||
import { i18n, getNotification } from 'Common/Translator';
|
||||
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
import ContactStore from 'Stores/User/Contact';
|
||||
|
|
@ -31,31 +42,29 @@ import Remote from 'Remote/User/Ajax';
|
|||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {EmailModel} from 'Model/Email';
|
||||
import {ContactModel} from 'Model/Contact';
|
||||
import {ContactPropertyModel} from 'Model/ContactProperty';
|
||||
import { EmailModel } from 'Model/Email';
|
||||
import { ContactModel } from 'Model/Contact';
|
||||
import { ContactPropertyModel } from 'Model/ContactProperty';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Contacts',
|
||||
templateID: 'PopupsContacts'
|
||||
})
|
||||
class ContactsPopupView extends AbstractViewNext
|
||||
{
|
||||
class ContactsPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
const
|
||||
fFastClearEmptyListHelper = (list) => {
|
||||
if (list && 0 < list.length) {
|
||||
this.viewProperties.removeAll(list);
|
||||
delegateRunOnDestroy(list);
|
||||
}
|
||||
};
|
||||
const fFastClearEmptyListHelper = (list) => {
|
||||
if (list && 0 < list.length) {
|
||||
this.viewProperties.removeAll(list);
|
||||
delegateRunOnDestroy(list);
|
||||
}
|
||||
};
|
||||
|
||||
this.bBackToCompose = false;
|
||||
this.sLastComposeFocusedField = '';
|
||||
|
|
@ -98,36 +107,28 @@ class ContactsPopupView extends AbstractViewNext
|
|||
// );
|
||||
|
||||
this.viewPropertiesOther = ko.computed(() => {
|
||||
const list = _.filter(this.viewProperties(),
|
||||
const list = _.filter(
|
||||
this.viewProperties(),
|
||||
(property) => -1 < inArray(property.type(), [ContactPropertyType.Nick])
|
||||
);
|
||||
return _.sortBy(list, (property) => property.type());
|
||||
});
|
||||
|
||||
this.viewPropertiesEmails = this.viewProperties.filter(
|
||||
(property) => ContactPropertyType.Email === property.type()
|
||||
);
|
||||
this.viewPropertiesEmails = this.viewProperties.filter((property) => ContactPropertyType.Email === property.type());
|
||||
|
||||
this.viewPropertiesWeb = this.viewProperties.filter(
|
||||
(property) => ContactPropertyType.Web === property.type()
|
||||
);
|
||||
this.viewPropertiesWeb = this.viewProperties.filter((property) => ContactPropertyType.Web === property.type());
|
||||
|
||||
this.viewHasNonEmptyRequaredProperties = ko.computed(() => {
|
||||
const
|
||||
names = this.viewPropertiesNames(),
|
||||
const names = this.viewPropertiesNames(),
|
||||
emails = this.viewPropertiesEmails(),
|
||||
fFilter = (property) => '' !== trim(property.value());
|
||||
|
||||
return !!(_.find(names, fFilter) || _.find(emails, fFilter));
|
||||
});
|
||||
|
||||
this.viewPropertiesPhones = this.viewProperties.filter(
|
||||
(property) => ContactPropertyType.Phone === property.type()
|
||||
);
|
||||
this.viewPropertiesPhones = this.viewProperties.filter((property) => ContactPropertyType.Phone === property.type());
|
||||
|
||||
this.viewPropertiesEmailsNonEmpty = this.viewPropertiesNames.filter(
|
||||
(property) => '' !== trim(property.value())
|
||||
);
|
||||
this.viewPropertiesEmailsNonEmpty = this.viewPropertiesNames.filter((property) => '' !== trim(property.value()));
|
||||
|
||||
this.viewPropertiesEmailsEmptyAndOnFocused = this.viewPropertiesEmails.filter((property) => {
|
||||
const foc = property.focused();
|
||||
|
|
@ -144,8 +145,8 @@ class ContactsPopupView extends AbstractViewNext
|
|||
return '' === trim(property.value()) && !foc;
|
||||
});
|
||||
|
||||
this.viewPropertiesOtherEmptyAndOnFocused = ko.computed(
|
||||
() => _.filter(this.viewPropertiesOther(), (property) => {
|
||||
this.viewPropertiesOtherEmptyAndOnFocused = ko.computed(() =>
|
||||
_.filter(this.viewPropertiesOther(), (property) => {
|
||||
const foc = property.focused();
|
||||
return '' === trim(property.value()) && !foc;
|
||||
})
|
||||
|
|
@ -178,31 +179,32 @@ class ContactsPopupView extends AbstractViewNext
|
|||
this.contacts.subscribe(windowResizeCallback);
|
||||
this.viewProperties.subscribe(windowResizeCallback);
|
||||
|
||||
this.contactsChecked = ko.computed(
|
||||
() => _.filter(this.contacts(), (item) => item.checked())
|
||||
);
|
||||
this.contactsChecked = ko.computed(() => _.filter(this.contacts(), (item) => item.checked()));
|
||||
|
||||
this.contactsCheckedOrSelected = ko.computed(() => {
|
||||
const
|
||||
checked = this.contactsChecked(),
|
||||
const checked = this.contactsChecked(),
|
||||
selected = this.currentContact();
|
||||
|
||||
return _.union(checked, selected ? [selected] : []);
|
||||
});
|
||||
|
||||
this.contactsCheckedOrSelectedUids = ko.computed(
|
||||
() => _.map(this.contactsCheckedOrSelected(), (contact) => contact.idContact)
|
||||
this.contactsCheckedOrSelectedUids = ko.computed(() =>
|
||||
_.map(this.contactsCheckedOrSelected(), (contact) => contact.idContact)
|
||||
);
|
||||
|
||||
this.selector = new Selector(
|
||||
this.contacts, this.currentContact, null,
|
||||
'.e-contact-item .actionHandle', '.e-contact-item.selected',
|
||||
'.e-contact-item .checkboxItem', '.e-contact-item.focused');
|
||||
this.contacts,
|
||||
this.currentContact,
|
||||
null,
|
||||
'.e-contact-item .actionHandle',
|
||||
'.e-contact-item.selected',
|
||||
'.e-contact-item .checkboxItem',
|
||||
'.e-contact-item.focused'
|
||||
);
|
||||
|
||||
this.selector.on('onItemSelect', (contact) => {
|
||||
this.populateViewContact(contact ? contact : null);
|
||||
if (!contact)
|
||||
{
|
||||
if (!contact) {
|
||||
this.emptySelection(true);
|
||||
}
|
||||
});
|
||||
|
|
@ -219,8 +221,7 @@ class ContactsPopupView extends AbstractViewNext
|
|||
// this.saveCommandDebounce = _.debounce(_.bind(this.saveCommand, this), 1000);
|
||||
|
||||
this.viewHash.subscribe(() => {
|
||||
if (this.watchHash() && !this.viewReadOnly() && !this.watchDirty())
|
||||
{
|
||||
if (this.watchHash() && !this.viewReadOnly() && !this.watchDirty()) {
|
||||
this.watchDirty(true);
|
||||
}
|
||||
});
|
||||
|
|
@ -242,30 +243,23 @@ class ContactsPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => 0 < self.contactsCheckedOrSelected().length)
|
||||
newMessageCommand() {
|
||||
|
||||
if (!Settings.capa(Capa.Composer))
|
||||
{
|
||||
if (!Settings.capa(Capa.Composer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
let
|
||||
aE = [],
|
||||
let aE = [],
|
||||
toEmails = null,
|
||||
ccEmails = null,
|
||||
bccEmails = null;
|
||||
|
||||
const aC = this.contactsCheckedOrSelected();
|
||||
if (isNonEmptyArray(aC))
|
||||
{
|
||||
if (isNonEmptyArray(aC)) {
|
||||
aE = _.map(aC, (oItem) => {
|
||||
if (oItem)
|
||||
{
|
||||
const
|
||||
data = oItem.getNameAndEmailHelper(),
|
||||
if (oItem) {
|
||||
const data = oItem.getNameAndEmailHelper(),
|
||||
email = data ? new EmailModel(data[0], data[1]) : null;
|
||||
|
||||
if (email && email.validate())
|
||||
{
|
||||
if (email && email.validate()) {
|
||||
return email;
|
||||
}
|
||||
}
|
||||
|
|
@ -276,14 +270,12 @@ class ContactsPopupView extends AbstractViewNext
|
|||
aE = _.compact(aE);
|
||||
}
|
||||
|
||||
if (isNonEmptyArray(aE))
|
||||
{
|
||||
if (isNonEmptyArray(aE)) {
|
||||
this.bBackToCompose = false;
|
||||
|
||||
hideScreenPopup(ContactsPopupView);
|
||||
|
||||
switch (this.sLastComposeFocusedField)
|
||||
{
|
||||
switch (this.sLastComposeFocusedField) {
|
||||
case 'cc':
|
||||
ccEmails = aE;
|
||||
break;
|
||||
|
|
@ -312,67 +304,66 @@ class ContactsPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
@command((self) => {
|
||||
const
|
||||
bV = self.viewHasNonEmptyRequaredProperties(),
|
||||
const bV = self.viewHasNonEmptyRequaredProperties(),
|
||||
bReadOnly = self.viewReadOnly();
|
||||
return !self.viewSaving() && bV && !bReadOnly;
|
||||
})
|
||||
saveCommand() {
|
||||
|
||||
this.viewSaving(true);
|
||||
this.viewSaveTrigger(SaveSettingsStep.Animate);
|
||||
|
||||
const
|
||||
requestUid = fakeMd5(),
|
||||
const requestUid = fakeMd5(),
|
||||
properties = [];
|
||||
|
||||
_.each(this.viewProperties(), (oItem) => {
|
||||
if (oItem.type() && oItem.type() !== ContactPropertyType.FullName && '' !== trim(oItem.value()))
|
||||
{
|
||||
if (oItem.type() && oItem.type() !== ContactPropertyType.FullName && '' !== trim(oItem.value())) {
|
||||
properties.push([oItem.type(), oItem.value(), oItem.typeStr()]);
|
||||
}
|
||||
});
|
||||
|
||||
Remote.contactSave((sResult, oData) => {
|
||||
Remote.contactSave(
|
||||
(sResult, oData) => {
|
||||
let res = false;
|
||||
this.viewSaving(false);
|
||||
|
||||
let res = false;
|
||||
this.viewSaving(false);
|
||||
if (
|
||||
StorageResultType.Success === sResult &&
|
||||
oData &&
|
||||
oData.Result &&
|
||||
oData.Result.RequestUid === requestUid &&
|
||||
0 < pInt(oData.Result.ResultID)
|
||||
) {
|
||||
if ('' === this.viewID()) {
|
||||
this.viewID(pInt(oData.Result.ResultID));
|
||||
}
|
||||
|
||||
if (StorageResultType.Success === sResult && oData && oData.Result &&
|
||||
oData.Result.RequestUid === requestUid && 0 < pInt(oData.Result.ResultID))
|
||||
{
|
||||
if ('' === this.viewID())
|
||||
{
|
||||
this.viewID(pInt(oData.Result.ResultID));
|
||||
this.reloadContactList();
|
||||
res = true;
|
||||
}
|
||||
|
||||
this.reloadContactList();
|
||||
res = true;
|
||||
}
|
||||
|
||||
_.delay(() => {
|
||||
this.viewSaveTrigger(res ? SaveSettingsStep.TrueResult : SaveSettingsStep.FalseResult);
|
||||
}, Magics.Time350ms);
|
||||
|
||||
if (res)
|
||||
{
|
||||
this.watchDirty(false);
|
||||
|
||||
_.delay(() => {
|
||||
this.viewSaveTrigger(SaveSettingsStep.Idle);
|
||||
}, Magics.Time1s);
|
||||
}
|
||||
this.viewSaveTrigger(res ? SaveSettingsStep.TrueResult : SaveSettingsStep.FalseResult);
|
||||
}, Magics.Time350ms);
|
||||
|
||||
}, requestUid, this.viewID(), properties);
|
||||
if (res) {
|
||||
this.watchDirty(false);
|
||||
|
||||
_.delay(() => {
|
||||
this.viewSaveTrigger(SaveSettingsStep.Idle);
|
||||
}, Magics.Time1s);
|
||||
}
|
||||
},
|
||||
requestUid,
|
||||
this.viewID(),
|
||||
properties
|
||||
);
|
||||
}
|
||||
|
||||
@command((self) => !self.contacts.syncing() && !self.contacts.importing())
|
||||
syncCommand() {
|
||||
getApp().contactsSync((result, data) => {
|
||||
if (StorageResultType.Success !== result || !data || !data.Result)
|
||||
{
|
||||
window.alert(getNotification(
|
||||
data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
|
||||
if (StorageResultType.Success !== result || !data || !data.Result) {
|
||||
window.alert(getNotification(data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
|
||||
}
|
||||
|
||||
this.reloadContactList(true);
|
||||
|
|
@ -381,8 +372,7 @@ class ContactsPopupView extends AbstractViewNext
|
|||
|
||||
getPropertyPlaceholder(type) {
|
||||
let result = '';
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case ContactPropertyType.LastName:
|
||||
result = 'CONTACTS/PLACEHOLDER_ENTER_LAST_NAME';
|
||||
break;
|
||||
|
|
@ -399,17 +389,16 @@ class ContactsPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
addNewProperty(type, typeStr) {
|
||||
this.viewProperties.push(new ContactPropertyModel(type, typeStr || '', '', true, this.getPropertyPlaceholder(type)));
|
||||
this.viewProperties.push(
|
||||
new ContactPropertyModel(type, typeStr || '', '', true, this.getPropertyPlaceholder(type))
|
||||
);
|
||||
}
|
||||
|
||||
addNewOrFocusProperty(type, typeStr) {
|
||||
const item = _.find(this.viewProperties(), (prop) => type === prop.type());
|
||||
if (item)
|
||||
{
|
||||
if (item) {
|
||||
item.focused(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.addNewProperty(type, typeStr);
|
||||
}
|
||||
}
|
||||
|
|
@ -447,53 +436,42 @@ class ContactsPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
initUploader() {
|
||||
if (this.importUploaderButton())
|
||||
{
|
||||
const
|
||||
j = new Jua({
|
||||
'action': uploadContacts(),
|
||||
'name': 'uploader',
|
||||
'queueSize': 1,
|
||||
'multipleSizeLimit': 1,
|
||||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'disableDocumentDropPrevent': true,
|
||||
'clickElement': this.importUploaderButton()
|
||||
});
|
||||
if (this.importUploaderButton()) {
|
||||
const j = new Jua({
|
||||
'action': uploadContacts(),
|
||||
'name': 'uploader',
|
||||
'queueSize': 1,
|
||||
'multipleSizeLimit': 1,
|
||||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'disableDocumentDropPrevent': true,
|
||||
'clickElement': this.importUploaderButton()
|
||||
});
|
||||
|
||||
if (j)
|
||||
{
|
||||
j
|
||||
.on('onStart', () => {
|
||||
this.contacts.importing(true);
|
||||
})
|
||||
.on('onComplete', (id, result, data) => {
|
||||
this.contacts.importing(false);
|
||||
this.reloadContactList();
|
||||
if (!id || !result || !data || !data.Result)
|
||||
{
|
||||
window.alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
||||
}
|
||||
});
|
||||
if (j) {
|
||||
j.on('onStart', () => {
|
||||
this.contacts.importing(true);
|
||||
}).on('onComplete', (id, result, data) => {
|
||||
this.contacts.importing(false);
|
||||
this.reloadContactList();
|
||||
if (!id || !result || !data || !data.Result) {
|
||||
window.alert(i18n('CONTACTS/ERROR_IMPORT_FILE'));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeCheckedOrSelectedContactsFromList() {
|
||||
const
|
||||
koContacts = this.contacts,
|
||||
const koContacts = this.contacts,
|
||||
contacts = this.contactsCheckedOrSelected();
|
||||
|
||||
let
|
||||
currentContact = this.currentContact(),
|
||||
let currentContact = this.currentContact(),
|
||||
count = this.contacts().length;
|
||||
|
||||
if (0 < contacts.length)
|
||||
{
|
||||
if (0 < contacts.length) {
|
||||
_.each(contacts, (contact) => {
|
||||
|
||||
if (currentContact && currentContact.idContact === contact.idContact)
|
||||
{
|
||||
if (currentContact && currentContact.idContact === contact.idContact) {
|
||||
currentContact = null;
|
||||
this.currentContact(null);
|
||||
}
|
||||
|
|
@ -502,8 +480,7 @@ class ContactsPopupView extends AbstractViewNext
|
|||
count -= 1;
|
||||
});
|
||||
|
||||
if (0 >= count)
|
||||
{
|
||||
if (0 >= count) {
|
||||
this.bDropPageAfterDelete = true;
|
||||
}
|
||||
|
||||
|
|
@ -517,12 +494,8 @@ class ContactsPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
deleteSelectedContacts() {
|
||||
if (0 < this.contactsCheckedOrSelected().length)
|
||||
{
|
||||
Remote.contactsDelete(
|
||||
_.bind(this.deleteResponse, this),
|
||||
this.contactsCheckedOrSelectedUids()
|
||||
);
|
||||
if (0 < this.contactsCheckedOrSelected().length) {
|
||||
Remote.contactsDelete(_.bind(this.deleteResponse, this), this.contactsCheckedOrSelectedUids());
|
||||
|
||||
this.removeCheckedOrSelectedContactsFromList();
|
||||
}
|
||||
|
|
@ -533,12 +506,9 @@ class ContactsPopupView extends AbstractViewNext
|
|||
* @param {AjaxJsonDefaultResponse} oData
|
||||
*/
|
||||
deleteResponse(sResult, oData) {
|
||||
if (Magics.Time500ms < (StorageResultType.Success === sResult && oData && oData.Time ? pInt(oData.Time) : 0))
|
||||
{
|
||||
if (Magics.Time500ms < (StorageResultType.Success === sResult && oData && oData.Time ? pInt(oData.Time) : 0)) {
|
||||
this.reloadContactList(this.bDropPageAfterDelete);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_.delay(() => {
|
||||
this.reloadContactList(this.bDropPageAfterDelete);
|
||||
}, Magics.Time500ms);
|
||||
|
|
@ -554,36 +524,26 @@ class ContactsPopupView extends AbstractViewNext
|
|||
* @param {?ContactModel} contact
|
||||
*/
|
||||
populateViewContact(contact) {
|
||||
let
|
||||
id = '',
|
||||
let id = '',
|
||||
lastName = '',
|
||||
firstName = '';
|
||||
const
|
||||
list = [];
|
||||
const list = [];
|
||||
|
||||
this.watchHash(false);
|
||||
|
||||
this.emptySelection(false);
|
||||
this.viewReadOnly(false);
|
||||
|
||||
if (contact)
|
||||
{
|
||||
if (contact) {
|
||||
id = contact.idContact;
|
||||
if (isNonEmptyArray(contact.properties))
|
||||
{
|
||||
if (isNonEmptyArray(contact.properties)) {
|
||||
_.each(contact.properties, (property) => {
|
||||
if (property && property[0])
|
||||
{
|
||||
if (ContactPropertyType.LastName === property[0])
|
||||
{
|
||||
if (property && property[0]) {
|
||||
if (ContactPropertyType.LastName === property[0]) {
|
||||
lastName = property[1];
|
||||
}
|
||||
else if (ContactPropertyType.FirstName === property[0])
|
||||
{
|
||||
} else if (ContactPropertyType.FirstName === property[0]) {
|
||||
firstName = property[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
list.push(new ContactPropertyModel(property[0], property[2] || '', property[1]));
|
||||
}
|
||||
}
|
||||
|
|
@ -593,11 +553,25 @@ class ContactsPopupView extends AbstractViewNext
|
|||
this.viewReadOnly(!!contact.readOnly);
|
||||
}
|
||||
|
||||
list.unshift(new ContactPropertyModel(ContactPropertyType.LastName, '', lastName, false,
|
||||
this.getPropertyPlaceholder(ContactPropertyType.LastName)));
|
||||
list.unshift(
|
||||
new ContactPropertyModel(
|
||||
ContactPropertyType.LastName,
|
||||
'',
|
||||
lastName,
|
||||
false,
|
||||
this.getPropertyPlaceholder(ContactPropertyType.LastName)
|
||||
)
|
||||
);
|
||||
|
||||
list.unshift(new ContactPropertyModel(ContactPropertyType.FirstName, '', firstName, !contact,
|
||||
this.getPropertyPlaceholder(ContactPropertyType.FirstName)));
|
||||
list.unshift(
|
||||
new ContactPropertyModel(
|
||||
ContactPropertyType.FirstName,
|
||||
'',
|
||||
firstName,
|
||||
!contact,
|
||||
this.getPropertyPlaceholder(ContactPropertyType.FirstName)
|
||||
)
|
||||
);
|
||||
|
||||
this.viewID(id);
|
||||
|
||||
|
|
@ -614,49 +588,47 @@ class ContactsPopupView extends AbstractViewNext
|
|||
* @param {boolean=} dropPagePosition = false
|
||||
*/
|
||||
reloadContactList(dropPagePosition = false) {
|
||||
|
||||
let offset = (this.contactsPage() - 1) * CONTACTS_PER_PAGE;
|
||||
|
||||
this.bDropPageAfterDelete = false;
|
||||
|
||||
if (dropPagePosition)
|
||||
{
|
||||
if (dropPagePosition) {
|
||||
this.contactsPage(1);
|
||||
offset = 0;
|
||||
}
|
||||
|
||||
this.contacts.loading(true);
|
||||
Remote.contacts((result, data) => {
|
||||
Remote.contacts(
|
||||
(result, data) => {
|
||||
let count = 0,
|
||||
list = [];
|
||||
|
||||
let
|
||||
count = 0,
|
||||
list = [];
|
||||
if (StorageResultType.Success === result && data && data.Result && data.Result.List) {
|
||||
if (isNonEmptyArray(data.Result.List)) {
|
||||
list = _.map(data.Result.List, (item) => {
|
||||
const contact = new ContactModel();
|
||||
return contact.parse(item) ? contact : null;
|
||||
});
|
||||
|
||||
if (StorageResultType.Success === result && data && data.Result && data.Result.List)
|
||||
{
|
||||
if (isNonEmptyArray(data.Result.List))
|
||||
{
|
||||
list = _.map(data.Result.List, (item) => {
|
||||
const contact = new ContactModel();
|
||||
return contact.parse(item) ? contact : null;
|
||||
});
|
||||
list = _.compact(list);
|
||||
|
||||
list = _.compact(list);
|
||||
|
||||
count = pInt(data.Result.Count);
|
||||
count = 0 < count ? count : 0;
|
||||
count = pInt(data.Result.Count);
|
||||
count = 0 < count ? count : 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this.contactsCount(count);
|
||||
this.contactsCount(count);
|
||||
|
||||
delegateRunOnDestroy(this.contacts());
|
||||
this.contacts(list);
|
||||
delegateRunOnDestroy(this.contacts());
|
||||
this.contacts(list);
|
||||
|
||||
this.contacts.loading(false);
|
||||
this.viewClearSearch('' !== this.search());
|
||||
|
||||
}, offset, CONTACTS_PER_PAGE, this.search());
|
||||
this.contacts.loading(false);
|
||||
this.viewClearSearch('' !== this.search());
|
||||
},
|
||||
offset,
|
||||
CONTACTS_PER_PAGE,
|
||||
this.search()
|
||||
);
|
||||
}
|
||||
|
||||
onBuild(dom) {
|
||||
|
|
@ -677,15 +649,14 @@ class ContactsPopupView extends AbstractViewNext
|
|||
|
||||
const self = this;
|
||||
|
||||
dom
|
||||
.on('click', '.e-pagenator .e-page', function() { // eslint-disable-line prefer-arrow-callback
|
||||
const page = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (page)
|
||||
{
|
||||
self.contactsPage(pInt(page.value));
|
||||
self.reloadContactList();
|
||||
}
|
||||
});
|
||||
dom.on('click', '.e-pagenator .e-page', function() {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
const page = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (page) {
|
||||
self.contactsPage(pInt(page.value));
|
||||
self.reloadContactList();
|
||||
}
|
||||
});
|
||||
|
||||
this.initUploader();
|
||||
}
|
||||
|
|
@ -711,16 +682,14 @@ class ContactsPopupView extends AbstractViewNext
|
|||
|
||||
this.sLastComposeFocusedField = '';
|
||||
|
||||
if (this.bBackToCompose)
|
||||
{
|
||||
if (this.bBackToCompose) {
|
||||
this.bBackToCompose = false;
|
||||
|
||||
if (Settings.capa(Capa.Composer))
|
||||
{
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(require('View/Popup/Compose'));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {ContactsPopupView, ContactsPopupView as default};
|
||||
export { ContactsPopupView, ContactsPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,28 +1,26 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, ServerSecure, Ports, Notification} from 'Common/Enums';
|
||||
import {IMAP_DEFAULT_PORT, SIEVE_DEFAULT_PORT, SMTP_DEFAULT_PORT} from 'Common/Consts';
|
||||
import {bMobileDevice} from 'Common/Globals';
|
||||
import {trim, pInt, pString} from 'Common/Utils';
|
||||
import {i18n} from 'Common/Translator';
|
||||
import { StorageResultType, ServerSecure, Ports, Notification } from 'Common/Enums';
|
||||
import { IMAP_DEFAULT_PORT, SIEVE_DEFAULT_PORT, SMTP_DEFAULT_PORT } from 'Common/Consts';
|
||||
import { bMobileDevice } from 'Common/Globals';
|
||||
import { trim, pInt, pString } from 'Common/Utils';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
import CapaAdminStore from 'Stores/Admin/Capa';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Domain',
|
||||
templateID: 'PopupsDomain'
|
||||
})
|
||||
class DomainPopupView extends AbstractViewNext
|
||||
{
|
||||
class DomainPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -42,22 +40,19 @@ class DomainPopupView extends AbstractViewNext
|
|||
this.testingSmtpErrorDesc = ko.observable('');
|
||||
|
||||
this.testingImapError.subscribe((value) => {
|
||||
if (!value)
|
||||
{
|
||||
if (!value) {
|
||||
this.testingImapErrorDesc('');
|
||||
}
|
||||
});
|
||||
|
||||
this.testingSieveError.subscribe((value) => {
|
||||
if (!value)
|
||||
{
|
||||
if (!value) {
|
||||
this.testingSieveErrorDesc('');
|
||||
}
|
||||
});
|
||||
|
||||
this.testingSmtpError.subscribe((value) => {
|
||||
if (!value)
|
||||
{
|
||||
if (!value) {
|
||||
this.testingSmtpErrorDesc('');
|
||||
}
|
||||
});
|
||||
|
|
@ -92,49 +87,43 @@ class DomainPopupView extends AbstractViewNext
|
|||
this.allowSieve = ko.computed(() => CapaAdminStore.filters() && CapaAdminStore.sieve());
|
||||
|
||||
this.headerText = ko.computed(() => {
|
||||
|
||||
const
|
||||
name = this.name(),
|
||||
const name = this.name(),
|
||||
aliasName = this.aliasName();
|
||||
|
||||
let result = '';
|
||||
|
||||
if (this.edit())
|
||||
{
|
||||
result = i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', {'NAME': name});
|
||||
if (aliasName)
|
||||
{
|
||||
if (this.edit()) {
|
||||
result = i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', { 'NAME': name });
|
||||
if (aliasName) {
|
||||
result += ' ← ' + aliasName;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
result = ('' === name ? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN') :
|
||||
i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', {'NAME': name}));
|
||||
} else {
|
||||
result =
|
||||
'' === name
|
||||
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN')
|
||||
: i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { 'NAME': name });
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
});
|
||||
|
||||
this.domainDesc = ko.computed(() => {
|
||||
const name = this.name();
|
||||
return !this.edit() && name ? i18n('POPUPS_DOMAIN/NEW_DOMAIN_DESC', {'NAME': '*@' + name}) : '';
|
||||
return !this.edit() && name ? i18n('POPUPS_DOMAIN/NEW_DOMAIN_DESC', { 'NAME': '*@' + name }) : '';
|
||||
});
|
||||
|
||||
this.domainIsComputed = ko.computed(() => {
|
||||
|
||||
const
|
||||
usePhpMail = this.smtpPhpMail(),
|
||||
const usePhpMail = this.smtpPhpMail(),
|
||||
allowSieve = this.allowSieve(),
|
||||
useSieve = this.useSieve();
|
||||
|
||||
return '' !== this.name() &&
|
||||
return (
|
||||
'' !== this.name() &&
|
||||
'' !== this.imapServer() &&
|
||||
'' !== this.imapPort() &&
|
||||
(allowSieve && useSieve ? ('' !== this.sieveServer() && '' !== this.sievePort()) : true) &&
|
||||
(('' !== this.smtpServer() && '' !== this.smtpPort()) || usePhpMail);
|
||||
|
||||
(allowSieve && useSieve ? '' !== this.sieveServer() && '' !== this.sievePort() : true) &&
|
||||
(('' !== this.smtpServer() && '' !== this.smtpPort()) || usePhpMail)
|
||||
);
|
||||
});
|
||||
|
||||
this.canBeTested = ko.computed(() => !this.testing() && this.domainIsComputed());
|
||||
|
|
@ -146,42 +135,35 @@ class DomainPopupView extends AbstractViewNext
|
|||
|
||||
// smart form improvements
|
||||
this.imapServerFocus.subscribe((value) => {
|
||||
if (value && '' !== this.name() && '' === this.imapServer())
|
||||
{
|
||||
if (value && '' !== this.name() && '' === this.imapServer()) {
|
||||
this.imapServer(this.name().replace(/[.]?[*][.]?/g, ''));
|
||||
}
|
||||
});
|
||||
|
||||
this.sieveServerFocus.subscribe((value) => {
|
||||
if (value && '' !== this.imapServer() && '' === this.sieveServer())
|
||||
{
|
||||
if (value && '' !== this.imapServer() && '' === this.sieveServer()) {
|
||||
this.sieveServer(this.imapServer());
|
||||
}
|
||||
});
|
||||
|
||||
this.smtpServerFocus.subscribe((value) => {
|
||||
if (value && '' !== this.imapServer() && '' === this.smtpServer())
|
||||
{
|
||||
this.smtpServer(this.imapServer().replace(/imap/ig, 'smtp'));
|
||||
if (value && '' !== this.imapServer() && '' === this.smtpServer()) {
|
||||
this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp'));
|
||||
}
|
||||
});
|
||||
|
||||
this.imapSecure.subscribe((value) => {
|
||||
if (this.enableSmartPorts())
|
||||
{
|
||||
if (this.enableSmartPorts()) {
|
||||
const port = pInt(this.imapPort());
|
||||
switch (pString(value))
|
||||
{
|
||||
switch (pString(value)) {
|
||||
case '0':
|
||||
case '2':
|
||||
if (Ports.ImapSsl === port)
|
||||
{
|
||||
if (Ports.ImapSsl === port) {
|
||||
this.imapPort(pString(Ports.Imap));
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
if (Ports.Imap === port)
|
||||
{
|
||||
if (Ports.Imap === port) {
|
||||
this.imapPort(pString(Ports.ImapSsl));
|
||||
}
|
||||
break;
|
||||
|
|
@ -191,26 +173,21 @@ class DomainPopupView extends AbstractViewNext
|
|||
});
|
||||
|
||||
this.smtpSecure.subscribe((value) => {
|
||||
if (this.enableSmartPorts())
|
||||
{
|
||||
if (this.enableSmartPorts()) {
|
||||
const port = pInt(this.smtpPort());
|
||||
switch (pString(value))
|
||||
{
|
||||
switch (pString(value)) {
|
||||
case '0':
|
||||
if (Ports.SmtpSsl === port || Ports.SmtpStartTls === port)
|
||||
{
|
||||
if (Ports.SmtpSsl === port || Ports.SmtpStartTls === port) {
|
||||
this.smtpPort(pString(Ports.Smtp));
|
||||
}
|
||||
break;
|
||||
case '1':
|
||||
if (Ports.Smtp === port || Ports.SmtpStartTls === port)
|
||||
{
|
||||
if (Ports.Smtp === port || Ports.SmtpStartTls === port) {
|
||||
this.smtpPort(pString(Ports.SmtpSsl));
|
||||
}
|
||||
break;
|
||||
case '2':
|
||||
if (Ports.Smtp === port || Ports.SmtpSsl === port)
|
||||
{
|
||||
if (Ports.Smtp === port || Ports.SmtpSsl === port) {
|
||||
this.smtpPort(pString(Ports.SmtpStartTls));
|
||||
}
|
||||
break;
|
||||
|
|
@ -252,7 +229,6 @@ class DomainPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => self.canBeTested())
|
||||
testConnectionCommand() {
|
||||
|
||||
this.page('main');
|
||||
|
||||
this.testingDone(false);
|
||||
|
|
@ -300,10 +276,8 @@ class DomainPopupView extends AbstractViewNext
|
|||
|
||||
onTestConnectionResponse(sResult, oData) {
|
||||
this.testing(false);
|
||||
if (StorageResultType.Success === sResult && oData.Result)
|
||||
{
|
||||
let
|
||||
bImap = false,
|
||||
if (StorageResultType.Success === sResult && oData.Result) {
|
||||
let bImap = false,
|
||||
bSieve = false;
|
||||
|
||||
this.testingDone(true);
|
||||
|
|
@ -311,40 +285,31 @@ class DomainPopupView extends AbstractViewNext
|
|||
this.testingSieveError(true !== oData.Result.Sieve);
|
||||
this.testingSmtpError(true !== oData.Result.Smtp);
|
||||
|
||||
if (this.testingImapError() && oData.Result.Imap)
|
||||
{
|
||||
if (this.testingImapError() && oData.Result.Imap) {
|
||||
bImap = true;
|
||||
this.testingImapErrorDesc('');
|
||||
this.testingImapErrorDesc(oData.Result.Imap);
|
||||
}
|
||||
|
||||
if (this.testingSieveError() && oData.Result.Sieve)
|
||||
{
|
||||
if (this.testingSieveError() && oData.Result.Sieve) {
|
||||
bSieve = true;
|
||||
this.testingSieveErrorDesc('');
|
||||
this.testingSieveErrorDesc(oData.Result.Sieve);
|
||||
}
|
||||
|
||||
if (this.testingSmtpError() && oData.Result.Smtp)
|
||||
{
|
||||
if (this.testingSmtpError() && oData.Result.Smtp) {
|
||||
this.testingSmtpErrorDesc('');
|
||||
this.testingSmtpErrorDesc(oData.Result.Smtp);
|
||||
}
|
||||
|
||||
if (this.sieveSettings())
|
||||
{
|
||||
if (!bSieve && bImap)
|
||||
{
|
||||
if (this.sieveSettings()) {
|
||||
if (!bSieve && bImap) {
|
||||
this.sieveSettings(false);
|
||||
}
|
||||
}
|
||||
else if (bSieve && !bImap)
|
||||
{
|
||||
} else if (bSieve && !bImap) {
|
||||
this.sieveSettings(true);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.testingImapError(true);
|
||||
this.testingSieveError(true);
|
||||
this.testingSmtpError(true);
|
||||
|
|
@ -354,20 +319,14 @@ class DomainPopupView extends AbstractViewNext
|
|||
|
||||
onDomainCreateOrSaveResponse(sResult, oData) {
|
||||
this.saving(false);
|
||||
if (StorageResultType.Success === sResult && oData)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
if (StorageResultType.Success === sResult && oData) {
|
||||
if (oData.Result) {
|
||||
getApp().reloadDomainList();
|
||||
this.closeCommand();
|
||||
}
|
||||
else if (Notification.DomainAlreadyExists === oData.ErrorCode)
|
||||
{
|
||||
} else if (Notification.DomainAlreadyExists === oData.ErrorCode) {
|
||||
this.savingError(i18n('ERRORS/DOMAIN_ALREADY_EXISTS'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.savingError(i18n('ERRORS/UNKNOWN_ERROR'));
|
||||
}
|
||||
}
|
||||
|
|
@ -394,8 +353,7 @@ class DomainPopupView extends AbstractViewNext
|
|||
this.clearTesting();
|
||||
|
||||
this.clearForm();
|
||||
if (oDomain)
|
||||
{
|
||||
if (oDomain) {
|
||||
this.enableSmartPorts(false);
|
||||
|
||||
this.edit(true);
|
||||
|
|
@ -424,8 +382,7 @@ class DomainPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if ('' === this.name() && !bMobileDevice)
|
||||
{
|
||||
if ('' === this.name() && !bMobileDevice) {
|
||||
this.name.focused(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -467,4 +424,4 @@ class DomainPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {DomainPopupView, DomainPopupView as default};
|
||||
export { DomainPopupView, DomainPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {bMobileDevice} from 'Common/Globals';
|
||||
import {i18n} from 'Common/Translator';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { bMobileDevice } from 'Common/Globals';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
import DomainStore from 'Stores/Admin/Domain';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/DomainAlias',
|
||||
templateID: 'PopupsDomainAlias'
|
||||
})
|
||||
class DomainAliasPopupView extends AbstractViewNext
|
||||
{
|
||||
class DomainAliasPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -34,8 +32,8 @@ class DomainAliasPopupView extends AbstractViewNext
|
|||
|
||||
this.domains = DomainStore.domainsWithoutAliases;
|
||||
|
||||
this.domainsOptions = ko.computed(
|
||||
() => _.map(this.domains(), (item) => ({optValue: item.name, optText: item.name}))
|
||||
this.domainsOptions = ko.computed(() =>
|
||||
_.map(this.domains(), (item) => ({ optValue: item.name, optText: item.name }))
|
||||
);
|
||||
|
||||
this.canBeSaved = ko.computed(() => !this.saving() && '' !== this.name() && '' !== this.alias());
|
||||
|
|
@ -46,29 +44,19 @@ class DomainAliasPopupView extends AbstractViewNext
|
|||
@command((self) => self.canBeSaved())
|
||||
createCommand() {
|
||||
this.saving(true);
|
||||
Remote.createDomainAlias(
|
||||
this.onDomainAliasCreateOrSaveResponse,
|
||||
this.name(),
|
||||
this.alias()
|
||||
);
|
||||
Remote.createDomainAlias(this.onDomainAliasCreateOrSaveResponse, this.name(), this.alias());
|
||||
}
|
||||
|
||||
onDomainAliasCreateOrSaveResponse(result, data) {
|
||||
this.saving(false);
|
||||
if (StorageResultType.Success === result && data)
|
||||
{
|
||||
if (data.Result)
|
||||
{
|
||||
if (StorageResultType.Success === result && data) {
|
||||
if (data.Result) {
|
||||
getApp().reloadDomainList();
|
||||
this.closeCommand();
|
||||
}
|
||||
else if (Notification.DomainAlreadyExists === data.ErrorCode)
|
||||
{
|
||||
} else if (Notification.DomainAlreadyExists === data.ErrorCode) {
|
||||
this.savingError(i18n('ERRORS/DOMAIN_ALREADY_EXISTS'));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.savingError(i18n('ERRORS/UNKNOWN_ERROR'));
|
||||
}
|
||||
}
|
||||
|
|
@ -78,8 +66,7 @@ class DomainAliasPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if ('' === this.name() && !bMobileDevice)
|
||||
{
|
||||
if ('' === this.name() && !bMobileDevice) {
|
||||
this.name.focused(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -95,4 +82,4 @@ class DomainAliasPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {DomainAliasPopupView, DomainAliasPopupView as default};
|
||||
export { DomainAliasPopupView, DomainAliasPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {FiltersAction, FilterConditionField, FilterConditionType} from 'Common/Enums';
|
||||
import {bMobileDevice} from 'Common/Globals';
|
||||
import {defautOptionsAfterRender, delegateRun} from 'Common/Utils';
|
||||
import {i18n, initOnStartOrLangChange} from 'Common/Translator';
|
||||
import { FiltersAction, FilterConditionField, FilterConditionType } from 'Common/Enums';
|
||||
import { bMobileDevice } from 'Common/Globals';
|
||||
import { defautOptionsAfterRender, delegateRun } from 'Common/Utils';
|
||||
import { i18n, initOnStartOrLangChange } from 'Common/Translator';
|
||||
|
||||
import FilterStore from 'Stores/User/Filter';
|
||||
import FolderStore from 'Stores/User/Folder';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Filter',
|
||||
templateID: 'PopupsFilter'
|
||||
})
|
||||
class FilterPopupView extends AbstractViewNext
|
||||
{
|
||||
class FilterPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -36,8 +34,7 @@ class FilterPopupView extends AbstractViewNext
|
|||
this.selectedFolderValue = ko.observable('');
|
||||
|
||||
this.selectedFolderValue.subscribe(() => {
|
||||
if (this.filter())
|
||||
{
|
||||
if (this.filter()) {
|
||||
this.filter().actionValue.error(false);
|
||||
}
|
||||
});
|
||||
|
|
@ -54,26 +51,20 @@ class FilterPopupView extends AbstractViewNext
|
|||
|
||||
@command()
|
||||
saveFilterCommand() {
|
||||
|
||||
if (this.filter())
|
||||
{
|
||||
if (FiltersAction.MoveTo === this.filter().actionType())
|
||||
{
|
||||
if (this.filter()) {
|
||||
if (FiltersAction.MoveTo === this.filter().actionType()) {
|
||||
this.filter().actionValue(this.selectedFolderValue());
|
||||
}
|
||||
|
||||
if (!this.filter().verify())
|
||||
{
|
||||
if (!this.filter().verify()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.fTrueCallback)
|
||||
{
|
||||
if (this.fTrueCallback) {
|
||||
this.fTrueCallback(this.filter());
|
||||
}
|
||||
|
||||
if (this.modalVisibility())
|
||||
{
|
||||
if (this.modalVisibility()) {
|
||||
delegateRun(this, 'closeCommand');
|
||||
}
|
||||
}
|
||||
|
|
@ -88,71 +79,66 @@ class FilterPopupView extends AbstractViewNext
|
|||
// 'name': i18n('POPUPS_FILTER/SELECT_ACTION_NONE')});
|
||||
|
||||
const modules = this.modules();
|
||||
if (modules)
|
||||
{
|
||||
if (modules.markasread)
|
||||
{
|
||||
if (modules) {
|
||||
if (modules.markasread) {
|
||||
this.allowMarkAsRead(true);
|
||||
}
|
||||
|
||||
if (modules.moveto)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': FiltersAction.MoveTo,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')});
|
||||
if (modules.moveto) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.MoveTo,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_MOVE_TO')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.redirect)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': FiltersAction.Forward,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')});
|
||||
if (modules.redirect) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.Forward,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_FORWARD_TO')
|
||||
});
|
||||
}
|
||||
|
||||
if (modules.reject)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': FiltersAction.Reject,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT')});
|
||||
if (modules.reject) {
|
||||
this.actionTypeOptions.push({ 'id': FiltersAction.Reject, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_REJECT') });
|
||||
}
|
||||
|
||||
if (modules.vacation)
|
||||
{
|
||||
this.actionTypeOptions.push({'id': FiltersAction.Vacation,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')});
|
||||
|
||||
if (modules.vacation) {
|
||||
this.actionTypeOptions.push({
|
||||
'id': FiltersAction.Vacation,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_VACATION_MESSAGE')
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
this.actionTypeOptions.push({'id': FiltersAction.Discard,
|
||||
'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD')});
|
||||
this.actionTypeOptions.push({ 'id': FiltersAction.Discard, 'name': i18n('POPUPS_FILTER/SELECT_ACTION_DISCARD') });
|
||||
|
||||
this.fieldOptions([
|
||||
{'id': FilterConditionField.From, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_FROM')},
|
||||
{'id': FilterConditionField.Recipient, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS')},
|
||||
{'id': FilterConditionField.Subject, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT')},
|
||||
{'id': FilterConditionField.Size, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SIZE')},
|
||||
{'id': FilterConditionField.Header, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_HEADER')}
|
||||
{ 'id': FilterConditionField.From, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_FROM') },
|
||||
{ 'id': FilterConditionField.Recipient, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_RECIPIENTS') },
|
||||
{ 'id': FilterConditionField.Subject, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SUBJECT') },
|
||||
{ 'id': FilterConditionField.Size, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_SIZE') },
|
||||
{ 'id': FilterConditionField.Header, 'name': i18n('POPUPS_FILTER/SELECT_FIELD_HEADER') }
|
||||
]);
|
||||
|
||||
this.typeOptions([
|
||||
{'id': FilterConditionType.Contains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS')},
|
||||
{'id': FilterConditionType.NotContains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS')},
|
||||
{'id': FilterConditionType.EqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO')},
|
||||
{'id': FilterConditionType.NotEqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO')}
|
||||
{ 'id': FilterConditionType.Contains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_CONTAINS') },
|
||||
{ 'id': FilterConditionType.NotContains, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_CONTAINS') },
|
||||
{ 'id': FilterConditionType.EqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_EQUAL_TO') },
|
||||
{ 'id': FilterConditionType.NotEqualTo, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_NOT_EQUAL_TO') }
|
||||
]);
|
||||
|
||||
if (modules && modules.regex)
|
||||
{
|
||||
this.typeOptions.push({'id': FilterConditionType.Regex, 'name': 'Regex'});
|
||||
if (modules && modules.regex) {
|
||||
this.typeOptions.push({ 'id': FilterConditionType.Regex, 'name': 'Regex' });
|
||||
}
|
||||
|
||||
this.typeOptionsSize([
|
||||
{'id': FilterConditionType.Over, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_OVER')},
|
||||
{'id': FilterConditionType.Under, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_UNDER')}
|
||||
{ 'id': FilterConditionType.Over, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_OVER') },
|
||||
{ 'id': FilterConditionType.Under, 'name': i18n('POPUPS_FILTER/SELECT_TYPE_UNDER') }
|
||||
]);
|
||||
}
|
||||
|
||||
removeCondition(oConditionToDelete) {
|
||||
if (this.filter())
|
||||
{
|
||||
if (this.filter()) {
|
||||
this.filter().removeCondition(oConditionToDelete);
|
||||
}
|
||||
}
|
||||
|
|
@ -170,25 +156,22 @@ class FilterPopupView extends AbstractViewNext
|
|||
this.fTrueCallback = fTrueCallback;
|
||||
this.filter(oFilter);
|
||||
|
||||
if (oFilter)
|
||||
{
|
||||
if (oFilter) {
|
||||
this.selectedFolderValue(oFilter.actionValue());
|
||||
}
|
||||
|
||||
this.isNew(!bEdit);
|
||||
|
||||
if (!bEdit && oFilter)
|
||||
{
|
||||
if (!bEdit && oFilter) {
|
||||
oFilter.name.focused(true);
|
||||
}
|
||||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (this.isNew() && this.filter() && !bMobileDevice)
|
||||
{
|
||||
if (this.isNew() && this.filter() && !bMobileDevice) {
|
||||
this.filter().name.focused(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {FilterPopupView, FilterPopupView as default};
|
||||
export { FilterPopupView, FilterPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,25 +1,23 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {i18n, getNotification} from 'Common/Translator';
|
||||
import {setFolderHash} from 'Common/Cache';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { i18n, getNotification } from 'Common/Translator';
|
||||
import { setFolderHash } from 'Common/Cache';
|
||||
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/FolderClear',
|
||||
templateID: 'PopupsFolderClear'
|
||||
})
|
||||
class FolderClearPopupView extends AbstractViewNext
|
||||
{
|
||||
class FolderClearPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -37,23 +35,20 @@ class FolderClearPopupView extends AbstractViewNext
|
|||
return folder ? folder.localName() : '';
|
||||
});
|
||||
|
||||
this.dangerDescHtml = ko.computed(
|
||||
() => i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {'FOLDER': this.folderNameForClear()})
|
||||
this.dangerDescHtml = ko.computed(() =>
|
||||
i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', { 'FOLDER': this.folderNameForClear() })
|
||||
);
|
||||
}
|
||||
|
||||
@command((self) => {
|
||||
const
|
||||
folder = self.selectedFolder(),
|
||||
const folder = self.selectedFolder(),
|
||||
isClearing = self.clearingProcess();
|
||||
|
||||
return !isClearing && null !== folder;
|
||||
})
|
||||
clearCommand() {
|
||||
|
||||
const folderToClear = this.selectedFolder();
|
||||
if (folderToClear)
|
||||
{
|
||||
if (folderToClear) {
|
||||
MessageStore.message(null);
|
||||
MessageStore.messageList([]);
|
||||
|
||||
|
|
@ -65,21 +60,14 @@ class FolderClearPopupView extends AbstractViewNext
|
|||
setFolderHash(folderToClear.fullNameRaw, '');
|
||||
|
||||
Remote.folderClear((result, data) => {
|
||||
|
||||
this.clearingProcess(false);
|
||||
if (StorageResultType.Success === result && data && data.Result)
|
||||
{
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
getApp().reloadMessageList(true);
|
||||
this.cancelCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (data && data.ErrorCode)
|
||||
{
|
||||
} else {
|
||||
if (data && data.ErrorCode) {
|
||||
this.clearingError(getNotification(data.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.clearingError(getNotification(Notification.MailServerError));
|
||||
}
|
||||
}
|
||||
|
|
@ -94,11 +82,10 @@ class FolderClearPopupView extends AbstractViewNext
|
|||
|
||||
onShow(folder) {
|
||||
this.clearPopup();
|
||||
if (folder)
|
||||
{
|
||||
if (folder) {
|
||||
this.selectedFolder(folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {FolderClearPopupView, FolderClearPopupView as default};
|
||||
export { FolderClearPopupView, FolderClearPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {Notification} from 'Common/Enums';
|
||||
import {UNUSED_OPTION_VALUE} from 'Common/Consts';
|
||||
import {bMobileDevice} from 'Common/Globals';
|
||||
import {trim, defautOptionsAfterRender, folderListOptionsBuilder} from 'Common/Utils';
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
import { bMobileDevice } from 'Common/Globals';
|
||||
import { trim, defautOptionsAfterRender, folderListOptionsBuilder } from 'Common/Utils';
|
||||
|
||||
import FolderStore from 'Stores/User/Folder';
|
||||
|
||||
import Promises from 'Promises/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/FolderCreate',
|
||||
templateID: 'PopupsFolderCreate'
|
||||
})
|
||||
class FolderCreateView extends AbstractViewNext
|
||||
{
|
||||
class FolderCreateView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -30,22 +28,19 @@ class FolderCreateView extends AbstractViewNext
|
|||
this.selectedParentValue = ko.observable(UNUSED_OPTION_VALUE);
|
||||
|
||||
this.parentFolderSelectList = ko.computed(() => {
|
||||
|
||||
const
|
||||
top = [],
|
||||
const top = [],
|
||||
list = FolderStore.folderList(),
|
||||
fRenameCallback = (oItem) => (oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '');
|
||||
fRenameCallback = (oItem) =>
|
||||
oItem ? (oItem.isSystemFolder() ? oItem.name() + ' ' + oItem.manageFolderSystemName() : oItem.name()) : '';
|
||||
|
||||
top.push(['', '']);
|
||||
|
||||
let fDisableCallback = null;
|
||||
if ('' !== FolderStore.namespace)
|
||||
{
|
||||
if ('' !== FolderStore.namespace) {
|
||||
fDisableCallback = (item) => FolderStore.namespace !== item.fullNameRaw.substr(0, FolderStore.namespace.length);
|
||||
}
|
||||
|
||||
return folderListOptionsBuilder([], list, [], top, null, fDisableCallback, null, fRenameCallback);
|
||||
|
||||
});
|
||||
|
||||
this.defautOptionsAfterRender = defautOptionsAfterRender;
|
||||
|
|
@ -53,10 +48,8 @@ class FolderCreateView extends AbstractViewNext
|
|||
|
||||
@command((self) => self.simpleFolderNameValidation(self.folderName()))
|
||||
createFolderCommand() {
|
||||
|
||||
let parentFolderName = this.selectedParentValue();
|
||||
if ('' === parentFolderName && 1 < FolderStore.namespace.length)
|
||||
{
|
||||
if ('' === parentFolderName && 1 < FolderStore.namespace.length) {
|
||||
parentFolderName = FolderStore.namespace.substr(0, FolderStore.namespace.length - 1);
|
||||
}
|
||||
|
||||
|
|
@ -69,7 +62,7 @@ class FolderCreateView extends AbstractViewNext
|
|||
}
|
||||
|
||||
simpleFolderNameValidation(sName) {
|
||||
return (/^[^\\\/]+$/g).test(trim(sName));
|
||||
return /^[^\\/]+$/g.test(trim(sName));
|
||||
}
|
||||
|
||||
clearPopup() {
|
||||
|
|
@ -83,11 +76,10 @@ class FolderCreateView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (!bMobileDevice)
|
||||
{
|
||||
if (!bMobileDevice) {
|
||||
this.folderName.focused(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {FolderCreateView, FolderCreateView as default};
|
||||
export { FolderCreateView, FolderCreateView as default };
|
||||
|
|
|
|||
|
|
@ -1,26 +1,24 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {SetSystemFoldersNotification, Magics} from 'Common/Enums';
|
||||
import {UNUSED_OPTION_VALUE} from 'Common/Consts';
|
||||
import {folderListOptionsBuilder, noop, defautOptionsAfterRender} from 'Common/Utils';
|
||||
import {initOnStartOrLangChange, i18n} from 'Common/Translator';
|
||||
import { SetSystemFoldersNotification, Magics } from 'Common/Enums';
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
import { folderListOptionsBuilder, noop, defautOptionsAfterRender } from 'Common/Utils';
|
||||
import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
||||
|
||||
import FolderStore from 'Stores/User/Folder';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {popup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/FolderSystem',
|
||||
templateID: 'PopupsFolderSystem'
|
||||
})
|
||||
class FolderSystemPopupView extends AbstractViewNext
|
||||
{
|
||||
class FolderSystemPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -34,10 +32,19 @@ class FolderSystemPopupView extends AbstractViewNext
|
|||
|
||||
this.notification = ko.observable('');
|
||||
|
||||
this.folderSelectList = ko.computed(
|
||||
() => folderListOptionsBuilder([], FolderStore.folderList(), FolderStore.folderListSystemNames(), [
|
||||
['', this.sChooseOnText], [UNUSED_OPTION_VALUE, this.sUnuseText]
|
||||
], null, null, null, null, null, true)
|
||||
this.folderSelectList = ko.computed(() =>
|
||||
folderListOptionsBuilder(
|
||||
[],
|
||||
FolderStore.folderList(),
|
||||
FolderStore.folderListSystemNames(),
|
||||
[['', this.sChooseOnText], [UNUSED_OPTION_VALUE, this.sUnuseText]],
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
null,
|
||||
true
|
||||
)
|
||||
);
|
||||
|
||||
this.sentFolder = FolderStore.sentFolder;
|
||||
|
|
@ -46,28 +53,24 @@ class FolderSystemPopupView extends AbstractViewNext
|
|||
this.trashFolder = FolderStore.trashFolder;
|
||||
this.archiveFolder = FolderStore.archiveFolder;
|
||||
|
||||
const
|
||||
fSetSystemFolders = () => {
|
||||
const fSetSystemFolders = () => {
|
||||
Settings.settingsSet('SentFolder', FolderStore.sentFolder());
|
||||
Settings.settingsSet('DraftFolder', FolderStore.draftFolder());
|
||||
Settings.settingsSet('SpamFolder', FolderStore.spamFolder());
|
||||
Settings.settingsSet('TrashFolder', FolderStore.trashFolder());
|
||||
Settings.settingsSet('ArchiveFolder', FolderStore.archiveFolder());
|
||||
},
|
||||
fSaveSystemFolders = _.debounce(
|
||||
() => {
|
||||
fSetSystemFolders();
|
||||
Remote.saveSystemFolders(noop, {
|
||||
SentFolder: FolderStore.sentFolder(),
|
||||
DraftFolder: FolderStore.draftFolder(),
|
||||
SpamFolder: FolderStore.spamFolder(),
|
||||
TrashFolder: FolderStore.trashFolder(),
|
||||
ArchiveFolder: FolderStore.archiveFolder(),
|
||||
NullFolder: 'NullFolder'
|
||||
});
|
||||
},
|
||||
Magics.Time1s
|
||||
),
|
||||
fSaveSystemFolders = _.debounce(() => {
|
||||
fSetSystemFolders();
|
||||
Remote.saveSystemFolders(noop, {
|
||||
SentFolder: FolderStore.sentFolder(),
|
||||
DraftFolder: FolderStore.draftFolder(),
|
||||
SpamFolder: FolderStore.spamFolder(),
|
||||
TrashFolder: FolderStore.trashFolder(),
|
||||
ArchiveFolder: FolderStore.archiveFolder(),
|
||||
NullFolder: 'NullFolder'
|
||||
});
|
||||
}, Magics.Time1s),
|
||||
fCallback = () => {
|
||||
fSetSystemFolders();
|
||||
fSaveSystemFolders();
|
||||
|
|
@ -86,10 +89,8 @@ class FolderSystemPopupView extends AbstractViewNext
|
|||
* @param {number=} notificationType = SetSystemFoldersNotification.None
|
||||
*/
|
||||
onShow(notificationType = SetSystemFoldersNotification.None) {
|
||||
|
||||
let notification = '';
|
||||
switch (notificationType)
|
||||
{
|
||||
switch (notificationType) {
|
||||
case SetSystemFoldersNotification.Sent:
|
||||
notification = i18n('POPUPS_SYSTEM_FOLDERS/NOTIFICATION_SENT');
|
||||
break;
|
||||
|
|
@ -112,4 +113,4 @@ class FolderSystemPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {FolderSystemPopupView, FolderSystemPopupView as default};
|
||||
export { FolderSystemPopupView, FolderSystemPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {bMobileDevice} from 'Common/Globals';
|
||||
import {trim, fakeMd5} from 'Common/Utils';
|
||||
import {getNotification} from 'Common/Translator';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { bMobileDevice } from 'Common/Globals';
|
||||
import { trim, fakeMd5 } from 'Common/Utils';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Identity',
|
||||
templateID: 'PopupsIdentity'
|
||||
})
|
||||
class IdentityPopupView extends AbstractViewNext
|
||||
{
|
||||
class IdentityPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -45,15 +43,13 @@ class IdentityPopupView extends AbstractViewNext
|
|||
this.submitError = ko.observable('');
|
||||
|
||||
this.bcc.subscribe((value) => {
|
||||
if (false === this.showBcc() && 0 < value.length)
|
||||
{
|
||||
if (false === this.showBcc() && 0 < value.length) {
|
||||
this.showBcc(true);
|
||||
}
|
||||
});
|
||||
|
||||
this.replyTo.subscribe((value) => {
|
||||
if (false === this.showReplyTo() && 0 < value.length)
|
||||
{
|
||||
if (false === this.showReplyTo() && 0 < value.length) {
|
||||
this.showReplyTo(true);
|
||||
}
|
||||
});
|
||||
|
|
@ -61,62 +57,56 @@ class IdentityPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest())
|
||||
addOrEditIdentityCommand() {
|
||||
|
||||
if (this.signature && this.signature.__fetchEditorValue)
|
||||
{
|
||||
if (this.signature && this.signature.__fetchEditorValue) {
|
||||
this.signature.__fetchEditorValue();
|
||||
}
|
||||
|
||||
if (!this.email.hasError())
|
||||
{
|
||||
if (!this.email.hasError()) {
|
||||
this.email.hasError('' === trim(this.email()));
|
||||
}
|
||||
|
||||
if (this.email.hasError())
|
||||
{
|
||||
if (!this.owner())
|
||||
{
|
||||
if (this.email.hasError()) {
|
||||
if (!this.owner()) {
|
||||
this.email.focused(true);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.replyTo.hasError())
|
||||
{
|
||||
if (this.replyTo.hasError()) {
|
||||
this.replyTo.focused(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.bcc.hasError())
|
||||
{
|
||||
if (this.bcc.hasError()) {
|
||||
this.bcc.focused(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.submitRequest(true);
|
||||
|
||||
Remote.identityUpdate((result, data) => {
|
||||
|
||||
this.submitRequest(false);
|
||||
if (StorageResultType.Success === result && data)
|
||||
{
|
||||
if (data.Result)
|
||||
{
|
||||
getApp().accountsAndIdentities();
|
||||
this.cancelCommand();
|
||||
Remote.identityUpdate(
|
||||
(result, data) => {
|
||||
this.submitRequest(false);
|
||||
if (StorageResultType.Success === result && data) {
|
||||
if (data.Result) {
|
||||
getApp().accountsAndIdentities();
|
||||
this.cancelCommand();
|
||||
} else if (data.ErrorCode) {
|
||||
this.submitError(getNotification(data.ErrorCode));
|
||||
}
|
||||
} else {
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
else if (data.ErrorCode)
|
||||
{
|
||||
this.submitError(getNotification(data.ErrorCode));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
|
||||
}, this.id, this.email(), this.name(), this.replyTo(), this.bcc(), this.signature(), this.signatureInsertBefore());
|
||||
},
|
||||
this.id,
|
||||
this.email(),
|
||||
this.name(),
|
||||
this.replyTo(),
|
||||
this.bcc(),
|
||||
this.signature(),
|
||||
this.signatureInsertBefore()
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -148,11 +138,9 @@ class IdentityPopupView extends AbstractViewNext
|
|||
* @param {?IdentityModel} oIdentity
|
||||
*/
|
||||
onShow(identity) {
|
||||
|
||||
this.clearPopup();
|
||||
|
||||
if (identity)
|
||||
{
|
||||
if (identity) {
|
||||
this.edit(true);
|
||||
|
||||
this.id = identity.id() || '';
|
||||
|
|
@ -164,16 +152,13 @@ class IdentityPopupView extends AbstractViewNext
|
|||
this.signatureInsertBefore(identity.signatureInsertBefore());
|
||||
|
||||
this.owner('' === this.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.id = fakeMd5();
|
||||
}
|
||||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (!this.owner() && !bMobileDevice)
|
||||
{
|
||||
if (!this.owner() && !bMobileDevice) {
|
||||
this.email.focused(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -183,4 +168,4 @@ class IdentityPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {IdentityPopupView, IdentityPopupView as default};
|
||||
export { IdentityPopupView, IdentityPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,54 +1,50 @@
|
|||
|
||||
import _ from '_';
|
||||
import key from 'key';
|
||||
|
||||
import {KeyState, Magics} from 'Common/Enums';
|
||||
import { KeyState, Magics } from 'Common/Enums';
|
||||
|
||||
import {popup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/KeyboardShortcutsHelp',
|
||||
templateID: 'PopupsKeyboardShortcutsHelp'
|
||||
})
|
||||
class KeyboardShortcutsHelpPopupView extends AbstractViewNext
|
||||
{
|
||||
class KeyboardShortcutsHelpPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
this.sDefaultKeyScope = KeyState.PopupKeyboardShortcutsHelp;
|
||||
}
|
||||
|
||||
onBuild(dom) {
|
||||
key('tab, shift+tab, left, right', KeyState.PopupKeyboardShortcutsHelp, _.throttle((event, handler) => {
|
||||
key(
|
||||
'tab, shift+tab, left, right',
|
||||
KeyState.PopupKeyboardShortcutsHelp,
|
||||
_.throttle((event, handler) => {
|
||||
if (event && handler) {
|
||||
const $tabs = dom.find('.nav.nav-tabs > li'),
|
||||
isNext = handler && ('tab' === handler.shortcut || 'right' === handler.shortcut);
|
||||
|
||||
if (event && handler)
|
||||
{
|
||||
const
|
||||
$tabs = dom.find('.nav.nav-tabs > li'),
|
||||
isNext = handler && ('tab' === handler.shortcut || 'right' === handler.shortcut);
|
||||
let index = $tabs.index($tabs.filter('.active'));
|
||||
if (!isNext && 0 < index) {
|
||||
index -= 1;
|
||||
} else if (isNext && index < $tabs.length - 1) {
|
||||
index += 1;
|
||||
} else {
|
||||
index = isNext ? 0 : $tabs.length - 1;
|
||||
}
|
||||
|
||||
let index = $tabs.index($tabs.filter('.active'));
|
||||
if (!isNext && 0 < index)
|
||||
{
|
||||
index -= 1;
|
||||
}
|
||||
else if (isNext && index < $tabs.length - 1)
|
||||
{
|
||||
index += 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
index = isNext ? 0 : $tabs.length - 1;
|
||||
$tabs
|
||||
.eq(index)
|
||||
.find('a[data-toggle="tab"]')
|
||||
.tab('show');
|
||||
return false;
|
||||
}
|
||||
|
||||
$tabs.eq(index).find('a[data-toggle="tab"]').tab('show');
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, Magics.Time100ms));
|
||||
return true;
|
||||
}, Magics.Time100ms)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export {KeyboardShortcutsHelpPopupView, KeyboardShortcutsHelpPopupView as default};
|
||||
export { KeyboardShortcutsHelpPopupView, KeyboardShortcutsHelpPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {convertLangName} from 'Common/Utils';
|
||||
import { convertLangName } from 'Common/Utils';
|
||||
|
||||
// import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {popup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Languages',
|
||||
templateID: 'PopupsLanguages'
|
||||
})
|
||||
class LanguagesPopupView extends AbstractViewNext
|
||||
{
|
||||
class LanguagesPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -64,8 +62,7 @@ class LanguagesPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
changeLanguage(lang) {
|
||||
if (this.fLang)
|
||||
{
|
||||
if (this.fLang) {
|
||||
this.fLang(lang);
|
||||
}
|
||||
|
||||
|
|
@ -73,4 +70,4 @@ class LanguagesPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {LanguagesPopupView, LanguagesPopupView as default};
|
||||
export { LanguagesPopupView, LanguagesPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,21 +1,19 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
import $ from '$';
|
||||
|
||||
import {pString, log} from 'Common/Utils';
|
||||
import {KeyState, Magics} from 'Common/Enums';
|
||||
import { pString, log } from 'Common/Utils';
|
||||
import { KeyState, Magics } from 'Common/Enums';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/MessageOpenPgp',
|
||||
templateID: 'PopupsMessageOpenPgp'
|
||||
})
|
||||
class MessageOpenPgpPopupView extends AbstractViewNext
|
||||
{
|
||||
class MessageOpenPgpPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -37,44 +35,31 @@ class MessageOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest())
|
||||
doCommand() {
|
||||
|
||||
this.submitRequest(true);
|
||||
|
||||
_.delay(() => {
|
||||
|
||||
let privateKey = null;
|
||||
|
||||
try
|
||||
{
|
||||
if (this.resultCallback && this.selectedKey())
|
||||
{
|
||||
try {
|
||||
if (this.resultCallback && this.selectedKey()) {
|
||||
const privateKeys = this.selectedKey().getNativeKeys();
|
||||
privateKey = privateKeys && privateKeys[0] ? privateKeys[0] : null;
|
||||
|
||||
if (privateKey)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!privateKey.decrypt(pString(this.password())))
|
||||
{
|
||||
if (privateKey) {
|
||||
try {
|
||||
if (!privateKey.decrypt(pString(this.password()))) {
|
||||
log('Error: Private key cannot be decrypted');
|
||||
privateKey = null;
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
} catch (e) {
|
||||
log(e);
|
||||
privateKey = null;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
log('Error: Private key cannot be found');
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
} catch (e) {
|
||||
log(e);
|
||||
privateKey = null;
|
||||
}
|
||||
|
|
@ -83,7 +68,6 @@ class MessageOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
this.cancelCommand();
|
||||
this.resultCallback(privateKey);
|
||||
|
||||
}, Magics.Time100ms);
|
||||
}
|
||||
|
||||
|
|
@ -103,9 +87,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
onBuild(oDom) {
|
||||
key('tab,shift+tab', KeyState.PopupMessageOpenPGP, () => {
|
||||
|
||||
switch (true)
|
||||
{
|
||||
switch (true) {
|
||||
case this.password.focus():
|
||||
this.buttonFocus(true);
|
||||
break;
|
||||
|
|
@ -116,26 +98,27 @@ class MessageOpenPgpPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
return false;
|
||||
|
||||
});
|
||||
|
||||
const self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.key-list__item', function() { // eslint-disable-line prefer-arrow-callback
|
||||
oDom.on('click', '.key-list__item', function() {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
|
||||
oDom.find('.key-list__item .key-list__item__radio')
|
||||
.addClass('icon-radio-unchecked')
|
||||
.removeClass('icon-radio-checked');
|
||||
oDom
|
||||
.find('.key-list__item .key-list__item__radio')
|
||||
.addClass('icon-radio-unchecked')
|
||||
.removeClass('icon-radio-checked');
|
||||
|
||||
$(this).find('.key-list__item__radio') // eslint-disable-line no-invalid-this
|
||||
.removeClass('icon-radio-unchecked')
|
||||
.addClass('icon-radio-checked');
|
||||
$(this)
|
||||
.find('.key-list__item__radio') // eslint-disable-line no-invalid-this
|
||||
.removeClass('icon-radio-unchecked')
|
||||
.addClass('icon-radio-checked');
|
||||
|
||||
self.selectedKey(ko.dataFor(this)); // eslint-disable-line no-invalid-this
|
||||
self.selectedKey(ko.dataFor(this)); // eslint-disable-line no-invalid-this
|
||||
|
||||
self.password.focus(true);
|
||||
});
|
||||
self.password.focus(true);
|
||||
});
|
||||
}
|
||||
|
||||
onHideWithDelay() {
|
||||
|
|
@ -144,7 +127,7 @@ class MessageOpenPgpPopupView extends AbstractViewNext
|
|||
|
||||
onShowWithDelay() {
|
||||
this.password.focus(true);
|
||||
// this.buttonFocus(true);
|
||||
// this.buttonFocus(true);
|
||||
}
|
||||
|
||||
onShow(fCallback, privateKeys) {
|
||||
|
|
@ -153,11 +136,13 @@ class MessageOpenPgpPopupView extends AbstractViewNext
|
|||
this.resultCallback = fCallback;
|
||||
this.privateKeys(privateKeys);
|
||||
|
||||
if (this.viewModelDom)
|
||||
{
|
||||
this.viewModelDom.find('.key-list__item').first().click();
|
||||
if (this.viewModelDom) {
|
||||
this.viewModelDom
|
||||
.find('.key-list__item')
|
||||
.first()
|
||||
.click();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {MessageOpenPgpPopupView, MessageOpenPgpPopupView as default};
|
||||
export { MessageOpenPgpPopupView, MessageOpenPgpPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {Magics} from 'Common/Enums';
|
||||
import {trim, log, delegateRun, pInt} from 'Common/Utils';
|
||||
import { Magics } from 'Common/Enums';
|
||||
import { trim, log, delegateRun, pInt } from 'Common/Utils';
|
||||
|
||||
import PgpStore from 'Stores/User/Pgp';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/NewOpenPgpKey',
|
||||
templateID: 'PopupsNewOpenPgpKey'
|
||||
})
|
||||
class NewOpenPgpKeyPopupView extends AbstractViewNext
|
||||
{
|
||||
class NewOpenPgpKeyPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -39,20 +37,16 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
|
|||
|
||||
@command()
|
||||
generateOpenPgpKeyCommand() {
|
||||
|
||||
const
|
||||
userId = {},
|
||||
const userId = {},
|
||||
openpgpKeyring = PgpStore.openpgpKeyring;
|
||||
|
||||
this.email.error('' === trim(this.email()));
|
||||
if (!openpgpKeyring || this.email.error())
|
||||
{
|
||||
if (!openpgpKeyring || this.email.error()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
userId.email = this.email();
|
||||
if ('' !== this.name())
|
||||
{
|
||||
if ('' !== this.name()) {
|
||||
userId.name = this.name();
|
||||
}
|
||||
|
||||
|
|
@ -60,39 +54,34 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
|
|||
this.submitError('');
|
||||
|
||||
_.delay(() => {
|
||||
|
||||
try {
|
||||
PgpStore.openpgp
|
||||
.generateKey({
|
||||
userIds: [userId],
|
||||
numBits: pInt(this.keyBitLength()),
|
||||
passphrase: trim(this.password())
|
||||
})
|
||||
.then((keyPair) => {
|
||||
this.submitRequest(false);
|
||||
|
||||
PgpStore.openpgp.generateKey({
|
||||
userIds: [userId],
|
||||
numBits: pInt(this.keyBitLength()),
|
||||
passphrase: trim(this.password())
|
||||
}).then((keyPair) => {
|
||||
if (keyPair && keyPair.privateKeyArmored) {
|
||||
openpgpKeyring.privateKeys.importKey(keyPair.privateKeyArmored);
|
||||
openpgpKeyring.publicKeys.importKey(keyPair.publicKeyArmored);
|
||||
|
||||
this.submitRequest(false);
|
||||
openpgpKeyring.store();
|
||||
|
||||
if (keyPair && keyPair.privateKeyArmored)
|
||||
{
|
||||
openpgpKeyring.privateKeys.importKey(keyPair.privateKeyArmored);
|
||||
openpgpKeyring.publicKeys.importKey(keyPair.publicKeyArmored);
|
||||
|
||||
openpgpKeyring.store();
|
||||
|
||||
getApp().reloadOpenPgpKeys();
|
||||
delegateRun(this, 'cancelCommand');
|
||||
}
|
||||
|
||||
}).catch((e) => {
|
||||
this.submitRequest(false);
|
||||
this.showError(e);
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
getApp().reloadOpenPgpKeys();
|
||||
delegateRun(this, 'cancelCommand');
|
||||
}
|
||||
})
|
||||
.catch((e) => {
|
||||
this.submitRequest(false);
|
||||
this.showError(e);
|
||||
});
|
||||
} catch (e) {
|
||||
this.submitRequest(false);
|
||||
this.showError(e);
|
||||
}
|
||||
|
||||
}, Magics.Time100ms);
|
||||
|
||||
return true;
|
||||
|
|
@ -100,8 +89,7 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
|
|||
|
||||
showError(e) {
|
||||
log(e);
|
||||
if (e && e.message)
|
||||
{
|
||||
if (e && e.message) {
|
||||
this.submitError(e.message);
|
||||
}
|
||||
}
|
||||
|
|
@ -126,4 +114,4 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {NewOpenPgpKeyPopupView, NewOpenPgpKeyPopupView as default};
|
||||
export { NewOpenPgpKeyPopupView, NewOpenPgpKeyPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,23 +1,21 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import {KeyState, Magics, StorageResultType, Notification} from 'Common/Enums';
|
||||
import {isNonEmptyArray, delegateRun} from 'Common/Utils';
|
||||
import {getNotification, i18n} from 'Common/Translator';
|
||||
import { KeyState, Magics, StorageResultType, Notification } from 'Common/Enums';
|
||||
import { isNonEmptyArray, delegateRun } from 'Common/Utils';
|
||||
import { getNotification, i18n } from 'Common/Translator';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {popup, command, isPopupVisible, showScreenPopup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command, isPopupVisible, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Plugin',
|
||||
templateID: 'PopupsPlugin'
|
||||
})
|
||||
class PluginPopupView extends AbstractViewNext
|
||||
{
|
||||
class PluginPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -50,14 +48,12 @@ class PluginPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => self.hasConfiguration())
|
||||
saveCommand() {
|
||||
|
||||
const list = {};
|
||||
list.Name = this.name();
|
||||
|
||||
_.each(this.configures(), (oItem) => {
|
||||
let value = oItem.value();
|
||||
if (false === value || true === value)
|
||||
{
|
||||
if (false === value || true === value) {
|
||||
value = value ? '1' : '0';
|
||||
}
|
||||
list['_' + oItem.Name] = value;
|
||||
|
|
@ -68,19 +64,13 @@ class PluginPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onPluginSettingsUpdateResponse(result, data) {
|
||||
if (StorageResultType.Success === result && data && data.Result)
|
||||
{
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
this.cancelCommand();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.saveError('');
|
||||
if (data && data.ErrorCode)
|
||||
{
|
||||
if (data && data.ErrorCode) {
|
||||
this.saveError(getNotification(data.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.saveError(getNotification(Notification.CantSavePluginSettings));
|
||||
}
|
||||
}
|
||||
|
|
@ -91,44 +81,44 @@ class PluginPopupView extends AbstractViewNext
|
|||
this.readme();
|
||||
this.configures([]);
|
||||
|
||||
if (oPlugin)
|
||||
{
|
||||
if (oPlugin) {
|
||||
this.name(oPlugin.Name);
|
||||
this.readme(oPlugin.Readme);
|
||||
|
||||
const config = oPlugin.Config;
|
||||
if (isNonEmptyArray(config))
|
||||
{
|
||||
this.configures(_.map(config, (item) => ({
|
||||
'value': ko.observable(item[0]),
|
||||
'placeholder': ko.observable(item[6]),
|
||||
'Name': item[1],
|
||||
'Type': item[2],
|
||||
'Label': item[3],
|
||||
'Default': item[4],
|
||||
'Desc': item[5]
|
||||
})));
|
||||
if (isNonEmptyArray(config)) {
|
||||
this.configures(
|
||||
_.map(config, (item) => ({
|
||||
'value': ko.observable(item[0]),
|
||||
'placeholder': ko.observable(item[6]),
|
||||
'Name': item[1],
|
||||
'Type': item[2],
|
||||
'Label': item[3],
|
||||
'Default': item[4],
|
||||
'Desc': item[5]
|
||||
}))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
tryToClosePopup() {
|
||||
const PopupsAskViewModel = require('View/Popup/Ask');
|
||||
if (!isPopupVisible(PopupsAskViewModel))
|
||||
{
|
||||
showScreenPopup(PopupsAskViewModel, [i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'), () => {
|
||||
if (this.modalVisibility())
|
||||
{
|
||||
delegateRun(this, 'cancelCommand');
|
||||
if (!isPopupVisible(PopupsAskViewModel)) {
|
||||
showScreenPopup(PopupsAskViewModel, [
|
||||
i18n('POPUPS_ASK/DESC_WANT_CLOSE_THIS_WINDOW'),
|
||||
() => {
|
||||
if (this.modalVisibility()) {
|
||||
delegateRun(this, 'cancelCommand');
|
||||
}
|
||||
}
|
||||
}]);
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
key('esc', KeyState.All, () => {
|
||||
if (this.modalVisibility())
|
||||
{
|
||||
if (this.modalVisibility()) {
|
||||
this.tryToClosePopup();
|
||||
}
|
||||
|
||||
|
|
@ -137,4 +127,4 @@ class PluginPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {PluginPopupView, PluginPopupView as default};
|
||||
export { PluginPopupView, PluginPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {trim, isNormal} from 'Common/Utils';
|
||||
import {getNotification} from 'Common/Translator';
|
||||
import {HtmlEditor} from 'Common/HtmlEditor';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { trim, isNormal } from 'Common/Utils';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
import { HtmlEditor } from 'Common/HtmlEditor';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Template',
|
||||
templateID: 'PopupsTemplate'
|
||||
})
|
||||
class TemplatePopupView extends AbstractViewNext
|
||||
{
|
||||
class TemplatePopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -49,40 +47,35 @@ class TemplatePopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest())
|
||||
addTemplateCommand() {
|
||||
|
||||
this.populateBodyFromEditor();
|
||||
|
||||
this.name.error('' === trim(this.name()));
|
||||
this.body.error('' === trim(this.body()) || ':HTML:' === trim(this.body()));
|
||||
|
||||
if (this.name.error() || this.body.error())
|
||||
{
|
||||
if (this.name.error() || this.body.error()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
this.submitRequest(true);
|
||||
|
||||
Remote.templateSetup((result, data) => {
|
||||
|
||||
this.submitRequest(false);
|
||||
if (StorageResultType.Success === result && data)
|
||||
{
|
||||
if (data.Result)
|
||||
{
|
||||
getApp().templates();
|
||||
this.cancelCommand();
|
||||
Remote.templateSetup(
|
||||
(result, data) => {
|
||||
this.submitRequest(false);
|
||||
if (StorageResultType.Success === result && data) {
|
||||
if (data.Result) {
|
||||
getApp().templates();
|
||||
this.cancelCommand();
|
||||
} else if (data.ErrorCode) {
|
||||
this.submitError(getNotification(data.ErrorCode));
|
||||
}
|
||||
} else {
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
else if (data.ErrorCode)
|
||||
{
|
||||
this.submitError(getNotification(data.ErrorCode));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
|
||||
}, this.id(), this.name(), this.body());
|
||||
},
|
||||
this.id(),
|
||||
this.name(),
|
||||
this.body()
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
|
@ -100,79 +93,71 @@ class TemplatePopupView extends AbstractViewNext
|
|||
this.submitRequest(false);
|
||||
this.submitError('');
|
||||
|
||||
if (this.editor)
|
||||
{
|
||||
if (this.editor) {
|
||||
this.editor.setPlain('', false);
|
||||
}
|
||||
}
|
||||
|
||||
populateBodyFromEditor() {
|
||||
if (this.editor)
|
||||
{
|
||||
if (this.editor) {
|
||||
this.body(this.editor.getDataWithHtmlMark());
|
||||
}
|
||||
}
|
||||
|
||||
editorSetBody(sBody) {
|
||||
if (!this.editor && this.signatureDom())
|
||||
{
|
||||
this.editor = new HtmlEditor(this.signatureDom(), () => {
|
||||
this.populateBodyFromEditor();
|
||||
}, () => {
|
||||
this.editor.setHtmlOrPlain(sBody);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this.editor && this.signatureDom()) {
|
||||
this.editor = new HtmlEditor(
|
||||
this.signatureDom(),
|
||||
() => {
|
||||
this.populateBodyFromEditor();
|
||||
},
|
||||
() => {
|
||||
this.editor.setHtmlOrPlain(sBody);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
this.editor.setHtmlOrPlain(sBody);
|
||||
}
|
||||
}
|
||||
|
||||
onShow(template) {
|
||||
|
||||
this.clearPopup();
|
||||
|
||||
if (template && template.id)
|
||||
{
|
||||
if (template && template.id) {
|
||||
this.id(template.id);
|
||||
this.name(template.name);
|
||||
this.body(template.body);
|
||||
|
||||
if (template.populated)
|
||||
{
|
||||
if (template.populated) {
|
||||
this.editorSetBody(this.body());
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.body.loading(true);
|
||||
this.body.error(false);
|
||||
|
||||
Remote.templateGetById((result, data) => {
|
||||
|
||||
this.body.loading(false);
|
||||
|
||||
if (StorageResultType.Success === result && data && data.Result &&
|
||||
'Object/Template' === data.Result['@Object'] && isNormal(data.Result.Body))
|
||||
{
|
||||
if (
|
||||
StorageResultType.Success === result &&
|
||||
data &&
|
||||
data.Result &&
|
||||
'Object/Template' === data.Result['@Object'] &&
|
||||
isNormal(data.Result.Body)
|
||||
) {
|
||||
template.body = data.Result.Body;
|
||||
template.populated = true;
|
||||
|
||||
this.body(template.body);
|
||||
this.body.error(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.body('');
|
||||
this.body.error(true);
|
||||
}
|
||||
|
||||
this.editorSetBody(this.body());
|
||||
|
||||
}, this.id());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.editorSetBody('');
|
||||
}
|
||||
}
|
||||
|
|
@ -182,4 +167,4 @@ class TemplatePopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {TemplatePopupView, TemplatePopupView as default};
|
||||
export { TemplatePopupView, TemplatePopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,28 +1,26 @@
|
|||
|
||||
import window from 'window';
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
import qr from 'qr';
|
||||
|
||||
import {Capa, StorageResultType} from 'Common/Enums';
|
||||
import {pString} from 'Common/Utils';
|
||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||
import { Capa, StorageResultType } from 'Common/Enums';
|
||||
import { pString } from 'Common/Utils';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {popup, showScreenPopup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/TwoFactorConfiguration',
|
||||
templateID: 'PopupsTwoFactorConfiguration'
|
||||
})
|
||||
class TwoFactorConfigurationPopupView extends AbstractViewNext
|
||||
{
|
||||
class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -50,26 +48,20 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
|
|||
read: this.viewEnable_,
|
||||
write: (value) => {
|
||||
value = !!value;
|
||||
if (value && this.twoFactorTested())
|
||||
{
|
||||
if (value && this.twoFactorTested()) {
|
||||
this.viewEnable_(value);
|
||||
Remote.enableTwoFactor((result, data) => {
|
||||
if (StorageResultType.Success !== result || !data || !data.Result)
|
||||
{
|
||||
if (StorageResultType.Success !== result || !data || !data.Result) {
|
||||
this.viewEnable_(false);
|
||||
}
|
||||
}, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!value)
|
||||
{
|
||||
} else {
|
||||
if (!value) {
|
||||
this.viewEnable_(value);
|
||||
}
|
||||
|
||||
Remote.enableTwoFactor((result, data) => {
|
||||
if (StorageResultType.Success !== result || !data || !data.Result)
|
||||
{
|
||||
if (StorageResultType.Success !== result || !data || !data.Result) {
|
||||
this.viewEnable_(false);
|
||||
}
|
||||
}, false);
|
||||
|
|
@ -79,15 +71,17 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
|
|||
|
||||
this.viewTwoFactorEnableTooltip = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return this.twoFactorTested() || this.viewEnable_() ? '' :
|
||||
i18n('POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_TEST_BEFORE_DESC');
|
||||
return this.twoFactorTested() || this.viewEnable_()
|
||||
? ''
|
||||
: i18n('POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_TEST_BEFORE_DESC');
|
||||
});
|
||||
|
||||
this.viewTwoFactorStatus = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return i18n(this.twoFactorStatus() ?
|
||||
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_CONFIGURED_DESC' :
|
||||
'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
|
||||
return i18n(
|
||||
this.twoFactorStatus()
|
||||
? 'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_CONFIGURED_DESC'
|
||||
: 'POPUPS_TWO_FACTOR_CFG/TWO_FACTOR_SECRET_NOT_CONFIGURED_DESC'
|
||||
);
|
||||
});
|
||||
|
||||
|
|
@ -144,24 +138,27 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onHide() {
|
||||
if (this.lock())
|
||||
{
|
||||
if (this.lock()) {
|
||||
window.location.reload();
|
||||
}
|
||||
}
|
||||
|
||||
getQr() {
|
||||
return 'otpauth://totp/' + window.encodeURIComponent(this.viewUser()) +
|
||||
'?secret=' + window.encodeURIComponent(this.viewSecret()) +
|
||||
'&issuer=' + window.encodeURIComponent('');
|
||||
return (
|
||||
'otpauth://totp/' +
|
||||
window.encodeURIComponent(this.viewUser()) +
|
||||
'?secret=' +
|
||||
window.encodeURIComponent(this.viewSecret()) +
|
||||
'&issuer=' +
|
||||
window.encodeURIComponent('')
|
||||
);
|
||||
}
|
||||
|
||||
onResult(sResult, oData) {
|
||||
this.processing(false);
|
||||
this.clearing(false);
|
||||
|
||||
if (StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
if (StorageResultType.Success === sResult && oData && oData.Result) {
|
||||
this.viewUser(pString(oData.Result.User));
|
||||
this.viewEnable_(!!oData.Result.Enable);
|
||||
this.twoFactorStatus(!!oData.Result.IsSet);
|
||||
|
|
@ -171,10 +168,8 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
|
|||
this.viewBackupCodes(pString(oData.Result.BackupCodes).replace(/[\s]+/g, ' '));
|
||||
|
||||
this.viewUrlTitle(pString(oData.Result.UrlTitle));
|
||||
this.viewUrl(qr.toDataURL({level: 'M', size: 8, value: this.getQr()}));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.viewUrl(qr.toDataURL({ level: 'M', size: 8, value: this.getQr() }));
|
||||
} else {
|
||||
this.viewUser('');
|
||||
this.viewEnable_(false);
|
||||
this.twoFactorStatus(false);
|
||||
|
|
@ -190,14 +185,11 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
|
|||
onShowSecretResult(result, data) {
|
||||
this.secreting(false);
|
||||
|
||||
if (StorageResultType.Success === result && data && data.Result)
|
||||
{
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
this.viewSecret(pString(data.Result.Secret));
|
||||
this.viewUrlTitle(pString(data.Result.UrlTitle));
|
||||
this.viewUrl(qr.toDataURL({level: 'M', size: 6, value: this.getQr()}));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.viewUrl(qr.toDataURL({ level: 'M', size: 6, value: this.getQr() }));
|
||||
} else {
|
||||
this.viewSecret('');
|
||||
this.viewUrlTitle('');
|
||||
this.viewUrl('');
|
||||
|
|
@ -205,12 +197,11 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
if (this.capaTwoFactor)
|
||||
{
|
||||
if (this.capaTwoFactor) {
|
||||
this.processing(true);
|
||||
Remote.getTwoFactor(this.onResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {TwoFactorConfigurationPopupView, TwoFactorConfigurationPopupView as default};
|
||||
export { TwoFactorConfigurationPopupView, TwoFactorConfigurationPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,20 +1,18 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType} from 'Common/Enums';
|
||||
import {bMobileDevice} from 'Common/Globals';
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
import { bMobileDevice } from 'Common/Globals';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/TwoFactorTest',
|
||||
templateID: 'PopupsTwoFactorTest'
|
||||
})
|
||||
class TwoFactorTestPopupView extends AbstractViewNext
|
||||
{
|
||||
class TwoFactorTestPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -29,18 +27,14 @@ class TwoFactorTestPopupView extends AbstractViewNext
|
|||
|
||||
@command((self) => '' !== self.code() && !self.testing())
|
||||
testCodeCommand() {
|
||||
|
||||
this.testing(true);
|
||||
Remote.testTwoFactor((result, data) => {
|
||||
|
||||
this.testing(false);
|
||||
this.code.status(StorageResultType.Success === result && data && !!data.Result);
|
||||
|
||||
if (this.koTestedTrigger && this.code.status())
|
||||
{
|
||||
if (this.koTestedTrigger && this.code.status()) {
|
||||
this.koTestedTrigger(true);
|
||||
}
|
||||
|
||||
}, this.code());
|
||||
}
|
||||
|
||||
|
|
@ -60,11 +54,10 @@ class TwoFactorTestPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if (!bMobileDevice)
|
||||
{
|
||||
if (!bMobileDevice) {
|
||||
this.code.focused(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {TwoFactorTestPopupView, TwoFactorTestPopupView as default};
|
||||
export { TwoFactorTestPopupView, TwoFactorTestPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,19 +1,17 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import {KeyState} from 'Common/Enums';
|
||||
import {selectElement} from 'Common/Utils';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { selectElement } from 'Common/Utils';
|
||||
|
||||
import {popup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/ViewOpenPgpKey',
|
||||
templateID: 'PopupsViewOpenPgpKey'
|
||||
})
|
||||
class ViewOpenPgpKeyPopupView extends AbstractViewNext
|
||||
{
|
||||
class ViewOpenPgpKeyPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -29,8 +27,7 @@ class ViewOpenPgpKeyPopupView extends AbstractViewNext
|
|||
|
||||
selectKey() {
|
||||
const el = this.keyDom();
|
||||
if (el)
|
||||
{
|
||||
if (el) {
|
||||
selectElement(el);
|
||||
}
|
||||
}
|
||||
|
|
@ -38,8 +35,7 @@ class ViewOpenPgpKeyPopupView extends AbstractViewNext
|
|||
onShow(openPgpKey) {
|
||||
this.clearPopup();
|
||||
|
||||
if (openPgpKey)
|
||||
{
|
||||
if (openPgpKey) {
|
||||
this.key(openPgpKey.armor);
|
||||
}
|
||||
}
|
||||
|
|
@ -52,4 +48,4 @@ class ViewOpenPgpKeyPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {ViewOpenPgpKeyPopupView, ViewOpenPgpKeyPopupView as default};
|
||||
export { ViewOpenPgpKeyPopupView, ViewOpenPgpKeyPopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import Promises from 'Promises/User/Ajax';
|
||||
|
||||
import {popup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/WelcomePage',
|
||||
templateID: 'PopupsWelcomePage'
|
||||
})
|
||||
class WelcomePagePopupView extends AbstractViewNext
|
||||
{
|
||||
class WelcomePagePopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -44,4 +42,4 @@ class WelcomePagePopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {WelcomePagePopupView, WelcomePagePopupView as default};
|
||||
export { WelcomePagePopupView, WelcomePagePopupView as default };
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
import ko from 'ko';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/About',
|
||||
type: ViewType.Center,
|
||||
templateID: 'About'
|
||||
})
|
||||
class AboutUserView extends AbstractViewNext
|
||||
{
|
||||
class AboutUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
}
|
||||
}
|
||||
|
||||
export {AboutUserView, AboutUserView as default};
|
||||
export { AboutUserView, AboutUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
|
@ -7,20 +6,19 @@ import AppStore from 'Stores/User/App';
|
|||
import AccountStore from 'Stores/User/Account';
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import {Capa, Magics, KeyState} from 'Common/Enums';
|
||||
import {trim, isUnd} from 'Common/Utils';
|
||||
import {settings} from 'Common/Links';
|
||||
import { Capa, Magics, KeyState } from 'Common/Enums';
|
||||
import { trim, isUnd } from 'Common/Utils';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import * as Events from 'Common/Events';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {showScreenPopup, setHash} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
class AbstractSystemDropDownUserView extends AbstractViewNext
|
||||
{
|
||||
class AbstractSystemDropDownUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -54,8 +52,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
accountClick(account, event) {
|
||||
if (account && event && !isUnd(event.which) && 1 === event.which)
|
||||
{
|
||||
if (account && event && !isUnd(event.which) && 1 === event.which) {
|
||||
AccountStore.accounts.loading(true);
|
||||
_.delay(() => AccountStore.accounts.loading(false), Magics.Time1s);
|
||||
}
|
||||
|
|
@ -68,23 +65,19 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
settingsClick() {
|
||||
if (Settings.capa(Capa.Settings))
|
||||
{
|
||||
if (Settings.capa(Capa.Settings)) {
|
||||
setHash(settings());
|
||||
}
|
||||
}
|
||||
|
||||
settingsHelp()
|
||||
{
|
||||
if (Settings.capa(Capa.Help))
|
||||
{
|
||||
settingsHelp() {
|
||||
if (Settings.capa(Capa.Help)) {
|
||||
showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
}
|
||||
}
|
||||
|
||||
addAccountClick() {
|
||||
if (this.capaAdditionalAccounts())
|
||||
{
|
||||
if (this.capaAdditionalAccounts()) {
|
||||
showScreenPopup(require('View/Popup/Account'));
|
||||
}
|
||||
}
|
||||
|
|
@ -95,8 +88,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
|
||||
onBuild() {
|
||||
key('`', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
if (this.viewModelVisibility())
|
||||
{
|
||||
if (this.viewModelVisibility()) {
|
||||
MessageStore.messageFullScreenMode(false);
|
||||
this.accountMenuDropdownTrigger(true);
|
||||
}
|
||||
|
|
@ -104,8 +96,7 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
|
||||
// shortcuts help
|
||||
key('shift+/', [KeyState.MessageList, KeyState.MessageView, KeyState.Settings], () => {
|
||||
if (this.viewModelVisibility())
|
||||
{
|
||||
if (this.viewModelVisibility()) {
|
||||
showScreenPopup(require('View/Popup/KeyboardShortcutsHelp'));
|
||||
return false;
|
||||
}
|
||||
|
|
@ -114,4 +105,4 @@ class AbstractSystemDropDownUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {AbstractSystemDropDownUserView, AbstractSystemDropDownUserView as default};
|
||||
export { AbstractSystemDropDownUserView, AbstractSystemDropDownUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
import window from 'window';
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
|
@ -12,14 +11,11 @@ import {
|
|||
Notification
|
||||
} from 'Common/Enums';
|
||||
|
||||
import {
|
||||
trim, inArray, pInt,
|
||||
convertLangName, triggerAutocompleteInputChange
|
||||
} from 'Common/Utils';
|
||||
import { trim, inArray, pInt, convertLangName, triggerAutocompleteInputChange } from 'Common/Utils';
|
||||
|
||||
import {$win} from 'Common/Globals';
|
||||
import {socialFacebook, socialGoogle, socialTwitter} from 'Common/Links';
|
||||
import {getNotification, getNotificationFromResponse, reload as translatorReload} from 'Common/Translator';
|
||||
import { $win } from 'Common/Globals';
|
||||
import { socialFacebook, socialGoogle, socialTwitter } from 'Common/Links';
|
||||
import { getNotification, getNotificationFromResponse, reload as translatorReload } from 'Common/Translator';
|
||||
|
||||
import * as Plugins from 'Common/Plugins';
|
||||
|
||||
|
|
@ -31,18 +27,17 @@ import * as Local from 'Storage/Client';
|
|||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {view, command, ViewType, routeOff, showScreenPopup} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, command, ViewType, routeOff, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: ['View/App/Login', 'View/User/Login'],
|
||||
type: ViewType.Center,
|
||||
templateID: 'Login'
|
||||
})
|
||||
class LoginUserView extends AbstractViewNext
|
||||
{
|
||||
class LoginUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -56,7 +51,7 @@ class LoginUserView extends AbstractViewNext
|
|||
|
||||
this.additionalCode = ko.observable('');
|
||||
this.additionalCode.error = ko.observable(false);
|
||||
this.additionalCode.errorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
||||
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);
|
||||
|
|
@ -74,13 +69,15 @@ class LoginUserView extends AbstractViewNext
|
|||
this.emailError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
|
||||
this.emailErrorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({falseTimeout: 500});
|
||||
this.emailErrorAnimation = ko.observable(false).extend({ falseTimeout: 500 });
|
||||
this.passwordErrorAnimation = ko.observable(false).extend({ falseTimeout: 500 });
|
||||
|
||||
this.formHidden = ko.observable(false);
|
||||
|
||||
this.formError = ko.computed(
|
||||
() => this.emailErrorAnimation() || this.passwordErrorAnimation() ||
|
||||
() =>
|
||||
this.emailErrorAnimation() ||
|
||||
this.passwordErrorAnimation() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.errorAnimation())
|
||||
);
|
||||
|
||||
|
|
@ -122,8 +119,7 @@ class LoginUserView extends AbstractViewNext
|
|||
this.submitErrorAddidional = ko.observable('');
|
||||
|
||||
this.submitError.subscribe((value) => {
|
||||
if ('' === value)
|
||||
{
|
||||
if ('' === value) {
|
||||
this.submitErrorAddidional('');
|
||||
}
|
||||
});
|
||||
|
|
@ -136,9 +132,7 @@ class LoginUserView extends AbstractViewNext
|
|||
|
||||
this.bSendLanguage = false;
|
||||
|
||||
this.languageFullName = ko.computed(
|
||||
() => convertLangName(this.language())
|
||||
);
|
||||
this.languageFullName = ko.computed(() => convertLangName(this.language()));
|
||||
|
||||
this.signMeType = ko.observable(LoginSignMeType.Unused);
|
||||
|
||||
|
|
@ -146,9 +140,7 @@ class LoginUserView extends AbstractViewNext
|
|||
this.signMe(LoginSignMeType.DefaultOn === iValue);
|
||||
});
|
||||
|
||||
this.signMeVisibility = ko.computed(
|
||||
() => LoginSignMeType.Unused !== this.signMeType()
|
||||
);
|
||||
this.signMeVisibility = ko.computed(() => LoginSignMeType.Unused !== this.signMeType());
|
||||
|
||||
this.facebookLoginEnabled = ko.observable(false);
|
||||
this.googleLoginEnabled = ko.observable(false);
|
||||
|
|
@ -156,16 +148,14 @@ class LoginUserView extends AbstractViewNext
|
|||
this.twitterLoginEnabled = ko.observable(false);
|
||||
|
||||
this.socialLoginEnabled = ko.computed(() => {
|
||||
const
|
||||
bF = this.facebookLoginEnabled(),
|
||||
const bF = this.facebookLoginEnabled(),
|
||||
bG = this.googleLoginEnabled(),
|
||||
bT = this.twitterLoginEnabled();
|
||||
|
||||
return bF || bG || bT;
|
||||
});
|
||||
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError())
|
||||
{
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError()) {
|
||||
this.submitError(Settings.settingsGet('AdditionalLoginError'));
|
||||
}
|
||||
}
|
||||
|
|
@ -200,7 +190,6 @@ class LoginUserView extends AbstractViewNext
|
|||
|
||||
@command((self) => !self.submitRequest())
|
||||
submitCommand() {
|
||||
|
||||
triggerAutocompleteInputChange();
|
||||
|
||||
this.emailError(false);
|
||||
|
|
@ -209,17 +198,17 @@ class LoginUserView extends AbstractViewNext
|
|||
this.emailError('' === trim(this.email()));
|
||||
this.passwordError('' === trim(this.password()));
|
||||
|
||||
if (this.additionalCode.visibility())
|
||||
{
|
||||
if (this.additionalCode.visibility()) {
|
||||
this.additionalCode.error(false);
|
||||
this.additionalCode.error('' === trim(this.additionalCode()));
|
||||
}
|
||||
|
||||
if (this.emailError() || this.passwordError() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.error()))
|
||||
{
|
||||
switch (true)
|
||||
{
|
||||
if (
|
||||
this.emailError() ||
|
||||
this.passwordError() ||
|
||||
(this.additionalCode.visibility() && this.additionalCode.error())
|
||||
) {
|
||||
switch (true) {
|
||||
case this.emailError():
|
||||
this.emailFocus(true);
|
||||
break;
|
||||
|
|
@ -235,24 +224,19 @@ class LoginUserView extends AbstractViewNext
|
|||
return false;
|
||||
}
|
||||
|
||||
let
|
||||
pluginResultCode = 0,
|
||||
let pluginResultCode = 0,
|
||||
pluginResultMessage = '';
|
||||
|
||||
const
|
||||
fSubmitResult = (iResultCode, sResultMessage) => {
|
||||
pluginResultCode = iResultCode || 0;
|
||||
pluginResultMessage = sResultMessage || '';
|
||||
};
|
||||
const fSubmitResult = (iResultCode, sResultMessage) => {
|
||||
pluginResultCode = iResultCode || 0;
|
||||
pluginResultMessage = sResultMessage || '';
|
||||
};
|
||||
|
||||
Plugins.runHook('user-login-submit', [fSubmitResult]);
|
||||
if (0 < pluginResultCode)
|
||||
{
|
||||
if (0 < pluginResultCode) {
|
||||
this.submitError(getNotification(pluginResultCode));
|
||||
return false;
|
||||
}
|
||||
else if ('' !== pluginResultMessage)
|
||||
{
|
||||
} else if ('' !== pluginResultMessage) {
|
||||
this.submitError(pluginResultMessage);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -260,79 +244,57 @@ class LoginUserView extends AbstractViewNext
|
|||
this.submitRequest(true);
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
|
||||
const
|
||||
fLoginRequest = (sLoginPassword) => {
|
||||
const fLoginRequest = (sLoginPassword) => {
|
||||
Remote.login(
|
||||
(sResult, oData) => {
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
$win.trigger('rl.tooltips.activate');
|
||||
|
||||
Remote.login(
|
||||
(sResult, oData) => {
|
||||
|
||||
$win.trigger('rl.tooltips.diactivate');
|
||||
$win.trigger('rl.tooltips.activate');
|
||||
|
||||
if (StorageResultType.Success === sResult && oData && 'Login' === oData.Action)
|
||||
{
|
||||
if (oData.Result)
|
||||
{
|
||||
if (oData.TwoFactorAuth)
|
||||
{
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(true);
|
||||
this.submitRequest(false);
|
||||
|
||||
_.delay(() => this.additionalCode.focused(true), Magics.Time100ms);
|
||||
}
|
||||
else if (oData.Admin)
|
||||
{
|
||||
getApp().redirectToAdminPanel();
|
||||
}
|
||||
else
|
||||
{
|
||||
getApp().loginAndLogoutReload(false);
|
||||
}
|
||||
}
|
||||
else if (oData.ErrorCode)
|
||||
{
|
||||
if (StorageResultType.Success === sResult && oData && 'Login' === oData.Action) {
|
||||
if (oData.Result) {
|
||||
if (oData.TwoFactorAuth) {
|
||||
this.additionalCode('');
|
||||
this.additionalCode.visibility(true);
|
||||
this.submitRequest(false);
|
||||
if (-1 < inArray(oData.ErrorCode, [Notification.InvalidInputArgument]))
|
||||
{
|
||||
oData.ErrorCode = Notification.AuthError;
|
||||
}
|
||||
|
||||
this.submitError(getNotificationFromResponse(oData));
|
||||
|
||||
if ('' === this.submitError())
|
||||
{
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
else if (oData.ErrorMessageAdditional)
|
||||
{
|
||||
this.submitErrorAddidional(oData.ErrorMessageAdditional);
|
||||
}
|
||||
_.delay(() => this.additionalCode.focused(true), Magics.Time100ms);
|
||||
} else if (oData.Admin) {
|
||||
getApp().redirectToAdminPanel();
|
||||
} else {
|
||||
getApp().loginAndLogoutReload(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.submitRequest(false);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else if (oData.ErrorCode) {
|
||||
this.submitRequest(false);
|
||||
if (-1 < inArray(oData.ErrorCode, [Notification.InvalidInputArgument])) {
|
||||
oData.ErrorCode = Notification.AuthError;
|
||||
}
|
||||
|
||||
this.submitError(getNotificationFromResponse(oData));
|
||||
|
||||
if ('' === this.submitError()) {
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
} else if (oData.ErrorMessageAdditional) {
|
||||
this.submitErrorAddidional(oData.ErrorMessageAdditional);
|
||||
}
|
||||
} else {
|
||||
this.submitRequest(false);
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
} else {
|
||||
this.submitRequest(false);
|
||||
this.submitError(getNotification(Notification.UnknownError));
|
||||
}
|
||||
},
|
||||
this.email(),
|
||||
'',
|
||||
sLoginPassword,
|
||||
!!this.signMe(),
|
||||
this.bSendLanguage ? this.language() : '',
|
||||
this.additionalCode.visibility() ? this.additionalCode() : '',
|
||||
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
||||
);
|
||||
|
||||
},
|
||||
this.email(),
|
||||
'',
|
||||
sLoginPassword,
|
||||
!!this.signMe(),
|
||||
this.bSendLanguage ? this.language() : '',
|
||||
this.additionalCode.visibility() ? this.additionalCode() : '',
|
||||
this.additionalCode.visibility() ? !!this.additionalCodeSignMe() : false
|
||||
);
|
||||
|
||||
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
|
||||
};
|
||||
Local.set(ClientSideKeyName.LastSignMe, this.signMe() ? '-1-' : '-0-');
|
||||
};
|
||||
|
||||
fLoginRequest(this.password());
|
||||
|
||||
|
|
@ -348,20 +310,13 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onShowWithDelay() {
|
||||
if ('' !== this.email() && '' !== this.password())
|
||||
{
|
||||
if ('' !== this.email() && '' !== this.password()) {
|
||||
this.passwordFocus(true);
|
||||
}
|
||||
else if ('' === this.email())
|
||||
{
|
||||
} else if ('' === this.email()) {
|
||||
this.emailFocus(true);
|
||||
}
|
||||
else if ('' === this.password())
|
||||
{
|
||||
} else if ('' === this.password()) {
|
||||
this.passwordFocus(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.emailFocus(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -372,38 +327,36 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
const
|
||||
signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
|
||||
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
|
||||
signMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase(),
|
||||
jsHash = Settings.appSettingsGet('jsHash'),
|
||||
fSocial = (iErrorCode) => {
|
||||
iErrorCode = pInt(iErrorCode);
|
||||
if (0 === iErrorCode)
|
||||
{
|
||||
if (0 === iErrorCode) {
|
||||
this.submitRequest(true);
|
||||
getApp().loginAndLogoutReload(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.submitError(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'));
|
||||
this.googleLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuth')
|
||||
);
|
||||
this.googleFastLoginEnabled(
|
||||
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialAuthFast')
|
||||
);
|
||||
|
||||
switch (signMe)
|
||||
{
|
||||
switch (signMe) {
|
||||
case LoginSignMeTypeAsString.DefaultOff:
|
||||
case LoginSignMeTypeAsString.DefaultOn:
|
||||
this.signMeType(
|
||||
LoginSignMeTypeAsString.DefaultOn === signMe ? LoginSignMeType.DefaultOn : LoginSignMeType.DefaultOff
|
||||
);
|
||||
|
||||
this.signMeType(LoginSignMeTypeAsString.DefaultOn === signMe ?
|
||||
LoginSignMeType.DefaultOn : LoginSignMeType.DefaultOff);
|
||||
|
||||
switch (signMeLocal)
|
||||
{
|
||||
switch (signMeLocal) {
|
||||
case '-1-':
|
||||
this.signMeType(LoginSignMeType.DefaultOn);
|
||||
break;
|
||||
|
|
@ -423,36 +376,32 @@ class LoginUserView extends AbstractViewNext
|
|||
this.email(AppStore.devEmail);
|
||||
this.password(AppStore.devPassword);
|
||||
|
||||
if (this.googleLoginEnabled() || this.googleFastLoginEnabled())
|
||||
{
|
||||
if (this.googleLoginEnabled() || this.googleFastLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_google_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.facebookLoginEnabled())
|
||||
{
|
||||
if (this.facebookLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_facebook_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
if (this.twitterLoginEnabled())
|
||||
{
|
||||
if (this.twitterLoginEnabled()) {
|
||||
window['rl_' + jsHash + '_twitter_login_service'] = fSocial;
|
||||
}
|
||||
|
||||
_.delay(() => {
|
||||
|
||||
LanguageStore.language.subscribe((value) => {
|
||||
|
||||
this.langRequest(true);
|
||||
|
||||
translatorReload(false, value).then(() => {
|
||||
this.langRequest(false);
|
||||
this.bSendLanguage = true;
|
||||
}, () => {
|
||||
this.langRequest(false);
|
||||
});
|
||||
|
||||
translatorReload(false, value).then(
|
||||
() => {
|
||||
this.langRequest(false);
|
||||
this.bSendLanguage = true;
|
||||
},
|
||||
() => {
|
||||
this.langRequest(false);
|
||||
}
|
||||
);
|
||||
});
|
||||
|
||||
}, Magics.Time50ms);
|
||||
|
||||
triggerAutocompleteInputChange(true);
|
||||
|
|
@ -463,14 +412,11 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
selectLanguage() {
|
||||
showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
showScreenPopup(require('View/Popup/Languages'), [this.language, this.languages(), LanguageStore.userLanguage()]);
|
||||
}
|
||||
|
||||
selectLanguageOnTab(bShift) {
|
||||
if (!bShift)
|
||||
{
|
||||
if (!bShift) {
|
||||
_.delay(() => {
|
||||
this.emailFocus(true);
|
||||
}, Magics.Time50ms);
|
||||
|
|
@ -482,4 +428,4 @@ class LoginUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {LoginUserView, LoginUserView as default};
|
||||
export { LoginUserView, LoginUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,14 +1,13 @@
|
|||
|
||||
import window from 'window';
|
||||
import $ from '$';
|
||||
import ko from 'ko';
|
||||
import key from 'key';
|
||||
|
||||
import {trim, isNormal, isArray, windowResize} from 'Common/Utils';
|
||||
import {Capa, Focused, Layout, KeyState, EventKeyCode, Magics} from 'Common/Enums';
|
||||
import {$html, leftPanelDisabled, moveAction} from 'Common/Globals';
|
||||
import {mailBox, settings} from 'Common/Links';
|
||||
import {setFolderHash} from 'Common/Cache';
|
||||
import { trim, isNormal, isArray, windowResize } from 'Common/Utils';
|
||||
import { Capa, Focused, Layout, KeyState, EventKeyCode, Magics } from 'Common/Enums';
|
||||
import { $html, leftPanelDisabled, moveAction } from 'Common/Globals';
|
||||
import { mailBox, settings } from 'Common/Links';
|
||||
import { setFolderHash } from 'Common/Cache';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
|
|
@ -17,18 +16,17 @@ import MessageStore from 'Stores/User/Message';
|
|||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {getApp} from 'Helper/Apps/User';
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import {view, ViewType, showScreenPopup, setHash} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/MailBox/FolderList',
|
||||
type: ViewType.Left,
|
||||
templateID: 'MailFolderList'
|
||||
})
|
||||
class FolderListMailBoxUserView extends AbstractViewNext
|
||||
{
|
||||
class FolderListMailBoxUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -57,40 +55,34 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
this.folderListFocused = ko.computed(() => Focused.FolderList === AppStore.focusedState());
|
||||
|
||||
this.isInboxStarred = ko.computed(
|
||||
() => FolderStore.currentFolder() &&
|
||||
() =>
|
||||
FolderStore.currentFolder() &&
|
||||
FolderStore.currentFolder().isInbox() &&
|
||||
-1 < trim(MessageStore.messageListSearch()).indexOf('is:flagged')
|
||||
);
|
||||
}
|
||||
|
||||
onBuild(dom) {
|
||||
|
||||
this.oContentVisible = $('.b-content', dom);
|
||||
this.oContentScrollable = $('.content', this.oContentVisible);
|
||||
|
||||
const
|
||||
self = this,
|
||||
const self = this,
|
||||
isMobile = Settings.appSettingsGet('mobile'),
|
||||
fSelectFolder = (el, event, starred) => {
|
||||
|
||||
const isMove = moveAction();
|
||||
if (isMobile)
|
||||
{
|
||||
if (isMobile) {
|
||||
leftPanelDisabled(true);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
if (starred)
|
||||
{
|
||||
if (starred) {
|
||||
event.stopPropagation();
|
||||
}
|
||||
|
||||
const folder = ko.dataFor(el);
|
||||
if (folder)
|
||||
{
|
||||
if (isMove)
|
||||
{
|
||||
if (folder) {
|
||||
if (isMove) {
|
||||
moveAction(false);
|
||||
getApp().moveMessagesToFolder(
|
||||
FolderStore.currentFolderFullNameRaw(),
|
||||
|
|
@ -98,25 +90,18 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
folder.fullNameRaw,
|
||||
false
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Layout.NoPreview === SettingsStore.layout())
|
||||
{
|
||||
} else {
|
||||
if (Layout.NoPreview === SettingsStore.layout()) {
|
||||
MessageStore.message(null);
|
||||
}
|
||||
|
||||
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw())
|
||||
{
|
||||
if (folder.fullNameRaw === FolderStore.currentFolderFullNameRaw()) {
|
||||
setFolderHash(folder.fullNameRaw, '');
|
||||
}
|
||||
|
||||
if (starred)
|
||||
{
|
||||
if (starred) {
|
||||
setHash(mailBox(folder.fullNameHash, 1, 'is:flagged'));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
setHash(mailBox(folder.fullNameHash));
|
||||
}
|
||||
}
|
||||
|
|
@ -126,10 +111,10 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
};
|
||||
|
||||
dom
|
||||
.on('click', '.b-folders .e-item .e-link .e-collapsed-sign', function(event) { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.b-folders .e-item .e-link .e-collapsed-sign', function(event) {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
const folder = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (folder && event)
|
||||
{
|
||||
if (folder && event) {
|
||||
const collapsed = folder.collapsed();
|
||||
getApp().setExpandedFolder(folder.fullNameHash, collapsed);
|
||||
|
||||
|
|
@ -138,33 +123,28 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
event.stopPropagation();
|
||||
}
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable .inbox-star-icon', function(event) { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.b-folders .e-item .e-link.selectable .inbox-star-icon', function(event) {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
fSelectFolder(this, event, !self.isInboxStarred()); // eslint-disable-line no-invalid-this
|
||||
})
|
||||
.on('click', '.b-folders .e-item .e-link.selectable', function(event) { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.b-folders .e-item .e-link.selectable', function(event) {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
fSelectFolder(this, event, false); // eslint-disable-line no-invalid-this
|
||||
});
|
||||
|
||||
key('up, down', KeyState.FolderList, (event, handler) => {
|
||||
|
||||
const
|
||||
keyCode = handler && 'up' === handler.shortcut ? EventKeyCode.Up : EventKeyCode.Down,
|
||||
const keyCode = handler && 'up' === handler.shortcut ? EventKeyCode.Up : EventKeyCode.Down,
|
||||
$items = $('.b-folders .e-item .e-link:not(.hidden):visible', dom);
|
||||
|
||||
if (event && $items.length)
|
||||
{
|
||||
if (event && $items.length) {
|
||||
let index = $items.index($items.filter('.focused'));
|
||||
if (-1 < index)
|
||||
{
|
||||
if (-1 < index) {
|
||||
$items.eq(index).removeClass('focused');
|
||||
}
|
||||
|
||||
if (EventKeyCode.Up === keyCode && 0 < index)
|
||||
{
|
||||
if (EventKeyCode.Up === keyCode && 0 < index) {
|
||||
index -= 1;
|
||||
}
|
||||
else if (EventKeyCode.Down === keyCode && index < $items.length - 1)
|
||||
{
|
||||
} else if (EventKeyCode.Down === keyCode && index < $items.length - 1) {
|
||||
index += 1;
|
||||
}
|
||||
|
||||
|
|
@ -177,8 +157,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
key('enter', KeyState.FolderList, () => {
|
||||
const $items = $('.b-folders .e-item .e-link:not(.hidden).focused', dom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
if ($items.length && $items[0]) {
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
$items.click();
|
||||
}
|
||||
|
|
@ -188,11 +167,9 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
key('space', KeyState.FolderList, () => {
|
||||
const $items = $('.b-folders .e-item .e-link:not(.hidden).focused', dom);
|
||||
if ($items.length && $items[0])
|
||||
{
|
||||
if ($items.length && $items[0]) {
|
||||
const folder = ko.dataFor($items[0]);
|
||||
if (folder)
|
||||
{
|
||||
if (folder) {
|
||||
const collapsed = folder.collapsed();
|
||||
getApp().setExpandedFolder(folder.fullNameHash, collapsed);
|
||||
folder.collapsed(!collapsed);
|
||||
|
|
@ -210,8 +187,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
AppStore.focusedState.subscribe((value) => {
|
||||
$('.b-folders .e-item .e-link.focused', dom).removeClass('focused');
|
||||
if (Focused.FolderList === value)
|
||||
{
|
||||
if (Focused.FolderList === value) {
|
||||
$('.b-folders .e-item .e-link.selected', dom).addClass('focused');
|
||||
}
|
||||
});
|
||||
|
|
@ -219,8 +195,7 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
|
||||
messagesDropOver(folder) {
|
||||
window.clearTimeout(this.iDropOverTimer);
|
||||
if (folder && folder.collapsed())
|
||||
{
|
||||
if (folder && folder.collapsed()) {
|
||||
this.iDropOverTimer = window.setTimeout(() => {
|
||||
folder.collapsed(false);
|
||||
getApp().setExpandedFolder(folder.fullNameHash, true);
|
||||
|
|
@ -234,27 +209,23 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
scrollToFocused() {
|
||||
if (!this.oContentVisible || !this.oContentScrollable)
|
||||
{
|
||||
if (!this.oContentVisible || !this.oContentScrollable) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const
|
||||
offset = 20,
|
||||
const offset = 20,
|
||||
focused = $('.e-item .e-link.focused', this.oContentScrollable),
|
||||
pos = focused.position(),
|
||||
visibleHeight = this.oContentVisible.height(),
|
||||
focusedHeight = focused.outerHeight();
|
||||
|
||||
if (pos && (0 > pos.top || pos.top + focusedHeight > visibleHeight))
|
||||
{
|
||||
if (0 > pos.top)
|
||||
{
|
||||
if (pos && (0 > pos.top || pos.top + focusedHeight > visibleHeight)) {
|
||||
if (0 > pos.top) {
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + pos.top - offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.oContentScrollable.scrollTop(this.oContentScrollable.scrollTop() + pos.top - visibleHeight + focusedHeight + offset);
|
||||
} else {
|
||||
this.oContentScrollable.scrollTop(
|
||||
this.oContentScrollable.scrollTop() + pos.top - visibleHeight + focusedHeight + offset
|
||||
);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
@ -269,23 +240,19 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
* @returns {void}
|
||||
*/
|
||||
messagesDrop(toFolder, ui) {
|
||||
if (toFolder && ui && ui.helper)
|
||||
{
|
||||
const
|
||||
fromFolderFullNameRaw = ui.helper.data('rl-folder'),
|
||||
if (toFolder && ui && ui.helper) {
|
||||
const fromFolderFullNameRaw = ui.helper.data('rl-folder'),
|
||||
copy = $html.hasClass('rl-ctrl-key-pressed'),
|
||||
uids = ui.helper.data('rl-uids');
|
||||
|
||||
if (isNormal(fromFolderFullNameRaw) && '' !== fromFolderFullNameRaw && isArray(uids))
|
||||
{
|
||||
if (isNormal(fromFolderFullNameRaw) && '' !== fromFolderFullNameRaw && isArray(uids)) {
|
||||
getApp().moveMessagesToFolder(fromFolderFullNameRaw, uids, toFolder.fullNameRaw, copy);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
composeClick() {
|
||||
if (Settings.capa(Capa.Composer))
|
||||
{
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(require('View/Popup/Compose'));
|
||||
}
|
||||
}
|
||||
|
|
@ -299,11 +266,10 @@ class FolderListMailBoxUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
contactsClick() {
|
||||
if (this.allowContacts)
|
||||
{
|
||||
if (this.allowContacts) {
|
||||
showScreenPopup(require('View/Popup/Contacts'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {FolderListMailBoxUserView, FolderListMailBoxUserView as default};
|
||||
export { FolderListMailBoxUserView, FolderListMailBoxUserView as default };
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
||||
import { view, ViewType } from 'Knoin/Knoin';
|
||||
import { AbstractSystemDropDownUserView } from 'View/User/AbstractSystemDropDown';
|
||||
|
||||
@view({
|
||||
name: 'View/User/MailBox/SystemDropDown',
|
||||
|
|
@ -9,4 +8,4 @@ import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
|||
})
|
||||
class SystemDropDownMailBoxUserView extends AbstractSystemDropDownUserView {}
|
||||
|
||||
export {SystemDropDownMailBoxUserView, SystemDropDownMailBoxUserView as default};
|
||||
export { SystemDropDownMailBoxUserView, SystemDropDownMailBoxUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
|
||||
import $ from '$';
|
||||
import key from 'key';
|
||||
|
||||
import {KeyState} from 'Common/Enums';
|
||||
import {leftPanelDisabled} from 'Common/Globals';
|
||||
import {settings, inbox} from 'Common/Links';
|
||||
import {getFolderInboxName} from 'Common/Cache';
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
import { settings, inbox } from 'Common/Links';
|
||||
import { getFolderInboxName } from 'Common/Cache';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import {view, ViewType, setHash, settingsMenuKeysHandler} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType, setHash, settingsMenuKeysHandler } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/Settings/Menu',
|
||||
type: ViewType.Left,
|
||||
templateID: 'SettingsMenu'
|
||||
})
|
||||
class MenuSettingsUserView extends AbstractViewNext
|
||||
{
|
||||
class MenuSettingsUserView extends AbstractViewNext {
|
||||
/**
|
||||
* @param {Object} screen
|
||||
*/
|
||||
|
|
@ -33,8 +31,7 @@ class MenuSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
if (this.mobile)
|
||||
{
|
||||
if (this.mobile) {
|
||||
dom.on('click', '.b-settings-menu .e-item.selectable', () => {
|
||||
leftPanelDisabled(true);
|
||||
});
|
||||
|
|
@ -52,4 +49,4 @@ class MenuSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {MenuSettingsUserView, MenuSettingsUserView as default};
|
||||
export { MenuSettingsUserView, MenuSettingsUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
import {inbox} from 'Common/Links';
|
||||
import {getFolderInboxName} from 'Common/Cache';
|
||||
import {leftPanelDisabled} from 'Common/Globals';
|
||||
import { inbox } from 'Common/Links';
|
||||
import { getFolderInboxName } from 'Common/Cache';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import {view, ViewType, setHash} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { view, ViewType, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@view({
|
||||
name: 'View/User/Settings/Pane',
|
||||
type: ViewType.Right,
|
||||
templateID: 'SettingsPane'
|
||||
})
|
||||
class PaneSettingsUserView extends AbstractViewNext
|
||||
{
|
||||
class PaneSettingsUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -44,8 +42,7 @@ class PaneSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
|
||||
onBuild(dom) {
|
||||
if (this.mobile)
|
||||
{
|
||||
if (this.mobile) {
|
||||
dom.on('click', () => {
|
||||
leftPanelDisabled(true);
|
||||
});
|
||||
|
|
@ -57,4 +54,4 @@ class PaneSettingsUserView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {PaneSettingsUserView, PaneSettingsUserView as default};
|
||||
export { PaneSettingsUserView, PaneSettingsUserView as default };
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
|
||||
import {view, ViewType} from 'Knoin/Knoin';
|
||||
import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
||||
import { view, ViewType } from 'Knoin/Knoin';
|
||||
import { AbstractSystemDropDownUserView } from 'View/User/AbstractSystemDropDown';
|
||||
|
||||
@view({
|
||||
name: 'View/User/Settings/SystemDropDown',
|
||||
|
|
@ -9,4 +8,4 @@ import {AbstractSystemDropDownUserView} from 'View/User/AbstractSystemDropDown';
|
|||
})
|
||||
class SystemDropDownSettingsUserView extends AbstractSystemDropDownUserView {}
|
||||
|
||||
export {SystemDropDownSettingsUserView, SystemDropDownSettingsUserView as default};
|
||||
export { SystemDropDownSettingsUserView, SystemDropDownSettingsUserView as default };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue