dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #19782
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8769: (DV) Exit redirect fixed + (GIS) Favorites (work in progress).
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 8769 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-10-30 14:49:45 +0300
message:
(DV) Exit redirect fixed + (GIS) Favorites (work in progress).
added:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_14.png
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_16.png
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/grid-save_16.png
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css
dhis-2/dhis-web/dhis-web-visualizer/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
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_14.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_14.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_14.png 2012-10-26 22:49:41 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_16.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_16.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/favorite_16.png 2012-10-26 13:47:25 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/grid-save_16.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/grid-save_16.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/grid-save_16.png 2012-10-26 22:49:41 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2012-10-25 15:38:29 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2012-10-30 07:26:04 +0000
@@ -55,6 +55,9 @@
item_width: 222,
itemlabel_width: 95,
window_width: 250
+ },
+ grid: {
+ row_height: 27
}
},
period: {
@@ -746,6 +749,39 @@
}
});
+ GIS.store.maps = Ext.create('Ext.data.Store', {
+ fields: ['id', 'name', 'lastUpdated'],
+ proxy: {
+ type: 'ajax',
+ url: GIS.conf.url.path_api + 'indicators.json?links=false',
+ reader: {
+ type: 'json',
+ root: 'indicators'
+ }
+ },
+ isLoaded: false,
+ loadFn: function(fn) {
+ if (this.isLoaded) {
+ fn.call();
+ }
+ else {
+ this.load(fn);
+ }
+ },
+ listeners: {
+ beforeload: function() {
+ //console.log(this.getProxy());
+ //this.getProxy().setExtraParam('pageSize', GIS.cmp.region.center.getHeight() - 155);
+ },
+ load: function() {
+ if (!this.isLoaded) {
+ this.isLoaded = true;
+ }
+ this.sort('name', 'ASC');
+ }
+ }
+ });
+
// Objects
GIS.obj.StyleMap = function(base, labelConfig) {
@@ -1454,6 +1490,192 @@
return panel;
};
+ GIS.obj.MapWindow = function() {
+
+ // Objects
+ var UpdateWindow,
+
+ // Instances
+ updateWindow,
+
+ // Components
+ addButton,
+ searchTextfield,
+ grid,
+ prevButton,
+ nextButton,
+ tbar,
+ bbar,
+
+ nameTextfied,
+ systemCheckbox,
+ createButton,
+ updateButton,
+
+ window;
+
+ searchTextfield = Ext.create('Ext.form.field.Text', {
+ width: 354,
+ height: 26,
+ style: 'margin-right: 4px',
+ fieldStyle: 'padding-left: 6px; border-radius: 1px; border-color: #bbb',
+ emptyText: 'Search for favorites..', //i18n
+ enableKeyEvents: true,
+ currentValue: '',
+ listeners: {
+ keyup: function() {
+ if (this.getValue() !== this.currentValue) {
+ console.log('Request ' + this.getValue());
+ this.currentValue = this.getValue();
+ }
+ }
+ }
+ });
+
+ addButton = Ext.create('Ext.button.Button', {
+ text: 'Add new', //i18n
+ height: 26,
+ style: 'border-radius: 1px',
+ menu: {},
+ handler: function() {
+ }
+ });
+
+ prevButton = Ext.create('Ext.button.Button', {
+ text: 'Prev', //i18n
+ handler: function() {
+ }
+ });
+
+ nextButton = Ext.create('Ext.button.Button', {
+ text: 'Next', //i18n
+ handler: function() {
+ }
+ });
+
+ grid = Ext.create('Ext.grid.Panel', {
+ cls: 'gis-grid',
+ bodyStyle: 'border-top-color: red !important, border-bottom: 0 none',
+ scroll: false,
+ hideHeaders: true,
+ columns: [
+ {
+ dataIndex: 'name',
+ sortable: false,
+ width: 355,
+ renderer: function(value, metaData, record) {
+ var fn = function() {
+ var span = Ext.get(record.data.id),
+ div = span.parent('div'),
+ td = span.parent('td'),
+ currentElement,
+ clickHandler = function(id) {
+ alert(id);
+ console.log(record.data.id);
+ };
+
+ td.addClsOnOver('text-link');
+ td.addListener('click', clickHandler(td.id));
+ };
+
+ Ext.defer(fn, 100);
+
+ return '<span id="' + record.data.id + '">' + value + '</span>';
+ }
+ },
+ {
+ xtype: 'actioncolumn',
+ sortable: false,
+ width: 65,
+ items: [
+ {
+ iconCls: 'gis-grid-row-icon-edit',
+ handler: function(grid, rowIndex, colIndex, col, event) {
+ //var id = this.up('grid').store.getAt(rowIndex).data.id;
+ }
+ },
+ {
+ iconCls: 'gis-grid-row-icon-overwrite',
+ handler: function(grid, rowIndex, colIndex, col, event) {
+ //var id = this.up('grid').store.getAt(rowIndex).data.id;
+ }
+ },
+ {
+ iconCls: 'gis-grid-row-icon-delete',
+ handler: function(grid, rowIndex, colIndex, col, event) {
+ //var id = this.up('grid').store.getAt(rowIndex).data.id;
+ }
+ }
+ ]
+ }
+ ],
+ store: GIS.store.maps,
+ bbar: [
+ '->',
+ prevButton,
+ nextButton
+ ],
+ listeners: {
+ added: function() {
+ GIS.cmp.mapGrid = this;
+ },
+ render: function() {
+ var size = Math.floor((GIS.cmp.region.center.getHeight() - 155) / GIS.conf.layout.grid.row_height);
+ this.store.load({
+ params: {
+ pageSize: size
+ }
+ });
+ },
+ itemmouseenter: function(grid, record, item) {
+ this.currentItem = Ext.get(item);
+ this.currentItem.removeCls('x-grid-row-over');
+ },
+ select: function() {
+ this.currentItem.removeCls('x-grid-row-selected');
+ },
+ selectionchange: function() {
+ this.currentItem.removeCls('x-grid-row-focused');
+ }
+ }
+ });
+
+ window = Ext.create('Ext.window.Window', {
+ title: 'Manage favorites',
+ iconCls: 'gis-window-title-icon-favorite',
+ cls: 'gis-container-default',
+ width: 450,
+ onmouseover: function(id) { // mapgrid
+ //Ext.get(id).addCls('gis-grid-icon-link');
+ },
+ onmouseout: function(id) {
+ //Ext.get(id).removeCls('gis-grid-icon-link');
+ },
+ onclick: function(id) {
+ //alert(id);
+ },
+ items: [
+ {
+ xtype: 'panel',
+ layout: 'hbox',
+ cls: 'gis-container-inner',
+ items: [
+ searchTextfield,
+ addButton
+ ]
+ },
+ grid
+ ],
+ listeners: {
+ show: function() {
+ this.setPosition(this.getPosition()[0], 40);
+ }
+ }
+ });
+
+ return window;
+ };
+
GIS.obj.LegendSetWindow = function() {
// Stores
@@ -1493,7 +1715,7 @@
validateLegends;
legendSetStore = Ext.create('Ext.data.Store', {
- fields: ['id', 'name', 'edit', 'del'],
+ fields: ['id', 'name'],
proxy: {
type: 'ajax',
url: GIS.conf.url.path_api + 'mapLegendSets.json?links=false&paging=false',
@@ -1506,15 +1728,6 @@
load: function(store, records) {
this.sort('name', 'ASC');
- this.each( function(record) {
- record.set({
- edit: '<img id="' + record.getId() + '" class="gis-grid-icon-link" src="images/grid-edit_16.png"' +
- 'name="legendSetGrid" onclick="Ext.getCmp(this.name).showUpdateLegendSet(this.id);" />',
- del: '<img id="' + record.getId() + '" class="gis-grid-icon-link" src="images/grid-delete_16.png"' +
- 'name="legendSetGrid" onclick="Ext.getCmp(this.name).deleteLegendSet(this.id);" />'
- });
- });
-
info.setText(records.length + ' legend sets available');
}
}
@@ -1565,30 +1778,38 @@
});
legendSetGrid = Ext.create('Ext.grid.Panel', {
- id: 'legendSetGrid',
cls: 'gis-grid',
bodyStyle: 'border-top: 0 none',
width: GIS.conf.layout.widget.item_width,
scroll: 'vertical',
hideHeaders: true,
- showUpdateLegendSet: showUpdateLegendSet,
- deleteLegendSet: deleteLegendSet,
currentItem: null,
- columns: [
+ columns: [
{
dataIndex: 'name',
sortable: false,
width: GIS.conf.layout.widget.item_width - 62
},
{
- dataIndex: 'edit',
- sortable: false,
- width: 20
- },
- {
- dataIndex: 'del',
- sortable: false,
- width: 20
+ xtype: 'actioncolumn',
+ sortable: false,
+ width: 40,
+ items: [
+ {
+ iconCls: 'gis-grid-row-icon-edit',
+ handler: function(grid, rowIndex, colIndex, col, event) {
+ var id = this.up('grid').store.getAt(rowIndex).data.id;
+ showUpdateLegendSet(id);
+ }
+ },
+ {
+ iconCls: 'gis-grid-row-icon-delete',
+ handler: function(grid, rowIndex, colIndex, col, event) {
+ var id = this.up('grid').store.getAt(rowIndex).data.id;
+ deleteLegendSet(id);
+ }
+ }
+ ]
},
{
sortable: false,
@@ -1624,30 +1845,19 @@
data = [];
tmpLegendStore = Ext.create('Ext.data.ArrayStore', {
- fields: ['id', 'name', 'startValue', 'endValue', 'color', 'colorString', 'del'],
- listeners: {
- add: function() {
- this.each( function(record) {
- record.set({
- colorString: '<span style="color:' + record.data.color + '">Color</span>',
- del: '<img id="' + record.data.id + '" class="gis-grid-icon-link" src="images/grid-delete_16.png"' +
- ' name="legendGrid" onclick="Ext.getCmp(this.name).deleteLegend(this.id);" />'
- });
- });
- }
- }
+ fields: ['id', 'name', 'startValue', 'endValue', 'color']
});
-
+
legendSetName = Ext.create('Ext.form.field.Text', {
cls: 'gis-textfield',
width: GIS.conf.layout.widget.item_width,
- fieldLabel: 'Legend set name' //i18m
+ fieldLabel: 'Legend set name' //i18n
});
legendName = Ext.create('Ext.form.field.Text', {
cls: 'gis-textfield',
width: GIS.conf.layout.widget.item_width - 12,
- fieldLabel: 'Legend name' //i18m
+ fieldLabel: 'Legend name' //i18n
});
startValue = Ext.create('Ext.form.field.Number', {
@@ -1665,7 +1875,7 @@
color = Ext.create('Ext.ux.button.ColorButton', {
width: GIS.conf.layout.widget.item_width - GIS.conf.layout.widget.itemlabel_width - 10 - 12,
- fieldLabel: 'Symbolizer', //i18m
+ fieldLabel: 'Symbolizer', //i18n
value: 'e1e1e1'
});
@@ -1710,14 +1920,12 @@
});
legendGrid = Ext.create('Ext.grid.Panel', {
- id: 'legendGrid',
cls: 'gis-grid',
bodyStyle: 'border-top: 0 none',
width: GIS.conf.layout.widget.item_width,
height: 235,
scroll: 'vertical',
hideHeaders: true,
- deleteLegend: deleteLegend,
currentItem: null,
columns: [
{
@@ -1726,15 +1934,16 @@
width: GIS.conf.layout.widget.item_width - 156
},
{
- dataIndex: 'colorString',
sortable: false,
- width: 40
+ width: 40,
+ renderer: function(value, metaData, record) {
+ return '<span style="color:' + record.data.color + '">Color</span>';
+ }
},
{
dataIndex: 'startValue',
sortable: false,
- width: 37,
- cls: 'NISSA'
+ width: 37
},
{
dataIndex: 'endValue',
@@ -1742,9 +1951,18 @@
width: 37
},
{
- dataIndex: 'del',
+ xtype: 'actioncolumn',
sortable: false,
- width: 20
+ width: 20,
+ items: [
+ {
+ iconCls: 'gis-grid-row-icon-delete',
+ handler: function(grid, rowIndex, colIndex, col, event) {
+ var id = this.up('grid').store.getAt(rowIndex).data.id;
+ deleteLegend(id);
+ }
+ }
+ ]
},
{
sortable: false,
@@ -1862,10 +2080,8 @@
deleteLegendSet = function(id) {
if (id) {
Ext.Ajax.request({
- url: GIS.conf.url.path_gis + 'deleteMapLegendSet.action',
- params: {
- id: id
- },
+ url: GIS.conf.url.path_api + 'mapLegendSets/' + id,
+ method: 'DELETE',
success: function() {
legendSetStore.load();
}
@@ -1883,7 +2099,6 @@
body = {
name: legendSetName.getValue(),
- type: GIS.conf.finals.widget.legendtype_predefined,
symbolizer: GIS.conf.finals.widget.symbolizer_color,
mapLegends: []
};
@@ -2038,7 +2253,7 @@
return window;
};
- GIS.obj.getDownloadMenu = function() {
+ GIS.obj.DownloadMenu = function() {
var menu,
item,
textfield,
@@ -2059,20 +2274,20 @@
var title = textfield.getValue(),
svg = GIS.util.svg.getString(title, GIS.util.map.getVisibleVectorLayers()),
exportForm = document.getElementById('exportForm');
-
+
if (svg) {
document.getElementById('svgField').value = svg;
document.getElementById('titleField').value = title;
exportForm.action = '../exportImage.action';
exportForm.method = 'post';
exportForm.submit();
+ }
+ else {
+ alert('Please create a map first'); //todo //i18n
+ }
- textfield.reset();
- menu.hide();
- }
- else {
- alert('No map data to export'); //todo //i18n
- }
+ textfield.reset();
+ menu.hide();
}
});
@@ -2094,13 +2309,7 @@
height: 30,
cls: 'gis-menu',
items: item,
- listeners: {
- beforeshow: function() {
- if (!GIS.util.map.getVisibleVectorLayers()) {
- alert('No map data to export'); //todo //i18n
- return false;
- }
- },
+ listeners: {
afterrender: function() {
this.getEl().addCls('gis-toolbar-btn-menu gis-toolbar-btn-menu-download');
},
@@ -2326,14 +2535,17 @@
menu: new GIS.obj.LayerMenu(GIS.base.facility),
width: 26
},
- //{
- //iconCls: 'gis-btn-icon-' + GIS.base.symbol.id,
- //menu: new GIS.obj.LayerMenu(GIS.base.symbol),
- //width: 26
- //},
{
text: 'Favorites', //i18n
- menu: {}
+ menu: {},
+ handler: function() {
+ if (GIS.cmp.mapWindow && GIS.cmp.mapWindow.destroy) {
+ GIS.cmp.mapWindow.destroy();
+ }
+
+ GIS.cmp.mapWindow = new GIS.obj.MapWindow();
+ GIS.cmp.mapWindow.show();
+ }
},
{
text: 'Legend', //i18n
@@ -2349,7 +2561,7 @@
},
{
text: 'Download', //i18n
- menu: GIS.obj.getDownloadMenu()
+ menu: new GIS.obj.DownloadMenu()
},
'->',
{
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css 2012-10-25 12:07:10 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css 2012-10-30 07:26:04 +0000
@@ -13,6 +13,7 @@
* TextField
* Checkbox
* NumberField
+ * Label
*/
/* General */
@@ -182,7 +183,7 @@
.x-btn-default-toolbar-small-over {
border-color: #bbb;
- border-radius: 2px;
+ border-radius: 1px;
}
.gis-toolbar-btn-menu-download .x-btn-icon,
@@ -276,37 +277,22 @@
}
.gis-menu-item-icon-edit,
- .gis-menu-item-icon-refresh,
.gis-menu-item-icon-clear,
.gis-menu-item-icon-labels,
.gis-menu-item-icon-filter,
.gis-menu-item-icon-search,
- .gis-menu-item-icon-opacity,
- .gis-menu-item-icon-history,
.gis-menu-item-icon-drill,
.gis-menu-item-icon-float,
.gis-menu-item-icon-information,
.gis-menu-item-icon-relocate,
- .gis-menu-item-icon-opacity10,
- .gis-menu-item-icon-opacity20,
- .gis-menu-item-icon-opacity30,
- .gis-menu-item-icon-opacity40,
- .gis-menu-item-icon-opacity50,
- .gis-menu-item-icon-opacity60,
- .gis-menu-item-icon-opacity70,
- .gis-menu-item-icon-opacity80,
- .gis-menu-item-icon-opacity90,
- .gis-menu-item-icon-opacity100 {
+ .gis-menu-item-icon-favorite {
left: 6px;
}
.gis-menu-item-icon-edit {
background: url('../images/edit_16.png') no-repeat;
}
- .gis-menu-item-icon-refresh {
- background: url('../images/refresh_16.png') no-repeat;
- }
.gis-menu-item-icon-clear {
background: url('../images/clear_16.png') no-repeat;
}
@@ -319,12 +305,6 @@
.gis-menu-item-icon-search {
background: url('../images/search_16.png') no-repeat;
}
- .gis-menu-item-icon-opacity {
- background: url('../images/opacity_16.png') no-repeat;
- }
- .gis-menu-item-icon-history {
- background: url('../images/history_16.png') no-repeat;
- }
.gis-menu-item-icon-drill {
background: url('../images/drill_16.png') no-repeat;
@@ -339,6 +319,10 @@
background: url('../images/relocate_16.png') no-repeat;
}
+ .gis-menu-item-icon-favorite {
+ background: url('../images/favorite_16.png') no-repeat;
+ }
+
.x-menu-item-separator {
height: 1px;
}
@@ -454,8 +438,32 @@
/* Grid */
+.gis-grid-row-icon-edit,
+.gis-grid-row-icon-overwrite,
+.gis-grid-row-icon-delete {
+ width: 16px;
+ height: 16px;
+ cursor: pointer;
+}
+.gis-grid-row-icon-edit {
+ background: url('../images/grid-edit_16.png') no-repeat;
+}
+.gis-grid-row-icon-overwrite {
+ background: url('../images/grid-save_16.png') no-repeat;
+ margin-left: 4px;
+}
+.gis-grid-row-icon-delete {
+ background: url('../images/grid-delete_16.png') no-repeat;
+ margin-left: 4px;
+}
+
+.gis-grid .x-grid-cell-inner,
+.gis-grid .x-grid-cell-inner * {
+ font-size: 10px !important;
+}
.gis-grid .x-grid-cell-inner {
- font-size: 10px !important;
+ padding-top: 3px;
+ padding-bottom: 3px;
}
.gis-grid .x-column-header-text {
@@ -463,20 +471,29 @@
}
.gis-grid .x-grid-header-ct {
border-bottom-width: 1px !important;
- border-bottom-color: #dbdbdb;
+ border-bottom-color: #d0d0d0;
+}
+.gis-grid .x-grid-body {
+ border-top: 0 none !important;
}
-.gis-grid .x-grid-dirty-cell { /* hide red cell icon */
+.gis-grid .x-grid-dirty-cell { /* hide red "dirty" icon */
background-image: none;
}
.gis-grid .x-grid-row { /* middle align text in row with image */
vertical-align: middle;
}
-.gis-grid-icon-link {
+.gis-grid td.text-link,
+.gis-grid td.text-link div,
+.gis-grid td.text-link span {
cursor: pointer;
cursor: hand;
}
+.gis-grid td.text-link span {
+ color: blue;
+ text-decoration: underline;
+}
/* TextField */
@@ -508,3 +525,4 @@
height: 22px;
line-height: 21px;
}
+
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2012-10-24 10:45:58 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/app.js 2012-10-30 11:45:55 +0000
@@ -88,11 +88,10 @@
path_visualizer: '../',
path_api: '../../api/',
path_commons: '../../dhis-web-commons-ajax-json/',
- path_portal: '../../dhis-web-portal/',
path_lib: '../../dhis-web-commons/javascripts/',
path_images: 'images/',
initialize: 'initialize.action',
- redirect: 'redirect.action',
+ redirect: 'dhis-web-commons-about/redirect.action',
data_get: 'chartValues.json',
indicator_get: 'indicatorGroups/',
indicator_getall: 'indicators.json?paging=false&links=false',
@@ -4959,7 +4958,7 @@
cls: 'dv-toolbar-btn-2',
text: 'Exit',
handler: function() {
- window.location.href = DV.conf.finals.ajax.path_portal + DV.conf.finals.ajax.redirect;
+ window.location.href = '../../dhis-web-commons-about/redirect.action';
}
},
{