=== modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2014-08-25 13:11:09 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2014-08-26 11:58:34 +0000 @@ -600,7 +600,7 @@ isLoaded: false, pageSize: 10, page: 1, - defaultUrl: gis.init.contextPath + gis.conf.finals.url.path_api + 'maps.json?fields=id,name,access', + defaultUrl: gis.init.contextPath + '/api/maps.json?fields=id,name,access', loadStore: function(url) { this.proxy.url = url || this.defaultUrl; @@ -2629,7 +2629,7 @@ }; Ext.Ajax.request({ - url: gis.init.contextPath + gis.conf.finals.url.path_api + 'maps/', + url: gis.init.contextPath + '/api/maps/', method: 'POST', headers: {'Content-Type': 'application/json'}, params: Ext.encode(map), @@ -3854,84 +3854,88 @@ }; GIS.app.InterpretationWindow = function() { - var window, - textarea, - panel, - button; - - textarea = Ext.create('Ext.form.field.TextArea', { - cls: 'gis-textarea', - height: 130, - fieldStyle: 'padding-left: 3px; padding-top: 3px', - emptyText: GIS.i18n.write_your_interpretation + '..' - }); - - panel = Ext.create('Ext.panel.Panel', { - cls: 'gis-container-inner', - html: function() { - var moduleUrl = gis.init.contextPath + '/dhis-web-mapping/app/index.html?id=' + gis.map.id, - apiUrl = gis.init.contextPath + '/api/maps/' + gis.map.id + '/data', - html = ''; - - html += '
Map link: ' + moduleUrl + '
'; - html += '
API link: ' + apiUrl + '
'; - - return html; - }(), - style: 'padding:3px', - }); - - button = Ext.create('Ext.button.Button', { - text: GIS.i18n.share, - handler: function() { - if (textarea.getValue() && gis.map && gis.map.id) { - Ext.Ajax.request({ - url: gis.init.contextPath + gis.conf.finals.url.path_api + 'interpretations/map/' + gis.map.id, - method: 'POST', - params: textarea.getValue(), - headers: {'Content-Type': 'text/html'}, - success: function() { - window.destroy(); - } - }); - } - } - }); - - window = Ext.create('Ext.window.Window', { - title: gis.map.name, - layout: 'fit', - iconCls: 'gis-window-title-icon-interpretation', - cls: 'gis-container-default', - bodyStyle: 'padding: 1px', - width: 500, - resizable: true, - modal: true, - items: [ - textarea, - panel - ], - bbar: [ - '->', - button - ], - listeners: { - show: function() { - this.setPosition(325, 33); - }, - destroy: function() { - document.body.oncontextmenu = function(){ - return false; - }; - } - - } - }); - - document.body.oncontextmenu = true; // right click to copy url - - return window; - }; + var textArea, + shareButton, + window; + + if (Ext.isString(gis.map.id)) { + textArea = Ext.create('Ext.form.field.TextArea', { + cls: 'gis-textarea', + height: 130, + fieldStyle: 'padding-left: 3px; padding-top: 3px', + emptyText: GIS.i18n.write_your_interpretation + '..', + enableKeyEvents: true, + listeners: { + keyup: function() { + shareButton.xable(); + } + } + }); + + shareButton = Ext.create('Ext.button.Button', { + text: GIS.i18n.share, + disabled: true, + xable: function() { + this.setDisabled(!textArea.getValue()); + }, + handler: function() { + if (textArea.getValue()) { + Ext.Ajax.request({ + url: gis.init.contextPath + '/api/interpretations/map/' + gis.map.id, + method: 'POST', + params: textArea.getValue(), + headers: {'Content-Type': 'text/html'}, + success: function() { + textArea.reset(); + window.hide(); + } + }); + } + } + }); + + window = Ext.create('Ext.window.Window', { + title: gis.map.name, + layout: 'fit', + iconCls: 'gis-window-title-icon-interpretation', + cls: 'gis-container-default', + bodyStyle: 'padding: 1px', + width: 500, + resizable: true, + modal: true, + items: [ + textArea + ], + bbar: { + //cls: 'gis-toolbar-bbar', + defaults: { + height: 24 + }, + items: [ + '->', + shareButton + ] + }, + listeners: { + show: function() { + this.setPosition(325, 33); + + document.body.oncontextmenu = true; + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + }, + destroy: function() { + gis.viewport.interpretationWindow = null; + } + } + }); + + return window; + } + + return; + }; GIS.app.CircleLayer = function(features, radius) { var points = gis.util.map.getPointsByFeatures(features), @@ -8504,12 +8508,104 @@ } }); + favoriteUrlItem = Ext.create('Ext.menu.Item', { + text: 'Favorite link' + '  ', + iconCls: 'gis-menu-item-datasource', + disabled: true, + xable: function() { + if (gis.map.id) { + this.enable(); + } + else { + this.disable(); + } + }, + handler: function() { + var url = gis.init.contextPath + '/dhis-web-mapping/app/index.html?id=' + gis.map.id, + textField, + window; + + textField = Ext.create('Ext.form.field.Text', { + html: '' + url + '' + }); + + window = Ext.create('Ext.window.Window', { + title: 'Favorite link', + layout: 'fit', + modal: true, + resizable: false, + destroyOnBlur: true, + bodyStyle: 'padding: 12px 18px; background-color: #fff; font-size: 11px', + html: '' + url + '', + listeners: { + show: function(w) { + this.setPosition(325, 33); + + document.body.oncontextmenu = true; + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + } + } + }); + + window.show(); + } + }); + + apiUrlItem = Ext.create('Ext.menu.Item', { + text: 'API link' + '  ', + iconCls: 'gis-menu-item-datasource', + disabled: true, + xable: function() { + if (gis.map.id) { + this.enable(); + } + else { + this.disable(); + } + }, + handler: function() { + var url = gis.init.contextPath + '/api/maps/' + gis.map.id + '/data', + textField, + window; + + textField = Ext.create('Ext.form.field.Text', { + html: '' + url + '' + }); + + window = Ext.create('Ext.window.Window', { + title: 'API link', + layout: 'fit', + modal: true, + resizable: false, + destroyOnBlur: true, + bodyStyle: 'padding: 12px 18px; background-color: #fff; font-size: 11px', + html: '' + url + '', + listeners: { + show: function(w) { + this.setPosition(325, 33); + + document.body.oncontextmenu = true; + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + } + } + }); + + window.show(); + } + }); + shareButton = Ext.create('Ext.button.Button', { text: GIS.i18n.share, disabled: true, xableItems: function() { interpretationItem.xable(); pluginItem.xable(); + favoriteUrlItem.xable(); + apiUrlItem.xable(); }, menu: { cls: 'gis-menu', @@ -8517,7 +8613,9 @@ showSeparator: false, items: [ interpretationItem, - pluginItem + pluginItem, + favoriteUrlItem, + apiUrlItem ], listeners: { afterrender: function() { === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/app/styles/style.css' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/app/styles/style.css 2014-08-25 09:12:15 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-mapping/app/styles/style.css 2014-08-26 11:58:34 +0000 @@ -656,7 +656,6 @@ } .gis-toolbar-btn-menu .x-panel-body-default { /* Menu border */ border-radius: 2px; - border-color: #999; } === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-08-25 13:11:09 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2014-08-26 09:31:45 +0000 @@ -1701,7 +1701,6 @@ InterpretationWindow = function() { var textArea, - linkPanel, shareButton, window; @@ -1710,7 +1709,7 @@ cls: 'ns-textarea', height: 130, fieldStyle: 'padding-left: 3px; padding-top: 3px', - emptyText: NS.i18n.write_your_interpretation, + emptyText: NS.i18n.write_your_interpretation + '..', enableKeyEvents: true, listeners: { keyup: function() { @@ -1719,20 +1718,6 @@ } }); - linkPanel = Ext.create('Ext.panel.Panel', { - html: function() { - var url = ns.core.init.contextPath + '/dhis-web-pivot/app/index.html?id=' + ns.app.layout.id, - apiUrl = ns.core.init.contextPath + '/api/reportTables/' + ns.app.layout.id + '/data.html', - html = ''; - - html += '
Table link: ' + url + '
'; - html += '
API link: ' + apiUrl + '
'; - return html; - }(), - style: 'padding:3px', - bodyStyle: 'border: 0 none' - }); - shareButton = Ext.create('Ext.button.Button', { text: NS.i18n.share, disabled: true, @@ -1760,13 +1745,12 @@ layout: 'fit', //iconCls: 'ns-window-title-interpretation', width: 500, - bodyStyle: 'padding:2px; background-color:#fff', + bodyStyle: 'padding:1px; background-color:#fff', resizable: false, destroyOnBlur: true, modal: true, items: [ - textArea, - linkPanel + textArea ], bbar: { cls: 'ns-toolbar-bbar', @@ -2591,6 +2575,8 @@ downloadButton, interpretationItem, pluginItem, + favoriteUrlItem, + apiUrlItem, shareButton, defaultButton, centerRegion, @@ -5426,7 +5412,7 @@ }); pluginItem = Ext.create('Ext.menu.Item', { - text: 'Embed as plugin' + '  ', + text: 'Embed in any webpage' + '  ', iconCls: 'ns-menu-item-datasource', disabled: true, xable: function() { @@ -5499,12 +5485,112 @@ } }); + favoriteUrlItem = Ext.create('Ext.menu.Item', { + text: 'Favorite link' + '  ', + iconCls: 'ns-menu-item-datasource', + disabled: true, + xable: function() { + if (ns.app.layout.id) { + this.enable(); + } + else { + this.disable(); + } + }, + handler: function() { + var url = ns.core.init.contextPath + '/dhis-web-pivot/app/index.html?id=' + ns.app.layout.id, + textField, + window; + + textField = Ext.create('Ext.form.field.Text', { + html: '' + url + '' + }); + + window = Ext.create('Ext.window.Window', { + title: 'Favorite link', + layout: 'fit', + modal: true, + resizable: false, + destroyOnBlur: true, + bodyStyle: 'padding: 12px 18px; background-color: #fff; font-size: 11px', + html: '' + url + '', + listeners: { + show: function(w) { + ns.core.web.window.setAnchorPosition(w, ns.app.shareButton); + + document.body.oncontextmenu = true; + + if (!w.hasDestroyOnBlurHandler) { + ns.core.web.window.addDestroyOnBlurHandler(w); + } + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + } + } + }); + + window.show(); + } + }); + + apiUrlItem = Ext.create('Ext.menu.Item', { + text: 'API link' + '  ', + iconCls: 'ns-menu-item-datasource', + disabled: true, + xable: function() { + if (ns.app.layout.id) { + this.enable(); + } + else { + this.disable(); + } + }, + handler: function() { + var url = ns.core.init.contextPath + '/api/reportTables/' + ns.app.layout.id + '/data.html', + textField, + window; + + textField = Ext.create('Ext.form.field.Text', { + html: '' + url + '' + }); + + window = Ext.create('Ext.window.Window', { + title: 'API link', + layout: 'fit', + modal: true, + resizable: false, + destroyOnBlur: true, + bodyStyle: 'padding: 12px 18px; background-color: #fff; font-size: 11px', + html: '' + url + '', + listeners: { + show: function(w) { + ns.core.web.window.setAnchorPosition(w, ns.app.shareButton); + + document.body.oncontextmenu = true; + + if (!w.hasDestroyOnBlurHandler) { + ns.core.web.window.addDestroyOnBlurHandler(w); + } + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + } + } + }); + + window.show(); + } + }); + shareButton = Ext.create('Ext.button.Button', { text: NS.i18n.share, disabled: true, xableItems: function() { interpretationItem.xable(); pluginItem.xable(); + favoriteUrlItem.xable(); + apiUrlItem.xable(); }, menu: { cls: 'ns-menu', @@ -5512,7 +5598,9 @@ showSeparator: false, items: [ interpretationItem, - pluginItem + pluginItem, + favoriteUrlItem, + apiUrlItem ], listeners: { afterrender: function() { === modified file 'dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/app/scripts/app.js' --- dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2014-08-25 13:11:09 +0000 +++ dhis-2/dhis-web/dhis-web-apps/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2014-08-26 09:31:45 +0000 @@ -1753,7 +1753,6 @@ InterpretationWindow = function() { var textArea, - linkPanel, shareButton, window; @@ -1762,7 +1761,7 @@ cls: 'ns-textarea', height: 130, fieldStyle: 'padding-left: 3px; padding-top: 3px', - emptyText: NS.i18n.write_your_interpretation, + emptyText: NS.i18n.write_your_interpretation + '..', enableKeyEvents: true, listeners: { keyup: function() { @@ -1771,20 +1770,6 @@ } }); - linkPanel = Ext.create('Ext.panel.Panel', { - html: function() { - var url = ns.core.init.contextPath + '/dhis-web-visualizer/app/index.html?id=' + ns.app.layout.id, - apiUrl = ns.core.init.contextPath + '/api/charts/' + ns.app.layout.id + '/data', - html = ''; - - html += '
Chart link: ' + url + '
'; - html += '
API link: ' + apiUrl + '
'; - return html; - }(), - style: 'padding: 3px', - bodyStyle: 'border: 0 none' - }); - shareButton = Ext.create('Ext.button.Button', { text: NS.i18n.share, disabled: true, @@ -1810,14 +1795,14 @@ window = Ext.create('Ext.window.Window', { title: ns.app.layout.name, layout: 'fit', + //iconCls: 'ns-window-title-interpretation', width: 500, bodyStyle: 'padding:1px; background-color:#fff', resizable: false, destroyOnBlur: true, modal: true, items: [ - textArea, - linkPanel + textArea ], bbar: { cls: 'ns-toolbar-bbar', @@ -2413,6 +2398,8 @@ downloadButton, interpretationItem, pluginItem, + favoriteUrlItem, + apiUrlItem, shareButton, defaultButton, centerRegion, @@ -5398,12 +5385,112 @@ } }); + favoriteUrlItem = Ext.create('Ext.menu.Item', { + text: 'Favorite link' + '  ', + iconCls: 'ns-menu-item-datasource', + disabled: true, + xable: function() { + if (ns.app.layout.id) { + this.enable(); + } + else { + this.disable(); + } + }, + handler: function() { + var url = ns.core.init.contextPath + '/dhis-web-visualizer/app/index.html?id=' + ns.app.layout.id, + textField, + window; + + textField = Ext.create('Ext.form.field.Text', { + html: '' + url + '' + }); + + window = Ext.create('Ext.window.Window', { + title: 'Favorite link', + layout: 'fit', + modal: true, + resizable: false, + destroyOnBlur: true, + bodyStyle: 'padding: 12px 18px; background-color: #fff; font-size: 11px', + html: '' + url + '', + listeners: { + show: function(w) { + ns.core.web.window.setAnchorPosition(w, ns.app.shareButton); + + document.body.oncontextmenu = true; + + if (!w.hasDestroyOnBlurHandler) { + ns.core.web.window.addDestroyOnBlurHandler(w); + } + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + } + } + }); + + window.show(); + } + }); + + apiUrlItem = Ext.create('Ext.menu.Item', { + text: 'API link' + '  ', + iconCls: 'ns-menu-item-datasource', + disabled: true, + xable: function() { + if (ns.app.layout.id) { + this.enable(); + } + else { + this.disable(); + } + }, + handler: function() { + var url = ns.core.init.contextPath + '/api/charts/' + ns.app.layout.id + '/data', + textField, + window; + + textField = Ext.create('Ext.form.field.Text', { + html: '' + url + '' + }); + + window = Ext.create('Ext.window.Window', { + title: 'API link', + layout: 'fit', + modal: true, + resizable: false, + destroyOnBlur: true, + bodyStyle: 'padding: 12px 18px; background-color: #fff; font-size: 11px', + html: '' + url + '', + listeners: { + show: function(w) { + ns.core.web.window.setAnchorPosition(w, ns.app.shareButton); + + document.body.oncontextmenu = true; + + if (!w.hasDestroyOnBlurHandler) { + ns.core.web.window.addDestroyOnBlurHandler(w); + } + }, + hide: function() { + document.body.oncontextmenu = function(){return false;}; + } + } + }); + + window.show(); + } + }); + shareButton = Ext.create('Ext.button.Button', { text: NS.i18n.share, disabled: true, xableItems: function() { interpretationItem.xable(); pluginItem.xable(); + favoriteUrlItem.xable(); + apiUrlItem.xable(); }, menu: { cls: 'ns-menu', @@ -5411,7 +5498,9 @@ showSeparator: false, items: [ interpretationItem, - pluginItem + pluginItem, + favoriteUrlItem, + apiUrlItem ], listeners: { afterrender: function() {