Browse Source

Getting started on enhanced color changes

tags/3.1.0
Mike Koch 2 years ago
parent
commit
a043dced97
3 changed files with 57 additions and 33 deletions
  1. 51
    31
      admin/manage_categories.php
  2. 3
    0
      install/mods-for-hesk/sql/installSql.php
  3. 3
    2
      language/en/text.php

+ 51
- 31
admin/manage_categories.php View File

@@ -277,11 +277,15 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
}

$tmp = $i ? 'White' : 'Blue';
$style = '';
if ($mycat['color'] == null) {
$style .= 'color: black; border: solid 1px #000';
} else {
$style .= 'background: ' . $mycat['color'];
$style = 'background: ' . $mycat['background_color'];
$backgroundVolatile = 'background-volatile';
if ($mycat['foreground_color'] != 'AUTO') {
$style .= '; color: ' . $mycat['foreground_color'];
$backgroundVolatile = '';

if ($mycat['display_border_outline']) {
$style .= '; border: solid 1px ' . $mycat['foreground_color'];
}
}
$i = $i ? 0 : 1;

@@ -319,10 +323,12 @@ while ($mycat = hesk_dbFetchAssoc($res)) {

echo '
<tr data-category-id="' . $mycat['id'] . '" data-name="' . htmlspecialchars($mycat['name']) . '"
data-color="'. htmlspecialchars($mycat['color']) . '" data-priority="' . $mycat['priority'] . '"
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-manager="' . $mycat['manager'] . '" data-usage="'. $mycat['usage'] .'">
<td style="display: none">' . $mycat['id'] . '</td>
<td><span class="label background-volatile category-label" style="'.$style.'">' . $mycat['name'] . '</span></td>
<td><span class="label ' . $backgroundVolatile . ' category-label" style="'.$style.'">' . $mycat['name'] . '</span></td>
<td width="1" style="white-space: nowrap;">' . $priorities[$mycat['priority']]['formatted'] . '</td>
<td><a href="show_tickets.php?category=' . $mycat['id'] . '&amp;s_all=1&amp;s_my=1&amp;s_ot=1&amp;s_un=1" alt="' . $hesklang['list_tickets_cat'] . '" title="' . $hesklang['list_tickets_cat'] . '">' . $all . '</a></td>
<td>
@@ -386,15 +392,28 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
</div>
</div>
<div class="form-group">
<label for="color" class="col-sm-3 control-label">
<?php echo $hesklang['category_color']; ?>
<label for="background-color" class="col-sm-3 control-label">
<?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>
</label>
<div class="col-sm-9">
<input type="text" name="background-color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_background_color']; ?>">
<div class="help-block with-errors"></div>
</div>
</div>
<div class="form-group">
<label for="foreground-color" class="col-sm-3 control-label">
<?php echo $hesklang['category_foreground_color']; ?>
<i class="fa fa-question-circle settingsquestionmark" data-toggle="popover"
title="<?php echo htmlspecialchars($hesklang['category_color']); ?>"
title="<?php echo htmlspecialchars($hesklang['category_foreground_color']); ?>"
data-content="<?php echo htmlspecialchars($hesklang['category_color_help']); ?>"></i>
</label>
<div class="col-sm-9">
<input type="text" name="color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_color']; ?>">
<input type="text" name="foreground-color" class="form-control category-colorpicker"
placeholder="<?php echo $hesklang['category_foreground_color']; ?>">
<div class="help-block with-errors"></div>
</div>
</div>
@@ -471,7 +490,8 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
var name = tempNameElement.value;

var id = $row.attr('data-category-id');
var color = $row.attr('data-color');
var backgroundColor = $row.attr('data-background-color');
var foregroundColor = $row.attr('data-foreground-color');
var priority = $row.attr('data-priority');
var manager = $row.attr('data-manager');
var usage = $row.attr('data-usage');
@@ -482,29 +502,29 @@ while ($mycat = hesk_dbFetchAssoc($res)) {
.find('select[name="manager"]').val(manager).end()
.find('input[name="id"]').val(id).end()
.find('select[name="usage"]').val(usage).end()
.find('input[name="color"]').val(color).end();

var colorpickerOptions = null;
if (color == '') {
colorpickerOptions = {
format: 'hex'
};
} else {
colorpickerOptions = {
format: 'hex',
color: color
};
}
$modal.find('input[name="color"]')
.find('input[name="background-color"]').val(backgroundColor).end()
.find('input[name="foreground-color"]').val(foregroundColor).end();

var colorpickerOptions = {
format: 'hex',
color: backgroundColor
};
$modal.find('input[name="background-color"]')
.colorpicker(colorpickerOptions).end().modal('show');
colorpickerOptions = {
format: 'hex',
color: foregroundColor
};

if (color == '') {
$modal.find('input[name="color"]').val('');
}
$modal.find('input[name="foreground-color"]')
.colorpicker(colorpickerOptions).end().modal('show');
});

$('.cancel-callback').click(function() {
$('#edit-category-modal').find('input[name="color"]').val('').colorpicker('destroy').end();
var $editCategoryModal = $('#edit-category-modal');

$editCategoryModal.find('input[name="background-color"]').val('').colorpicker('destroy').end();
$editCategoryModal.find('input[name="foreground-color"]').val('').colorpicker('destroy').end();
});
});
</script>

+ 3
- 0
install/mods-for-hesk/sql/installSql.php View File

@@ -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');
}

+ 3
- 2
language/en/text.php View File

@@ -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 <i>%s</i> have been saved';
$hesklang['new_event'] = 'New Event';
$hesklang['create_event'] = 'Create Event';
@@ -2127,6 +2125,9 @@ $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_color_help'] = 'The hex code for the color to be used on the view ticket screen and calendar.';

// DO NOT CHANGE BELOW
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');

Loading…
Cancel
Save