mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 11:09:20 +03:00
CommonJS (research/2)
This commit is contained in:
parent
56607de87c
commit
586abbb802
115 changed files with 16201 additions and 9943 deletions
|
|
@ -1,76 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminAbout()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.version = ko.observable(RL.settingsGet('Version'));
|
||||
this.access = ko.observable(!!RL.settingsGet('CoreAccess'));
|
||||
this.errorDesc = ko.observable('');
|
||||
|
||||
this.coreReal = oData.coreReal;
|
||||
this.coreUpdatable = oData.coreUpdatable;
|
||||
this.coreAccess = oData.coreAccess;
|
||||
this.coreChecking = oData.coreChecking;
|
||||
this.coreUpdating = oData.coreUpdating;
|
||||
this.coreRemoteVersion = oData.coreRemoteVersion;
|
||||
this.coreRemoteRelease = oData.coreRemoteRelease;
|
||||
this.coreVersionCompare = oData.coreVersionCompare;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminAbout, 'AdminSettingsAbout', 'About', 'about');
|
||||
|
||||
AdminAbout.prototype.onBuild = function ()
|
||||
{
|
||||
if (this.access())
|
||||
{
|
||||
RL.reloadCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
AdminAbout.prototype.updateCoreData = function ()
|
||||
{
|
||||
if (!this.coreUpdating())
|
||||
{
|
||||
RL.updateCoreData();
|
||||
}
|
||||
};
|
||||
87
dev/Admin/AdminSettingsAbout.js
Normal file
87
dev/Admin/AdminSettingsAbout.js
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
Data = require('../Storages/AdminDataStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsAbout()
|
||||
{
|
||||
this.version = ko.observable(RL.settingsGet('Version'));
|
||||
this.access = ko.observable(!!RL.settingsGet('CoreAccess'));
|
||||
this.errorDesc = ko.observable('');
|
||||
|
||||
this.coreReal = Data.coreReal;
|
||||
this.coreUpdatable = Data.coreUpdatable;
|
||||
this.coreAccess = Data.coreAccess;
|
||||
this.coreChecking = Data.coreChecking;
|
||||
this.coreUpdating = Data.coreUpdating;
|
||||
this.coreRemoteVersion = Data.coreRemoteVersion;
|
||||
this.coreRemoteRelease = Data.coreRemoteRelease;
|
||||
this.coreVersionCompare = Data.coreVersionCompare;
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsAbout, 'AdminSettingsAbout', 'About', 'about');
|
||||
|
||||
AdminSettingsAbout.prototype.onBuild = function ()
|
||||
{
|
||||
if (this.access())
|
||||
{
|
||||
RL.reloadCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
AdminSettingsAbout.prototype.updateCoreData = function ()
|
||||
{
|
||||
if (!this.coreUpdating())
|
||||
{
|
||||
RL.updateCoreData();
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsAbout;
|
||||
|
||||
}(module));
|
||||
87
dev/Admin/AdminSettingsBranding.js
Normal file
87
dev/Admin/AdminSettingsBranding.js
Normal file
|
|
@ -0,0 +1,87 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsBranding()
|
||||
{
|
||||
this.title = ko.observable(RL.settingsGet('Title'));
|
||||
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loadingDesc = ko.observable(RL.settingsGet('LoadingDescription'));
|
||||
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginLogo = ko.observable(RL.settingsGet('LoginLogo'));
|
||||
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginDescription = ko.observable(RL.settingsGet('LoginDescription'));
|
||||
this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginCss = ko.observable(RL.settingsGet('LoginCss'));
|
||||
this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsBranding, 'AdminSettingsBranding', 'Branding', 'branding');
|
||||
|
||||
AdminSettingsBranding.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.loginLogo.trigger, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.loginDescription.trigger, self),
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.loginCss.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.loginLogo.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'LoginLogo': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loginDescription.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'LoginDescription': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loginCss.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'LoginCss': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsBranding;
|
||||
|
||||
}(module));
|
||||
235
dev/Admin/AdminSettingsContacts.js
Normal file
235
dev/Admin/AdminSettingsContacts.js
Normal file
|
|
@ -0,0 +1,235 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsContacts()
|
||||
{
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
this.enableContacts = ko.observable(!!RL.settingsGet('ContactsEnable'));
|
||||
this.contactsSharing = ko.observable(!!RL.settingsGet('ContactsSharing'));
|
||||
this.contactsSync = ko.observable(!!RL.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 (!!RL.settingsGet('SQLiteIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('sqlite');
|
||||
}
|
||||
if (!!RL.settingsGet('MySqlIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('mysql');
|
||||
}
|
||||
if (!!RL.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 ? ' (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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.contactsType.subscribe(function () {
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
}, this);
|
||||
|
||||
this.pdoDsn = ko.observable(RL.settingsGet('ContactsPdoDsn'));
|
||||
this.pdoUser = ko.observable(RL.settingsGet('ContactsPdoUser'));
|
||||
this.pdoPassword = ko.observable(RL.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(RL.settingsGet('ContactsPdoType'));
|
||||
|
||||
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsContacts, 'AdminSettingsContacts', 'Contacts', 'contacts');
|
||||
|
||||
AdminSettingsContacts.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);
|
||||
};
|
||||
|
||||
AdminSettingsContacts.prototype.onShow = function ()
|
||||
{
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
};
|
||||
|
||||
AdminSettingsContacts.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.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.contactsSharing.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'ContactsSharing': 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.pdoDsn.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'ContactsPdoDsn': 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.contactsType(RL.settingsGet('ContactsPdoType'));
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsContacts;
|
||||
|
||||
}(module));
|
||||
107
dev/Admin/AdminSettingsDomains.js
Normal file
107
dev/Admin/AdminSettingsDomains.js
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsDomains()
|
||||
{
|
||||
this.domains = Data.domains;
|
||||
this.domainsLoading = Data.domainsLoading;
|
||||
|
||||
this.iDomainForDeletionTimeout = 0;
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return Data.domainsLoading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
this.domainForDeletion = ko.observable(null).extend({'toggleSubscribe': [this,
|
||||
function (oPrev) {
|
||||
if (oPrev)
|
||||
{
|
||||
oPrev.deleteAccess(false);
|
||||
}
|
||||
}, function (oNext) {
|
||||
if (oNext)
|
||||
{
|
||||
oNext.deleteAccess(true);
|
||||
this.startDomainForDeletionTimeout();
|
||||
}
|
||||
}
|
||||
]});
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsDomains, 'AdminSettingsDomains', 'Domains', 'domains');
|
||||
|
||||
AdminSettingsDomains.prototype.startDomainForDeletionTimeout = function ()
|
||||
{
|
||||
var self = this;
|
||||
window.clearInterval(this.iDomainForDeletionTimeout);
|
||||
this.iDomainForDeletionTimeout = window.setTimeout(function () {
|
||||
self.domainForDeletion(null);
|
||||
}, 1000 * 3);
|
||||
};
|
||||
|
||||
AdminSettingsDomains.prototype.createDomain = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsDomainViewModel);
|
||||
};
|
||||
|
||||
AdminSettingsDomains.prototype.deleteDomain = function (oDomain)
|
||||
{
|
||||
this.domains.remove(oDomain);
|
||||
Remote.domainDelete(_.bind(this.onDomainListChangeRequest, this), oDomain.name);
|
||||
};
|
||||
|
||||
AdminSettingsDomains.prototype.disableDomain = function (oDomain)
|
||||
{
|
||||
oDomain.disabled(!oDomain.disabled());
|
||||
Remote.domainDisable(_.bind(this.onDomainListChangeRequest, this), oDomain.name, oDomain.disabled());
|
||||
};
|
||||
|
||||
AdminSettingsDomains.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(_.bind(self.onDomainLoadRequest, self), oDomainItem.name);
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
RL.reloadDomainList();
|
||||
};
|
||||
|
||||
AdminSettingsDomains.prototype.onDomainLoadRequest = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
kn.showScreenPopup(PopupsDomainViewModel, [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
AdminSettingsDomains.prototype.onDomainListChangeRequest = function ()
|
||||
{
|
||||
RL.reloadDomainList();
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsDomains;
|
||||
|
||||
}(module));
|
||||
148
dev/Admin/AdminSettingsGeneral.js
Normal file
148
dev/Admin/AdminSettingsGeneral.js
Normal file
|
|
@ -0,0 +1,148 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
LinkBuilder = require('../Common/LinkBuilder.js'),
|
||||
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
|
||||
|
||||
PopupsLanguagesViewModel = require('../ViewModels/Popups/PopupsLanguagesViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsGeneral()
|
||||
{
|
||||
this.mainLanguage = Data.mainLanguage;
|
||||
this.mainTheme = Data.mainTheme;
|
||||
|
||||
this.language = Data.language;
|
||||
this.theme = Data.theme;
|
||||
|
||||
this.allowLanguagesOnSettings = Data.allowLanguagesOnSettings;
|
||||
this.capaThemes = Data.capaThemes;
|
||||
this.capaGravatar = Data.capaGravatar;
|
||||
this.capaAdditionalAccounts = Data.capaAdditionalAccounts;
|
||||
this.capaAdditionalIdentities = Data.capaAdditionalIdentities;
|
||||
|
||||
this.mainAttachmentLimit = ko.observable(Utils.pInt(RL.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25});
|
||||
this.uploadData = RL.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(Data.themes(), function (sTheme) {
|
||||
return {
|
||||
'optValue': sTheme,
|
||||
'optText': Utils.convertThemeName(sTheme)
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
this.mainLanguageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.mainLanguage());
|
||||
}, this);
|
||||
|
||||
this.weakPassword = !!RL.settingsGet('WeakPassword');
|
||||
|
||||
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsGeneral, 'AdminSettingsGeneral', 'General', 'general', true);
|
||||
|
||||
AdminSettingsGeneral.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.attachmentLimitTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self)
|
||||
;
|
||||
|
||||
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.theme.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'Theme': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.capaAdditionalAccounts.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAdditionalAccounts': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaAdditionalIdentities.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaAdditionalIdentities': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaGravatar.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaGravatar': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaThemes.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'CapaThemes': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowLanguagesOnSettings.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnSettings': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
AdminSettingsGeneral.prototype.selectLanguage = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsLanguagesViewModel);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
AdminSettingsGeneral.prototype.phpInfoLink = function ()
|
||||
{
|
||||
return LinkBuilder.phpInfo();
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsGeneral;
|
||||
|
||||
}(module));
|
||||
75
dev/Admin/AdminSettingsLicensing.js
Normal file
75
dev/Admin/AdminSettingsLicensing.js
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
moment = require('../External/moment.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
|
||||
kn = require('../Knoin/Knoin.js'),
|
||||
PopupsActivateViewModel = require('../ViewModels/Popups/PopupsActivateViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsLicensing()
|
||||
{
|
||||
this.licensing = Data.licensing;
|
||||
this.licensingProcess = Data.licensingProcess;
|
||||
this.licenseValid = Data.licenseValid;
|
||||
this.licenseExpired = Data.licenseExpired;
|
||||
this.licenseError = Data.licenseError;
|
||||
this.licenseTrigger = Data.licenseTrigger;
|
||||
|
||||
this.adminDomain = ko.observable('');
|
||||
this.subscriptionEnabled = ko.observable(!!RL.settingsGet('SubscriptionEnabled'));
|
||||
|
||||
this.licenseTrigger.subscribe(function () {
|
||||
if (this.subscriptionEnabled())
|
||||
{
|
||||
RL.reloadLicensing(true);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsLicensing, 'AdminSettingsLicensing', 'Licensing', 'licensing');
|
||||
|
||||
AdminSettingsLicensing.prototype.onBuild = function ()
|
||||
{
|
||||
if (this.subscriptionEnabled())
|
||||
{
|
||||
RL.reloadLicensing(false);
|
||||
}
|
||||
};
|
||||
|
||||
AdminSettingsLicensing.prototype.onShow = function ()
|
||||
{
|
||||
this.adminDomain(RL.settingsGet('AdminDomain'));
|
||||
};
|
||||
|
||||
AdminSettingsLicensing.prototype.showActivationForm = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsActivateViewModel);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AdminSettingsLicensing.prototype.licenseExpiredMomentValue = function ()
|
||||
{
|
||||
var
|
||||
iTime = this.licenseExpired(),
|
||||
oDate = moment.unix(iTime)
|
||||
;
|
||||
|
||||
return iTime && 1898625600 === iTime ? 'Never' : (oDate.format('LL') + ' (' + oDate.from(moment()) + ')');
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsLicensing;
|
||||
|
||||
}(module));
|
||||
69
dev/Admin/AdminSettingsLogin.js
Normal file
69
dev/Admin/AdminSettingsLogin.js
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsLogin()
|
||||
{
|
||||
this.determineUserLanguage = Data.determineUserLanguage;
|
||||
this.determineUserDomain = Data.determineUserDomain;
|
||||
|
||||
this.defaultDomain = ko.observable(RL.settingsGet('LoginDefaultDomain'));
|
||||
|
||||
this.allowLanguagesOnLogin = Data.allowLanguagesOnLogin;
|
||||
this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsLogin, 'AdminSettingsLogin', 'Login', 'login');
|
||||
|
||||
AdminSettingsLogin.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function () {
|
||||
|
||||
var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
|
||||
|
||||
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.allowLanguagesOnLogin.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'AllowLanguagesOnLogin': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.defaultDomain.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'LoginDefaultDomain': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsLogin;
|
||||
|
||||
}(module));
|
||||
116
dev/Admin/AdminSettingsPackages.js
Normal file
116
dev/Admin/AdminSettingsPackages.js
Normal file
|
|
@ -0,0 +1,116 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
window = require('../External/window.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsPackages()
|
||||
{
|
||||
this.packagesError = ko.observable('');
|
||||
|
||||
this.packages = Data.packages;
|
||||
this.packagesLoading = Data.packagesLoading;
|
||||
this.packagesReal = Data.packagesReal;
|
||||
this.packagesMainUpdatable = Data.packagesMainUpdatable;
|
||||
|
||||
this.packagesCurrent = this.packages.filter(function (oItem) {
|
||||
return oItem && '' !== oItem['installed'] && !oItem['compare'];
|
||||
});
|
||||
|
||||
this.packagesAvailableForUpdate = this.packages.filter(function (oItem) {
|
||||
return oItem && '' !== oItem['installed'] && !!oItem['compare'];
|
||||
});
|
||||
|
||||
this.packagesAvailableForInstallation = this.packages.filter(function (oItem) {
|
||||
return oItem && '' === oItem['installed'];
|
||||
});
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return Data.packagesLoading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsPackages, 'AdminSettingsPackages', 'Packages', 'packages');
|
||||
|
||||
AdminSettingsPackages.prototype.onShow = function ()
|
||||
{
|
||||
this.packagesError('');
|
||||
};
|
||||
|
||||
AdminSettingsPackages.prototype.onBuild = function ()
|
||||
{
|
||||
RL.reloadPackagesList();
|
||||
};
|
||||
|
||||
AdminSettingsPackages.prototype.requestHelper = function (oPackage, bInstall)
|
||||
{
|
||||
var self = this;
|
||||
return function (sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
|
||||
{
|
||||
if (oData && oData.ErrorCode)
|
||||
{
|
||||
self.packagesError(Utils.getNotification(oData.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
self.packagesError(Utils.getNotification(
|
||||
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
|
||||
}
|
||||
}
|
||||
|
||||
_.each(Data.packages(), function (oItem) {
|
||||
if (oItem && oPackage && oItem['loading']() && oPackage['file'] === oItem['file'])
|
||||
{
|
||||
oPackage['loading'](false);
|
||||
oItem['loading'](false);
|
||||
}
|
||||
});
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result['Reload'])
|
||||
{
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
RL.reloadPackagesList();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AdminSettingsPackages.prototype.deletePackage = function (oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage['loading'](true);
|
||||
Remote.packageDelete(this.requestHelper(oPackage, false), oPackage);
|
||||
}
|
||||
};
|
||||
|
||||
AdminSettingsPackages.prototype.installPackage = function (oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage['loading'](true);
|
||||
Remote.packageInstall(this.requestHelper(oPackage, true), oPackage);
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsPackages;
|
||||
|
||||
}(module));
|
||||
117
dev/Admin/AdminSettingsPlugins.js
Normal file
117
dev/Admin/AdminSettingsPlugins.js
Normal file
|
|
@ -0,0 +1,117 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js'),
|
||||
|
||||
PopupsPluginViewModel = require('../ViewModels/Popups/PopupsPluginViewModel.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsPlugins()
|
||||
{
|
||||
this.enabledPlugins = ko.observable(!!RL.settingsGet('EnabledPlugins'));
|
||||
|
||||
this.pluginsError = ko.observable('');
|
||||
|
||||
this.plugins = Data.plugins;
|
||||
this.pluginsLoading = Data.pluginsLoading;
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return Data.pluginsLoading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
|
||||
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsPlugins, 'AdminSettingsPlugins', 'Plugins', 'plugins');
|
||||
|
||||
AdminSettingsPlugins.prototype.disablePlugin = function (oPlugin)
|
||||
{
|
||||
oPlugin.disabled(!oPlugin.disabled());
|
||||
Remote.pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
|
||||
};
|
||||
|
||||
AdminSettingsPlugins.prototype.configurePlugin = function (oPlugin)
|
||||
{
|
||||
Remote.plugin(this.onPluginLoadRequest, oPlugin.name);
|
||||
};
|
||||
|
||||
AdminSettingsPlugins.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.emptyFunction, {
|
||||
'EnabledPlugins': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
AdminSettingsPlugins.prototype.onShow = function ()
|
||||
{
|
||||
this.pluginsError('');
|
||||
RL.reloadPluginList();
|
||||
};
|
||||
|
||||
AdminSettingsPlugins.prototype.onPluginLoadRequest = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
kn.showScreenPopup(PopupsPluginViewModel, [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
AdminSettingsPlugins.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)
|
||||
{
|
||||
this.pluginsError(oData.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pluginsError(Utils.getNotification(oData.ErrorCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RL.reloadPluginList();
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsPlugins;
|
||||
|
||||
}(module));
|
||||
134
dev/Admin/AdminSettingsSecurity.js
Normal file
134
dev/Admin/AdminSettingsSecurity.js
Normal file
|
|
@ -0,0 +1,134 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
LinkBuilder = require('../Common/LinkBuilder.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsSecurity()
|
||||
{
|
||||
this.useLocalProxyForExternalImages = Data.useLocalProxyForExternalImages;
|
||||
|
||||
this.capaOpenPGP = ko.observable(RL.capa(Enums.Capa.OpenPGP));
|
||||
this.capaTwoFactorAuth = ko.observable(RL.capa(Enums.Capa.TwoFactor));
|
||||
|
||||
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
|
||||
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.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 (this.adminPasswordNew() !== this.adminPasswordNew2())
|
||||
{
|
||||
this.adminPasswordNewError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
|
||||
Remote.saveNewAdminPassword(this.onNewAdminPasswordResponse, {
|
||||
'Password': this.adminPassword(),
|
||||
'NewPassword': this.adminPasswordNew()
|
||||
});
|
||||
|
||||
}, function () {
|
||||
return '' !== this.adminPassword() && '' !== this.adminPasswordNew() && '' !== this.adminPasswordNew2();
|
||||
});
|
||||
|
||||
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsSecurity, 'AdminSettingsSecurity', 'Security', 'security');
|
||||
|
||||
AdminSettingsSecurity.prototype.onNewAdminPasswordResponse = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
|
||||
this.adminPasswordUpdateSuccess(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.adminPasswordUpdateError(true);
|
||||
}
|
||||
};
|
||||
|
||||
AdminSettingsSecurity.prototype.onBuild = function ()
|
||||
{
|
||||
this.capaOpenPGP.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'CapaOpenPGP': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.capaTwoFactorAuth.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'CapaTwoFactorAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.useLocalProxyForExternalImages.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'UseLocalProxyForExternalImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
AdminSettingsSecurity.prototype.onHide = function ()
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
AdminSettingsSecurity.prototype.phpInfoLink = function ()
|
||||
{
|
||||
return LinkBuilder.phpInfo();
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsSecurity;
|
||||
|
||||
}(module));
|
||||
153
dev/Admin/AdminSettingsSocial.js
Normal file
153
dev/Admin/AdminSettingsSocial.js
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
(function (module) {
|
||||
|
||||
'use strict';
|
||||
|
||||
var
|
||||
_ = require('../External/underscore.js'),
|
||||
ko = require('../External/ko.js'),
|
||||
|
||||
Enums = require('../Common/Enums.js'),
|
||||
Utils = require('../Common/Utils.js'),
|
||||
|
||||
Data = require('../Storages/AdminDataStorage.js'),
|
||||
Remote = require('../Storages/AdminAjaxRemoteStorage.js')
|
||||
;
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSettingsSocial()
|
||||
{
|
||||
this.googleEnable = Data.googleEnable;
|
||||
this.googleClientID = Data.googleClientID;
|
||||
this.googleApiKey = Data.googleApiKey;
|
||||
this.googleClientSecret = Data.googleClientSecret;
|
||||
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.facebookSupported = Data.facebookSupported;
|
||||
this.facebookEnable = Data.facebookEnable;
|
||||
this.facebookAppID = Data.facebookAppID;
|
||||
this.facebookAppSecret = Data.facebookAppSecret;
|
||||
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.twitterEnable = Data.twitterEnable;
|
||||
this.twitterConsumerKey = Data.twitterConsumerKey;
|
||||
this.twitterConsumerSecret = Data.twitterConsumerSecret;
|
||||
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dropboxEnable = Data.dropboxEnable;
|
||||
this.dropboxApiKey = Data.dropboxApiKey;
|
||||
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
kn.addSettingsViewModel(AdminSettingsSocial, 'AdminSettingsSocial', 'Social', 'social');
|
||||
|
||||
AdminSettingsSocial.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.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.emptyFunction, {
|
||||
'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) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'TwitterEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.twitterConsumerKey.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'TwitterConsumerKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.twitterConsumerSecret.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'TwitterConsumerSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnable.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'GoogleEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientID.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'GoogleClientID': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientSecret.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f6, {
|
||||
'GoogleClientSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleApiKey.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f7, {
|
||||
'GoogleApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxEnable.subscribe(function (bValue) {
|
||||
Remote.saveAdminConfig(Utils.emptyFunction, {
|
||||
'DropboxEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxApiKey.subscribe(function (sValue) {
|
||||
Remote.saveAdminConfig(f8, {
|
||||
'DropboxApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
module.exports = AdminSettingsSocial;
|
||||
|
||||
}(module));
|
||||
|
|
@ -1,70 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminBranding()
|
||||
{
|
||||
this.title = ko.observable(RL.settingsGet('Title'));
|
||||
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loadingDesc = ko.observable(RL.settingsGet('LoadingDescription'));
|
||||
this.loadingDesc.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginLogo = ko.observable(RL.settingsGet('LoginLogo'));
|
||||
this.loginLogo.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginDescription = ko.observable(RL.settingsGet('LoginDescription'));
|
||||
this.loginDescription.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.loginCss = ko.observable(RL.settingsGet('LoginCss'));
|
||||
this.loginCss.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminBranding, 'AdminSettingsBranding', 'Branding', 'branding');
|
||||
|
||||
AdminBranding.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.title.trigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.loadingDesc.trigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.loginLogo.trigger, self),
|
||||
f4 = Utils.settingsSaveHelperSimpleFunction(self.loginDescription.trigger, self),
|
||||
f5 = Utils.settingsSaveHelperSimpleFunction(self.loginCss.trigger, self)
|
||||
;
|
||||
|
||||
self.title.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f1, {
|
||||
'Title': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loadingDesc.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f2, {
|
||||
'LoadingDescription': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loginLogo.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f3, {
|
||||
'LoginLogo': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loginDescription.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f4, {
|
||||
'LoginDescription': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.loginCss.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f5, {
|
||||
'LoginCss': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
|
@ -1,221 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminContacts()
|
||||
{
|
||||
// var oData = RL.data();
|
||||
|
||||
this.defautOptionsAfterRender = Utils.defautOptionsAfterRender;
|
||||
this.enableContacts = ko.observable(!!RL.settingsGet('ContactsEnable'));
|
||||
this.contactsSharing = ko.observable(!!RL.settingsGet('ContactsSharing'));
|
||||
this.contactsSync = ko.observable(!!RL.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 (!!RL.settingsGet('SQLiteIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('sqlite');
|
||||
}
|
||||
if (!!RL.settingsGet('MySqlIsSupported'))
|
||||
{
|
||||
aSupportedTypes.push('mysql');
|
||||
}
|
||||
if (!!RL.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 ? ' (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();
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
this.contactsType.subscribe(function () {
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
}, this);
|
||||
|
||||
this.pdoDsn = ko.observable(RL.settingsGet('ContactsPdoDsn'));
|
||||
this.pdoUser = ko.observable(RL.settingsGet('ContactsPdoUser'));
|
||||
this.pdoPassword = ko.observable(RL.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);
|
||||
|
||||
RL.remote().testContacts(this.onTestContactsResponse, {
|
||||
'ContactsPdoType': this.contactsType(),
|
||||
'ContactsPdoDsn': this.pdoDsn(),
|
||||
'ContactsPdoUser': this.pdoUser(),
|
||||
'ContactsPdoPassword': this.pdoPassword()
|
||||
});
|
||||
|
||||
}, function () {
|
||||
return '' !== this.pdoDsn() && '' !== this.pdoUser();
|
||||
});
|
||||
|
||||
this.contactsType(RL.settingsGet('ContactsPdoType'));
|
||||
|
||||
this.onTestContactsResponse = _.bind(this.onTestContactsResponse, this);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminContacts, 'AdminSettingsContacts', 'Contacts', 'contacts');
|
||||
|
||||
AdminContacts.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);
|
||||
};
|
||||
|
||||
AdminContacts.prototype.onShow = function ()
|
||||
{
|
||||
this.testContactsSuccess(false);
|
||||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
};
|
||||
|
||||
AdminContacts.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.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) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'ContactsEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsSharing.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'ContactsSharing': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsSync.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'ContactsSync': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsType.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f5, {
|
||||
'ContactsPdoType': sValue
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoDsn.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f1, {
|
||||
'ContactsPdoDsn': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoUser.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f3, {
|
||||
'ContactsPdoUser': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.pdoPassword.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f4, {
|
||||
'ContactsPdoPassword': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.contactsType(RL.settingsGet('ContactsPdoType'));
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
|
@ -1,90 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminDomains()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.domains = oData.domains;
|
||||
this.domainsLoading = oData.domainsLoading;
|
||||
|
||||
this.iDomainForDeletionTimeout = 0;
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return oData.domainsLoading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
this.domainForDeletion = ko.observable(null).extend({'toggleSubscribe': [this,
|
||||
function (oPrev) {
|
||||
if (oPrev)
|
||||
{
|
||||
oPrev.deleteAccess(false);
|
||||
}
|
||||
}, function (oNext) {
|
||||
if (oNext)
|
||||
{
|
||||
oNext.deleteAccess(true);
|
||||
this.startDomainForDeletionTimeout();
|
||||
}
|
||||
}
|
||||
]});
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminDomains, 'AdminSettingsDomains', 'Domains', 'domains');
|
||||
|
||||
AdminDomains.prototype.startDomainForDeletionTimeout = function ()
|
||||
{
|
||||
var self = this;
|
||||
window.clearInterval(this.iDomainForDeletionTimeout);
|
||||
this.iDomainForDeletionTimeout = window.setTimeout(function () {
|
||||
self.domainForDeletion(null);
|
||||
}, 1000 * 3);
|
||||
};
|
||||
|
||||
AdminDomains.prototype.createDomain = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsDomainViewModel);
|
||||
};
|
||||
|
||||
AdminDomains.prototype.deleteDomain = function (oDomain)
|
||||
{
|
||||
this.domains.remove(oDomain);
|
||||
RL.remote().domainDelete(_.bind(this.onDomainListChangeRequest, this), oDomain.name);
|
||||
};
|
||||
|
||||
AdminDomains.prototype.disableDomain = function (oDomain)
|
||||
{
|
||||
oDomain.disabled(!oDomain.disabled());
|
||||
RL.remote().domainDisable(_.bind(this.onDomainListChangeRequest, this), oDomain.name, oDomain.disabled());
|
||||
};
|
||||
|
||||
AdminDomains.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)
|
||||
{
|
||||
RL.remote().domain(_.bind(self.onDomainLoadRequest, self), oDomainItem.name);
|
||||
}
|
||||
})
|
||||
;
|
||||
|
||||
RL.reloadDomainList();
|
||||
};
|
||||
|
||||
AdminDomains.prototype.onDomainLoadRequest = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
kn.showScreenPopup(PopupsDomainViewModel, [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
AdminDomains.prototype.onDomainListChangeRequest = function ()
|
||||
{
|
||||
RL.reloadDomainList();
|
||||
};
|
||||
|
|
@ -1,127 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminGeneral()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.mainLanguage = oData.mainLanguage;
|
||||
this.mainTheme = oData.mainTheme;
|
||||
|
||||
this.language = oData.language;
|
||||
this.theme = oData.theme;
|
||||
|
||||
this.allowLanguagesOnSettings = oData.allowLanguagesOnSettings;
|
||||
this.capaThemes = oData.capaThemes;
|
||||
this.capaGravatar = oData.capaGravatar;
|
||||
this.capaAdditionalAccounts = oData.capaAdditionalAccounts;
|
||||
this.capaAdditionalIdentities = oData.capaAdditionalIdentities;
|
||||
|
||||
this.mainAttachmentLimit = ko.observable(Utils.pInt(RL.settingsGet('AttachmentLimit')) / (1024 * 1024)).extend({'posInterer': 25});
|
||||
this.uploadData = RL.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(oData.themes(), function (sTheme) {
|
||||
return {
|
||||
'optValue': sTheme,
|
||||
'optText': Utils.convertThemeName(sTheme)
|
||||
};
|
||||
});
|
||||
});
|
||||
|
||||
this.mainLanguageFullName = ko.computed(function () {
|
||||
return Utils.convertLangName(this.mainLanguage());
|
||||
}, this);
|
||||
|
||||
this.weakPassword = !!RL.settingsGet('WeakPassword');
|
||||
|
||||
this.attachmentLimitTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminGeneral, 'AdminSettingsGeneral', 'General', 'general', true);
|
||||
|
||||
AdminGeneral.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function () {
|
||||
|
||||
var
|
||||
f1 = Utils.settingsSaveHelperSimpleFunction(self.attachmentLimitTrigger, self),
|
||||
f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self),
|
||||
f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self)
|
||||
;
|
||||
|
||||
self.mainAttachmentLimit.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f1, {
|
||||
'AttachmentLimit': Utils.pInt(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.language.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f2, {
|
||||
'Language': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.theme.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f3, {
|
||||
'Theme': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.capaAdditionalAccounts.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'CapaAdditionalAccounts': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaAdditionalIdentities.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'CapaAdditionalIdentities': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaGravatar.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'CapaGravatar': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.capaThemes.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'CapaThemes': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowLanguagesOnSettings.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'AllowLanguagesOnSettings': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
||||
AdminGeneral.prototype.selectLanguage = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsLanguagesViewModel);
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
AdminGeneral.prototype.phpInfoLink = function ()
|
||||
{
|
||||
return RL.link().phpInfo();
|
||||
};
|
||||
|
||||
|
|
@ -1,57 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminLicensing()
|
||||
{
|
||||
this.licensing = RL.data().licensing;
|
||||
this.licensingProcess = RL.data().licensingProcess;
|
||||
this.licenseValid = RL.data().licenseValid;
|
||||
this.licenseExpired = RL.data().licenseExpired;
|
||||
this.licenseError = RL.data().licenseError;
|
||||
this.licenseTrigger = RL.data().licenseTrigger;
|
||||
|
||||
this.adminDomain = ko.observable('');
|
||||
this.subscriptionEnabled = ko.observable(!!RL.settingsGet('SubscriptionEnabled'));
|
||||
|
||||
this.licenseTrigger.subscribe(function () {
|
||||
if (this.subscriptionEnabled())
|
||||
{
|
||||
RL.reloadLicensing(true);
|
||||
}
|
||||
}, this);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminLicensing, 'AdminSettingsLicensing', 'Licensing', 'licensing');
|
||||
|
||||
AdminLicensing.prototype.onBuild = function ()
|
||||
{
|
||||
if (this.subscriptionEnabled())
|
||||
{
|
||||
RL.reloadLicensing(false);
|
||||
}
|
||||
};
|
||||
|
||||
AdminLicensing.prototype.onShow = function ()
|
||||
{
|
||||
this.adminDomain(RL.settingsGet('AdminDomain'));
|
||||
};
|
||||
|
||||
AdminLicensing.prototype.showActivationForm = function ()
|
||||
{
|
||||
kn.showScreenPopup(PopupsActivateViewModel);
|
||||
};
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
AdminLicensing.prototype.licenseExpiredMomentValue = function ()
|
||||
{
|
||||
var
|
||||
iTime = this.licenseExpired(),
|
||||
oDate = moment.unix(iTime)
|
||||
;
|
||||
|
||||
return iTime && 1898625600 === iTime ? 'Never' : (oDate.format('LL') + ' (' + oDate.from(moment()) + ')');
|
||||
};
|
||||
|
|
@ -1,53 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminLogin()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.determineUserLanguage = oData.determineUserLanguage;
|
||||
this.determineUserDomain = oData.determineUserDomain;
|
||||
|
||||
this.defaultDomain = ko.observable(RL.settingsGet('LoginDefaultDomain'));
|
||||
|
||||
this.allowLanguagesOnLogin = oData.allowLanguagesOnLogin;
|
||||
this.defaultDomainTrigger = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminLogin, 'AdminSettingsLogin', 'Login', 'login');
|
||||
|
||||
AdminLogin.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.delay(function () {
|
||||
|
||||
var f1 = Utils.settingsSaveHelperSimpleFunction(self.defaultDomainTrigger, self);
|
||||
|
||||
self.determineUserLanguage.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'DetermineUserLanguage': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.determineUserDomain.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'DetermineUserDomain': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.allowLanguagesOnLogin.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'AllowLanguagesOnLogin': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.defaultDomain.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f1, {
|
||||
'LoginDefaultDomain': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
|
|
@ -1,99 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminPackages()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.packagesError = ko.observable('');
|
||||
|
||||
this.packages = oData.packages;
|
||||
this.packagesLoading = oData.packagesLoading;
|
||||
this.packagesReal = oData.packagesReal;
|
||||
this.packagesMainUpdatable = oData.packagesMainUpdatable;
|
||||
|
||||
this.packagesCurrent = this.packages.filter(function (oItem) {
|
||||
return oItem && '' !== oItem['installed'] && !oItem['compare'];
|
||||
});
|
||||
|
||||
this.packagesAvailableForUpdate = this.packages.filter(function (oItem) {
|
||||
return oItem && '' !== oItem['installed'] && !!oItem['compare'];
|
||||
});
|
||||
|
||||
this.packagesAvailableForInstallation = this.packages.filter(function (oItem) {
|
||||
return oItem && '' === oItem['installed'];
|
||||
});
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return oData.packagesLoading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminPackages, 'AdminSettingsPackages', 'Packages', 'packages');
|
||||
|
||||
AdminPackages.prototype.onShow = function ()
|
||||
{
|
||||
this.packagesError('');
|
||||
};
|
||||
|
||||
AdminPackages.prototype.onBuild = function ()
|
||||
{
|
||||
RL.reloadPackagesList();
|
||||
};
|
||||
|
||||
AdminPackages.prototype.requestHelper = function (oPackage, bInstall)
|
||||
{
|
||||
var self = this;
|
||||
return function (sResult, oData) {
|
||||
|
||||
if (Enums.StorageResultType.Success !== sResult || !oData || !oData.Result)
|
||||
{
|
||||
if (oData && oData.ErrorCode)
|
||||
{
|
||||
self.packagesError(Utils.getNotification(oData.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
self.packagesError(Utils.getNotification(
|
||||
bInstall ? Enums.Notification.CantInstallPackage : Enums.Notification.CantDeletePackage));
|
||||
}
|
||||
}
|
||||
|
||||
_.each(RL.data().packages(), function (oItem) {
|
||||
if (oItem && oPackage && oItem['loading']() && oPackage['file'] === oItem['file'])
|
||||
{
|
||||
oPackage['loading'](false);
|
||||
oItem['loading'](false);
|
||||
}
|
||||
});
|
||||
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result && oData.Result['Reload'])
|
||||
{
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
RL.reloadPackagesList();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
AdminPackages.prototype.deletePackage = function (oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage['loading'](true);
|
||||
RL.remote().packageDelete(this.requestHelper(oPackage, false), oPackage);
|
||||
}
|
||||
};
|
||||
|
||||
AdminPackages.prototype.installPackage = function (oPackage)
|
||||
{
|
||||
if (oPackage)
|
||||
{
|
||||
oPackage['loading'](true);
|
||||
RL.remote().packageInstall(this.requestHelper(oPackage, true), oPackage);
|
||||
}
|
||||
};
|
||||
|
|
@ -1,98 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminPlugins()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.enabledPlugins = ko.observable(!!RL.settingsGet('EnabledPlugins'));
|
||||
|
||||
this.pluginsError = ko.observable('');
|
||||
|
||||
this.plugins = oData.plugins;
|
||||
this.pluginsLoading = oData.pluginsLoading;
|
||||
|
||||
this.visibility = ko.computed(function () {
|
||||
return oData.pluginsLoading() ? 'visible' : 'hidden';
|
||||
}, this);
|
||||
|
||||
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
|
||||
this.onPluginDisableRequest = _.bind(this.onPluginDisableRequest, this);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminPlugins, 'AdminSettingsPlugins', 'Plugins', 'plugins');
|
||||
|
||||
AdminPlugins.prototype.disablePlugin = function (oPlugin)
|
||||
{
|
||||
oPlugin.disabled(!oPlugin.disabled());
|
||||
RL.remote().pluginDisable(this.onPluginDisableRequest, oPlugin.name, oPlugin.disabled());
|
||||
};
|
||||
|
||||
AdminPlugins.prototype.configurePlugin = function (oPlugin)
|
||||
{
|
||||
RL.remote().plugin(this.onPluginLoadRequest, oPlugin.name);
|
||||
};
|
||||
|
||||
AdminPlugins.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) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'EnabledPlugins': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
AdminPlugins.prototype.onShow = function ()
|
||||
{
|
||||
this.pluginsError('');
|
||||
RL.reloadPluginList();
|
||||
};
|
||||
|
||||
AdminPlugins.prototype.onPluginLoadRequest = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
kn.showScreenPopup(PopupsPluginViewModel, [oData.Result]);
|
||||
}
|
||||
};
|
||||
|
||||
AdminPlugins.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)
|
||||
{
|
||||
this.pluginsError(oData.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.pluginsError(Utils.getNotification(oData.ErrorCode));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
RL.reloadPluginList();
|
||||
};
|
||||
|
|
@ -1,114 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSecurity()
|
||||
{
|
||||
this.useLocalProxyForExternalImages = RL.data().useLocalProxyForExternalImages;
|
||||
|
||||
this.capaOpenPGP = ko.observable(RL.capa(Enums.Capa.OpenPGP));
|
||||
this.capaTwoFactorAuth = ko.observable(RL.capa(Enums.Capa.TwoFactor));
|
||||
|
||||
this.adminLogin = ko.observable(RL.settingsGet('AdminLogin'));
|
||||
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.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 (this.adminPasswordNew() !== this.adminPasswordNew2())
|
||||
{
|
||||
this.adminPasswordNewError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
this.adminPasswordUpdateError(false);
|
||||
this.adminPasswordUpdateSuccess(false);
|
||||
|
||||
RL.remote().saveNewAdminPassword(this.onNewAdminPasswordResponse, {
|
||||
'Password': this.adminPassword(),
|
||||
'NewPassword': this.adminPasswordNew()
|
||||
});
|
||||
|
||||
}, function () {
|
||||
return '' !== this.adminPassword() && '' !== this.adminPasswordNew() && '' !== this.adminPasswordNew2();
|
||||
});
|
||||
|
||||
this.onNewAdminPasswordResponse = _.bind(this.onNewAdminPasswordResponse, this);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminSecurity, 'AdminSettingsSecurity', 'Security', 'security');
|
||||
|
||||
AdminSecurity.prototype.onNewAdminPasswordResponse = function (sResult, oData)
|
||||
{
|
||||
if (Enums.StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
|
||||
this.adminPasswordUpdateSuccess(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.adminPasswordUpdateError(true);
|
||||
}
|
||||
};
|
||||
|
||||
AdminSecurity.prototype.onBuild = function ()
|
||||
{
|
||||
this.capaOpenPGP.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'CapaOpenPGP': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.capaTwoFactorAuth.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'CapaTwoFactorAuth': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
this.useLocalProxyForExternalImages.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(null, {
|
||||
'UseLocalProxyForExternalImages': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
AdminSecurity.prototype.onHide = function ()
|
||||
{
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
};
|
||||
|
||||
/**
|
||||
* @return {string}
|
||||
*/
|
||||
AdminSecurity.prototype.phpInfoLink = function ()
|
||||
{
|
||||
return RL.link().phpInfo();
|
||||
};
|
||||
|
|
@ -1,136 +0,0 @@
|
|||
/* RainLoop Webmail (c) RainLoop Team | Licensed under CC BY-NC-SA 3.0 */
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
*/
|
||||
function AdminSocial()
|
||||
{
|
||||
var oData = RL.data();
|
||||
|
||||
this.googleEnable = oData.googleEnable;
|
||||
this.googleClientID = oData.googleClientID;
|
||||
this.googleApiKey = oData.googleApiKey;
|
||||
this.googleClientSecret = oData.googleClientSecret;
|
||||
this.googleTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.googleTrigger3 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.facebookSupported = oData.facebookSupported;
|
||||
this.facebookEnable = oData.facebookEnable;
|
||||
this.facebookAppID = oData.facebookAppID;
|
||||
this.facebookAppSecret = oData.facebookAppSecret;
|
||||
this.facebookTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.facebookTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.twitterEnable = oData.twitterEnable;
|
||||
this.twitterConsumerKey = oData.twitterConsumerKey;
|
||||
this.twitterConsumerSecret = oData.twitterConsumerSecret;
|
||||
this.twitterTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
this.twitterTrigger2 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
|
||||
this.dropboxEnable = oData.dropboxEnable;
|
||||
this.dropboxApiKey = oData.dropboxApiKey;
|
||||
this.dropboxTrigger1 = ko.observable(Enums.SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
Utils.addSettingsViewModel(AdminSocial, 'AdminSettingsSocial', 'Social', 'social');
|
||||
|
||||
AdminSocial.prototype.onBuild = function ()
|
||||
{
|
||||
var self = this;
|
||||
_.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())
|
||||
{
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'FacebookEnable': bValue ? '1' : '0'
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.facebookAppID.subscribe(function (sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
RL.remote().saveAdminConfig(f1, {
|
||||
'FacebookAppID': Utils.trim(sValue)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.facebookAppSecret.subscribe(function (sValue) {
|
||||
if (self.facebookSupported())
|
||||
{
|
||||
RL.remote().saveAdminConfig(f2, {
|
||||
'FacebookAppSecret': Utils.trim(sValue)
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
self.twitterEnable.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'TwitterEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.twitterConsumerKey.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f3, {
|
||||
'TwitterConsumerKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.twitterConsumerSecret.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f4, {
|
||||
'TwitterConsumerSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleEnable.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'GoogleEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientID.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f5, {
|
||||
'GoogleClientID': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleClientSecret.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f6, {
|
||||
'GoogleClientSecret': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.googleApiKey.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f7, {
|
||||
'GoogleApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxEnable.subscribe(function (bValue) {
|
||||
RL.remote().saveAdminConfig(Utils.emptyFunction, {
|
||||
'DropboxEnable': bValue ? '1' : '0'
|
||||
});
|
||||
});
|
||||
|
||||
self.dropboxApiKey.subscribe(function (sValue) {
|
||||
RL.remote().saveAdminConfig(f8, {
|
||||
'DropboxApiKey': Utils.trim(sValue)
|
||||
});
|
||||
});
|
||||
|
||||
}, 50);
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue