dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #32372
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 16524: PT DV GIS share fav/api links.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 16524 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2014-08-26 14:04:05 +0200
message:
PT DV GIS share fav/api links.
modified:
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/styles/style.css
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-visualizer/app/scripts/app.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== 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 += '<div><b>Map link: </b><span class="user-select"><a href="' + moduleUrl + '" target="_blank">' + moduleUrl + '</a></span></div>';
- html += '<div style="padding-top:3px"><b>API link: </b><span class="user-select"><a href="' + apiUrl + '" target="_blank">' + apiUrl + '</a></span></div>';
-
- 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>'
+ });
+
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>',
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>'
+ });
+
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>',
+ 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 += '<div><b>Table link: </b><span class="user-select"><a href="' + url + '" target="_blank">' + url + '</a></span></div>';
- html += '<div style="padding-top:3px"><b>API link: </b><span class="user-select"><a href="' + apiUrl + '" target="_blank">' + apiUrl + '</a></span></div>';
- 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>'
+ });
+
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>',
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>'
+ });
+
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>',
+ 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 += '<div><b>Chart link: </b><span class="user-select"><a href="' + url + '" target="_blank">' + url + '</a></span></div>';
- html += '<div style="padding-top:3px"><b>API link: </b><span class="user-select"><a href="' + apiUrl + '" target="_blank">' + apiUrl + '</a></span></div>';
- 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>'
+ });
+
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>',
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>'
+ });
+
+ 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: '<a class="user-select td-nobreak" target="_blank" href="' + url + '">' + url + '</a>',
+ 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() {