Browse Source

Add Bootswatch theme picker, Fix bug where the bootstrap theme can't be disabled

pull/2/head
Skylar Ittner 2 years ago
parent
commit
a5ae672b9f
4 changed files with 44 additions and 5 deletions
  1. 26
    0
      admin/admin_settings.php
  2. 5
    0
      admin/admin_settings_save.php
  3. 12
    5
      inc/header.inc.php
  4. 1
    0
      language/en/text.php

+ 26
- 0
admin/admin_settings.php View File

@@ -3582,6 +3582,32 @@ $modsForHesk_settings = mfh_getSettings();
buildColorSchemeColorpicker('dropdownItemTextHoverColor', 'dropdownItemTextHoverColor', $modsForHesk_settings['dropdownItemTextHoverColor'], 'Help');
?>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="bootswatch-theme"
class="col-sm-4 col-xs-6 control-label"><?php echo $hesklang['bootswatch_theme']; ?>
</label>

<div class="col-sm-8 col-xs-6">
<select name="bootswatch-theme" id="bootswatch-theme" class="form-control">
<option value="DEFAULT">Default</option>
<?php
$bootswatch_themes = json_decode(file_get_contents("https://bootswatch.com/api/3.json"), TRUE)['themes'];
foreach ($bootswatch_themes as $theme) {
$themename = $theme['name'];
$themedesc = $theme['description'];
$themeurl = $theme['cssCdn'];
$selected = "";
if ($modsForHesk_settings['bootswatch_theme'] == $themeurl) {
$selected = " selected";
}
echo "<option value=\"$themeurl\"$selected>$themename: $themedesc</option>";
}
?>
</select>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">

+ 5
- 0
admin/admin_settings_save.php View File

@@ -495,6 +495,9 @@ $set['dropdownItemTextColor'] = hesk_input(hesk_POST('dropdownItemTextColor'));
$set['dropdownItemTextHoverColor'] = hesk_input(hesk_POST('dropdownItemTextHoverColor'));
$set['questionMarkColor'] = hesk_input(hesk_POST('questionMarkColor'));
$set['dropdownItemTextHoverBackgroundColor'] = hesk_input(hesk_POST('dropdownItemTextHoverBackgroundColor'));

$set['bootswatch_theme'] = hesk_POST('bootswatch-theme');

$set['admin_navbar_background'] = hesk_input(hesk_POST('admin-navbar-background-color'));
$set['admin_navbar_background_hover'] = hesk_input(hesk_POST('admin-navbar-background-hover-color'));
$set['admin_navbar_brand_background'] = hesk_input(hesk_POST('admin-navbar-brand-background-color'));
@@ -666,6 +669,8 @@ if ($changedLoginImage) {
mfh_updateSetting('login_box_header_image', $set['login_box_header_image'], true);
}

mfh_updateSetting('bootswatch_theme', $set['bootswatch_theme'], true);

// Prepare settings file and save it
$settings_file_content = '<?php
// Settings file for HESK ' . $set['hesk_version'] . '

+ 12
- 5
inc/header.inc.php View File

@@ -39,6 +39,7 @@ if (is_dir(HESK_PATH . 'install')) {
$modsForHesk_settings['dropdownItemTextHoverBackgroundColor'] = '#f5f5f5';
$modsForHesk_settings['questionMarkColor'] = '#000000';
$modsForHesk_settings['enable_calendar'] = 1;
$modsForHesk_settings['bootswatch_theme'] = "DEFAULT";
} else {
$modsForHesk_settings = mfh_getSettings();
}
@@ -53,12 +54,18 @@ if (is_dir(HESK_PATH . 'install')) {
<meta name="theme-color" content="<?php echo '#414a5c'; ?>">
<link href="<?php echo HESK_PATH; ?>hesk_style.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>" type="text/css" rel="stylesheet"/>
<link href="<?php echo HESK_PATH; ?>css/datepicker.css" type="text/css" rel="stylesheet"/>
<link href="<?php echo HESK_PATH; ?>css/bootstrap.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>" type="text/css"
rel="stylesheet"/>
<link href="<?php if (!isset(modsForHesk_settings['bootswatch_theme']) || $modsForHesk_settings['bootswatch_theme'] == "DEFAULT") {
echo HESK_PATH . "css/bootstrap.css?v=" . MODS_FOR_HESK_BUILD;
} else {
echo $modsForHesk_settings['bootswatch_theme'];
}
?>" type="text/css" rel="stylesheet"/>
<?php if ($modsForHesk_settings['use_bootstrap_theme'] != 0) {
echo <<<HERE
<link href="<?php echo HESK_PATH; ?>css/bootstrap-theme.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>" type="text/css"
rel="stylesheet" <?php if ($modsForHesk_settings['use_bootstrap_theme'] == 0) {
echo 'disabled';
} ?>>
rel="stylesheet">
HERE;
} ?>
<link href="<?php echo HESK_PATH; ?>css/mods-for-hesk.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>" type="text/css"
rel="stylesheet"/>
<link href="<?php echo HESK_PATH; ?>css/hesk_newStyle.css?v=<?php echo MODS_FOR_HESK_BUILD; ?>" type="text/css"

+ 1
- 0
language/en/text.php View File

@@ -1629,6 +1629,7 @@ $hesklang['dropdownItemTextHoverColorHelp'] = 'The text color of a dropdown item
$hesklang['questionMarkColor'] = 'Question Mark Color';
$hesklang['questionMarkColorHelp'] = 'The text color for the question mark circle, as seen on the \'Settings\' page and on other various pages.';
$hesklang['dropdownItemTextHoverBackgroundColor'] = 'Dropdown Item Text Hover Background Color';
$hesklang['bootswatch_theme'] = 'Bootswatch Bootstrap Theme';
$hesklang['dropdownItemTextHoverBackgroundColorHelp'] = 'The background color of a dropdown item when the mouse hovers over it.';
$hesklang['uiColors'] = 'UI Colors';
$hesklang['displayRtl'] = 'Display site right-to-left';

Loading…
Cancel
Save