diff --git a/admin/manage_custom_nav_elements.php b/admin/manage_custom_nav_elements.php
index 3fd46f26..683bb30f 100644
--- a/admin/manage_custom_nav_elements.php
+++ b/admin/manage_custom_nav_elements.php
@@ -134,6 +134,16 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
+
URL[!]
+
Image[!]
diff --git a/api/DataAccess/Navigation/CustomNavElementGateway.php b/api/DataAccess/Navigation/CustomNavElementGateway.php
index 8d80dd9b..81de0679 100644
--- a/api/DataAccess/Navigation/CustomNavElementGateway.php
+++ b/api/DataAccess/Navigation/CustomNavElementGateway.php
@@ -10,7 +10,7 @@ class CustomNavElementGateway extends CommonDao {
function getAllCustomNavElements($heskSettings) {
$this->init();
- $columns = '`t1`.`id`, `t1`.`image_url`, `t1`.`font_icon`, `t1`.`place`, `t2`.`language`, `t2`.`text`, `t2`.`subtext`';
+ $columns = '`t1`.`id`, `t1`.`image_url`, `t1`.`font_icon`, `t1`.`place`, `t1`.`url`, `t2`.`language`, `t2`.`text`, `t2`.`subtext`';
$rs = hesk_dbQuery("SELECT {$columns} FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element` AS `t1`
INNER JOIN `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element_to_text` AS `t2`
@@ -33,6 +33,7 @@ class CustomNavElementGateway extends CommonDao {
$element->place = intval($row['place']);
$element->imageUrl = $row['image_url'];
$element->fontIcon = $row['font_icon'];
+ $element->url = $row['url'];
$element->text = array();
$element->subtext = array();
}
@@ -103,6 +104,7 @@ class CustomNavElementGateway extends CommonDao {
hesk_dbQuery("UPDATE `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element`
SET `image_url` = {$imageUrl},
`font_icon` = {$fontIcon},
+ `url` = '" . hesk_dbEscape($element->url) . "',
`place` = " . intval($element->place) .
" WHERE `id` = " . intval($element->id));
@@ -117,7 +119,7 @@ class CustomNavElementGateway extends CommonDao {
function createCustomNavElement($element, $heskSettings) {
$this->init();
- $rs = hesk_dbQuery("SELECT MAX(`sort`) FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element`
+ $rs = hesk_dbQuery("SELECT MAX(`sort`) AS `sort` FROM `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element`
WHERE `place` = " . intval($element->place));
$maxSort = hesk_dbFetchAssoc($rs);
$sortValue = intval($maxSort['sort']) + 1;
@@ -125,8 +127,8 @@ class CustomNavElementGateway extends CommonDao {
$imageUrl = $element->imageUrl == null ? 'NULL' : "'" . hesk_dbEscape($element->imageUrl) . "'";
$fontIcon = $element->fontIcon == null ? 'NULL' : "'" . hesk_dbEscape($element->fontIcon) . "'";
hesk_dbQuery("INSERT INTO `" . hesk_dbEscape($heskSettings['db_pfix']) . "custom_nav_element`
- (`image_url`, `font_icon`, `place`, `sort`)
- VALUES ({$imageUrl}, {$fontIcon}, " . intval($element->place) . ", " . $sortValue . ")");
+ (`image_url`, `font_icon`, `place`, `sort`, `url`)
+ VALUES ({$imageUrl}, {$fontIcon}, " . intval($element->place) . ", " . $sortValue . ", '" . hesk_dbEscape($element->url) . "')");
$element->id = hesk_dbInsertID();
diff --git a/internal-api/js/manage-custom-nav-elements.js b/internal-api/js/manage-custom-nav-elements.js
index e2cce50a..876fd2b5 100644
--- a/internal-api/js/manage-custom-nav-elements.js
+++ b/internal-api/js/manage-custom-nav-elements.js
@@ -69,13 +69,15 @@ $(document).ready(function() {
}
var id = parseInt($modal.find('input[name="id"]').val());
+ var navUrl = $modal.find('input[name="url"]').val();
var data = {
place: place,
text: text,
subtext: subtext,
imageUrl: imageUrl,
- fontIcon: fontIcon
+ fontIcon: fontIcon,
+ url: navUrl
};
var url = heskUrl + '/api/v1-internal/custom-navigation/';
@@ -136,7 +138,7 @@ function loadTable(modalToClose) {
if (lastElement !== null) {
//-- Hide the down arrow on the last element
$('[data-value="' + lastElement.id + '"]').parent().parent()
- .find('[data-direction="down"]').find('i').removeClass('fa-arrow-down');
+ .find('[data-direction="down"]').css('visibility', 'hidden');
lastElement = null;
}
@@ -156,7 +158,7 @@ function loadTable(modalToClose) {
$template.find('span[data-property="image-or-font"]').text(this.imageUrl);
}
- $template.find('span[data-property="url"]').text(places[this.url]);
+ $template.find('span[data-property="url"]').text(this.url);
var text = '';
$.each(this.text, function(key, value) {
@@ -174,7 +176,7 @@ function loadTable(modalToClose) {
$template.find('ul[data-property="subtext"]').html(subtext);
if (first) {
- $template.find('[data-direction="up"]').find('i').removeClass('fa-arrow-up');
+ $template.find('[data-direction="up"]').css('visibility', 'hidden');
first = false;
}
@@ -191,7 +193,7 @@ function loadTable(modalToClose) {
$('#table-body').append('
' + places[2] + ' |
');
$('#table-body').append('' + notFoundText + ' |
');
}
- if (currentPlace === 2) {
+ if (currentPlace === 1 || currentPlace === 2) {
$('#table-body').append('' + places[3] + ' |
');
$('#table-body').append('' + notFoundText + ' |
');
}
@@ -199,7 +201,7 @@ function loadTable(modalToClose) {
if (lastElement) {
//-- Hide the down arrow on the last element
$('[data-value="' + lastElement.id + '"]').parent().parent()
- .find('[data-direction="down"]').find('i').removeClass('fa-arrow-down');
+ .find('[data-direction="down"]').css('visibility', 'hidden');
}
if (modalToClose !== undefined) {
@@ -228,6 +230,7 @@ function bindEditModal() {
$modal.find('select[name="place"]').val(element.place);
$modal.find('input[name="id"]').val(element.id);
+ $modal.find('input[name="url"]').val(element.url);
var $textLanguages = $modal.find('[data-text-language]');
$.each($textLanguages, function() {
var language = $(this).data('text-language');
@@ -290,6 +293,7 @@ function bindCreateModal() {
$modal.find('input[name="image-url"]').val('');
$modal.find('#font-icon-group').hide();
$modal.find('#image-url-group').show();
+ $modal.find('input[name="url"]').val('');
$modal.modal('show');
});