From 662fc8291966a7d558461ac61aef78e1472970f9 Mon Sep 17 00:00:00 2001 From: Paulo Gustavo Veiga Date: Tue, 18 Sep 2012 20:46:04 -0300 Subject: [PATCH] Wheel enabled on read only maps Fix NPE on mobile firefox on UserAgent MindmapList display list fix on read only maps. --- mindplot/src/main/javascript/Designer.js | 59 ++++++++++--------- .../filter/SupportedUserAgent.java | 1 - wise-webapp/src/main/webapp/js/mindmapList.js | 5 +- 3 files changed, 33 insertions(+), 32 deletions(-) diff --git a/mindplot/src/main/javascript/Designer.js b/mindplot/src/main/javascript/Designer.js index a5f14475..5d71b31f 100644 --- a/mindplot/src/main/javascript/Designer.js +++ b/mindplot/src/main/javascript/Designer.js @@ -55,9 +55,15 @@ mindplot.Designer = new Class({ // Register events if (!this.isReadOnly()) { - this._registerEvents(); + // Register mouse events ... + this._registerMouseEvents(); + + // Register keyboard events ... + mindplot.DesignerKeyboard.register(this); + this._dragManager = this._buildDragManager(this._workspace); } + this._registerWheelEvents(); this._relPivot = new mindplot.RelationshipPivot(this._workspace, this); @@ -76,6 +82,29 @@ mindplot.Designer = new Class({ this.deselectAll(); }, + _registerWheelEvents:function () { + // Zoom In and Zoom Out must active event + $(document).addEvent('mousewheel', function (event) { + // Change mousewheel handling so we let the default + //event happen if we are outside the container. + var coords = screenManager.getContainer().getCoordinates(); + var isOutsideContainer = event.client.y < coords.top || + event.client.y > coords.bottom || + event.client.x < coords.left || + event.client.x > coords.right; + + if (!isOutsideContainer) { + if (event.wheel > 0) { + this.zoomIn(1.05); + } + else { + this.zoomOut(1.05); + } + event.preventDefault(); + } + }.bind(this)); + }, + /** * Activates the keyboard events so you can enter text into forms */ @@ -84,13 +113,6 @@ mindplot.Designer = new Class({ }, - _registerEvents:function () { - // Register mouse events ... - this._registerMouseEvents(); - - // Register keyboard events ... - mindplot.DesignerKeyboard.register(this); - }, addEvent:function (type, listener) { if (type == mindplot.TopicEvent.EDIT || type == mindplot.TopicEvent.CLICK) { @@ -136,27 +158,6 @@ mindplot.Designer = new Class({ } }.bind(this)); - - $(document).addEvent('mousewheel', function (event) { - // Change mousewheel handling so we let the default - //event happen if we are outside the container. - var coords = screenManager.getContainer().getCoordinates(); - var isOutsideContainer = event.client.y < coords.top || - event.client.y > coords.bottom || - event.client.x < coords.left || - event.client.x > coords.right; - - if (!isOutsideContainer) { - if (event.wheel > 0) { - this.zoomIn(1.05); - } - else { - this.zoomOut(1.05); - } - event.preventDefault(); - } - }.bind(this)); - }, _buildDragManager:function (workspace) { diff --git a/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java b/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java index e20fab27..bb28dcd9 100644 --- a/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java +++ b/wise-webapp/src/main/java/com/wisemapping/filter/SupportedUserAgent.java @@ -72,7 +72,6 @@ public class SupportedUserAgent implements Serializable { final UserAgent userAgent = this.getUserAgent(); final Browser browser = userAgent.getBrowser(); final Version version = userAgent.getBrowserVersion(); - final OperatingSystem os = userAgent.getOperatingSystem(); return (browser == Browser.IE8 || browser == Browser.IE && Integer.parseInt(version.getMajorVersion()) == 8) && !header.contains("chromeframe"); } diff --git a/wise-webapp/src/main/webapp/js/mindmapList.js b/wise-webapp/src/main/webapp/js/mindmapList.js index 8d7e5347..425c876f 100644 --- a/wise-webapp/src/main/webapp/js/mindmapList.js +++ b/wise-webapp/src/main/webapp/js/mindmapList.js @@ -1,4 +1,3 @@ - $.fn.dataTableExt.oApi.fnReloadAjax = function (oSettings, sNewSource, fnCallback, bStandingRedraw) { if (typeof sNewSource != 'undefined' && sNewSource != null) { oSettings.sAjaxSource = sNewSource; @@ -180,7 +179,9 @@ function updateStatusToolbar() { // Can be executed by the owner ? var rowData = tableElem.dataTable().fnGetData(selectedRows[0]); - if (rowData.role != 'owner') { + if ('owner' == rowData.role) { + $(".buttonsToolbar").find('#publishBtn').show().end().find('#shareBtn').show().end().find('#renameBtn').show(); + } else { $(".buttonsToolbar").find('#publishBtn').hide().end().find('#shareBtn').hide().end().find('#renameBtn').hide(); } } else {