From aabed21b1903d856a98a80d708f9301ec6d19dfb Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Sat, 18 Oct 2014 21:24:00 +0400 Subject: [PATCH] Added additiona setting for google drive integration --- dev/Common/Utils.js | 2 + dev/Settings/Admin/Branding.js | 64 ++++++++++--------- dev/Settings/Admin/Social.js | 14 +++- dev/Storage/AbstractData.js | 2 + dev/Styles/@Main.less | 1 + dev/Styles/AdminBranding.less | 7 ++ dev/Styles/Settings.less | 10 +++ dev/View/Admin/Settings/Pane.js | 4 ++ dev/View/Popup/Compose.js | 1 + dev/View/User/Login.js | 3 +- rainloop/v/0.0.0/app/src/RainLoop/Actions.php | 12 ++++ .../app/src/RainLoop/Config/Application.php | 2 + .../app/templates/Views/Admin/AdminPane.html | 3 + .../Views/Admin/AdminSettingsBranding.html | 19 ++++-- .../Views/Admin/AdminSettingsSocial.html | 21 ++++-- .../templates/Views/User/SettingsMenu.html | 18 ++++-- .../templates/Views/User/SettingsSocial.html | 2 +- 17 files changed, 136 insertions(+), 49 deletions(-) create mode 100644 dev/Styles/AdminBranding.less diff --git a/dev/Common/Utils.js b/dev/Common/Utils.js index 7ceefbdf3..8a2d92dcc 100644 --- a/dev/Common/Utils.js +++ b/dev/Common/Utils.js @@ -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(''); diff --git a/dev/Settings/Admin/Branding.js b/dev/Settings/Admin/Branding.js index 1956c0dce..87c822fef 100644 --- a/dev/Settings/Admin/Branding.js +++ b/dev/Settings/Admin/Branding.js @@ -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; diff --git a/dev/Settings/Admin/Social.js b/dev/Settings/Admin/Social.js index 8336a1547..3e0041665 100644 --- a/dev/Settings/Admin/Social.js +++ b/dev/Settings/Admin/Social.js @@ -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) diff --git a/dev/Storage/AbstractData.js b/dev/Storage/AbstractData.js index cb965ef0e..de48c1f36 100644 --- a/dev/Storage/AbstractData.js +++ b/dev/Storage/AbstractData.js @@ -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')); diff --git a/dev/Styles/@Main.less b/dev/Styles/@Main.less index 3080d2587..c802056c7 100644 --- a/dev/Styles/@Main.less +++ b/dev/Styles/@Main.less @@ -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"; diff --git a/dev/Styles/AdminBranding.less b/dev/Styles/AdminBranding.less new file mode 100644 index 000000000..cb8c82964 --- /dev/null +++ b/dev/Styles/AdminBranding.less @@ -0,0 +1,7 @@ + +.b-admin-branding { + .disabled-form { + opacity: 0.5; + } +} + diff --git a/dev/Styles/Settings.less b/dev/Styles/Settings.less index 238340f6d..574d65596 100644 --- a/dev/Styles/Settings.less +++ b/dev/Styles/Settings.less @@ -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; diff --git a/dev/View/Admin/Settings/Pane.js b/dev/View/Admin/Settings/Pane.js index 4400574b8..b7e058cbd 100644 --- a/dev/View/Admin/Settings/Pane.js +++ b/dev/View/Admin/Settings/Pane.js @@ -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); } diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index c37741c81..f26a8cda8 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -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); diff --git a/dev/View/User/Login.js b/dev/View/User/Login.js index 0420568cb..467ffa46c 100644 --- a/dev/View/User/Login.js +++ b/dev/View/User/Login.js @@ -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()) { diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Actions.php b/rainloop/v/0.0.0/app/src/RainLoop/Actions.php index 284be4f76..d3a533a77 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Actions.php @@ -1102,12 +1102,17 @@ class Actions } $aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); + $aResult['AllowGoogleSocialAuth'] = (bool) $oConfig->Get('social', 'google_enable_auth', true); + $aResult['AllowGoogleSocialDrive'] = (bool) $oConfig->Get('social', 'google_enable_drive', true); + $aResult['GoogleClientID'] = \trim($oConfig->Get('social', 'google_client_id', '')); $aResult['GoogleApiKey'] = \trim($oConfig->Get('social', 'google_api_key', '')); if ($aResult['AllowGoogleSocial'] && ( '' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', '')))) { $aResult['AllowGoogleSocial'] = false; + $aResult['AllowGoogleSocialAuth'] = false; + $aResult['AllowGoogleSocialDrive'] = false; $aResult['GoogleClientID'] = ''; $aResult['GoogleApiKey'] = ''; } @@ -1165,6 +1170,9 @@ class Actions $aResult['ContactsPdoPassword'] = APP_DUMMY; $aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); + $aResult['AllowGoogleSocialAuth'] = (bool) $oConfig->Get('social', 'google_enable_auth', true); + $aResult['AllowGoogleSocialDrive'] = (bool) $oConfig->Get('social', 'google_enable_drive', true); + $aResult['GoogleClientID'] = (string) $oConfig->Get('social', 'google_client_id', ''); $aResult['GoogleClientSecret'] = (string) $oConfig->Get('social', 'google_client_secret', ''); $aResult['GoogleApiKey'] = (string) $oConfig->Get('social', 'google_api_key', ''); @@ -1280,6 +1288,8 @@ class Actions if (0 < \strlen($aResult['ParentEmail'])) { $aResult['AllowGoogleSocial'] = false; + $aResult['AllowGoogleSocialAuth'] = false; + $aResult['AllowGoogleSocialDrive'] = false; $aResult['AllowFacebookSocial'] = false; $aResult['AllowTwitterSocial'] = false; } @@ -2456,6 +2466,8 @@ class Actions $this->setConfigFromParams($oConfig, 'EnabledPlugins', 'plugins', 'enable', 'bool'); $this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_enable', 'bool'); + $this->setConfigFromParams($oConfig, 'GoogleEnableAuth', 'social', 'google_enable_auth', 'bool'); + $this->setConfigFromParams($oConfig, 'GoogleEnableDrive', 'social', 'google_enable_drive', 'bool'); $this->setConfigFromParams($oConfig, 'GoogleClientID', 'social', 'google_client_id', 'string'); $this->setConfigFromParams($oConfig, 'GoogleClientSecret', 'social', 'google_client_secret', 'string'); $this->setConfigFromParams($oConfig, 'GoogleApiKey', 'social', 'google_api_key', 'string'); diff --git a/rainloop/v/0.0.0/app/src/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/src/RainLoop/Config/Application.php index 6543878b8..1a3ef123f 100644 --- a/rainloop/v/0.0.0/app/src/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/src/RainLoop/Config/Application.php @@ -188,6 +188,8 @@ Examples: 'social' => array( 'google_enable' => array(false, 'Google'), + 'google_enable_auth' => array(true), + 'google_enable_drive' => array(true), 'google_client_id' => array(''), 'google_client_secret' => array(''), 'google_api_key' => array(''), diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminPane.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminPane.html index 0fedceb0f..7bcb54da6 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminPane.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminPane.html @@ -4,6 +4,9 @@

   + RainLoop + (Premium) + — Admin Panel    () diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html index cd7945885..52048a95d 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsBranding.html @@ -1,5 +1,12 @@
-
+
+
+

Premium version only

+
+ Licensing +
+
+
Branding
@@ -9,7 +16,7 @@
+ data-bind="value: title, saveTrigger: title.trigger, enable: capa" />
@@ -19,7 +26,7 @@
+ data-bind="value: loadingDesc, saveTrigger: loadingDesc.trigger, enable: capa" />
@@ -33,7 +40,7 @@
+ placeholder="https://" data-bind="value: loginLogo, saveTrigger: loginLogo.trigger, enable: capa" />
@@ -43,7 +50,7 @@
+ data-bind="value: loginDescription, saveTrigger: loginDescription.trigger, enable: capa" />
@@ -52,7 +59,7 @@ Custom CSS
- +
diff --git a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html index 1bfd44b8b..4ea590e2d 100644 --- a/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html +++ b/rainloop/v/0.0.0/app/templates/Views/Admin/AdminSettingsSocial.html @@ -15,6 +15,19 @@ Enable Google Integration +
+
+
+ + +
+
@@ -44,7 +57,7 @@
+ data-bind="value: googleApiKey, saveTrigger: googleTrigger3, enable: googleEnable.drive" />

@@ -62,7 +75,7 @@

@@ -94,7 +107,7 @@
@@ -125,7 +138,7 @@
diff --git a/rainloop/v/0.0.0/app/templates/Views/User/SettingsMenu.html b/rainloop/v/0.0.0/app/templates/Views/User/SettingsMenu.html index 30a5bcaba..59f6b9784 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/SettingsMenu.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/SettingsMenu.html @@ -1,11 +1,4 @@
-
-
- - - -
-
@@ -21,4 +14,15 @@
+
\ No newline at end of file diff --git a/rainloop/v/0.0.0/app/templates/Views/User/SettingsSocial.html b/rainloop/v/0.0.0/app/templates/Views/User/SettingsSocial.html index 613c9444e..67b489e75 100644 --- a/rainloop/v/0.0.0/app/templates/Views/User/SettingsSocial.html +++ b/rainloop/v/0.0.0/app/templates/Views/User/SettingsSocial.html @@ -1,5 +1,5 @@
-
+