Frio: add input for login backround image in admin settings

This commit is contained in:
fabrixxm 2018-01-14 19:19:24 +01:00
parent 1064da1052
commit de227e305e
3 changed files with 13 additions and 3 deletions

View File

@ -39,6 +39,7 @@ function theme_admin_post(App $a) {
Config::set('frio', 'contentbg_transp', $_POST["frio_contentbg_transp"]); Config::set('frio', 'contentbg_transp', $_POST["frio_contentbg_transp"]);
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', 'css_modified', time()); Config::set('frio', 'css_modified', time());
} }
} }
@ -75,6 +76,7 @@ function theme_admin(App $a) {
$arr["contentbg_transp"] = Config::get('frio', 'contentbg_transp'); $arr["contentbg_transp"] = Config::get('frio', 'contentbg_transp');
$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');
return frio_form($arr); return frio_form($arr);
} }
@ -104,7 +106,7 @@ function frio_form($arr) {
$background_image_help = "<strong>" . t("Note"). ": </strong>".t("Check image permissions if all users are allowed to visit the image"); $background_image_help = "<strong>" . t("Note"). ": </strong>".t("Check image permissions if all users are allowed to visit the image");
$t = get_markup_template('theme_settings.tpl'); $t = get_markup_template('theme_settings.tpl');
$o .= replace_macros($t, array( $ctx = array(
'$submit' => t('Submit'), '$submit' => t('Submit'),
'$baseurl' => System::baseUrl(), '$baseurl' => System::baseUrl(),
'$title' => t("Theme settings"), '$title' => t("Theme settings"),
@ -116,7 +118,13 @@ function frio_form($arr) {
'$contentbg_transp' => array_key_exists("contentbg_transp", $disable) ? "" : array('frio_contentbg_transp', t("Content background transparency"), ((isset($arr["contentbg_transp"]) && $arr["contentbg_transp"] != "") ? $arr["contentbg_transp"] : 100)), '$contentbg_transp' => array_key_exists("contentbg_transp", $disable) ? "" : array('frio_contentbg_transp', t("Content background transparency"), ((isset($arr["contentbg_transp"]) && $arr["contentbg_transp"] != "") ? $arr["contentbg_transp"] : 100)),
'$background_image' => array_key_exists("background_image", $disable ) ? "" : array('frio_background_image', t('Set the background image'), $arr['background_image'], $background_image_help), '$background_image' => array_key_exists("background_image", $disable ) ? "" : array('frio_background_image', t('Set the background image'), $arr['background_image'], $background_image_help),
'$bg_image_options' => Image::get_options($arr), '$bg_image_options' => Image::get_options($arr),
)); );
if ( array_key_exists("login_bg_image", $arr ) && !array_key_exists("login_bg_image", $disable ) ) {
$ctx['$login_bg_image'] = array('frio_login_bg_image', t('Login page background image'), $arr['login_bg_image'], $background_image_help);
}
$o .= replace_macros($t, $ctx);
return $o; return $o;
} }

View File

@ -41,8 +41,8 @@ if ($a->module !== 'install') {
$bgcolor = Config::get("frio", "background_color"); $bgcolor = Config::get("frio", "background_color");
$contentbg_transp = Config::get("frio", "contentbg_transp"); $contentbg_transp = Config::get("frio", "contentbg_transp");
$background_image = Config::get("frio", "background_image"); $background_image = Config::get("frio", "background_image");
$login_bg_image = Config::get("frio", "login_bg_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");
$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.

View File

@ -30,6 +30,8 @@
{{/foreach}} {{/foreach}}
</div> </div>
{{if $login_bg_image}}{{include file="field_fileinput.tpl" field=$login_bg_image}}{{/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").colorpicker({format: 'hex', align: 'left'});