Code refactoring

Flow first look
This commit is contained in:
RainLoop Team 2016-09-10 01:38:16 +03:00
parent 2f841524cb
commit e6e0b02849
71 changed files with 2092 additions and 1836 deletions

View file

@ -90,7 +90,7 @@ module.exports = {
'no-lone-blocks': 2,
'no-loop-func': 2,
// 'no-magic-numbers': [2, {
// 'ignore': [-1, 0, 1, 2],
// 'ignore': [-1, 0, 1, 2, 10, 100],
// 'ignoreArrayIndexes': true
// }],
'no-multi-spaces': 2,

23
.flowconfig Normal file
View file

@ -0,0 +1,23 @@
[ignore]
.*/node_modules/.*
.*/vendors/.*
.*/rainloop/.*
.*/plugins/.*
.*/build/.*
.*/asserts/.*
[include]
[libs]
./dev/
[options]
module.system=haste
esproposal.class_static_fields=enable
esproposal.class_instance_fields=enable
experimental.strict_type_args=true
unsafe.enable_getters_and_setters=true

View file

@ -437,11 +437,12 @@ class AppUser extends AbstractApp
const prom = Promises.foldersReload(FolderStore.foldersLoading);
if (callback)
{
prom.then((value) => {
callback(!!value);
}).catch(() => {
prom.then((value) => !!value).then(callback).catch(() => {
_.delay(() => {
callback(false);
if (callback)
{
callback(false); // eslint-disable-line callback-return
}
}, 1);
});
}

View file

@ -7,18 +7,20 @@ import {trim} from 'Common/Utils';
class Audio
{
notificator = null;
player = null;
supported = false;
supportedMp3 = false;
supportedOgg = false;
supportedWav = false;
supportedNotification = false;
constructor() {
this.notificator = null;
this.supportedMp3 = false;
this.supportedOgg = false;
this.supportedWav = false;
this.supportedNotification = false;
this.player = this.createNewObject();
this.supported = !bMobileDevice && !bSafari && !!this.player && !!this.player.play;
if (this.supported && this.player.canPlayType)
if (this.supported && this.player && this.player.canPlayType)
{
this.supportedMp3 = '' !== this.player.canPlayType('audio/mpeg;').replace(/no/, '');
this.supportedWav = '' !== this.player.canPlayType('audio/wav; codecs="1"').replace(/no/, '');
@ -35,7 +37,7 @@ class Audio
this.supportedNotification = false;
}
if (this.supported)
if (this.supported && this.player)
{
const stopFn = () => this.stop();
@ -137,4 +139,4 @@ class Audio
}
}
module.exports = new Audio();
export default new Audio();

View file

@ -6,6 +6,8 @@ import {CLIENT_SIDE_STORAGE_INDEX_NAME} from 'Common/Consts';
class LocalStorageDriver
{
s = null;
constructor() {
this.s = window.localStorage || null;
}

View file

@ -4,7 +4,7 @@ import $ from '$';
import _ from '_';
import ko from 'ko';
import {$html, $body} from 'Common/Globals';
import {EventKeyCode} from 'Common/Enums';
import {EventKeyCode, Magics} from 'Common/Enums';
import {trim, inArray, changeTheme} from 'Common/Utils';
import {reload as translatorReload} from 'Common/Translator';
@ -111,25 +111,28 @@ function cmdVersion() {
class CmdContoller
{
dom = null;
opened = ko.observable(false);
cmd = ko.observable('');
focused = ko.observable(false);
themes = ThemeStore.themes;
cmdHistory = [];
cmdHistoryShift = 0;
cmdHelper = ko.observable('');
cmds = ['help', 'version', 'glass', 'clear', 'theme', 'lang'];
cmdsWithParameters = ['theme', 'lang'];
isAdmin = false;
constructor(dom)
{
this.dom = dom;
this.opened = ko.observable(false);
this.cmd = ko.observable('');
this.focused = ko.observable(false);
this.themes = ThemeStore.themes;
this.cmdHistory = [];
this.cmdHistoryShift = 0;
this.cmdHelper = ko.observable('');
this.cmds = ['help', 'version', 'glass', 'clear', 'theme', 'lang'];
this.cmdsWithParameters = ['theme', 'lang'];
this.isAdmin = Settings.appSettingsGet('admin');
this.isAdmin = !!Settings.appSettingsGet('admin');
}
runCmd(cmd, params, isTab) {
@ -377,11 +380,14 @@ export function toggle()
if (contoller.opened())
{
_.delay(() => {
contoller.focused(true);
}, 50);
if (contoller && contoller.focused)
{
contoller.focused(true);
}
}, Magics.Time50ms);
}
}
}, 50);
}, Magics.Time50ms);
}
}

View file

@ -3,13 +3,27 @@ import window from 'window';
import _ from '_';
import $ from '$';
import {htmlEditorDefaultConfig, htmlEditorLangsMap} from 'Common/Globals';
import {EventKeyCode} from 'Common/Enums';
import {EventKeyCode, Magics} from 'Common/Enums';
import * as Settings from 'Storage/Settings';
class HtmlEditor
{
editor;
blurTimer = 0;
__resizable = false;
__inited = false;
onBlur = null;
onReady = null;
onModeChange = null;
element;
$element;
resize;
/**
* @constructor
* @param {Object} element
* @param {Function=} onBlur
* @param {Function=} onReady
@ -17,9 +31,6 @@ class HtmlEditor
*/
constructor(element, onBlur = null, onReady = null, onModeChange = null)
{
this.editor = null;
this.blurTimer = 0;
this.onBlur = onBlur;
this.onReady = onReady;
this.onModeChange = onModeChange;
@ -27,20 +38,25 @@ class HtmlEditor
this.element = element;
this.$element = $(element);
this.resize = _.throttle(_.bind(this.resize, this), 100);
this.__inited = false;
this.resize = _.throttle(_.bind(this.resizeEditor, this), 100);
this.init();
}
runOnBlur() {
if (this.onBlur)
{
this.onBlur();
}
}
blurTrigger() {
if (this.onBlur)
{
window.clearTimeout(this.blurTimer);
this.blurTimer = window.setTimeout(() => {
this.onBlur();
}, 200);
this.runOnBlur();
}, Magics.Time200ms);
}
}
@ -198,8 +214,7 @@ class HtmlEditor
if (this.editor && this.__inited && 'wysiwyg' === this.editor.mode)
{
try {
this.editor.setData(
this.editor.getData().replace(find, replaceHtml));
this.editor.setData(this.editor.getData().replace(find, replaceHtml));
}
catch (e) {} // eslint-disable-line no-empty
}
@ -387,7 +402,7 @@ class HtmlEditor
}
}
resize() {
resizeEditor() {
if (this.editor && this.__resizable)
{
try {

View file

@ -8,8 +8,31 @@ import {isArray, inArray, noop, noopTrue} from 'Common/Utils';
class Selector
{
list;
listChecked;
isListChecked;
focusedItem;
selectedItem;
itemSelectedThrottle;
selectedItemUseCallback = true;
iSelectNextHelper = 0;
iFocusedNextHelper = 0;
oContentVisible;
oContentScrollable;
sItemSelector;
sItemSelectedSelector;
sItemCheckedSelector;
sItemFocusedSelector;
sLastUid = '';
oCallbacks = {};
/**
* @constructor
* @param {koProperty} koList
* @param {koProperty} koSelectedItem
* @param {koProperty} koFocusedItem
@ -28,7 +51,6 @@ class Selector
this.focusedItem = koFocusedItem || ko.observable(null);
this.selectedItem = koSelectedItem || ko.observable(null);
this.selectedItemUseCallback = true;
this.itemSelectedThrottle = _.debounce(_.bind(this.itemSelected, this), 300);
@ -79,19 +101,11 @@ class Selector
this.selectedItem = this.selectedItem.extend({toggleSubscribeProperty: [this, 'selected']});
this.focusedItem = this.focusedItem.extend({toggleSubscribeProperty: [null, 'focused']});
this.iSelectNextHelper = 0;
this.iFocusedNextHelper = 0;
this.oContentVisible = null;
this.oContentScrollable = null;
this.sItemSelector = sItemSelector;
this.sItemSelectedSelector = sItemSelectedSelector;
this.sItemCheckedSelector = sItemCheckedSelector;
this.sItemFocusedSelector = sItemFocusedSelector;
this.sLastUid = '';
this.oCallbacks = {};
this.focusedItem.subscribe((item) => {
if (item)
{
@ -253,7 +267,7 @@ class Selector
mFocused = null;
mSelected = null;
}, this);
});
}
itemSelected(item) {

View file

@ -216,8 +216,10 @@ export function initOnStartOrLangChange(startCallback, langCallback = null)
{
startCallback();
}
langCallback();
if (langCallback)
{
langCallback();
}
});
}
else if (startCallback)

View file

@ -508,26 +508,16 @@ export function createCommandLegacy(context, fExecute, fCanExecute = true)
if (isFunc(fCanExecute))
{
fResult.canExecute = ko.computed(() => fResult.enabled() && fCanExecute.call(context));
fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && fCanExecute.call(context));
}
else
{
fResult.canExecute = ko.computed(() => fResult.enabled() && !!fCanExecute);
fResult.canExecute = ko.computed(() => fResult && fResult.enabled() && !!fCanExecute);
}
return fResult;
}
/**
* @param {Function} fExecute
* @param {(Function|boolean|null)=} fCanExecute = true
* @returns {Function}
*/
export function createCommand(fExecute, fCanExecute = true)
{
return createCommandLegacy(null, fExecute, fCanExecute);
}
/**
* @param {string} theme
* @returns {string}
@ -1264,8 +1254,8 @@ export function changeTheme(value, themeTrigger = noop)
if (url)
{
url = url.toString().replace(/\/-\/[^\/]+\/\-\//, '/-/' + value + '/-/');
url = url.toString().replace(/\/Css\/[^\/]+\/User\//, '/Css/0/User/');
url = url.toString().replace(/\/Hash\/[^\/]+\//, '/Hash/-/');
url = url.replace(/\/Css\/[^\/]+\/User\//, '/Css/0/User/');
url = url.replace(/\/Hash\/[^\/]+\//, '/Hash/-/');
if ('Json/' !== url.substring(url.length - 5, url.length))
{

View file

@ -6,7 +6,6 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstracCheckbox extends AbstractComponent
{
/**
* @constructor
* @param {Object} params = {}
*/
constructor(params = {}) {

View file

@ -7,7 +7,6 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstracRadio extends AbstractComponent
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

View file

@ -5,9 +5,7 @@ import {isUnd} from 'Common/Utils';
class AbstractComponent
{
constructor() {
this.disposable = [];
}
disposable = [];
dispose() {
this.disposable.forEach((funcToDispose) => {

View file

@ -7,7 +7,6 @@ import {AbstractComponent} from 'Component/Abstract';
class AbstractInput extends AbstractComponent
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

View file

@ -7,7 +7,6 @@ import {AbstracCheckbox} from 'Component/AbstracCheckbox';
class CheckboxMaterialDesignComponent extends AbstracCheckbox
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

View file

@ -6,7 +6,6 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
class SaveTriggerComponent extends AbstractComponent
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

View file

@ -5,7 +5,6 @@ import {AbstractComponent, componentExportHelper} from 'Component/Abstract';
class ScriptComponent extends AbstractComponent
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

View file

@ -7,7 +7,6 @@ import {AbstractInput} from 'Component/AbstractInput';
class SelectComponent extends AbstractInput
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

View file

@ -8,7 +8,6 @@ const DEFAULT_ROWS = 5;
class TextAreaComponent extends AbstractInput
{
/**
* @constructor
* @param {Object} params
*/
constructor(params) {

12
dev/External/ko.js vendored
View file

@ -581,7 +581,7 @@ ko.bindingHandlers.initFixedTrigger = {
if ($container)
{
$win.resize(() => {
const offset = $container.offset();
const offset = $container ? $container.offset() : null;
if (offset && offset.top)
{
$el.css('top', offset.top + top);
@ -654,7 +654,10 @@ ko.bindingHandlers.draggable = {
handle: '.dragHandle',
cursorAt: {top: 22, left: 3},
refreshPositions: true,
scroll: true
scroll: true,
drag: null,
stop: null,
helper: null
};
if (droppableSelector)
@ -733,7 +736,10 @@ ko.bindingHandlers.droppable = {
fOutCallback = fAllValueFunc && fAllValueFunc.droppableOut ? fAllValueFunc.droppableOut : null,
conf = {
tolerance: 'pointer',
hoverClass: 'droppableHover'
hoverClass: 'droppableHover',
drop: null,
over: null,
out: null
};
if (fValueFunc)

View file

@ -4,13 +4,15 @@ import {isArray, disposeObject} from 'Common/Utils';
class AbstractModel
{
sModelName = '';
disposables = [];
/**
* @param {string} modelName
* @param {string} modelName = ''
*/
constructor(modelName)
constructor(modelName = '')
{
this.sModelName = modelName || '';
this.disposables = [];
}
regDisposables(value) {

View file

@ -5,9 +5,12 @@ import {isArray, isNonEmptyArray, noop} from 'Common/Utils';
class AbstractScreen
{
oCross = null;
sScreenName;
aViewModels;
constructor(screenName, viewModels = [])
{
this.oCross = null;
this.sScreenName = screenName;
this.aViewModels = isArray(viewModels) ? viewModels : [];
}
@ -54,8 +57,11 @@ class AbstractScreen
fMatcher = _.bind(this.onRoute || noop, this);
route = crossroads.create();
_.each(routes, (aItem) => {
route.addRoute(aItem[0], fMatcher).rules = aItem[1];
_.each(routes, (item) => {
if (item && route)
{
route.addRoute(item[0], fMatcher).rules = item[1];
}
});
this.oCross = route;

View file

@ -7,18 +7,16 @@ import {$win, keyScope} from 'Common/Globals';
class AbstractViewNext
{
constructor() {
this.bDisabeCloseOnEsc = false;
this.sDefaultKeyScope = KeyState.None;
this.sCurrentKeyScope = this.sDefaultKeyScope;
bDisabeCloseOnEsc = false;
sDefaultKeyScope = KeyState.None;
sCurrentKeyScope = KeyState.None;
this.viewModelVisibility = ko.observable(false);
this.modalVisibility = ko.observable(false).extend({rateLimit: 0});
viewModelVisibility = ko.observable(false);
modalVisibility = ko.observable(false).extend({rateLimit: 0});
this.viewModelName = '';
this.viewModelNames = [];
this.viewModelDom = null;
}
viewModelName = '';
viewModelNames = [];
viewModelDom = null;
/**
* @returns {void}

View file

@ -10,7 +10,7 @@ import {$html, aViewModels as VIEW_MODELS, popupVisibilityNames} from 'Common/Gl
import {
isArray, isUnd, pString, log, isFunc,
createCommand, delegateRun, isNonEmptyArray
createCommandLegacy, delegateRun, isNonEmptyArray
} from 'Common/Utils';
let
@ -35,6 +35,16 @@ export function hideLoading()
$('#rl-loading').hide().remove();
}
/**
* @param {Function} fExecute
* @param {(Function|boolean|null)=} fCanExecute = true
* @returns {Function}
*/
export function createCommand(fExecute, fCanExecute = true)
{
return createCommandLegacy(null, fExecute, fCanExecute);
}
/**
* @param {Function} SettingsViewModelClass
* @param {string} template
@ -98,15 +108,35 @@ export function screen(screenName)
return ('' !== screenName && !isUnd(SCREENS[screenName])) ? SCREENS[screenName] : null;
}
/**
* @param {Function} ViewModelClassToShow
* @returns {Function|null}
*/
export function getScreenPopup(PopuViewModelClass)
{
let result = null;
if (PopuViewModelClass)
{
result = PopuViewModelClass;
if (PopuViewModelClass.default)
{
result = PopuViewModelClass.default;
}
}
return result;
}
/**
* @param {Function} ViewModelClassToHide
* @returns {void}
*/
export function hideScreenPopup(ViewModelClassToHide)
{
if (ViewModelClassToHide && ViewModelClassToHide.__vm && ViewModelClassToHide.__dom)
const ModalView = getScreenPopup(ViewModelClassToHide);
if (ModalView && ModalView.__vm && ModalView.__dom)
{
ViewModelClassToHide.__vm.modalVisibility(false);
ModalView.__vm.modalVisibility(false);
}
}
@ -231,19 +261,20 @@ export function buildViewModel(ViewModelClass, vmScreen)
*/
export function showScreenPopup(ViewModelClassToShow, params = [])
{
if (ViewModelClassToShow)
const ModalView = getScreenPopup(ViewModelClassToShow);
if (ModalView)
{
buildViewModel(ViewModelClassToShow);
buildViewModel(ModalView);
if (ViewModelClassToShow.__vm && ViewModelClassToShow.__dom)
if (ModalView.__vm && ModalView.__dom)
{
delegateRun(ViewModelClassToShow.__vm, 'onBeforeShow', params || []);
delegateRun(ModalView.__vm, 'onBeforeShow', params || []);
ViewModelClassToShow.__vm.modalVisibility(true);
ModalView.__vm.modalVisibility(true);
delegateRun(ViewModelClassToShow.__vm, 'onShow', params || []);
delegateRun(ModalView.__vm, 'onShow', params || []);
vmRunHook('view-model-on-show', ViewModelClassToShow, params || []);
vmRunHook('view-model-on-show', ModalView, params || []);
}
}
}
@ -254,13 +285,14 @@ export function showScreenPopup(ViewModelClassToShow, params = [])
*/
export function warmUpScreenPopup(ViewModelClassToShow)
{
if (ViewModelClassToShow)
const ModalView = getScreenPopup(ViewModelClassToShow);
if (ModalView)
{
buildViewModel(ViewModelClassToShow);
buildViewModel(ModalView);
if (ViewModelClassToShow.__vm && ViewModelClassToShow.__dom)
if (ModalView.__vm && ModalView.__dom)
{
delegateRun(ViewModelClassToShow.__vm, 'onWarmUp');
delegateRun(ModalView.__vm, 'onWarmUp');
}
}
}
@ -271,7 +303,8 @@ export function warmUpScreenPopup(ViewModelClassToShow)
*/
export function isPopupVisible(ViewModelClassToShow)
{
return ViewModelClassToShow && ViewModelClassToShow.__vm ? ViewModelClassToShow.__vm.modalVisibility() : false;
const ModalView = getScreenPopup(ViewModelClassToShow);
return ModalView && ModalView.__vm ? ModalView.__vm.modalVisibility() : false;
}
/**
@ -394,7 +427,7 @@ export function screenOnRoute(screenName, subPart)
}
// --
cross = vmScreen.__cross ? vmScreen.__cross() : null;
cross = vmScreen && vmScreen.__cross ? vmScreen.__cross() : null;
if (cross)
{
cross.parse(subPart);
@ -515,6 +548,15 @@ function viewDecorator({name, type, templateID})
};
}
/**
* @param {Object} params
* @returns {Function}
*/
function popupDecorator({name, templateID})
{
return viewDecorator({name, type: ViewType.Popup, templateID});
}
/**
* @param {Function} canExecute
* @returns {Function}
@ -548,4 +590,8 @@ function commandDecorator(canExecute = true)
};
}
export {commandDecorator, commandDecorator as command, viewDecorator, viewDecorator as view, viewDecorator as viewModel};
export {
commandDecorator, commandDecorator as command,
viewDecorator, viewDecorator as view, viewDecorator as viewModel,
popupDecorator, popupDecorator as popup
};

View file

@ -3,6 +3,11 @@ import {trim, pString, encodeHtml} from 'Common/Utils';
class EmailModel
{
email = '';
name = '';
dkimStatus = '';
dkimValue = '';
/**
* @param {string=} email = ''
* @param {string=} name = ''

View file

@ -14,9 +14,11 @@ import {AbstractBasicPromises} from 'Promises/AbstractBasic';
class AbstractAjaxPromises extends AbstractBasicPromises
{
oRequests = {};
constructor() {
super();
this.oRequests = {};
this.clear();
}

View file

@ -5,9 +5,7 @@ import {isArray} from 'Common/Utils';
class AbstractBasicPromises
{
constructor() {
this.oPromisesStack = {};
}
oPromisesStack = {};
func(fFunc) {
fFunc();

View file

@ -86,9 +86,10 @@ class AbstractSettingsScreen extends AbstractScreen
RoutedSettingsViewModel.__builded = true;
RoutedSettingsViewModel.__vm = settingsScreen;
const tmpl = {name: RoutedSettingsViewModel.__rlSettingsData.Template};
ko.applyBindingAccessorsToNode(viewModelDom[0], {
translatorInit: true,
template: () => ({name: RoutedSettingsViewModel.__rlSettingsData.Template})
template: () => tmpl
}, settingsScreen);
delegateRun(settingsScreen, 'onBuild', [viewModelDom]);

View file

@ -4,13 +4,15 @@ import ko from 'ko';
import {
settingsSaveHelperSimpleFunction,
defautOptionsAfterRender, createCommand,
defautOptionsAfterRender,
inArray, trim, boolToAjax
} from 'Common/Utils';
import {SaveSettingsStep, StorageResultType, Magics} from 'Common/Enums';
import {i18n} from 'Common/Translator';
import {settingsGet} from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import {command} from 'Knoin/Knoin';
class ContactsAdminSettings
{
@ -21,7 +23,6 @@ class ContactsAdminSettings
this.contactsSync = ko.observable(!!settingsGet('ContactsSync'));
const
Remote = require('Remote/Admin/Ajax'),
supportedTypes = [],
types = ['sqlite', 'mysql', 'pgsql'],
getTypeName = (name) => {
@ -111,27 +112,26 @@ class ContactsAdminSettings
this.testContactsError = ko.observable(false);
this.testContactsErrorMessage = ko.observable('');
this.testContactsCommand = createCommand(() => {
this.testContactsSuccess(false);
this.testContactsError(false);
this.testContactsErrorMessage('');
this.testing(true);
Remote.testContacts(this.onTestContactsResponse, {
'ContactsPdoType': this.contactsType(),
'ContactsPdoDsn': this.pdoDsn(),
'ContactsPdoUser': this.pdoUser(),
'ContactsPdoPassword': this.pdoPassword()
});
}, () => '' !== this.pdoDsn() && '' !== this.pdoUser());
this.contactsType(settingsGet('ContactsPdoType'));
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
}
@command((self) => '' !== self.pdoDsn() && '' !== self.pdoUser())
testContactsCommand() {
this.testContactsSuccess(false);
this.testContactsError(false);
this.testContactsErrorMessage('');
this.testing(true);
Remote.testContacts(this.onTestContactsResponse, {
'ContactsPdoType': this.contactsType(),
'ContactsPdoDsn': this.pdoDsn(),
'ContactsPdoUser': this.pdoUser(),
'ContactsPdoPassword': this.pdoPassword()
});
}
onTestContactsResponse(result, data) {
this.testContactsSuccess(false);
this.testContactsError(false);
@ -166,7 +166,6 @@ class ContactsAdminSettings
onBuild() {
_.delay(() => {
const
Remote = require('Remote/Admin/Ajax'),
f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
f3 = settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this),
f4 = settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this),

View file

@ -2,7 +2,7 @@
import _ from '_';
import ko from 'ko';
import {createCommand, trim, boolToAjax} from 'Common/Utils';
import {trim, boolToAjax} from 'Common/Utils';
import {phpInfo} from 'Common/Links';
import {StorageResultType, Magics} from 'Common/Enums';
@ -13,6 +13,8 @@ import CapaAdminStore from 'Stores/Admin/Capa';
import Remote from 'Remote/Admin/Ajax';
import {command} from 'Knoin/Knoin';
class SecurityAdminSettings
{
constructor() {
@ -77,35 +79,36 @@ class SecurityAdminSettings
this.adminPasswordNewError(false);
});
this.saveNewAdminPasswordCommand = createCommand(() => {
if ('' === trim(this.adminLogin()))
{
this.adminLoginError(true);
return false;
}
if (this.adminPasswordNew() !== this.adminPasswordNew2())
{
this.adminPasswordNewError(true);
return false;
}
this.adminPasswordUpdateError(false);
this.adminPasswordUpdateSuccess(false);
Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
'Login': this.adminLogin(),
'Password': this.adminPassword(),
'NewPassword': this.adminPasswordNew()
});
return true;
}, () => '' !== trim(this.adminLogin()) && '' !== this.adminPassword());
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
}
@command((self) => '' !== trim(self.adminLogin()) && '' !== self.adminPassword())
saveNewAdminPasswordCommand() {
if ('' === trim(this.adminLogin()))
{
this.adminLoginError(true);
return false;
}
if (this.adminPasswordNew() !== this.adminPasswordNew2())
{
this.adminPasswordNewError(true);
return false;
}
this.adminPasswordUpdateError(false);
this.adminPasswordUpdateSuccess(false);
Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
'Login': this.adminLogin(),
'Password': this.adminPassword(),
'NewPassword': this.adminPasswordNew()
});
return true;
}
showTwoFactorDropper() {
this.twoFactorDropperUser('');
this.isTwoFactorDropperShown(true);

View file

@ -3,12 +3,12 @@ import _ from '_';
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {createCommand} from 'Common/Utils';
import {getNotificationFromResponse, i18n} from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {command} from 'Knoin/Knoin';
class ChangePasswordUserSettings
{
@ -43,30 +43,30 @@ class ChangePasswordUserSettings
this.passwordMismatch(false);
});
this.saveNewPasswordCommand = createCommand(() => {
if (this.newPassword() !== this.newPassword2())
{
this.passwordMismatch(true);
this.errorDescription(i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
}
else
{
this.changeProcess(true);
this.passwordUpdateError(false);
this.passwordUpdateSuccess(false);
this.currentPassword.error(false);
this.passwordMismatch(false);
this.errorDescription('');
Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
}
}, () => !this.changeProcess() && '' !== this.currentPassword() && '' !== this.newPassword() && '' !== this.newPassword2());
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
}
@command((self) => !self.changeProcess() && '' !== self.currentPassword() && '' !== self.newPassword() && '' !== self.newPassword2())
saveNewPasswordCommand() {
if (this.newPassword() !== this.newPassword2())
{
this.passwordMismatch(true);
this.errorDescription(i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
}
else
{
this.changeProcess(true);
this.passwordUpdateError(false);
this.passwordUpdateSuccess(false);
this.currentPassword.error(false);
this.passwordMismatch(false);
this.errorDescription('');
Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
}
}
onHide() {
this.changeProcess(false);
this.currentPassword('');

View file

@ -2,20 +2,17 @@
import _ from '_';
import ko from 'ko';
import {windowResizeCallback, isArray, trim, delegateRunOnDestroy} from 'Common/Utils';
import {StorageResultType, Notification} from 'Common/Enums';
import {getNotification} from 'Common/Translator';
import {
windowResizeCallback, createCommand, isArray, trim, delegateRunOnDestroy
} from 'Common/Utils';
import {showScreenPopup} from 'Knoin/Knoin';
import FilterStore from 'Stores/User/Filter';
import Remote from 'Remote/User/Ajax';
import {FilterModel} from 'Model/Filter';
import {showScreenPopup, command} from 'Knoin/Knoin';
class FiltersUserSettings
{
constructor() {
@ -46,41 +43,6 @@ class FiltersUserSettings
this.filterForDeletion = ko.observable(null).deleteAccessHelper();
this.saveChanges = createCommand(() => {
if (!this.filters.saving())
{
if (this.filterRaw.active() && '' === trim(this.filterRaw()))
{
this.filterRaw.error(true);
return false;
}
this.filters.saving(true);
this.saveErrorText('');
Remote.filtersSave((result, data) => {
this.filters.saving(false);
if (StorageResultType.Success === result && data && data.Result)
{
this.haveChanges(false);
this.updateList();
}
else if (data && data.ErrorCode)
{
this.saveErrorText(data.ErrorMessageAdditional || getNotification(data.ErrorCode));
}
else
{
this.saveErrorText(getNotification(Notification.CantSaveFilters));
}
}, this.filters(), this.filterRaw(), this.filterRaw.active());
}
return true;
}, () => this.haveChanges());
this.filters.subscribe(() => {
this.haveChanges(true);
});
@ -100,6 +62,42 @@ class FiltersUserSettings
});
}
@command((self) => self.haveChanges())
saveChangesCommand() {
if (!this.filters.saving())
{
if (this.filterRaw.active() && '' === trim(this.filterRaw()))
{
this.filterRaw.error(true);
return false;
}
this.filters.saving(true);
this.saveErrorText('');
Remote.filtersSave((result, data) => {
this.filters.saving(false);
if (StorageResultType.Success === result && data && data.Result)
{
this.haveChanges(false);
this.updateList();
}
else if (data && data.ErrorCode)
{
this.saveErrorText(data.ErrorMessageAdditional || getNotification(data.ErrorCode));
}
else
{
this.saveErrorText(getNotification(Notification.CantSaveFilters));
}
}, this.filters(), this.filterRaw(), this.filterRaw.active());
}
return true;
}
scrollableOptions(wrapper) {
return {
handle: '.drag-handle',

View file

@ -1,10 +1,10 @@
import {createCommand} from 'Common/Utils';
import SocialStore from 'Stores/Social';
import {getApp} from 'Helper/Apps/User';
import {command} from 'Knoin/Knoin';
class SocialUserSettings
{
constructor() {
@ -29,39 +29,45 @@ class SocialUserSettings
this.twitterActions = SocialStore.twitter.loading;
this.twitterLoggined = SocialStore.twitter.loggined;
this.twitterUserName = SocialStore.twitter.userName;
}
this.connectGoogle = createCommand(() => {
if (!this.googleLoggined())
{
getApp().googleConnect();
}
}, () => !this.googleLoggined() && !this.googleActions());
@command((self) => !self.googleLoggined() && !self.googleActions())
connectGoogleCommand() {
if (!this.googleLoggined())
{
getApp().googleConnect();
}
}
this.disconnectGoogle = createCommand(() => {
getApp().googleDisconnect();
});
@command()
disconnectGoogleCommand() {
getApp().googleDisconnect();
}
this.connectFacebook = createCommand(() => {
if (!this.facebookLoggined())
{
getApp().facebookConnect();
}
}, () => !this.facebookLoggined() && !this.facebookActions());
@command((self) => !self.facebookLoggined() && !self.facebookActions())
connectFacebookCommand() {
if (!this.facebookLoggined())
{
getApp().facebookConnect();
}
}
this.disconnectFacebook = createCommand(() => {
getApp().facebookDisconnect();
});
@command()
disconnectFacebookCommand() {
getApp().facebookDisconnect();
}
this.connectTwitter = createCommand(() => {
if (!this.twitterLoggined())
{
getApp().twitterConnect();
}
}, () => !this.twitterLoggined() && !this.twitterActions());
@command((self) => !self.twitterLoggined() && !self.twitterActions())
connectTwitterCommand() {
if (!this.twitterLoggined())
{
getApp().twitterConnect();
}
}
this.disconnectTwitter = createCommand(() => {
getApp().twitterDisconnect();
});
@command()
disconnectTwitterCommand() {
getApp().twitterDisconnect();
}
}

View file

@ -2,19 +2,18 @@
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {trim, createCommand} from 'Common/Utils';
import {trim} from 'Common/Utils';
import {getNotification} from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Account',
type: ViewType.Popup,
templateID: 'PopupsAccount'
})
class AccountPopupView extends AbstractViewNext
@ -43,51 +42,51 @@ class AccountPopupView extends AbstractViewNext
this.submitErrorAdditional = ko.observable('');
this.emailFocus = ko.observable(false);
}
this.addAccountCommand = createCommand(() => {
@command((self) => !self.submitRequest())
addAccountCommand() {
this.emailError('' === trim(this.email()));
this.passwordError('' === trim(this.password()));
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) => {
this.submitRequest(false);
if (StorageResultType.Success === result && data)
{
return false;
}
this.submitRequest(true);
Remote.accountSetup((result, data) => {
this.submitRequest(false);
if (StorageResultType.Success === result && data)
if (data.Result)
{
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);
}
}
getApp().accountsAndIdentities();
this.cancelCommand();
}
else
{
this.submitError(getNotification(Notification.UnknownError));
this.submitErrorAdditional('');
this.submitError(data.ErrorCode ? getNotification(data.ErrorCode) :
getNotification(Notification.UnknownError));
if (data.ErrorMessageAdditional)
{
this.submitErrorAdditional(data.ErrorMessageAdditional);
}
}
}
else
{
this.submitError(getNotification(Notification.UnknownError));
this.submitErrorAdditional('');
}
}, this.email(), this.password(), this.isNew());
}, this.email(), this.password(), this.isNew());
return true;
}, () => !this.submitRequest());
return true;
}
clearPopup() {
@ -118,4 +117,4 @@ class AccountPopupView extends AbstractViewNext
}
}
module.exports = AccountPopupView;
export {AccountPopupView, AccountPopupView as default};

View file

@ -2,7 +2,7 @@
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {trim, isUnd, createCommand} from 'Common/Utils';
import {trim, isUnd} from 'Common/Utils';
import {RAINLOOP_TRIAL_KEY} from 'Common/Consts';
import {i18n, getNotification} from 'Common/Translator';
@ -11,12 +11,11 @@ import * as Settings from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import LicenseStore from 'Stores/Admin/License';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Activate',
type: ViewType.Popup,
templateID: 'PopupsActivate'
})
class ActivatePopupView extends AbstractViewNext
@ -48,54 +47,54 @@ class ActivatePopupView extends AbstractViewNext
this.licenseTrigger(!this.licenseTrigger());
}
});
}
this.activateCommand = createCommand(() => {
@command((self) => !self.activateProcess() && '' !== self.domain() && '' !== self.key() && !self.activationSuccessed())
activateCommand() {
this.activateProcess(true);
if (this.validateSubscriptionKey())
{
Remote.licensingActivate((sResult, oData) => {
this.activateProcess(true);
if (this.validateSubscriptionKey())
{
Remote.licensingActivate((sResult, oData) => {
this.activateProcess(false);
if (StorageResultType.Success === sResult && oData.Result)
this.activateProcess(false);
if (StorageResultType.Success === sResult && oData.Result)
{
if (true === 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);
this.activationSuccessed(true);
this.activateText(i18n('POPUPS_ACTIVATE/SUBS_KEY_ACTIVATED'));
this.activateText.isError(false);
}
else
{
this.activateText(getNotification(Notification.UnknownError));
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);
}
}, this.domain(), this.key());
}
else
{
this.activateProcess(false);
this.activateText(i18n('POPUPS_ACTIVATE/ERROR_INVALID_SUBS_KEY'));
this.activateText.isError(true);
this.key.focus(true);
}
}, () => !this.activateProcess() && '' !== this.domain() && '' !== this.key() && !this.activationSuccessed());
}, this.domain(), this.key());
}
else
{
this.activateProcess(false);
this.activateText(i18n('POPUPS_ACTIVATE/ERROR_INVALID_SUBS_KEY'));
this.activateText.isError(true);
this.key.focus(true);
}
}
onShow(isTrial) {
@ -127,4 +126,4 @@ class ActivatePopupView extends AbstractViewNext
}
}
module.exports = ActivatePopupView;
export {ActivatePopupView, ActivatePopupView as default};

View file

@ -1,17 +1,16 @@
import ko from 'ko';
import {trim, delegateRun, createCommand, log} from 'Common/Utils';
import {trim, delegateRun, log} from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/AddOpenPgpKey',
type: ViewType.Popup,
templateID: 'PopupsAddOpenPgpKey'
})
class AddOpenPgpKeyPopupView extends AbstractViewNext
@ -28,80 +27,81 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
this.key.error(false);
this.key.errorMessage('');
});
}
this.addOpenPgpKeyCommand = createCommand(() => {
@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,
openpgpKeyring = PgpStore.openpgpKeyring;
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());
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())
{
return false;
}
let
match = null,
count = 30,
done = false;
do
{
match = reg.exec(keyTrimmed);
if (match && 0 < count)
{
keyTrimmed = keyTrimmed.replace(/[\r]+/g, '').replace(/[\n]{2,}/g, '\n\n');
}
this.key.error('' === keyTrimmed);
this.key.errorMessage('');
if (!openpgpKeyring || this.key.error())
{
return false;
}
let
match = null,
count = 30,
done = false;
do
{
match = reg.exec(keyTrimmed);
if (match && 0 < count)
if (match[0] && match[1] && match[2] && match[1] === match[2])
{
if (match[0] && match[1] && match[2] && match[1] === match[2])
let err = null;
if ('PRIVATE' === match[1])
{
let err = null;
if ('PRIVATE' === match[1])
{
err = openpgpKeyring.privateKeys.importKey(match[0]);
}
else if ('PUBLIC' === match[1])
{
err = openpgpKeyring.publicKeys.importKey(match[0]);
}
if (err)
{
this.key.error(true);
this.key.errorMessage(err && err[0] ? '' + err[0] : '');
log(err);
}
err = openpgpKeyring.privateKeys.importKey(match[0]);
}
else if ('PUBLIC' === match[1])
{
err = openpgpKeyring.publicKeys.importKey(match[0]);
}
count -= 1;
done = false;
}
else
{
done = true;
if (err)
{
this.key.error(true);
this.key.errorMessage(err && err[0] ? '' + err[0] : '');
log(err);
}
}
count -= 1;
done = false;
}
while (!done);
openpgpKeyring.store();
getApp().reloadOpenPgpKeys();
if (this.key.error())
else
{
return false;
done = true;
}
}
while (!done);
delegateRun(this, 'cancelCommand');
return true;
});
openpgpKeyring.store();
getApp().reloadOpenPgpKeys();
if (this.key.error())
{
return false;
}
delegateRun(this, 'cancelCommand');
return true;
}
clearPopup() {
@ -119,4 +119,4 @@ class AddOpenPgpKeyPopupView extends AbstractViewNext
}
}
module.exports = AddOpenPgpKeyPopupView;
export {AddOpenPgpKeyPopupView, AddOpenPgpKeyPopupView as default};

View file

@ -2,18 +2,17 @@
import _ from '_';
import ko from 'ko';
import {trim, createCommand} from 'Common/Utils';
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 {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/AdvancedSearch',
type: ViewType.Popup,
templateID: 'PopupsAdvancedSearch'
})
class AdvancedSearchPopupView extends AbstractViewNext
@ -33,16 +32,6 @@ class AdvancedSearchPopupView extends AbstractViewNext
this.starred = ko.observable(false);
this.unseen = ko.observable(false);
this.searchCommand = createCommand(() => {
const search = this.buildSearchString();
if ('' !== search)
{
MessageStore.mainMessageListSearch(search);
}
this.cancelCommand();
});
this.selectedDates = ko.computed(() => {
translatorTrigger();
return [
@ -57,6 +46,17 @@ class AdvancedSearchPopupView extends AbstractViewNext
});
}
@command()
searchCommand() {
const search = this.buildSearchString();
if ('' !== search)
{
MessageStore.mainMessageListSearch(search);
}
this.cancelCommand();
}
parseSearchStringValue(search) {
const parts = (search || '').split(/[\s]+/g);
_.each(parts, (part) => {
@ -171,4 +171,4 @@ class AdvancedSearchPopupView extends AbstractViewNext
}
}
module.exports = AdvancedSearchPopupView;
export {AdvancedSearchPopupView, AdvancedSearchPopupView as default};

View file

@ -6,12 +6,11 @@ import {KeyState} from 'Common/Enums';
import {isFunc} from 'Common/Utils';
import {i18n} from 'Common/Translator';
import {view, ViewType} from 'Knoin/Knoin';
import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Ask',
type: ViewType.Popup,
templateID: 'PopupsAsk'
})
class AskPopupView extends AbstractViewNext
@ -122,4 +121,4 @@ class AskPopupView extends AbstractViewNext
}
}
module.exports = AskPopupView;
export {AskPopupView, AskPopupView as default};

View file

@ -13,7 +13,7 @@ import {
} from 'Common/Enums';
import {
trim, isArray, isNormal, createCommand, delegateRun,
trim, isArray, isNormal, delegateRun,
isNonEmptyArray, clearBqSwitcher, replySubjectAdd,
encodeHtml, noopFalse, inFocus, delegateRunOnDestroy,
pInt, isUnd
@ -46,12 +46,11 @@ import {ComposeAttachmentModel} from 'Model/ComposeAttachment';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin';
import {popup, command, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Compose',
type: ViewType.Popup,
templateID: 'PopupsCompose'
})
class ComposePopupView extends AbstractViewNext
@ -311,199 +310,9 @@ class ComposePopupView extends AbstractViewNext
this.canBeSentOrSaved = ko.computed(() => !this.sending() && !this.saving());
this.deleteCommand = createCommand(() => {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel) && this.modalVisibility())
{
showScreenPopup(PopupsAskViewModel, [i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), () => {
if (this.modalVisibility())
{
getApp().deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
hideScreenPopup(ComposePopupView);
}
}]);
}
}, () => this.isDraftFolderMessage());
this.sendMessageResponse = _.bind(this.sendMessageResponse, this);
this.saveMessageResponse = _.bind(this.saveMessageResponse, this);
this.sendCommand = createCommand(() => {
const
sTo = trim(this.to()),
sCc = trim(this.cc()),
sBcc = trim(this.bcc());
let
sSentFolder = FolderStore.sentFolder();
this.attachmentsInProcessError(false);
this.attachmentsInErrorError(false);
this.emptyToError(false);
if (0 < this.attachmentsInProcess().length)
{
this.attachmentsInProcessError(true);
this.attachmentsPlace(true);
}
else if (0 < this.attachmentsInError().length)
{
this.attachmentsInErrorError(true);
this.attachmentsPlace(true);
}
if ('' === sTo && '' === sCc && '' === sBcc)
{
this.emptyToError(true);
}
if (!this.emptyToError() && !this.attachmentsInErrorError() && !this.attachmentsInProcessError())
{
if (SettingsStore.replySameFolder())
{
if (isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length && isNormal(this.aDraftInfo[2]) && 0 < this.aDraftInfo[2].length)
{
sSentFolder = this.aDraftInfo[2];
}
}
if (!this.allowFolders)
{
sSentFolder = UNUSED_OPTION_VALUE;
}
if ('' === sSentFolder)
{
showScreenPopup(require('View/Popup/FolderSystem'), [SetSystemFoldersNotification.Sent]);
}
else
{
this.sendError(false);
this.sending(true);
if (isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length)
{
const flagsCache = getMessageFlagsFromCache(this.aDraftInfo[2], this.aDraftInfo[1]);
if (flagsCache)
{
if ('forward' === this.aDraftInfo[0])
{
flagsCache[3] = true;
}
else
{
flagsCache[2] = true;
}
setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], flagsCache);
getApp().reloadFlagsCurrentMessageListAndMessageFromCache();
setFolderHash(this.aDraftInfo[2], '');
}
}
sSentFolder = UNUSED_OPTION_VALUE === sSentFolder ? '' : sSentFolder;
setFolderHash(this.draftFolder(), '');
setFolderHash(sSentFolder, '');
Remote.sendMessage(
this.sendMessageResponse,
this.currentIdentity() ? this.currentIdentity().id() : '',
this.draftFolder(),
this.draftUid(),
sSentFolder,
sTo,
this.cc(),
this.bcc(),
this.replyTo(),
this.subject(),
this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo,
this.sInReplyTo,
this.sReferences,
this.requestDsn(),
this.requestReadReceipt(),
this.markAsImportant()
);
}
}
}, this.canBeSentOrSaved);
this.saveCommand = createCommand(() => {
if (!this.allowFolders)
{
return false;
}
if (FolderStore.draftFolderNotEnabled())
{
showScreenPopup(require('View/Popup/FolderSystem'), [SetSystemFoldersNotification.Draft]);
}
else
{
this.savedError(false);
this.saving(true);
this.autosaveStart();
setFolderHash(FolderStore.draftFolder(), '');
Remote.saveMessage(
this.saveMessageResponse,
this.currentIdentity() ? this.currentIdentity().id() : '',
this.draftFolder(),
this.draftUid(),
FolderStore.draftFolder(),
this.to(),
this.cc(),
this.bcc(),
this.replyTo(),
this.subject(),
this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo,
this.sInReplyTo,
this.sReferences,
this.markAsImportant()
);
}
return true;
}, this.canBeSentOrSaved);
this.skipCommand = createCommand(() => {
this.bSkipNextHide = true;
if (this.modalVisibility() && !this.saving() && !this.sending() &&
!FolderStore.draftFolderNotEnabled())
{
this.saveCommand();
}
this.tryToClosePopup();
}, this.canBeSentOrSaved);
this.contactsCommand = createCommand(() => {
if (this.allowContacts)
{
this.skipCommand();
_.delay(() => {
showScreenPopup(require('View/Popup/Contacts'), [true, this.sLastFocusedField]);
}, Magics.Time200ms);
}
}, () => this.allowContacts);
Events.sub('interval.2m', () => {
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
!this.saving() && !this.sending() && !this.savedError())
@ -519,37 +328,12 @@ class ComposePopupView extends AbstractViewNext
this.dropboxEnabled = SocialStore.dropbox.enabled;
this.dropboxApiKey = SocialStore.dropbox.apiKey;
this.dropboxCommand = createCommand(() => {
if (window.Dropbox)
{
window.Dropbox.choose({
success: (files) => {
if (files && files[0] && files[0].link)
{
this.addDropboxAttachment(files[0]);
}
},
linkType: 'direct',
multiselect: false
});
}
return true;
}, () => this.dropboxEnabled());
this.driveEnabled = ko.observable(bXMLHttpRequestSupported &&
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialDrive') &&
!!Settings.settingsGet('GoogleClientID') && !!Settings.settingsGet('GoogleApiKey'));
this.driveVisible = ko.observable(false);
this.driveCommand = createCommand(() => {
this.driveOpenPopup();
return true;
}, () => this.driveEnabled());
this.driveCallback = _.bind(this.driveCallback, this);
this.onMessageUploadAttachments = _.bind(this.onMessageUploadAttachments, this);
@ -565,6 +349,219 @@ class ComposePopupView extends AbstractViewNext
this.iTimer = 0;
}
@command((self) => self.canBeSentOrSaved())
sendCommand() {
const
sTo = trim(this.to()),
sCc = trim(this.cc()),
sBcc = trim(this.bcc());
let
sSentFolder = FolderStore.sentFolder();
this.attachmentsInProcessError(false);
this.attachmentsInErrorError(false);
this.emptyToError(false);
if (0 < this.attachmentsInProcess().length)
{
this.attachmentsInProcessError(true);
this.attachmentsPlace(true);
}
else if (0 < this.attachmentsInError().length)
{
this.attachmentsInErrorError(true);
this.attachmentsPlace(true);
}
if ('' === sTo && '' === sCc && '' === sBcc)
{
this.emptyToError(true);
}
if (!this.emptyToError() && !this.attachmentsInErrorError() && !this.attachmentsInProcessError())
{
if (SettingsStore.replySameFolder())
{
if (isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length && isNormal(this.aDraftInfo[2]) && 0 < this.aDraftInfo[2].length)
{
sSentFolder = this.aDraftInfo[2];
}
}
if (!this.allowFolders)
{
sSentFolder = UNUSED_OPTION_VALUE;
}
if ('' === sSentFolder)
{
showScreenPopup(require('View/Popup/FolderSystem'), [SetSystemFoldersNotification.Sent]);
}
else
{
this.sendError(false);
this.sending(true);
if (isArray(this.aDraftInfo) && 3 === this.aDraftInfo.length)
{
const flagsCache = getMessageFlagsFromCache(this.aDraftInfo[2], this.aDraftInfo[1]);
if (flagsCache)
{
if ('forward' === this.aDraftInfo[0])
{
flagsCache[3] = true;
}
else
{
flagsCache[2] = true;
}
setMessageFlagsToCache(this.aDraftInfo[2], this.aDraftInfo[1], flagsCache);
getApp().reloadFlagsCurrentMessageListAndMessageFromCache();
setFolderHash(this.aDraftInfo[2], '');
}
}
sSentFolder = UNUSED_OPTION_VALUE === sSentFolder ? '' : sSentFolder;
setFolderHash(this.draftFolder(), '');
setFolderHash(sSentFolder, '');
Remote.sendMessage(
this.sendMessageResponse,
this.currentIdentity() ? this.currentIdentity().id() : '',
this.draftFolder(),
this.draftUid(),
sSentFolder,
sTo,
this.cc(),
this.bcc(),
this.replyTo(),
this.subject(),
this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo,
this.sInReplyTo,
this.sReferences,
this.requestDsn(),
this.requestReadReceipt(),
this.markAsImportant()
);
}
}
}
@command((self) => self.canBeSentOrSaved())
saveCommand() {
if (!this.allowFolders)
{
return false;
}
if (FolderStore.draftFolderNotEnabled())
{
showScreenPopup(require('View/Popup/FolderSystem'), [SetSystemFoldersNotification.Draft]);
}
else
{
this.savedError(false);
this.saving(true);
this.autosaveStart();
setFolderHash(FolderStore.draftFolder(), '');
Remote.saveMessage(
this.saveMessageResponse,
this.currentIdentity() ? this.currentIdentity().id() : '',
this.draftFolder(),
this.draftUid(),
FolderStore.draftFolder(),
this.to(),
this.cc(),
this.bcc(),
this.replyTo(),
this.subject(),
this.oEditor ? this.oEditor.isHtml() : false,
this.oEditor ? this.oEditor.getData(true) : '',
this.prepearAttachmentsForSendOrSave(),
this.aDraftInfo,
this.sInReplyTo,
this.sReferences,
this.markAsImportant()
);
}
return true;
}
@command((self) => self.isDraftFolderMessage())
deleteCommand() {
const PopupsAskViewModel = require('View/Popup/Ask');
if (!isPopupVisible(PopupsAskViewModel) && this.modalVisibility())
{
showScreenPopup(PopupsAskViewModel, [i18n('POPUPS_ASK/DESC_WANT_DELETE_MESSAGES'), () => {
if (this.modalVisibility())
{
getApp().deleteMessagesFromFolderWithoutCheck(this.draftFolder(), [this.draftUid()]);
hideScreenPopup(ComposePopupView);
}
}]);
}
}
@command((self) => self.canBeSentOrSaved())
skipCommand() {
this.bSkipNextHide = true;
if (this.modalVisibility() && !this.saving() && !this.sending() &&
!FolderStore.draftFolderNotEnabled())
{
this.saveCommand();
}
this.tryToClosePopup();
}
@command((self) => self.allowContacts)
contactsCommand() {
if (this.allowContacts)
{
this.skipCommand();
_.delay(() => {
showScreenPopup(require('View/Popup/Contacts'), [true, this.sLastFocusedField]);
}, Magics.Time200ms);
}
}
@command((self) => self.dropboxEnabled())
dropboxCommand() {
if (window.Dropbox)
{
window.Dropbox.choose({
success: (files) => {
if (files && files[0] && files[0].link)
{
this.addDropboxAttachment(files[0]);
}
},
linkType: 'direct',
multiselect: false
});
}
return true;
}
@command((self) => self.driveEnabled())
driveCommand() {
this.driveOpenPopup();
return true;
}
autosaveFunction() {
if (this.modalVisibility() && !FolderStore.draftFolderNotEnabled() && !this.isEmptyForm(false) &&
!this.saving() && !this.sending() && !this.savedError())
@ -1991,4 +1988,4 @@ class ComposePopupView extends AbstractViewNext
}
}
module.exports = ComposePopupView;
export {ComposePopupView, ComposePopupView as default};

View file

@ -5,8 +5,7 @@ import ko from 'ko';
import key from 'key';
import {
inArray, createCommand,
pString, log, isUnd, trim,
inArray, pString, log, isUnd, trim,
defautOptionsAfterRender
} from 'Common/Utils';
@ -17,14 +16,13 @@ import PgpStore from 'Stores/User/Pgp';
import {EmailModel} from 'Model/Email';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
const KEY_NAME_SUBSTR = -8;
@view({
@popup({
name: 'View/Popup/ComposeOpenPgp',
type: ViewType.Popup,
templateID: 'PopupsComposeOpenPgp'
})
class ComposeOpenPgpPopupView extends AbstractViewNext
@ -92,210 +90,6 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
this.resultCallback = null;
// commands
this.doCommand = createCommand(() => {
let
result = true,
privateKey = null,
aPublicKeys = [];
this.submitRequest(true);
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
}));
result = false;
}
if (result)
{
const privateKeys = this.signKey().key.getNativeKeys();
privateKey = privateKeys[0] || null;
try
{
if (privateKey)
{
privateKey.decrypt(pString(this.password()));
}
}
catch (e)
{
privateKey = null;
}
if (!privateKey)
{
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
result = false;
}
}
}
if (result && this.encrypt())
{
if (0 === this.encryptKeys().length)
{
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
result = false;
}
else if (this.encryptKeys())
{
aPublicKeys = [];
_.each(this.encryptKeys(), (oKey) => {
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
}));
result = false;
}
});
if (result && (0 === aPublicKeys.length || this.encryptKeys().length !== aPublicKeys.length))
{
result = false;
}
}
}
if (result && this.resultCallback)
{
_.delay(() => {
let pgpPromise = null;
try
{
if (privateKey && 0 === aPublicKeys.length)
{
pgpPromise = PgpStore.openpgp.sign({
data: this.text(),
privateKeys: [privateKey]
});
}
else if (privateKey && 0 < aPublicKeys.length)
{
pgpPromise = PgpStore.openpgp.encrypt({
data: this.text(),
publicKeys: aPublicKeys,
privateKeys: [privateKey]
});
}
else if (!privateKey && 0 < aPublicKeys.length)
{
pgpPromise = PgpStore.openpgp.encrypt({
data: this.text(),
publicKeys: aPublicKeys
});
}
}
catch (e)
{
log(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', {
'ERROR': '' + e
}));
});
}
catch (e)
{
this.notification(i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
'ERROR': '' + e
}));
}
}
this.submitRequest(false);
}, Magics.Time20ms);
}
else
{
this.submitRequest(false);
}
return result;
}, () => !this.submitRequest() && (this.sign() || this.encrypt()));
this.selectCommand = createCommand(() => {
const
keyId = this.selectedPrivateKey(),
option = keyId ? _.find(this.privateKeysOptions(), (item) => item && keyId === item.id) : null;
if (option)
{
this.signKey({
'empty': !option.key,
'selected': ko.observable(!!option.key),
'users': option.key.users,
'hash': option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
'key': option.key
});
}
});
this.addCommand = createCommand(() => {
const
keyId = this.selectedPublicKey(),
keys = this.encryptKeys(),
option = keyId ? _.find(this.publicKeysOptions(), (item) => (item && keyId === item.id)) : null;
if (option)
{
keys.push({
'empty': !option.key,
'selected': ko.observable(!!option.key),
'removable': ko.observable(!this.sign() || !this.signKey() || this.signKey().key.id !== option.key.id),
'users': option.key.users,
'hash': option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
'key': option.key
});
this.encryptKeys(keys);
}
});
this.updateCommand = createCommand(() => {
_.each(this.encryptKeys(), (oKey) => {
oKey.removable(!this.sign() || !this.signKey() || this.signKey().key.id !== oKey.key.id);
});
});
this.selectedPrivateKey.subscribe((value) => {
if (value)
{
@ -328,6 +122,211 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
this.deletePublickKey = _.bind(this.deletePublickKey, this);
}
@command((self) => !self.submitRequest() && (self.sign() || self.encrypt()))
doCommand() {
let
result = true,
privateKey = null,
aPublicKeys = [];
this.submitRequest(true);
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
}));
result = false;
}
if (result)
{
const privateKeys = this.signKey().key.getNativeKeys();
privateKey = privateKeys[0] || null;
try
{
if (privateKey)
{
privateKey.decrypt(pString(this.password()));
}
}
catch (e)
{
privateKey = null;
}
if (!privateKey)
{
this.notification(i18n('PGP_NOTIFICATIONS/NO_PRIVATE_KEY_FOUND'));
result = false;
}
}
}
if (result && this.encrypt())
{
if (0 === this.encryptKeys().length)
{
this.notification(i18n('PGP_NOTIFICATIONS/NO_PUBLIC_KEYS_FOUND'));
result = false;
}
else if (this.encryptKeys())
{
aPublicKeys = [];
_.each(this.encryptKeys(), (oKey) => {
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
}));
result = false;
}
});
if (result && (0 === aPublicKeys.length || this.encryptKeys().length !== aPublicKeys.length))
{
result = false;
}
}
}
if (result && this.resultCallback)
{
_.delay(() => {
let pgpPromise = null;
try
{
if (privateKey && 0 === aPublicKeys.length)
{
pgpPromise = PgpStore.openpgp.sign({
data: this.text(),
privateKeys: [privateKey]
});
}
else if (privateKey && 0 < aPublicKeys.length)
{
pgpPromise = PgpStore.openpgp.encrypt({
data: this.text(),
publicKeys: aPublicKeys,
privateKeys: [privateKey]
});
}
else if (!privateKey && 0 < aPublicKeys.length)
{
pgpPromise = PgpStore.openpgp.encrypt({
data: this.text(),
publicKeys: aPublicKeys
});
}
}
catch (e)
{
log(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', {
'ERROR': '' + e
}));
});
}
catch (e)
{
this.notification(i18n('PGP_NOTIFICATIONS/PGP_ERROR', {
'ERROR': '' + e
}));
}
}
this.submitRequest(false);
}, Magics.Time20ms);
}
else
{
this.submitRequest(false);
}
return result;
}
@command()
selectCommand() {
const
keyId = this.selectedPrivateKey(),
option = keyId ? _.find(this.privateKeysOptions(), (item) => item && keyId === item.id) : null;
if (option)
{
this.signKey({
'empty': !option.key,
'selected': ko.observable(!!option.key),
'users': option.key.users,
'hash': option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
'key': option.key
});
}
}
@command()
addCommand() {
const
keyId = this.selectedPublicKey(),
keys = this.encryptKeys(),
option = keyId ? _.find(this.publicKeysOptions(), (item) => (item && keyId === item.id)) : null;
if (option)
{
keys.push({
'empty': !option.key,
'selected': ko.observable(!!option.key),
'removable': ko.observable(!this.sign() || !this.signKey() || this.signKey().key.id !== option.key.id),
'users': option.key.users,
'hash': option.key.id.substr(KEY_NAME_SUBSTR).toUpperCase(),
'key': option.key
});
this.encryptKeys(keys);
}
}
@command()
updateCommand() {
_.each(this.encryptKeys(), (oKey) => {
oKey.removable(!this.sign() || !this.signKey() || this.signKey().key.id !== oKey.key.id);
});
}
deletePublickKey(publicKey) {
this.encryptKeys.remove(publicKey);
}
@ -459,4 +458,4 @@ class ComposeOpenPgpPopupView extends AbstractViewNext
}
}
module.exports = ComposeOpenPgpPopupView;
export {ComposeOpenPgpPopupView, ComposeOpenPgpPopupView as default};

View file

@ -13,7 +13,7 @@ import {
import {
delegateRunOnDestroy, computedPagenatorHelper,
inArray, trim, windowResizeCallback, createCommand,
inArray, trim, windowResizeCallback,
isNonEmptyArray, fakeMd5, pInt, isUnd
} from 'Common/Utils';
@ -37,12 +37,11 @@ import {ContactPropertyModel} from 'Model/ContactProperty';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin';
import {popup, command, showScreenPopup, hideScreenPopup, routeOn, routeOff} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Contacts',
type: ViewType.Popup,
templateID: 'PopupsContacts'
})
class ContactsPopupView extends AbstractViewNext
@ -210,155 +209,6 @@ class ContactsPopupView extends AbstractViewNext
this.selector.on('onItemGetUid', (contact) => (contact ? contact.generateUid() : ''));
this.newCommand = createCommand(() => {
this.populateViewContact(null);
this.currentContact(null);
});
this.deleteCommand = createCommand(() => {
this.deleteSelectedContacts();
this.emptySelection(true);
}, () => 0 < this.contactsCheckedOrSelected().length);
this.newMessageCommand = createCommand(() => {
if (!Settings.capa(Capa.Composer))
{
return false;
}
let
aE = [],
toEmails = null,
ccEmails = null,
bccEmails = null;
const aC = this.contactsCheckedOrSelected();
if (isNonEmptyArray(aC))
{
aE = _.map(aC, (oItem) => {
if (oItem)
{
const
data = oItem.getNameAndEmailHelper(),
email = data ? new EmailModel(data[0], data[1]) : null;
if (email && email.validate())
{
return email;
}
}
return null;
});
aE = _.compact(aE);
}
if (isNonEmptyArray(aE))
{
this.bBackToCompose = false;
hideScreenPopup(require('View/Popup/Contacts'));
switch (this.sLastComposeFocusedField)
{
case 'cc':
ccEmails = aE;
break;
case 'bcc':
bccEmails = aE;
break;
case 'to':
default:
toEmails = aE;
break;
}
this.sLastComposeFocusedField = '';
_.delay(() => {
showScreenPopup(require('View/Popup/Compose'), [ComposeType.Empty, null, toEmails, ccEmails, bccEmails]);
}, Magics.Time200ms);
}
return true;
}, () => 0 < this.contactsCheckedOrSelected().length);
this.clearCommand = createCommand(() => {
this.search('');
});
this.saveCommand = createCommand(() => {
this.viewSaving(true);
this.viewSaveTrigger(SaveSettingsStep.Animate);
const
requestUid = fakeMd5(),
properties = [];
_.each(this.viewProperties(), (oItem) => {
if (oItem.type() && '' !== trim(oItem.value()))
{
properties.push([oItem.type(), oItem.value(), oItem.typeStr()]);
}
});
Remote.contactSave((sResult, oData) => {
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));
}
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);
}
}, requestUid, this.viewID(), properties);
}, () => {
const
bV = this.viewHasNonEmptyRequaredProperties(),
bReadOnly = this.viewReadOnly();
return !this.viewSaving() && bV && !bReadOnly;
});
this.syncCommand = createCommand(() => {
getApp().contactsSync((result, data) => {
if (StorageResultType.Success !== result || !data || !data.Result)
{
window.alert(getNotification(
data && data.ErrorCode ? data.ErrorCode : Notification.ContactsSyncError));
}
this.reloadContactList(true);
});
}, () => !this.contacts.syncing() && !this.contacts.importing());
this.bDropPageAfterDelete = false;
this.watchDirty = ko.observable(false);
@ -378,6 +228,157 @@ class ContactsPopupView extends AbstractViewNext
this.sDefaultKeyScope = KeyState.ContactList;
}
@command()
newCommand() {
this.populateViewContact(null);
this.currentContact(null);
}
@command((self) => 0 < self.contactsCheckedOrSelected().length)
deleteCommand() {
this.deleteSelectedContacts();
this.emptySelection(true);
}
@command((self) => 0 < self.contactsCheckedOrSelected().length)
newMessageCommand() {
if (!Settings.capa(Capa.Composer))
{
return false;
}
let
aE = [],
toEmails = null,
ccEmails = null,
bccEmails = null;
const aC = this.contactsCheckedOrSelected();
if (isNonEmptyArray(aC))
{
aE = _.map(aC, (oItem) => {
if (oItem)
{
const
data = oItem.getNameAndEmailHelper(),
email = data ? new EmailModel(data[0], data[1]) : null;
if (email && email.validate())
{
return email;
}
}
return null;
});
aE = _.compact(aE);
}
if (isNonEmptyArray(aE))
{
this.bBackToCompose = false;
hideScreenPopup(require('View/Popup/Contacts'));
switch (this.sLastComposeFocusedField)
{
case 'cc':
ccEmails = aE;
break;
case 'bcc':
bccEmails = aE;
break;
case 'to':
default:
toEmails = aE;
break;
}
this.sLastComposeFocusedField = '';
_.delay(() => {
showScreenPopup(require('View/Popup/Compose'), [ComposeType.Empty, null, toEmails, ccEmails, bccEmails]);
}, Magics.Time200ms);
}
return true;
}
@command()
clearCommand() {
this.search('');
}
@command((self) => {
const
bV = self.viewHasNonEmptyRequaredProperties(),
bReadOnly = self.viewReadOnly();
return !self.viewSaving() && bV && !bReadOnly;
})
saveCommand() {
this.viewSaving(true);
this.viewSaveTrigger(SaveSettingsStep.Animate);
const
requestUid = fakeMd5(),
properties = [];
_.each(this.viewProperties(), (oItem) => {
if (oItem.type() && '' !== trim(oItem.value()))
{
properties.push([oItem.type(), oItem.value(), oItem.typeStr()]);
}
});
Remote.contactSave((sResult, oData) => {
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));
}
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);
}
}, 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));
}
this.reloadContactList(true);
});
}
getPropertyPlaceholder(type) {
let result = '';
switch (type)
@ -722,4 +723,4 @@ class ContactsPopupView extends AbstractViewNext
}
}
module.exports = ContactsPopupView;
export {ContactsPopupView, ContactsPopupView as default};

View file

@ -5,7 +5,7 @@ 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 {createCommand, trim, pInt, pString} from 'Common/Utils';
import {trim, pInt, pString} from 'Common/Utils';
import {i18n} from 'Common/Translator';
import CapaAdminStore from 'Stores/Admin/Capa';
@ -14,12 +14,11 @@ import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Domain',
type: ViewType.Popup,
templateID: 'PopupsDomain'
})
class DomainPopupView extends AbstractViewNext
@ -141,79 +140,6 @@ class DomainPopupView extends AbstractViewNext
this.canBeTested = ko.computed(() => !this.testing() && this.domainIsComputed());
this.canBeSaved = ko.computed(() => !this.saving() && this.domainIsComputed());
this.createOrAddCommand = createCommand(() => {
this.saving(true);
Remote.createOrUpdateDomain(
_.bind(this.onDomainCreateOrSaveResponse, this),
!this.edit(),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.imapShortLogin(),
this.useSieve(),
this.sieveAllowRaw(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpShortLogin(),
this.smtpAuth(),
this.smtpPhpMail(),
this.whiteList()
);
}, this.canBeSaved);
this.testConnectionCommand = createCommand(() => {
this.page('main');
this.testingDone(false);
this.testingImapError(false);
this.testingSieveError(false);
this.testingSmtpError(false);
this.testing(true);
Remote.testConnectionForDomain(
_.bind(this.onTestConnectionResponse, this),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.useSieve(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpAuth(),
this.smtpPhpMail()
);
}, this.canBeTested);
this.whiteListCommand = createCommand(() => {
this.page('white-list');
});
this.backCommand = createCommand(() => {
this.page('main');
});
this.sieveCommand = createCommand(() => {
this.sieveSettings(!this.sieveSettings());
this.clearTesting();
});
this.page.subscribe(() => {
this.sieveSettings(false);
});
@ -293,6 +219,84 @@ class DomainPopupView extends AbstractViewNext
});
}
@command((self) => self.canBeSaved())
createOrAddCommand() {
this.saving(true);
Remote.createOrUpdateDomain(
_.bind(this.onDomainCreateOrSaveResponse, this),
!this.edit(),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.imapShortLogin(),
this.useSieve(),
this.sieveAllowRaw(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpShortLogin(),
this.smtpAuth(),
this.smtpPhpMail(),
this.whiteList()
);
}
@command((self) => self.canBeTested())
testConnectionCommand() {
this.page('main');
this.testingDone(false);
this.testingImapError(false);
this.testingSieveError(false);
this.testingSmtpError(false);
this.testing(true);
Remote.testConnectionForDomain(
_.bind(this.onTestConnectionResponse, this),
this.name(),
this.imapServer(),
pInt(this.imapPort()),
this.imapSecure(),
this.useSieve(),
this.sieveServer(),
pInt(this.sievePort()),
this.sieveSecure(),
this.smtpServer(),
pInt(this.smtpPort()),
this.smtpSecure(),
this.smtpAuth(),
this.smtpPhpMail()
);
}
@command()
whiteListCommand() {
this.page('white-list');
}
@command()
backCommand() {
this.page('main');
}
@command()
sieveCommand() {
this.sieveSettings(!this.sieveSettings());
this.clearTesting();
}
onTestConnectionResponse(sResult, oData) {
this.testing(false);
if (StorageResultType.Success === sResult && oData.Result)
@ -462,4 +466,4 @@ class DomainPopupView extends AbstractViewNext
}
}
module.exports = DomainPopupView;
export {DomainPopupView, DomainPopupView as default};

View file

@ -4,7 +4,6 @@ import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals';
import {createCommand} from 'Common/Utils';
import {i18n} from 'Common/Translator';
import DomainStore from 'Stores/Admin/Domain';
@ -13,12 +12,11 @@ import Remote from 'Remote/Admin/Ajax';
import {getApp} from 'Helper/Apps/Admin';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/DomainAlias',
type: ViewType.Popup,
templateID: 'PopupsDomainAlias'
})
class DomainAliasPopupView extends AbstractViewNext
@ -42,18 +40,19 @@ class DomainAliasPopupView extends AbstractViewNext
this.canBeSaved = ko.computed(() => !this.saving() && '' !== this.name() && '' !== this.alias());
this.createCommand = createCommand(() => {
this.saving(true);
Remote.createDomainAlias(
this.onDomainAliasCreateOrSaveResponse,
this.name(),
this.alias()
);
}, this.canBeSaved);
this.onDomainAliasCreateOrSaveResponse = _.bind(this.onDomainAliasCreateOrSaveResponse, this);
}
@command((self) => self.canBeSaved())
createCommand() {
this.saving(true);
Remote.createDomainAlias(
this.onDomainAliasCreateOrSaveResponse,
this.name(),
this.alias()
);
}
onDomainAliasCreateOrSaveResponse(result, data) {
this.saving(false);
if (StorageResultType.Success === result && data)
@ -96,4 +95,4 @@ class DomainAliasPopupView extends AbstractViewNext
}
}
module.exports = DomainAliasPopupView;
export {DomainAliasPopupView, DomainAliasPopupView as default};

View file

@ -4,18 +4,17 @@ import ko from 'ko';
import {FiltersAction, FilterConditionField, FilterConditionType} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals';
import {defautOptionsAfterRender, createCommand, delegateRun} from 'Common/Utils';
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 {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Filter',
type: ViewType.Popup,
templateID: 'PopupsFilter'
})
class FilterPopupView extends AbstractViewNext
@ -43,34 +42,6 @@ class FilterPopupView extends AbstractViewNext
}
});
this.saveFilter = createCommand(() => {
if (this.filter())
{
if (FiltersAction.MoveTo === this.filter().actionType())
{
this.filter().actionValue(this.selectedFolderValue());
}
if (!this.filter().verify())
{
return false;
}
if (this.fTrueCallback)
{
this.fTrueCallback(this.filter());
}
if (this.modalVisibility())
{
delegateRun(this, 'closeCommand');
}
}
return true;
});
this.actionTypeOptions = ko.observableArray([]);
this.fieldOptions = ko.observableArray([]);
this.typeOptions = ko.observableArray([]);
@ -81,6 +52,35 @@ class FilterPopupView extends AbstractViewNext
this.modules.subscribe(this.populateOptions, this);
}
@command()
saveFilterCommand() {
if (this.filter())
{
if (FiltersAction.MoveTo === this.filter().actionType())
{
this.filter().actionValue(this.selectedFolderValue());
}
if (!this.filter().verify())
{
return false;
}
if (this.fTrueCallback)
{
this.fTrueCallback(this.filter());
}
if (this.modalVisibility())
{
delegateRun(this, 'closeCommand');
}
}
return true;
}
populateOptions() {
this.actionTypeOptions([]);
@ -191,4 +191,4 @@ class FilterPopupView extends AbstractViewNext
}
}
module.exports = FilterPopupView;
export {FilterPopupView, FilterPopupView as default};

View file

@ -2,7 +2,6 @@
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {createCommand} from 'Common/Utils';
import {i18n, getNotification} from 'Common/Translator';
import {setFolderHash} from 'Common/Cache';
@ -12,12 +11,11 @@ import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/FolderClear',
type: ViewType.Popup,
templateID: 'PopupsFolderClear'
})
class FolderClearPopupView extends AbstractViewNext
@ -42,51 +40,51 @@ class FolderClearPopupView extends AbstractViewNext
this.dangerDescHtml = ko.computed(
() => i18n('POPUPS_CLEAR_FOLDER/DANGER_DESC_HTML_1', {'FOLDER': this.folderNameForClear()})
);
}
this.clearCommand = createCommand(() => {
@command((self) => {
const
folder = self.selectedFolder(),
isClearing = self.clearingProcess();
const folderToClear = this.selectedFolder();
if (folderToClear)
{
MessageStore.message(null);
MessageStore.messageList([]);
return !isClearing && null !== folder;
})
clearCommand() {
this.clearingProcess(true);
const folderToClear = this.selectedFolder();
if (folderToClear)
{
MessageStore.message(null);
MessageStore.messageList([]);
folderToClear.messageCountAll(0);
folderToClear.messageCountUnread(0);
this.clearingProcess(true);
setFolderHash(folderToClear.fullNameRaw, '');
folderToClear.messageCountAll(0);
folderToClear.messageCountUnread(0);
Remote.folderClear((result, data) => {
setFolderHash(folderToClear.fullNameRaw, '');
this.clearingProcess(false);
if (StorageResultType.Success === result && data && data.Result)
Remote.folderClear((result, data) => {
this.clearingProcess(false);
if (StorageResultType.Success === result && data && data.Result)
{
getApp().reloadMessageList(true);
this.cancelCommand();
}
else
{
if (data && data.ErrorCode)
{
getApp().reloadMessageList(true);
this.cancelCommand();
this.clearingError(getNotification(data.ErrorCode));
}
else
{
if (data && data.ErrorCode)
{
this.clearingError(getNotification(data.ErrorCode));
}
else
{
this.clearingError(getNotification(Notification.MailServerError));
}
this.clearingError(getNotification(Notification.MailServerError));
}
}, folderToClear.fullNameRaw);
}
}, () => {
const
folder = this.selectedFolder(),
isClearing = this.clearingProcess();
return !isClearing && null !== folder;
});
}
}, folderToClear.fullNameRaw);
}
}
clearPopup() {
@ -103,4 +101,4 @@ class FolderClearPopupView extends AbstractViewNext
}
}
module.exports = FolderClearPopupView;
export {FolderClearPopupView, FolderClearPopupView as default};

View file

@ -4,7 +4,7 @@ import ko from 'ko';
import {Notification} from 'Common/Enums';
import {UNUSED_OPTION_VALUE} from 'Common/Consts';
import {bMobileDevice} from 'Common/Globals';
import {trim, createCommand, defautOptionsAfterRender, folderListOptionsBuilder} from 'Common/Utils';
import {trim, defautOptionsAfterRender, folderListOptionsBuilder} from 'Common/Utils';
import FolderStore from 'Stores/User/Folder';
@ -12,12 +12,11 @@ import Promises from 'Promises/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/FolderCreate',
type: ViewType.Popup,
templateID: 'PopupsFolderCreate'
})
class FolderCreateView extends AbstractViewNext
@ -49,27 +48,26 @@ class FolderCreateView extends AbstractViewNext
});
// commands
this.createFolder = createCommand(() => {
let parentFolderName = this.selectedParentValue();
if ('' === parentFolderName && 1 < FolderStore.namespace.length)
{
parentFolderName = FolderStore.namespace.substr(0, FolderStore.namespace.length - 1);
}
getApp().foldersPromisesActionHelper(
Promises.folderCreate(this.folderName(), parentFolderName, FolderStore.foldersCreating),
Notification.CantCreateFolder
);
this.cancelCommand();
}, () => this.simpleFolderNameValidation(this.folderName()));
this.defautOptionsAfterRender = defautOptionsAfterRender;
}
@command((self) => self.simpleFolderNameValidation(self.folderName()))
createFolderCommand() {
let parentFolderName = this.selectedParentValue();
if ('' === parentFolderName && 1 < FolderStore.namespace.length)
{
parentFolderName = FolderStore.namespace.substr(0, FolderStore.namespace.length - 1);
}
getApp().foldersPromisesActionHelper(
Promises.folderCreate(this.folderName(), parentFolderName, FolderStore.foldersCreating),
Notification.CantCreateFolder
);
this.cancelCommand();
}
simpleFolderNameValidation(sName) {
return (/^[^\\\/]+$/g).test(trim(sName));
}
@ -92,4 +90,4 @@ class FolderCreateView extends AbstractViewNext
}
}
module.exports = FolderCreateView;
export {FolderCreateView, FolderCreateView as default};

View file

@ -12,12 +12,11 @@ import FolderStore from 'Stores/User/Folder';
import * as Settings from 'Storage/Settings';
import Remote from 'Remote/User/Ajax';
import {view, ViewType} from 'Knoin/Knoin';
import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/FolderSystem',
type: ViewType.Popup,
templateID: 'PopupsFolderSystem'
})
class FolderSystemPopupView extends AbstractViewNext
@ -110,4 +109,4 @@ class FolderSystemPopupView extends AbstractViewNext
}
}
module.exports = FolderSystemPopupView;
export {FolderSystemPopupView, FolderSystemPopupView as default};

View file

@ -3,19 +3,18 @@ import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals';
import {createCommand, trim, fakeMd5} from 'Common/Utils';
import {trim, fakeMd5} from 'Common/Utils';
import {getNotification} from 'Common/Translator';
import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Identity',
type: ViewType.Popup,
templateID: 'PopupsIdentity'
})
class IdentityPopupView extends AbstractViewNext
@ -58,68 +57,68 @@ class IdentityPopupView extends AbstractViewNext
this.showReplyTo(true);
}
});
}
this.addOrEditIdentityCommand = createCommand(() => {
@command((self) => !self.submitRequest())
addOrEditIdentityCommand() {
if (this.signature && this.signature.__fetchEditorValue)
if (this.signature && this.signature.__fetchEditorValue)
{
this.signature.__fetchEditorValue();
}
if (!this.email.hasError())
{
this.email.hasError('' === trim(this.email()));
}
if (this.email.hasError())
{
if (!this.owner())
{
this.signature.__fetchEditorValue();
this.email.focused(true);
}
if (!this.email.hasError())
{
this.email.hasError('' === trim(this.email()));
}
return false;
}
if (this.email.hasError())
if (this.replyTo.hasError())
{
this.replyTo.focused(true);
return false;
}
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 (!this.owner())
if (data.Result)
{
this.email.focused(true);
getApp().accountsAndIdentities();
this.cancelCommand();
}
return false;
}
if (this.replyTo.hasError())
{
this.replyTo.focused(true);
return false;
}
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)
else if (data.ErrorCode)
{
if (data.Result)
{
getApp().accountsAndIdentities();
this.cancelCommand();
}
else if (data.ErrorCode)
{
this.submitError(getNotification(data.ErrorCode));
}
}
else
{
this.submitError(getNotification(Notification.UnknownError));
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;
}, () => !this.submitRequest());
return true;
}
clearPopup() {
@ -184,4 +183,4 @@ class IdentityPopupView extends AbstractViewNext
}
}
module.exports = IdentityPopupView;
export {IdentityPopupView, IdentityPopupView as default};

View file

@ -4,12 +4,11 @@ import key from 'key';
import {KeyState, Magics} from 'Common/Enums';
import {view, ViewType} from 'Knoin/Knoin';
import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/KeyboardShortcutsHelp',
type: ViewType.Popup,
templateID: 'PopupsKeyboardShortcutsHelp'
})
class KeyboardShortcutsHelpPopupView extends AbstractViewNext
@ -52,4 +51,4 @@ class KeyboardShortcutsHelpPopupView extends AbstractViewNext
}
}
module.exports = KeyboardShortcutsHelpPopupView;
export {KeyboardShortcutsHelpPopupView, KeyboardShortcutsHelpPopupView as default};

View file

@ -4,12 +4,12 @@ import ko from 'ko';
import {convertLangName} from 'Common/Utils';
import {view, ViewType} from 'Knoin/Knoin';
// import {view, ViewType} from 'Knoin/Knoin';
import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Languages',
type: ViewType.Popup,
templateID: 'PopupsLanguages'
})
class LanguagesPopupView extends AbstractViewNext
@ -73,4 +73,4 @@ class LanguagesPopupView extends AbstractViewNext
}
}
module.exports = LanguagesPopupView;
export {LanguagesPopupView, LanguagesPopupView as default};

View file

@ -4,15 +4,14 @@ import ko from 'ko';
import key from 'key';
import $ from '$';
import {createCommand, pString, log} from 'Common/Utils';
import {pString, log} from 'Common/Utils';
import {KeyState, Magics} from 'Common/Enums';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/MessageOpenPgp',
type: ViewType.Popup,
templateID: 'PopupsMessageOpenPgp'
})
class MessageOpenPgpPopupView extends AbstractViewNext
@ -33,60 +32,59 @@ class MessageOpenPgpPopupView extends AbstractViewNext
this.submitRequest = ko.observable(false);
// commands
this.doCommand = createCommand(() => {
this.sDefaultKeyScope = KeyState.PopupMessageOpenPGP;
}
this.submitRequest(true);
@command((self) => !self.submitRequest())
doCommand() {
_.delay(() => {
this.submitRequest(true);
let privateKey = null;
_.delay(() => {
try
let privateKey = null;
try
{
if (this.resultCallback && this.selectedKey())
{
if (this.resultCallback && this.selectedKey())
{
const privateKeys = this.selectedKey().getNativeKeys();
privateKey = privateKeys && privateKeys[0] ? privateKeys[0] : null;
const privateKeys = this.selectedKey().getNativeKeys();
privateKey = privateKeys && privateKeys[0] ? privateKeys[0] : null;
if (privateKey)
if (privateKey)
{
try
{
try
if (!privateKey.decrypt(pString(this.password())))
{
if (!privateKey.decrypt(pString(this.password())))
{
log('Error: Private key cannot be decrypted');
privateKey = null;
}
}
catch (e)
{
log(e);
log('Error: Private key cannot be decrypted');
privateKey = null;
}
}
else
catch (e)
{
log('Error: Private key cannot be found');
log(e);
privateKey = null;
}
}
else
{
log('Error: Private key cannot be found');
}
}
catch (e)
{
log(e);
privateKey = null;
}
}
catch (e)
{
log(e);
privateKey = null;
}
this.submitRequest(false);
this.submitRequest(false);
this.cancelCommand();
this.resultCallback(privateKey);
this.cancelCommand();
this.resultCallback(privateKey);
}, Magics.Time100ms);
}, () => !this.submitRequest());
this.sDefaultKeyScope = KeyState.PopupMessageOpenPGP;
}, Magics.Time100ms);
}
clearPopup() {
@ -162,4 +160,4 @@ class MessageOpenPgpPopupView extends AbstractViewNext
}
}
module.exports = MessageOpenPgpPopupView;
export {MessageOpenPgpPopupView, MessageOpenPgpPopupView as default};

View file

@ -3,18 +3,17 @@ import _ from '_';
import ko from 'ko';
import {Magics} from 'Common/Enums';
import {trim, log, createCommand, delegateRun, pInt} from 'Common/Utils';
import {trim, log, delegateRun, pInt} from 'Common/Utils';
import PgpStore from 'Stores/User/Pgp';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/NewOpenPgpKey',
type: ViewType.Popup,
templateID: 'PopupsNewOpenPgpKey'
})
class NewOpenPgpKeyPopupView extends AbstractViewNext
@ -36,66 +35,67 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
this.email.subscribe(() => {
this.email.error(false);
});
}
this.generateOpenPgpKeyCommand = createCommand(() => {
@command()
generateOpenPgpKeyCommand() {
const
userId = {},
openpgpKeyring = PgpStore.openpgpKeyring;
const
userId = {},
openpgpKeyring = PgpStore.openpgpKeyring;
this.email.error('' === trim(this.email()));
if (!openpgpKeyring || this.email.error())
{
return false;
}
this.email.error('' === trim(this.email()));
if (!openpgpKeyring || this.email.error())
{
return false;
}
userId.email = this.email();
if ('' !== this.name())
{
userId.name = this.name();
}
userId.email = this.email();
if ('' !== this.name())
{
userId.name = this.name();
}
this.submitRequest(true);
this.submitError('');
this.submitRequest(true);
this.submitError('');
_.delay(() => {
_.delay(() => {
try {
try {
PgpStore.openpgp.generateKey({
userIds: [userId],
numBits: pInt(this.keyBitLength()),
passphrase: trim(this.password())
}).then((keyPair) => {
PgpStore.openpgp.generateKey({
userIds: [userId],
numBits: pInt(this.keyBitLength()),
passphrase: trim(this.password())
}).then((keyPair) => {
this.submitRequest(false);
this.submitRequest(false);
if (keyPair && keyPair.privateKeyArmored)
{
openpgpKeyring.privateKeys.importKey(keyPair.privateKeyArmored);
openpgpKeyring.publicKeys.importKey(keyPair.publicKeyArmored);
if (keyPair && keyPair.privateKeyArmored)
{
openpgpKeyring.privateKeys.importKey(keyPair.privateKeyArmored);
openpgpKeyring.publicKeys.importKey(keyPair.publicKeyArmored);
openpgpKeyring.store();
openpgpKeyring.store();
getApp().reloadOpenPgpKeys();
delegateRun(this, 'cancelCommand');
}
getApp().reloadOpenPgpKeys();
delegateRun(this, 'cancelCommand');
}
}).catch((e) => {
this.submitRequest(false);
this.showError(e);
});
}
catch (e)
{
}).catch((e) => {
this.submitRequest(false);
this.showError(e);
}
});
}
catch (e)
{
this.submitRequest(false);
this.showError(e);
}
}, Magics.Time100ms);
}, Magics.Time100ms);
return true;
});
return true;
}
showError(e) {
@ -126,4 +126,4 @@ class NewOpenPgpKeyPopupView extends AbstractViewNext
}
}
module.exports = NewOpenPgpKeyPopupView;
export {NewOpenPgpKeyPopupView, NewOpenPgpKeyPopupView as default};

View file

@ -4,17 +4,16 @@ import ko from 'ko';
import key from 'key';
import {KeyState, Magics, StorageResultType, Notification} from 'Common/Enums';
import {createCommand, isNonEmptyArray, delegateRun} from 'Common/Utils';
import {isNonEmptyArray, delegateRun} from 'Common/Utils';
import {getNotification, i18n} from 'Common/Translator';
import Remote from 'Remote/Admin/Ajax';
import {view, ViewType, isPopupVisible, showScreenPopup} from 'Knoin/Knoin';
import {popup, command, isPopupVisible, showScreenPopup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Plugin',
type: ViewType.Popup,
templateID: 'PopupsPlugin'
})
class PluginPopupView extends AbstractViewNext
@ -43,31 +42,31 @@ class PluginPopupView extends AbstractViewNext
'content': () => `<pre>${this.readme()}</pre>`
};
this.saveCommand = createCommand(() => {
const list = {};
list.Name = this.name();
_.each(this.configures(), (oItem) => {
let value = oItem.value();
if (false === value || true === value)
{
value = value ? '1' : '0';
}
list['_' + oItem.Name] = value;
});
this.saveError('');
Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, list);
}, this.hasConfiguration);
this.bDisabeCloseOnEsc = true;
this.sDefaultKeyScope = KeyState.All;
this.tryToClosePopup = _.debounce(_.bind(this.tryToClosePopup, this), Magics.Time200ms);
}
@command((self) => self.hasConfiguration())
saveCommand() {
const list = {};
list.Name = this.name();
_.each(this.configures(), (oItem) => {
let value = oItem.value();
if (false === value || true === value)
{
value = value ? '1' : '0';
}
list['_' + oItem.Name] = value;
});
this.saveError('');
Remote.pluginSettingsUpdate(this.onPluginSettingsUpdateResponse, list);
}
onPluginSettingsUpdateResponse(result, data) {
if (StorageResultType.Success === result && data && data.Result)
{
@ -138,4 +137,4 @@ class PluginPopupView extends AbstractViewNext
}
}
module.exports = PluginPopupView;
export {PluginPopupView, PluginPopupView as default};

View file

@ -2,7 +2,7 @@
import ko from 'ko';
import {StorageResultType, Notification} from 'Common/Enums';
import {trim, isNormal, createCommand} from 'Common/Utils';
import {trim, isNormal} from 'Common/Utils';
import {getNotification} from 'Common/Translator';
import {HtmlEditor} from 'Common/HtmlEditor';
@ -10,12 +10,11 @@ import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/Template',
type: ViewType.Popup,
templateID: 'PopupsTemplate'
})
class TemplatePopupView extends AbstractViewNext
@ -46,46 +45,46 @@ class TemplatePopupView extends AbstractViewNext
this.submitRequest = ko.observable(false);
this.submitError = ko.observable('');
}
this.addTemplateCommand = createCommand(() => {
@command((self) => !self.submitRequest())
addTemplateCommand() {
this.populateBodyFromEditor();
this.populateBodyFromEditor();
this.name.error('' === trim(this.name()));
this.body.error('' === trim(this.body()) || ':HTML:' === trim(this.body()));
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)
{
return false;
if (data.Result)
{
getApp().templates();
this.cancelCommand();
}
else if (data.ErrorCode)
{
this.submitError(getNotification(data.ErrorCode));
}
}
else
{
this.submitError(getNotification(Notification.UnknownError));
}
this.submitRequest(true);
}, this.id(), this.name(), this.body());
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));
}
}, this.id(), this.name(), this.body());
return true;
}, () => !this.submitRequest());
return true;
}
clearPopup() {
@ -183,4 +182,4 @@ class TemplatePopupView extends AbstractViewNext
}
}
module.exports = TemplatePopupView;
export {TemplatePopupView, TemplatePopupView as default};

View file

@ -14,12 +14,11 @@ import Remote from 'Remote/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {view, ViewType, showScreenPopup} from 'Knoin/Knoin';
import {popup, showScreenPopup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/TwoFactorConfiguration',
type: ViewType.Popup,
templateID: 'PopupsTwoFactorConfiguration'
})
class TwoFactorConfigurationPopupView extends AbstractViewNext
@ -214,4 +213,4 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext
}
}
module.exports = TwoFactorConfigurationPopupView;
export {TwoFactorConfigurationPopupView, TwoFactorConfigurationPopupView as default};

View file

@ -3,16 +3,14 @@ import ko from 'ko';
import {StorageResultType} from 'Common/Enums';
import {bMobileDevice} from 'Common/Globals';
import {createCommand} from 'Common/Utils';
import Remote from 'Remote/User/Ajax';
import {view, ViewType} from 'Knoin/Knoin';
import {popup, command} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/TwoFactorTest',
type: ViewType.Popup,
templateID: 'PopupsTwoFactorTest'
})
class TwoFactorTestPopupView extends AbstractViewNext
@ -27,24 +25,23 @@ class TwoFactorTestPopupView extends AbstractViewNext
this.koTestedTrigger = null;
this.testing = ko.observable(false);
}
// commands
this.testCode = createCommand(() => {
@command((self) => '' !== self.code() && !self.testing())
testCodeCommand() {
this.testing(true);
Remote.testTwoFactor((result, data) => {
this.testing(true);
Remote.testTwoFactor((result, data) => {
this.testing(false);
this.code.status(StorageResultType.Success === result && data && !!data.Result);
this.testing(false);
this.code.status(StorageResultType.Success === result && data && !!data.Result);
if (this.koTestedTrigger && this.code.status())
{
this.koTestedTrigger(true);
}
if (this.koTestedTrigger && this.code.status())
{
this.koTestedTrigger(true);
}
}, this.code());
}, () => '' !== this.code() && !this.testing());
}, this.code());
}
clearPopup() {
@ -70,4 +67,4 @@ class TwoFactorTestPopupView extends AbstractViewNext
}
}
module.exports = TwoFactorTestPopupView;
export {TwoFactorTestPopupView, TwoFactorTestPopupView as default};

View file

@ -5,12 +5,11 @@ import key from 'key';
import {KeyState} from 'Common/Enums';
import {selectElement} from 'Common/Utils';
import {view, ViewType} from 'Knoin/Knoin';
import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/ViewOpenPgpKey',
type: ViewType.Popup,
templateID: 'PopupsTwoFactorTest'
})
class ViewOpenPgpKeyPopupView extends AbstractViewNext
@ -53,4 +52,4 @@ class ViewOpenPgpKeyPopupView extends AbstractViewNext
}
}
module.exports = ViewOpenPgpKeyPopupView;
export {ViewOpenPgpKeyPopupView, ViewOpenPgpKeyPopupView as default};

View file

@ -3,12 +3,11 @@ import ko from 'ko';
import Promises from 'Promises/User/Ajax';
import {view, ViewType} from 'Knoin/Knoin';
import {popup} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({
@popup({
name: 'View/Popup/WelcomePage',
type: ViewType.Popup,
templateID: 'PopupsWelcomePage'
})
class WelcomePagePopupView extends AbstractViewNext
@ -45,4 +44,4 @@ class WelcomePagePopupView extends AbstractViewNext
}
}
module.exports = WelcomePagePopupView;
export {WelcomePagePopupView, WelcomePagePopupView as default};

View file

@ -22,8 +22,7 @@ import {
import {
inArray, isArray, isNonEmptyArray, trim, noop,
windowResize, windowResizeCallback, inFocus,
removeSelection, removeInFocus, mailToHelper,
createCommand
removeSelection, removeInFocus, mailToHelper
} from 'Common/Utils';
import Audio from 'Common/Audio';
@ -52,7 +51,7 @@ import Promises from 'Promises/User/Ajax';
import {getApp} from 'Helper/Apps/User';
import {view, command, ViewType, showScreenPopup} from 'Knoin/Knoin';
import {view, command, ViewType, showScreenPopup, createCommand} from 'Knoin/Knoin';
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
@view({

View file

@ -1,4 +1,4 @@
/* @flow */
import bootstrap from 'bootstrap';
import App from 'App/Admin';

View file

@ -1,4 +1,4 @@
/* @flow */
import bootstrap from 'bootstrap';
import App from 'App/User';

2
dev/bootstrap.js vendored
View file

@ -1,4 +1,4 @@
/* @flow */
import window from 'window';
import {killCtrlACtrlS, detectDropdownVisibility, createCommandLegacy, domReady} from 'Common/Utils';
import {$win, $html, data as GlobalsData, bMobileDevice} from 'Common/Globals';

View file

@ -391,20 +391,33 @@ gulp.task('js:admin', ['js:webpack'], function() {
});
// - min
gulp.task('js:min', ['js:app', 'js:admin'], function() {
gulp.task('js:es5:min', ['js:app', 'js:admin'], function() {
return gulp.src(cfg.paths.staticJS + '*.js')
.pipe(ignore.exclude('*.next.js'))
.pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify({
mangle: true,
compress: true
compress: true,
'screw-ie8': true
}))
.pipe(eol('\n', true))
.pipe(gulp.dest(cfg.paths.staticMinJS))
.on('error', gutil.log);
});
gulp.task('js:es6:min', ['js:app', 'js:admin'], function() {
return cfg.next ? gulp.src(cfg.paths.staticJS + '*.next.js')
.pipe(replace(/"rainloop\/v\/([^\/]+)\/static\/js\/"/g, '"rainloop/v/$1/static/js/min/"'))
// TODO
.pipe(eol('\n', true))
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest(cfg.paths.staticMinJS))
.on('error', gutil.log) : true;
});
gulp.task('js:min', ['js:es5:min', 'js:es6:min']);
// lint
gulp.task('js:eslint', function() {
return gulp.src(cfg.paths.globjs)

203
npm-shrinkwrap.json generated
View file

@ -162,9 +162,9 @@
"resolved": "https://registry.npmjs.org/async/-/async-0.2.10.tgz"
},
"async-each": {
"version": "1.0.0",
"version": "1.0.1",
"from": "async-each@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.0.tgz"
"resolved": "https://registry.npmjs.org/async-each/-/async-each-1.0.1.tgz"
},
"autolinker": {
"version": "1.1.0",
@ -633,9 +633,9 @@
"resolved": "https://registry.npmjs.org/big.js/-/big.js-3.1.3.tgz"
},
"binary-extensions": {
"version": "1.5.0",
"version": "1.6.0",
"from": "binary-extensions@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.5.0.tgz"
"resolved": "https://registry.npmjs.org/binary-extensions/-/binary-extensions-1.6.0.tgz"
},
"binaryextensions": {
"version": "1.0.1",
@ -685,9 +685,9 @@
"resolved": "https://registry.npmjs.org/braces/-/braces-1.8.5.tgz"
},
"brorand": {
"version": "1.0.5",
"version": "1.0.6",
"from": "brorand@>=1.0.1 <2.0.0",
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.5.tgz"
"resolved": "https://registry.npmjs.org/brorand/-/brorand-1.0.6.tgz"
},
"browserify-aes": {
"version": "1.0.6",
@ -940,7 +940,17 @@
"readable-stream": {
"version": "2.0.6",
"from": "readable-stream@>=2.0.0 <2.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
"dependencies": {
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -1161,7 +1171,21 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.0.0 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -1191,9 +1215,9 @@
"resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-0.1.5.tgz"
},
"enhanced-resolve": {
"version": "2.2.2",
"version": "2.3.0",
"from": "enhanced-resolve@>=2.2.0 <3.0.0",
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-2.2.2.tgz"
"resolved": "https://registry.npmjs.org/enhanced-resolve/-/enhanced-resolve-2.3.0.tgz"
},
"errno": {
"version": "0.1.4",
@ -1738,7 +1762,22 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.1.4 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/buffer-shims/-/buffer-shims-1.0.0.tgz"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -1878,7 +1917,21 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -1994,7 +2047,21 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -2187,9 +2254,9 @@
"resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.5.tgz"
},
"inherits": {
"version": "2.0.1",
"version": "2.0.3",
"from": "inherits@>=2.0.1 <2.1.0",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz"
},
"ini": {
"version": "1.3.4",
@ -2964,7 +3031,21 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -3367,7 +3448,14 @@
"supports-color": {
"version": "3.1.2",
"from": "supports-color@>=3.1.2 <4.0.0",
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz"
"resolved": "https://registry.npmjs.org/supports-color/-/supports-color-3.1.2.tgz",
"dependencies": {
"has-flag": {
"version": "1.0.0",
"from": "has-flag@>=1.0.0 <2.0.0",
"resolved": "https://registry.npmjs.org/has-flag/-/has-flag-1.0.0.tgz"
}
}
}
}
},
@ -3402,9 +3490,9 @@
"resolved": "https://registry.npmjs.org/private/-/private-0.1.6.tgz"
},
"process": {
"version": "0.11.8",
"version": "0.11.9",
"from": "process@>=0.11.0 <0.12.0",
"resolved": "https://registry.npmjs.org/process/-/process-0.11.8.tgz"
"resolved": "https://registry.npmjs.org/process/-/process-0.11.9.tgz"
},
"process-nextick-args": {
"version": "1.0.7",
@ -3647,7 +3735,21 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.0.1 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -3910,7 +4012,21 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -3937,7 +4053,21 @@
"readable-stream": {
"version": "2.1.5",
"from": "readable-stream@>=2.0.2 <3.0.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.1.5.tgz",
"dependencies": {
"buffer-shims": {
"version": "1.0.0",
"from": "buffer-shims@>=1.0.0 <2.0.0"
},
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0"
}
}
}
}
},
@ -4046,7 +4176,19 @@
"readable-stream": {
"version": "2.0.6",
"from": "readable-stream@>=2.0.0 <2.1.0",
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz"
"resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-2.0.6.tgz",
"dependencies": {
"process-nextick-args": {
"version": "1.0.7",
"from": "process-nextick-args@>=1.0.6 <1.1.0",
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz"
},
"util-deprecate": {
"version": "1.0.2",
"from": "util-deprecate@>=1.0.1 <1.1.0",
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz"
}
}
}
}
},
@ -4241,7 +4383,14 @@
"util": {
"version": "0.10.3",
"from": "util@>=0.10.3 <0.11.0",
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz"
"resolved": "https://registry.npmjs.org/util/-/util-0.10.3.tgz",
"dependencies": {
"inherits": {
"version": "2.0.1",
"from": "inherits@2.0.1",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.1.tgz"
}
}
},
"util-deprecate": {
"version": "1.0.2",
@ -4338,9 +4487,9 @@
"resolved": "https://registry.npmjs.org/wcwidth/-/wcwidth-1.0.1.tgz"
},
"webpack": {
"version": "2.1.0-beta.21",
"from": "webpack@>=2.1.0-beta.21 <3.0.0",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-2.1.0-beta.21.tgz",
"version": "2.1.0-beta.22",
"from": "webpack@2.1.0-beta.22",
"resolved": "https://registry.npmjs.org/webpack/-/webpack-2.1.0-beta.22.tgz",
"dependencies": {
"async": {
"version": "1.5.2",

View file

@ -114,7 +114,7 @@
"style-loader": "^0.13.1",
"tinycon": "github:tommoor/tinycon",
"underscore": "^1.8.3",
"webpack": "^2.1.0-beta.21",
"webpack": "2.1.0-beta.22",
"webpack-notifier": "1.4.1"
}
}

View file

@ -1,64 +1,64 @@
<div class="popups">
<div class="modal hide b-filter-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n="POPUPS_FILTER/TITLE_CREATE_FILTER" data-bind="visible: isNew"></span>
<span class="i18n" data-i18n="POPUPS_FILTER/TITLE_EDIT_FILTER" data-bind="visible: !isNew()"></span>
</h3>
</div>
<div class="modal-body">
<div class="row filter" data-bind="with: filter, i18nInit: filter">
<div class="span9" data-bind="i18nInit: true">
<div class="control-group" data-bind="css: {'error': name.error}">
<div class="controls">
<input type="text" class="i18n span5"
data-bind="value: name, hasFocus: name.focused"
autocorrect="off" autocapitalize="off" spellcheck="false"
data-i18n="[placeholder]POPUPS_FILTER/FILTER_NAME"
/>
</div>
</div>
<div class="legend i18n" data-i18n="POPUPS_FILTER/LEGEND_CONDITIONS"></div>
<div>
<div data-bind="visible: 1 < conditions().length">
<select class="span4" data-bind="value: conditionsType">
<option value="Any" class="i18n"
data-i18n="POPUPS_FILTER/SELECT_MATCH_ANY"></option>
<option value="All" class="i18n"
data-i18n="POPUPS_FILTER/SELECT_MATCH_ALL"></option>
</select>
</div>
<div data-bind="visible: 0 < conditions().length, foreach: conditions">
<div data-bind="template: {'name': template(), 'data': $data}"></div>
</div>
<div data-bind="visible: 0 === conditions().length">
<span class="i18n" data-i18n="POPUPS_FILTER/ALL_INCOMING_MESSAGES_DESC"></span>
</div>
<br />
<a class="btn" data-bind="click: addCondition, i18nInit: true">
<i class="icon-plus"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_ADD_CONDITION"></span>
</a>
</div>
<br />
<div class="legend i18n" data-i18n="POPUPS_FILTER/LEGEND_ACTIONS"></div>
<select class="span3" data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
<div data-bind="template: {'name': actionTemplate()}, i18nUpdate: actionTemplate"></div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn buttonSave" data-bind="command: saveFilter">
<i class="icon-ok"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_DONE"></span>
</a>
</div>
</div>
</div>
</div>
<div class="popups">
<div class="modal hide b-filter-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n="POPUPS_FILTER/TITLE_CREATE_FILTER" data-bind="visible: isNew"></span>
<span class="i18n" data-i18n="POPUPS_FILTER/TITLE_EDIT_FILTER" data-bind="visible: !isNew()"></span>
</h3>
</div>
<div class="modal-body">
<div class="row filter" data-bind="with: filter, i18nInit: filter">
<div class="span9" data-bind="i18nInit: true">
<div class="control-group" data-bind="css: {'error': name.error}">
<div class="controls">
<input type="text" class="i18n span5"
data-bind="value: name, hasFocus: name.focused"
autocorrect="off" autocapitalize="off" spellcheck="false"
data-i18n="[placeholder]POPUPS_FILTER/FILTER_NAME"
/>
</div>
</div>
<div class="legend i18n" data-i18n="POPUPS_FILTER/LEGEND_CONDITIONS"></div>
<div>
<div data-bind="visible: 1 < conditions().length">
<select class="span4" data-bind="value: conditionsType">
<option value="Any" class="i18n"
data-i18n="POPUPS_FILTER/SELECT_MATCH_ANY"></option>
<option value="All" class="i18n"
data-i18n="POPUPS_FILTER/SELECT_MATCH_ALL"></option>
</select>
</div>
<div data-bind="visible: 0 < conditions().length, foreach: conditions">
<div data-bind="template: {'name': template(), 'data': $data}"></div>
</div>
<div data-bind="visible: 0 === conditions().length">
<span class="i18n" data-i18n="POPUPS_FILTER/ALL_INCOMING_MESSAGES_DESC"></span>
</div>
<br />
<a class="btn" data-bind="click: addCondition, i18nInit: true">
<i class="icon-plus"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_ADD_CONDITION"></span>
</a>
</div>
<br />
<div class="legend i18n" data-i18n="POPUPS_FILTER/LEGEND_ACTIONS"></div>
<select class="span3" data-bind="options: $root.actionTypeOptions, value: actionType, optionsText: 'name', optionsValue: 'id'"></select>
<div data-bind="template: {'name': actionTemplate()}, i18nUpdate: actionTemplate"></div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn buttonSave" data-bind="command: saveFilterCommand">
<i class="icon-ok"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_FILTER/BUTTON_DONE"></span>
</a>
</div>
</div>
</div>
</div>

View file

@ -1,42 +1,42 @@
<div class="popups">
<div class="modal hide b-folder-create-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/TITLE_CREATE_FOLDER"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<br />
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/LABEL_NAME"></span>
</label>
<div class="controls">
<input type="text" class="uiInput inputName" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: folderName, hasfocus: folderName.focused, onEnter: createFolder" />
</div>
</div>
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/LABEL_PARENT"></span>
</label>
<div class="controls">
<select data-bind="options: parentFolderSelectList, value: selectedParentValue,
optionsText: 'name', optionsValue: 'id', optionsAfterRender: defautOptionsAfterRender"></select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn buttonCreate" data-bind="command: createFolder">
<i class="icon-folder-add"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/BUTTON_CREATE"></span>
</a>
</div>
</div>
</div>
</div>
<div class="popups">
<div class="modal hide b-folder-create-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/TITLE_CREATE_FOLDER"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<br />
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/LABEL_NAME"></span>
</label>
<div class="controls">
<input type="text" class="uiInput inputName" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: folderName, hasfocus: folderName.focused, onEnter: createFolderCommand" />
</div>
</div>
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/LABEL_PARENT"></span>
</label>
<div class="controls">
<select data-bind="options: parentFolderSelectList, value: selectedParentValue,
optionsText: 'name', optionsValue: 'id', optionsAfterRender: defautOptionsAfterRender"></select>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn buttonCreate" data-bind="command: createFolderCommand">
<i class="icon-folder-add"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_CREATE_FOLDER/BUTTON_CREATE"></span>
</a>
</div>
</div>
</div>
</div>

View file

@ -1,34 +1,34 @@
<div class="popups">
<div class="modal hide b-two-factor-test-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/TITLE_TEST_CODE"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<br />
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/LABEL_CODE"></span>
</label>
<div class="controls">
<input type="text" class="uiInput inputName"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: code, hasfocus: code.focused, onEnter: testCode" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn" data-bind="command: testCode, css: { 'btn-success': true === code.status(), 'btn-danger': false === code.status() }">
<i data-bind="css: {'icon-ok': !testing(), 'icon-spinner animated': testing(), 'icon-white': true === code.status() || false === code.status() }"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/BUTTON_TEST"></span>
</a>
</div>
</div>
</div>
</div>
<div class="popups">
<div class="modal hide b-two-factor-test-content g-ui-user-select-none" data-bind="modal: modalVisibility">
<div>
<div class="modal-header">
<button type="button" class="close" data-bind="command: cancelCommand">&times;</button>
<h3>
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/TITLE_TEST_CODE"></span>
</h3>
</div>
<div class="modal-body">
<div class="form-horizontal">
<br />
<div class="control-group">
<label class="control-label">
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/LABEL_CODE"></span>
</label>
<div class="controls">
<input type="text" class="uiInput inputName"
autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: code, hasfocus: code.focused, onEnter: testCodeCommand" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<a class="btn" data-bind="command: testCodeCommand, css: { 'btn-success': true === code.status(), 'btn-danger': false === code.status() }">
<i data-bind="css: {'icon-ok': !testing(), 'icon-spinner animated': testing(), 'icon-white': true === code.status() || false === code.status() }"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="POPUPS_TWO_FACTOR_TEST/BUTTON_TEST"></span>
</a>
</div>
</div>
</div>
</div>

View file

@ -1,106 +1,106 @@
<div class="b-settings-filters g-ui-user-select-none">
<div class="form-horizontal">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_FILTERS/LEGEND_FILTERS"></span>
&nbsp;&nbsp;&nbsp;
<i class="icon-spinner animated" style="margin-top: 5px" data-bind="visible: filters.loading"></i>
</div>
</div>
<div class="row" data-bind="visible: inited() && !serverError()">
<div class="span5 width100-on-mobile">
<a class="btn" data-bind="click: addFilter">
<i class="icon-plus"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_FILTERS/BUTTON_ADD_FILTER"></span>
</a>
&nbsp;&nbsp;
<a class="btn" data-tooltip-join="top" data-bind="visible: filterRaw.allow, click: function () { filterRaw.active(!filterRaw.active()) },
css: {'active': filterRaw.active }, tooltip: 'SETTINGS_FILTERS/BUTTON_RAW_SCRIPT'">
<i class="icon-file-code"></i>
</a>
&nbsp;&nbsp;
<a class="btn hide-on-disabled-command" data-placement="bottom" data-join="top"
data-bind="command: saveChanges, tooltipErrorTip: saveErrorText, css: {'btn-danger': '' !== saveErrorText()}">
<i data-bind="css: {'icon-floppy': !filters.saving(), 'icon-spinner animated': filters.saving()}"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_FILTERS/BUTTON_SAVE"></span>
</a>
</div>
</div>
<div class="row" data-bind="visible: haveChanges">
<div class="span8 width100-on-mobile">
<br />
<div class="alert g-ui-user-select-none" style="margin-bottom: 0">
<i class="icon-warning"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_FILTERS/CHACHES_NEED_TO_BE_SAVED_DESC"></span>
</div>
</div>
</div>
<div class="row" data-bind="visible: serverError">
<div class="span8 width100-on-mobile">
<div class="alert alert-error g-ui-user-select-none" style="margin-bottom: 0">
<i class="icon-warning"></i>
&nbsp;&nbsp;
<span data-bind="text: serverErrorDesc"></span>
</div>
</div>
</div>
<br />
<br />
<div class="row">
<div class="span8 width100-on-mobile">
<div class="control-group" data-bind="css: {'error': filterRaw.error}, visible: inited() && filterRaw.allow() && filterRaw.active()">
<div class="controls">
<pre style="word-break: break-word;" data-bind="visible: '' !== filterRaw.capa()">
<b class="i18n" data-i18n="SETTINGS_FILTERS/CAPABILITY_LABEL"></b>:
<span data-bind="text: filterRaw.capa"></span>
</pre>
<textarea class="span8" style="height: 300px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;"
data-bind="value: filterRaw, valueUpdate: 'afterkeydown'"></textarea>
</div>
</div>
<div class="filters-list-wrp">
<div class="filters-list-top-padding"></div>
<table class="table table-hover list-table filters-list g-ui-user-select-none"
data-bind="visible: inited() && (!filterRaw.active() || !filterRaw.active()), i18nUpdate: filters">
<colgroup>
<col style="width: 30px" />
<col style="width: 16px" />
<col />
<col style="width: 140px" />
<col style="width: 1%" />
</colgroup>
<tbody data-bind="sortable: {data: filters, options: scrollableOptions('.filters-list-wrp')}" style="width: 600px">
<tr class="filter-item">
<td>
<span class="disabled-filter" data-bind="click: function () { $root.haveChanges(true); enabled(!enabled()); }">
<i data-bind="css: {'icon-checkbox-checked': enabled, 'icon-checkbox-unchecked': !enabled()}"></i>
</span>
</td>
<td class="drag-wrapper">
<i class="icon-braille drag-handle"></i>
</td>
<td class="e-action">
<span class="filter-name" data-bind="text: name()"></span>
&nbsp;&nbsp;
<span class="filter-sub-name" data-bind="text: nameSub()"></span>
</td>
<td>
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oFilter) { $root.deleteFilter(oFilter); }">
<span class="i18n" data-i18n="SETTINGS_FILTERS/DELETING_ASK"></span>
</a>
</td>
<td>
<span class="delete-filter" data-bind="visible: !deleteAccess() && canBeDeleted(), click: function (oFilter) { $root.filterForDeletion(oFilter); }">
<i class="icon-trash"></i>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="b-settings-filters g-ui-user-select-none">
<div class="form-horizontal">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_FILTERS/LEGEND_FILTERS"></span>
&nbsp;&nbsp;&nbsp;
<i class="icon-spinner animated" style="margin-top: 5px" data-bind="visible: filters.loading"></i>
</div>
</div>
<div class="row" data-bind="visible: inited() && !serverError()">
<div class="span5 width100-on-mobile">
<a class="btn" data-bind="click: addFilter">
<i class="icon-plus"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_FILTERS/BUTTON_ADD_FILTER"></span>
</a>
&nbsp;&nbsp;
<a class="btn" data-tooltip-join="top" data-bind="visible: filterRaw.allow, click: function () { filterRaw.active(!filterRaw.active()) },
css: {'active': filterRaw.active }, tooltip: 'SETTINGS_FILTERS/BUTTON_RAW_SCRIPT'">
<i class="icon-file-code"></i>
</a>
&nbsp;&nbsp;
<a class="btn hide-on-disabled-command" data-placement="bottom" data-join="top"
data-bind="command: saveChangesCommand, tooltipErrorTip: saveErrorText, css: {'btn-danger': '' !== saveErrorText()}">
<i data-bind="css: {'icon-floppy': !filters.saving(), 'icon-spinner animated': filters.saving()}"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_FILTERS/BUTTON_SAVE"></span>
</a>
</div>
</div>
<div class="row" data-bind="visible: haveChanges">
<div class="span8 width100-on-mobile">
<br />
<div class="alert g-ui-user-select-none" style="margin-bottom: 0">
<i class="icon-warning"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_FILTERS/CHACHES_NEED_TO_BE_SAVED_DESC"></span>
</div>
</div>
</div>
<div class="row" data-bind="visible: serverError">
<div class="span8 width100-on-mobile">
<div class="alert alert-error g-ui-user-select-none" style="margin-bottom: 0">
<i class="icon-warning"></i>
&nbsp;&nbsp;
<span data-bind="text: serverErrorDesc"></span>
</div>
</div>
</div>
<br />
<br />
<div class="row">
<div class="span8 width100-on-mobile">
<div class="control-group" data-bind="css: {'error': filterRaw.error}, visible: inited() && filterRaw.allow() && filterRaw.active()">
<div class="controls">
<pre style="word-break: break-word;" data-bind="visible: '' !== filterRaw.capa()">
<b class="i18n" data-i18n="SETTINGS_FILTERS/CAPABILITY_LABEL"></b>:
<span data-bind="text: filterRaw.capa"></span>
</pre>
<textarea class="span8" style="height: 300px; font-family: Monaco, Menlo, Consolas, 'Courier New', monospace;"
data-bind="value: filterRaw, valueUpdate: 'afterkeydown'"></textarea>
</div>
</div>
<div class="filters-list-wrp">
<div class="filters-list-top-padding"></div>
<table class="table table-hover list-table filters-list g-ui-user-select-none"
data-bind="visible: inited() && (!filterRaw.active() || !filterRaw.active()), i18nUpdate: filters">
<colgroup>
<col style="width: 30px" />
<col style="width: 16px" />
<col />
<col style="width: 140px" />
<col style="width: 1%" />
</colgroup>
<tbody data-bind="sortable: {data: filters, options: scrollableOptions('.filters-list-wrp')}" style="width: 600px">
<tr class="filter-item">
<td>
<span class="disabled-filter" data-bind="click: function () { $root.haveChanges(true); enabled(!enabled()); }">
<i data-bind="css: {'icon-checkbox-checked': enabled, 'icon-checkbox-unchecked': !enabled()}"></i>
</span>
</td>
<td class="drag-wrapper">
<i class="icon-braille drag-handle"></i>
</td>
<td class="e-action">
<span class="filter-name" data-bind="text: name()"></span>
&nbsp;&nbsp;
<span class="filter-sub-name" data-bind="text: nameSub()"></span>
</td>
<td>
<a class="btn btn-small btn-small-small btn-danger pull-right button-delete button-delete-transitions" data-bind="css: {'delete-access': deleteAccess()}, click: function(oFilter) { $root.deleteFilter(oFilter); }">
<span class="i18n" data-i18n="SETTINGS_FILTERS/DELETING_ASK"></span>
</a>
</td>
<td>
<span class="delete-filter" data-bind="visible: !deleteAccess() && canBeDeleted(), click: function (oFilter) { $root.filterForDeletion(oFilter); }">
<i class="icon-trash"></i>
</span>
</td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>

View file

@ -1,101 +1,101 @@
<div class="b-settings-social g-ui-user-select-none">
<div class="form-horizontal" data-bind="visible: googleEnable() && googleEnableAuth()">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div>
<div class="control-group" data-bind="visible: !googleLoggined()">
<button class="btn" data-bind="command: connectGoogle">
<i class="icon-google" data-bind="visible: !googleActions()"></i>
<i class="icon-spinner animated" data-bind="visible: googleActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_GOOGLE_CONNECT"></span>
</button>
<br />
<br />
<blockquote>
<p class="i18n muted" style="width: 500px" data-i18n="SETTINGS_SOCIAL/MAIN_GOOGLE_DESC"></p>
</blockquote>
</div>
<div class="control-group" data-bind="visible: googleLoggined">
<strong>
<i class="icon-google"></i>
&nbsp;&nbsp;
<span data-bind="text: googleUserName"></span>
</strong>
<br />
<br />
<button class="btn" data-bind="command: disconnectGoogle">
<i class="icon-remove" data-bind="visible: !googleActions()"></i>
<i class="icon-spinner animated" data-bind="visible: googleActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_GOOGLE_DISCONNECT"></span>
</button>
</div>
</div>
<div class="form-horizontal" data-bind="visible: facebookEnable">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_FACEBOOK"></span>
</div>
<div class="control-group" data-bind="visible: !facebookLoggined()">
<button class="btn" data-bind="command: connectFacebook">
<i class="icon-facebook" data-bind="visible: !facebookActions()"></i>
<i class="icon-spinner animated" data-bind="visible: facebookActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_FACEBOOK_CONNECT"></span>
</button>
<br />
<br />
<blockquote>
<p class="i18n muted" style="width: 500px" data-i18n="SETTINGS_SOCIAL/MAIN_FACEBOOK_DESC"></p>
</blockquote>
</div>
<div class="control-group" data-bind="visible: facebookLoggined">
<strong>
<i class="icon-facebook"></i>
&nbsp;&nbsp;
<span data-bind="text: facebookUserName"></span>
</strong>
<br />
<br />
<button class="btn" data-bind="command: disconnectFacebook">
<i class="icon-remove" data-bind="visible: !facebookActions()"></i>
<i class="icon-spinner animated" data-bind="visible: facebookActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_FACEBOOK_DISCONNECT"></span>
</button>
</div>
</div>
<div class="form-horizontal" data-bind="visible: twitterEnable">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_TWITTER"></span>
</div>
<div class="control-group" data-bind="visible: !twitterLoggined()">
<button class="btn" data-bind="command: connectTwitter">
<i class="icon-twitter" data-bind="visible: !twitterActions()"></i>
<i class="icon-spinner animated" data-bind="visible: twitterActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_TWITTER_CONNECT"></span>
</button>
<br />
<br />
<blockquote>
<p class="i18n muted" style="width: 500px" data-i18n="SETTINGS_SOCIAL/MAIN_TWITTER_DESC"></p>
</blockquote>
</div>
<div class="control-group" data-bind="visible: twitterLoggined">
<strong>
<i class="icon-twitter"></i>
&nbsp;&nbsp;
<span data-bind="text: twitterUserName"></span>
</strong>
<br />
<br />
<button class="btn" data-bind="command: disconnectTwitter">
<i class="icon-remove" data-bind="visible: !twitterActions()"></i>
<i class="icon-spinner animated" data-bind="visible: twitterActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_TWITTER_DISCONNECT"></span>
</button>
</div>
</div>
<div class="b-settings-social g-ui-user-select-none">
<div class="form-horizontal" data-bind="visible: googleEnable() && googleEnableAuth()">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div>
<div class="control-group" data-bind="visible: !googleLoggined()">
<button class="btn" data-bind="command: connectGoogleCommand">
<i class="icon-google" data-bind="visible: !googleActions()"></i>
<i class="icon-spinner animated" data-bind="visible: googleActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_GOOGLE_CONNECT"></span>
</button>
<br />
<br />
<blockquote>
<p class="i18n muted" style="width: 500px" data-i18n="SETTINGS_SOCIAL/MAIN_GOOGLE_DESC"></p>
</blockquote>
</div>
<div class="control-group" data-bind="visible: googleLoggined">
<strong>
<i class="icon-google"></i>
&nbsp;&nbsp;
<span data-bind="text: googleUserName"></span>
</strong>
<br />
<br />
<button class="btn" data-bind="command: disconnectGoogleCommand">
<i class="icon-remove" data-bind="visible: !googleActions()"></i>
<i class="icon-spinner animated" data-bind="visible: googleActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_GOOGLE_DISCONNECT"></span>
</button>
</div>
</div>
<div class="form-horizontal" data-bind="visible: facebookEnable">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_FACEBOOK"></span>
</div>
<div class="control-group" data-bind="visible: !facebookLoggined()">
<button class="btn" data-bind="command: connectFacebookCommand">
<i class="icon-facebook" data-bind="visible: !facebookActions()"></i>
<i class="icon-spinner animated" data-bind="visible: facebookActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_FACEBOOK_CONNECT"></span>
</button>
<br />
<br />
<blockquote>
<p class="i18n muted" style="width: 500px" data-i18n="SETTINGS_SOCIAL/MAIN_FACEBOOK_DESC"></p>
</blockquote>
</div>
<div class="control-group" data-bind="visible: facebookLoggined">
<strong>
<i class="icon-facebook"></i>
&nbsp;&nbsp;
<span data-bind="text: facebookUserName"></span>
</strong>
<br />
<br />
<button class="btn" data-bind="command: disconnectFacebookCommand">
<i class="icon-remove" data-bind="visible: !facebookActions()"></i>
<i class="icon-spinner animated" data-bind="visible: facebookActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_FACEBOOK_DISCONNECT"></span>
</button>
</div>
</div>
<div class="form-horizontal" data-bind="visible: twitterEnable">
<div class="legend">
<span class="i18n" data-i18n="SETTINGS_SOCIAL/LEGEND_TWITTER"></span>
</div>
<div class="control-group" data-bind="visible: !twitterLoggined()">
<button class="btn" data-bind="command: connectTwitterCommand">
<i class="icon-twitter" data-bind="visible: !twitterActions()"></i>
<i class="icon-spinner animated" data-bind="visible: twitterActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_TWITTER_CONNECT"></span>
</button>
<br />
<br />
<blockquote>
<p class="i18n muted" style="width: 500px" data-i18n="SETTINGS_SOCIAL/MAIN_TWITTER_DESC"></p>
</blockquote>
</div>
<div class="control-group" data-bind="visible: twitterLoggined">
<strong>
<i class="icon-twitter"></i>
&nbsp;&nbsp;
<span data-bind="text: twitterUserName"></span>
</strong>
<br />
<br />
<button class="btn" data-bind="command: disconnectTwitterCommand">
<i class="icon-remove" data-bind="visible: !twitterActions()"></i>
<i class="icon-spinner animated" data-bind="visible: twitterActions()"></i>
&nbsp;&nbsp;
<span class="i18n" data-i18n="SETTINGS_SOCIAL/BUTTON_TWITTER_DISCONNECT"></span>
</button>
</div>
</div>
</div>

View file

@ -3,9 +3,9 @@ var
path = require('path'),
webpack = require('webpack'),
devPath = path.resolve(__dirname, 'dev'),
CopyWebpackPlugin = require('copy-webpack-plugin'),
WebpackNotifierPlugin = require('webpack-notifier');
WebpackNotifierPlugin = require('webpack-notifier'),
loose = true;
module.exports = function(publicPath, pro, es6) {
return {
@ -54,29 +54,29 @@ module.exports = function(publicPath, pro, es6) {
include: [devPath],
query: !es6 ? {
cacheDirectory: true,
presets: [['es2015', {loose: true, modules: false}], 'es2016', 'stage-0'],
presets: [['es2015', {loose: loose, modules: false}], 'es2016', 'stage-0'],
plugins: ['transform-runtime', 'transform-decorators-legacy']
} : {
cacheDirectory: true,
plugins: [
// es2015
["transform-es2015-template-literals", {loose: true}],
["transform-es2015-template-literals", {loose: loose}],
"transform-es2015-literals",
"transform-es2015-function-name",
// ["transform-es2015-arrow-functions")],
"transform-es2015-block-scoped-functions",
// ["transform-es2015-classes", {loose: true}],
// ["transform-es2015-classes", {loose: loose}],
// "transform-es2015-object-super",
"transform-es2015-shorthand-properties",
"transform-es2015-duplicate-keys",
["transform-es2015-computed-properties", {loose: true}],
["transform-es2015-for-of", {loose: true}],
["transform-es2015-computed-properties", {loose: loose}],
["transform-es2015-for-of", {loose: loose}],
"transform-es2015-sticky-regex",
"transform-es2015-unicode-regex",
// "check-es2015-constants",
//["transform-es2015-spread", {loose: true}],
//["transform-es2015-spread", {loose: loose}],
// "transform-es2015-parameters",
//["transform-es2015-destructuring", {loose: true}],
//["transform-es2015-destructuring", {loose: loose}],
// "transform-es2015-block-scoping",
"transform-es2015-typeof-symbol",
// ["transform-regenerator", { async: false, asyncGenerators: false }],