diff options
Diffstat (limited to 'frontends/php/js/class.cmap.js')
-rw-r--r-- | frontends/php/js/class.cmap.js | 131 |
1 files changed, 69 insertions, 62 deletions
diff --git a/frontends/php/js/class.cmap.js b/frontends/php/js/class.cmap.js index 30e8055f8d2..bc522dd7d92 100644 --- a/frontends/php/js/class.cmap.js +++ b/frontends/php/js/class.cmap.js @@ -150,6 +150,13 @@ ZABBIX.apps.map = (function($) { }); } + // for some reason IE8 does not catch clicks if there is no background color and alpha opacity is 0 + if (IE8) { + this.container.css({ + backgroundColor: 'white' + }); + } + if (IE || GK) { this.base64image = false; this.mapimg = $('#sysmap_img'); @@ -488,30 +495,15 @@ ZABBIX.apps.map = (function($) { $('#elementType').change(function() { var obj = $(this); - // clean element id and name switch (obj.val()) { // host case '0': - $('#elementNameHost').multiSelectHelper({ - objectName: 'hosts', - name: 'elementValue', - selectedLimit: 1, - objectOptions: { - editable: true - } - }); + jQuery('#elementNameHost').multiSelect('clean'); break; // host group case '3': - $('#elementNameHostGroup').multiSelectHelper({ - objectName: 'hostGroup', - name: 'elementValue', - selectedLimit: 1, - objectOptions: { - editable: true - } - }); + jQuery('#elementNameHostGroup').multiSelect('clean'); break; // others types @@ -560,11 +552,11 @@ ZABBIX.apps.map = (function($) { // application selection pop up $('#application-select').click(function() { - var data = $('elementNameHost').multiSelect.getData(); + var data = $('#elementNameHost').multiSelect('getData'); PopUp('popup.php?srctbl=applications&srcfld1=name&real_hosts=1&dstfld1=application' + '&with_applications=1&dstfrm=selementForm' - + ((data.length > 0) ? '&hostid='+ data[0].id : ''), + + ((data.length > 0 && $('#elementType').val() == '4') ? '&hostid='+ data[0].id : ''), 450, 450 ); }); @@ -704,6 +696,9 @@ ZABBIX.apps.map = (function($) { this.massForm.hide(); $('#link-connect-to').show(); this.form.show(); + + // resize multiselect + $('.multiselect').multiSelect('resize'); } // multiple elements selected @@ -1268,13 +1263,47 @@ ZABBIX.apps.map = (function($) { }); } + // hosts + $('#elementNameHost').multiSelectHelper({ + id: 'elementNameHost', + objectName: 'hosts', + name: 'elementValue', + selectedLimit: 1, + objectOptions: { + editable: true + }, + popup: { + parameters: 'srctbl=hosts&dstfrm=selementForm&dstfld1=elementNameHost' + + '&srcfld1=hostid&writeonly=1', + width: 450, + height: 450 + } + }); + + // host group + $('#elementNameHostGroup').multiSelectHelper({ + id: 'elementNameHostGroup', + objectName: 'hostGroup', + name: 'elementValue', + selectedLimit: 1, + objectOptions: { + editable: true + }, + popup: { + parameters: 'srctbl=host_groups&dstfrm=selementForm&dstfld1=elementNameHostGroup' + + '&srcfld1=groupid&writeonly=1', + width: 450, + height: 450 + } + }); + this.actionProcessor = new ActionProcessor(formActions); this.actionProcessor.process(); } SelementForm.prototype = { /** - * Shows lement form. + * Shows element form. */ show: function() { this.formContainer.draggable('option', 'handle', '#formDragHandler'); @@ -1353,34 +1382,26 @@ ZABBIX.apps.map = (function($) { $('#use_iconmap').prop('disabled', true); } - // set element id and name - switch (selement.elementtype) { - // host - case '0': - $('#elementNameHost').multiSelectHelper({ - objectName: 'hosts', - name: 'elementValue', - data: [{id: selement.elementid, name: selement.elementName}], - selectedLimit: 1, - objectOptions: { - editable: true - } - }); - break; + // set multiselect values + if (selement.elementtype == 0 || selement.elementtype == 3) { + var item = { + 'id': selement.elementid, + 'name': selement.elementName + }; - // host group - case '3': - $('#elementNameHostGroup').multiSelectHelper({ - objectName: 'hostGroup', - name: 'elementValue', - data: [{id: selement.elementid, name: selement.elementName}], - selectedLimit: 1, - objectOptions: { - editable: true - } - }); - break; + switch (selement.elementtype) { + // host + case '0': + $('#elementNameHost').multiSelect('addData', item); + break; + + // host group + case '3': + $('#elementNameHostGroup').multiSelect('addData', item); + break; + } } + }, /** @@ -1417,7 +1438,7 @@ ZABBIX.apps.map = (function($) { switch (data.elementtype) { // host case '0': - var elementData = $('#elementNameHost').multiSelect.getData(); + var elementData = $('#elementNameHost').multiSelect('getData'); if (empty(elementData)) { data.elementid = '0'; @@ -1431,7 +1452,7 @@ ZABBIX.apps.map = (function($) { // host group case '3': - var elementData = $('#elementNameHostGroup').multiSelect.getData(); + var elementData = $('#elementNameHostGroup').multiSelect('getData'); if (empty(elementData)) { data.elementid = '0'; @@ -2040,17 +2061,3 @@ ZABBIX.apps.map = (function($) { } }; }(jQuery)); - -/** - * Function that is executed by popup.php to ass selected values to destination. - * It uses a sysmap global variable that created in sysmap.php file via 'var sysmap = ZABBIX.apps.map.run();' - * - * @param list link triggers selected in popup - * @param {String} list.object name of objects which we returned - * @param {Array} list.values list of link triggers - */ -function addPopupValues(list) { - if (list.object === 'linktrigger') { - ZABBIX.apps.map.object.linkForm.addNewTriggers(list.values); - } -} |