From: fabrixxm Date: Wed, 17 Jan 2018 15:33:27 +0000 (+0100) Subject: Frio: add login background color admin option X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=fc8e8feec1a4aeb050bfa8eecb43c658e80a92e3;p=friendica.git Frio: add login background color admin option --- diff --git a/mod/home.php b/mod/home.php index f3138d1867..733f612bd0 100644 --- a/mod/home.php +++ b/mod/home.php @@ -34,8 +34,8 @@ function home_content(App $a) { $customhome = False; $defaultheader = '

'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'

'; - $homefilepath = $a->basepath . '/home.html'; - $cssfilepath = $a->basepath . '/home.css'; + $homefilepath = $a->basepath . "/home.html"; + $cssfilepath = $a->basepath . "/home.css"; if (file_exists($homefilepath)) { $customhome = $homefilepath; if (file_exists($cssfilepath)) { diff --git a/view/theme/frio/config.php b/view/theme/frio/config.php index 091ce01326..4e474de5d5 100644 --- a/view/theme/frio/config.php +++ b/view/theme/frio/config.php @@ -40,6 +40,7 @@ function theme_admin_post(App $a) { Config::set('frio', 'background_image', $_POST["frio_background_image"]); Config::set('frio', 'bg_image_option', $_POST["frio_bg_image_option"]); Config::set('frio', 'login_bg_image', $_POST["frio_login_bg_image"]); + Config::set('frio', 'login_bg_color', $_POST["frio_login_bg_color"]); Config::set('frio', 'css_modified', time()); } } @@ -77,6 +78,7 @@ function theme_admin(App $a) { $arr["background_image"] = Config::get('frio', 'background_image'); $arr["bg_image_option"] = Config::get('frio', 'bg_image_option'); $arr["login_bg_image"] = Config::get('frio', 'login_bg_image'); + $arr["login_bg_color"] = Config::get('frio', 'login_bg_color'); return frio_form($arr); } @@ -123,6 +125,10 @@ function frio_form($arr) { if ( array_key_exists("login_bg_image", $arr ) && !array_key_exists("login_bg_image", $disable ) ) { $ctx['$login_bg_image'] = ['frio_login_bg_image', t('Login page background image'), $arr['login_bg_image'], $background_image_help]; } + if ( array_key_exists("login_bg_color", $arr ) && !array_key_exists("login_bg_color", $disable ) ) { + $ctx['$login_bg_color'] = ['frio_login_bg_color', t('Login page background color'), $arr['login_bg_color'], t('Leave background image and color empty for theme defaults')]; + } + $o .= replace_macros($t, $ctx); diff --git a/view/theme/frio/css/style.css b/view/theme/frio/css/style.css index f6f6ad9ded..9aa6913e4d 100644 --- a/view/theme/frio/css/style.css +++ b/view/theme/frio/css/style.css @@ -3018,6 +3018,7 @@ section .profile-match-wrapper { .mod-home.is-not-singleuser, .mod-login { + background-color: $login_bg_color; background-image: linear-gradient(to right, rgba(0,0,0, 0.7) , rgba(0,0,0, 0.4)), url($login_bg_image); background-size: cover; background-attachment: fixed; @@ -3034,29 +3035,29 @@ section .profile-match-wrapper { } .mod-home.is-not-singleuser .login-content, .mod-login .login-content { - color: #eee; - margin-top: 2.5%; + color: #eee; + margin-top: 2.5%; } .mod-home.is-not-singleuser .login-form > #login-form label, .mod-login #content #login-form label { - color: #eee; + color: #eee; } .mod-home.is-not-singleuser .login-panel-content, .mod-login .login-panel-content { - background-color: rgba(255,255,255,.85); + background-color: rgba(255,255,255,.85); } /* Medium devices (desktops, 992px and up) */ @media (min-width: 992px) { - .mod-home.is-not-singleuser #content, + .mod-home.is-not-singleuser #content, .mod-login #content { - margin-top: 100px!important; - } + margin-top: 100px!important; + } - .mod-home.is-not-singleuser .login-form > #login-form, + .mod-home.is-not-singleuser .login-form > #login-form, .mod-login #content #login-form { background-color: #fff; padding: 1em; @@ -3064,10 +3065,10 @@ section .profile-match-wrapper { margin-top: 4em; } - .mod-home.is-not-singleuser .login-form > #login-form label, - .mod-login #content #login-form label { - color: #444; - } + .mod-home.is-not-singleuser .login-form > #login-form label, + .mod-login #content #login-form label { + color: #444; + } .mod-home.is-not-singleuser .login-form > #login-form::before, .mod-login #content #login-form::before { @@ -3093,7 +3094,7 @@ section .profile-match-wrapper { top: -10%; left: 10%; z-index: -1; - } + } } diff --git a/view/theme/frio/style.php b/view/theme/frio/style.php index 8452877b3e..044f2ab61c 100644 --- a/view/theme/frio/style.php +++ b/view/theme/frio/style.php @@ -47,6 +47,7 @@ if ($a->module !== 'install') { $background_image = Config::get("frio", "background_image"); $bg_image_option = Config::get("frio", "bg_image_option"); $login_bg_image = Config::get("frio", "login_bg_image"); + $login_bg_color = Config::get("frio", "login_bg_color"); $modified = Config::get("frio", "css_modified"); // There is maybe the case that the user did never modify the theme settings. @@ -101,9 +102,16 @@ $link_color = (empty($link_color) ? "#6fdbe8" : $link_color); $bgcolor = (empty($bgcolor) ? "#ededed" : $bgcolor); // The background image can not be empty. So we use a dummy jpg if no image was set. $background_image = (empty($background_image) ? 'img/none.jpg' : $background_image); -$login_bg_image = (empty($login_bg_image) ? 'img/login_bg.jpg' : $login_bg_image); $modified = (empty($modified) ? time() :$modified); + +// set a default login bg image if no custom image and no custom bg color are set. +if (empty($login_bg_image) && empty($login_bg_color)) { + $login_bg_image = (empty($login_bg_image) ? 'img/login_bg.jpg' : $login_bg_image); +} +$login_bg_color = (empty($login_bg_color) ? "#ededed" : $login_bg_color); + + $contentbg_transp = ((isset($contentbg_transp) && $contentbg_transp != "") ? $contentbg_transp : 100); // Calculate some colors in dependance of existing colors. @@ -181,6 +189,7 @@ $options = [ '$background_image' => $background_image, '$background_size_img' => $background_size_img, '$login_bg_image' => $login_bg_image, + '$login_bg_color' => $login_bg_color ]; $css_tpl = file_get_contents('view/theme/frio/css/style.css'); diff --git a/view/theme/frio/templates/theme_settings.tpl b/view/theme/frio/templates/theme_settings.tpl index 38311f27ba..37b29d9a10 100644 --- a/view/theme/frio/templates/theme_settings.tpl +++ b/view/theme/frio/templates/theme_settings.tpl @@ -31,10 +31,11 @@ {{if $login_bg_image}}{{include file="field_fileinput.tpl" field=$login_bg_image}}{{/if}} +{{if $login_bg_color}}{{include file="field_colorinput.tpl" field=$login_bg_color}}{{/if}}