Localized some stuff, add descriptions to create ticket pages
This commit is contained in:
parent
45726bd388
commit
02d965e2d9
@ -375,8 +375,8 @@ $res = hesk_dbQuery("SELECT * FROM `" . hesk_dbEscape($hesk_settings['db_pfix'])
|
||||
<i class="fa fa-info-circle" data-toggle="popover" title="<?php echo $hesklang['description']; ?>"></i>
|
||||
</td>
|
||||
<td>
|
||||
<i style="display: none" class="fa fa-fw fa-lock icon-link gray"></i>
|
||||
<i style="display: none" class="fa fa-fw fa-unlock-alt icon-link blue"></i>
|
||||
<i style="display: none; padding-right: 8px;" class="fa fa-fw fa-lock icon-link gray"></i>
|
||||
<i style="display: none; padding-right: 8px;" class="fa fa-fw fa-unlock-alt icon-link blue"></i>
|
||||
<span data-property="type"></span>
|
||||
</td>
|
||||
<td>
|
||||
@ -437,6 +437,11 @@ echo mfh_get_hidden_fields_for_language(array(
|
||||
'cat_public',
|
||||
'cat_removed',
|
||||
'error_deleting_category',
|
||||
'error_retrieving_categories',
|
||||
'error_saving_updating_category',
|
||||
'copied_to_clipboard',
|
||||
'category_updated',
|
||||
'cat_name_added',
|
||||
'enabled_title_case',
|
||||
'disabled_title_case',
|
||||
'geco',
|
||||
|
@ -113,13 +113,13 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
|
||||
$hesk_settings['categories'] = array();
|
||||
|
||||
if (hesk_checkPermission('can_submit_any_cat', 0)) {
|
||||
$res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC");
|
||||
$res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` ORDER BY `cat_order` ASC");
|
||||
} else {
|
||||
$res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC");
|
||||
$res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE ".hesk_myCategories('id')." ORDER BY `cat_order` ASC");
|
||||
}
|
||||
|
||||
while ($row = hesk_dbFetchAssoc($res)) {
|
||||
$hesk_settings['categories'][$row['id']] = $row['name'];
|
||||
$hesk_settings['categories'][$row['id']] = $row;
|
||||
}
|
||||
|
||||
$number_of_categories = count($hesk_settings['categories']);
|
||||
@ -147,7 +147,7 @@ $show_quick_help = $show['show'];
|
||||
<li><a href="admin_main.php"><?php echo $hesk_settings['hesk_title']; ?></a></li>
|
||||
<?php if ($number_of_categories > 1): ?>
|
||||
<li><a href="new_ticket.php"><?php echo $hesklang['nti2']; ?></a></li>
|
||||
<li class="active"><?php echo $hesk_settings['categories'][$category]; ?></li>
|
||||
<li class="active"><?php echo $hesk_settings['categories'][$category]['name']; ?></li>
|
||||
<?php else: ?>
|
||||
<li class="active"><?php echo $hesklang['nti2']; ?></li>
|
||||
<?php endif; ?>
|
||||
@ -1038,9 +1038,10 @@ function print_select_category($number_of_categories) {
|
||||
// Print a select box if number of categories is large
|
||||
if ($number_of_categories > $hesk_settings['cat_show_select'])
|
||||
{
|
||||
$firstDescription = null;
|
||||
?>
|
||||
<form action="new_ticket.php" method="get">
|
||||
<select name="category" id="select_category" class="form-control">
|
||||
<select name="category" id="select_category" class="form-control" onchange="showDescription()">
|
||||
<?php
|
||||
if ($hesk_settings['select_cat'])
|
||||
{
|
||||
@ -1048,23 +1049,45 @@ function print_select_category($number_of_categories) {
|
||||
}
|
||||
foreach ($hesk_settings['categories'] as $k=>$v)
|
||||
{
|
||||
echo '<option value="'.$k.'">'.$v.'</option>';
|
||||
if ($firstDescription === null) {
|
||||
$firstDescription = $v['mfh_description'];
|
||||
}
|
||||
echo '<option value="'.$k.'" data-description="'.$v['mfh_description'].'">'.$v['name'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
$display = ' style="display: none"';
|
||||
|
||||
<br />
|
||||
|
||||
if (!$hesk_settings['select_cat'] && $firstDescription !== null && trim($firstDescription) !== '') {
|
||||
$display = '';
|
||||
}
|
||||
?>
|
||||
<span id="category-description"<?php echo $display; ?>>
|
||||
<b><?php echo $hesklang['description_colon']; ?></b>
|
||||
<span><?php echo $firstDescription; ?></span>
|
||||
</span>
|
||||
<br>
|
||||
<div style="text-align:center">
|
||||
<input type="submit" value="<?php echo $hesklang['c2c']; ?>" class="btn btn-default">
|
||||
</div>
|
||||
</form>
|
||||
<script>
|
||||
function showDescription() {
|
||||
var $value = $('#select_category').find(':selected');
|
||||
|
||||
if ($value.data('description') !== '') {
|
||||
$('#category-description').show().find('span').text($value.data('description'));
|
||||
} else {
|
||||
$('#category-description').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
<?php
|
||||
}
|
||||
// Otherwise print quick links
|
||||
else
|
||||
{
|
||||
// echo '<li><a href="new_ticket.php?a=add&category='.$k.'">» '.$v.'</a></li>';
|
||||
$new_row = 1;
|
||||
|
||||
foreach ($hesk_settings['categories'] as $k=>$v):
|
||||
@ -1079,7 +1102,14 @@ function print_select_category($number_of_categories) {
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<?php echo $v; ?>
|
||||
<?php
|
||||
echo $v['name'];
|
||||
|
||||
if ($v['mfh_description'] !== null && trim($v['mfh_description']) !== '') {
|
||||
echo ' <i class="fa fa-info-circle" data-toggle="popover"
|
||||
title="'. $hesklang['description'] .'" data-content="' . $v['mfh_description'] . '"></i>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
47
index.php
47
index.php
@ -87,9 +87,10 @@ function print_select_category($number_of_categories)
|
||||
// Print a select box if number of categories is large
|
||||
if ($number_of_categories > $hesk_settings['cat_show_select'])
|
||||
{
|
||||
$firstDescription = null;
|
||||
?>
|
||||
<form action="index.php" method="get">
|
||||
<select name="category" id="select_category" class="form-control">
|
||||
<select name="category" id="select_category" class="form-control" onchange="showDescription()">
|
||||
<?php
|
||||
if ($hesk_settings['select_cat'])
|
||||
{
|
||||
@ -97,17 +98,40 @@ function print_select_category($number_of_categories)
|
||||
}
|
||||
foreach ($hesk_settings['categories'] as $k=>$v)
|
||||
{
|
||||
echo '<option value="'.$k.'">'.$v.'</option>';
|
||||
if ($firstDescription === null) {
|
||||
$firstDescription = $v['mfh_description'];
|
||||
}
|
||||
echo '<option value="'.$k.'" data-description="'.$v['mfh_description'].'">'.$v['name'].'</option>';
|
||||
}
|
||||
?>
|
||||
</select>
|
||||
<?php
|
||||
$display = ' style="display: none"';
|
||||
|
||||
<br />
|
||||
|
||||
if (!$hesk_settings['select_cat'] && $firstDescription !== null && trim($firstDescription) !== '') {
|
||||
$display = '';
|
||||
}
|
||||
?>
|
||||
<span id="category-description"<?php echo $display; ?>>
|
||||
<b><?php echo $hesklang['description_colon']; ?></b>
|
||||
<span><?php echo $firstDescription; ?></span>
|
||||
</span>
|
||||
<br>
|
||||
<div style="text-align:center">
|
||||
<input type="submit" value="<?php echo $hesklang['c2c']; ?>" class="btn btn-default">
|
||||
<input type="hidden" name="a" value="add" />
|
||||
</div>
|
||||
<script>
|
||||
function showDescription() {
|
||||
var $value = $('#select_category').find(':selected');
|
||||
|
||||
if ($value.data('description') !== '') {
|
||||
$('#category-description').show().find('span').text($value.data('description'));
|
||||
} else {
|
||||
$('#category-description').hide();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
@ -128,7 +152,14 @@ function print_select_category($number_of_categories)
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-xs-12">
|
||||
<?php echo $v; ?>
|
||||
<?php
|
||||
echo $v['name'];
|
||||
|
||||
if ($v['mfh_description'] !== null && trim($v['mfh_description']) !== '') {
|
||||
echo ' <i class="fa fa-info-circle" data-toggle="popover"
|
||||
title="'. $hesklang['description'] .'" data-content="' . $v['mfh_description'] . '"></i>';
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -220,9 +251,9 @@ function print_add_ticket()
|
||||
|
||||
// Get categories
|
||||
$hesk_settings['categories'] = array();
|
||||
$res = hesk_dbQuery("SELECT `id`, `name` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE `type`='0' ORDER BY `cat_order` ASC");
|
||||
$res = hesk_dbQuery("SELECT `id`, `name`, `mfh_description` FROM `".hesk_dbEscape($hesk_settings['db_pfix'])."categories` WHERE `type`='0' ORDER BY `cat_order` ASC");
|
||||
while ($row=hesk_dbFetchAssoc($res)) {
|
||||
$hesk_settings['categories'][$row['id']] = $row['name'];
|
||||
$hesk_settings['categories'][$row['id']] = $row;
|
||||
}
|
||||
|
||||
$number_of_categories = count($hesk_settings['categories']);
|
||||
@ -254,7 +285,7 @@ function print_add_ticket()
|
||||
<?php echo $hesklang['sub_support']; ?>
|
||||
</a>
|
||||
</li>
|
||||
<li class="active"><?php echo $hesk_settings['categories'][$category]; ?></li>
|
||||
<li class="active"><?php echo $hesk_settings['categories'][$category]['name']; ?></li>
|
||||
<?php } else { ?>
|
||||
<li class="active"><?php echo $hesklang['sub_support']; ?></li>
|
||||
<?php } ?>
|
||||
|
@ -1130,4 +1130,14 @@ function execute311Scripts() {
|
||||
hesk_dbConnect();
|
||||
|
||||
updateVersion('3.1.1');
|
||||
}
|
||||
|
||||
function execute320Scripts() {
|
||||
global $hesk_settings;
|
||||
hesk_dbConnect();
|
||||
|
||||
executeQuery("ALTER TABLE `" . hesk_dbEscape($hesk_settings['db_pfix']) . "categories`
|
||||
ADD COLUMN `mfh_description` VARCHAR(255)");
|
||||
|
||||
updateVersion('3.2.0');
|
||||
}
|
@ -1,5 +1,8 @@
|
||||
var mfhLang = {
|
||||
text: function(key) {
|
||||
return $('#lang_' + key).text();
|
||||
},
|
||||
html: function(key) {
|
||||
return $('#lang_' + key).html()
|
||||
}
|
||||
};
|
@ -25,7 +25,7 @@ function loadTable() {
|
||||
$tableBody.html('');
|
||||
|
||||
if (data.length === 0) {
|
||||
mfhAlert.error("I couldn't find any categories :(", "No categories found");
|
||||
mfhAlert.error("No categories were found. This shouldn't happen.", "No categories found");
|
||||
$('#overlay').hide();
|
||||
return;
|
||||
}
|
||||
@ -138,7 +138,7 @@ function loadTable() {
|
||||
}
|
||||
},
|
||||
error: function(data) {
|
||||
mfhAlert.errorWithLog(mfhLang.text('Something bad happened...'), data.responseJSON);
|
||||
mfhAlert.errorWithLog(mfhLang.text('error_retrieving_categories'), data.responseJSON);
|
||||
console.error(data);
|
||||
},
|
||||
complete: function() {
|
||||
@ -288,16 +288,19 @@ function bindFormSubmit() {
|
||||
},
|
||||
data: JSON.stringify(data),
|
||||
success: function(data) {
|
||||
var format = undefined;
|
||||
if (categoryId === -1) {
|
||||
mfhAlert.success('CREATED');
|
||||
format = mfhLang.html('cat_name_added');
|
||||
mfhAlert.success(format.replace('%s', data.name));
|
||||
} else {
|
||||
mfhAlert.success('SAVED');
|
||||
format = mfhLang.html('category_updated');
|
||||
mfhAlert.success(format.replace('%s', data.name));
|
||||
}
|
||||
$modal.modal('hide');
|
||||
loadTable();
|
||||
},
|
||||
error: function(data) {
|
||||
mfhAlert.errorWithLog('ERROR SAVING/CREATING', data.responseJSON);
|
||||
mfhAlert.errorWithLog(mfhLang.text('error_saving_updating_category'), data.responseJSON);
|
||||
console.error(data);
|
||||
},
|
||||
complete: function(data) {
|
||||
@ -340,7 +343,7 @@ function bindGenerateLinkModal() {
|
||||
|
||||
$modal.find('.input-group-addon').click(function() {
|
||||
clipboard.copy($modal.find('input[type="text"]').val());
|
||||
mfhAlert.success('Copied to clipboard', 'Success');
|
||||
mfhAlert.success(mfhLang.text('copied_to_clipboard'));
|
||||
});
|
||||
|
||||
$(document).on('click', '[data-property="generate-link"] i.fa-code', function () {
|
||||
|
@ -2178,6 +2178,10 @@ $hesklang['cat_private'] = 'Private';
|
||||
$hesklang['cat_public'] = 'Public';
|
||||
$hesklang['cat_name_description'] = 'Name / Description';
|
||||
$hesklang['error_sorting_categories'] = 'An error occurred sorting categories!';
|
||||
$hesklang['error_retrieving_categories'] = 'An error occurred retrieving categories!';
|
||||
$hesklang['error_saving_updating_category'] = 'An error occurred creating / saving the category!';
|
||||
$hesklang['description_colon'] = 'Description:'; // Same as 'description', but with a colon (:) afterwards
|
||||
$hesklang['copied_to_clipboard'] = 'Copied to clipboard';
|
||||
|
||||
// DO NOT CHANGE BELOW
|
||||
if (!defined('IN_SCRIPT')) die('PHP syntax OK!');
|
||||
|
Loading…
x
Reference in New Issue
Block a user