From 8890de4a8632604c7279324757a14614a850f65d Mon Sep 17 00:00:00 2001 From: RainLoop Team Date: Sun, 19 Jan 2014 00:49:14 +0400 Subject: [PATCH] Add branding section in admin panel --- Gruntfile.js | 1 + README.md | 38 ++++---- dev/Admin/Branding.js | 70 +++++++++++++++ dev/Admin/General.js | 21 +---- dev/Styles/Login.less | 12 ++- dev/ViewModels/LoginViewModel.js | 4 +- package.json | 4 +- .../0.0.0/app/libraries/RainLoop/Actions.php | 7 ++ .../libraries/RainLoop/Config/Application.php | 6 ++ .../0.0.0/app/templates/Themes/template.less | 5 ++ .../Views/AdminSettingsBranding.html | 56 ++++++++++++ .../templates/Views/AdminSettingsGeneral.html | 26 +----- .../v/0.0.0/app/templates/Views/Login.html | 11 +++ rainloop/v/0.0.0/static/css/app.css | 10 ++- rainloop/v/0.0.0/static/css/app.min.css | 2 +- rainloop/v/0.0.0/static/js/admin.js | 90 ++++++++++++++----- rainloop/v/0.0.0/static/js/admin.min.js | 6 +- rainloop/v/0.0.0/static/js/app.js | 4 +- rainloop/v/0.0.0/static/js/app.min.js | 16 ++-- 19 files changed, 290 insertions(+), 99 deletions(-) create mode 100644 dev/Admin/Branding.js create mode 100644 rainloop/v/0.0.0/app/templates/Views/AdminSettingsBranding.html diff --git a/Gruntfile.js b/Gruntfile.js index 99a29e366..a99cbe815 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -181,6 +181,7 @@ module.exports = function (grunt) { "dev/Admin/General.js", "dev/Admin/Login.js", + "dev/Admin/Branding.js", "dev/Admin/Contacts.js", "dev/Admin/Domains.js", "dev/Admin/Security.js", diff --git a/README.md b/README.md index 8af794f5b..b85c6a4e0 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ -RainLoop Webmail (PHP) -================== - -## About - -Simple, modern & fast web-based email client - -Modest system requirements, decent performance, simple installation and upgrade, no database required - all these make RainLoop Webmail a perfect choice for your email solution. - -For more information about the product, check [http://rainloop.net](http://rainloop.net). - -Information about installing the product, check the [documentation page](http://rainloop.net/docs/installation/). - -## License - -**Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)** -http://creativecommons.org/licenses/by-nc-sa/3.0/ - -Copyright (c) 2013 Rainloop Team \ No newline at end of file +RainLoop Webmail (PHP) +================== + +## About + +Simple, modern & fast web-based email client + +Modest system requirements, decent performance, simple installation and upgrade, no database required - all these make RainLoop Webmail a perfect choice for your email solution. + +For more information about the product, check [http://rainloop.net](http://rainloop.net). + +Information about installing the product, check the [documentation page](http://rainloop.net/docs/installation/). + +## License + +**Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported (CC BY-NC-SA 3.0)** +http://creativecommons.org/licenses/by-nc-sa/3.0/ + +Copyright (c) 2014 Rainloop Team \ No newline at end of file diff --git a/dev/Admin/Branding.js b/dev/Admin/Branding.js new file mode 100644 index 000000000..f3e6323b7 --- /dev/null +++ b/dev/Admin/Branding.js @@ -0,0 +1,70 @@ +/* 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); +}; diff --git a/dev/Admin/General.js b/dev/Admin/General.js index 35fd7a66c..c656ffdcc 100644 --- a/dev/Admin/General.js +++ b/dev/Admin/General.js @@ -19,9 +19,6 @@ function AdminGeneral() this.allowAdditionalAccounts = oData.allowAdditionalAccounts; this.allowIdentities = oData.allowIdentities; - this.title = ko.observable(RL.settingsGet('Title')); - this.loadingDesc = ko.observable(RL.settingsGet('LoadingDescription')); - this.themesOptions = ko.computed(function () { return _.map(oData.themes(), function (sTheme) { return { @@ -37,10 +34,8 @@ function AdminGeneral() this.weakPassword = !!RL.settingsGet('WeakPassword'); - this.titleTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.languageTrigger = ko.observable(Enums.SaveSettingsStep.Idle); this.themeTrigger = ko.observable(Enums.SaveSettingsStep.Idle); - this.loadingDescTrigger = ko.observable(Enums.SaveSettingsStep.Idle); } Utils.addSettingsViewModel(AdminGeneral, 'AdminSettingsGeneral', 'General', 'general', true); @@ -51,24 +46,10 @@ AdminGeneral.prototype.onBuild = function () _.delay(function () { var - f1 = Utils.settingsSaveHelperSimpleFunction(self.titleTrigger, self), f2 = Utils.settingsSaveHelperSimpleFunction(self.languageTrigger, self), - f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self), - f4 = Utils.settingsSaveHelperSimpleFunction(self.loadingDescTrigger, self) + f3 = Utils.settingsSaveHelperSimpleFunction(self.themeTrigger, self) ; - self.title.subscribe(function (sValue) { - RL.remote().saveAdminConfig(f1, { - 'Title': Utils.trim(sValue) - }); - }); - - self.loadingDesc.subscribe(function (sValue) { - RL.remote().saveAdminConfig(f4, { - 'LoadingDescription': Utils.trim(sValue) - }); - }); - self.language.subscribe(function (sValue) { RL.remote().saveAdminConfig(f2, { 'Language': Utils.trim(sValue) diff --git a/dev/Styles/Login.less b/dev/Styles/Login.less index b0d793280..a11ca1c8d 100644 --- a/dev/Styles/Login.less +++ b/dev/Styles/Login.less @@ -17,7 +17,17 @@ display: inline-block; vertical-align: middle; text-align: center; - width: 380px; + /*width: 380px;*/ + + .descWrapper { + + margin-bottom: 10px; + + .desc { + font-size: 18px; + padding: 2px; + } + } .loginForm { background-color: #efefef; diff --git a/dev/ViewModels/LoginViewModel.js b/dev/ViewModels/LoginViewModel.js index 0318564e1..991c5f407 100644 --- a/dev/ViewModels/LoginViewModel.js +++ b/dev/ViewModels/LoginViewModel.js @@ -15,7 +15,9 @@ function LoginViewModel() this.password = ko.observable(''); this.signMe = ko.observable(false); - this.logoMain = ko.observable('RainLoop'); + this.logoImg = Utils.trim(RL.settingsGet('LoginLogo')); + this.loginDescription = Utils.trim(RL.settingsGet('LoginDescription')); + this.logoCss = Utils.trim(RL.settingsGet('LoginCss')); this.emailError = ko.observable(false); this.loginError = ko.observable(false); diff --git a/package.json b/package.json index b3cb833b1..13438a2b8 100644 --- a/package.json +++ b/package.json @@ -1,8 +1,8 @@ { "name": "RainLoop", "title": "RainLoop Webmail", - "version": "1.6.1", - "release": "645", + "version": "1.6.2", + "release": "659", "description": "Simple, modern & fast web-based email client", "homepage": "http://rainloop.net", "main": "Gruntfile.js", diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php index be4b05ebd..22d7bd33a 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -897,6 +897,9 @@ class Actions 'Email' => '', 'Title' => $oConfig->Get('webmail', 'title', ''), 'LoadingDescription' => $oConfig->Get('webmail', 'loading_description', ''), + 'LoginLogo' => $oConfig->Get('branding', 'login_logo', ''), + 'LoginDescription' => $oConfig->Get('branding', 'login_desc', ''), + 'LoginCss' => $oConfig->Get('branding', 'login_css', ''), 'Token' => $oConfig->Get('security', 'csrf_protection', false) ? \RainLoop\Utils::GetCsrfToken() : '', 'InIframe' => (bool) $oConfig->Get('labs', 'in_iframe', false), 'AllowAdminPanel' => (bool) $oConfig->Get('security', 'allow_admin_panel', true), @@ -1949,6 +1952,10 @@ class Actions $this->setConfigFromParams($oConfig, 'Title', 'webmail', 'title', 'string'); $this->setConfigFromParams($oConfig, 'LoadingDescription', 'webmail', 'loading_description', 'string'); + $this->setConfigFromParams($oConfig, 'LoginLogo', 'branding', 'login_logo', 'string'); + $this->setConfigFromParams($oConfig, 'LoginDescription', 'branding', 'login_desc', 'string'); + $this->setConfigFromParams($oConfig, 'LoginCss', 'branding', 'login_css', 'string'); + $this->setConfigFromParams($oConfig, 'TokenProtection', 'security', 'csrf_protection', 'bool'); $this->setConfigFromParams($oConfig, 'EnabledPlugins', 'plugins', 'enable', 'bool'); diff --git a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php index 04b5f7287..3e5c75ac8 100644 --- a/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/rainloop/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -81,6 +81,12 @@ class Application extends \RainLoop\Config\AbstractConfig 0 for unlimited.') ), + 'branding' => array( + 'login_logo' => array(''), + 'login_desc' => array(''), + 'login_css' => array(''), + ), + 'contacts' => array( 'enable' => array(false, 'Enable contacts'), 'allow_sharing' => array(true), diff --git a/rainloop/v/0.0.0/app/templates/Themes/template.less b/rainloop/v/0.0.0/app/templates/Themes/template.less index 38aebbfa6..15d59988b 100644 --- a/rainloop/v/0.0.0/app/templates/Themes/template.less +++ b/rainloop/v/0.0.0/app/templates/Themes/template.less @@ -53,6 +53,11 @@ } } +.thm-login-desc .desc { + color: @loading-color !important; + text-shadow: @loading-text-shadow !important; +} + .thm-login { color: @login-color !important; border: @login-border !important; diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsBranding.html b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsBranding.html new file mode 100644 index 000000000..8de0cb008 --- /dev/null +++ b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsBranding.html @@ -0,0 +1,56 @@ +
+
+
+ Branding +
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
+ Login Screen +
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+ +
+ +
+
+
+
+
\ No newline at end of file diff --git a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html index 164ee3bee..fd1bffc61 100644 --- a/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html +++ b/rainloop/v/0.0.0/app/templates/Views/AdminSettingsGeneral.html @@ -14,9 +14,9 @@ General
-
-
-
- -
- -
-
-
-
- -
- -
-
-