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.twitterConsumerSecret = ko.observable('');
oData.googleEnable = ko.observable(false); oData.googleEnable = ko.observable(false);
oData.googleEnable.auth = ko.observable(false);
oData.googleEnable.drive = ko.observable(false);
oData.googleClientID = ko.observable(''); oData.googleClientID = ko.observable('');
oData.googleClientSecret = ko.observable(''); oData.googleClientSecret = ko.observable('');
oData.googleApiKey = ko.observable(''); oData.googleApiKey = ko.observable('');

View file

@ -20,6 +20,9 @@
Settings = require('Storage/Settings') Settings = require('Storage/Settings')
; ;
this.capa = !!Settings.capa(Enums.Capa.Prem);
this.capa = true;
this.title = ko.observable(Settings.settingsGet('Title')); this.title = ko.observable(Settings.settingsGet('Title'));
this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle); this.title.trigger = ko.observable(Enums.SaveSettingsStep.Idle);
@ -43,6 +46,8 @@
Remote = require('Storage/Admin/Remote') Remote = require('Storage/Admin/Remote')
; ;
if (this.capa)
{
_.delay(function () { _.delay(function () {
var var
@ -84,6 +89,7 @@
}); });
}, 50); }, 50);
}
}; };
module.exports = BrandingAdminSetting; module.exports = BrandingAdminSetting;

View file

@ -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) { self.googleClientID.subscribe(function (sValue) {
Remote.saveAdminConfig(f5, { Remote.saveAdminConfig(f5, {
'GoogleClientID': Utils.trim(sValue) 'GoogleClientID': Utils.trim(sValue)

View file

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

View file

@ -73,6 +73,7 @@
@import "Compose.less"; @import "Compose.less";
@import "Admin.less"; @import "Admin.less";
@import "AdminGeneral.less"; @import "AdminGeneral.less";
@import "AdminBranding.less";
@import "AdminDomains.less"; @import "AdminDomains.less";
@import "AdminDomain.less"; @import "AdminDomain.less";
@import "AdminPackages.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; 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 { .b-content {
position: absolute; position: absolute;
top: 50px + @rlLowMargin + 10px; top: 50px + @rlLowMargin + 10px;

View file

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

View file

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

View file

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

View file

@ -1102,12 +1102,17 @@ class Actions
} }
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); $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['GoogleClientID'] = \trim($oConfig->Get('social', 'google_client_id', ''));
$aResult['GoogleApiKey'] = \trim($oConfig->Get('social', 'google_api_key', '')); $aResult['GoogleApiKey'] = \trim($oConfig->Get('social', 'google_api_key', ''));
if ($aResult['AllowGoogleSocial'] && ( if ($aResult['AllowGoogleSocial'] && (
'' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', '')))) '' === \trim($oConfig->Get('social', 'google_client_id', '')) || '' === \trim($oConfig->Get('social', 'google_client_secret', ''))))
{ {
$aResult['AllowGoogleSocial'] = false; $aResult['AllowGoogleSocial'] = false;
$aResult['AllowGoogleSocialAuth'] = false;
$aResult['AllowGoogleSocialDrive'] = false;
$aResult['GoogleClientID'] = ''; $aResult['GoogleClientID'] = '';
$aResult['GoogleApiKey'] = ''; $aResult['GoogleApiKey'] = '';
} }
@ -1165,6 +1170,9 @@ class Actions
$aResult['ContactsPdoPassword'] = APP_DUMMY; $aResult['ContactsPdoPassword'] = APP_DUMMY;
$aResult['AllowGoogleSocial'] = (bool) $oConfig->Get('social', 'google_enable', false); $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['GoogleClientID'] = (string) $oConfig->Get('social', 'google_client_id', '');
$aResult['GoogleClientSecret'] = (string) $oConfig->Get('social', 'google_client_secret', ''); $aResult['GoogleClientSecret'] = (string) $oConfig->Get('social', 'google_client_secret', '');
$aResult['GoogleApiKey'] = (string) $oConfig->Get('social', 'google_api_key', ''); $aResult['GoogleApiKey'] = (string) $oConfig->Get('social', 'google_api_key', '');
@ -1280,6 +1288,8 @@ class Actions
if (0 < \strlen($aResult['ParentEmail'])) if (0 < \strlen($aResult['ParentEmail']))
{ {
$aResult['AllowGoogleSocial'] = false; $aResult['AllowGoogleSocial'] = false;
$aResult['AllowGoogleSocialAuth'] = false;
$aResult['AllowGoogleSocialDrive'] = false;
$aResult['AllowFacebookSocial'] = false; $aResult['AllowFacebookSocial'] = false;
$aResult['AllowTwitterSocial'] = false; $aResult['AllowTwitterSocial'] = false;
} }
@ -2456,6 +2466,8 @@ class Actions
$this->setConfigFromParams($oConfig, 'EnabledPlugins', 'plugins', 'enable', 'bool'); $this->setConfigFromParams($oConfig, 'EnabledPlugins', 'plugins', 'enable', 'bool');
$this->setConfigFromParams($oConfig, 'GoogleEnable', 'social', 'google_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, 'GoogleClientID', 'social', 'google_client_id', 'string');
$this->setConfigFromParams($oConfig, 'GoogleClientSecret', 'social', 'google_client_secret', 'string'); $this->setConfigFromParams($oConfig, 'GoogleClientSecret', 'social', 'google_client_secret', 'string');
$this->setConfigFromParams($oConfig, 'GoogleApiKey', 'social', 'google_api_key', 'string'); $this->setConfigFromParams($oConfig, 'GoogleApiKey', 'social', 'google_api_key', 'string');

View file

@ -188,6 +188,8 @@ Examples:
'social' => array( 'social' => array(
'google_enable' => array(false, 'Google'), 'google_enable' => array(false, 'Google'),
'google_enable_auth' => array(true),
'google_enable_drive' => array(true),
'google_client_id' => array(''), 'google_client_id' => array(''),
'google_client_secret' => array(''), 'google_client_secret' => array(''),
'google_api_key' => array(''), 'google_api_key' => array(''),

View file

@ -4,6 +4,9 @@
<h4 class="pull-left"> <h4 class="pull-left">
<i class="icon-spinner animated" style="margin-top: 2px" data-bind="style: {'visibility': adminManLoadingVisibility }"></i> <i class="icon-spinner animated" style="margin-top: 2px" data-bind="style: {'visibility': adminManLoadingVisibility }"></i>
&nbsp;&nbsp; &nbsp;&nbsp;
RainLoop
<span data-bind="visible: capa">(Premium)</span>
&mdash;
Admin Panel Admin Panel
&nbsp;&nbsp; &nbsp;&nbsp;
(<span data-bind="text: adminDomain"></span>) (<span data-bind="text: adminDomain"></span>)

View file

@ -1,5 +1,12 @@
<div class="b-admin-branding"> <div class="b-admin-branding">
<div class="form-horizontal"> <div class="row" data-bind="visible: !capa">
<div class="alert alert-error span8" style="margin-top: 10px;">
<h4>Premium version only</h4>
<br />
<strong><a href="#/licensing">Licensing</a></strong>
</div>
</div>
<div class="form-horizontal" data-bind="css: {'disabled-form': !capa}">
<div class="legend"> <div class="legend">
Branding Branding
</div> </div>
@ -9,7 +16,7 @@
</label> </label>
<div class="controls"> <div class="controls">
<input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: title, saveTrigger: title.trigger" /> data-bind="value: title, saveTrigger: title.trigger, enable: capa" />
<div data-bind="saveTrigger: title.trigger"></div> <div data-bind="saveTrigger: title.trigger"></div>
</div> </div>
</div> </div>
@ -19,7 +26,7 @@
</label> </label>
<div class="controls"> <div class="controls">
<input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: loadingDesc, saveTrigger: loadingDesc.trigger" /> data-bind="value: loadingDesc, saveTrigger: loadingDesc.trigger, enable: capa" />
<div data-bind="saveTrigger: loadingDesc.trigger"></div> <div data-bind="saveTrigger: loadingDesc.trigger"></div>
</div> </div>
</div> </div>
@ -33,7 +40,7 @@
</label> </label>
<div class="controls"> <div class="controls">
<input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
placeholder="https://" data-bind="value: loginLogo, saveTrigger: loginLogo.trigger" /> placeholder="https://" data-bind="value: loginLogo, saveTrigger: loginLogo.trigger, enable: capa" />
<div data-bind="saveTrigger: loginLogo.trigger"></div> <div data-bind="saveTrigger: loginLogo.trigger"></div>
</div> </div>
</div> </div>
@ -43,7 +50,7 @@
</label> </label>
<div class="controls"> <div class="controls">
<input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: loginDescription, saveTrigger: loginDescription.trigger" /> data-bind="value: loginDescription, saveTrigger: loginDescription.trigger, enable: capa" />
<div data-bind="saveTrigger: loginDescription.trigger"></div> <div data-bind="saveTrigger: loginDescription.trigger"></div>
</div> </div>
</div> </div>
@ -52,7 +59,7 @@
Custom CSS Custom CSS
</label> </label>
<div class="controls"> <div class="controls">
<textarea class="input-xxlarge" data-bind="value: loginCss, saveTrigger: loginCss.trigger" rows="7" spellcheck="true"></textarea> <textarea class="input-xxlarge" data-bind="value: loginCss, saveTrigger: loginCss.trigger, enable: capa" rows="7" spellcheck="true"></textarea>
<div style="vertical-align: top;" data-bind="saveTrigger: loginCss.trigger"></div> <div style="vertical-align: top;" data-bind="saveTrigger: loginCss.trigger"></div>
</div> </div>
</div> </div>

View file

@ -15,6 +15,19 @@
<i data-bind="css: googleEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i> <i data-bind="css: googleEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Google Integration Enable Google Integration
</label> </label>
<div data-bind="visible: googleEnable">
<br />
<blockquote>
<label data-bind="click: function () { googleEnable.auth(!googleEnable.auth()); }">
<i data-bind="css: googleEnable.auth() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Authentication
</label>
<label data-bind="click: function () { googleEnable.drive(!googleEnable.drive()); }" style="margin-top: 5px">
<i data-bind="css: googleEnable.drive() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Google Drive Integration (Compose view)
</label>
</blockquote>
</div>
</div> </div>
</div> </div>
<div class="control-group"> <div class="control-group">
@ -44,7 +57,7 @@
</label> </label>
<div class="controls"> <div class="controls">
<input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span5" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="value: googleApiKey, saveTrigger: googleTrigger3" /> data-bind="value: googleApiKey, saveTrigger: googleTrigger3, enable: googleEnable.drive" />
<div data-bind="saveTrigger: googleTrigger3"></div> <div data-bind="saveTrigger: googleTrigger3"></div>
<blockquote style="margin-top: 10px; margin-bottom: 0"> <blockquote style="margin-top: 10px; margin-bottom: 0">
<p class="muted"> <p class="muted">
@ -62,7 +75,7 @@
<div class="controls"> <div class="controls">
<label data-bind="click: function () { facebookEnable(!facebookEnable()); }"> <label data-bind="click: function () { facebookEnable(!facebookEnable()); }">
<i data-bind="css: facebookEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i> <i data-bind="css: facebookEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Facebook Integration Enable Facebook Integration (Authentication)
</label> </label>
</div> </div>
</div> </div>
@ -94,7 +107,7 @@
<div class="controls"> <div class="controls">
<label data-bind="click: function () { twitterEnable(!twitterEnable()); }"> <label data-bind="click: function () { twitterEnable(!twitterEnable()); }">
<i data-bind="css: twitterEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i> <i data-bind="css: twitterEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Twitter Integration Enable Twitter Integration (Authentication)
</label> </label>
</div> </div>
</div> </div>
@ -125,7 +138,7 @@
<div class="controls"> <div class="controls">
<label data-bind="click: function () { dropboxEnable(!dropboxEnable()); }"> <label data-bind="click: function () { dropboxEnable(!dropboxEnable()); }">
<i data-bind="css: dropboxEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i> <i data-bind="css: dropboxEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Dropbox Integration Enable Dropbox Integration (Compose attachments)
</label> </label>
</div> </div>
</div> </div>

View file

@ -1,11 +1,4 @@
<div class="b-settins-left g-ui-user-select-none"> <div class="b-settins-left g-ui-user-select-none">
<div class="b-toolbar">
<div class="btn-group">
<a class="btn buttonResize" data-bind="click: function () { leftPanelDisabled(!leftPanelDisabled()); }">
<i data-bind="css: {'icon-resize-out': leftPanelDisabled(), 'icon-resize-in': !leftPanelDisabled()}"></i>
</a>
</div>
</div>
<div class="b-content thm-settings-menu opacity-on-panel-disabled"> <div class="b-content thm-settings-menu opacity-on-panel-disabled">
<div class="b-settings-menu" data-bind="foreach: menu"> <div class="b-settings-menu" data-bind="foreach: menu">
<!-- ko if: disabled --> <!-- ko if: disabled -->
@ -21,4 +14,15 @@
</div> </div>
</div> </div>
<div class="b-content show-on-panel-disabled" data-bind="click: function () { leftPanelDisabled(false); }"></div> <div class="b-content show-on-panel-disabled" data-bind="click: function () { leftPanelDisabled(false); }"></div>
<div class="b-footer">
<nobr>
<div class="btn-toolbar">
<div class="btn-group">
<a class="btn buttonResize" data-bind="click: function () { leftPanelDisabled(!leftPanelDisabled()); }">
<i data-bind="css: {'icon-resize-out': leftPanelDisabled(), 'icon-resize-in': !leftPanelDisabled()}"></i>
</a>
</div>
</div>
</nobr>
</div>
</div> </div>

View file

@ -1,5 +1,5 @@
<div class="b-settings-social g-ui-user-select-none"> <div class="b-settings-social g-ui-user-select-none">
<div class="form-horizontal" data-bind="visible: googleEnable"> <div class="form-horizontal" data-bind="visible: googleEnable() && googleEnable.auth()">
<div class="legend"> <div class="legend">
<span class="i18n" data-i18n-text="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span> <span class="i18n" data-i18n-text="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div> </div>