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())
{

View file

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

View file

@ -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(''),

View file

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

View file

@ -1,5 +1,12 @@
<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">
Branding
</div>
@ -9,7 +16,7 @@
</label>
<div class="controls">
<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>
</div>
@ -19,7 +26,7 @@
</label>
<div class="controls">
<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>
</div>
@ -33,7 +40,7 @@
</label>
<div class="controls">
<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>
</div>
@ -43,7 +50,7 @@
</label>
<div class="controls">
<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>
</div>
@ -52,7 +59,7 @@
Custom CSS
</label>
<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>
</div>

View file

@ -15,6 +15,19 @@
<i data-bind="css: googleEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Google Integration
</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 class="control-group">
@ -44,7 +57,7 @@
</label>
<div class="controls">
<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>
<blockquote style="margin-top: 10px; margin-bottom: 0">
<p class="muted">
@ -62,7 +75,7 @@
<div class="controls">
<label data-bind="click: function () { facebookEnable(!facebookEnable()); }">
<i data-bind="css: facebookEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Facebook Integration
Enable Facebook Integration (Authentication)
</label>
</div>
</div>
@ -94,7 +107,7 @@
<div class="controls">
<label data-bind="click: function () { twitterEnable(!twitterEnable()); }">
<i data-bind="css: twitterEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Twitter Integration
Enable Twitter Integration (Authentication)
</label>
</div>
</div>
@ -125,7 +138,7 @@
<div class="controls">
<label data-bind="click: function () { dropboxEnable(!dropboxEnable()); }">
<i data-bind="css: dropboxEnable() ? 'icon-checkbox-checked' : 'icon-checkbox-unchecked'"></i>
Enable Dropbox Integration
Enable Dropbox Integration (Compose attachments)
</label>
</div>
</div>

View file

@ -1,11 +1,4 @@
<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-settings-menu" data-bind="foreach: menu">
<!-- ko if: disabled -->
@ -21,4 +14,15 @@
</div>
</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>

View file

@ -1,5 +1,5 @@
<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">
<span class="i18n" data-i18n-text="SETTINGS_SOCIAL/LEGEND_GOOGLE"></span>
</div>