Browse Source

#49 NuMods settings can now be changed via the Settings page

merge-requests/2/head
Mike Koch 7 years ago
parent
commit
77e0b01725
  1. 118
      admin/admin_settings.php
  2. 51
      admin/admin_settings_save.php
  3. 16
      language/en/text.php

118
admin/admin_settings.php

@ -478,6 +478,7 @@ if ( defined('HESK_DEMO') )
<ul class="dropdown-menu" role="menu" aria-labelledby="nuModsDropdown">
<li><a href="#numods-general" data-toggle="tab"><?php echo $hesklang['tab_1']; ?></a></li>
<li><a href="#statuses" data-toggle="tab"><?php echo $hesklang['statuses']; ?></a></li>
<li><a href="#colors" data-toggle="tab"><?php echo $hesklang['uiColors']; ?></a></li>
</ul>
</li>
</ul>
@ -1787,7 +1788,7 @@ if ( defined('HESK_DEMO') )
<div class="footerWithBorder blankSpace"></div>
<div class="form-group">
<label for="rtl" class="col-sm-3 col-xs-12 control-label">
<?php echo 'Display site right-to-left:'; ?>
<?php echo $hesklang['displayRtl']; ?>
<a href="#" onclick="javascript:alert('Check this box to convert the helpdesk to right-to-left');">
<i class="fa fa-question-circle settingsquestionmark"></i>
</a>
@ -1795,14 +1796,14 @@ if ( defined('HESK_DEMO') )
<div class="col-sm-9 col-xs-12">
<div class="checkbox">
<label>
<input type="checkbox" <?php if ($nuMods_settings['rtl']) {echo 'checked' ;} ?>> Display site right-to-left
<input id="rtl" name="rtl" type="checkbox" <?php if ($nuMods_settings['rtl']) {echo 'checked' ;} ?>> Display site right-to-left
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="show-icons" class="col-sm-3 col-xs-12 control-label">
<?php echo 'Show icons:'; ?>
<?php echo $hesklang['showIcons']; ?>
<a href="#" onclick="javascript:alert('Check this box to show icons next to navigation bar items');">
<i class="fa fa-question-circle settingsquestionmark"></i>
</a>
@ -1810,14 +1811,14 @@ if ( defined('HESK_DEMO') )
<div class="col-sm-9 col-xs-12">
<div class="checkbox">
<label>
<input type="checkbox" <?php if ($nuMods_settings['show_icons']) {echo 'checked';} ?>> Show icons on navigation bar
<input id="show-icons" name="show-icons" type="checkbox" <?php if ($nuMods_settings['show_icons']) {echo 'checked';} ?>> Show icons on navigation bar
</label>
</div>
</div>
</div>
<div class="form-group">
<label for="maintenance-mode" class="col-sm-3 col-xs-12 control-label">
<?php echo 'Maintenance Mode:'; ?>
<?php echo $hesklang['maintenanceMode']; ?>
<a href="#" onclick="javascript:alert('Check this box to show icons next to navigation bar items');">
<i class="fa fa-question-circle settingsquestionmark"></i>
</a>
@ -1825,7 +1826,7 @@ if ( defined('HESK_DEMO') )
<div class="col-sm-9 col-xs-12">
<div class="checkbox">
<label>
<input type="checkbox" <?php if ($nuMods_settings['maintenance_mode']) {echo 'checked';} ?>> Enable Maintenance Mode
<input id="maintenance-mode" name="maintenance-mode" type="checkbox" <?php if ($nuMods_settings['maintenance_mode']) {echo 'checked';} ?>> Enable Maintenance Mode
</label>
</div>
</div>
@ -2005,6 +2006,111 @@ if ( defined('HESK_DEMO') )
</select>
</div>
</div>
</div>
<!-- NuMods: Color settings -->
<div class="tab-pane fade in" id="colors">
<h6 style="font-weight: bold"><?php echo $hesklang['uiColors']; ?></h6>
<div class="footerWithBorder blankSpace"></div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarBackgroundColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarBackgroundColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarBackgroundColor" name="navbarBackgroundColor" class="form-control" value="<?php echo $nuMods_settings['navbarBackgroundColor']; ?>">
</div>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarBrandColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarBrandColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarBrandColor" name="navbarBrandColor" class="form-control" value="<?php echo $nuMods_settings['navbarBrandColor']; ?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarBrandHoverColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarBrandHoverColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarBrandHoverColor" name="navbarBrandHoverColor" class="form-control" value="<?php echo $nuMods_settings['navbarBrandHoverColor']; ?>">
</div>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarItemTextColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemTextColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemTextColor" name="navbarItemTextColor" class="form-control" value="<?php echo $nuMods_settings['navbarItemTextColor']; ?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarItemTextHoverColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemTextHoverColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemTextHoverColor" name="navbarItemTextHoverColor" class="form-control" value="<?php echo $nuMods_settings['navbarItemTextHoverColor']; ?>">
</div>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarItemTextSelectedColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemTextSelectedColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemTextSelectedColor" name="navbarItemTextSelectedColor" class="form-control" value="<?php echo $nuMods_settings['navbarItemTextSelectedColor']; ?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="navbarItemSelectedBackgroundColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['navbarItemSelectedBackgroundColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="navbarItemSelectedBackgroundColor" name="navbarItemSelectedBackgroundColor" class="form-control" value="<?php echo $nuMods_settings['navbarItemSelectedBackgroundColor']; ?>">
</div>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="dropdownItemTextColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['dropdownItemTextColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="dropdownItemTextColor" name="dropdownItemTextColor" class="form-control" value="<?php echo $nuMods_settings['dropdownItemTextColor']; ?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="dropdownItemTextHoverColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['dropdownItemTextHoverColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="dropdownItemTextHoverColor" name="dropdownItemTextHoverColor" class="form-control" value="<?php echo $nuMods_settings['dropdownItemTextHoverColor']; ?>">
</div>
</div>
</div>
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="questionMarkColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['questionMarkColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="questionMarkColor" name="questionMarkColor" class="form-control" value="<?php echo $nuMods_settings['questionMarkColor']; ?>">
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6 col-xs-12">
<div class="form-group">
<label for="dropdownItemTextHoverBackgroundColor" class="col-sm-7 col-xs-12 control-label"><?php echo $hesklang['dropdownItemTextHoverBackgroundColor']; ?> (?)</label>
<div class="col-sm-5 col-xs-12">
<input type="text" id="dropdownItemTextHoverBackgroundColor" name="dropdownItemTextHoverBackgroundColor" class="form-control" value="<?php echo $nuMods_settings['dropdownItemTextHoverBackgroundColor']; ?>">
</div>
</div>
</div>
</div>
</div>
<div class="form-group">
<div class="col-sm-9 col-sm-offset-3">

51
admin/admin_settings_save.php

@ -37,6 +37,7 @@ define('HESK_PATH','../');
/* Get all the required files and functions */
require(HESK_PATH . 'hesk_settings.inc.php');
require(HESK_PATH . 'nuMods_settings.inc.php');
require(HESK_PATH . 'inc/common.inc.php');
require(HESK_PATH . 'inc/admin_functions.inc.php');
require(HESK_PATH . 'inc/email_functions.inc.php');
@ -498,6 +499,56 @@ $stmt->execute();
$set['hesk_version'] = $hesk_settings['hesk_version'];
// Save the nuMods_settings.inc.php file
$set['nuMods_version'] = $nuMods_settings['version'];
$set['rtl'] = empty($_POST['rtl']) ? 0 : 1;
$set['show-icons'] = empty($_POST['show-icons']) ? 0 : 1;
$set['maintenance-mode'] = empty($_POST['maintenance-mode']) ? 0 : 1;
$set['navbarBackgroundColor'] = hesk_input(hesk_POST('navbarBackgroundColor'));
$set['navbarBrandColor'] = hesk_input(hesk_POST('navbarBrandColor'));
$set['navbarBrandHoverColor'] = hesk_input(hesk_POST('navbarBrandHoverColor'));
$set['navbarItemTextColor'] = hesk_input(hesk_POST('navbarItemTextColor'));
$set['navbarItemTextHoverColor'] = hesk_input(hesk_POST('navbarItemTextHoverColor'));
$set['navbarItemTextSelectedColor'] = hesk_input(hesk_POST('navbarItemTextSelectedColor'));
$set['navbarItemSelectedBackgroundColor'] = hesk_input(hesk_POST('navbarItemSelectedBackgroundColor'));
$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'));
$nuMods_file_content='<?php
//-- NuMods Theme Color Settings
$nuMods_settings[\'navbarBackgroundColor\'] = \''.$set['navbarBackgroundColor'].'\';
$nuMods_settings[\'navbarBrandColor\'] = \''.$set['navbarBrandColor'].'\';
$nuMods_settings[\'navbarBrandHoverColor\'] = \''.$set['navbarBrandHoverColor'].'\';
$nuMods_settings[\'navbarItemTextColor\'] = \''.$set['navbarItemTextColor'].'\';
$nuMods_settings[\'navbarItemTextHoverColor\'] = \''.$set['navbarItemTextHoverColor'].'\';
$nuMods_settings[\'navbarItemTextSelectedColor\'] = \''.$set['navbarItemTextSelectedColor'].'\';
$nuMods_settings[\'navbarItemSelectedBackgroundColor\'] = \''.$set['navbarItemSelectedBackgroundColor'].'\';
$nuMods_settings[\'dropdownItemTextColor\'] = \''.$set['dropdownItemTextColor'].'\';
$nuMods_settings[\'dropdownItemTextHoverColor\'] = \''.$set['dropdownItemTextHoverColor'].'\';
$nuMods_settings[\'dropdownItemTextHoverBackgroundColor\'] = \''.$set['dropdownItemTextHoverBackgroundColor'].'\';
$nuMods_settings[\'questionMarkColor\'] = \''.$set['questionMarkColor'].'\';
//-- Set this to 1 for right-to-left text.
$nuMods_settings[\'rtl\'] = '.$set['rtl'].';
//-- Set this to 1 to show icons next to navigation menu items
$nuMods_settings[\'show_icons\'] = '.$set['show-icons'].';
//-- Set this to 1 to enable maintenance mode
$nuMods_settings[\'maintenance_mode\'] = '.$set['maintenance-mode'].';
/* DO NOT EDIT ANYTHING BELOW THIS LINE */
$nuMods_settings[\'version\']= \''.$set['nuMods_version'].'\';';
// Write the file
if ( ! file_put_contents(HESK_PATH . 'nuMods_settings.inc.php', $nuMods_file_content) )
{
hesk_error($hesklang['err_nuMods_settings']);
}
// Prepare settings file and save it
$settings_file_content='<?php
// Settings file for HESK ' . $set['hesk_version'] . '

16
language/en/text.php

@ -23,6 +23,22 @@ $hesklang['EMAIL_HR']='------ Reply above this line ------';
// ADDED OR MODIFIED IN NuMods 1.4.0
$hesklang['numods'] = 'NuMods';
$hesklang['navbarBackgroundColor'] = 'Navbar Background Color';
$hesklang['navbarBrandColor'] = 'Navbar Brand Color';
$hesklang['navbarBrandHoverColor'] = 'Navbar Brand Hover Color';
$hesklang['navbarItemTextColor'] = 'Navbar Item Text Color';
$hesklang['navbarItemTextHoverColor'] = 'Navbar Item Text Hover Color';
$hesklang['navbarItemTextSelectedColor'] = 'Navbar Item Text Selected Color';
$hesklang['navbarItemSelectedBackgroundColor'] = 'Navbar Item Selected Background Color';
$hesklang['dropdownItemTextColor'] = 'Dropdown Item Text Color';
$hesklang['dropdownItemTextHoverColor'] = 'Dropdown Item Text Hover Color';
$hesklang['questionMarkColor'] = 'Question Mark Color';
$hesklang['dropdownItemTextHoverBackgroundColor'] = 'Dropdown Item Text Hover Background Color';
$hesklang['uiColors'] = 'UI Colors';
$hesklang['displayRtl'] = 'Display site right-to-left';
$hesklang['showIcons'] = 'Show Icons';
$hesklang['maintenanceMode'] = 'Maintenance Mode';
$hesklang['err_nuMods_settings'] = 'Can\'t open file <b>nuMods_settings.inc.php</b> for writing. Please CHMOD this file to 666 (rw-rw-rw-)';
// ADDED OR MODIFIED IN NuMods 1.3.1
$hesklang['autorefresh'] = 'Autorefresh:';

Loading…
Cancel
Save