@@ -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'); | |||
<?php foreach ($categories as $category): ?> | |||
<li> | |||
<div class="ticket-info"> | |||
<div class="hide-on-overflow no-wrap event-category background-volatile" | |||
<div class="hide-on-overflow no-wrap event-category <?php echo $category['background_volatile']; ?>" | |||
data-select-toggle="category-toggle" data-name="category-toggle" data-category-value="<?php echo $category['id']; ?>" | |||
data-checked="1" | |||
data-toggle="tooltip" |
@@ -287,6 +287,11 @@ while ($mycat = hesk_dbFetchAssoc($res)) { | |||
$style .= '; border: solid 1px ' . $mycat['foreground_color']; | |||
} | |||
} | |||
if ($mycat['foreground_color'] == 'AUTO') { | |||
$mycat['foreground_color'] = ''; | |||
} | |||
$i = $i ? 0 : 1; | |||
/* Number of tickets and graph width */ | |||
@@ -325,7 +330,8 @@ while ($mycat = hesk_dbFetchAssoc($res)) { | |||
<tr data-category-id="' . $mycat['id'] . '" data-name="' . htmlspecialchars($mycat['name']) . '" | |||
data-foreground-color="' . htmlspecialchars($mycat['foreground_color']) . '" | |||
data-border="' . $mycat['display_border_outline'] . '" | |||
data-background-color="'. htmlspecialchars($mycat['background_color']) . '" data-priority="' . $mycat['priority'] . '" | |||
data-background-color="'. htmlspecialchars($mycat['background_color']) . '" | |||
data-priority="' . $mycat['priority'] . '" | |||
data-manager="' . $mycat['manager'] . '" data-usage="'. $mycat['usage'] .'"> | |||
<td style="display: none">' . $mycat['id'] . '</td> | |||
<td><span class="label ' . $backgroundVolatile . ' category-label" style="'.$style.'">' . $mycat['name'] . '</span></td> | |||
@@ -334,7 +340,6 @@ while ($mycat = hesk_dbFetchAssoc($res)) { | |||
<td> | |||
<div class="progress" style="width: 160px; margin-bottom: 0" title="' . sprintf($hesklang['perat'], $width_all . '%') . '" data-toggle="tooltip"> | |||
<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width: ' . $width_all . '%"> | |||
<span class="sr-only">40% Complete (success)</span> | |||
</div> | |||
</div> | |||
</td> | |||
@@ -396,12 +401,13 @@ while ($mycat = hesk_dbFetchAssoc($res)) { | |||
<?php echo $hesklang['category_background_color']; ?> | |||
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" | |||
title="<?php echo htmlspecialchars($hesklang['category_background_color']); ?>" | |||
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i> | |||
data-content="<?php echo htmlspecialchars($hesklang['category_background_color_help']); ?>"></i> | |||
</label> | |||
<div class="col-sm-9"> | |||
<input type="text" name="background-color" class="form-control category-colorpicker" | |||
placeholder="<?php echo $hesklang['category_background_color']; ?>" | |||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>"> | |||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>" | |||
required> | |||
<div class="help-block with-errors"></div> | |||
</div> | |||
</div> | |||
@@ -410,20 +416,18 @@ while ($mycat = hesk_dbFetchAssoc($res)) { | |||
<?php echo $hesklang['category_foreground_color']; ?> | |||
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" | |||
title="<?php echo htmlspecialchars($hesklang['category_foreground_color']); ?>" | |||
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i> | |||
data-content="<?php echo htmlspecialchars($hesklang['category_foreground_color_help']); ?>"></i> | |||
</label> | |||
<div class="col-sm-9"> | |||
<input type="text" name="foreground-color" class="form-control category-colorpicker" | |||
placeholder="<?php echo $hesklang['category_foreground_color']; ?>" | |||
data-error="<?php echo htmlspecialchars($hesklang['this_field_is_required']); ?>" | |||
required> | |||
placeholder="<?php echo $hesklang['category_foreground_color']; ?>"> | |||
<div class="help-block with-errors"></div> | |||
</div> | |||
</div> | |||
<div class="form-group"> | |||
<label for="display-border" class="col-sm-3 control-label"> | |||
<?php echo $hesklang['category_display_border']; ?> | |||
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover" | |||
<i class="fa fa-question-circle settingsquestionmark" data-toggle="htmlpopover" | |||
title="<?php echo htmlspecialchars($hesklang['category_display_border']); ?>" | |||
data-content="<?php echo htmlspecialchars($hesklang['category_display_border_help']); ?>"></i> | |||
</label> | |||
@@ -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) . "'"); | |||
@@ -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'); | |||
<div class="checkbox"> | |||
<input type="checkbox" data-select-target="category-toggle" name="category-toggle" value="<?php echo $category['id']; ?>" checked> | |||
</div> | |||
<div class="hide-on-overflow no-wrap event-category background-volatile" style="<?php echo $category['css_style']; ?>"> | |||
<div class="hide-on-overflow no-wrap event-category <?php echo $category['background_volatile']; ?>" | |||
style="<?php echo $category['css_style']; ?>"> | |||
<?php echo $category['name']; ?> | |||
</div> | |||
</li> |
@@ -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; |
@@ -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`'); |
@@ -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`"); |
@@ -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` |
@@ -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). <b>This is ignored if foreground color is set to automatic.</b>'; | |||
// DO NOT CHANGE BELOW | |||
if (!defined('IN_SCRIPT')) die('PHP syntax OK!'); |