diff --git a/admin/calendar.php b/admin/calendar.php index 6e582816..e02dde94 100644 --- a/admin/calendar.php +++ b/admin/calendar.php @@ -33,14 +33,26 @@ if ($modsForHesk_settings['enable_calendar'] == '0') { // Get categories for the dropdown $order_by = $modsForHesk_settings['category_order_column']; -$rs = hesk_dbQuery("SELECT `id`, `name`, `color` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `usage` <> 1 ORDER BY `" . hesk_dbEscape($order_by) . "`"); +$rs = hesk_dbQuery("SELECT `id`, `name`, `background_color`, `foreground_color`, `display_border_outline` + FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` + WHERE `usage` <> 1 ORDER BY `" . hesk_dbEscape($order_by) . "`"); $categories = array(); while ($row = hesk_dbFetchAssoc($rs)) { if (!$_SESSION['isadmin'] && !in_array($row['id'], $_SESSION['categories'])) { continue; } - $row['css_style'] = $row['color'] == null ? 'background: white; color: black; border: solid 1px #000;' : 'border: solid 1px ' . $row['color'] . '; background: ' . $row['color']; + $row['css_style'] = "background: {$row['background_color']};"; + $row['background_volatile'] = 'background-volatile'; + if ($row['foreground_color'] != 'AUTO') { + $row['background_volatile'] = ''; + $row['css_style'] .= " color: {$row['foreground_color']};"; + + if ($row['display_border_outline'] == '1') { + $row['css_style'] .= " border: solid 1px {$row['foreground_color']};"; + } + } + $categories[] = $row; } @@ -57,7 +69,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
  • -
    ' . $mycat['id'] . ' ' . $mycat['name'] . ' @@ -334,7 +340,6 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
    - 40% Complete (success)
    @@ -396,12 +401,13 @@ while ($mycat = hesk_dbFetchAssoc($res)) { + data-content="">
    + data-error="" + required>
    @@ -410,20 +416,18 @@ while ($mycat = hesk_dbFetchAssoc($res)) { + data-content="">
    + placeholder="">
    @@ -536,10 +540,13 @@ while ($mycat = hesk_dbFetchAssoc($res)) { }; $modal.find('input[name="background-color"]') .colorpicker(colorpickerOptions).end().modal('show'); + colorpickerOptions = { - format: 'hex', - color: foregroundColor + format: 'hex' }; + if (foregroundColor != '') { + colorpickerOptions.color = foregroundColor; + } $modal.find('input[name="foreground-color"]') .colorpicker(colorpickerOptions).end().modal('show'); @@ -677,6 +684,10 @@ function new_cat() $background_color = hesk_POST('background-color', '#ffffff'); $foreground_color = hesk_POST('foreground-color', '#000000'); $display_border = hesk_POST('display-border', 0); + if ($foreground_color == '') { + $foreground_color = 'AUTO'; + $display_border = 0; + } $usage = hesk_POST('usage', 0); @@ -725,9 +736,13 @@ function update_category() $catname = hesk_input(hesk_POST('name'), $hesklang['cat_ren_name'], $_SERVER['PHP_SELF']); $_SESSION['catname2'] = $catname; - $color = hesk_POST('color', null); - $color = str_replace('#', '', $color); - $color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL'; + $background_color = hesk_POST('background-color', '#ffffff'); + $foreground_color = hesk_POST('foreground-color', '#000000'); + $display_border = hesk_POST('display-border', 0); + if ($foreground_color == '') { + $foreground_color = 'AUTO'; + $display_border = 0; + } $manager = hesk_POST('manager', 0); $priority = hesk_POST('priority', 0); $usage = hesk_POST('usage', 0); @@ -736,7 +751,9 @@ function update_category() hesk_dbQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` SET `name`='" . hesk_dbEscape($catname) . "', `priority` = '" . hesk_dbEscape($priority) . "', `manager` = " . intval($manager) . ", - `color` = " . $color . ", + `background_color` = '" . hesk_dbEscape($background_color) . "', + `foreground_color` = '" . hesk_dbEscape($foreground_color) . "', + `display_border_outline` = '" . intval($display_border) . "', `usage` = " . intval($usage) . " WHERE `id`='" . intval($catid) . "'"); diff --git a/calendar.php b/calendar.php index ea1822f4..bb6a9ee0 100644 --- a/calendar.php +++ b/calendar.php @@ -31,7 +31,16 @@ $categorySql = "SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "c $categoryRs = hesk_dbQuery($categorySql); while ($row = hesk_dbFetchAssoc($categoryRs)) { - $row['css_style'] = $row['color'] == null ? 'color: black; border: solid 1px #000; padding-right: 14px' : 'background: ' . $row['color']; + $row['css_style'] = "background: {$row['background_color']};"; + $row['background_volatile'] = 'background-volatile'; + if ($row['foreground_color'] != 'AUTO') { + $row['background_volatile'] = ''; + $row['css_style'] .= " color: {$row['foreground_color']};"; + + if ($row['display_border_outline'] == '1') { + $row['css_style'] .= " border: solid 1px {$row['foreground_color']};"; + } + } $categories[] = $row; } @@ -55,7 +64,8 @@ require_once(HESK_PATH . 'inc/header.inc.php');
    -
    +
  • diff --git a/css/mods-for-hesk-new.css b/css/mods-for-hesk-new.css index 89e011d8..f0385a1d 100644 --- a/css/mods-for-hesk-new.css +++ b/css/mods-for-hesk-new.css @@ -267,16 +267,17 @@ div.ticket-info { color: #444; } -.event-category:hover { - border: solid 1px #fff !important; - cursor: pointer; -} - .event-category[data-checked="0"] { background: #777 !important; + border: none !important; color: #aaa !important; } +.event-category:hover { + border: solid 1px #fff !important; + cursor: pointer; +} + .anchor { padding-top: 50px; height: 0; diff --git a/install/mods-for-hesk/database-validation.php b/install/mods-for-hesk/database-validation.php index 707caf73..94b1f762 100644 --- a/install/mods-for-hesk/database-validation.php +++ b/install/mods-for-hesk/database-validation.php @@ -160,7 +160,9 @@ hesk_dbConnect(); $all_good = $all_good & run_column_check('calendar_event_reminder', '`email_sent`'); $all_good = $all_good & run_column_check('tickets', '`due_date`'); $all_good = $all_good & run_column_check('tickets', '`overdue_email_sent`'); - $all_good = $all_good & run_column_check('categories', '`color`'); + + // Changed in 3.1.0 + //$all_good = $all_good & run_column_check('categories', '`color`'); $all_good = $all_good & run_column_check('categories', '`usage`'); $all_good = $all_good & run_column_check('users', '`notify_overdue_unassigned`'); $all_good = $all_good & run_column_check('users', '`default_calendar_view`'); diff --git a/install/mods-for-hesk/sql/uninstallSql.php b/install/mods-for-hesk/sql/uninstallSql.php index 681d2043..6d12cda5 100644 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ b/install/mods-for-hesk/sql/uninstallSql.php @@ -94,7 +94,9 @@ function removeOtherColumns() executeQuery("DROP TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "calendar_event_reminder`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `due_date`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` DROP COLUMN `overdue_email_sent`"); - executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `color`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `background_color`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `foreground_color`"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `display_border_outline`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` DROP COLUMN `usage`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `notify_overdue_unassigned`"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "users` DROP COLUMN `default_calendar_view`"); diff --git a/internal-api/dao/calendar_dao.php b/internal-api/dao/calendar_dao.php index 71ed2f75..a43bf67b 100644 --- a/internal-api/dao/calendar_dao.php +++ b/internal-api/dao/calendar_dao.php @@ -6,7 +6,7 @@ function get_events($start, $end, $hesk_settings, $staff = true) { $start_time_sql = "CONVERT_TZ(FROM_UNIXTIME(" . hesk_dbEscape($start) . " / 1000), @@session.time_zone, '+00:00')"; $end_time_sql = "CONVERT_TZ(FROM_UNIXTIME(" . hesk_dbEscape($end) . " / 1000), @@session.time_zone, '+00:00')"; - $sql = "SELECT `events`.*, `categories`.`name` AS `category_name`, `categories`.`color` AS `category_color` "; + $sql = "SELECT `events`.*, `categories`.`name` AS `category_name`, `categories`.`background_color` AS `category_color` "; if ($staff) { $sql .= ",`reminders`.`amount` AS `reminder_value`, `reminders`.`unit` AS `reminder_unit` "; @@ -63,7 +63,7 @@ function get_events($start, $end, $hesk_settings, $staff = true) { $current_date = hesk_date(); $hesk_settings['timeformat'] = $old_time_setting; - $sql = "SELECT `trackid`, `subject`, `due_date`, `category`, `categories`.`name` AS `category_name`, `categories`.`color` AS `category_color`, + $sql = "SELECT `trackid`, `subject`, `due_date`, `category`, `categories`.`name` AS `category_name`, `categories`.`background_color` AS `category_color`, CASE WHEN `due_date` < '{$current_date}' THEN 1 ELSE 0 END AS `overdue`, `owner`.`name` AS `owner_name`, `tickets`.`owner` AS `owner_id`, `tickets`.`priority` AS `priority` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` AS `tickets` diff --git a/language/en/text.php b/language/en/text.php index c3a51c6f..cb790216 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -2127,9 +2127,10 @@ $hesklang['manage_custom_nav_elements'] = 'Manage Custom Nav Elements'; $hesklang['can_man_custom_nav'] = 'Can manage custom nav elements'; $hesklang['category_background_color'] = 'Background Color'; $hesklang['category_foreground_color'] = 'Foreground Color'; -$hesklang['category_color_help'] = 'The hex code for the color to be used on the view ticket screen and calendar.'; +$hesklang['category_background_color_help'] = 'The hex code for the background color to be used on the view ticket screen and calendar.'; +$hesklang['category_foreground_color_help'] = 'The hex code for the foreground color to be used on the view ticket and calendar screens. Leave blank for automatic color based on background.'; $hesklang['category_display_border'] = 'Display Border'; -$hesklang['category_display_border_help'] = 'Choose to decide whether or not to display a border around the category (uses foreground color)'; +$hesklang['category_display_border_help'] = 'Choose to decide whether or not to display a border around the category (uses foreground color). This is ignored if foreground color is set to automatic.'; // DO NOT CHANGE BELOW if (!defined('IN_SCRIPT')) die('PHP syntax OK!');