From 0743f63982a33d5cd0bde5c906f24bce737eb666 Mon Sep 17 00:00:00 2001 From: Mike Koch Date: Sun, 14 Feb 2016 22:25:55 -0500 Subject: [PATCH] more work on category colors --- admin/calendar.php | 14 ++++++++---- admin/manage_categories.php | 29 +++++++++++++++++++++--- install/mods-for-hesk/sql/installSql.php | 1 + language/en/text.php | 2 ++ 4 files changed, 39 insertions(+), 7 deletions(-) diff --git a/admin/calendar.php b/admin/calendar.php index 878715aa..d96269cb 100644 --- a/admin/calendar.php +++ b/admin/calendar.php @@ -119,10 +119,12 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); title="Category for the event">
- '.$hesklang['select'].''; + echo ''; } foreach ($categories as $category): ?> +
@@ -253,10 +256,12 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php'); title="Category for the event">
- '.$hesklang['select'].''; + echo ''; } foreach ($categories as $category): ?> +
diff --git a/admin/manage_categories.php b/admin/manage_categories.php index 7437c532..6f106775 100644 --- a/admin/manage_categories.php +++ b/admin/manage_categories.php @@ -165,6 +165,19 @@ while ($mycat = hesk_dbFetchAssoc($res)) { +
+ +
+ +
+
@@ -299,6 +312,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) { + @@ -337,7 +351,12 @@ while ($mycat = hesk_dbFetchAssoc($res)) { } $tmp = $i ? 'White' : 'Blue'; - $style = 'class="option' . $tmp . 'OFF" onmouseover="this.className=\'option' . $tmp . 'ON\'" onmouseout="this.className=\'option' . $tmp . 'OFF\'"'; + $style = 'font-weight:normal;font-size:1em'; + if ($mycat['color'] == null) { + $style .= ';color: black'; + } else { + $style .= ';background: ' . $mycat['color']; + } $i = $i ? 0 : 1; /* Number of tickets and graph width */ @@ -375,7 +394,7 @@ while ($mycat = hesk_dbFetchAssoc($res)) { echo ' ' . $mycat['id'] . ' - ' . $mycat['name'] . ' + ' . $mycat['name'] . ' ' . $priorities[$mycat['priority']]['formatted'] . ' ' . $all . ' @@ -535,6 +554,10 @@ function new_cat() /* Category name */ $catname = hesk_input(hesk_POST('name'), $hesklang['enter_cat_name'], 'manage_categories.php'); + $color = hesk_POST('color', null); + $color = str_replace('#', '', $color); + $color = $color != null ? "'#" . hesk_dbEscape($color) . "'" : 'NULL'; + /* Do we already have a category with this name? */ $res = hesk_dbQuery("SELECT `id` FROM `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` WHERE `name` LIKE '" . hesk_dbEscape(hesk_dbLike($catname)) . "' LIMIT 1"); if (hesk_dbNumRows($res) != 0) { @@ -547,7 +570,7 @@ function new_cat() $row = hesk_dbFetchRow($res); $my_order = $row[0] + 10; - hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}')"); + hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` (`name`,`cat_order`,`autoassign`,`type`, `priority`, `color`) VALUES ('" . hesk_dbEscape($catname) . "','" . intval($my_order) . "','" . intval($_SESSION['cat_autoassign']) . "','" . intval($_SESSION['cat_type']) . "','{$_SESSION['cat_priority']}', {$color})"); hesk_cleanSessionVars('catname'); hesk_cleanSessionVars('cat_autoassign'); diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index 11b397f5..95d3fd81 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -730,5 +730,6 @@ function execute260Scripts() `comments` MEDIUMTEXT, `category` INT) ENGINE = MyISAM DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci"); executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "tickets` ADD COLUMN `due_date` DATETIME"); + executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories` ADD COLUMN `color` VARCHAR(7)"); executeQuery("UPDATE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "settings` SET `Value` = '2.6.0' WHERE `Key` = 'modsForHeskVersion'"); } \ No newline at end of file diff --git a/language/en/text.php b/language/en/text.php index 883480d7..84314040 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -40,6 +40,8 @@ $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'; // ADDED OR MODIFIED IN Mods for HESK 2.5.2 $hesklang['manage_statuses'] = 'Manage Statuses';