eslint (additional rules)

This commit is contained in:
RainLoop Team 2016-06-30 03:02:45 +03:00
parent 77a1d3f3df
commit 8e8a041032
150 changed files with 21911 additions and 23106 deletions

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;

View file

@ -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;