diff --git a/admin/service_messages.php b/admin/service_messages.php index 30d5155e..ecbd2ba8 100644 --- a/admin/service_messages.php +++ b/admin/service_messages.php @@ -158,7 +158,7 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
-
- - - -
-
@@ -308,14 +298,14 @@ require_once(HESK_PATH . 'inc/show_admin_nav.inc.php');
-
+
-
+
-
+
+
+ + +
+ + + +
+
+
@@ -427,6 +430,7 @@ function save_sm() } $type = empty($_POST['type']) ? 0 : 1; + $icon = hesk_POST('icon'); $title = hesk_input( hesk_POST('title') ) or $hesk_error_buffer[] = $hesklang['sm_e_title']; $message = hesk_getHTML( hesk_POST('message') ); @@ -441,6 +445,7 @@ function save_sm() 'style' => $style, 'type' => $type, 'title' => $title, + 'icon' => $icon, 'message' => hesk_input( hesk_POST('message') ), ); @@ -468,6 +473,7 @@ function save_sm() 'type' => $type, 'title' => $title, 'message' => $message, + 'icon' => $icon, ); header('Location: service_messages.php'); @@ -480,7 +486,8 @@ function save_sm() `title` = '".hesk_dbEscape($title)."', `message` = '".hesk_dbEscape($message)."', `style` = '{$style}', - `type` = '{$type}' + `type` = '{$type}', + `icon` = '{$icon}' WHERE `id`={$id} LIMIT 1"); $_SESSION['smord'] = $id; @@ -600,6 +607,7 @@ function new_sm() } $type = empty($_POST['type']) ? 0 : 1; + $icon = hesk_POST('icon'); $title = hesk_input( hesk_POST('title') ) or $hesk_error_buffer[] = $hesklang['sm_e_title']; $message = hesk_getHTML( hesk_POST('message') ); @@ -610,6 +618,7 @@ function new_sm() 'style' => $style, 'type' => $type, 'title' => $title, + 'icon' => $icon, 'message' => hesk_input( hesk_POST('message') ), ); @@ -633,6 +642,7 @@ function new_sm() 'style' => $style, 'type' => $type, 'title' => $title, + 'icon' => $icon, 'message' => $message, ); @@ -646,13 +656,14 @@ function new_sm() $my_order = intval($row[0]) + 10; // Insert service message into database - hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` (`author`,`title`,`message`,`style`,`type`,`order`) VALUES ( + hesk_dbQuery("INSERT INTO `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` (`author`,`title`,`message`,`style`,`type`,`order`, `icon`) VALUES ( '".intval($_SESSION['id'])."', '".hesk_dbEscape($title)."', '".hesk_dbEscape($message)."', '{$style}', '{$type}', - '{$my_order}' + '{$my_order}', + '{$icon}' )"); $_SESSION['smord'] = hesk_dbInsertID(); diff --git a/css/bootstrap-iconpicker.min.css b/css/bootstrap-iconpicker.min.css new file mode 100644 index 00000000..a8f74264 --- /dev/null +++ b/css/bootstrap-iconpicker.min.css @@ -0,0 +1,10 @@ +/*! + * Bootstrap-iconpicker v1.5.0 + * + * Copyright 2013-2014 Victor Valencia Rico. + * Licensed under the Apache License v2.0 + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Designed and built with all the love in the world by @recktoner. + */ +.iconpicker .caret{margin-left:10px!important}.iconpicker{min-width:60px}.table-icons .btn{min-height:30px;min-width:35px;text-align:center;padding:0;margin:2px}.table-icons td{min-width:39px}.popover{max-width:inherit!important}.iconpicker-popover{z-index:1050!important}.iconpicker-popover .search-control{margin-bottom:6px;margin-top:6px} \ No newline at end of file diff --git a/inc/common.inc.php b/inc/common.inc.php index 25550dab..7f2c5ce3 100644 --- a/inc/common.inc.php +++ b/inc/common.inc.php @@ -65,24 +65,20 @@ hesk_getLanguage(); function hesk_service_message($sm) { - $faIcon = ""; + $faIcon = $sm['icon']; switch ($sm['style']) { case 1: $style = "alert alert-success"; - $faIcon = "fa fa-check-circle"; break; case 2: $style = "alert alert-info"; - $faIcon = "fa fa-comment"; break; case 3: $style = "alert alert-warning"; - $faIcon = "fa fa-exclamation-triangle"; break; case 4: $style = "alert alert-danger"; - $faIcon = "fa fa-times-circle"; break; default: $style = "none"; @@ -90,7 +86,7 @@ function hesk_service_message($sm) ?>
- '; ?> + '; ?>

diff --git a/inc/headerAdmin.inc.php b/inc/headerAdmin.inc.php index 4640dbec..0b8e68d6 100644 --- a/inc/headerAdmin.inc.php +++ b/inc/headerAdmin.inc.php @@ -57,6 +57,7 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php'); + @@ -64,6 +65,9 @@ require(HESK_PATH . 'modsForHesk_settings.inc.php'); + + + 0) { ?> diff --git a/install/mods-for-hesk/ajax/uninstall-database-ajax.php b/install/mods-for-hesk/ajax/uninstall-database-ajax.php index 69357dcc..d03d06d0 100644 --- a/install/mods-for-hesk/ajax/uninstall-database-ajax.php +++ b/install/mods-for-hesk/ajax/uninstall-database-ajax.php @@ -29,6 +29,8 @@ if ($task == 'status-change') { removePendingVerificationEmailsTable(); } elseif ($task == 'pending-verification-tickets-table') { removeTicketsPendingVerificationTable(); +} elseif ($task == 'service-message-icon') { + removeServiceMessageCustomIcon(); } elseif ($task == 'miscellaneous') { executeMiscellaneousSql(); } else { diff --git a/install/mods-for-hesk/js/uninstall-scripts.js b/install/mods-for-hesk/js/uninstall-scripts.js index d85b6a33..ce2f3a0d 100644 --- a/install/mods-for-hesk/js/uninstall-scripts.js +++ b/install/mods-for-hesk/js/uninstall-scripts.js @@ -1,7 +1,7 @@ function getTasks() { return ['status-change', 'autorefresh', 'parent-child', 'settings-access', 'activate-user', 'notify-note-unassigned', 'user-manage-notification-settings', 'settings-table', 'verified-emails-table', - 'pending-verification-emails-table', 'pending-verification-tickets-table', 'miscellaneous']; + 'pending-verification-emails-table', 'pending-verification-tickets-table', 'service-message-icon', 'miscellaneous']; } function processUninstallation() { diff --git a/install/mods-for-hesk/sql/installSql.php b/install/mods-for-hesk/sql/installSql.php index f0ca04b9..ce61e4a9 100644 --- a/install/mods-for-hesk/sql/installSql.php +++ b/install/mods-for-hesk/sql/installSql.php @@ -436,4 +436,14 @@ function execute221Scripts() { hesk_dbConnect(); executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.2.1' WHERE `Key` = 'modsForHeskVersion'"); } -// END Version 2.2.1 \ No newline at end of file +// END Version 2.2.1 + +// BEGIN Version 2.3.0 +function execute230Scripts() { + global $hesk_settings; + + hesk_dbConnect(); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` ADD COLUMN `icon` VARCHAR(150)"); + executeQuery("UPDATE `".hesk_dbEscape($hesk_settings['db_pfix'])."settings` SET `Value` = '2.3.0' WHERE `Key` = 'modsForHeskVersion'"); +} +// END Version 2.3.0 \ No newline at end of file diff --git a/install/mods-for-hesk/sql/uninstallSql.php b/install/mods-for-hesk/sql/uninstallSql.php index d8f2b7b4..d76c7728 100644 --- a/install/mods-for-hesk/sql/uninstallSql.php +++ b/install/mods-for-hesk/sql/uninstallSql.php @@ -129,6 +129,13 @@ function removeTicketsPendingVerificationTable() { executeQuery("DROP TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."stage_tickets`"); } +function removeServiceMessageCustomIcon() { + global $hesk_settings; + + hesk_dbConnect(); + executeQuery("ALTER TABLE `".hesk_dbEscape($hesk_settings['db_pfix'])."service_messages` DROP COLUMN `icon`"); +} + function executeMiscellaneousSql() { global $hesk_settings; diff --git a/install/mods-for-hesk/uninstallModsForHesk.php b/install/mods-for-hesk/uninstallModsForHesk.php index 34dc18d7..1dd3d27c 100644 --- a/install/mods-for-hesk/uninstallModsForHesk.php +++ b/install/mods-for-hesk/uninstallModsForHesk.php @@ -16,6 +16,7 @@ function echoTaskRows() { printUninstallRow('Remove verified emails table', 'verified-emails-table'); printUninstallRow('Remove pending verification emails table', 'pending-verification-emails-table'); printUninstallRow('Remove tickets pending verification table', 'pending-verification-tickets-table'); + printUninstallRow('Remove custom service messages icon', 'service-message-icon'); printUninstallRow('Miscellaneous database cleanup changes', 'miscellaneous'); } diff --git a/js/bootstrap-iconpicker.js b/js/bootstrap-iconpicker.js new file mode 100644 index 00000000..84dc4c54 --- /dev/null +++ b/js/bootstrap-iconpicker.js @@ -0,0 +1,527 @@ +/* ======================================================================== + * Bootstrap: bootstrap-iconpicker.js v1.6.0 by @recktoner + * https://victor-valencia.github.com/bootstrap-iconpicker + * ======================================================================== + * Copyright 2013-2014 Victor Valencia Rico. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== */ + +; (function ($) { + "use strict"; + + // ICONPICKER PUBLIC CLASS DEFINITION + // ============================== + var Iconpicker = function (element, options) { + this.$element = $(element); + this.options = $.extend({}, Iconpicker.DEFAULTS, this.$element.data()); + this.options = $.extend({}, this.options, options); + }; + + // ICONPICKER ICONSET_EMPTY + // ============================== + Iconpicker.ICONSET_EMPTY = { + iconClass: '', + iconClassFix: '', + icons: [] + }; + + // ICONPICKER ICONSET + // ============================== + Iconpicker.ICONSET = { + _custom: null, + elusiveicon: $.iconset_elusiveicon || Iconpicker.ICONSET_EMPTY, + fontawesome: $.iconset_fontawesome || Iconpicker.ICONSET_EMPTY, + ionicon: $.iconset_ionicon || Iconpicker.ICONSET_EMPTY, + glyphicon: $.iconset_glyphicon || Iconpicker.ICONSET_EMPTY, + mapicon: $.iconset_mapicon || Iconpicker.ICONSET_EMPTY, + octicon: $.iconset_octicon || Iconpicker.ICONSET_EMPTY, + typicon: $.iconset_typicon || Iconpicker.ICONSET_EMPTY, + weathericon: $.iconset_weathericon || Iconpicker.ICONSET_EMPTY + }; + + // ICONPICKER DEFAULTS + // ============================== + Iconpicker.DEFAULTS = { + arrowClass: 'btn-primary', + arrowNextIconClass: 'glyphicon glyphicon-arrow-right', + arrowPrevIconClass: 'glyphicon glyphicon-arrow-left', + cols: 4, + icon: '', + iconset: 'glyphicon', + labelHeader: '{0} / {1}', + labelFooter: '{0} - {1} of {2}', + placement: 'bottom', + rows: 4, + search: true, + searchText: 'Search icon', + selectedClass: 'btn-warning', + unselectedClass: 'btn-default', + resetButton: true, + noIconSelectedClass: 'glyphicon glyphicon-ban-circle', + labelNoIcon: 'No Icon' + }; + + // ICONPICKER PRIVATE METHODS + // ============================== + Iconpicker.prototype.bindEvents = function () { + var op = this.options; + var el = this; + op.table.find('.btn-previous, .btn-next').off('click').on('click', function () { + var inc = parseInt($(this).val(), 10); + el.changeList(op.page + inc); + }); + op.table.find('.btn-icon').off('click').on('click', function () { + el.select($(this).val()); + el.$element.popover('destroy'); + }); + op.table.find('.search-control').off('keyup').on('keyup', function () { + el.changeList(1); + }); + }; + + //new match function + Iconpicker.prototype.matchEx = function (opIcon, icon) { + return icon === opIcon.icon || + icon === opIcon.iconClassFix + opIcon.icon || + icon === opIcon.iconClass + ' ' + opIcon.iconClassFix + opIcon.icon || + icon.replace(opIcon.iconClassFix, '') == opIcon.icon; + }; + + Iconpicker.prototype.changeList = function (page) { + this.filterIcons(); + this.updateLabels(page); + this.updateIcons(page); + this.options.page = page; + this.bindEvents(); + }; + + Iconpicker.prototype.filterIcons = function () { + var op = this.options; + var search = op.table.find('.search-control').val(); + if (search === "") { + op.icons = op.cacheset; + } + else { + var result = []; + $.each(op.cacheset, function (i, v) { + if (v.icon.indexOf(search) > -1) + result.push(v); + }); + op.icons = result; + } + }; + + Iconpicker.prototype.removeAddClass = function (target, remove, add) { + this.options.table.find(target).removeClass(remove).addClass(add); + return add; + }; + + Iconpicker.prototype.reset = function () { + this.updatePicker(); + this.changeList(1); + }; + + Iconpicker.prototype.select = function (icon) { + var op = this.options; + var el = this.$element; + if (icon === '') { + op.icon = ''; + el.find('input').val(''); + el.find('i').attr('class', op.noIconSelectedClass); + el.find('i').css('color', '#FF0000'); + el.trigger({type:"change", icon: ''}); + op.table.find('button.' + op.selectedClass).removeClass(op.selectedClass); + return; + } + + for (var i = 0; i < op.icons.length; i++) { + if (this.matchEx(op.icons[i], icon)) { + icon = op.icons[i]; + op.selected = i; + break; + } + } + if (op.selected === -1) { + op.selected = 0; + icon = op.icons[op.selected]; + } + if (icon !== '' && op.selected >= 0) { + var icoStr = ''; + if (op.iconset.length > 1) + icoStr = icon.iconClass + ' ' + icon.iconClassFix + icon.icon; + else + icoStr = icon.iconClassFix + icon.icon; + + op.icon = icoStr; + + el.find('input').val(icoStr); + el.find('i').attr('class', '').addClass(icon.iconClass).addClass(icon.iconClassFix + icon.icon); + el.find('i').css('color', '#000000'); + el.trigger({ type: "change", icon: icoStr }); + op.table.find('button.' + op.selectedClass).removeClass(op.selectedClass); + } + }; + + Iconpicker.prototype.switchPage = function (icon) { + var op = this.options; + for (var i = 0; i < op.icons.length; i++) { + if (this.matchEx(op.icons[i], icon)) { + icon = op.icons[i]; + op.selected = i; + break; + } + } + if (op.selected === -1) { + icon === ''; + } + if (icon !== '' && op.selected >= 0) { + var page = Math.ceil((op.selected + 1) / this.totalIconsPerPage()); + this.changeList(page); + } + op.table.find('i.' + icon.iconClassFix + icon.icon).parent().addClass(op.selectedClass); + }; + + Iconpicker.prototype.totalPages = function () { + return Math.ceil(this.totalIcons() / this.totalIconsPerPage()); + }; + + Iconpicker.prototype.totalIcons = function () { + return this.options.icons.length; + }; + + Iconpicker.prototype.totalIconsPerPage = function () { + return this.options.cols * this.options.rows; + }; + + Iconpicker.prototype.updateArrows = function (page) { + var op = this.options; + var total_pages = this.totalPages(); + if (page === 1) { + op.table.find('.btn-previous').addClass('disabled'); + } + else { + op.table.find('.btn-previous').removeClass('disabled'); + } + if (page === total_pages || total_pages === 0) { + op.table.find('.btn-next').addClass('disabled'); + } + else { + op.table.find('.btn-next').removeClass('disabled'); + } + }; + + Iconpicker.prototype.updateIcons = function (page) { + var op = this.options; + var tbody = op.table.find('tbody').empty(); + var offset = (page - 1) * this.totalIconsPerPage(); + for (var i = 0; i < op.rows; i++) { + var tr = $(''); + for (var j = 0; j < op.cols; j++) { + var pos = offset + (i * op.cols) + j; + var btn = $('').hide(); + if (pos < op.icons.length) { + var ico = op.icons[pos]; + var v = ico.iconClassFix + ico.icon; + btn.val(v).attr('title', v).append('').data('icon-picker-icon', ico).show(); + if (this.matchEx(ico, op.icon)) { + console.log('matched'); + btn.addClass(op.selectedClass).addClass('btn-icon-selected'); + } + } + tr.append($('').append(btn)); + } + tbody.append(tr); + } + }; + + Iconpicker.prototype.updateIconsCount = function () { + var op = this.options; + var icons_count = [ + '', + ' ', + ' ', + ' ', + '' + ]; + op.table.find('tfoot').append(icons_count.join('')); + }; + + Iconpicker.prototype.updateLabels = function (page) { + var op = this.options; + var total_icons = this.totalIcons(); + var total_pages = this.totalPages(); + op.table.find('.page-count').html(op.labelHeader.replace('{0}', (total_pages === 0) ? 0 : page).replace('{1}', total_pages)); + var offset = (page - 1) * this.totalIconsPerPage(); + var total = page * this.totalIconsPerPage(); + op.table.find('.icons-count').html(op.labelFooter.replace('{0}', offset + 1).replace('{1}', (total < total_icons) ? total : total_icons).replace('{2}', total_icons)); + this.updateArrows(page); + }; + + Iconpicker.prototype.updatePagesCount = function () { + var op = this.options; + var tr = $(''); + for (var i = 0; i < op.cols; i++) { + var td = $(''); + if (i === 0 || i === op.cols - 1) { + var arrow = [ + '' + ]; + td.append(arrow.join('')); + tr.append(td); + } + else if (tr.find('.page-count').length === 0) { + td.attr('colspan', op.cols - 2).append(''); + tr.append(td); + } + } + op.table.find('thead').empty().append(tr); + }; + + Iconpicker.prototype.updatePicker = function () { + var op = this.options; + if (op.cols < 4) { + throw 'Iconpicker => The number of columns must be greater than or equal to 4. [option.cols = ' + op.cols + ']'; + } + else if (op.rows < 1) { + throw 'Iconpicker => The number of rows must be greater than or equal to 1. [option.rows = ' + op.rows + ']'; + } + else { + this.updatePagesCount(); + this.updateSearch(); + this.addResetButton(); + this.updateIconsCount(); + } + }; + + Iconpicker.prototype.updateSearch = function () { + var op = this.options; + var search = [ + '', + ' ', + ' ', + ' ', + '' + ]; + search = $(search.join('')); + if (op.search === true) { + search.show(); + } + else { + search.hide(); + } + op.table.find('thead').append(search); + }; + + Iconpicker.prototype.addResetButton = function () { + var op = this.options; + var resetButton = [ + '', + '', + '', + '', + '' + ]; + resetButton = $(resetButton.join('')); + if (op.resetButton === true) { + resetButton.show(); + } else { + resetButton.hide(); + } + op.table.find('tfoot').empty().append(resetButton); + } + + // ICONPICKER PUBLIC METHODS + // ============================== + Iconpicker.prototype.setArrowClass = function (value) { + this.options.arrowClass = this.removeAddClass('.btn-arrow', this.options.arrowClass, value); + }; + + Iconpicker.prototype.setArrowNextIconClass = function (value) { + this.options.arrowNextIconClass = this.removeAddClass('.btn-next > span', this.options.arrowNextIconClass, value); + }; + + Iconpicker.prototype.setArrowPrevIconClass = function (value) { + this.options.arrowPrevIconClass = this.removeAddClass('.btn-previous > span', this.options.arrowPrevIconClass, value); + }; + + Iconpicker.prototype.setCols = function (value) { + this.options.cols = value; + this.reset(); + }; + + Iconpicker.prototype.setIcon = function (value) { + this.select(value); + }; + + Iconpicker.prototype.setIconset = function (value) { + var op = this.options; + value = [].concat(value); + var evalSet = []; + var customSets = 0; + $.each(value, function (index, setItem) { + if ($.isPlainObject(setItem)) { + customSets++; + var setName = String('_custom' + String(customSets)); + Iconpicker.ICONSET[setName] = $.extend(Iconpicker.ICONSET_EMPTY, setItem); + evalSet.push(setName); + } else { + var subSet = setItem.split(/\|/gi); + $.each(subSet, function (subIndex, subSetItem) { + if (!Iconpicker.ICONSET.hasOwnProperty(subSetItem)) { + Iconpicker.ICONSET[subSetItem] = Iconpicker.DEFAULTS.iconset; + evalSet.push(subSetItem); + } + else { + evalSet.push(subSetItem); + } + }); + } + }); + this.options.iconset = evalSet; + var cacheset = []; + $.each(op.iconset, function (setIndex, setItem) { + var set = Iconpicker.ICONSET[setItem]; + $.each(set.icons, function (i, v) { + cacheset.push({ icon: v, iconClass: set.iconClass, iconClassFix: set.iconClassFix }) + }); + }); + this.options.cacheset = cacheset; + this.reset(); + this.select(op.icon); + }; + + Iconpicker.prototype.setLabelHeader = function (value) { + this.options.labelHeader = value; + this.updateLabels(this.options.page); + }; + + Iconpicker.prototype.setLabelFooter = function (value) { + this.options.labelFooter = value; + this.updateLabels(this.options.page); + }; + + Iconpicker.prototype.setPlacement = function (value) { + this.options.placement = value; + }; + + Iconpicker.prototype.setRows = function (value) { + this.options.rows = value; + this.reset(); + }; + + Iconpicker.prototype.setSearch = function (value) { + var search = this.options.table.find('.search-control'); + if (value === true) { + search.show(); + } + else { + search.hide(); + } + search.val(''); + this.changeList(1); + this.options.search = value; + }; + + Iconpicker.prototype.setSearchText = function (value) { + this.options.table.find('.search-control').attr('placeholder', value); + this.options.searchText = value; + }; + + Iconpicker.prototype.setSelectedClass = function (value) { + this.options.selectedClass = this.removeAddClass('.btn-icon-selected', this.options.selectedClass, value); + }; + + Iconpicker.prototype.setUnselectedClass = function (value) { + this.options.unselectedClass = this.removeAddClass('.btn-icon', this.options.unselectedClass, value); + }; + + // ICONPICKER PLUGIN DEFINITION + // ======================== + var old = $.fn.iconpicker; + $.fn.iconpicker = function (option, params) { + return this.each(function () { + var $this = $(this); + var data = $this.data('bs.iconpicker'); + var options = typeof option === 'object' && option; + if (!data) { + $this.data('bs.iconpicker', (data = new Iconpicker(this, options))); + } + if (typeof option === 'string') { + if (typeof data[option] === 'undefined') { + throw 'Iconpicker => The "' + option + '" method does not exists.'; + } + else { + data[option](params); + } + } + else { + var op = data.options; + op = $.extend(op, { + page: 1, + selected: -1, + table: $('
') + }); + var name = (typeof $this.attr('name') !== 'undefined') ? 'name="' + $this.attr('name') + '"' : ''; + $this.empty() + .append('') + .append('') + .append(''); + $this.addClass('iconpicker'); + data.setIconset(op.iconset); + $this.on('click', function (e) { + e.preventDefault(); + $this.popover({ + animation: false, + trigger: 'manual', + html: true, + content: op.table, + container: 'body', + placement: op.placement + }).on('shown.bs.popover', function () { + data.switchPage(op.icon); + data.bindEvents(); + }); + $this.data('bs.popover').tip().addClass('iconpicker-popover'); + $this.popover('show'); + }); + } + }); + }; + + $.fn.iconpicker.Constructor = Iconpicker; + + // ICONPICKER NO CONFLICT + // ================== + $.fn.iconpicker.noConflict = function () { + $.fn.iconpicker = old; + return this; + }; + + // ICONPICKER DATA-API + // =============== + $(document).on('click', 'body', function (e) { + $('.iconpicker').each(function () { + //the 'is' for buttons that trigger popups + //the 'has' for icons within a button that triggers a popup + if (!$(this).is(e.target) && $(this).has(e.target).length === 0 && $('.popover').has(e.target).length === 0) { + $(this).popover('destroy'); + } + }); + }); + + $('button[role="iconpicker"]').iconpicker(); + +})(jQuery); \ No newline at end of file diff --git a/js/iconset-fontawesome-4.3.0.js b/js/iconset-fontawesome-4.3.0.js new file mode 100644 index 00000000..a866a74a --- /dev/null +++ b/js/iconset-fontawesome-4.3.0.js @@ -0,0 +1,623 @@ +/* ======================================================================== + * Bootstrap: iconset-fontawesome-4.3.0.js by @recktoner + * https://victor-valencia.github.com/bootstrap-iconpicker + * + * Iconset: Font Awesome 4.3.0 + * http://fortawesome.github.io/Font-Awesome/ + * ======================================================================== + * Copyright 2013-2014 Victor Valencia Rico. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== */ + +;(function($){ + + $.iconset_fontawesome = { + iconClass: 'fa', + iconClassFix: 'fa-', + icons: [ + 'adn', + 'align-center', + 'align-justify', + 'align-left', + 'align-right', + 'ambulance', + 'anchor', + 'android', + 'angellist', + 'angle-double-down', + 'angle-double-left', + 'angle-double-right', + 'angle-double-up', + 'angle-down', + 'angle-left', + 'angle-right', + 'angle-up', + 'apple', + 'archive', + 'area-chart', + 'arrow-circle-down', + 'arrow-circle-left', + 'arrow-circle-o-down', + 'arrow-circle-o-left', + 'arrow-circle-o-right', + 'arrow-circle-o-up', + 'arrow-circle-right', + 'arrow-circle-up', + 'arrow-down', + 'arrow-left', + 'arrow-right', + 'arrow-up', + 'arrows', + 'arrows-alt', + 'arrows-h', + 'arrows-v', + 'asterisk', + 'at', + 'automobile', + 'backward', + 'ban', + 'bank', + 'bar-chart', + 'bar-chart-o', + 'barcode', + 'bars', + 'bed', + 'beer', + 'behance', + 'behance-square', + 'bell', + 'bell-o', + 'bell-slash', + 'bell-slash-o', + 'bicycle', + 'binoculars', + 'birthday-cake', + 'bitbucket', + 'bitbucket-square', + 'bitcoin', + 'bold', + 'bolt', + 'bomb', + 'book', + 'bookmark', + 'bookmark-o', + 'briefcase', + 'btc', + 'bug', + 'building', + 'building-o', + 'bullhorn', + 'bullseye', + 'bus', + 'buysellads', + 'cab', + 'calculator', + 'calendar', + 'calendar-o', + 'camera', + 'camera-retro', + 'car', + 'caret-down', + 'caret-left', + 'caret-right', + 'caret-square-o-down', + 'caret-square-o-left', + 'caret-square-o-right', + 'caret-square-o-up', + 'caret-up', + 'cart-arrow-down', + 'cart-plus', + 'cc', + 'cc-amex', + 'cc-discover', + 'cc-mastercard', + 'cc-paypal', + 'cc-stripe', + 'cc-visa', + 'certificate', + 'chain', + 'chain-broken', + 'check', + 'check-circle', + 'check-circle-o', + 'check-square', + 'check-square-o', + 'chevron-circle-down', + 'chevron-circle-left', + 'chevron-circle-right', + 'chevron-circle-up', + 'chevron-down', + 'chevron-left', + 'chevron-right', + 'chevron-up', + 'child', + 'circle', + 'circle-o', + 'circle-o-notch', + 'circle-thin', + 'clipboard', + 'clock-o', + 'close', + 'cloud', + 'cloud-download', + 'cloud-upload', + 'cny', + 'code', + 'code-fork', + 'codepen', + 'coffee', + 'cog', + 'cogs', + 'columns', + 'comment', + 'comment-o', + 'comments', + 'comments-o', + 'compass', + 'compress', + 'connectdevelop', + 'copy', + 'copyright', + 'credit-card', + 'crop', + 'crosshairs', + 'css3', + 'cube', + 'cubes', + 'cut', + 'cutlery', + 'dashboard', + 'dashcube', + 'database', + 'dedent', + 'delicious', + 'desktop', + 'deviantart', + 'diamond', + 'digg', + 'dollar', + 'dot-circle-o', + 'download', + 'dribbble', + 'dropbox', + 'drupal', + 'edit', + 'eject', + 'ellipsis-h', + 'ellipsis-v', + 'empire', + 'envelope', + 'envelope-o', + 'envelope-square', + 'eraser', + 'eur', + 'euro', + 'exchange', + 'exclamation', + 'exclamation-circle', + 'exclamation-triangle', + 'expand', + 'external-link', + 'external-link-square', + 'eye', + 'eye-slash', + 'eyedropper', + 'facebook', + 'facebook-f', + 'facebook-official', + 'facebook-square', + 'fast-backward', + 'fast-forward', + 'fax', + 'female', + 'fighter-jet', + 'file', + 'file-archive-o', + 'file-audio-o', + 'file-code-o', + 'file-excel-o', + 'file-image-o', + 'file-movie-o', + 'file-o', + 'file-pdf-o', + 'file-photo-o', + 'file-picture-o', + 'file-powerpoint-o', + 'file-sound-o', + 'file-text', + 'file-text-o', + 'file-video-o', + 'file-word-o', + 'file-zip-o', + 'files-o', + 'film', + 'filter', + 'fire', + 'fire-extinguisher', + 'flag', + 'flag-checkered', + 'flag-o', + 'flash', + 'flask', + 'flickr', + 'floppy-o', + 'folder', + 'folder-o', + 'folder-open', + 'folder-open-o', + 'font', + 'forumbee', + 'forward', + 'foursquare', + 'frown-o', + 'futbol-o', + 'gamepad', + 'gavel', + 'gbp', + 'ge', + 'gear', + 'gears', + 'genderless', + 'gift', + 'git', + 'git-square', + 'github', + 'github-alt', + 'github-square', + 'gittip', + 'glass', + 'globe', + 'google', + 'google-plus', + 'google-plus-square', + 'google-wallet', + 'graduation-cap', + 'gratipay', + 'group', + 'h-square', + 'hacker-news', + 'hand-o-down', + 'hand-o-left', + 'hand-o-right', + 'hand-o-up', + 'hdd-o', + 'header', + 'headphones', + 'heart', + 'heart-o', + 'heartbeat', + 'history', + 'home', + 'hospital-o', + 'hotel', + 'html5', + 'ils', + 'image', + 'inbox', + 'indent', + 'info', + 'info-circle', + 'inr', + 'instagram', + 'institution', + 'ioxhost', + 'italic', + 'joomla', + 'jpy', + 'jsfiddle', + 'key', + 'keyboard-o', + 'krw', + 'language', + 'laptop', + 'lastfm', + 'lastfm-square', + 'leaf', + 'leanpub', + 'legal', + 'lemon-o', + 'level-down', + 'level-up', + 'life-bouy', + 'life-buoy', + 'life-ring', + 'life-saver', + 'lightbulb-o', + 'line-chart', + 'link', + 'linkedin', + 'linkedin-square', + 'linux', + 'list', + 'list-alt', + 'list-ol', + 'list-ul', + 'location-arrow', + 'lock', + 'long-arrow-down', + 'long-arrow-left', + 'long-arrow-right', + 'long-arrow-up', + 'magic', + 'magnet', + 'mail-forward', + 'mail-reply', + 'mail-reply-all', + 'male', + 'map-marker', + 'mars', + 'mars-double', + 'mars-stroke', + 'mars-stroke-h', + 'mars-stroke-v', + 'maxcdn', + 'meanpath', + 'medium', + 'medkit', + 'meh-o', + 'mercury', + 'microphone', + 'microphone-slash', + 'minus', + 'minus-circle', + 'minus-square', + 'minus-square-o', + 'mobile', + 'mobile-phone', + 'money', + 'moon-o', + 'mortar-board', + 'motorcycle', + 'music', + 'navicon', + 'neuter', + 'newspaper-o', + 'openid', + 'outdent', + 'pagelines', + 'paint-brush', + 'paper-plane', + 'paper-plane-o', + 'paperclip', + 'paragraph', + 'paste', + 'pause', + 'paw', + 'paypal', + 'pencil', + 'pencil-square', + 'pencil-square-o', + 'phone', + 'phone-square', + 'photo', + 'picture-o', + 'pie-chart', + 'pied-piper', + 'pied-piper-alt', + 'pinterest', + 'pinterest-p', + 'pinterest-square', + 'plane', + 'play', + 'play-circle', + 'play-circle-o', + 'plug', + 'plus', + 'plus-circle', + 'plus-square', + 'plus-square-o', + 'power-off', + 'print', + 'puzzle-piece', + 'qq', + 'qrcode', + 'question', + 'question-circle', + 'quote-left', + 'quote-right', + 'ra', + 'random', + 'rebel', + 'recycle', + 'reddit', + 'reddit-square', + 'refresh', + 'remove', + 'renren', + 'reorder', + 'repeat', + 'reply', + 'reply-all', + 'retweet', + 'rmb', + 'road', + 'rocket', + 'rotate-left', + 'rotate-right', + 'rouble', + 'rss', + 'rss-square', + 'rub', + 'ruble', + 'rupee', + 'save', + 'scissors', + 'search', + 'search-minus', + 'search-plus', + 'sellsy', + 'send', + 'send-o', + 'server', + 'share', + 'share-alt', + 'share-alt-square', + 'share-square', + 'share-square-o', + 'shekel', + 'sheqel', + 'shield', + 'ship', + 'shirtsinbulk', + 'shopping-cart', + 'sign-in', + 'sign-out', + 'signal', + 'simplybuilt', + 'sitemap', + 'skyatlas', + 'skype', + 'slack', + 'sliders', + 'slideshare', + 'smile-o', + 'soccer-ball-o', + 'sort', + 'sort-alpha-asc', + 'sort-alpha-desc', + 'sort-amount-asc', + 'sort-amount-desc', + 'sort-asc', + 'sort-desc', + 'sort-down', + 'sort-numeric-asc', + 'sort-numeric-desc', + 'sort-up', + 'soundcloud', + 'space-shuttle', + 'spinner', + 'spoon', + 'spotify', + 'square', + 'square-o', + 'stack-exchange', + 'stack-overflow', + 'star', + 'star-half', + 'star-half-empty', + 'star-half-full', + 'star-half-o', + 'star-o', + 'steam', + 'steam-square', + 'step-backward', + 'step-forward', + 'stethoscope', + 'stop', + 'street-view', + 'strikethrough', + 'stumbleupon', + 'stumbleupon-circle', + 'subscript', + 'subway', + 'suitcase', + 'sun-o', + 'superscript', + 'support', + 'table', + 'tablet', + 'tachometer', + 'tag', + 'tags', + 'tasks', + 'taxi', + 'tencent-weibo', + 'terminal', + 'text-height', + 'text-width', + 'th', + 'th-large', + 'th-list', + 'thumb-tack', + 'thumbs-down', + 'thumbs-o-down', + 'thumbs-o-up', + 'thumbs-up', + 'ticket', + 'times', + 'times-circle', + 'times-circle-o', + 'tint', + 'toggle-down', + 'toggle-left', + 'toggle-off', + 'toggle-on', + 'toggle-right', + 'toggle-up', + 'train', + 'transgender', + 'transgender-alt', + 'trash', + 'trash-o', + 'tree', + 'trello', + 'trophy', + 'truck', + 'try', + 'tty', + 'tumblr', + 'tumblr-square', + 'turkish-lira', + 'twitch', + 'twitter', + 'twitter-square', + 'umbrella', + 'underline', + 'undo', + 'university', + 'unlink', + 'unlock', + 'unlock-alt', + 'unsorted', + 'upload', + 'usd', + 'user', + 'user-md', + 'user-plus', + 'user-secret', + 'user-times', + 'users', + 'venus', + 'venus-double', + 'venus-mars', + 'viacoin', + 'video-camera', + 'vimeo-square', + 'vine', + 'vk', + 'volume-down', + 'volume-off', + 'volume-up', + 'warning', + 'wechat', + 'weibo', + 'weixin', + 'whatsapp', + 'wheelchair', + 'wifi', + 'windows', + 'won', + 'wordpress', + 'wrench', + 'xing', + 'xing-square', + 'yahoo', + 'yelp', + 'yen', + 'youtube', + 'youtube-play', + 'youtube-square' + ]}; + +})(jQuery); \ No newline at end of file diff --git a/js/iconset-octicon-2.1.2.js b/js/iconset-octicon-2.1.2.js new file mode 100644 index 00000000..7a4de6fe --- /dev/null +++ b/js/iconset-octicon-2.1.2.js @@ -0,0 +1,208 @@ +/* ======================================================================== + * Bootstrap: iconset-octicon-2.1.2.js by @recktoner + * https://victor-valencia.github.com/bootstrap-iconpicker + * + * Iconset: Octicons 2.1.2 + * https://octicons.github.com/ + * ======================================================================== + * Copyright 2013-2014 Victor Valencia Rico. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * ======================================================================== */ + +;(function($){ + + $.iconset_octicon = { + iconClass: 'octicon', + iconClassFix: 'octicon-', + icons: [ + 'alert', + 'alignment-align', + 'alignment-aligned-to', + 'alignment-unalign', + 'arrow-down', + 'arrow-left', + 'arrow-right', + 'arrow-small-down', + 'arrow-small-left', + 'arrow-small-right', + 'arrow-small-up', + 'arrow-up', + 'beer', + 'book', + 'bookmark', + 'briefcase', + 'broadcast', + 'browser', + 'bug', + 'calendar', + 'check', + 'checklist', + 'chevron-down', + 'chevron-left', + 'chevron-right', + 'chevron-up', + 'circle-slash', + 'circuit-board', + 'clippy', + 'clock', + 'cloud-download', + 'cloud-upload', + 'code', + 'color-mode', + 'comment', + 'comment-discussion', + 'credit-card', + 'dash', + 'dashboard', + 'database', + 'device-camera', + 'device-camera-video', + 'device-desktop', + 'device-mobile', + 'diff', + 'diff-added', + 'diff-ignored', + 'diff-modified', + 'diff-removed', + 'diff-renamed', + 'ellipsis', + 'eye', + 'file-binary', + 'file-code', + 'file-directory', + 'file-media', + 'file-pdf', + 'file-submodule', + 'file-symlink-directory', + 'file-symlink-file', + 'file-text', + 'file-zip', + 'flame', + 'fold', + 'gear', + 'gift', + 'gist', + 'gist-secret', + 'git-branch', + 'git-commit', + 'git-compare', + 'git-merge', + 'git-pull-request', + 'globe', + 'graph', + 'heart', + 'history', + 'home', + 'horizontal-rule', + 'hourglass', + 'hubot', + 'inbox', + 'info', + 'issue-closed', + 'issue-opened', + 'issue-reopened', + 'jersey', + 'jump-down', + 'jump-left', + 'jump-right', + 'jump-up', + 'key', + 'keyboard', + 'law', + 'light-bulb', + 'link', + 'link-external', + 'list-ordered', + 'list-unordered', + 'location', + 'lock', + //'logo-github', + 'mail', + 'mail-read', + 'mail-reply', + 'mark-github', + 'markdown', + 'megaphone', + 'mention', + 'microscope', + 'milestone', + 'mirror', + 'mortar-board', + 'move-down', + 'move-left', + 'move-right', + 'move-up', + 'mute', + 'no-newline', + 'octoface', + 'organization', + 'package', + 'paintcan', + 'pencil', + 'person', + 'pin', + 'playback-fast-forward', + 'playback-pause', + 'playback-play', + 'playback-rewind', + 'plug', + 'plus', + 'podium', + 'primitive-dot', + 'primitive-square', + 'pulse', + 'puzzle', + 'question', + 'quote', + 'radio-tower', + 'repo', + 'repo-clone', + 'repo-force-push', + 'repo-forked', + 'repo-pull', + 'repo-push', + 'rocket', + 'rss', + 'ruby', + 'screen-full', + 'screen-normal', + 'search', + 'server', + 'settings', + 'sign-in', + 'sign-out', + 'split', + 'squirrel', + 'star', + 'steps', + 'stop', + 'sync', + 'tag', + 'telescope', + 'terminal', + 'three-bars', + 'tools', + 'trashcan', + 'triangle-down', + 'triangle-left', + 'triangle-right', + 'triangle-up', + 'unfold', + 'unmute', + 'versions', + 'x', + 'zap' + ]}; + +})(jQuery); diff --git a/js/modsForHesk-javascript.js b/js/modsForHesk-javascript.js index 9fb5597d..d3b40d2f 100644 --- a/js/modsForHesk-javascript.js +++ b/js/modsForHesk-javascript.js @@ -1,4 +1,4 @@ -//-- Activate anything Hesk UI needs, such as tooltips. +//-- Activate anything Mods for HESK needs, such as tooltips. var loadJquery = function() { //-- Activate tooltips @@ -25,12 +25,25 @@ var loadJquery = function() todayBtn: "linked", clearBtn: true, autoclose: true, + autoclose: true, todayHighlight: true, format: "yyyy-mm-dd" }); }); + + $('[data-toggle="iconpicker"]').iconpicker({ + iconset: ['fontawesome', 'octicon'], + selectedClass: "btn-warning", + labelNoIcon: $('#no-icon').text(), + searchText: $('#search-icon').text(), + labelFooter: $('#footer-icon').text() + }); }; +var setIcon = function(icon) { + $('[data-toggle="iconpicker"]').iconpicker('setIcon', icon); +} + function selectAll(id) { $('#' + id + ' option').prop('selected', true); } diff --git a/language/en/text.php b/language/en/text.php index cfa575ca..1c452d3e 100644 --- a/language/en/text.php +++ b/language/en/text.php @@ -21,6 +21,13 @@ $hesklang['_COLLATE']='utf8_unicode_ci'; // This is the email break line that will be used in email piping $hesklang['EMAIL_HR']='------ Reply above this line ------'; +// ADDED OR MODIFIED IN Mods for HESK 2.3.0 +$hesklang['sm_icon'] = 'Icon'; +$hesklang['sm_icon_type'] = 'Icon Type'; +$hesklang['sm_no_icon'] = 'No Icon'; +$hesklang['sm_search_icon'] = 'Search Icon'; +$hesklang['sm_iconpicker_footer_label'] = '{0} - {1} of {2}'; // {0}: lower bound of page, {1}: upper bound of page, {2}: total number of icons + // ADDED OR MODIFIED IN Mods for HESK 2.2.1 $hesklang['popart_no_colon']='Top Knowledgebase Articles'; // same as $hesklang['popart'] but without a colon (:) $hesklang['latart_no_colon']='Latest Knowledgebase Articles'; // same as $hesklang['latart'] but without a colon (:)