Frio: add login background color admin option
This commit is contained in:
parent
2c8bbea65d
commit
fc8e8feec1
|
@ -34,8 +34,8 @@ function home_content(App $a) {
|
||||||
$customhome = False;
|
$customhome = False;
|
||||||
$defaultheader = '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>';
|
$defaultheader = '<h1>'.((x($a->config,'sitename')) ? sprintf(t("Welcome to %s"), $a->config['sitename']) : "").'</h1>';
|
||||||
|
|
||||||
$homefilepath = $a->basepath . '/home.html';
|
$homefilepath = $a->basepath . "/home.html";
|
||||||
$cssfilepath = $a->basepath . '/home.css';
|
$cssfilepath = $a->basepath . "/home.css";
|
||||||
if (file_exists($homefilepath)) {
|
if (file_exists($homefilepath)) {
|
||||||
$customhome = $homefilepath;
|
$customhome = $homefilepath;
|
||||||
if (file_exists($cssfilepath)) {
|
if (file_exists($cssfilepath)) {
|
||||||
|
|
|
@ -40,6 +40,7 @@ function theme_admin_post(App $a) {
|
||||||
Config::set('frio', 'background_image', $_POST["frio_background_image"]);
|
Config::set('frio', 'background_image', $_POST["frio_background_image"]);
|
||||||
Config::set('frio', 'bg_image_option', $_POST["frio_bg_image_option"]);
|
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_image', $_POST["frio_login_bg_image"]);
|
||||||
|
Config::set('frio', 'login_bg_color', $_POST["frio_login_bg_color"]);
|
||||||
Config::set('frio', 'css_modified', time());
|
Config::set('frio', 'css_modified', time());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -77,6 +78,7 @@ function theme_admin(App $a) {
|
||||||
$arr["background_image"] = Config::get('frio', 'background_image');
|
$arr["background_image"] = Config::get('frio', 'background_image');
|
||||||
$arr["bg_image_option"] = Config::get('frio', 'bg_image_option');
|
$arr["bg_image_option"] = Config::get('frio', 'bg_image_option');
|
||||||
$arr["login_bg_image"] = Config::get('frio', 'login_bg_image');
|
$arr["login_bg_image"] = Config::get('frio', 'login_bg_image');
|
||||||
|
$arr["login_bg_color"] = Config::get('frio', 'login_bg_color');
|
||||||
|
|
||||||
return frio_form($arr);
|
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 ) ) {
|
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];
|
$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);
|
$o .= replace_macros($t, $ctx);
|
||||||
|
|
||||||
|
|
|
@ -3018,6 +3018,7 @@ section .profile-match-wrapper {
|
||||||
|
|
||||||
.mod-home.is-not-singleuser,
|
.mod-home.is-not-singleuser,
|
||||||
.mod-login {
|
.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-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-size: cover;
|
||||||
background-attachment: fixed;
|
background-attachment: fixed;
|
||||||
|
|
|
@ -47,6 +47,7 @@ if ($a->module !== 'install') {
|
||||||
$background_image = Config::get("frio", "background_image");
|
$background_image = Config::get("frio", "background_image");
|
||||||
$bg_image_option = Config::get("frio", "bg_image_option");
|
$bg_image_option = Config::get("frio", "bg_image_option");
|
||||||
$login_bg_image = Config::get("frio", "login_bg_image");
|
$login_bg_image = Config::get("frio", "login_bg_image");
|
||||||
|
$login_bg_color = Config::get("frio", "login_bg_color");
|
||||||
$modified = Config::get("frio", "css_modified");
|
$modified = Config::get("frio", "css_modified");
|
||||||
|
|
||||||
// There is maybe the case that the user did never modify the theme settings.
|
// 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);
|
$bgcolor = (empty($bgcolor) ? "#ededed" : $bgcolor);
|
||||||
// The background image can not be empty. So we use a dummy jpg if no image was set.
|
// 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);
|
$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);
|
$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);
|
$contentbg_transp = ((isset($contentbg_transp) && $contentbg_transp != "") ? $contentbg_transp : 100);
|
||||||
|
|
||||||
// Calculate some colors in dependance of existing colors.
|
// Calculate some colors in dependance of existing colors.
|
||||||
|
@ -181,6 +189,7 @@ $options = [
|
||||||
'$background_image' => $background_image,
|
'$background_image' => $background_image,
|
||||||
'$background_size_img' => $background_size_img,
|
'$background_size_img' => $background_size_img,
|
||||||
'$login_bg_image' => $login_bg_image,
|
'$login_bg_image' => $login_bg_image,
|
||||||
|
'$login_bg_color' => $login_bg_color
|
||||||
];
|
];
|
||||||
|
|
||||||
$css_tpl = file_get_contents('view/theme/frio/css/style.css');
|
$css_tpl = file_get_contents('view/theme/frio/css/style.css');
|
||||||
|
|
|
@ -31,10 +31,11 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{{if $login_bg_image}}{{include file="field_fileinput.tpl" field=$login_bg_image}}{{/if}}
|
{{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}}
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
$(document).ready(function() {
|
$(document).ready(function() {
|
||||||
$("#frio_nav_bg, #frio_nav_icon_color, #frio_background_color, #frio_link_color").colorpicker({format: 'hex', align: 'left'});
|
$("#frio_nav_bg, #frio_nav_icon_color, #frio_background_color, #frio_link_color, #frio_login_bg_color").colorpicker({format: 'hex', align: 'left'});
|
||||||
|
|
||||||
// show image options when user user starts to type the address of the image
|
// show image options when user user starts to type the address of the image
|
||||||
$("#id_frio_background_image").keyup(function(){
|
$("#id_frio_background_image").keyup(function(){
|
||||||
|
|
Loading…
Reference in a new issue