Added additiona setting for google drive integration

This commit is contained in:
RainLoop Team 2014-10-18 21:24:00 +04:00
parent 430d36a648
commit aabed21b19
17 changed files with 136 additions and 49 deletions

View file

@ -1082,6 +1082,8 @@
oData.twitterConsumerSecret = ko.observable('');
oData.googleEnable = ko.observable(false);
oData.googleEnable.auth = ko.observable(false);
oData.googleEnable.drive = ko.observable(false);
oData.googleClientID = ko.observable('');
oData.googleClientSecret = ko.observable('');
oData.googleApiKey = ko.observable('');

View file

@ -20,6 +20,9 @@
Settings = require('Storage/Settings')
;
this.capa = !!Settings.capa(Enums.Capa.Prem);
this.capa = true;
this.title = ko.observable(Settings.settingsGet('Title'));
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
@ -43,47 +46,50 @@
Remote = require('Storage/Admin/Remote')
;
_.delay(function () {
if (this.capa)
{
_.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)
;
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.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.loginLogo.subscribe(function (sValue) {
Remote.saveAdminConfig(f3, {
'LoginLogo': 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.loginDescription.subscribe(function (sValue) {
Remote.saveAdminConfig(f4, {
'LoginDescription': Utils.trim(sValue)
});
});
});
self.loginCss.subscribe(function (sValue) {
Remote.saveAdminConfig(f5, {
'LoginCss': Utils.trim(sValue)
self.loginCss.subscribe(function (sValue) {
Remote.saveAdminConfig(f5, {
'LoginCss': Utils.trim(sValue)
});
});
});
}, 50);
}, 50);
}
};
module.exports = BrandingAdminSetting;

View file

@ -22,7 +22,7 @@
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);
@ -116,6 +116,18 @@
});
});
self.googleEnable.auth.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnableAuth': bValue ? '1' : '0'
});
});
self.googleEnable.drive.subscribe(function (bValue) {
Remote.saveAdminConfig(Utils.emptyFunction, {
'GoogleEnableDrive': bValue ? '1' : '0'
});
});
self.googleClientID.subscribe(function (sValue) {
Remote.saveAdminConfig(f5, {
'GoogleClientID': Utils.trim(sValue)

View file

@ -80,6 +80,8 @@
this.twitterConsumerSecret(Settings.settingsGet('TwitterConsumerSecret'));
this.googleEnable(!!Settings.settingsGet('AllowGoogleSocial'));
this.googleEnable.auth(!!Settings.settingsGet('AllowGoogleSocialAuth'));
this.googleEnable.drive(!!Settings.settingsGet('AllowGoogleSocialDrive'));
this.googleClientID(Settings.settingsGet('GoogleClientID'));
this.googleClientSecret(Settings.settingsGet('GoogleClientSecret'));
this.googleApiKey(Settings.settingsGet('GoogleApiKey'));

View file

@ -73,6 +73,7 @@
@import "Compose.less";
@import "Admin.less";
@import "AdminGeneral.less";
@import "AdminBranding.less";
@import "AdminDomains.less";
@import "AdminDomain.less";
@import "AdminPackages.less";

View file

@ -0,0 +1,7 @@
.b-admin-branding {
.disabled-form {
opacity: 0.5;
}
}

View file

@ -10,6 +10,16 @@
padding: 8px 0 0 @rlLowMargin;
}
.b-footer {
position: absolute;
bottom: 20px;
right: 0;
left: 0;
height: 20px;
padding: 0 10px 0 5px;
z-index: 101;
}
.b-content {
position: absolute;
top: 50px + @rlLowMargin + 10px;

View file

@ -7,6 +7,8 @@
_ = require('_'),
ko = require('ko'),
Enums = require('Common/Enums'),
Settings = require('Storage/Settings'),
Data = require('Storage/Admin/Data'),
Remote = require('Storage/Admin/Remote'),
@ -27,6 +29,8 @@
this.version = ko.observable(Settings.settingsGet('Version'));
this.adminManLoadingVisibility = Data.adminManLoadingVisibility;
this.capa = !!Settings.capa(Enums.Capa.Prem);
this.capa = false;
kn.constructorEnd(this);
}

View file

@ -378,6 +378,7 @@
});
this.driveEnabled = ko.observable(Globals.bXMLHttpRequestSupported &&
!!Settings.settingsGet('AllowGoogleSocial') && !!Settings.settingsGet('AllowGoogleSocialDrive') &&
!!Settings.settingsGet('GoogleClientID') && !!Settings.settingsGet('GoogleApiKey'));
this.driveVisible = ko.observable(false);

View file

@ -286,7 +286,8 @@
this.facebookLoginEnabled(!!Settings.settingsGet('AllowFacebookSocial'));
this.twitterLoginEnabled(!!Settings.settingsGet('AllowTwitterSocial'));
this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial'));
this.googleLoginEnabled(!!Settings.settingsGet('AllowGoogleSocial') &&
!!Settings.settingsGet('AllowGoogleSocialAuth'));
switch ((Settings.settingsGet('SignMe') || 'unused').toLowerCase())
{