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'] . ' + ' . $mycat['name'] . ' ' . $priorities[$mycat['priority']]['formatted'] . ' ' . $all . '
    - 40% Complete (success)
    @@ -386,18 +397,55 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
    -
    +
    + +
    + +
    +
    +
    +
    + +
    +
    + +
        +
    + +
    +
    +
  • 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..1794874b 100644 --- a/install/mods-for-hesk/database-validation.php +++ b/install/mods-for-hesk/database-validation.php @@ -65,21 +65,21 @@ hesk_dbConnect(); output_header_row('1.0.0 - 1.3.x'); $all_good = run_table_check('statuses'); - $all_good = $all_good & run_column_check('statuses', '`ID`'); - $all_good = $all_good & run_column_check('statuses', '`TextColor`'); - $all_good = $all_good & run_column_check('statuses', '`IsNewTicketStatus`'); - $all_good = $all_good & run_column_check('statuses', '`IsClosed`'); - $all_good = $all_good & run_column_check('statuses', '`IsClosedByClient`'); - $all_good = $all_good & run_column_check('statuses', '`IsCustomerReplyStatus`'); - $all_good = $all_good & run_column_check('statuses', '`IsStaffClosedOption`'); - $all_good = $all_good & run_column_check('statuses', '`IsStaffReopenedStatus`'); - $all_good = $all_good & run_column_check('statuses', '`IsDefaultStaffReplyStatus`'); - $all_good = $all_good & run_column_check('statuses', '`LockedTicketStatus`'); - $all_good = $all_good & run_column_check('statuses', '`IsAutocloseOption`'); - $all_good = $all_good & run_column_check('statuses', '`Closable`'); + $all_good = $all_good & run_column_check('statuses', 'ID'); + $all_good = $all_good & run_column_check('statuses', 'TextColor'); + $all_good = $all_good & run_column_check('statuses', 'IsNewTicketStatus'); + $all_good = $all_good & run_column_check('statuses', 'IsClosed'); + $all_good = $all_good & run_column_check('statuses', 'IsClosedByClient'); + $all_good = $all_good & run_column_check('statuses', 'IsCustomerReplyStatus'); + $all_good = $all_good & run_column_check('statuses', 'IsStaffClosedOption'); + $all_good = $all_good & run_column_check('statuses', 'IsStaffReopenedStatus'); + $all_good = $all_good & run_column_check('statuses', 'IsDefaultStaffReplyStatus'); + $all_good = $all_good & run_column_check('statuses', 'LockedTicketStatus'); + $all_good = $all_good & run_column_check('statuses', 'IsAutocloseOption'); + $all_good = $all_good & run_column_check('statuses', 'Closable'); output_header_row('1.5.0'); - $all_good = $all_good & run_column_check('users', '`active`'); - $all_good = $all_good & run_column_check('users', '`notify_note_unassigned`'); + $all_good = $all_good & run_column_check('users', 'active'); + $all_good = $all_good & run_column_check('users', 'notify_note_unassigned'); output_header_row('1.6.0'); $all_good = $all_good & run_table_check('settings'); output_header_row('1.7.0'); @@ -87,86 +87,103 @@ hesk_dbConnect(); $all_good = $all_good & run_table_check('pending_verification_emails'); $all_good = $all_good & run_table_check('stage_tickets'); output_header_row('2.3.0'); - $all_good = $all_good & run_column_check('service_messages', '`icon`'); - $all_good = $all_good & run_column_check('statuses', '`Key`'); - $all_good = $all_good & run_column_check('tickets', '`latitude`'); - $all_good = $all_good & run_column_check('tickets', '`longitude`'); - $all_good = $all_good & run_column_check('stage_tickets', '`latitude`'); - $all_good = $all_good & run_column_check('stage_tickets', '`longitude`'); - $all_good = $all_good & run_column_check('categories', '`manager`'); - $all_good = $all_good & run_column_check('users', '`permission_template`'); + $all_good = $all_good & run_column_check('service_messages', 'icon'); + $all_good = $all_good & run_column_check('statuses', 'Key'); + $all_good = $all_good & run_column_check('tickets', 'latitude'); + $all_good = $all_good & run_column_check('tickets', 'longitude'); + $all_good = $all_good & run_column_check('stage_tickets', 'latitude'); + $all_good = $all_good & run_column_check('stage_tickets', 'longitude'); + $all_good = $all_good & run_column_check('categories', 'manager'); + $all_good = $all_good & run_column_check('users', 'permission_template'); $all_good = $all_good & run_table_check('permission_templates'); - $all_good = $all_good & run_column_check('permission_templates', '`id`'); - $all_good = $all_good & run_column_check('permission_templates', '`name`'); - $all_good = $all_good & run_column_check('permission_templates', '`heskprivileges`'); - $all_good = $all_good & run_column_check('permission_templates', '`categories`'); + $all_good = $all_good & run_column_check('permission_templates', 'id'); + $all_good = $all_good & run_column_check('permission_templates', 'name'); + $all_good = $all_good & run_column_check('permission_templates', 'heskprivileges'); + $all_good = $all_good & run_column_check('permission_templates', 'categories'); output_header_row('2.4.0'); $all_good = $all_good & run_table_check('quick_help_sections'); - $all_good = $all_good & run_column_check('quick_help_sections', '`id`'); - $all_good = $all_good & run_column_check('quick_help_sections', '`location`'); - $all_good = $all_good & run_column_check('quick_help_sections', '`show`'); + $all_good = $all_good & run_column_check('quick_help_sections', 'id'); + $all_good = $all_good & run_column_check('quick_help_sections', 'location'); + $all_good = $all_good & run_column_check('quick_help_sections', 'show'); $all_good = $all_good & run_table_check('text_to_status_xref'); - $all_good = $all_good & run_column_check('text_to_status_xref', '`id`'); - $all_good = $all_good & run_column_check('text_to_status_xref', '`language`'); - $all_good = $all_good & run_column_check('text_to_status_xref', '`text`'); - $all_good = $all_good & run_column_check('text_to_status_xref', '`status_id`'); - $all_good = $all_good & run_column_check('statuses', '`sort`'); - $all_good = $all_good & run_column_check('attachments', '`download_count`'); - $all_good = $all_good & run_column_check('kb_attachments', '`download_count`'); - $all_good = $all_good & run_column_check('tickets', '`html`'); - $all_good = $all_good & run_column_check('stage_tickets', '`html`'); - $all_good = $all_good & run_column_check('replies', '`html`'); + $all_good = $all_good & run_column_check('text_to_status_xref', 'id'); + $all_good = $all_good & run_column_check('text_to_status_xref', 'language'); + $all_good = $all_good & run_column_check('text_to_status_xref', 'text'); + $all_good = $all_good & run_column_check('text_to_status_xref', 'status_id'); + $all_good = $all_good & run_column_check('statuses', 'sort'); + $all_good = $all_good & run_column_check('attachments', 'download_count'); + $all_good = $all_good & run_column_check('kb_attachments', 'download_count'); + $all_good = $all_good & run_column_check('tickets', 'html'); + $all_good = $all_good & run_column_check('stage_tickets', 'html'); + $all_good = $all_good & run_column_check('replies', 'html'); output_header_row('2.5.0'); - $all_good = $all_good & run_column_check('tickets', '`user_agent`'); - $all_good = $all_good & run_column_check('tickets', '`screen_resolution_width`'); - $all_good = $all_good & run_column_check('tickets', '`screen_resolution_height`'); - $all_good = $all_good & run_column_check('stage_tickets', '`user_agent`'); - $all_good = $all_good & run_column_check('stage_tickets', '`screen_resolution_width`'); - $all_good = $all_good & run_column_check('stage_tickets', '`screen_resolution_height`'); + $all_good = $all_good & run_column_check('tickets', 'user_agent'); + $all_good = $all_good & run_column_check('tickets', 'screen_resolution_width'); + $all_good = $all_good & run_column_check('tickets', 'screen_resolution_height'); + $all_good = $all_good & run_column_check('stage_tickets', 'user_agent'); + $all_good = $all_good & run_column_check('stage_tickets', 'screen_resolution_width'); + $all_good = $all_good & run_column_check('stage_tickets', 'screen_resolution_height'); output_header_row('2.6.0'); $all_good = $all_good & run_table_check('logging'); - $all_good = $all_good & run_column_check('logging', '`id`'); - $all_good = $all_good & run_column_check('logging', '`username`'); - $all_good = $all_good & run_column_check('logging', '`message`'); - $all_good = $all_good & run_column_check('logging', '`severity`'); - $all_good = $all_good & run_column_check('logging', '`location`'); - $all_good = $all_good & run_column_check('logging', '`timestamp`'); + $all_good = $all_good & run_column_check('logging', 'id'); + $all_good = $all_good & run_column_check('logging', 'username'); + $all_good = $all_good & run_column_check('logging', 'message'); + $all_good = $all_good & run_column_check('logging', 'severity'); + $all_good = $all_good & run_column_check('logging', 'location'); + $all_good = $all_good & run_column_check('logging', 'timestamp'); $all_good = $all_good & run_table_check('user_api_tokens'); - $all_good = $all_good & run_column_check('user_api_tokens', '`id`'); - $all_good = $all_good & run_column_check('user_api_tokens', '`user_id`'); - $all_good = $all_good & run_column_check('user_api_tokens', '`token`'); + $all_good = $all_good & run_column_check('user_api_tokens', 'id'); + $all_good = $all_good & run_column_check('user_api_tokens', 'user_id'); + $all_good = $all_good & run_column_check('user_api_tokens', 'token'); $all_good = $all_good & run_table_check('temp_attachment'); - $all_good = $all_good & run_column_check('temp_attachment', '`id`'); - $all_good = $all_good & run_column_check('temp_attachment', '`file_name`'); - $all_good = $all_good & run_column_check('temp_attachment', '`saved_name`'); - $all_good = $all_good & run_column_check('temp_attachment', '`size`'); - $all_good = $all_good & run_column_check('temp_attachment', '`type`'); - $all_good = $all_good & run_column_check('temp_attachment', '`date_uploaded`'); + $all_good = $all_good & run_column_check('temp_attachment', 'id'); + $all_good = $all_good & run_column_check('temp_attachment', 'file_name'); + $all_good = $all_good & run_column_check('temp_attachment', 'saved_name'); + $all_good = $all_good & run_column_check('temp_attachment', 'size'); + $all_good = $all_good & run_column_check('temp_attachment', 'type'); + $all_good = $all_good & run_column_check('temp_attachment', 'date_uploaded'); $all_good = $all_good & run_table_check('calendar_event'); - $all_good = $all_good & run_column_check('calendar_event', '`id`'); - $all_good = $all_good & run_column_check('calendar_event', '`start`'); - $all_good = $all_good & run_column_check('calendar_event', '`end`'); - $all_good = $all_good & run_column_check('calendar_event', '`all_day`'); - $all_good = $all_good & run_column_check('calendar_event', '`name`'); - $all_good = $all_good & run_column_check('calendar_event', '`location`'); - $all_good = $all_good & run_column_check('calendar_event', '`comments`'); - $all_good = $all_good & run_column_check('calendar_event', '`category`'); + $all_good = $all_good & run_column_check('calendar_event', 'id'); + $all_good = $all_good & run_column_check('calendar_event', 'start'); + $all_good = $all_good & run_column_check('calendar_event', 'end'); + $all_good = $all_good & run_column_check('calendar_event', 'all_day'); + $all_good = $all_good & run_column_check('calendar_event', 'name'); + $all_good = $all_good & run_column_check('calendar_event', 'location'); + $all_good = $all_good & run_column_check('calendar_event', 'comments'); + $all_good = $all_good & run_column_check('calendar_event', 'category'); $all_good = $all_good & run_table_check('calendar_event_reminder'); - $all_good = $all_good & run_column_check('calendar_event_reminder', '`id`'); - $all_good = $all_good & run_column_check('calendar_event_reminder', '`user_id`'); - $all_good = $all_good & run_column_check('calendar_event_reminder', '`event_id`'); - $all_good = $all_good & run_column_check('calendar_event_reminder', '`amount`'); - $all_good = $all_good & run_column_check('calendar_event_reminder', '`unit`'); - $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`'); - $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`'); + $all_good = $all_good & run_column_check('calendar_event_reminder', 'id'); + $all_good = $all_good & run_column_check('calendar_event_reminder', 'user_id'); + $all_good = $all_good & run_column_check('calendar_event_reminder', 'event_id'); + $all_good = $all_good & run_column_check('calendar_event_reminder', 'amount'); + $all_good = $all_good & run_column_check('calendar_event_reminder', 'unit'); + $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', 'usage'); + $all_good = $all_good & run_column_check('users', 'notify_overdue_unassigned'); + $all_good = $all_good & run_column_check('users', 'default_calendar_view'); output_header_row('2.6.2'); - $all_good = $all_good & run_column_check('stage_tickets', '`due_date`'); - $all_good = $all_good & run_column_check('stage_tickets', '`overdue_email_sent`'); + $all_good = $all_good & run_column_check('stage_tickets', 'due_date'); + $all_good = $all_good & run_column_check('stage_tickets', 'overdue_email_sent'); + output_header_row('3.1.0'); + $all_good = $all_good & run_column_check('categories', 'background_color'); + $all_good = $all_good & run_column_check('categories', 'foreground_color'); + $all_good = $all_good & run_column_check('categories', 'display_border_outline'); + $all_good = $all_good & run_column_check('logging', 'stack_trace'); + $all_good = $all_good & run_table_check('custom_nav_element'); + $all_good = $all_good & run_column_check('custom_nav_element', 'id'); + $all_good = $all_good & run_column_check('custom_nav_element', 'image_url'); + $all_good = $all_good & run_column_check('custom_nav_element', 'font_icon'); + $all_good = $all_good & run_column_check('custom_nav_element', 'place'); + $all_good = $all_good & run_column_check('custom_nav_element', 'url'); + $all_good = $all_good & run_column_check('custom_nav_element', 'sort'); + $all_good = $all_good & run_table_check('custom_nav_element_to_text'); + $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'id'); + $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'nav_element_id'); + $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'language'); + $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'text'); + $all_good = $all_good & run_column_check('custom_nav_element_to_text', 'subtext'); if ($all_good) { echo ""; @@ -194,7 +211,7 @@ function run_column_check($table_name, $column_name) { output_result('Table Exists: ' . $table_name, $all_good); } else { - $all_good = run_check('SELECT ' . $column_name . ' FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1'); + $all_good = run_check('SELECT `' . $column_name . '` FROM `' . $hesk_settings['db_pfix'] . $table_name . '` LIMIT 1'); output_result('Column Exists: ' . $table_name . '.' . $column_name, $all_good); } diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index c9bd0063..b2faa81a 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -1006,6 +1006,9 @@ function execute310Scripts() { language VARCHAR(200) NOT NULL, text VARCHAR(200) NOT NULL, subtext VARCHAR(200))"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `foreground_color` VARCHAR(7) NOT NULL DEFAULT 'AUTO'"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `display_border_outline` ENUM('0','1') NOT NULL DEFAULT '0'"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` CHANGE `color` `background_color` VARCHAR(7) NOT NULL DEFAULT '#FFFFFF'"); updateVersion('3.1.0'); } \ No newline at end of file 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..9c87e458 100644 --- a/internal-api/dao/calendar_dao.php +++ b/internal-api/dao/calendar_dao.php @@ -6,7 +6,8 @@ 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 `background_color`, + `categories`.`foreground_color` AS `foreground_color`, `categories`.`display_border_outline` AS `display_border` "; if ($staff) { $sql .= ",`reminders`.`amount` AS `reminder_value`, `reminders`.`unit` AS `reminder_unit` "; @@ -47,7 +48,9 @@ function get_events($start, $end, $hesk_settings, $staff = true) { $event['comments'] = $row['comments']; $event['categoryId'] = $row['category']; $event['categoryName'] = $row['category_name']; - $event['categoryColor'] = $row['category_color']; + $event['backgroundColor'] = $row['background_color']; + $event['foregroundColor'] = $row['foreground_color']; + $event['displayBorder'] = $row['display_border']; if ($staff) { $event['reminderValue'] = $row['reminder_value']; @@ -63,7 +66,8 @@ 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 `background_color`, + `categories`.`foreground_color` AS `foreground_color`, `categories`.`display_border_outline` AS `display_border`, 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` @@ -94,7 +98,9 @@ function get_events($start, $end, $hesk_settings, $staff = true) { $event['url'] = $hesk_settings['hesk_url'] . '/' . $hesk_settings['admin_dir'] . '/admin_ticket.php?track=' . $event['trackingId']; $event['categoryId'] = $row['category']; $event['categoryName'] = $row['category_name']; - $event['categoryColor'] = $row['category_color']; + $event['backgroundColor'] = $row['background_color']; + $event['foregroundColor'] = $row['foreground_color']; + $event['displayBorder'] = $row['display_border']; $event['owner'] = $row['owner_name']; $priorities = array( diff --git a/js/calendar/mods-for-hesk-calendar-admin-readonly.js b/js/calendar/mods-for-hesk-calendar-admin-readonly.js index c06ba37d..c3d086c8 100644 --- a/js/calendar/mods-for-hesk-calendar-admin-readonly.js +++ b/js/calendar/mods-for-hesk-calendar-admin-readonly.js @@ -89,9 +89,17 @@ $(document).ready(function() { .tip() .css('padding', '0') .find('.popover-title') - .css('background-color', event.color === '#fff' ? '#f7f7f7' : event.color) + .css('background-color', event.backgroundColor) .addClass('background-volatile'); + if (event.textColor === 'AUTO') { + $eventMarkup.addClass('background-volatile'); + } else { + $eventMarkup.data('bs.popover').tip().find('.popover-title') + .css('color', event.textColor) + .css('border', 'solid 1px ' + event.borderColor); + } + $eventMarkup.popover('show'); refreshBackgroundVolatileItems(); }, @@ -120,7 +128,9 @@ function buildEvent(id, dbObject) { trackingId: dbObject.trackingId, start: moment(dbObject.startTime), url: dbObject.url, - color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, + backgroundColor: dbObject.backgroundColor, + textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor, + borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor, allDay: true, type: dbObject.type, categoryId: dbObject.categoryId, @@ -128,7 +138,6 @@ function buildEvent(id, dbObject) { className: 'category-' + dbObject.categoryId, owner: dbObject.owner, priority: dbObject.priority, - textColor: calculateTextColor(dbObject.categoryColor), fontIconMarkup: getIcon(dbObject) }; } @@ -151,8 +160,9 @@ function buildEvent(id, dbObject) { categoryId: dbObject.categoryId, categoryName: dbObject.categoryName, className: 'category-' + dbObject.categoryId, - color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, - textColor: calculateTextColor(dbObject.categoryColor), + backgroundColor: dbObject.backgroundColor, + textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor, + borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor, reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue, reminderUnits: dbObject.reminderUnits, fontIconMarkup: '' @@ -170,7 +180,7 @@ function getIcon(dbObject) { } function calculateTextColor(color) { - if (color === null || color === '') { + if (color === null || color === '' || color === undefined) { return 'black'; } diff --git a/js/calendar/mods-for-hesk-calendar-readonly.js b/js/calendar/mods-for-hesk-calendar-readonly.js index 16be40a1..ebddd6cd 100644 --- a/js/calendar/mods-for-hesk-calendar-readonly.js +++ b/js/calendar/mods-for-hesk-calendar-readonly.js @@ -78,9 +78,17 @@ $(document).ready(function() { .tip() .css('padding', '0') .find('.popover-title') - .css('background-color', event.color === '#fff' ? '#f7f7f7' : event.color) + .css('background-color', event.backgroundColor) .addClass('background-volatile'); + if (event.textColor === 'AUTO') { + $eventMarkup.addClass('background-volatile'); + } else { + $eventMarkup.data('bs.popover').tip().find('.popover-title') + .css('color', event.textColor) + .css('border', 'solid 1px ' + event.borderColor); + } + $eventMarkup.popover('show'); refreshBackgroundVolatileItems(); }, @@ -116,15 +124,16 @@ function buildEvent(id, dbObject) { categoryId: dbObject.categoryId, categoryName: dbObject.categoryName, className: 'category-' + dbObject.categoryId, - color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, - textColor: calculateTextColor(dbObject.categoryColor), + backgroundColor: dbObject.backgroundColor, + textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor, + borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor, reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue, reminderUnits: dbObject.reminderUnits }; } function calculateTextColor(color) { - if (color === null || color === '') { + if (color === null || color === '' || color === undefined) { return 'black'; } diff --git a/js/calendar/mods-for-hesk-calendar.js b/js/calendar/mods-for-hesk-calendar.js index 46bca008..de39d1a0 100644 --- a/js/calendar/mods-for-hesk-calendar.js +++ b/js/calendar/mods-for-hesk-calendar.js @@ -102,8 +102,16 @@ $(document).ready(function() { .tip() .css('padding', '0') .find('.popover-title') - .css('background-color', event.color === '#fff' ? '#f7f7f7' : event.color) - .addClass('background-volatile'); + .css('background-color', event.backgroundColor); + + if (event.textColor === 'AUTO') { + $eventMarkup.addClass('background-volatile'); + } else { + $eventMarkup.data('bs.popover').tip().find('.popover-title') + .css('color', event.textColor) + .css('border', 'solid 1px ' + event.borderColor); + } + $eventMarkup.popover('show'); refreshBackgroundVolatileItems(); @@ -282,7 +290,9 @@ function buildEvent(id, dbObject) { trackingId: dbObject.trackingId, start: moment(dbObject.startTime), url: dbObject.url, - color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, + backgroundColor: dbObject.backgroundColor, + textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor, + borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor, allDay: true, type: dbObject.type, categoryId: dbObject.categoryId, @@ -290,7 +300,6 @@ function buildEvent(id, dbObject) { className: 'category-' + dbObject.categoryId, owner: dbObject.owner, priority: dbObject.priority, - textColor: calculateTextColor(dbObject.categoryColor), fontIconMarkup: getIcon(dbObject) }; } @@ -299,7 +308,7 @@ function buildEvent(id, dbObject) { if (dbObject.allDay) { endTime.add(1, 'days'); } - + console.log(dbObject); return { id: id, title: dbObject.title, @@ -313,8 +322,9 @@ function buildEvent(id, dbObject) { categoryId: dbObject.categoryId, categoryName: dbObject.categoryName, className: 'category-' + dbObject.categoryId, - color: dbObject.categoryColor === '' || dbObject.categoryColor === null ? '#fff' : dbObject.categoryColor, - textColor: calculateTextColor(dbObject.categoryColor), + backgroundColor: dbObject.backgroundColor, + textColor: dbObject.foregroundColor === 'AUTO' ? calculateTextColor(dbObject.backgroundColor) : dbObject.foregroundColor, + borderColor: parseInt(dbObject.displayBorder) === 1 ? dbObject.foregroundColor : dbObject.backgroundColor, reminderValue: dbObject.reminderValue == null ? '' : dbObject.reminderValue, reminderUnits: dbObject.reminderUnits, fontIconMarkup: '' @@ -332,7 +342,7 @@ function getIcon(dbObject) { } function calculateTextColor(color) { - if (color === null || color === '') { + if (color === null || color === '' || color === undefined) { return 'black'; } diff --git a/language/en/text.php b/language/en/text.php index ab5ae57e..cb790216 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -1965,8 +1965,6 @@ $hesklang['attachment_cancel'] = 'Cancel'; $hesklang['attachment_confirm_cancel'] = 'Are you sure you want to cancel this upload?'; $hesklang['attachment_remove'] = 'Remove attachment'; $hesklang['due_date'] = 'Due Date'; -$hesklang['category_color'] = 'Color'; -$hesklang['category_color_help'] = 'The hex code for the color to be used on the view ticket screen and calendar. Leave blank for no color'; $hesklang['category_updated'] = 'Changes to %s have been saved'; $hesklang['new_event'] = 'New Event'; $hesklang['create_event'] = 'Create Event'; @@ -2127,6 +2125,12 @@ $hesklang['customer_view'] = 'Customer View'; $hesklang['admin_panel'] = 'Admin Panel'; $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_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). This is ignored if foreground color is set to automatic.'; // DO NOT CHANGE BELOW if (!defined('IN_SCRIPT')) die('PHP syntax OK!');