Add ability to hide start time

This commit is contained in:
Mike Koch 2018-01-30 22:24:12 -05:00
parent df780f4546
commit af45726fe6
No known key found for this signature in database
GPG Key ID: 9BA5D7F8391455ED
12 changed files with 74 additions and 2 deletions

View File

@ -2220,6 +2220,22 @@ $modsForHesk_settings = mfh_getSettings();
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label for="show-start-time" class="col-sm-4 col-xs-12 control-label">
<?php echo $hesklang['show_event_start_time']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo $hesklang['show_event_start_time']; ?>"
data-content="<?php echo $hesklang['show_event_start_time_help']; ?>"></i>
</label>
<div class="col-sm-8 form-inline">
<?php
$on = $modsForHesk_settings['calendar_show_start_time'] == 'true' ? 'checked="checked"' : '';
$off = $modsForHesk_settings['calendar_show_start_time'] == 'false' ? 'checked="checked"' : '';
echo '
<div class="radio"><label><input type="radio" name="calendar-show-start-time" value="true" ' . $on . ' /> ' . $hesklang['yes'] . '</label></div><br>
<div class="radio"><label><input type="radio" name="calendar-show-start-time" value="false" ' . $off . ' /> ' . $hesklang['no'] . '</label></div><br>'; ?>
</div>
</div>
<h4 class="bold"> <h4 class="bold">
<?php echo $hesklang['business_hours']; ?> <?php echo $hesklang['business_hours']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" <i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"

View File

@ -480,6 +480,7 @@ $set['navbar_title_url'] = hesk_POST('navbar_title_url');
$set['enable_calendar'] = hesk_checkMinMax(intval(hesk_POST('enable_calendar')), 0, 2, 2); $set['enable_calendar'] = hesk_checkMinMax(intval(hesk_POST('enable_calendar')), 0, 2, 2);
$set['first_day_of_week'] = hesk_POST('first-day-of-week', 0); $set['first_day_of_week'] = hesk_POST('first-day-of-week', 0);
$set['default_view'] = hesk_POST('default-view', 'month'); $set['default_view'] = hesk_POST('default-view', 'month');
$set['calendar_show_start_time'] = hesk_POST('calendar-show-start-time', 'true');
if ($set['customer-email-verification-required']) { if ($set['customer-email-verification-required']) {
//-- Don't allow multiple emails if verification is required //-- Don't allow multiple emails if verification is required
@ -662,6 +663,7 @@ mfh_updateSetting('use_mailgun', $set['use_mailgun'], false);
mfh_updateSetting('enable_calendar', $set['enable_calendar'], false); mfh_updateSetting('enable_calendar', $set['enable_calendar'], false);
mfh_updateSetting('first_day_of_week', $set['first_day_of_week'], false); mfh_updateSetting('first_day_of_week', $set['first_day_of_week'], false);
mfh_updateSetting('default_calendar_view', $set['default_view'], true); mfh_updateSetting('default_calendar_view', $set['default_view'], true);
mfh_updateSetting('calendar_show_start_time', $set['calendar_show_start_time'], true);
mfh_updateSetting('admin_color_scheme', $set['admin_color_scheme'], true); mfh_updateSetting('admin_color_scheme', $set['admin_color_scheme'], true);
mfh_updateSetting('login_background_type', $set['login_background_type'], true); mfh_updateSetting('login_background_type', $set['login_background_type'], true);

View File

@ -605,6 +605,7 @@ echo mfh_get_hidden_fields_for_language(array('error_loading_events',
echo $view_array[$_SESSION['default_calendar_view']]; echo $view_array[$_SESSION['default_calendar_view']];
?> ?>
</p> </p>
<p id="setting_show_start_time"><?php echo $modsForHesk_settings['calendar_show_start_time']; ?></p>
<?php <?php
$businessHoursRs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`"); $businessHoursRs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");
while ($row = hesk_dbFetchAssoc($businessHoursRs)): while ($row = hesk_dbFetchAssoc($businessHoursRs)):

View File

@ -119,6 +119,7 @@ echo mfh_get_hidden_fields_for_language(array(
<div style="display: none"> <div style="display: none">
<p id="setting_default_view"><?php echo $modsForHesk_settings['default_calendar_view']; ?></p> <p id="setting_default_view"><?php echo $modsForHesk_settings['default_calendar_view']; ?></p>
<p id="setting_first_day_of_week"><?php echo $modsForHesk_settings['first_day_of_week']; ?></p> <p id="setting_first_day_of_week"><?php echo $modsForHesk_settings['first_day_of_week']; ?></p>
<p id="setting_show_start_time"><?php echo $modsForHesk_settings['calendar_show_start_time']; ?></p>
</div> </div>
<?php <?php
$businessHoursRs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`"); $businessHoursRs = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");

View File

@ -222,5 +222,8 @@ function getAllMigrations() {
164 => new \v330\ServiceMessagesImprovements\CreateServiceMessageToLocationTable(164), 164 => new \v330\ServiceMessagesImprovements\CreateServiceMessageToLocationTable(164),
165 => new \v330\ServiceMessagesImprovements\UpdateExistingServiceMessagesLocations(165), 165 => new \v330\ServiceMessagesImprovements\UpdateExistingServiceMessagesLocations(165),
166 => new \v330\ServiceMessagesImprovements\AddLanguageColumnToServiceMessages(166), 166 => new \v330\ServiceMessagesImprovements\AddLanguageColumnToServiceMessages(166),
167 => new \v330\CalendarImprovements\AddBusinessHoursTable(167),
168 => new \v330\CalendarImprovements\InsertDefaultBusinessHours(168),
169 => new \v330\CalendarImprovements\AddShowStartTimeSetting(169),
); );
} }

View File

@ -6,8 +6,7 @@ class AddBusinessHoursTable extends \AbstractUpdatableMigration {
function innerUp($hesk_settings) { function innerUp($hesk_settings) {
$this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` $this->executeQuery("CREATE TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`
(`day_of_week` INT NOT NULL, `all_day` INT NOT NULL, (`day_of_week` INT NOT NULL, `start_time` VARCHAR(5) NOT NULL, `end_time` VARCHAR(5) NOT NULL)");
`start_time` VARCHAR(5) NOT NULL, `end_time` VARCHAR(5) NOT NULL)");
} }
function innerDown($hesk_settings) { function innerDown($hesk_settings) {

View File

@ -0,0 +1,17 @@
<?php
namespace v330\CalendarImprovements;
class AddShowStartTimeSetting extends \AbstractUpdatableMigration {
function innerUp($hesk_settings) {
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` (`Key`, `Value`)
VALUES ('calendar_show_start_time', 'true')");
}
function innerDown($hesk_settings) {
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings`
WHERE `Key` = 'calendar_show_start_time'");
}
}

View File

@ -0,0 +1,28 @@
<?php
namespace v330\CalendarImprovements;
class InsertDefaultBusinessHours extends \AbstractUpdatableMigration {
function innerUp($hesk_settings) {
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
VALUES (0, '00:00', '23:59')");
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
VALUES (1, '00:00', '23:59')");
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
VALUES (2, '00:00', '23:59')");
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
VALUES (3, '00:00', '23:59')");
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
VALUES (4, '00:00', '23:59')");
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
VALUES (5, '00:00', '23:59')");
$this->executeQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours` (`day_of_week`, `start_time`, `end_time`)
VALUES (6, '00:00', '23:59')");
}
function innerDown($hesk_settings) {
$this->executeQuery("DELETE FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "mfh_calendar_business_hours`");
}
}

View File

@ -12,6 +12,7 @@ $(document).ready(function() {
eventLimit: true, eventLimit: true,
timeFormat: 'H:mm', timeFormat: 'H:mm',
axisFormat: 'H:mm', axisFormat: 'H:mm',
displayEventTime: $('#setting_show_start_time').text(),
businessHours: [ businessHours: [
{ {
dow: [0], dow: [0],

View File

@ -12,6 +12,7 @@ $(document).ready(function() {
eventLimit: true, eventLimit: true,
timeFormat: 'H:mm', timeFormat: 'H:mm',
axisFormat: 'H:mm', axisFormat: 'H:mm',
displayEventTime: $('#setting_show_start_time').text(),
businessHours: [ businessHours: [
{ {
dow: [0], dow: [0],

View File

@ -12,6 +12,7 @@ $(document).ready(function() {
eventLimit: true, eventLimit: true,
timeFormat: 'H:mm', timeFormat: 'H:mm',
axisFormat: 'H:mm', axisFormat: 'H:mm',
displayEventTime: $('#setting_show_start_time').text() === 'true',
businessHours: [ businessHours: [
{ {
dow: [0], dow: [0],

View File

@ -2233,6 +2233,8 @@ $hesklang['sm_login_page'] = 'Login Page';
$hesklang['business_hours'] = 'Business Hours'; $hesklang['business_hours'] = 'Business Hours';
$hesklang['business_hours_help'] = 'Set business hours for the calendar. There is no functional change by setting this, $hesklang['business_hours_help'] = 'Set business hours for the calendar. There is no functional change by setting this,
but times outside of the defined business hours will have a darker gray background for increased visibility.'; but times outside of the defined business hours will have a darker gray background for increased visibility.';
$hesklang['show_event_start_time'] = 'Show event start time in title';
$hesklang['show_event_start_time_help'] = 'Always show the start time on event titles (unless the event is an all-day event).';
// DO NOT CHANGE BELOW // DO NOT CHANGE BELOW
if (!defined('IN_SCRIPT')) die('PHP syntax OK!'); if (!defined('IN_SCRIPT')) die('PHP syntax OK!');