mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
eslint (additional rules)
This commit is contained in:
parent
77a1d3f3df
commit
8e8a041032
150 changed files with 21911 additions and 23106 deletions
|
|
@ -1,102 +1,94 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
ko = require('ko'),
|
||||
Settings = require('Storage/Settings'),
|
||||
CoreStore = require('Stores/Admin/Core'),
|
||||
AppStore = require('Stores/Admin/App');
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AboutAdminSettings()
|
||||
{
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
this.access = ko.observable(!!Settings.settingsGet('CoreAccess'));
|
||||
this.errorDesc = ko.observable('');
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
CoreStore = require('Stores/Admin/Core'),
|
||||
AppStore = require('Stores/Admin/App')
|
||||
;
|
||||
this.coreReal = CoreStore.coreReal;
|
||||
this.coreChannel = CoreStore.coreChannel;
|
||||
this.coreType = CoreStore.coreType;
|
||||
this.coreUpdatable = CoreStore.coreUpdatable;
|
||||
this.coreAccess = CoreStore.coreAccess;
|
||||
this.coreChecking = CoreStore.coreChecking;
|
||||
this.coreUpdating = CoreStore.coreUpdating;
|
||||
this.coreWarning = CoreStore.coreWarning;
|
||||
this.coreVersion = CoreStore.coreVersion;
|
||||
this.coreRemoteVersion = CoreStore.coreRemoteVersion;
|
||||
this.coreRemoteRelease = CoreStore.coreRemoteRelease;
|
||||
this.coreVersionCompare = CoreStore.coreVersionCompare;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AboutAdminSettings()
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
|
||||
this.coreRemoteVersionHtmlDesc = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return Translator.i18n('TAB_ABOUT/HTML_NEW_VERSION', {'VERSION': this.coreRemoteVersion()});
|
||||
}, this);
|
||||
|
||||
this.statusType = ko.computed(function() {
|
||||
|
||||
var
|
||||
sType = '',
|
||||
iVersionCompare = this.coreVersionCompare(),
|
||||
bChecking = this.coreChecking(),
|
||||
bUpdating = this.coreUpdating(),
|
||||
bReal = this.coreReal();
|
||||
|
||||
if (bChecking)
|
||||
{
|
||||
sType = 'checking';
|
||||
}
|
||||
else if (bUpdating)
|
||||
{
|
||||
sType = 'updating';
|
||||
}
|
||||
else if (bReal && 0 === iVersionCompare)
|
||||
{
|
||||
sType = 'up-to-date';
|
||||
}
|
||||
else if (bReal && -1 === iVersionCompare)
|
||||
{
|
||||
sType = 'available';
|
||||
}
|
||||
else if (!bReal)
|
||||
{
|
||||
sType = 'error';
|
||||
this.errorDesc('Cannot access the repository at the moment.');
|
||||
}
|
||||
|
||||
return sType;
|
||||
|
||||
}, this);
|
||||
}
|
||||
|
||||
AboutAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
if (this.access() && !this.community)
|
||||
{
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
this.access = ko.observable(!!Settings.settingsGet('CoreAccess'));
|
||||
this.errorDesc = ko.observable('');
|
||||
|
||||
this.coreReal = CoreStore.coreReal;
|
||||
this.coreChannel = CoreStore.coreChannel;
|
||||
this.coreType = CoreStore.coreType;
|
||||
this.coreUpdatable = CoreStore.coreUpdatable;
|
||||
this.coreAccess = CoreStore.coreAccess;
|
||||
this.coreChecking = CoreStore.coreChecking;
|
||||
this.coreUpdating = CoreStore.coreUpdating;
|
||||
this.coreWarning = CoreStore.coreWarning;
|
||||
this.coreVersion = CoreStore.coreVersion;
|
||||
this.coreRemoteVersion = CoreStore.coreRemoteVersion;
|
||||
this.coreRemoteRelease = CoreStore.coreRemoteRelease;
|
||||
this.coreVersionCompare = CoreStore.coreVersionCompare;
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
|
||||
this.coreRemoteVersionHtmlDesc = ko.computed(function () {
|
||||
Translator.trigger();
|
||||
return Translator.i18n('TAB_ABOUT/HTML_NEW_VERSION', {'VERSION': this.coreRemoteVersion()});
|
||||
}, this);
|
||||
|
||||
this.statusType = ko.computed(function () {
|
||||
|
||||
var
|
||||
sType = '',
|
||||
iVersionCompare = this.coreVersionCompare(),
|
||||
bChecking = this.coreChecking(),
|
||||
bUpdating = this.coreUpdating(),
|
||||
bReal = this.coreReal()
|
||||
;
|
||||
|
||||
if (bChecking)
|
||||
{
|
||||
sType = 'checking';
|
||||
}
|
||||
else if (bUpdating)
|
||||
{
|
||||
sType = 'updating';
|
||||
}
|
||||
else if (bReal && 0 === iVersionCompare)
|
||||
{
|
||||
sType = 'up-to-date';
|
||||
}
|
||||
else if (bReal && -1 === iVersionCompare)
|
||||
{
|
||||
sType = 'available';
|
||||
}
|
||||
else if (!bReal)
|
||||
{
|
||||
sType = 'error';
|
||||
this.errorDesc('Cannot access the repository at the moment.');
|
||||
}
|
||||
|
||||
return sType;
|
||||
|
||||
}, this);
|
||||
require('App/Admin').default.reloadCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
AboutAdminSettings.prototype.onBuild = function ()
|
||||
AboutAdminSettings.prototype.updateCoreData = function()
|
||||
{
|
||||
if (!this.coreUpdating() && !this.community)
|
||||
{
|
||||
if (this.access() && !this.community)
|
||||
{
|
||||
require('App/Admin').default.reloadCoreData();
|
||||
}
|
||||
};
|
||||
require('App/Admin').default.updateCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
AboutAdminSettings.prototype.updateCoreData = function ()
|
||||
{
|
||||
if (!this.coreUpdating() && !this.community)
|
||||
{
|
||||
require('App/Admin').default.updateCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AboutAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = AboutAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,123 +1,113 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function BrandingAdminSettings()
|
||||
{
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
Enums = require('Common/Enums'),
|
||||
Settings = require('Storage/Settings'),
|
||||
AppStore = require('Stores/Admin/App');
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator')
|
||||
;
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
this.title = ko.observable(Settings.settingsGet('Title'));
|
||||
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loadingDesc = ko.observable(Settings.settingsGet('LoadingDescription'));
|
||||
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.faviconUrl = ko.observable(Settings.settingsGet('FaviconUrl'));
|
||||
this.faviconUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginLogo = ko.observable(Settings.settingsGet('LoginLogo') || '');
|
||||
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginBackground = ko.observable(Settings.settingsGet('LoginBackground') || '');
|
||||
this.loginBackground.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogo = ko.observable(Settings.settingsGet('UserLogo') || '');
|
||||
this.userLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogoMessage = ko.observable(Settings.settingsGet('UserLogoMessage') || '');
|
||||
this.userLogoMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userIframeMessage = ko.observable(Settings.settingsGet('UserIframeMessage') || '');
|
||||
this.userIframeMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogoTitle = ko.observable(Settings.settingsGet('UserLogoTitle') || '');
|
||||
this.userLogoTitle.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginDescription = ko.observable(Settings.settingsGet('LoginDescription'));
|
||||
this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginCss = ko.observable(Settings.settingsGet('LoginCss'));
|
||||
this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userCss = ko.observable(Settings.settingsGet('UserCss'));
|
||||
this.userCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageUrl = ko.observable(Settings.settingsGet('WelcomePageUrl'));
|
||||
this.welcomePageUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageDisplay = ko.observable(Settings.settingsGet('WelcomePageDisplay'));
|
||||
this.welcomePageDisplay.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageDisplay.options = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'optValue': 'none', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||
{'optValue': 'once', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
||||
{'optValue': 'always', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
||||
];
|
||||
});
|
||||
|
||||
this.loginPowered = ko.observable(!!Settings.settingsGet('LoginPowered'));
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
}
|
||||
|
||||
BrandingAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function() {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function BrandingAdminSettings()
|
||||
{
|
||||
var
|
||||
Enums = require('Common/Enums'),
|
||||
Settings = require('Storage/Settings'),
|
||||
AppStore = require('Stores/Admin/App')
|
||||
;
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self);
|
||||
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
this.title = ko.observable(Settings.settingsGet('Title'));
|
||||
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loadingDesc = ko.observable(Settings.settingsGet('LoadingDescription'));
|
||||
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.faviconUrl = ko.observable(Settings.settingsGet('FaviconUrl'));
|
||||
this.faviconUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginLogo = ko.observable(Settings.settingsGet('LoginLogo') || '');
|
||||
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginBackground = ko.observable(Settings.settingsGet('LoginBackground') || '');
|
||||
this.loginBackground.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogo = ko.observable(Settings.settingsGet('UserLogo') || '');
|
||||
this.userLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogoMessage = ko.observable(Settings.settingsGet('UserLogoMessage') || '');
|
||||
this.userLogoMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userIframeMessage = ko.observable(Settings.settingsGet('UserIframeMessage') || '');
|
||||
this.userIframeMessage.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userLogoTitle = ko.observable(Settings.settingsGet('UserLogoTitle') || '');
|
||||
this.userLogoTitle.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginDescription = ko.observable(Settings.settingsGet('LoginDescription'));
|
||||
this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginCss = ko.observable(Settings.settingsGet('LoginCss'));
|
||||
this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.userCss = ko.observable(Settings.settingsGet('UserCss'));
|
||||
this.userCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageUrl = ko.observable(Settings.settingsGet('WelcomePageUrl'));
|
||||
this.welcomePageUrl.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageDisplay = ko.observable(Settings.settingsGet('WelcomePageDisplay'));
|
||||
this.welcomePageDisplay.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.welcomePageDisplay.options = ko.computed(function () {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'optValue': 'none', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||
{'optValue': 'once', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
||||
{'optValue': 'always', 'optText': Translator.i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
||||
];
|
||||
self.title.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'Title': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
this.loginPowered = ko.observable(!!Settings.settingsGet('LoginPowered'));
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
}
|
||||
|
||||
BrandingAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.faviconUrl.trigger, self)
|
||||
;
|
||||
|
||||
self.title.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'Title': Utils.trim(sValue)
|
||||
});
|
||||
self.loadingDesc.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'LoadingDescription': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loadingDesc.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'LoadingDescription': Utils.trim(sValue)
|
||||
});
|
||||
self.faviconUrl.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'FaviconUrl': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.faviconUrl.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'FaviconUrl': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
}, 50);
|
||||
};
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = BrandingAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = BrandingAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,244 +1,234 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactsAdminSettings()
|
||||
{
|
||||
var
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
this.enableContacts = ko.observable(!!Settings.settingsGet('ContactsEnable'));
|
||||
this.contactsSharing = ko.observable(!!Settings.settingsGet('ContactsSharing'));
|
||||
this.contactsSync = ko.observable(!!Settings.settingsGet('ContactsSync'));
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
aTypes = ['sqlite', 'mysql', 'pgsql'],
|
||||
aSupportedTypes = [],
|
||||
getTypeName = function(sName) {
|
||||
switch (sName)
|
||||
{
|
||||
case 'sqlite':
|
||||
sName = 'SQLite';
|
||||
break;
|
||||
case 'mysql':
|
||||
sName = 'MySQL';
|
||||
break;
|
||||
case 'pgsql':
|
||||
sName = 'PostgreSQL';
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
return sName;
|
||||
};
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactsAdminSettings()
|
||||
if (Settings.settingsGet('SQLiteIsSupported'))
|
||||
{
|
||||
var
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
this.enableContacts = ko.observable(!!Settings.settingsGet('ContactsEnable'));
|
||||
this.contactsSharing = ko.observable(!!Settings.settingsGet('ContactsSharing'));
|
||||
this.contactsSync = ko.observable(!!Settings.settingsGet('ContactsSync'));
|
||||
|
||||
var
|
||||
aTypes = ['sqlite', 'mysql', 'pgsql'],
|
||||
aSupportedTypes = [],
|
||||
getTypeName = function(sName) {
|
||||
switch (sName)
|
||||
{
|
||||
case 'sqlite':
|
||||
sName = 'SQLite';
|
||||
break;
|
||||
case 'mysql':
|
||||
sName = 'MySQL';
|
||||
break;
|
||||
case 'pgsql':
|
||||
sName = 'PostgreSQL';
|
||||
break;
|
||||
}
|
||||
|
||||
return sName;
|
||||
}
|
||||
;
|
||||
|
||||
if (Settings.settingsGet('SQLiteIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('sqlite');
|
||||
}
|
||||
if (Settings.settingsGet('MySqlIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('mysql');
|
||||
}
|
||||
if (Settings.settingsGet('PostgreSqlIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('pgsql');
|
||||
}
|
||||
|
||||
this.contactsSupported = 0 < aSupportedTypes.length;
|
||||
|
||||
this.contactsTypes = ko.observableArray([]);
|
||||
this.contactsTypesOptions = this.contactsTypes.map(function (sValue) {
|
||||
var bDisabled = -1 === Utils.inArray(sValue, aSupportedTypes);
|
||||
return {
|
||||
'id': sValue,
|
||||
'name': getTypeName(sValue) + (bDisabled ? ' (' + Translator.i18n('HINTS/NOT_SUPPORTED') + ')' : ''),
|
||||
'disabled': bDisabled
|
||||
};
|
||||
});
|
||||
|
||||
this.contactsTypes(aTypes);
|
||||
this.contactsType = ko.observable('');
|
||||
|
||||
this.mainContactsType = ko.computed({
|
||||
'owner': this,
|
||||
'read': this.contactsType,
|
||||
'write': function (sValue) {
|
||||
if (sValue !== this.contactsType())
|
||||
{
|
||||
if (-1 < Utils.inArray(sValue, aSupportedTypes))
|
||||
{
|
||||
this.contactsType(sValue);
|
||||
}
|
||||
else if (0 < aSupportedTypes.length)
|
||||
{
|
||||
this.contactsType('');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.contactsType.valueHasMutated();
|
||||
}
|
||||
}
|
||||
}).extend({'notify': 'always'});
|
||||
|
||||
this.contactsType.subscribe(function () {
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
}, this);
|
||||
|
||||
this.pdoDsn = ko.observable(Settings.settingsGet('ContactsPdoDsn'));
|
||||
this.pdoUser = ko.observable(Settings.settingsGet('ContactsPdoUser'));
|
||||
this.pdoPassword = ko.observable(Settings.settingsGet('ContactsPdoPassword'));
|
||||
|
||||
this.pdoDsnTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.pdoUserTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.pdoPasswordTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.contactsTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.testing = ko.observable(false);
|
||||
this.testContactsSuccess = ko.observable(false);
|
||||
this.testContactsError = ko.observable(false);
|
||||
this.testContactsErrorMessage = ko.observable('');
|
||||
|
||||
this.testContactsCommand = Utils.createCommand(this, function () {
|
||||
|
||||
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()
|
||||
});
|
||||
|
||||
}, function () {
|
||||
return '' !== this.pdoDsn() && '' !== this.pdoUser();
|
||||
});
|
||||
|
||||
this.contactsType(Settings.settingsGet('ContactsPdoType'));
|
||||
|
||||
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
|
||||
aSupportedTypes.push('sqlite');
|
||||
}
|
||||
if (Settings.settingsGet('MySqlIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('mysql');
|
||||
}
|
||||
if (Settings.settingsGet('PostgreSqlIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('pgsql');
|
||||
}
|
||||
|
||||
ContactsAdminSettings.prototype.onTestContactsResponse = function (sResult, oData)
|
||||
{
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
this.contactsSupported = 0 < aSupportedTypes.length;
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result.Result)
|
||||
{
|
||||
this.testContactsSuccess(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.testContactsError(true);
|
||||
if (oData && oData.Result)
|
||||
this.contactsTypes = ko.observableArray([]);
|
||||
this.contactsTypesOptions = this.contactsTypes.map(function(sValue) {
|
||||
var bDisabled = -1 === Utils.inArray(sValue, aSupportedTypes);
|
||||
return {
|
||||
'id': sValue,
|
||||
'name': getTypeName(sValue) + (bDisabled ? ' (' + Translator.i18n('HINTS/NOT_SUPPORTED') + ')' : ''),
|
||||
'disabled': bDisabled
|
||||
};
|
||||
});
|
||||
|
||||
this.contactsTypes(aTypes);
|
||||
this.contactsType = ko.observable('');
|
||||
|
||||
this.mainContactsType = ko.computed({
|
||||
'owner': this,
|
||||
'read': this.contactsType,
|
||||
'write': function(sValue) {
|
||||
if (sValue !== this.contactsType())
|
||||
{
|
||||
this.testContactsErrorMessage(oData.Result.Message || '');
|
||||
if (-1 < Utils.inArray(sValue, aSupportedTypes))
|
||||
{
|
||||
this.contactsType(sValue);
|
||||
}
|
||||
else if (0 < aSupportedTypes.length)
|
||||
{
|
||||
this.contactsType('');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.testContactsErrorMessage('');
|
||||
this.contactsType.valueHasMutated();
|
||||
}
|
||||
}
|
||||
}).extend({'notify': 'always'});
|
||||
|
||||
this.testing(false);
|
||||
};
|
||||
|
||||
ContactsAdminSettings.prototype.onShow = function ()
|
||||
{
|
||||
this.contactsType.subscribe(function() {
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
};
|
||||
}, this);
|
||||
|
||||
ContactsAdminSettings.prototype.onBuild = function ()
|
||||
this.pdoDsn = ko.observable(Settings.settingsGet('ContactsPdoDsn'));
|
||||
this.pdoUser = ko.observable(Settings.settingsGet('ContactsPdoUser'));
|
||||
this.pdoPassword = ko.observable(Settings.settingsGet('ContactsPdoPassword'));
|
||||
|
||||
this.pdoDsnTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.pdoUserTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.pdoPasswordTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.contactsTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.testing = ko.observable(false);
|
||||
this.testContactsSuccess = ko.observable(false);
|
||||
this.testContactsError = ko.observable(false);
|
||||
this.testContactsErrorMessage = ko.observable('');
|
||||
|
||||
this.testContactsCommand = Utils.createCommand(this, function() {
|
||||
|
||||
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()
|
||||
});
|
||||
|
||||
}, function() {
|
||||
return '' !== this.pdoDsn() && '' !== this.pdoUser();
|
||||
});
|
||||
|
||||
this.contactsType(Settings.settingsGet('ContactsPdoType'));
|
||||
|
||||
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
|
||||
}
|
||||
|
||||
ContactsAdminSettings.prototype.onTestContactsResponse = function(sResult, oData)
|
||||
{
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result.Result)
|
||||
{
|
||||
this.testContactsSuccess(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.testContactsError(true);
|
||||
if (oData && oData.Result)
|
||||
{
|
||||
this.testContactsErrorMessage(oData.Result.Message || '');
|
||||
}
|
||||
else
|
||||
{
|
||||
this.testContactsErrorMessage('');
|
||||
}
|
||||
}
|
||||
|
||||
this.testing(false);
|
||||
};
|
||||
|
||||
ContactsAdminSettings.prototype.onShow = function()
|
||||
{
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
};
|
||||
|
||||
ContactsAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.pdoDsnTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.pdoUserTrigger, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.pdoPasswordTrigger, self),
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self);
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.pdoDsnTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.pdoUserTrigger, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.pdoPasswordTrigger, self),
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.contactsTypeTrigger, self)
|
||||
;
|
||||
|
||||
self.enableContacts.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsEnable': bValue ? '1' : '0'
|
||||
});
|
||||
self.enableContacts.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsSharing.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsSharing': bValue ? '1' : '0'
|
||||
});
|
||||
self.contactsSharing.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsSharing': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsSync.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsSync': bValue ? '1' : '0'
|
||||
});
|
||||
self.contactsSync.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsSync': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsType.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'ContactsPdoType': sValue
|
||||
});
|
||||
self.contactsType.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'ContactsPdoType': sValue
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoDsn.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'ContactsPdoDsn': Utils.trim(sValue)
|
||||
});
|
||||
self.pdoDsn.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'ContactsPdoDsn': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoUser.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'ContactsPdoUser': Utils.trim(sValue)
|
||||
});
|
||||
self.pdoUser.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'ContactsPdoUser': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoPassword.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'ContactsPdoPassword': Utils.trim(sValue)
|
||||
});
|
||||
self.pdoPassword.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'ContactsPdoPassword': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsType(Settings.settingsGet('ContactsPdoType'));
|
||||
self.contactsType(Settings.settingsGet('ContactsPdoType'));
|
||||
|
||||
}, 50);
|
||||
};
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = ContactsAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = ContactsAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,86 +1,78 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
DomainStore = require('Stores/Admin/Domain'),
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function DomainsAdminSettings()
|
||||
{
|
||||
this.domains = DomainStore.domains;
|
||||
|
||||
DomainStore = require('Stores/Admin/Domain'),
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
this.visibility = ko.computed(function() {
|
||||
return this.domains.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function DomainsAdminSettings()
|
||||
this.domainForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.onDomainListChangeRequest = _.bind(this.onDomainListChangeRequest, this);
|
||||
this.onDomainLoadRequest = _.bind(this.onDomainLoadRequest, this);
|
||||
}
|
||||
|
||||
DomainsAdminSettings.prototype.createDomain = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Domain'));
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.createDomainAlias = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/DomainAlias'));
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.deleteDomain = function(oDomain)
|
||||
{
|
||||
this.domains.remove(oDomain);
|
||||
Remote.domainDelete(this.onDomainListChangeRequest, oDomain.name);
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.disableDomain = function(oDomain)
|
||||
{
|
||||
oDomain.disabled(!oDomain.disabled());
|
||||
Remote.domainDisable(this.onDomainListChangeRequest, oDomain.name, oDomain.disabled());
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
oDom
|
||||
.on('click', '.b-admin-domains-list-table .e-item .e-action', function() {
|
||||
var oDomainItem = ko.dataFor(this);
|
||||
if (oDomainItem)
|
||||
{
|
||||
Remote.domain(self.onDomainLoadRequest, oDomainItem.name);
|
||||
}
|
||||
});
|
||||
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onDomainLoadRequest = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
this.domains = DomainStore.domains;
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return this.domains.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
this.domainForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.onDomainListChangeRequest = _.bind(this.onDomainListChangeRequest, this);
|
||||
this.onDomainLoadRequest = _.bind(this.onDomainLoadRequest, this);
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Domain'), [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.createDomain = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Domain'));
|
||||
};
|
||||
DomainsAdminSettings.prototype.onDomainListChangeRequest = function()
|
||||
{
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.createDomainAlias = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/DomainAlias'));
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.deleteDomain = function (oDomain)
|
||||
{
|
||||
this.domains.remove(oDomain);
|
||||
Remote.domainDelete(this.onDomainListChangeRequest, oDomain.name);
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.disableDomain = function (oDomain)
|
||||
{
|
||||
oDomain.disabled(!oDomain.disabled());
|
||||
Remote.domainDisable(this.onDomainListChangeRequest, oDomain.name, oDomain.disabled());
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
oDom
|
||||
.on('click', '.b-admin-domains-list-table .e-item .e-action', function () {
|
||||
var oDomainItem = ko.dataFor(this);
|
||||
if (oDomainItem)
|
||||
{
|
||||
Remote.domain(self.onDomainLoadRequest, oDomainItem.name);
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onDomainLoadRequest = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Domain'), [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
DomainsAdminSettings.prototype.onDomainListChangeRequest = function ()
|
||||
{
|
||||
require('App/Admin').default.reloadDomainList();
|
||||
};
|
||||
|
||||
module.exports = DomainsAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = DomainsAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,211 +1,202 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
ThemeStore = require('Stores/Theme'),
|
||||
LanguageStore = require('Stores/Language'),
|
||||
AppAdminStore = require('Stores/Admin/App'),
|
||||
CapaAdminStore = require('Stores/Admin/Capa'),
|
||||
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function GeneralAdminSettings()
|
||||
{
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.languageAdmin = LanguageStore.languageAdmin;
|
||||
this.languagesAdmin = LanguageStore.languagesAdmin;
|
||||
|
||||
this.theme = ThemeStore.theme;
|
||||
this.themes = ThemeStore.themes;
|
||||
|
||||
this.capaThemes = CapaAdminStore.themes;
|
||||
this.capaUserBackground = CapaAdminStore.userBackground;
|
||||
this.capaGravatar = CapaAdminStore.gravatar;
|
||||
this.capaAdditionalAccounts = CapaAdminStore.additionalAccounts;
|
||||
this.capaIdentities = CapaAdminStore.identities;
|
||||
this.capaAttachmentThumbnails = CapaAdminStore.attachmentThumbnails;
|
||||
this.capaTemplates = CapaAdminStore.templates;
|
||||
|
||||
this.allowLanguagesOnSettings = AppAdminStore.allowLanguagesOnSettings;
|
||||
this.weakPassword = AppAdminStore.weakPassword;
|
||||
|
||||
this.mainAttachmentLimit = ko.observable(Utils.pInt(Settings.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25});
|
||||
this.uploadData = Settings.settingsGet('PhpUploadSizes');
|
||||
this.uploadDataDesc = this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size) ? [
|
||||
this.uploadData.upload_max_filesize ? 'upload_max_filesize = ' + this.uploadData.upload_max_filesize + '; ' : '',
|
||||
this.uploadData.post_max_size ? 'post_max_size = ' + this.uploadData.post_max_size : ''
|
||||
].join('') : '';
|
||||
|
||||
this.themesOptions = ko.computed(function() {
|
||||
return _.map(this.themes(), function(sTheme) {
|
||||
return {
|
||||
optValue: sTheme,
|
||||
optText: Utils.convertThemeName(sTheme)
|
||||
};
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.languageFullName = ko.computed(function() {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.languageAdminFullName = ko.computed(function() {
|
||||
return Utils.convertLangName(this.languageAdmin());
|
||||
}, this);
|
||||
|
||||
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.languageAdminTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
GeneralAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Translator = require('Common/Translator'),
|
||||
_.delay(function() {
|
||||
|
||||
ThemeStore = require('Stores/Theme'),
|
||||
LanguageStore = require('Stores/Language'),
|
||||
AppAdminStore = require('Stores/Admin/App'),
|
||||
CapaAdminStore = require('Stores/Admin/Capa'),
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function GeneralAdminSettings()
|
||||
{
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.languageAdmin = LanguageStore.languageAdmin;
|
||||
this.languagesAdmin = LanguageStore.languagesAdmin;
|
||||
|
||||
this.theme = ThemeStore.theme;
|
||||
this.themes = ThemeStore.themes;
|
||||
|
||||
this.capaThemes = CapaAdminStore.themes;
|
||||
this.capaUserBackground = CapaAdminStore.userBackground;
|
||||
this.capaGravatar = CapaAdminStore.gravatar;
|
||||
this.capaAdditionalAccounts = CapaAdminStore.additionalAccounts;
|
||||
this.capaIdentities = CapaAdminStore.identities;
|
||||
this.capaAttachmentThumbnails = CapaAdminStore.attachmentThumbnails;
|
||||
this.capaTemplates = CapaAdminStore.templates;
|
||||
|
||||
this.allowLanguagesOnSettings = AppAdminStore.allowLanguagesOnSettings;
|
||||
this.weakPassword = AppAdminStore.weakPassword;
|
||||
|
||||
this.mainAttachmentLimit = ko.observable(Utils.pInt(Settings.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25});
|
||||
this.uploadData = Settings.settingsGet('PhpUploadSizes');
|
||||
this.uploadDataDesc = this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size) ? [
|
||||
this.uploadData.upload_max_filesize ? 'upload_max_filesize = ' + this.uploadData.upload_max_filesize + '; ' : '',
|
||||
this.uploadData.post_max_size ? 'post_max_size = ' + this.uploadData.post_max_size : ''
|
||||
].join('') : '';
|
||||
|
||||
this.themesOptions = ko.computed(function () {
|
||||
return _.map(this.themes(), function (sTheme) {
|
||||
return {
|
||||
optValue: sTheme,
|
||||
optText: Utils.convertThemeName(sTheme)
|
||||
};
|
||||
});
|
||||
}, this);
|
||||
|
||||
this.languageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.languageAdminFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.languageAdmin());
|
||||
}, this);
|
||||
|
||||
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.languageAdminTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
GeneralAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.attachmentLimitTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self),
|
||||
fReloadLanguageHelper = function(iSaveSettingsStep) {
|
||||
return function() {
|
||||
self.languageAdminTrigger(iSaveSettingsStep);
|
||||
_.delay(function() {
|
||||
self.languageAdminTrigger(Enums.SaveSettingsStep.Idle);
|
||||
}, 1000);
|
||||
};
|
||||
};
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.attachmentLimitTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self),
|
||||
fReloadLanguageHelper = function (iSaveSettingsStep) {
|
||||
return function() {
|
||||
self.languageAdminTrigger(iSaveSettingsStep);
|
||||
_.delay(function () {
|
||||
self.languageAdminTrigger(Enums.SaveSettingsStep.Idle);
|
||||
}, 1000);
|
||||
};
|
||||
}
|
||||
;
|
||||
|
||||
self.mainAttachmentLimit.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'AttachmentLimit': Utils.pInt(sValue)
|
||||
});
|
||||
self.mainAttachmentLimit.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'AttachmentLimit': Utils.pInt(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.language.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'Language': Utils.trim(sValue)
|
||||
});
|
||||
self.language.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'Language': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.languageAdmin.subscribe(function (sValue) {
|
||||
self.languageAdmin.subscribe(function(sValue) {
|
||||
|
||||
self.languageAdminTrigger(Enums.SaveSettingsStep.Animate);
|
||||
self.languageAdminTrigger(Enums.SaveSettingsStep.Animate);
|
||||
|
||||
Translator.reload(true, sValue).then(
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult),
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult)
|
||||
).then(function() {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'LanguageAdmin': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
self.theme.subscribe(function (sValue) {
|
||||
|
||||
Utils.changeTheme(sValue, self.themeTrigger);
|
||||
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'Theme': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.capaAdditionalAccounts.subscribe(function (bValue) {
|
||||
Translator.reload(true, sValue).then(
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult),
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult)
|
||||
).then(function() {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAdditionalAccounts': bValue ? '1' : '0'
|
||||
'LanguageAdmin': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.capaIdentities.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaIdentities': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.theme.subscribe(function(sValue) {
|
||||
|
||||
Utils.changeTheme(sValue, self.themeTrigger);
|
||||
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'Theme': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.capaTemplates.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaTemplates': bValue ? '1' : '0'
|
||||
});
|
||||
self.capaAdditionalAccounts.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAdditionalAccounts': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaGravatar.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaGravatar': bValue ? '1' : '0'
|
||||
});
|
||||
self.capaIdentities.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaIdentities': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaAttachmentThumbnails.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAttachmentThumbnails': bValue ? '1' : '0'
|
||||
});
|
||||
self.capaTemplates.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaTemplates': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaThemes.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaThemes': bValue ? '1' : '0'
|
||||
});
|
||||
self.capaGravatar.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaGravatar': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaUserBackground.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaUserBackground': bValue ? '1' : '0'
|
||||
});
|
||||
self.capaAttachmentThumbnails.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAttachmentThumbnails': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowLanguagesOnSettings.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnSettings': bValue ? '1' : '0'
|
||||
});
|
||||
self.capaThemes.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaThemes': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
self.capaUserBackground.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaUserBackground': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
GeneralAdminSettings.prototype.selectLanguage = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
self.allowLanguagesOnSettings.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnSettings': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
GeneralAdminSettings.prototype.selectLanguageAdmin = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.languageAdmin, this.languagesAdmin(), LanguageStore.userLanguageAdmin()
|
||||
]);
|
||||
};
|
||||
}, 50);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
GeneralAdminSettings.prototype.phpInfoLink = function ()
|
||||
{
|
||||
return Links.phpInfo();
|
||||
};
|
||||
GeneralAdminSettings.prototype.selectLanguage = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
|
||||
module.exports = GeneralAdminSettings;
|
||||
GeneralAdminSettings.prototype.selectLanguageAdmin = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.languageAdmin, this.languagesAdmin(), LanguageStore.userLanguageAdmin()
|
||||
]);
|
||||
};
|
||||
|
||||
}());
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
GeneralAdminSettings.prototype.phpInfoLink = function()
|
||||
{
|
||||
return Links.phpInfo();
|
||||
};
|
||||
|
||||
module.exports = GeneralAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,74 +1,66 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
AppAdminStore = require('Stores/Admin/App'),
|
||||
|
||||
Settings = require('Storage/Settings');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LoginAdminSettings()
|
||||
{
|
||||
this.determineUserLanguage = AppAdminStore.determineUserLanguage;
|
||||
this.determineUserDomain = AppAdminStore.determineUserDomain;
|
||||
|
||||
this.defaultDomain = ko.observable(Settings.settingsGet('LoginDefaultDomain'));
|
||||
|
||||
this.allowLanguagesOnLogin = AppAdminStore.allowLanguagesOnLogin;
|
||||
this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dummy = ko.observable(false);
|
||||
}
|
||||
|
||||
LoginAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
_.delay(function() {
|
||||
|
||||
AppAdminStore = require('Stores/Admin/App'),
|
||||
var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
|
||||
|
||||
Settings = require('Storage/Settings')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function LoginAdminSettings()
|
||||
{
|
||||
this.determineUserLanguage = AppAdminStore.determineUserLanguage;
|
||||
this.determineUserDomain = AppAdminStore.determineUserDomain;
|
||||
|
||||
this.defaultDomain = ko.observable(Settings.settingsGet('LoginDefaultDomain'));
|
||||
|
||||
this.allowLanguagesOnLogin = AppAdminStore.allowLanguagesOnLogin;
|
||||
this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dummy = ko.observable(false);
|
||||
}
|
||||
|
||||
LoginAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
|
||||
|
||||
self.determineUserLanguage.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'DetermineUserLanguage': bValue ? '1' : '0'
|
||||
});
|
||||
self.determineUserLanguage.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'DetermineUserLanguage': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.determineUserDomain.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'DetermineUserDomain': bValue ? '1' : '0'
|
||||
});
|
||||
self.determineUserDomain.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'DetermineUserDomain': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowLanguagesOnLogin.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnLogin': bValue ? '1' : '0'
|
||||
});
|
||||
self.allowLanguagesOnLogin.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnLogin': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.defaultDomain.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'LoginDefaultDomain': Utils.trim(sValue)
|
||||
});
|
||||
self.defaultDomain.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'LoginDefaultDomain': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = LoginAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = LoginAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,113 +1,106 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
PackageStore = require('Stores/Admin/Package'),
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Translator = require('Common/Translator'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PackagesAdminSettings()
|
||||
{
|
||||
this.packagesError = ko.observable('');
|
||||
|
||||
PackageStore = require('Stores/Admin/Package'),
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
this.packages = PackageStore.packages;
|
||||
this.packagesReal = PackageStore.packagesReal;
|
||||
this.packagesMainUpdatable = PackageStore.packagesMainUpdatable;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PackagesAdminSettings()
|
||||
{
|
||||
this.packagesError = ko.observable('');
|
||||
this.packagesCurrent = this.packages.filter(function(item) {
|
||||
return item && '' !== item.installed && !item.compare;
|
||||
});
|
||||
|
||||
this.packages = PackageStore.packages;
|
||||
this.packagesReal = PackageStore.packagesReal;
|
||||
this.packagesMainUpdatable = PackageStore.packagesMainUpdatable;
|
||||
this.packagesAvailableForUpdate = this.packages.filter(function(item) {
|
||||
return item && '' !== item.installed && !!item.compare;
|
||||
});
|
||||
|
||||
this.packagesCurrent = this.packages.filter(function (item) {
|
||||
return item && '' !== item.installed && !item.compare;
|
||||
});
|
||||
this.packagesAvailableForInstallation = this.packages.filter(function(item) {
|
||||
return item && '' === item.installed;
|
||||
});
|
||||
|
||||
this.packagesAvailableForUpdate = this.packages.filter(function (item) {
|
||||
return item && '' !== item.installed && !!item.compare;
|
||||
});
|
||||
this.visibility = ko.computed(function() {
|
||||
return PackageStore.packages.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
}
|
||||
|
||||
this.packagesAvailableForInstallation = this.packages.filter(function (item) {
|
||||
return item && '' === item.installed;
|
||||
});
|
||||
PackagesAdminSettings.prototype.onShow = function()
|
||||
{
|
||||
this.packagesError('');
|
||||
};
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return PackageStore.packages.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
}
|
||||
PackagesAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
require('App/Admin').default.reloadPackagesList();
|
||||
};
|
||||
|
||||
PackagesAdminSettings.prototype.onShow = function ()
|
||||
{
|
||||
this.packagesError('');
|
||||
};
|
||||
PackagesAdminSettings.prototype.requestHelper = function(oPackage, bInstall)
|
||||
{
|
||||
var self = this;
|
||||
return function(sResult, oData) {
|
||||
|
||||
PackagesAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
require('App/Admin').default.reloadPackagesList();
|
||||
};
|
||||
|
||||
PackagesAdminSettings.prototype.requestHelper = function (oPackage, bInstall)
|
||||
{
|
||||
var self = this;
|
||||
return function (sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
|
||||
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
|
||||
{
|
||||
if (oData && oData.ErrorCode)
|
||||
{
|
||||
if (oData && oData.ErrorCode)
|
||||
{
|
||||
self.packagesError(Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
self.packagesError(Translator.getNotification(
|
||||
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
|
||||
}
|
||||
}
|
||||
|
||||
_.each(self.packages(), function (item) {
|
||||
if (item && oPackage && item.loading && item.loading() && oPackage.file === item.file)
|
||||
{
|
||||
oPackage.loading(false);
|
||||
item.loading(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result.Reload)
|
||||
{
|
||||
window.location.reload();
|
||||
self.packagesError(Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
require('App/Admin').default.reloadPackagesList();
|
||||
self.packagesError(Translator.getNotification(
|
||||
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
|
||||
}
|
||||
};
|
||||
};
|
||||
}
|
||||
|
||||
PackagesAdminSettings.prototype.deletePackage = function (oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
_.each(self.packages(), function(item) {
|
||||
if (item && oPackage && item.loading && item.loading() && oPackage.file === item.file)
|
||||
{
|
||||
oPackage.loading(false);
|
||||
item.loading(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result.Reload)
|
||||
{
|
||||
oPackage.loading(true);
|
||||
Remote.packageDelete(this.requestHelper(oPackage, false), oPackage);
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
require('App/Admin').default.reloadPackagesList();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
PackagesAdminSettings.prototype.installPackage = function (oPackage)
|
||||
PackagesAdminSettings.prototype.deletePackage = function(oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage.loading(true);
|
||||
Remote.packageInstall(this.requestHelper(oPackage, true), oPackage);
|
||||
}
|
||||
};
|
||||
oPackage.loading(true);
|
||||
Remote.packageDelete(this.requestHelper(oPackage, false), oPackage);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = PackagesAdminSettings;
|
||||
PackagesAdminSettings.prototype.installPackage = function(oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage.loading(true);
|
||||
Remote.packageInstall(this.requestHelper(oPackage, true), oPackage);
|
||||
}
|
||||
};
|
||||
|
||||
}());
|
||||
module.exports = PackagesAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,119 +1,111 @@
|
|||
|
||||
/* global RL_COMMUNITY */
|
||||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
AppStore = require('Stores/Admin/App'),
|
||||
PluginStore = require('Stores/Admin/Plugin'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
AppStore = require('Stores/Admin/App'),
|
||||
PluginStore = require('Stores/Admin/Plugin'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PluginsAdminSettings()
|
||||
{
|
||||
this.enabledPlugins = ko.observable(!!Settings.settingsGet('EnabledPlugins'));
|
||||
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
this.plugins = PluginStore.plugins;
|
||||
this.pluginsError = PluginStore.plugins.error;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function PluginsAdminSettings()
|
||||
{
|
||||
this.enabledPlugins = ko.observable(!!Settings.settingsGet('EnabledPlugins'));
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
|
||||
this.plugins = PluginStore.plugins;
|
||||
this.pluginsError = PluginStore.plugins.error;
|
||||
this.visibility = ko.computed(function() {
|
||||
return PluginStore.plugins.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
|
||||
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
|
||||
}
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return PluginStore.plugins.loading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
PluginsAdminSettings.prototype.disablePlugin = function(oPlugin)
|
||||
{
|
||||
oPlugin.disabled(!oPlugin.disabled());
|
||||
Remote.pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
|
||||
};
|
||||
|
||||
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
|
||||
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
|
||||
}
|
||||
PluginsAdminSettings.prototype.configurePlugin = function(oPlugin)
|
||||
{
|
||||
Remote.plugin(this.onPluginLoadRequest, oPlugin.name);
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.disablePlugin = function (oPlugin)
|
||||
{
|
||||
oPlugin.disabled(!oPlugin.disabled());
|
||||
Remote.pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
|
||||
};
|
||||
PluginsAdminSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
PluginsAdminSettings.prototype.configurePlugin = function (oPlugin)
|
||||
{
|
||||
Remote.plugin(this.onPluginLoadRequest, oPlugin.name);
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.e-item .configure-plugin-action', function () {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
self.configurePlugin(oPlugin);
|
||||
}
|
||||
})
|
||||
.on('click', '.e-item .disabled-plugin', function () {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
self.disablePlugin(oPlugin);
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
this.enabledPlugins.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'EnabledPlugins': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onShow = function ()
|
||||
{
|
||||
PluginStore.plugins.error('');
|
||||
require('App/Admin').default.reloadPluginList();
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onPluginLoadRequest = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Plugin'), [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onPluginDisableRequest = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData)
|
||||
{
|
||||
if (!oData.Result && oData.ErrorCode)
|
||||
oDom
|
||||
.on('click', '.e-item .configure-plugin-action', function() {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
if (Enums.Notification.UnsupportedPluginPackage === oData.ErrorCode && oData.ErrorMessage && '' !== oData.ErrorMessage)
|
||||
{
|
||||
PluginStore.plugins.error(oData.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginStore.plugins.error(Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
self.configurePlugin(oPlugin);
|
||||
}
|
||||
})
|
||||
.on('click', '.e-item .disabled-plugin', function() {
|
||||
var oPlugin = ko.dataFor(this);
|
||||
if (oPlugin)
|
||||
{
|
||||
self.disablePlugin(oPlugin);
|
||||
}
|
||||
});
|
||||
|
||||
this.enabledPlugins.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'EnabledPlugins': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onShow = function()
|
||||
{
|
||||
PluginStore.plugins.error('');
|
||||
require('App/Admin').default.reloadPluginList();
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onPluginLoadRequest = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Plugin'), [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
PluginsAdminSettings.prototype.onPluginDisableRequest = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData)
|
||||
{
|
||||
if (!oData.Result && oData.ErrorCode)
|
||||
{
|
||||
if (Enums.Notification.UnsupportedPluginPackage === oData.ErrorCode && oData.ErrorMessage && '' !== oData.ErrorMessage)
|
||||
{
|
||||
PluginStore.plugins.error(oData.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
PluginStore.plugins.error(Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
require('App/Admin').default.reloadPluginList();
|
||||
};
|
||||
require('App/Admin').default.reloadPluginList();
|
||||
};
|
||||
|
||||
module.exports = PluginsAdminSettings;
|
||||
|
||||
}());
|
||||
module.exports = PluginsAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,187 +1,180 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
AppAdminStore = require('Stores/Admin/App'),
|
||||
CapaAdminStore = require('Stores/Admin/Capa'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Settings = require('Storage/Settings'),
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
AppAdminStore = require('Stores/Admin/App'),
|
||||
CapaAdminStore = require('Stores/Admin/Capa'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SecurityAdminSettings()
|
||||
{
|
||||
this.useLocalProxyForExternalImages = AppAdminStore.useLocalProxyForExternalImages;
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
this.weakPassword = AppAdminStore.weakPassword;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SecurityAdminSettings()
|
||||
{
|
||||
this.useLocalProxyForExternalImages = AppAdminStore.useLocalProxyForExternalImages;
|
||||
this.capaOpenPGP = CapaAdminStore.openPGP;
|
||||
|
||||
this.weakPassword = AppAdminStore.weakPassword;
|
||||
this.capaTwoFactorAuth = CapaAdminStore.twoFactorAuth;
|
||||
this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce;
|
||||
|
||||
this.capaOpenPGP = CapaAdminStore.openPGP;
|
||||
|
||||
this.capaTwoFactorAuth = CapaAdminStore.twoFactorAuth;
|
||||
this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce;
|
||||
|
||||
this.capaTwoFactorAuth.subscribe(function (bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.capaTwoFactorAuthForce(false);
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.verifySslCertificate = ko.observable(!!Settings.settingsGet('VerifySslCertificate'));
|
||||
this.allowSelfSigned = ko.observable(!!Settings.settingsGet('AllowSelfSigned'));
|
||||
|
||||
this.verifySslCertificate.subscribe(function (bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.allowSelfSigned(true);
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.adminLogin = ko.observable(Settings.settingsGet('AdminLogin'));
|
||||
this.adminLoginError = ko.observable(false);
|
||||
this.adminPassword = ko.observable('');
|
||||
this.adminPasswordNew = ko.observable('');
|
||||
this.adminPasswordNew2 = ko.observable('');
|
||||
this.adminPasswordNewError = ko.observable(false);
|
||||
|
||||
this.adminPasswordUpdateError = ko.observable(false);
|
||||
this.adminPasswordUpdateSuccess = ko.observable(false);
|
||||
|
||||
this.adminPassword.subscribe(function () {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
}, this);
|
||||
|
||||
this.adminLogin.subscribe(function () {
|
||||
this.adminLoginError(false);
|
||||
}, this);
|
||||
|
||||
this.adminPasswordNew.subscribe(function () {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
this.adminPasswordNewError(false);
|
||||
}, this);
|
||||
|
||||
this.adminPasswordNew2.subscribe(function () {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
this.adminPasswordNewError(false);
|
||||
}, this);
|
||||
|
||||
this.saveNewAdminPasswordCommand = Utils.createCommand(this, function () {
|
||||
|
||||
if ('' === Utils.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()
|
||||
});
|
||||
|
||||
}, function () {
|
||||
return '' !== Utils.trim(this.adminLogin()) && '' !== this.adminPassword();
|
||||
});
|
||||
|
||||
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
|
||||
}
|
||||
|
||||
SecurityAdminSettings.prototype.onNewAdminPasswordResponse = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
this.capaTwoFactorAuth.subscribe(function(bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
|
||||
this.adminPasswordUpdateSuccess(true);
|
||||
|
||||
this.weakPassword(!!oData.Result.Weak);
|
||||
this.capaTwoFactorAuthForce(false);
|
||||
}
|
||||
else
|
||||
}, this);
|
||||
|
||||
this.verifySslCertificate = ko.observable(!!Settings.settingsGet('VerifySslCertificate'));
|
||||
this.allowSelfSigned = ko.observable(!!Settings.settingsGet('AllowSelfSigned'));
|
||||
|
||||
this.verifySslCertificate.subscribe(function(bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.adminPasswordUpdateError(true);
|
||||
this.allowSelfSigned(true);
|
||||
}
|
||||
};
|
||||
}, this);
|
||||
|
||||
SecurityAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
this.capaOpenPGP.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaOpenPGP': bValue ? '1' : '0'
|
||||
});
|
||||
this.adminLogin = ko.observable(Settings.settingsGet('AdminLogin'));
|
||||
this.adminLoginError = ko.observable(false);
|
||||
this.adminPassword = ko.observable('');
|
||||
this.adminPasswordNew = ko.observable('');
|
||||
this.adminPasswordNew2 = ko.observable('');
|
||||
this.adminPasswordNewError = ko.observable(false);
|
||||
|
||||
this.adminPasswordUpdateError = ko.observable(false);
|
||||
this.adminPasswordUpdateSuccess = ko.observable(false);
|
||||
|
||||
this.adminPassword.subscribe(function() {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
}, this);
|
||||
|
||||
this.adminLogin.subscribe(function() {
|
||||
this.adminLoginError(false);
|
||||
}, this);
|
||||
|
||||
this.adminPasswordNew.subscribe(function() {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
this.adminPasswordNewError(false);
|
||||
}, this);
|
||||
|
||||
this.adminPasswordNew2.subscribe(function() {
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
this.adminPasswordNewError(false);
|
||||
}, this);
|
||||
|
||||
this.saveNewAdminPasswordCommand = Utils.createCommand(this, function() {
|
||||
|
||||
if ('' === Utils.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()
|
||||
});
|
||||
|
||||
this.capaTwoFactorAuth.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaTwoFactorAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
}, function() {
|
||||
return '' !== Utils.trim(this.adminLogin()) && '' !== this.adminPassword();
|
||||
});
|
||||
|
||||
this.capaTwoFactorAuthForce.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaTwoFactorAuthForce': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
|
||||
}
|
||||
|
||||
this.useLocalProxyForExternalImages.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'UseLocalProxyForExternalImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.verifySslCertificate.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'VerifySslCertificate': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.allowSelfSigned.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowSelfSigned': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
SecurityAdminSettings.prototype.onHide = function ()
|
||||
SecurityAdminSettings.prototype.onNewAdminPasswordResponse = function(sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
SecurityAdminSettings.prototype.phpInfoLink = function ()
|
||||
this.adminPasswordUpdateSuccess(true);
|
||||
|
||||
this.weakPassword(!!oData.Result.Weak);
|
||||
}
|
||||
else
|
||||
{
|
||||
return Links.phpInfo();
|
||||
};
|
||||
this.adminPasswordUpdateError(true);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = SecurityAdminSettings;
|
||||
SecurityAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
this.capaOpenPGP.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaOpenPGP': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
this.capaTwoFactorAuth.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaTwoFactorAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.capaTwoFactorAuthForce.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'CapaTwoFactorAuthForce': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.useLocalProxyForExternalImages.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'UseLocalProxyForExternalImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.verifySslCertificate.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'VerifySslCertificate': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.allowSelfSigned.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowSelfSigned': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
SecurityAdminSettings.prototype.onHide = function()
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
SecurityAdminSettings.prototype.phpInfoLink = function()
|
||||
{
|
||||
return Links.phpInfo();
|
||||
};
|
||||
|
||||
module.exports = SecurityAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,183 +1,174 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SocialAdminSettings()
|
||||
{
|
||||
var SocialStore = require('Stores/Social');
|
||||
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
this.googleEnableRequireClientSettings = SocialStore.google.require.clientSettings;
|
||||
this.googleEnableRequireApiKey = SocialStore.google.require.apiKeySettings;
|
||||
|
||||
this.googleClientID = SocialStore.google.clientID;
|
||||
this.googleClientSecret = SocialStore.google.clientSecret;
|
||||
this.googleApiKey = SocialStore.google.apiKey;
|
||||
|
||||
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.facebookSupported = SocialStore.facebook.supported;
|
||||
this.facebookEnable = SocialStore.facebook.enabled;
|
||||
this.facebookAppID = SocialStore.facebook.appID;
|
||||
this.facebookAppSecret = SocialStore.facebook.appSecret;
|
||||
|
||||
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.twitterEnable = SocialStore.twitter.enabled;
|
||||
this.twitterConsumerKey = SocialStore.twitter.consumerKey;
|
||||
this.twitterConsumerSecret = SocialStore.twitter.consumerSecret;
|
||||
|
||||
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dropboxEnable = SocialStore.dropbox.enabled;
|
||||
this.dropboxApiKey = SocialStore.dropbox.apiKey;
|
||||
|
||||
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
SocialAdminSettings.prototype.onBuild = function()
|
||||
{
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax');
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils')
|
||||
;
|
||||
_.delay(function() {
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SocialAdminSettings()
|
||||
{
|
||||
var SocialStore = require('Stores/Social');
|
||||
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
this.googleEnableRequireClientSettings = SocialStore.google.require.clientSettings;
|
||||
this.googleEnableRequireApiKey = SocialStore.google.require.apiKeySettings;
|
||||
|
||||
this.googleClientID = SocialStore.google.clientID;
|
||||
this.googleClientSecret = SocialStore.google.clientSecret;
|
||||
this.googleApiKey = SocialStore.google.apiKey;
|
||||
|
||||
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.facebookSupported = SocialStore.facebook.supported;
|
||||
this.facebookEnable = SocialStore.facebook.enabled;
|
||||
this.facebookAppID = SocialStore.facebook.appID;
|
||||
this.facebookAppSecret = SocialStore.facebook.appSecret;
|
||||
|
||||
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.twitterEnable = SocialStore.twitter.enabled;
|
||||
this.twitterConsumerKey = SocialStore.twitter.consumerKey;
|
||||
this.twitterConsumerSecret = SocialStore.twitter.consumerSecret;
|
||||
|
||||
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dropboxEnable = SocialStore.dropbox.enabled;
|
||||
this.dropboxApiKey = SocialStore.dropbox.apiKey;
|
||||
|
||||
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
SocialAdminSettings.prototype.onBuild = function ()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
Remote = require('Remote/Admin/Ajax')
|
||||
;
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger1, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger2, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger1, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
|
||||
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
|
||||
f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
|
||||
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self);
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger1, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.facebookTrigger2, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger1, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.twitterTrigger2, self),
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger1, self),
|
||||
f6 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger2, self),
|
||||
f7 = Utils.settingsSaveHelperSimpleFunction(self.googleTrigger3, self),
|
||||
f8 = Utils.settingsSaveHelperSimpleFunction(self.dropboxTrigger1, self)
|
||||
;
|
||||
|
||||
self.facebookEnable.subscribe(function (bValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'FacebookEnable': bValue ? '1' : '0'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.facebookAppID.subscribe(function (sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'FacebookAppID': Utils.trim(sValue)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.facebookAppSecret.subscribe(function (sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'FacebookAppSecret': Utils.trim(sValue)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.twitterEnable.subscribe(function (bValue) {
|
||||
self.facebookEnable.subscribe(function(bValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'TwitterEnable': bValue ? '1' : '0'
|
||||
'FacebookEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.twitterConsumerKey.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'TwitterConsumerKey': Utils.trim(sValue)
|
||||
self.facebookAppID.subscribe(function(sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'FacebookAppID': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.twitterConsumerSecret.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'TwitterConsumerSecret': Utils.trim(sValue)
|
||||
self.facebookAppSecret.subscribe(function(sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'FacebookAppSecret': Utils.trim(sValue)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.twitterEnable.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'TwitterEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnable.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnable': bValue ? '1' : '0'
|
||||
});
|
||||
self.twitterConsumerKey.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'TwitterConsumerKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnableAuth.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnableAuth': bValue ? '1' : '0'
|
||||
});
|
||||
self.twitterConsumerSecret.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'TwitterConsumerSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnableDrive.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnableDrive': bValue ? '1' : '0'
|
||||
});
|
||||
self.googleEnable.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnablePreview.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnablePreview': bValue ? '1' : '0'
|
||||
});
|
||||
self.googleEnableAuth.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnableAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientID.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'GoogleClientID': Utils.trim(sValue)
|
||||
});
|
||||
self.googleEnableDrive.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnableDrive': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientSecret.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f6, {
|
||||
'GoogleClientSecret': Utils.trim(sValue)
|
||||
});
|
||||
self.googleEnablePreview.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'GoogleEnablePreview': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleApiKey.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f7, {
|
||||
'GoogleApiKey': Utils.trim(sValue)
|
||||
});
|
||||
self.googleClientID.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'GoogleClientID': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxEnable.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'DropboxEnable': bValue ? '1' : '0'
|
||||
});
|
||||
self.googleClientSecret.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f6, {
|
||||
'GoogleClientSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxApiKey.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f8, {
|
||||
'DropboxApiKey': Utils.trim(sValue)
|
||||
});
|
||||
self.googleApiKey.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f7, {
|
||||
'GoogleApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
self.dropboxEnable.subscribe(function(bValue) {
|
||||
Remote.saveAdminConfig(Utils.noop, {
|
||||
'DropboxEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = SocialAdminSettings;
|
||||
self.dropboxApiKey.subscribe(function(sValue) {
|
||||
Remote.saveAdminConfig(f8, {
|
||||
'DropboxApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = SocialAdminSettings;
|
||||
|
|
|
|||
|
|
@ -1,163 +1,154 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Links = require('Common/Links'),
|
||||
|
||||
var
|
||||
window = require('window'),
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
IdentityStore = require('Stores/User/Identity'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Links = require('Common/Links'),
|
||||
Settings = require('Storage/Settings'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
AccountStore = require('Stores/User/Account'),
|
||||
IdentityStore = require('Stores/User/Identity'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AccountsUserSettings()
|
||||
{
|
||||
this.allowAdditionalAccount = Settings.capa(Enums.Capa.AdditionalAccounts);
|
||||
this.allowIdentities = Settings.capa(Enums.Capa.Identities);
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.accounts = AccountStore.accounts;
|
||||
this.identities = IdentityStore.identities;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AccountsUserSettings()
|
||||
this.accountForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
this.identityForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
}
|
||||
|
||||
AccountsUserSettings.prototype.scrollableOptions = function(sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.addNewAccount = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'));
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.editAccount = function(oAccountItem)
|
||||
{
|
||||
if (oAccountItem && oAccountItem.canBeEdit())
|
||||
{
|
||||
this.allowAdditionalAccount = Settings.capa(Enums.Capa.AdditionalAccounts);
|
||||
this.allowIdentities = Settings.capa(Enums.Capa.Identities);
|
||||
|
||||
this.accounts = AccountStore.accounts;
|
||||
this.identities = IdentityStore.identities;
|
||||
|
||||
this.accountForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
this.identityForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'), [oAccountItem]);
|
||||
}
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.scrollableOptions = function (sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
AccountsUserSettings.prototype.addNewIdentity = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'));
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.addNewAccount = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'));
|
||||
};
|
||||
AccountsUserSettings.prototype.editIdentity = function(oIdentity)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'), [oIdentity]);
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.editAccount = function (oAccountItem)
|
||||
/**
|
||||
* @param {AccountModel} oAccountToRemove
|
||||
*/
|
||||
AccountsUserSettings.prototype.deleteAccount = function(oAccountToRemove)
|
||||
{
|
||||
if (oAccountToRemove && oAccountToRemove.deleteAccess())
|
||||
{
|
||||
if (oAccountItem && oAccountItem.canBeEdit())
|
||||
this.accountForDeletion(null);
|
||||
|
||||
var
|
||||
kn = require('Knoin/Knoin'),
|
||||
fRemoveAccount = function(oAccount) {
|
||||
return oAccountToRemove === oAccount;
|
||||
};
|
||||
|
||||
if (oAccountToRemove)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Account'), [oAccountItem]);
|
||||
}
|
||||
};
|
||||
this.accounts.remove(fRemoveAccount);
|
||||
|
||||
AccountsUserSettings.prototype.addNewIdentity = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'));
|
||||
};
|
||||
Remote.accountDelete(function(sResult, oData) {
|
||||
|
||||
AccountsUserSettings.prototype.editIdentity = function (oIdentity)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'), [oIdentity]);
|
||||
};
|
||||
if (Enums.StorageResultType.Success === sResult && oData &&
|
||||
oData.Result && oData.Reload)
|
||||
{
|
||||
kn.routeOff();
|
||||
kn.setHash(Links.root(), true);
|
||||
kn.routeOff();
|
||||
|
||||
/**
|
||||
* @param {AccountModel} oAccountToRemove
|
||||
*/
|
||||
AccountsUserSettings.prototype.deleteAccount = function (oAccountToRemove)
|
||||
{
|
||||
if (oAccountToRemove && oAccountToRemove.deleteAccess())
|
||||
{
|
||||
this.accountForDeletion(null);
|
||||
|
||||
var
|
||||
kn = require('Knoin/Knoin'),
|
||||
fRemoveAccount = function (oAccount) {
|
||||
return oAccountToRemove === oAccount;
|
||||
_.defer(function() {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
;
|
||||
|
||||
if (oAccountToRemove)
|
||||
{
|
||||
this.accounts.remove(fRemoveAccount);
|
||||
|
||||
Remote.accountDelete(function (sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData &&
|
||||
oData.Result && oData.Reload)
|
||||
{
|
||||
kn.routeOff();
|
||||
kn.setHash(Links.root(), true);
|
||||
kn.routeOff();
|
||||
|
||||
_.defer(function () {
|
||||
window.location.reload();
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
require('App/User').default.accountsAndIdentities();
|
||||
}
|
||||
|
||||
}, oAccountToRemove.email);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {IdentityModel} oIdentityToRemove
|
||||
*/
|
||||
AccountsUserSettings.prototype.deleteIdentity = function (oIdentityToRemove)
|
||||
{
|
||||
if (oIdentityToRemove && oIdentityToRemove.deleteAccess())
|
||||
{
|
||||
this.identityForDeletion(null);
|
||||
|
||||
if (oIdentityToRemove)
|
||||
{
|
||||
IdentityStore.identities.remove(function (oIdentity) {
|
||||
return oIdentityToRemove === oIdentity;
|
||||
});
|
||||
|
||||
Remote.identityDelete(function () {
|
||||
else
|
||||
{
|
||||
require('App/User').default.accountsAndIdentities();
|
||||
}, oIdentityToRemove.id);
|
||||
}
|
||||
}
|
||||
|
||||
}, oAccountToRemove.email);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
AccountsUserSettings.prototype.accountsAndIdentitiesAfterMove = function ()
|
||||
/**
|
||||
* @param {IdentityModel} oIdentityToRemove
|
||||
*/
|
||||
AccountsUserSettings.prototype.deleteIdentity = function(oIdentityToRemove)
|
||||
{
|
||||
if (oIdentityToRemove && oIdentityToRemove.deleteAccess())
|
||||
{
|
||||
Remote.accountsAndIdentitiesSortOrder(null,
|
||||
AccountStore.accountsEmails.peek(), IdentityStore.identitiesIDS.peek());
|
||||
};
|
||||
this.identityForDeletion(null);
|
||||
|
||||
AccountsUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
if (oIdentityToRemove)
|
||||
{
|
||||
IdentityStore.identities.remove(function(oIdentity) {
|
||||
return oIdentityToRemove === oIdentity;
|
||||
});
|
||||
|
||||
oDom
|
||||
.on('click', '.accounts-list .account-item .e-action', function () {
|
||||
var oAccountItem = ko.dataFor(this);
|
||||
if (oAccountItem)
|
||||
{
|
||||
self.editAccount(oAccountItem);
|
||||
}
|
||||
})
|
||||
.on('click', '.identities-list .identity-item .e-action', function () {
|
||||
var oIdentityItem = ko.dataFor(this);
|
||||
if (oIdentityItem)
|
||||
{
|
||||
self.editIdentity(oIdentityItem);
|
||||
}
|
||||
})
|
||||
;
|
||||
};
|
||||
Remote.identityDelete(function() {
|
||||
require('App/User').default.accountsAndIdentities();
|
||||
}, oIdentityToRemove.id);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AccountsUserSettings;
|
||||
AccountsUserSettings.prototype.accountsAndIdentitiesAfterMove = function()
|
||||
{
|
||||
Remote.accountsAndIdentitiesSortOrder(null,
|
||||
AccountStore.accountsEmails.peek(), IdentityStore.identitiesIDS.peek());
|
||||
};
|
||||
|
||||
}());
|
||||
AccountsUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.accounts-list .account-item .e-action', function() {
|
||||
var oAccountItem = ko.dataFor(this);
|
||||
if (oAccountItem)
|
||||
{
|
||||
self.editAccount(oAccountItem);
|
||||
}
|
||||
})
|
||||
.on('click', '.identities-list .identity-item .e-action', function() {
|
||||
var oIdentityItem = ko.dataFor(this);
|
||||
if (oIdentityItem)
|
||||
{
|
||||
self.editIdentity(oIdentityItem);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
module.exports = AccountsUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,124 +1,117 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ChangePasswordUserSettings()
|
||||
{
|
||||
this.changeProcess = ko.observable(false);
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.errorDescription = ko.observable('');
|
||||
this.passwordMismatch = ko.observable(false);
|
||||
this.passwordUpdateError = ko.observable(false);
|
||||
this.passwordUpdateSuccess = ko.observable(false);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ChangePasswordUserSettings()
|
||||
{
|
||||
this.changeProcess = ko.observable(false);
|
||||
this.currentPassword = ko.observable('');
|
||||
this.currentPassword.error = ko.observable(false);
|
||||
this.newPassword = ko.observable('');
|
||||
this.newPassword2 = ko.observable('');
|
||||
|
||||
this.errorDescription = ko.observable('');
|
||||
this.passwordMismatch = ko.observable(false);
|
||||
this.passwordUpdateError = ko.observable(false);
|
||||
this.passwordUpdateSuccess = ko.observable(false);
|
||||
|
||||
this.currentPassword = ko.observable('');
|
||||
this.currentPassword.error = ko.observable(false);
|
||||
this.newPassword = ko.observable('');
|
||||
this.newPassword2 = ko.observable('');
|
||||
|
||||
this.currentPassword.subscribe(function () {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.currentPassword.error(false);
|
||||
}, this);
|
||||
|
||||
this.newPassword.subscribe(function () {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.passwordMismatch(false);
|
||||
}, this);
|
||||
|
||||
this.newPassword2.subscribe(function () {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.passwordMismatch(false);
|
||||
}, this);
|
||||
|
||||
this.saveNewPasswordCommand = Utils.createCommand(this, function () {
|
||||
|
||||
if (this.newPassword() !== this.newPassword2())
|
||||
{
|
||||
this.passwordMismatch(true);
|
||||
this.errorDescription(Translator.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());
|
||||
}
|
||||
|
||||
}, function () {
|
||||
return !this.changeProcess() && '' !== this.currentPassword() &&
|
||||
'' !== this.newPassword() && '' !== this.newPassword2();
|
||||
});
|
||||
|
||||
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
|
||||
}
|
||||
|
||||
ChangePasswordUserSettings.prototype.onHide = function ()
|
||||
{
|
||||
this.changeProcess(false);
|
||||
this.currentPassword('');
|
||||
this.newPassword('');
|
||||
this.newPassword2('');
|
||||
this.errorDescription('');
|
||||
this.passwordMismatch(false);
|
||||
this.currentPassword.subscribe(function() {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.currentPassword.error(false);
|
||||
};
|
||||
}, this);
|
||||
|
||||
ChangePasswordUserSettings.prototype.onChangePasswordResponse = function (sResult, oData)
|
||||
{
|
||||
this.changeProcess(false);
|
||||
this.newPassword.subscribe(function() {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.passwordMismatch(false);
|
||||
this.errorDescription('');
|
||||
this.currentPassword.error(false);
|
||||
}, this);
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
this.newPassword2.subscribe(function() {
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.passwordMismatch(false);
|
||||
}, this);
|
||||
|
||||
this.saveNewPasswordCommand = Utils.createCommand(this, function() {
|
||||
|
||||
if (this.newPassword() !== this.newPassword2())
|
||||
{
|
||||
this.currentPassword('');
|
||||
this.newPassword('');
|
||||
this.newPassword2('');
|
||||
|
||||
this.passwordUpdateSuccess(true);
|
||||
this.currentPassword.error(false);
|
||||
|
||||
require('App/User').default.setClientSideToken(oData.Result);
|
||||
this.passwordMismatch(true);
|
||||
this.errorDescription(Translator.i18n('SETTINGS_CHANGE_PASSWORD/ERROR_PASSWORD_MISMATCH'));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oData && Enums.Notification.CurrentPasswordIncorrect === oData.ErrorCode)
|
||||
{
|
||||
this.currentPassword.error(true);
|
||||
}
|
||||
this.changeProcess(true);
|
||||
|
||||
this.passwordUpdateError(true);
|
||||
this.errorDescription(
|
||||
Translator.getNotificationFromResponse(oData, Enums.Notification.CouldNotSaveNewPassword));
|
||||
this.passwordUpdateError(false);
|
||||
this.passwordUpdateSuccess(false);
|
||||
this.currentPassword.error(false);
|
||||
this.passwordMismatch(false);
|
||||
this.errorDescription('');
|
||||
|
||||
Remote.changePassword(this.onChangePasswordResponse, this.currentPassword(), this.newPassword());
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ChangePasswordUserSettings;
|
||||
}, function() {
|
||||
return !this.changeProcess() && '' !== this.currentPassword() &&
|
||||
'' !== this.newPassword() && '' !== this.newPassword2();
|
||||
});
|
||||
|
||||
}());
|
||||
this.onChangePasswordResponse = _.bind(this.onChangePasswordResponse, this);
|
||||
}
|
||||
|
||||
ChangePasswordUserSettings.prototype.onHide = function()
|
||||
{
|
||||
this.changeProcess(false);
|
||||
this.currentPassword('');
|
||||
this.newPassword('');
|
||||
this.newPassword2('');
|
||||
this.errorDescription('');
|
||||
this.passwordMismatch(false);
|
||||
this.currentPassword.error(false);
|
||||
};
|
||||
|
||||
ChangePasswordUserSettings.prototype.onChangePasswordResponse = function(sResult, oData)
|
||||
{
|
||||
this.changeProcess(false);
|
||||
this.passwordMismatch(false);
|
||||
this.errorDescription('');
|
||||
this.currentPassword.error(false);
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
this.currentPassword('');
|
||||
this.newPassword('');
|
||||
this.newPassword2('');
|
||||
|
||||
this.passwordUpdateSuccess(true);
|
||||
this.currentPassword.error(false);
|
||||
|
||||
require('App/User').default.setClientSideToken(oData.Result);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (oData && Enums.Notification.CurrentPasswordIncorrect === oData.ErrorCode)
|
||||
{
|
||||
this.currentPassword.error(true);
|
||||
}
|
||||
|
||||
this.passwordUpdateError(true);
|
||||
this.errorDescription(
|
||||
Translator.getNotificationFromResponse(oData, Enums.Notification.CouldNotSaveNewPassword));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ChangePasswordUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,58 +1,51 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
AppStore = require('Stores/User/App'),
|
||||
ContactStore = require('Stores/User/Contact'),
|
||||
|
||||
var
|
||||
ko = require('ko'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
ContactStore = require('Stores/User/Contact'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactsUserSettings()
|
||||
{
|
||||
this.contactsAutosave = AppStore.contactsAutosave;
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.allowContactsSync = ContactStore.allowContactsSync;
|
||||
this.enableContactsSync = ContactStore.enableContactsSync;
|
||||
this.contactsSyncUrl = ContactStore.contactsSyncUrl;
|
||||
this.contactsSyncUser = ContactStore.contactsSyncUser;
|
||||
this.contactsSyncPass = ContactStore.contactsSyncPass;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ContactsUserSettings()
|
||||
{
|
||||
this.contactsAutosave = AppStore.contactsAutosave;
|
||||
this.saveTrigger = ko.computed(function() {
|
||||
return [
|
||||
this.enableContactsSync() ? '1' : '0',
|
||||
this.contactsSyncUrl(),
|
||||
this.contactsSyncUser(),
|
||||
this.contactsSyncPass()
|
||||
].join('|');
|
||||
}, this).extend({'throttle': 500});
|
||||
}
|
||||
|
||||
this.allowContactsSync = ContactStore.allowContactsSync;
|
||||
this.enableContactsSync = ContactStore.enableContactsSync;
|
||||
this.contactsSyncUrl = ContactStore.contactsSyncUrl;
|
||||
this.contactsSyncUser = ContactStore.contactsSyncUser;
|
||||
this.contactsSyncPass = ContactStore.contactsSyncPass;
|
||||
|
||||
this.saveTrigger = ko.computed(function () {
|
||||
return [
|
||||
this.enableContactsSync() ? '1' : '0',
|
||||
this.contactsSyncUrl(),
|
||||
this.contactsSyncUser(),
|
||||
this.contactsSyncPass()
|
||||
].join('|');
|
||||
}, this).extend({'throttle': 500});
|
||||
}
|
||||
|
||||
ContactsUserSettings.prototype.onBuild = function ()
|
||||
{
|
||||
this.contactsAutosave.subscribe(function (bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'ContactsAutosave': bValue ? '1' : '0'
|
||||
});
|
||||
ContactsUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
this.contactsAutosave.subscribe(function(bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'ContactsAutosave': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.saveTrigger.subscribe(function () {
|
||||
Remote.saveContactsSyncData(null,
|
||||
this.enableContactsSync(),
|
||||
this.contactsSyncUrl(),
|
||||
this.contactsSyncUser(),
|
||||
this.contactsSyncPass()
|
||||
);
|
||||
}, this);
|
||||
};
|
||||
this.saveTrigger.subscribe(function() {
|
||||
Remote.saveContactsSyncData(null,
|
||||
this.enableContactsSync(),
|
||||
this.contactsSyncUrl(),
|
||||
this.contactsSyncUser(),
|
||||
this.contactsSyncPass()
|
||||
);
|
||||
}, this);
|
||||
};
|
||||
|
||||
module.exports = ContactsUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = ContactsUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,246 +1,234 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
ko = require('ko'),
|
||||
_ = require('_'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
ko = require('ko'),
|
||||
_ = require('_'),
|
||||
FilterStore = require('Stores/User/Filter'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
FilterStore = require('Stores/User/Filter'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FiltersUserSettings()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.modules = FilterStore.modules;
|
||||
this.filters = FilterStore.filters;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FiltersUserSettings()
|
||||
{
|
||||
var self = this;
|
||||
this.inited = ko.observable(false);
|
||||
this.serverError = ko.observable(false);
|
||||
this.serverErrorDesc = ko.observable('');
|
||||
this.haveChanges = ko.observable(false);
|
||||
|
||||
this.modules = FilterStore.modules;
|
||||
this.filters = FilterStore.filters;
|
||||
this.saveErrorText = ko.observable('');
|
||||
|
||||
this.inited = ko.observable(false);
|
||||
this.serverError = ko.observable(false);
|
||||
this.serverErrorDesc = ko.observable('');
|
||||
this.haveChanges = ko.observable(false);
|
||||
this.filters.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
this.saveErrorText = ko.observable('');
|
||||
|
||||
this.filters.subscribe(Utils.windowResizeCallback);
|
||||
|
||||
this.serverError.subscribe(function (bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.serverErrorDesc('');
|
||||
}
|
||||
}, this);
|
||||
|
||||
this.filterRaw = FilterStore.raw;
|
||||
this.filterRaw.capa = FilterStore.capa;
|
||||
this.filterRaw.active = ko.observable(false);
|
||||
this.filterRaw.allow = ko.observable(false);
|
||||
this.filterRaw.error = ko.observable(false);
|
||||
|
||||
this.filterForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend(
|
||||
{'toggleSubscribeProperty': [this, 'deleteAccess']});
|
||||
|
||||
this.saveChanges = Utils.createCommand(this, function () {
|
||||
|
||||
if (!this.filters.saving())
|
||||
{
|
||||
if (this.filterRaw.active() && '' === Utils.trim(this.filterRaw()))
|
||||
{
|
||||
this.filterRaw.error(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.filters.saving(true);
|
||||
this.saveErrorText('');
|
||||
|
||||
Remote.filtersSave(function (sResult, oData) {
|
||||
|
||||
self.filters.saving(false);
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
self.haveChanges(false);
|
||||
self.updateList();
|
||||
}
|
||||
else if (oData && oData.ErrorCode)
|
||||
{
|
||||
self.saveErrorText(oData.ErrorMessageAdditional || Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
self.saveErrorText(Translator.getNotification(Enums.Notification.CantSaveFilters));
|
||||
}
|
||||
|
||||
}, this.filters(), this.filterRaw(), this.filterRaw.active());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
}, function () {
|
||||
return this.haveChanges();
|
||||
});
|
||||
|
||||
this.filters.subscribe(function () {
|
||||
this.haveChanges(true);
|
||||
}, this);
|
||||
|
||||
this.filterRaw.subscribe(function () {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
|
||||
this.haveChanges.subscribe(function () {
|
||||
this.saveErrorText('');
|
||||
}, this);
|
||||
|
||||
this.filterRaw.active.subscribe(function () {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
}
|
||||
|
||||
FiltersUserSettings.prototype.scrollableOptions = function (sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.updateList = function ()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
FilterModel = require('Model/Filter')
|
||||
;
|
||||
|
||||
if (!this.filters.loading())
|
||||
this.serverError.subscribe(function(bValue) {
|
||||
if (!bValue)
|
||||
{
|
||||
this.filters.loading(true);
|
||||
this.serverErrorDesc('');
|
||||
}
|
||||
}, this);
|
||||
|
||||
Remote.filtersGet(function (sResult, oData) {
|
||||
this.filterRaw = FilterStore.raw;
|
||||
this.filterRaw.capa = FilterStore.capa;
|
||||
this.filterRaw.active = ko.observable(false);
|
||||
this.filterRaw.allow = ko.observable(false);
|
||||
this.filterRaw.error = ko.observable(false);
|
||||
|
||||
self.filters.loading(false);
|
||||
self.serverError(false);
|
||||
this.filterForDeletion = ko.observable(null).extend({'falseTimeout': 3000}).extend(
|
||||
{'toggleSubscribeProperty': [this, 'deleteAccess']});
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData &&
|
||||
oData.Result && Utils.isArray(oData.Result.Filters))
|
||||
this.saveChanges = Utils.createCommand(this, function() {
|
||||
|
||||
if (!this.filters.saving())
|
||||
{
|
||||
if (this.filterRaw.active() && '' === Utils.trim(this.filterRaw()))
|
||||
{
|
||||
this.filterRaw.error(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.filters.saving(true);
|
||||
this.saveErrorText('');
|
||||
|
||||
Remote.filtersSave(function(sResult, oData) {
|
||||
|
||||
self.filters.saving(false);
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
self.inited(true);
|
||||
self.serverError(false);
|
||||
|
||||
var aResult = _.compact(_.map(oData.Result.Filters, function (aItem) {
|
||||
var oNew = new FilterModel();
|
||||
return (oNew && oNew.parse(aItem)) ? oNew : null;
|
||||
}));
|
||||
|
||||
self.filters(aResult);
|
||||
|
||||
self.modules(oData.Result.Modules ? oData.Result.Modules : {});
|
||||
|
||||
self.filterRaw(oData.Result.Raw || '');
|
||||
self.filterRaw.capa(Utils.isArray(oData.Result.Capa) ? oData.Result.Capa.join(' ') : '');
|
||||
self.filterRaw.active(!!oData.Result.RawIsActive);
|
||||
self.filterRaw.allow(!!oData.Result.RawIsAllow);
|
||||
self.haveChanges(false);
|
||||
self.updateList();
|
||||
}
|
||||
else if (oData && oData.ErrorCode)
|
||||
{
|
||||
self.saveErrorText(oData.ErrorMessageAdditional || Translator.getNotification(oData.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
self.filters([]);
|
||||
self.modules({});
|
||||
self.filterRaw('');
|
||||
self.filterRaw.capa({});
|
||||
|
||||
self.serverError(true);
|
||||
self.serverErrorDesc(oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) :
|
||||
Translator.getNotification(Enums.Notification.CantGetFilters));
|
||||
self.saveErrorText(Translator.getNotification(Enums.Notification.CantSaveFilters));
|
||||
}
|
||||
|
||||
self.haveChanges(false);
|
||||
});
|
||||
}, this.filters(), this.filterRaw(), this.filterRaw.active());
|
||||
}
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.deleteFilter = function (oFilter)
|
||||
return true;
|
||||
|
||||
}, function() {
|
||||
return this.haveChanges();
|
||||
});
|
||||
|
||||
this.filters.subscribe(function() {
|
||||
this.haveChanges(true);
|
||||
}, this);
|
||||
|
||||
this.filterRaw.subscribe(function() {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
|
||||
this.haveChanges.subscribe(function() {
|
||||
this.saveErrorText('');
|
||||
}, this);
|
||||
|
||||
this.filterRaw.active.subscribe(function() {
|
||||
this.haveChanges(true);
|
||||
this.filterRaw.error(false);
|
||||
}, this);
|
||||
}
|
||||
|
||||
FiltersUserSettings.prototype.scrollableOptions = function(sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.updateList = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
FilterModel = require('Model/Filter');
|
||||
|
||||
if (!this.filters.loading())
|
||||
{
|
||||
this.filters.remove(oFilter);
|
||||
Utils.delegateRunOnDestroy(oFilter);
|
||||
};
|
||||
this.filters.loading(true);
|
||||
|
||||
FiltersUserSettings.prototype.addFilter = function ()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
FilterModel = require('Model/Filter'),
|
||||
oNew = new FilterModel()
|
||||
;
|
||||
Remote.filtersGet(function(sResult, oData) {
|
||||
|
||||
oNew.generateID();
|
||||
require('Knoin/Knoin').showScreenPopup(
|
||||
require('View/Popup/Filter'), [oNew, function () {
|
||||
self.filters.push(oNew);
|
||||
self.filterRaw.active(false);
|
||||
}, false]);
|
||||
};
|
||||
self.filters.loading(false);
|
||||
self.serverError(false);
|
||||
|
||||
FiltersUserSettings.prototype.editFilter = function (oEdit)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oCloned = oEdit.cloneSelf()
|
||||
;
|
||||
if (Enums.StorageResultType.Success === sResult && oData &&
|
||||
oData.Result && Utils.isArray(oData.Result.Filters))
|
||||
{
|
||||
self.inited(true);
|
||||
self.serverError(false);
|
||||
|
||||
require('Knoin/Knoin').showScreenPopup(
|
||||
require('View/Popup/Filter'), [oCloned, function () {
|
||||
var aResult = _.compact(_.map(oData.Result.Filters, function(aItem) {
|
||||
var oNew = new FilterModel();
|
||||
return (oNew && oNew.parse(aItem)) ? oNew : null;
|
||||
}));
|
||||
|
||||
var
|
||||
aFilters = self.filters(),
|
||||
iIndex = aFilters.indexOf(oEdit)
|
||||
;
|
||||
self.filters(aResult);
|
||||
|
||||
if (-1 < iIndex && aFilters[iIndex])
|
||||
{
|
||||
Utils.delegateRunOnDestroy(aFilters[iIndex]);
|
||||
aFilters[iIndex] = oCloned;
|
||||
self.modules(oData.Result.Modules ? oData.Result.Modules : {});
|
||||
|
||||
self.filters(aFilters);
|
||||
self.haveChanges(true);
|
||||
}
|
||||
self.filterRaw(oData.Result.Raw || '');
|
||||
self.filterRaw.capa(Utils.isArray(oData.Result.Capa) ? oData.Result.Capa.join(' ') : '');
|
||||
self.filterRaw.active(!!oData.Result.RawIsActive);
|
||||
self.filterRaw.allow(!!oData.Result.RawIsAllow);
|
||||
}
|
||||
else
|
||||
{
|
||||
self.filters([]);
|
||||
self.modules({});
|
||||
self.filterRaw('');
|
||||
self.filterRaw.capa({});
|
||||
|
||||
}, true]);
|
||||
};
|
||||
self.serverError(true);
|
||||
self.serverErrorDesc(oData && oData.ErrorCode ? Translator.getNotification(oData.ErrorCode) :
|
||||
Translator.getNotification(Enums.Notification.CantGetFilters));
|
||||
}
|
||||
|
||||
FiltersUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
self.haveChanges(false);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
oDom
|
||||
.on('click', '.filter-item .e-action', function () {
|
||||
var oFilterItem = ko.dataFor(this);
|
||||
if (oFilterItem)
|
||||
{
|
||||
self.editFilter(oFilterItem);
|
||||
}
|
||||
})
|
||||
;
|
||||
};
|
||||
FiltersUserSettings.prototype.deleteFilter = function(oFilter)
|
||||
{
|
||||
this.filters.remove(oFilter);
|
||||
Utils.delegateRunOnDestroy(oFilter);
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
this.updateList();
|
||||
};
|
||||
FiltersUserSettings.prototype.addFilter = function()
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
FilterModel = require('Model/Filter'),
|
||||
oNew = new FilterModel();
|
||||
|
||||
module.exports = FiltersUserSettings;
|
||||
oNew.generateID();
|
||||
require('Knoin/Knoin').showScreenPopup(
|
||||
require('View/Popup/Filter'), [oNew, function() {
|
||||
self.filters.push(oNew);
|
||||
self.filterRaw.active(false);
|
||||
}, false]);
|
||||
};
|
||||
|
||||
}());
|
||||
FiltersUserSettings.prototype.editFilter = function(oEdit)
|
||||
{
|
||||
var
|
||||
self = this,
|
||||
oCloned = oEdit.cloneSelf();
|
||||
|
||||
require('Knoin/Knoin').showScreenPopup(
|
||||
require('View/Popup/Filter'), [oCloned, function() {
|
||||
|
||||
var
|
||||
aFilters = self.filters(),
|
||||
iIndex = aFilters.indexOf(oEdit);
|
||||
|
||||
if (-1 < iIndex && aFilters[iIndex])
|
||||
{
|
||||
Utils.delegateRunOnDestroy(aFilters[iIndex]);
|
||||
aFilters[iIndex] = oCloned;
|
||||
|
||||
self.filters(aFilters);
|
||||
self.haveChanges(true);
|
||||
}
|
||||
|
||||
}, true]);
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.filter-item .e-action', function() {
|
||||
var oFilterItem = ko.dataFor(this);
|
||||
if (oFilterItem)
|
||||
{
|
||||
self.editFilter(oFilterItem);
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
FiltersUserSettings.prototype.onShow = function()
|
||||
{
|
||||
this.updateList();
|
||||
};
|
||||
|
||||
module.exports = FiltersUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,203 +1,192 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
ko = require('ko'),
|
||||
Cache = require('Common/Cache'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
Settings = require('Storage/Settings'),
|
||||
Local = require('Storage/Client'),
|
||||
|
||||
Cache = require('Common/Cache'),
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
Local = require('Storage/Client'),
|
||||
Promises = require('Promises/User/Ajax'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
FolderStore = require('Stores/User/Folder'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FoldersUserSettings()
|
||||
{
|
||||
this.displaySpecSetting = FolderStore.displaySpecSetting;
|
||||
this.folderList = FolderStore.folderList;
|
||||
|
||||
Promises = require('Promises/User/Ajax'),
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.folderListHelp = ko.observable('').extend({'throttle': 100});
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function FoldersUserSettings()
|
||||
{
|
||||
this.displaySpecSetting = FolderStore.displaySpecSetting;
|
||||
this.folderList = FolderStore.folderList;
|
||||
this.loading = ko.computed(function() {
|
||||
|
||||
this.folderListHelp = ko.observable('').extend({'throttle': 100});
|
||||
var
|
||||
bLoading = FolderStore.foldersLoading(),
|
||||
bCreating = FolderStore.foldersCreating(),
|
||||
bDeleting = FolderStore.foldersDeleting(),
|
||||
bRenaming = FolderStore.foldersRenaming();
|
||||
|
||||
this.loading = ko.computed(function () {
|
||||
return bLoading || bCreating || bDeleting || bRenaming;
|
||||
|
||||
var
|
||||
bLoading = FolderStore.foldersLoading(),
|
||||
bCreating = FolderStore.foldersCreating(),
|
||||
bDeleting = FolderStore.foldersDeleting(),
|
||||
bRenaming = FolderStore.foldersRenaming()
|
||||
;
|
||||
}, this);
|
||||
|
||||
return bLoading || bCreating || bDeleting || bRenaming;
|
||||
this.folderForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
}, this);
|
||||
|
||||
this.folderForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.folderForEdit = ko.observable(null).extend({'toggleSubscribe': [this,
|
||||
function (oPrev) {
|
||||
if (oPrev)
|
||||
{
|
||||
oPrev.edited(false);
|
||||
}
|
||||
}, function (oNext) {
|
||||
if (oNext && oNext.canBeEdited())
|
||||
{
|
||||
oNext.edited(true);
|
||||
}
|
||||
this.folderForEdit = ko.observable(null).extend({'toggleSubscribe': [this,
|
||||
function(oPrev) {
|
||||
if (oPrev)
|
||||
{
|
||||
oPrev.edited(false);
|
||||
}
|
||||
]});
|
||||
}, function(oNext) {
|
||||
if (oNext && oNext.canBeEdited())
|
||||
{
|
||||
oNext.edited(true);
|
||||
}
|
||||
}
|
||||
]});
|
||||
|
||||
this.useImapSubscribe = !!Settings.appSettingsGet('useImapSubscribe');
|
||||
this.useImapSubscribe = !!Settings.appSettingsGet('useImapSubscribe');
|
||||
}
|
||||
|
||||
FoldersUserSettings.prototype.folderEditOnEnter = function(oFolder)
|
||||
{
|
||||
var
|
||||
sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : '';
|
||||
|
||||
if ('' !== sEditName && oFolder.name() !== sEditName)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
|
||||
require('App/User').default.foldersPromisesActionHelper(
|
||||
Promises.folderRename(oFolder.fullNameRaw, sEditName, FolderStore.foldersRenaming),
|
||||
Enums.Notification.CantRenameFolder
|
||||
);
|
||||
|
||||
Cache.removeFolderFromCacheList(oFolder.fullNameRaw);
|
||||
|
||||
oFolder.name(sEditName);
|
||||
}
|
||||
|
||||
FoldersUserSettings.prototype.folderEditOnEnter = function (oFolder)
|
||||
{
|
||||
var
|
||||
sEditName = oFolder ? Utils.trim(oFolder.nameForEdit()) : ''
|
||||
;
|
||||
oFolder.edited(false);
|
||||
};
|
||||
|
||||
if ('' !== sEditName && oFolder.name() !== sEditName)
|
||||
FoldersUserSettings.prototype.folderEditOnEsc = function(oFolder)
|
||||
{
|
||||
if (oFolder)
|
||||
{
|
||||
oFolder.edited(false);
|
||||
}
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.onShow = function()
|
||||
{
|
||||
FolderStore.folderList.error('');
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
oDom
|
||||
.on('mouseover', '.delete-folder-parent', function() {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_DELETE_FOLDER'));
|
||||
})
|
||||
.on('mouseover', '.subscribe-folder-parent', function() {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_SHOW_HIDE_FOLDER'));
|
||||
})
|
||||
.on('mouseover', '.check-folder-parent', function() {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_CHECK_FOR_NEW_MESSAGES'));
|
||||
})
|
||||
.on('mouseout', '.subscribe-folder-parent, .check-folder-parent, .delete-folder-parent', function() {
|
||||
self.folderListHelp('');
|
||||
});
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.createFolder = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/FolderCreate'));
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.systemFolder = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/FolderSystem'));
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.deleteFolder = function(oFolderToRemove)
|
||||
{
|
||||
if (oFolderToRemove && oFolderToRemove.canBeDeleted() && oFolderToRemove.deleteAccess() &&
|
||||
0 === oFolderToRemove.privateMessageCountAll())
|
||||
{
|
||||
this.folderForDeletion(null);
|
||||
|
||||
var
|
||||
fRemoveFolder = function(oFolder) {
|
||||
|
||||
if (oFolderToRemove === oFolder)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
oFolder.subFolders.remove(fRemoveFolder);
|
||||
return false;
|
||||
};
|
||||
|
||||
if (oFolderToRemove)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
|
||||
FolderStore.folderList.remove(fRemoveFolder);
|
||||
|
||||
require('App/User').default.foldersPromisesActionHelper(
|
||||
Promises.folderRename(oFolder.fullNameRaw, sEditName, FolderStore.foldersRenaming),
|
||||
Enums.Notification.CantRenameFolder
|
||||
Promises.folderDelete(oFolderToRemove.fullNameRaw, FolderStore.foldersDeleting),
|
||||
Enums.Notification.CantDeleteFolder
|
||||
);
|
||||
|
||||
Cache.removeFolderFromCacheList(oFolder.fullNameRaw);
|
||||
|
||||
oFolder.name(sEditName);
|
||||
Cache.removeFolderFromCacheList(oFolderToRemove.fullNameRaw);
|
||||
}
|
||||
|
||||
oFolder.edited(false);
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.folderEditOnEsc = function (oFolder)
|
||||
}
|
||||
else if (0 < oFolderToRemove.privateMessageCountAll())
|
||||
{
|
||||
if (oFolder)
|
||||
{
|
||||
oFolder.edited(false);
|
||||
}
|
||||
};
|
||||
FolderStore.folderList.error(Translator.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
|
||||
}
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
FolderStore.folderList.error('');
|
||||
};
|
||||
FoldersUserSettings.prototype.subscribeFolder = function(oFolder)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
Remote.folderSetSubscribe(Utils.noop, oFolder.fullNameRaw, true);
|
||||
|
||||
FoldersUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
oDom
|
||||
.on('mouseover', '.delete-folder-parent', function () {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_DELETE_FOLDER'));
|
||||
})
|
||||
.on('mouseover', '.subscribe-folder-parent', function () {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_SHOW_HIDE_FOLDER'));
|
||||
})
|
||||
.on('mouseover', '.check-folder-parent', function () {
|
||||
self.folderListHelp(Translator.i18n('SETTINGS_FOLDERS/HELP_CHECK_FOR_NEW_MESSAGES'));
|
||||
})
|
||||
.on('mouseout', '.subscribe-folder-parent, .check-folder-parent, .delete-folder-parent', function () {
|
||||
self.folderListHelp('');
|
||||
})
|
||||
;
|
||||
};
|
||||
oFolder.subScribed(true);
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.createFolder = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/FolderCreate'));
|
||||
};
|
||||
FoldersUserSettings.prototype.unSubscribeFolder = function(oFolder)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
Remote.folderSetSubscribe(Utils.noop, oFolder.fullNameRaw, false);
|
||||
|
||||
FoldersUserSettings.prototype.systemFolder = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/FolderSystem'));
|
||||
};
|
||||
oFolder.subScribed(false);
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.deleteFolder = function (oFolderToRemove)
|
||||
{
|
||||
if (oFolderToRemove && oFolderToRemove.canBeDeleted() && oFolderToRemove.deleteAccess() &&
|
||||
0 === oFolderToRemove.privateMessageCountAll())
|
||||
{
|
||||
this.folderForDeletion(null);
|
||||
FoldersUserSettings.prototype.checkableTrueFolder = function(oFolder)
|
||||
{
|
||||
Remote.folderSetCheckable(Utils.noop, oFolder.fullNameRaw, true);
|
||||
|
||||
var
|
||||
fRemoveFolder = function (oFolder) {
|
||||
oFolder.checkable(true);
|
||||
};
|
||||
|
||||
if (oFolderToRemove === oFolder)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
FoldersUserSettings.prototype.checkableFalseFolder = function(oFolder)
|
||||
{
|
||||
Remote.folderSetCheckable(Utils.noop, oFolder.fullNameRaw, false);
|
||||
|
||||
oFolder.subFolders.remove(fRemoveFolder);
|
||||
return false;
|
||||
}
|
||||
;
|
||||
oFolder.checkable(false);
|
||||
};
|
||||
|
||||
if (oFolderToRemove)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
|
||||
FolderStore.folderList.remove(fRemoveFolder);
|
||||
|
||||
require('App/User').default.foldersPromisesActionHelper(
|
||||
Promises.folderDelete(oFolderToRemove.fullNameRaw, FolderStore.foldersDeleting),
|
||||
Enums.Notification.CantDeleteFolder
|
||||
);
|
||||
|
||||
Cache.removeFolderFromCacheList(oFolderToRemove.fullNameRaw);
|
||||
}
|
||||
}
|
||||
else if (0 < oFolderToRemove.privateMessageCountAll())
|
||||
{
|
||||
FolderStore.folderList.error(Translator.getNotification(Enums.Notification.CantDeleteNonEmptyFolder));
|
||||
}
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.subscribeFolder = function (oFolder)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
Remote.folderSetSubscribe(Utils.noop, oFolder.fullNameRaw, true);
|
||||
|
||||
oFolder.subScribed(true);
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.unSubscribeFolder = function (oFolder)
|
||||
{
|
||||
Local.set(Enums.ClientSideKeyName.FoldersLashHash, '');
|
||||
Remote.folderSetSubscribe(Utils.noop, oFolder.fullNameRaw, false);
|
||||
|
||||
oFolder.subScribed(false);
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.checkableTrueFolder = function (oFolder)
|
||||
{
|
||||
Remote.folderSetCheckable(Utils.noop, oFolder.fullNameRaw, true);
|
||||
|
||||
oFolder.checkable(true);
|
||||
};
|
||||
|
||||
FoldersUserSettings.prototype.checkableFalseFolder = function (oFolder)
|
||||
{
|
||||
Remote.folderSetCheckable(Utils.noop, oFolder.fullNameRaw, false);
|
||||
|
||||
oFolder.checkable(false);
|
||||
};
|
||||
|
||||
module.exports = FoldersUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = FoldersUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,232 +1,224 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Consts = require('Common/Consts'),
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
AppStore = require('Stores/User/App'),
|
||||
LanguageStore = require('Stores/Language'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
IdentityStore = require('Stores/User/Identity'),
|
||||
NotificationStore = require('Stores/User/Notification'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Consts = require('Common/Consts'),
|
||||
Globals = require('Common/Globals'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
AppStore = require('Stores/User/App'),
|
||||
LanguageStore = require('Stores/Language'),
|
||||
SettingsStore = require('Stores/User/Settings'),
|
||||
IdentityStore = require('Stores/User/Identity'),
|
||||
NotificationStore = require('Stores/User/Notification'),
|
||||
MessageStore = require('Stores/User/Message'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function GeneralUserSettings()
|
||||
{
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.messagesPerPage = SettingsStore.messagesPerPage;
|
||||
this.messagesPerPageArray = Consts.MESSAGES_PER_PAGE_VALUES;
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.editorDefaultType = SettingsStore.editorDefaultType;
|
||||
this.layout = SettingsStore.layout;
|
||||
this.usePreviewPane = SettingsStore.usePreviewPane;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function GeneralUserSettings()
|
||||
{
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
this.messagesPerPage = SettingsStore.messagesPerPage;
|
||||
this.messagesPerPageArray = Consts.MESSAGES_PER_PAGE_VALUES;
|
||||
this.soundNotificationIsSupported = NotificationStore.soundNotificationIsSupported;
|
||||
this.enableSoundNotification = NotificationStore.enableSoundNotification;
|
||||
|
||||
this.editorDefaultType = SettingsStore.editorDefaultType;
|
||||
this.layout = SettingsStore.layout;
|
||||
this.usePreviewPane = SettingsStore.usePreviewPane;
|
||||
this.enableDesktopNotification = NotificationStore.enableDesktopNotification;
|
||||
this.isDesktopNotificationSupported = NotificationStore.isDesktopNotificationSupported;
|
||||
this.isDesktopNotificationDenied = NotificationStore.isDesktopNotificationDenied;
|
||||
|
||||
this.soundNotificationIsSupported = NotificationStore.soundNotificationIsSupported;
|
||||
this.enableSoundNotification = NotificationStore.enableSoundNotification;
|
||||
this.showImages = SettingsStore.showImages;
|
||||
this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
|
||||
this.threadsAllowed = AppStore.threadsAllowed;
|
||||
this.useThreads = SettingsStore.useThreads;
|
||||
this.replySameFolder = SettingsStore.replySameFolder;
|
||||
this.allowLanguagesOnSettings = AppStore.allowLanguagesOnSettings;
|
||||
|
||||
this.enableDesktopNotification = NotificationStore.enableDesktopNotification;
|
||||
this.isDesktopNotificationSupported = NotificationStore.isDesktopNotificationSupported;
|
||||
this.isDesktopNotificationDenied = NotificationStore.isDesktopNotificationDenied;
|
||||
this.languageFullName = ko.computed(function() {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
|
||||
this.showImages = SettingsStore.showImages;
|
||||
this.useCheckboxesInList = SettingsStore.useCheckboxesInList;
|
||||
this.threadsAllowed = AppStore.threadsAllowed;
|
||||
this.useThreads = SettingsStore.useThreads;
|
||||
this.replySameFolder = SettingsStore.replySameFolder;
|
||||
this.allowLanguagesOnSettings = AppStore.allowLanguagesOnSettings;
|
||||
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
|
||||
this.languageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.language());
|
||||
}, this);
|
||||
this.mppTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.editorDefaultTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.layoutTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
this.isAnimationSupported = Globals.bAnimationSupported;
|
||||
|
||||
this.mppTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.editorDefaultTypeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.layoutTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.identities = IdentityStore.identities;
|
||||
|
||||
this.isAnimationSupported = Globals.bAnimationSupported;
|
||||
this.identityMain = ko.computed(function() {
|
||||
var aList = this.identities();
|
||||
return Utils.isArray(aList) ? _.find(aList, function(oItem) {
|
||||
return oItem && '' === oItem.id();
|
||||
}) : null;
|
||||
}, this);
|
||||
|
||||
this.identities = IdentityStore.identities;
|
||||
|
||||
this.identityMain = ko.computed(function () {
|
||||
var aList = this.identities();
|
||||
return Utils.isArray(aList) ? _.find(aList, function (oItem) {
|
||||
return oItem && '' === oItem.id() ? true : false;
|
||||
}) : null;
|
||||
}, this);
|
||||
|
||||
this.identityMainDesc = ko.computed(function () {
|
||||
var oIdentity = this.identityMain();
|
||||
return oIdentity ? oIdentity.formattedName() : '---';
|
||||
}, this);
|
||||
|
||||
this.editorDefaultTypes = ko.computed(function () {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': Enums.EditorDefaultType.Html, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
|
||||
{'id': Enums.EditorDefaultType.Plain, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
|
||||
{'id': Enums.EditorDefaultType.HtmlForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
|
||||
{'id': Enums.EditorDefaultType.PlainForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
|
||||
];
|
||||
}, this);
|
||||
|
||||
this.layoutTypes = ko.computed(function () {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': Enums.Layout.NoPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
|
||||
{'id': Enums.Layout.SidePreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
|
||||
{'id': Enums.Layout.BottomPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
|
||||
];
|
||||
}, this);
|
||||
}
|
||||
|
||||
GeneralUserSettings.prototype.editMainIdentity = function ()
|
||||
{
|
||||
this.identityMainDesc = ko.computed(function() {
|
||||
var oIdentity = this.identityMain();
|
||||
if (oIdentity)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'), [oIdentity]);
|
||||
}
|
||||
};
|
||||
return oIdentity ? oIdentity.formattedName() : '---';
|
||||
}, this);
|
||||
|
||||
GeneralUserSettings.prototype.testSoundNotification = function ()
|
||||
this.editorDefaultTypes = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': Enums.EditorDefaultType.Html, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML')},
|
||||
{'id': Enums.EditorDefaultType.Plain, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN')},
|
||||
{'id': Enums.EditorDefaultType.HtmlForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_HTML_FORCED')},
|
||||
{'id': Enums.EditorDefaultType.PlainForced, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_EDITOR_PLAIN_FORCED')}
|
||||
];
|
||||
}, this);
|
||||
|
||||
this.layoutTypes = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': Enums.Layout.NoPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_NO_SPLIT')},
|
||||
{'id': Enums.Layout.SidePreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_VERTICAL_SPLIT')},
|
||||
{'id': Enums.Layout.BottomPreview, 'name': Translator.i18n('SETTINGS_GENERAL/LABEL_LAYOUT_HORIZONTAL_SPLIT')}
|
||||
];
|
||||
}, this);
|
||||
}
|
||||
|
||||
GeneralUserSettings.prototype.editMainIdentity = function()
|
||||
{
|
||||
var oIdentity = this.identityMain();
|
||||
if (oIdentity)
|
||||
{
|
||||
NotificationStore.playSoundNotification(true);
|
||||
};
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Identity'), [oIdentity]);
|
||||
}
|
||||
};
|
||||
|
||||
GeneralUserSettings.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
GeneralUserSettings.prototype.testSoundNotification = function()
|
||||
{
|
||||
NotificationStore.playSoundNotification(true);
|
||||
};
|
||||
|
||||
_.delay(function () {
|
||||
GeneralUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
var self = this;
|
||||
|
||||
var
|
||||
f0 = Utils.settingsSaveHelperSimpleFunction(self.editorDefaultTypeTrigger, self),
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.layoutTrigger, self),
|
||||
fReloadLanguageHelper = function (iSaveSettingsStep) {
|
||||
return function() {
|
||||
self.languageTrigger(iSaveSettingsStep);
|
||||
_.delay(function () {
|
||||
self.languageTrigger(Enums.SaveSettingsStep.Idle);
|
||||
}, 1000);
|
||||
};
|
||||
}
|
||||
;
|
||||
_.delay(function() {
|
||||
|
||||
self.language.subscribe(function (sValue) {
|
||||
var
|
||||
f0 = Utils.settingsSaveHelperSimpleFunction(self.editorDefaultTypeTrigger, self),
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.mppTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.layoutTrigger, self),
|
||||
fReloadLanguageHelper = function(iSaveSettingsStep) {
|
||||
return function() {
|
||||
self.languageTrigger(iSaveSettingsStep);
|
||||
_.delay(function() {
|
||||
self.languageTrigger(Enums.SaveSettingsStep.Idle);
|
||||
}, 1000);
|
||||
};
|
||||
};
|
||||
|
||||
self.languageTrigger(Enums.SaveSettingsStep.Animate);
|
||||
self.language.subscribe(function(sValue) {
|
||||
|
||||
Translator.reload(false, sValue).then(
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult),
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult)
|
||||
).then(function() {
|
||||
Remote.saveSettings(null, {
|
||||
'Language': sValue
|
||||
});
|
||||
});
|
||||
self.languageTrigger(Enums.SaveSettingsStep.Animate);
|
||||
|
||||
});
|
||||
|
||||
self.editorDefaultType.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f0, {
|
||||
'EditorDefaultType': sValue
|
||||
});
|
||||
});
|
||||
|
||||
self.messagesPerPage.subscribe(function (iValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'MPP': iValue
|
||||
});
|
||||
});
|
||||
|
||||
self.showImages.subscribe(function (bValue) {
|
||||
Translator.reload(false, sValue).then(
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.TrueResult),
|
||||
fReloadLanguageHelper(Enums.SaveSettingsStep.FalseResult)
|
||||
).then(function() {
|
||||
Remote.saveSettings(null, {
|
||||
'ShowImages': bValue ? '1' : '0'
|
||||
'Language': sValue
|
||||
});
|
||||
});
|
||||
|
||||
self.enableDesktopNotification.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveDesktopNotifications', function () {
|
||||
Remote.saveSettings(null, {
|
||||
'DesktopNotifications': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
self.editorDefaultType.subscribe(function(sValue) {
|
||||
Remote.saveSettings(f0, {
|
||||
'EditorDefaultType': sValue
|
||||
});
|
||||
});
|
||||
|
||||
self.enableSoundNotification.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveSoundNotification', function () {
|
||||
Remote.saveSettings(null, {
|
||||
'SoundNotification': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
self.messagesPerPage.subscribe(function(iValue) {
|
||||
Remote.saveSettings(f1, {
|
||||
'MPP': iValue
|
||||
});
|
||||
});
|
||||
|
||||
self.replySameFolder.subscribe(function (bValue) {
|
||||
Utils.timeOutAction('SaveReplySameFolder', function () {
|
||||
Remote.saveSettings(null, {
|
||||
'ReplySameFolder': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
self.showImages.subscribe(function(bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'ShowImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.useThreads.subscribe(function (bValue) {
|
||||
|
||||
MessageStore.messageList([]);
|
||||
|
||||
self.enableDesktopNotification.subscribe(function(bValue) {
|
||||
Utils.timeOutAction('SaveDesktopNotifications', function() {
|
||||
Remote.saveSettings(null, {
|
||||
'UseThreads': bValue ? '1' : '0'
|
||||
'DesktopNotifications': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
self.layout.subscribe(function (nValue) {
|
||||
|
||||
MessageStore.messageList([]);
|
||||
|
||||
Remote.saveSettings(f2, {
|
||||
'Layout': nValue
|
||||
});
|
||||
});
|
||||
|
||||
self.useCheckboxesInList.subscribe(function (bValue) {
|
||||
self.enableSoundNotification.subscribe(function(bValue) {
|
||||
Utils.timeOutAction('SaveSoundNotification', function() {
|
||||
Remote.saveSettings(null, {
|
||||
'UseCheckboxesInList': bValue ? '1' : '0'
|
||||
'SoundNotification': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
self.replySameFolder.subscribe(function(bValue) {
|
||||
Utils.timeOutAction('SaveReplySameFolder', function() {
|
||||
Remote.saveSettings(null, {
|
||||
'ReplySameFolder': bValue ? '1' : '0'
|
||||
});
|
||||
}, 3000);
|
||||
});
|
||||
|
||||
self.useThreads.subscribe(function(bValue) {
|
||||
|
||||
MessageStore.messageList([]);
|
||||
|
||||
Remote.saveSettings(null, {
|
||||
'UseThreads': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
self.layout.subscribe(function(nValue) {
|
||||
|
||||
GeneralUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
this.enableDesktopNotification.valueHasMutated();
|
||||
};
|
||||
MessageStore.messageList([]);
|
||||
|
||||
GeneralUserSettings.prototype.selectLanguage = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
Remote.saveSettings(f2, {
|
||||
'Layout': nValue
|
||||
});
|
||||
});
|
||||
|
||||
module.exports = GeneralUserSettings;
|
||||
self.useCheckboxesInList.subscribe(function(bValue) {
|
||||
Remote.saveSettings(null, {
|
||||
'UseCheckboxesInList': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}());
|
||||
}, 50);
|
||||
};
|
||||
|
||||
GeneralUserSettings.prototype.onShow = function()
|
||||
{
|
||||
this.enableDesktopNotification.valueHasMutated();
|
||||
};
|
||||
|
||||
GeneralUserSettings.prototype.selectLanguage = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
};
|
||||
|
||||
module.exports = GeneralUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,83 +1,76 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
window = require('window'),
|
||||
|
||||
'use strict';
|
||||
Utils = require('Common/Utils'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
window = require('window'),
|
||||
kn = require('Knoin/Knoin'),
|
||||
|
||||
Utils = require('Common/Utils'),
|
||||
PgpStore = require('Stores/User/Pgp');
|
||||
|
||||
kn = require('Knoin/Knoin'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function OpenPgpUserSettings()
|
||||
{
|
||||
this.openpgpkeys = PgpStore.openpgpkeys;
|
||||
this.openpgpkeysPublic = PgpStore.openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = PgpStore.openpgpkeysPrivate;
|
||||
|
||||
PgpStore = require('Stores/User/Pgp')
|
||||
;
|
||||
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function OpenPgpUserSettings()
|
||||
this.isHttps = window.document && window.document.location ? 'https:' === window.document.location.protocol : false;
|
||||
}
|
||||
|
||||
OpenPgpUserSettings.prototype.addOpenPgpKey = function()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/AddOpenPgpKey'));
|
||||
};
|
||||
|
||||
OpenPgpUserSettings.prototype.generateOpenPgpKey = function()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/NewOpenPgpKey'));
|
||||
};
|
||||
|
||||
OpenPgpUserSettings.prototype.viewOpenPgpKey = function(oOpenPgpKey)
|
||||
{
|
||||
if (oOpenPgpKey)
|
||||
{
|
||||
this.openpgpkeys = PgpStore.openpgpkeys;
|
||||
this.openpgpkeysPublic = PgpStore.openpgpkeysPublic;
|
||||
this.openpgpkeysPrivate = PgpStore.openpgpkeysPrivate;
|
||||
|
||||
this.openPgpKeyForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
|
||||
this.isHttps = window.document && window.document.location ? 'https:' === window.document.location.protocol : false;
|
||||
kn.showScreenPopup(require('View/Popup/ViewOpenPgpKey'), [oOpenPgpKey]);
|
||||
}
|
||||
};
|
||||
|
||||
OpenPgpUserSettings.prototype.addOpenPgpKey = function ()
|
||||
/**
|
||||
* @param {OpenPgpKeyModel} oOpenPgpKeyToRemove
|
||||
*/
|
||||
OpenPgpUserSettings.prototype.deleteOpenPgpKey = function(oOpenPgpKeyToRemove)
|
||||
{
|
||||
if (oOpenPgpKeyToRemove && oOpenPgpKeyToRemove.deleteAccess())
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/AddOpenPgpKey'));
|
||||
};
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
OpenPgpUserSettings.prototype.generateOpenPgpKey = function ()
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/NewOpenPgpKey'));
|
||||
};
|
||||
|
||||
OpenPgpUserSettings.prototype.viewOpenPgpKey = function (oOpenPgpKey)
|
||||
{
|
||||
if (oOpenPgpKey)
|
||||
if (oOpenPgpKeyToRemove && PgpStore.openpgpKeyring)
|
||||
{
|
||||
kn.showScreenPopup(require('View/Popup/ViewOpenPgpKey'), [oOpenPgpKey]);
|
||||
}
|
||||
};
|
||||
var oFindedItem = _.find(PgpStore.openpgpkeys(), function(oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
});
|
||||
|
||||
/**
|
||||
* @param {OpenPgpKeyModel} oOpenPgpKeyToRemove
|
||||
*/
|
||||
OpenPgpUserSettings.prototype.deleteOpenPgpKey = function (oOpenPgpKeyToRemove)
|
||||
{
|
||||
if (oOpenPgpKeyToRemove && oOpenPgpKeyToRemove.deleteAccess())
|
||||
{
|
||||
this.openPgpKeyForDeletion(null);
|
||||
|
||||
if (oOpenPgpKeyToRemove && PgpStore.openpgpKeyring)
|
||||
if (oFindedItem)
|
||||
{
|
||||
var oFindedItem = _.find(PgpStore.openpgpkeys(), function (oOpenPgpKey) {
|
||||
return oOpenPgpKeyToRemove === oOpenPgpKey;
|
||||
});
|
||||
PgpStore.openpgpkeys.remove(oFindedItem);
|
||||
Utils.delegateRunOnDestroy(oFindedItem);
|
||||
|
||||
if (oFindedItem)
|
||||
{
|
||||
PgpStore.openpgpkeys.remove(oFindedItem);
|
||||
Utils.delegateRunOnDestroy(oFindedItem);
|
||||
PgpStore.openpgpKeyring[oFindedItem.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
.removeForId(oFindedItem.guid);
|
||||
|
||||
PgpStore.openpgpKeyring[oFindedItem.isPrivate ? 'privateKeys' : 'publicKeys']
|
||||
.removeForId(oFindedItem.guid);
|
||||
|
||||
PgpStore.openpgpKeyring.store();
|
||||
}
|
||||
|
||||
require('App/User').default.reloadOpenPgpKeys();
|
||||
PgpStore.openpgpKeyring.store();
|
||||
}
|
||||
|
||||
require('App/User').default.reloadOpenPgpKeys();
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = OpenPgpUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = OpenPgpUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,76 +1,68 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
ko = require('ko'),
|
||||
SettinsStore = require('Stores/User/Settings'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Translator = require('Common/Translator'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
SettinsStore = require('Stores/User/Settings'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SecurityUserSettings()
|
||||
{
|
||||
this.capaAutoLogout = Settings.capa(Enums.Capa.AutoLogout);
|
||||
this.capaTwoFactor = Settings.capa(Enums.Capa.TwoFactor);
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.autoLogout = SettinsStore.autoLogout;
|
||||
this.autoLogout.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SecurityUserSettings()
|
||||
this.autoLogoutOptions = ko.computed(function() {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': 0, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_NEVER_OPTION_NAME')},
|
||||
{'id': 5, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 5})},
|
||||
{'id': 10, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 10})},
|
||||
{'id': 30, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 30})},
|
||||
{'id': 60, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 60})},
|
||||
{'id': 60 * 2, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 2})},
|
||||
{'id': 60 * 5, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 5})},
|
||||
{'id': 60 * 10, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 10})}
|
||||
];
|
||||
});
|
||||
}
|
||||
|
||||
SecurityUserSettings.prototype.configureTwoFactor = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/TwoFactorConfiguration'));
|
||||
};
|
||||
|
||||
SecurityUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
if (this.capaAutoLogout)
|
||||
{
|
||||
this.capaAutoLogout = Settings.capa(Enums.Capa.AutoLogout);
|
||||
this.capaTwoFactor = Settings.capa(Enums.Capa.TwoFactor);
|
||||
var self = this;
|
||||
|
||||
this.autoLogout = SettinsStore.autoLogout;
|
||||
this.autoLogout.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
_.delay(function() {
|
||||
|
||||
var
|
||||
f0 = Utils.settingsSaveHelperSimpleFunction(self.autoLogout.trigger, self);
|
||||
|
||||
self.autoLogout.subscribe(function(sValue) {
|
||||
Remote.saveSettings(f0, {
|
||||
'AutoLogout': Utils.pInt(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
this.autoLogoutOptions = ko.computed(function () {
|
||||
Translator.trigger();
|
||||
return [
|
||||
{'id': 0, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_NEVER_OPTION_NAME')},
|
||||
{'id': 5, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 5})},
|
||||
{'id': 10, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 10})},
|
||||
{'id': 30, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 30})},
|
||||
{'id': 60, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_MINUTES_OPTION_NAME', {'MINUTES': 60})},
|
||||
{'id': 60 * 2, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 2})},
|
||||
{'id': 60 * 5, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 5})},
|
||||
{'id': 60 * 10, 'name': Translator.i18n('SETTINGS_SECURITY/AUTOLOGIN_HOURS_OPTION_NAME', {'HOURS': 10})}
|
||||
];
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
SecurityUserSettings.prototype.configureTwoFactor = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/TwoFactorConfiguration'));
|
||||
};
|
||||
|
||||
SecurityUserSettings.prototype.onBuild = function ()
|
||||
{
|
||||
if (this.capaAutoLogout)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f0 = Utils.settingsSaveHelperSimpleFunction(self.autoLogout.trigger, self)
|
||||
;
|
||||
|
||||
self.autoLogout.subscribe(function (sValue) {
|
||||
Remote.saveSettings(f0, {
|
||||
'AutoLogout': Utils.pInt(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = SecurityUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = SecurityUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,80 +1,73 @@
|
|||
|
||||
(function () {
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SocialUserSettings()
|
||||
{
|
||||
var
|
||||
Utils = require('Common/Utils'),
|
||||
SocialStore = require('Stores/Social');
|
||||
|
||||
'use strict';
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function SocialUserSettings()
|
||||
{
|
||||
var
|
||||
Utils = require('Common/Utils'),
|
||||
SocialStore = require('Stores/Social')
|
||||
;
|
||||
this.googleActions = SocialStore.google.loading;
|
||||
this.googleLoggined = SocialStore.google.loggined;
|
||||
this.googleUserName = SocialStore.google.userName;
|
||||
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
this.googleEnableAuthFast = SocialStore.google.capa.authFast;
|
||||
this.googleEnableDrive = SocialStore.google.capa.drive;
|
||||
this.googleEnablePreview = SocialStore.google.capa.preview;
|
||||
this.facebookEnable = SocialStore.facebook.enabled;
|
||||
|
||||
this.googleActions = SocialStore.google.loading;
|
||||
this.googleLoggined = SocialStore.google.loggined;
|
||||
this.googleUserName = SocialStore.google.userName;
|
||||
this.facebookActions = SocialStore.facebook.loading;
|
||||
this.facebookLoggined = SocialStore.facebook.loggined;
|
||||
this.facebookUserName = SocialStore.facebook.userName;
|
||||
|
||||
this.facebookEnable = SocialStore.facebook.enabled;
|
||||
this.twitterEnable = SocialStore.twitter.enabled;
|
||||
|
||||
this.facebookActions = SocialStore.facebook.loading;
|
||||
this.facebookLoggined = SocialStore.facebook.loggined;
|
||||
this.facebookUserName = SocialStore.facebook.userName;
|
||||
this.twitterActions = SocialStore.twitter.loading;
|
||||
this.twitterLoggined = SocialStore.twitter.loggined;
|
||||
this.twitterUserName = SocialStore.twitter.userName;
|
||||
|
||||
this.twitterEnable = SocialStore.twitter.enabled;
|
||||
this.connectGoogle = Utils.createCommand(this, function() {
|
||||
if (!this.googleLoggined())
|
||||
{
|
||||
require('App/User').default.googleConnect();
|
||||
}
|
||||
}, function() {
|
||||
return !this.googleLoggined() && !this.googleActions();
|
||||
});
|
||||
|
||||
this.twitterActions = SocialStore.twitter.loading;
|
||||
this.twitterLoggined = SocialStore.twitter.loggined;
|
||||
this.twitterUserName = SocialStore.twitter.userName;
|
||||
this.disconnectGoogle = Utils.createCommand(this, function() {
|
||||
require('App/User').default.googleDisconnect();
|
||||
});
|
||||
|
||||
this.connectGoogle = Utils.createCommand(this, function () {
|
||||
if (!this.googleLoggined())
|
||||
{
|
||||
require('App/User').default.googleConnect();
|
||||
}
|
||||
}, function () {
|
||||
return !this.googleLoggined() && !this.googleActions();
|
||||
});
|
||||
this.connectFacebook = Utils.createCommand(this, function() {
|
||||
if (!this.facebookLoggined())
|
||||
{
|
||||
require('App/User').default.facebookConnect();
|
||||
}
|
||||
}, function() {
|
||||
return !this.facebookLoggined() && !this.facebookActions();
|
||||
});
|
||||
|
||||
this.disconnectGoogle = Utils.createCommand(this, function () {
|
||||
require('App/User').default.googleDisconnect();
|
||||
});
|
||||
this.disconnectFacebook = Utils.createCommand(this, function() {
|
||||
require('App/User').default.facebookDisconnect();
|
||||
});
|
||||
|
||||
this.connectFacebook = Utils.createCommand(this, function () {
|
||||
if (!this.facebookLoggined())
|
||||
{
|
||||
require('App/User').default.facebookConnect();
|
||||
}
|
||||
}, function () {
|
||||
return !this.facebookLoggined() && !this.facebookActions();
|
||||
});
|
||||
this.connectTwitter = Utils.createCommand(this, function() {
|
||||
if (!this.twitterLoggined())
|
||||
{
|
||||
require('App/User').default.twitterConnect();
|
||||
}
|
||||
}, function() {
|
||||
return !this.twitterLoggined() && !this.twitterActions();
|
||||
});
|
||||
|
||||
this.disconnectFacebook = Utils.createCommand(this, function () {
|
||||
require('App/User').default.facebookDisconnect();
|
||||
});
|
||||
this.disconnectTwitter = Utils.createCommand(this, function() {
|
||||
require('App/User').default.twitterDisconnect();
|
||||
});
|
||||
}
|
||||
|
||||
this.connectTwitter = Utils.createCommand(this, function () {
|
||||
if (!this.twitterLoggined())
|
||||
{
|
||||
require('App/User').default.twitterConnect();
|
||||
}
|
||||
}, function () {
|
||||
return !this.twitterLoggined() && !this.twitterActions();
|
||||
});
|
||||
|
||||
this.disconnectTwitter = Utils.createCommand(this, function () {
|
||||
require('App/User').default.twitterDisconnect();
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = SocialUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = SocialUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,107 +1,98 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
var
|
||||
ko = require('ko'),
|
||||
TemplateStore = require('Stores/User/Template'),
|
||||
|
||||
Translator = require('Common/Translator'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
TemplateStore = require('Stores/User/Template'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function TemplatesUserSettings()
|
||||
{
|
||||
this.templates = TemplateStore.templates;
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.processText = ko.computed(function() {
|
||||
return TemplateStore.templates.loading() ? Translator.i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : '';
|
||||
}, this);
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function TemplatesUserSettings()
|
||||
this.visibility = ko.computed(function() {
|
||||
return '' === this.processText() ? 'hidden' : 'visible';
|
||||
}, this);
|
||||
|
||||
this.templateForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
}
|
||||
|
||||
TemplatesUserSettings.prototype.scrollableOptions = function(sWrapper)
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.addNewTemplate = function()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Template'));
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.editTemplate = function(oTemplateItem)
|
||||
{
|
||||
if (oTemplateItem)
|
||||
{
|
||||
this.templates = TemplateStore.templates;
|
||||
|
||||
this.processText = ko.computed(function () {
|
||||
return TemplateStore.templates.loading() ? Translator.i18n('SETTINGS_TEMPLETS/LOADING_PROCESS') : '';
|
||||
}, this);
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return '' === this.processText() ? 'hidden' : 'visible';
|
||||
}, this);
|
||||
|
||||
this.templateForDeletion = ko.observable(null).deleteAccessHelper();
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Template'), [oTemplateItem]);
|
||||
}
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.scrollableOptions = function (sWrapper)
|
||||
/**
|
||||
* @param {AccountModel} oTemplateToRemove
|
||||
*/
|
||||
TemplatesUserSettings.prototype.deleteTemplate = function(oTemplateToRemove)
|
||||
{
|
||||
if (oTemplateToRemove && oTemplateToRemove.deleteAccess())
|
||||
{
|
||||
return {
|
||||
handle: '.drag-handle',
|
||||
containment: sWrapper || 'parent',
|
||||
axis: 'y'
|
||||
};
|
||||
};
|
||||
this.templateForDeletion(null);
|
||||
|
||||
TemplatesUserSettings.prototype.addNewTemplate = function ()
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Template'));
|
||||
};
|
||||
var
|
||||
self = this,
|
||||
fRemoveAccount = function(oAccount) {
|
||||
return oTemplateToRemove === oAccount;
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.editTemplate = function (oTemplateItem)
|
||||
{
|
||||
if (oTemplateItem)
|
||||
if (oTemplateToRemove)
|
||||
{
|
||||
require('Knoin/Knoin').showScreenPopup(require('View/Popup/Template'), [oTemplateItem]);
|
||||
this.templates.remove(fRemoveAccount);
|
||||
|
||||
Remote.templateDelete(function() {
|
||||
self.reloadTemplates();
|
||||
}, oTemplateToRemove.id);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {AccountModel} oTemplateToRemove
|
||||
*/
|
||||
TemplatesUserSettings.prototype.deleteTemplate = function (oTemplateToRemove)
|
||||
{
|
||||
if (oTemplateToRemove && oTemplateToRemove.deleteAccess())
|
||||
{
|
||||
this.templateForDeletion(null);
|
||||
TemplatesUserSettings.prototype.reloadTemplates = function()
|
||||
{
|
||||
require('App/User').default.templates();
|
||||
};
|
||||
|
||||
var
|
||||
self = this,
|
||||
fRemoveAccount = function (oAccount) {
|
||||
return oTemplateToRemove === oAccount;
|
||||
}
|
||||
;
|
||||
TemplatesUserSettings.prototype.onBuild = function(oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
if (oTemplateToRemove)
|
||||
oDom
|
||||
.on('click', '.templates-list .template-item .e-action', function() {
|
||||
var oTemplateItem = ko.dataFor(this);
|
||||
if (oTemplateItem)
|
||||
{
|
||||
this.templates.remove(fRemoveAccount);
|
||||
|
||||
Remote.templateDelete(function () {
|
||||
self.reloadTemplates();
|
||||
}, oTemplateToRemove.id);
|
||||
self.editTemplate(oTemplateItem);
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
TemplatesUserSettings.prototype.reloadTemplates = function ()
|
||||
{
|
||||
require('App/User').default.templates();
|
||||
};
|
||||
this.reloadTemplates();
|
||||
};
|
||||
|
||||
TemplatesUserSettings.prototype.onBuild = function (oDom)
|
||||
{
|
||||
var self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.templates-list .template-item .e-action', function () {
|
||||
var oTemplateItem = ko.dataFor(this);
|
||||
if (oTemplateItem)
|
||||
{
|
||||
self.editTemplate(oTemplateItem);
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
this.reloadTemplates();
|
||||
};
|
||||
|
||||
module.exports = TemplatesUserSettings;
|
||||
|
||||
}());
|
||||
module.exports = TemplatesUserSettings;
|
||||
|
|
|
|||
|
|
@ -1,185 +1,177 @@
|
|||
|
||||
(function () {
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
|
||||
'use strict';
|
||||
Jua = require('Jua'),
|
||||
|
||||
var
|
||||
_ = require('_'),
|
||||
$ = require('$'),
|
||||
ko = require('ko'),
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Translator = require('Common/Translator'),
|
||||
|
||||
Jua = require('Jua'),
|
||||
ThemeStore = require('Stores/Theme'),
|
||||
|
||||
Enums = require('Common/Enums'),
|
||||
Utils = require('Common/Utils'),
|
||||
Links = require('Common/Links'),
|
||||
Translator = require('Common/Translator'),
|
||||
Settings = require('Storage/Settings'),
|
||||
|
||||
ThemeStore = require('Stores/Theme'),
|
||||
Remote = require('Remote/User/Ajax');
|
||||
|
||||
Settings = require('Storage/Settings'),
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ThemesUserSettings()
|
||||
{
|
||||
this.theme = ThemeStore.theme;
|
||||
this.themes = ThemeStore.themes;
|
||||
this.themesObjects = ko.observableArray([]);
|
||||
|
||||
Remote = require('Remote/User/Ajax')
|
||||
;
|
||||
this.background = {};
|
||||
this.background.name = ThemeStore.themeBackgroundName;
|
||||
this.background.hash = ThemeStore.themeBackgroundHash;
|
||||
this.background.uploaderButton = ko.observable(null);
|
||||
this.background.loading = ko.observable(false);
|
||||
this.background.error = ko.observable('');
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function ThemesUserSettings()
|
||||
this.capaUserBackground = ko.observable(Settings.capa(Enums.Capa.UserBackground));
|
||||
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
|
||||
this.iTimer = 0;
|
||||
this.oThemeAjaxRequest = null;
|
||||
|
||||
this.theme.subscribe(function(sValue) {
|
||||
|
||||
_.each(this.themesObjects(), function(oTheme) {
|
||||
oTheme.selected(sValue === oTheme.name);
|
||||
});
|
||||
|
||||
Utils.changeTheme(sValue, this.themeTrigger);
|
||||
|
||||
Remote.saveSettings(null, {
|
||||
'Theme': sValue
|
||||
});
|
||||
|
||||
}, this);
|
||||
|
||||
this.background.hash.subscribe(function(sValue) {
|
||||
|
||||
var $oBg = $('#rl-bg');
|
||||
if (!sValue)
|
||||
{
|
||||
if ($oBg.data('backstretch'))
|
||||
{
|
||||
$oBg.backstretch('destroy').attr('style', '');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#rl-bg').attr('style', 'background-image: none !important;').backstretch(
|
||||
Links.userBackground(sValue), {
|
||||
'fade': 1000, 'centeredX': true, 'centeredY': true
|
||||
}).removeAttr('style');
|
||||
}
|
||||
|
||||
}, this);
|
||||
}
|
||||
|
||||
ThemesUserSettings.prototype.onBuild = function()
|
||||
{
|
||||
var sCurrentTheme = this.theme();
|
||||
this.themesObjects(_.map(this.themes(), function(sTheme) {
|
||||
return {
|
||||
'name': sTheme,
|
||||
'nameDisplay': Utils.convertThemeName(sTheme),
|
||||
'selected': ko.observable(sTheme === sCurrentTheme),
|
||||
'themePreviewSrc': Links.themePreviewLink(sTheme)
|
||||
};
|
||||
}));
|
||||
|
||||
this.initUploader();
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.onShow = function()
|
||||
{
|
||||
this.background.error('');
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.clearBackground = function()
|
||||
{
|
||||
if (this.capaUserBackground())
|
||||
{
|
||||
this.theme = ThemeStore.theme;
|
||||
this.themes = ThemeStore.themes;
|
||||
this.themesObjects = ko.observableArray([]);
|
||||
|
||||
this.background = {};
|
||||
this.background.name = ThemeStore.themeBackgroundName;
|
||||
this.background.hash = ThemeStore.themeBackgroundHash;
|
||||
this.background.uploaderButton = ko.observable(null);
|
||||
this.background.loading = ko.observable(false);
|
||||
this.background.error = ko.observable('');
|
||||
|
||||
this.capaUserBackground = ko.observable(Settings.capa(Enums.Capa.UserBackground));
|
||||
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle).extend({'throttle': 100});
|
||||
|
||||
this.iTimer = 0;
|
||||
this.oThemeAjaxRequest = null;
|
||||
|
||||
this.theme.subscribe(function (sValue) {
|
||||
|
||||
_.each(this.themesObjects(), function (oTheme) {
|
||||
oTheme.selected(sValue === oTheme.name);
|
||||
});
|
||||
|
||||
Utils.changeTheme(sValue, this.themeTrigger);
|
||||
|
||||
Remote.saveSettings(null, {
|
||||
'Theme': sValue
|
||||
});
|
||||
|
||||
}, this);
|
||||
|
||||
this.background.hash.subscribe(function (sValue) {
|
||||
|
||||
var $oBg = $('#rl-bg');
|
||||
if (!sValue)
|
||||
{
|
||||
if ($oBg.data('backstretch'))
|
||||
{
|
||||
$oBg.backstretch('destroy').attr('style', '');
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
$('#rl-bg').attr('style', 'background-image: none !important;').backstretch(
|
||||
Links.userBackground(sValue), {
|
||||
'fade': 1000, 'centeredX': true, 'centeredY': true
|
||||
}).removeAttr('style');
|
||||
}
|
||||
|
||||
}, this);
|
||||
var self = this;
|
||||
Remote.clearUserBackground(function() {
|
||||
self.background.name('');
|
||||
self.background.hash('');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.onBuild = function ()
|
||||
ThemesUserSettings.prototype.initUploader = function()
|
||||
{
|
||||
if (this.background.uploaderButton() && this.capaUserBackground())
|
||||
{
|
||||
var sCurrentTheme = this.theme();
|
||||
this.themesObjects(_.map(this.themes(), function (sTheme) {
|
||||
return {
|
||||
'name': sTheme,
|
||||
'nameDisplay': Utils.convertThemeName(sTheme),
|
||||
'selected': ko.observable(sTheme === sCurrentTheme),
|
||||
'themePreviewSrc': Links.themePreviewLink(sTheme)
|
||||
};
|
||||
}));
|
||||
|
||||
this.initUploader();
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.onShow = function ()
|
||||
{
|
||||
this.background.error('');
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.clearBackground = function ()
|
||||
{
|
||||
if (this.capaUserBackground())
|
||||
{
|
||||
var self = this;
|
||||
Remote.clearUserBackground(function () {
|
||||
self.background.name('');
|
||||
self.background.hash('');
|
||||
var
|
||||
oJua = new Jua({
|
||||
'action': Links.uploadBackground(),
|
||||
'name': 'uploader',
|
||||
'queueSize': 1,
|
||||
'multipleSizeLimit': 1,
|
||||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'clickElement': this.background.uploaderButton()
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
ThemesUserSettings.prototype.initUploader = function ()
|
||||
{
|
||||
if (this.background.uploaderButton() && this.capaUserBackground())
|
||||
{
|
||||
var
|
||||
oJua = new Jua({
|
||||
'action': Links.uploadBackground(),
|
||||
'name': 'uploader',
|
||||
'queueSize': 1,
|
||||
'multipleSizeLimit': 1,
|
||||
'disableDragAndDrop': true,
|
||||
'disableMultiple': true,
|
||||
'clickElement': this.background.uploaderButton()
|
||||
})
|
||||
;
|
||||
oJua
|
||||
.on('onStart', _.bind(function() {
|
||||
|
||||
oJua
|
||||
.on('onStart', _.bind(function () {
|
||||
this.background.loading(true);
|
||||
this.background.error('');
|
||||
|
||||
this.background.loading(true);
|
||||
this.background.error('');
|
||||
return true;
|
||||
|
||||
return true;
|
||||
}, this))
|
||||
.on('onComplete', _.bind(function(sId, bResult, oData) {
|
||||
|
||||
}, this))
|
||||
.on('onComplete', _.bind(function (sId, bResult, oData) {
|
||||
this.background.loading(false);
|
||||
|
||||
this.background.loading(false);
|
||||
if (bResult && sId && oData && oData.Result && oData.Result.Name && oData.Result.Hash)
|
||||
{
|
||||
this.background.name(oData.Result.Name);
|
||||
this.background.hash(oData.Result.Hash);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.background.name('');
|
||||
this.background.hash('');
|
||||
|
||||
if (bResult && sId && oData && oData.Result && oData.Result.Name && oData.Result.Hash)
|
||||
var sError = '';
|
||||
if (oData.ErrorCode)
|
||||
{
|
||||
this.background.name(oData.Result.Name);
|
||||
this.background.hash(oData.Result.Hash);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.background.name('');
|
||||
this.background.hash('');
|
||||
|
||||
var sError = '';
|
||||
if (oData.ErrorCode)
|
||||
switch (oData.ErrorCode)
|
||||
{
|
||||
switch (oData.ErrorCode)
|
||||
{
|
||||
case Enums.UploadErrorCode.FileIsTooBig:
|
||||
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG');
|
||||
break;
|
||||
case Enums.UploadErrorCode.FileType:
|
||||
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR');
|
||||
break;
|
||||
}
|
||||
case Enums.UploadErrorCode.FileIsTooBig:
|
||||
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_IS_TOO_BIG');
|
||||
break;
|
||||
case Enums.UploadErrorCode.FileType:
|
||||
sError = Translator.i18n('SETTINGS_THEMES/ERROR_FILE_TYPE_ERROR');
|
||||
break;
|
||||
// no default
|
||||
}
|
||||
|
||||
if (!sError && oData.ErrorMessage)
|
||||
{
|
||||
sError = oData.ErrorMessage;
|
||||
}
|
||||
|
||||
this.background.error(sError || Translator.i18n('SETTINGS_THEMES/ERROR_UNKNOWN'));
|
||||
}
|
||||
|
||||
return true;
|
||||
if (!sError && oData.ErrorMessage)
|
||||
{
|
||||
sError = oData.ErrorMessage;
|
||||
}
|
||||
|
||||
}, this))
|
||||
;
|
||||
}
|
||||
};
|
||||
this.background.error(sError || Translator.i18n('SETTINGS_THEMES/ERROR_UNKNOWN'));
|
||||
}
|
||||
|
||||
module.exports = ThemesUserSettings;
|
||||
return true;
|
||||
|
||||
}());
|
||||
}, this));
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = ThemesUserSettings;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue