=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2012-07-09 10:10:20 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnit.java 2012-10-25 12:07:10 +0000 @@ -132,7 +132,7 @@ private transient String type; - private transient String[] groupNames; + private transient List groupNames = new ArrayList(); private transient Double value; @@ -864,12 +864,12 @@ this.level = level; } - public String[] getGroupNames() + public List getGroupNames() { return groupNames; } - public void setGroupNames( String[] groupNames ) + public void setGroupNames( List groupNames ) { this.groupNames = groupNames; } === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2012-04-22 16:16:24 +0000 +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/organisationunit/OrganisationUnitGroupSet.java 2012-10-25 12:07:10 +0000 @@ -227,7 +227,6 @@ } @JsonProperty( value = "organisationUnitGroups" ) - @JsonSerialize( contentAs = BaseIdentifiableObject.class ) @JsonView( {DetailedView.class, ExportView.class} ) @JacksonXmlElementWrapper( localName = "organisationUnitGroups", namespace = Dxf2Namespace.NAMESPACE ) @JacksonXmlProperty( localName = "organisationUnitGroup", namespace = Dxf2Namespace.NAMESPACE ) === added file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/periodTypeNoDep.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/periodTypeNoDep.js 1970-01-01 00:00:00 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/periodTypeNoDep.js 2012-10-24 13:10:34 +0000 @@ -0,0 +1,406 @@ +// generatePeriods config object: { boolean offset, boolean filterFuturePeriods, boolean reversePeriods } + +function PeriodType() +{ + var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', + 'July', 'August', 'September', 'October', 'November', 'December'], + + format_yyyymmdd = function(date) { + var y = date.getFullYear(), + m = new String(date.getMonth() + 1), + d = new String(date.getDate()); + m = m.length < 2 ? '0' + m : m; + d = d.length < 2 ? '0' + d : d; + return y + '-' + m + '-' + d; + }, + + filterFuturePeriods = function( periods ) { + var array = [], + now = new Date(); + + for ( var i = 0; i < periods.length; i++ ) + { + if ( new Date( periods[i]['startDate'] ) <= now ) + { + array.push(periods[i]); + } + } + + return array; + }; + + var periodTypes = []; + periodTypes['Daily'] = new DailyPeriodType( format_yyyymmdd, filterFuturePeriods ); + periodTypes['Weekly'] = new WeeklyPeriodType( format_yyyymmdd, filterFuturePeriods ); + periodTypes['Monthly'] = new MonthlyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); + periodTypes['BiMonthly'] = new BiMonthlyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); + periodTypes['Quarterly'] = new QuarterlyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); + periodTypes['SixMonthly'] = new SixMonthlyPeriodType( monthNames, filterFuturePeriods ); + periodTypes['Yearly'] = new YearlyPeriodType( format_yyyymmdd, filterFuturePeriods ); + periodTypes['FinancialOct'] = new FinancialOctoberPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); + periodTypes['FinancialJuly'] = new FinancialJulyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); + periodTypes['FinancialApril'] = new FinancialAprilPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); + + this.get = function( key ) + { + return periodTypes[key]; + }; +} + +function DailyPeriodType( format_yyyymmdd, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset; + date = new Date( '01 Jan ' + year ); + + while ( date.getFullYear() === year ) + { + var period = {}; + period['startDate'] = format_yyyymmdd( date ); + period['endDate'] = period['startDate']; + period['name'] = period['startDate']; + //period['id'] = 'Daily_' + period['startDate']; + period['iso'] = period['startDate'].replace( /-/g, '' ); + period['id'] = period['iso']; + periods.push( period ); + date.setDate( date.getDate() + 1 ); + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods.reverse() : periods; + + return periods; + }; +} + +function WeeklyPeriodType( format_yyyymmdd, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '01 Jan ' + year ), + day = date.getDay(), + week = 1; + + if ( day <= 4 ) + { + date.setDate( date.getDate() - ( day - 1 ) ); + } + else + { + date.setDate( date.getDate() + ( 8 - day ) ); + } + + while ( date.getFullYear() <= year ) + { + var period = {}; + period['startDate'] = format_yyyymmdd( date ); + //period['id'] = 'Weekly_' + period['startDate']; + period['iso'] = year + 'W' + week; + period['id'] = period['iso']; + date.setDate( date.getDate() + 6 ); + period['endDate'] = format_yyyymmdd( date ); + period['name'] = 'W' + week + ' - ' + period['startDate'] + ' - ' + period['endDate']; + periods.push( period ); + date.setDate( date.getDate() + 1 ); + week++; + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods.reverse() : periods; + + return periods; + }; +} + +function MonthlyPeriodType( format_yyyymmdd, monthNames, fnFilter ) +{ + var format_iso = function(date) { + var y = date.getFullYear(), + m = new String(date.getMonth() + 1); + m = m.length < 2 ? '0' + m : m; + return y + m; + }; + + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '31 Dec ' + year ); + + while ( date.getFullYear() === year ) + { + var period = {}; + period['endDate'] = format_yyyymmdd( date ); + date.setDate( 1 ); + period['startDate'] = format_yyyymmdd( date ); + period['name'] = monthNames[date.getMonth()] + ' ' + date.getFullYear(); + //period['id'] = 'Monthly_' + period['startDate']; + period['iso'] = format_iso( date ); + period['id'] = period['iso']; + periods.push( period ); + date.setDate( 0 ); + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods : periods.reverse(); + // Months are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. + + return periods; + }; +} + +function BiMonthlyPeriodType( format_yyyymmdd, monthNames, fnFilter ) +{ + var format_iso = function( date ) { + var y = date.getFullYear(), + m = new String(date.getMonth() + 1); + m = m.length < 2 ? '0' + m : m; + return y + m + 'B'; + }; + + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '31 Dec ' + year ); + + while ( date.getFullYear() === year ) + { + var period = {}; + period['endDate'] = format_yyyymmdd( date ); + date.setDate( 0 ); + date.setDate( 1 ); + period['startDate'] = format_yyyymmdd( date ); + period['name'] = monthNames[date.getMonth()] + ' - ' + monthNames[date.getMonth() + 1] + ' ' + date.getFullYear(); + //period['id'] = 'BiMonthly_' + period['startDate']; + period['iso'] = format_iso( date ); + period['id'] = period['iso']; + periods.push(period); + date.setDate( 0 ); + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods : periods.reverse(); + // Bi-months are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. + + return periods; + }; +} + +function QuarterlyPeriodType( format_yyyymmdd, monthNames, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '31 Dec ' + year ), + quarter = 4; + + while ( date.getFullYear() === year ) + { + var period = {}; + period['endDate'] = format_yyyymmdd( date ); + date.setDate( 0 ); + date.setDate( 0 ); + date.setDate( 1 ); + period['startDate'] = format_yyyymmdd( date ); + period['name'] = monthNames[date.getMonth()] + ' - ' + monthNames[date.getMonth() + 2] + ' ' + date.getFullYear(); + //period['id'] = 'Quarterly_' + period['startDate']; + period['iso'] = year + 'Q' + quarter; + period['id'] = period['iso']; + periods.push(period); + date.setDate( 0 ); + quarter--; + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods : periods.reverse(); + // Quarters are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. + + return periods; + }; +} + +function SixMonthlyPeriodType( monthNames, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset; + + var period = {}; + period['startDate'] = year + '-01-01'; + period['endDate'] = year + '-06-30'; + period['name'] = monthNames[0] + ' - ' + monthNames[5] + ' ' + year; + //period['id'] = 'SixMonthly_' + period['startDate']; + period['iso'] = year + 'S1'; + period['id'] = period['iso']; + periods.push(period); + + period = {}; + period['startDate'] = year + '-07-01'; + period['endDate'] = year + '-12-31'; + period['name'] = monthNames[6] + ' - ' + monthNames[11] + ' ' + year; + //period['id'] = 'SixMonthly_' + period['startDate']; + period['iso'] = year + 'S2'; + period['id'] = period['iso']; + periods.push(period); + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods.reverse() : periods; + + return periods; + }; +} + +function YearlyPeriodType( format_yyyymmdd, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '31 Dec ' + year ); + + while ( ( year - date.getFullYear() ) < 10 ) + { + var period = {}; + period['endDate'] = format_yyyymmdd( date ); + date.setMonth( 0, 1 ); + period['startDate'] = format_yyyymmdd( date ); + period['name'] = date.getFullYear().toString(); + //period['id'] = 'Yearly_' + period['startDate']; + period['iso'] = date.getFullYear().toString(); + period['id'] = period['iso'].toString(); + periods.push(period); + date.setDate(0); + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods : periods.reverse(); + // Years are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. + + return periods; + }; +} + +function FinancialOctoberPeriodType( format_yyyymmdd, monthNames, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '30 Sep ' + ( year + 1 ) ); + + for ( var i = 0; i < 10; i++ ) + { + var period = {}; + period['endDate'] = format_yyyymmdd( date ); + date.setYear( date.getFullYear() - 1 ); + date.setDate( date.getDate() + 1 ); + period['startDate'] = format_yyyymmdd( date ); + period['name'] = monthNames[9] + ' ' + date.getFullYear() + ' - ' + monthNames[8] + ' ' + ( date.getFullYear() + 1 ); + period['id'] = 'FinancialOct_' + period['startDate']; + periods.push( period ); + date.setDate( date.getDate() - 1 ); + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods : periods.reverse(); + // FinancialOctober periods are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. + + return periods; + }; +} + +function FinancialJulyPeriodType( format_yyyymmdd, monthNames, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '30 Jun ' + ( year + 1 ) ); + + for ( var i = 0; i < 10; i++ ) + { + var period = {}; + period['endDate'] = format_yyyymmdd( date ); + date.setYear( date.getFullYear() - 1 ); + date.setDate( date.getDate() + 1 ); + period['startDate'] = format_yyyymmdd( date ); + period['name'] = monthNames[6] + ' ' + date.getFullYear() + ' - ' + monthNames[5] + ' ' + ( date.getFullYear() + 1 ); + period['id'] = 'FinancialJuly_' + period['startDate']; + periods.push( period ); + date.setDate( date.getDate() - 1 ); + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods : periods.reverse(); + // FinancialJuly periods are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. + + return periods; + }; +} + +function FinancialAprilPeriodType( format_yyyymmdd, monthNames, fnFilter ) +{ + this.generatePeriods = function( config ) + { + var periods = [], + offset = parseInt(config.offset), + isFilter = config.filterFuturePeriods, + isReverse = config.reversePeriods, + year = new Date().getFullYear() + offset, + date = new Date( '31 Mar ' + ( year + 1 ) ); + + for ( var i = 0; i < 10; i++ ) + { + var period = {}; + period['endDate'] = format_yyyymmdd( date ); + date.setYear( date.getFullYear() - 1 ); + date.setDate( date.getDate() + 1 ); + period['startDate'] = format_yyyymmdd( date ); + period['name'] = monthNames[3] + ' ' + date.getFullYear() + ' - ' + monthNames[2] + ' ' + ( date.getFullYear() + 1 ); + period['id'] = 'FinancialApril_' + period['startDate']; + periods.push( period ); + date.setDate( date.getDate() - 1 ); + } + + periods = isFilter ? fnFilter( periods ) : periods; + periods = isReverse ? periods : periods.reverse(); + // FinancialApril periods are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. + + return periods; + }; +} + === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonFacilitiesAction.java' --- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonFacilitiesAction.java 2012-10-16 13:33:23 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonFacilitiesAction.java 2012-10-25 12:07:10 +0000 @@ -29,6 +29,7 @@ import java.util.ArrayList; import java.util.Collection; +import java.util.List; import org.hisp.dhis.organisationunit.OrganisationUnit; import org.hisp.dhis.organisationunit.OrganisationUnitGroupService; @@ -92,7 +93,7 @@ { return object; } - + private Collection groupSets; public Collection getGroupSets() @@ -117,7 +118,7 @@ FilterUtils.filter( organisationUnits, new OrganisationUnitWithValidCoordinatesFilter() ); groupSets = organisationUnitGroupService.getAllOrganisationUnitGroupSets(); - + object = new ArrayList(); for ( OrganisationUnit unit : organisationUnits ) @@ -126,15 +127,15 @@ { int i = 0; - String[] groupNames = new String[groupSets.size()]; - + List groupNames = new ArrayList( groupSets.size() ); + for ( OrganisationUnitGroupSet groupSet : groupSets ) { - groupNames[ i++ ] = unit.getGroupNameInGroupSet( groupSet ); + groupNames.add( unit.getGroupNameInGroupSet( groupSet ) ); } - + unit.setGroupNames( groupNames ); - + object.add( unit ); } } === added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/download_22.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/download_22.png 1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/download_22.png 2012-10-24 15:00:24 +0000 differ === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html 2012-10-24 10:45:58 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/index.html 2012-10-24 15:00:24 +0000 @@ -23,7 +23,7 @@
-
+ - + === 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-24 09:38:24 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js 2012-10-25 15:38:29 +0000 @@ -232,33 +232,33 @@ } }); - // Load favorite - var config = { - classes: 5, - colorHigh: "ffff00", - colorLow: "0000ff", - dataElement: null, - dataElementGroup: null, - indicator: "Uvn6LCg7dVU", - indicatorGroup: "AoTB60phSOH", - legendSet: null, - legendType: "automatic", - level: 3, - levelName: "Chiefdom", - method: 2, - parentId: "fdc6uOvgoji", - parentLevel: 2, - parentName: "Bombali", - parentPath: "/ImspTQPwCqd/fdc6uOvgoji", - period: "2012", - periodType: "Yearly", - radiusHigh: 15, - radiusLow: 5, - updateData: false, - updateLegend: false, - updateOrganisationUnit: true, - valueType: "indicator" - }; + // Load favorite //todo + //var config = { + //classes: 5, + //colorHigh: "ffff00", + //colorLow: "0000ff", + //dataElement: null, + //dataElementGroup: null, + //indicator: "Uvn6LCg7dVU", + //indicatorGroup: "AoTB60phSOH", + //legendSet: null, + //legendType: "automatic", + //level: 3, + //levelName: "Chiefdom", + //method: 2, + //parentId: "fdc6uOvgoji", + //parentLevel: 2, + //parentName: "Bombali", + //parentPath: "/ImspTQPwCqd/fdc6uOvgoji", + //period: "2012", + //periodType: "Yearly", + //radiusHigh: 15, + //radiusLow: 5, + //updateData: false, + //updateLegend: false, + //updateOrganisationUnit: true, + //valueType: "indicator" + //}; //GIS.base.thematic1.widget.setConfig(config); //GIS.base.thematic1.widget.execute(); @@ -279,11 +279,13 @@ GIS.util.map.getVisibleVectorLayers = function() { var a = []; for (var i = 0; i < GIS.map.layers.length; i++) { - if (GIS.map.layers[i].layerType === GIS.conf.finals.layer.type_vector && GIS.map.layers[i].visibility) { + if (GIS.map.layers[i].layerType === GIS.conf.finals.layer.type_vector && + GIS.map.layers[i].visibility && + GIS.map.layers[i].features.length) { a.push(GIS.map.layers[i]); } } - return a; + return a.length ? a : false; }; GIS.util.map.getLayersByType = function(layerType) { @@ -367,8 +369,14 @@ y += 35; if (!layers.length) { - alert('No visible data layers'); //todo //i18n - return; + return false; + } + + for (var i = layers.length - 1; i > 0; i--) { + if (layers[i].base.id === GIS.base.facility.id) { + layers.splice(i, 1); + console.log('Facility layer export currently not supported'); + } } for (var i = 0; i < layers.length; i++) { @@ -385,7 +393,7 @@ svgArray.push(layer.div.innerHTML); // Legend - if (id !== GIS.base.boundary.id) { + if (id !== GIS.base.boundary.id && id !== GIS.base.facility.id) { what = '' + '' + '' + legendConfig.what + ''; @@ -681,7 +689,7 @@ }); GIS.store.groupsByGroupSet = Ext.create('Ext.data.Store', { - fields: ['id', 'name'], + fields: ['id', 'name', 'symbol'], proxy: { type: 'ajax', url: '', @@ -1920,12 +1928,22 @@ prevItem = items[i - 1].data; if (item.startValue < prevItem.endValue) { - alert('Overlapping legends'); + var msg = 'Overlapping legends not allowed!\n\n' + + prevItem.name + ' (' + prevItem.startValue + ' - ' + prevItem.endValue + ')\n' + + item.name + ' (' + item.startValue + ' - ' + item.endValue + ')'; + alert(msg); return false; } if (prevItem.endValue < item.startValue) { - alert('Legend gaps'); + var msg = 'Legend gaps detected!\n\n' + + prevItem.name + ' (' + prevItem.startValue + ' - ' + prevItem.endValue + ')\n' + + item.name + ' (' + item.startValue + ' - ' + item.endValue + ')\n\n' + + 'Proceed anyway?'; + + if (!confirm(msg)) { + return false; + } } } @@ -1940,7 +1958,7 @@ var body = Ext.encode(getRequestBody()); Ext.Ajax.request({ - url: GIS.conf.url.path_api + 'mapLegendSet/', + url: GIS.conf.url.path_api + 'mapLegendSets/', method: 'POST', headers: {'Content-Type': 'application/json'}, params: body, @@ -1963,7 +1981,7 @@ body = Ext.encode(getRequestBody()); Ext.Ajax.request({ - url: GIS.conf.url.path_api + 'mapLegendSet/' + id, + url: GIS.conf.url.path_api + 'mapLegendSets/' + id, method: 'PUT', headers: {'Content-Type': 'application/json'}, params: body, @@ -2008,6 +2026,12 @@ create, update ] + }, + listeners: { + show: function() { + var x = this.getPosition()[0]; + this.setPosition(x, 50); + } } }); @@ -2022,28 +2046,33 @@ textfield = Ext.create('Ext.form.field.Text', { cls: 'gis-textfield', - height: 30, + height: 28, emptyText: 'Enter map title..', //i18n - bodyStyle: 'margin-right: 3px' + style: 'margin-right: 2px' }); button = Ext.create('Ext.button.Button', { - text: 'D', - height: 30, - width: 30, + width: 28, + height: 28, + iconCls: 'gis-btn-icon-download', handler: function() { var title = textfield.getValue(), svg = GIS.util.svg.getString(title, GIS.util.map.getVisibleVectorLayers()), exportForm = document.getElementById('exportForm'); - - document.getElementById('svgField').value = svg; - document.getElementById('titleField').value = title; - exportForm.action = '../exportImage.action'; - exportForm.method = 'post'; - exportForm.submit(); - - textfield.reset(); - menu.hide(); + + if (svg) { + document.getElementById('svgField').value = svg; + document.getElementById('titleField').value = title; + exportForm.action = '../exportImage.action'; + exportForm.method = 'post'; + exportForm.submit(); + + textfield.reset(); + menu.hide(); + } + else { + alert('No map data to export'); //todo //i18n + } } }); @@ -2063,10 +2092,24 @@ enableKeyNav: false, width: 185, 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; + } + }, afterrender: function() { this.getEl().addCls('gis-toolbar-btn-menu gis-toolbar-btn-menu-download'); + }, + show: function() { + this.keyNav.disable(); + textfield.focus(); + }, + hide: function() { + this.keyNav.enable(); } } }); @@ -2294,6 +2337,7 @@ }, { text: 'Legend', //i18n + menu: {}, handler: function() { if (GIS.cmp.legendSetWindow && GIS.cmp.legendSetWindow.destroy) { GIS.cmp.legendSetWindow.destroy(); === removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources' === removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css' === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/geoext-all-debug.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/geoext-all-debug.css 2012-08-14 16:47:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/geoext-all-debug.css 1970-01-01 00:00:00 +0000 @@ -1,8 +0,0 @@ -/** - * This file combines all default css files. It will be parsed by the build - * processor to generate a minified geoext-all.css file. Theme specific - * overrides go into gxtheme-.css - */ -@import "popup.css"; -@import "layerlegend.css"; -@import "symbolizercolumn.css"; === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/geoext-all.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/geoext-all.css 2012-08-14 16:47:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/geoext-all.css 1970-01-01 00:00:00 +0000 @@ -1,2 +0,0 @@ - -.gx-popup-anc{background:transparent url(../images/default/anchor.png) no-repeat 0 0;position:absolute;left:5px;z-index:2;height:16px;width:31px;pointer-events:none;}.gx-popup-anc.top{background:transparent url(../images/default/anchor-top.png) no-repeat 0 0;top:-16px;}.gx-popup-anc.right{left:auto;right:5px;}.gx-ruledrag-insert-below{border-bottom:1px dotted;}.gx-ruledrag-insert-above{border-top:1px dotted;}.gx-grid-symbolizercol div{padding:0;} \ No newline at end of file === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/gxtheme-gray.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/gxtheme-gray.css 2012-08-14 16:47:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/gxtheme-gray.css 1970-01-01 00:00:00 +0000 @@ -1,1 +0,0 @@ -.gx-popup-anc{background-image:url(../images/gray/anchor.png);}.gx-popup-anc.top{background-image:url(../images/gray/anchor-top.png);} \ No newline at end of file === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/gxtheme-slate.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/gxtheme-slate.css 2012-08-14 16:47:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/gxtheme-slate.css 1970-01-01 00:00:00 +0000 @@ -1,1 +0,0 @@ -.gx-popup-anc{background-image:url(../images/slate/anchor.png);}.gx-popup-anc.top{background-image:url(../images/slate/anchor-top.png);} \ No newline at end of file === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/layerlegend.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/layerlegend.css 2012-08-14 16:47:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/layerlegend.css 1970-01-01 00:00:00 +0000 @@ -1,1 +0,0 @@ -.gx-ruledrag-insert-below{border-bottom:1px dotted;}.gx-ruledrag-insert-above{border-top:1px dotted;} \ No newline at end of file === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/popup.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/popup.css 2012-08-14 16:47:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/popup.css 1970-01-01 00:00:00 +0000 @@ -1,1 +0,0 @@ -.gx-popup-anc{background:transparent url(../images/default/anchor.png) no-repeat 0 0;position:absolute;left:5px;z-index:2;height:16px;width:31px;pointer-events:none;}.gx-popup-anc.top{background:transparent url(../images/default/anchor-top.png) no-repeat 0 0;top:-16px;}.gx-popup-anc.right{left:auto;right:5px;} \ No newline at end of file === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/symbolizercolumn.css' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/symbolizercolumn.css 2012-08-14 16:47:08 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/css/symbolizercolumn.css 1970-01-01 00:00:00 +0000 @@ -1,1 +0,0 @@ -.gx-grid-symbolizercol div{padding:0;} \ No newline at end of file === removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images' === removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default' === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/anchor-top.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/anchor-top.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/anchor-top.png 1970-01-01 00:00:00 +0000 differ === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/anchor.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/anchor.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/anchor.png 1970-01-01 00:00:00 +0000 differ === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/bullet_arrow_down.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/bullet_arrow_down.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/bullet_arrow_down.png 1970-01-01 00:00:00 +0000 differ === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/bullet_arrow_up.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/bullet_arrow_up.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/bullet_arrow_up.png 1970-01-01 00:00:00 +0000 differ === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/delete.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/delete.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/default/delete.png 1970-01-01 00:00:00 +0000 differ === removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/gray' === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/gray/anchor-top.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/gray/anchor-top.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/gray/anchor-top.png 1970-01-01 00:00:00 +0000 differ === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/gray/anchor.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/gray/anchor.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/gray/anchor.png 1970-01-01 00:00:00 +0000 differ === removed directory 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/slate' === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/slate/anchor-top.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/slate/anchor-top.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/slate/anchor-top.png 1970-01-01 00:00:00 +0000 differ === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/slate/anchor.png' Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/slate/anchor.png 2012-08-14 16:47:08 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/geoext/resources/images/slate/anchor.png 1970-01-01 00:00:00 +0000 differ === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/global.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/global.js 2012-09-10 16:41:53 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/global.js 1970-01-01 00:00:00 +0000 @@ -1,1215 +0,0 @@ -G.conf = { - -// Ajax requests - - path_mapping: '../', - path_commons: '../../dhis-web-commons-ajax-json/', - path_api: '../../api/', - type: '.action', - -// Layer names - - boundary_layer: G.i18n.boundary_layer, - thematic_layer_1: G.i18n.thematic_layer + ' 1', - thematic_layer_2: G.i18n.thematic_layer + ' 2', - symbol_layer: G.i18n.symbol_layer, - centroid_layer: G.i18n.centroid_layer, - -// Help strings - - setup: 'gisSetup', - thematicMap: 'gisThematicMap', - thematicMap2: 'gisThematicMap2', - thematicMap3: 'gisThematicMap3', - thematicMap4: 'gisThematicMap4', - overlayRegistration: 'gisOverlay', - administration: 'gisAdministration', - favorites: 'gisFavoriteMapView', - legendSets: 'gisLegendSet', - imageExport: 'gisImageExport', - -// Layout - - west_width: 270, - multiselect_width: 219, - label_width: 85, - combo_width: 150, - combo_width_fieldset: 127, - combo_list_width_fieldset: 127 + 17, - combo_number_width: 65, - combo_number_width_small: 44, - window_width: 251, - window_x_right: 55, - window_y_right: 41, - window_x_left: 70, - window_y_left: 45, - window_editlayer_width: 570, - window_editlayer_width_collapsed: 292, - -// GUI - - feature_data_style_name: 'color:#000', - feature_data_style_value: 'color:#444', - feature_data_style_empty: 'color:#555', - - emptyText: '', - labelseparator: '', - -// DHIS variables - - map_widget_choropleth: 'choropleth', - map_widget_point: 'point', - map_widget_symbol: 'symbol', - map_widget_centroid: 'centroid', - map_source_type_database: 'database', - map_source_type_geojson: 'geojson', - map_source_type_shapefile: 'shapefile', - map_legend_symbolizer_color: 'color', - map_legend_symbolizer_image: 'image', - map_legendset_type_automatic: 'automatic', - map_legendset_type_predefined: 'predefined', - map_layer_type_baselayer: 'baselayer', - map_layer_type_overlay: 'overlay', - map_layer_type_thematic: 'thematic', - map_overlay_type_wms: 'wms', - map_overlay_type_file: 'file', - map_value_type_indicator: 'indicator', - map_value_type_dataelement: 'dataelement', - map_date_type_fixed: 'fixed', - map_date_type_start_end: 'start-end', - map_selection_type_parent: 'parent', - map_selection_type_level: 'level', - map_feature_type_multipolygon: 'MultiPolygon', - map_feature_type_multipolygon_class_name: 'OpenLayers.Geometry.MultiPolygon', - map_feature_type_polygon: 'Polygon', - map_feature_type_polygon_class_name: 'OpenLayers.Geometry.Polygon', - map_feature_type_point: 'Point', - map_feature_type_point_class_name: 'OpenLayers.Geometry.Point', - map_view_access_level_user: 'user', - map_view_access_level_system: 'system', - aggregation_strategy_real_time: 'real_time', - aggregation_strategy_batch: 'batch', - operator_lowerthan: 'lt', - operator_greaterthan: 'gt', - -// MapFish - - classify_with_bounds: 1, - classify_by_equal_intervals: 2, - classify_by_quantils: 3, - -// Layers - - opacityItems: [ - {text: '0.1', iconCls: 'menu-layeroptions-opacity-10'}, - {text: '0.2', iconCls: 'menu-layeroptions-opacity-20'}, - {text: '0.3', iconCls: 'menu-layeroptions-opacity-30'}, - {text: '0.4', iconCls: 'menu-layeroptions-opacity-40'}, - {text: '0.5', iconCls: 'menu-layeroptions-opacity-50'}, - {text: '0.6', iconCls: 'menu-layeroptions-opacity-60'}, - {text: '0.7', iconCls: 'menu-layeroptions-opacity-70'}, - {text: '0.8', iconCls: 'menu-layeroptions-opacity-80'}, - {text: '0.9', iconCls: 'menu-layeroptions-opacity-90'}, - {text: '1.0', iconCls: 'menu-layeroptions-opacity-100'} - ], - - defaultLayerOpacity: 0.8, - - wmsLayerOpacity: 0.5, - - defaultLayerZIndex: 10000, - - defaultLowRadius: 5, - - defaultHighRadius: 20, - -// Measure - - sketchSymbolizers: { - "Point": { - pointRadius: 4, - graphicName: "square", - fillColor: "white", - fillOpacity: 1, - strokeWidth: 1, - strokeOpacity: 1, - strokeColor: "#333333" - }, - "Line": { - strokeWidth: 2, - strokeOpacity: 1, - strokeColor: "#444444", - strokeDashstyle: "dash" - }, - "Polygon": { - strokeWidth: 2, - strokeOpacity: 1, - strokeColor: "#666666", - fillColor: "white", - fillOpacity: 0.3 - } - } -}; - -G.util = { - - expandWidget: function(widget) { - var collapsed = widget == choropleth ? point : choropleth; - collapsed.collapse(); - widget.expand(); - }, - - getUrlParam: function(s) { - var output = ''; - var href = window.location.href; - if (href.indexOf('?') > -1 ) { - var query = href.substr(href.indexOf('?') + 1); - var query = query.split('&'); - for (var i = 0; i < query.length; i++) { - if (query[i].indexOf('=') > -1) { - var a = query[i].split('='); - if (a[0].toLowerCase() === s) { - output = a[1]; - break; - } - } - } - } - return unescape(output); - }, - - getKeys: function(obj) { - var temp = []; - for (var k in obj) { - if (obj.hasOwnProperty(k)) { - temp.push(k); - } - } - return temp; - }, - - validateInputNameLength: function(name) { - return (name.length <= 25); - }, - - getMultiSelectHeight: function() { - var h = screen.height; - return h <= 800 ? 220 : - h <= 1050 ? 310 : - h <= 1200 ? 470 : 900; - }, - - getGridPanelHeight: function() { - var h = screen.height; - return h <= 800 ? 180 : - h <= 1050 ? 480 : - h <= 1200 ? 600 : 900; - }, - - getNumericMapView: function(mapView) { - mapView.id = parseFloat(mapView.id); - mapView.indicatorGroupId = parseFloat(mapView.indicatorGroupId); - mapView.indicatorId = parseFloat(mapView.indicatorId); - mapView.periodId = parseFloat(mapView.periodId); - mapView.method = parseFloat(mapView.method); - mapView.classes = parseFloat(mapView.classes); - mapView.mapLegendSetId = parseFloat(mapView.mapLegendSetId); - mapView.longitude = parseFloat(mapView.longitude); - mapView.latitude = parseFloat(mapView.latitude); - mapView.zoom = parseFloat(mapView.zoom); - return mapView; - }, - - getNumberOfDecimals: function(x,dec_sep) { - var tmp = new String(); - tmp = x; - return tmp.indexOf(dec_sep) > -1 ? tmp.length-tmp.indexOf(dec_sep) - 1 : 0; - }, - - labels: { - vector: { - getActivatedOpenLayersStyleMap: function(widget, fsize, fweight, fstyle, fcolor) { - return new OpenLayers.StyleMap({ - 'default' : new OpenLayers.Style( - OpenLayers.Util.applyDefaults({ - 'fillOpacity': widget == boundary ? 0 : 1, - 'strokeColor': widget == boundary ? '#000' : '#fff', - 'strokeWidth': 1, - 'label': '${labelString}', - 'fontFamily': 'arial,sans-serif,ubuntu,consolas', - 'fontSize': fsize ? fsize : 13, - 'fontWeight': fweight ? 'bold' : 'normal', - 'fontStyle': fstyle ? 'italic' : 'normal', - 'fontColor': fcolor ? fcolor : '#000000' - }, - OpenLayers.Feature.Vector.style['default']) - ), - 'select': new OpenLayers.Style({ - 'strokeColor': '#000000', - 'strokeWidth': 2, - 'cursor': 'pointer' - }) - }); - }, - getDeactivatedOpenLayersStyleMap: function(widget) { - return new OpenLayers.StyleMap({ - 'default': new OpenLayers.Style( - OpenLayers.Util.applyDefaults({ - 'fillOpacity': widget == boundary ? 0 : 1, - 'strokeColor': widget == boundary ? '#000' : '#fff', - 'strokeWidth': 1 - }, - OpenLayers.Feature.Vector.style['default']) - ), - 'select': new OpenLayers.Style({ - 'strokeColor': '#000000', - 'strokeWidth': 2, - 'cursor': 'pointer' - }) - }); - }, - toggleFeatureLabels: function(widget, fsize, fweight, fstyle, fcolor) { - function activateLabels() { - widget.layer.styleMap = this.getActivatedOpenLayersStyleMap(widget, fsize, fweight, fstyle, fcolor); - widget.labels = true; - } - function deactivateLabels(scope) { - widget.layer.styleMap = this.getDeactivatedOpenLayersStyleMap(widget); - widget.labels = false; - } - - if (widget.labels) { - deactivateLabels.call(this); - } - else { - activateLabels.call(this); - } - - G.vars.lockPosition = true; - widget.applyValues(); - } - }, - fileOverlay: { - getActivatedOpenLayersStyleMap: function(layer) { - var style = layer.styleMap.styles['default'].defaultStyle; - return new OpenLayers.StyleMap({ - 'default' : new OpenLayers.Style( - OpenLayers.Util.applyDefaults({ - 'fillOpacity': style.fillOpacity, - 'fillColor': style.fillColor, - 'strokeWidth': style.strokeWidth, - 'strokeColor': style.strokeWidth, - 'label': '${name}', - 'fontFamily': 'arial,lucida sans unicode', - 'fontSize': 13, - 'fontWeight': 'normal', - 'fontStyle': 'normal', - 'fontColor': '#000000' - }, - OpenLayers.Feature.Vector.style['default']) - ) - }); - }, - getDeactivatedOpenLayersStyleMap: function(layer) { - var style = layer.styleMap.styles['default'].defaultStyle; - return new OpenLayers.StyleMap({ - 'default' : new OpenLayers.Style( - OpenLayers.Util.applyDefaults({ - 'fillOpacity': style.fillOpacity, - 'fillColor': style.fillColor, - 'strokeWidth': style.strokeWidth, - 'strokeColor': style.strokeWidth - }, - OpenLayers.Feature.Vector.style['default']) - ) - }); - }, - toggleFeatureLabels: function(layer) { - function activateLabels() { - layer.styleMap = this.getActivatedOpenLayersStyleMap(layer); - layer.labels = true; - layer.refresh(); - } - function deactivateLabels(scope) { - layer.styleMap = this.getDeactivatedOpenLayersStyleMap(layer); - layer.labels = false; - layer.refresh(); - } - - if (layer.labels) { - deactivateLabels.call(this); - } - else { - activateLabels.call(this); - } - } - } - }, - - measureDistance: { - getMeasureStyleMap: function() { - var style = new OpenLayers.Style(); - style.addRules([new OpenLayers.Rule({symbolizer: G.conf.sketchSymbolizers})]); - return new OpenLayers.StyleMap({"default": style}); - }, - - handleMeasurements: function(e) { - if (e.measure) { - document.getElementById('measureDistanceDiv').innerHTML = e.measure.toFixed(2) + ' ' + e.units; - } - } - }, - - sortByValue: function(a,b) { - return b.value-a.value; - }, - - getLegendsJSON: function() { - var json = '{"legends":['; - for (var i = 0; i < this.imageLegend.length; i++) { - json += '{'; - json += '"label": "' + this.imageLegend[i].label + '",'; - json += '"color": "' + this.imageLegend[i].color + '"'; - json += i < this.imageLegend.length-1 ? '},' : '}'; - } - json += ']}'; - return json; - }, - - setCurrentValue: function(cb, mv) { - if (cb.getValue() == cb.currentValue) { - return true; - } - else { - cb.currentValue = cb.getValue(); - mv.clearValue(); - return false; - } - }, - - setLockPosition: function(cb) { - cb.lockPosition = !cb.lockPosition ? true : cb.lockPosition; - }, - - mergeSvg: function(str, ext) { - if (ext.length) { - str = str || ''; - for (var i = 0; i < ext.length; i++) { - str = str.replace(''); - ext[i] = ext[i].substring(ext[i].indexOf('>')+1); - str += ext[i]; - } - } - return str; - }, - - getOverlaysSvg: function(overlays) { - if (overlays.length) { - for (var i = 0; i < overlays.length; i++) { - overlays[i] = document.getElementById(overlays[i].svgId).parentNode.innerHTML; - } - } - return overlays; - }, - - getTransformedFeatureArray: function(features) { - var sourceProjection = new OpenLayers.Projection("EPSG:4326"); - var destinationProjection = new OpenLayers.Projection("EPSG:900913"); - for (var i = 0; i < features.length; i++) { - features[i].geometry.transform(sourceProjection, destinationProjection); - } - return features; - }, - - getTransformedPointByXY: function(x, y) { - var p = new OpenLayers.Geometry.Point(parseFloat(x), parseFloat(y)); - return p.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")); - }, - - getTransformedPoint: function(p) { - return p.transform(new OpenLayers.Projection("EPSG:4326"), new OpenLayers.Projection("EPSG:900913")); - }, - - createWMSLayer: function(name, url, layers, time) { - var options = { - layers: layers, - transparent: true, - format: 'image/png' - }; - if (time) { - options.time = time; - } - var layer = new OpenLayers.Layer.WMS(name, url, options, { - isBaseLayer: false, - buffer: 0, - ratio: 1, - singleTile: true - }); - layer.baseUrl = url; - return layer; - }, - - convertWMSUrlToLegendString: function(url) { - var str = url.replace('wms.xml','wmsfigmap'); - return str += '?REQUEST=GetLegendGraphic'; - }, - - createOverlay: function(name, fillColor, fillOpacity, strokeColor, strokeWidth, url) { - return new OpenLayers.Layer.Vector(name, { - 'visibility': false, - 'styleMap': new OpenLayers.StyleMap({ - 'default': new OpenLayers.Style( - OpenLayers.Util.applyDefaults( - {'fillColor': fillColor, 'fillOpacity': fillOpacity, 'strokeColor': strokeColor, 'strokeWidth': strokeWidth}, - OpenLayers.Feature.Vector.style['default'] - ) - ) - }), - 'strategies': [new OpenLayers.Strategy.Fixed()], - 'protocol': new OpenLayers.Protocol.HTTP({ - 'url': url, - 'format': new OpenLayers.Format.GeoJSON() - }) - }); - }, - - getVisibleLayers: function(layers) { - var vLayers = []; - for (var i = 0; i < layers.length; i++) { - if (layers[i].visibility) { - vLayers.push(layers[i]); - } - } - return vLayers; - }, - - getVectorLayers: function() { - var layers = []; - for (var i = 0; i < G.vars.map.layers.length; i++) { - if (G.vars.map.layers[i].layerType == G.conf.map_layer_type_thematic || - G.vars.map.layers[i].layerType == G.conf.map_layer_type_overlay) { - layers.push(G.vars.map.layers[i]); - } - } - return layers; - }, - - getLayersByType: function(type) { - var layers = []; - for (var i = 0; i < G.vars.map.layers.length; i++) { - if (G.vars.map.layers[i].layerType == type) { - layers.push(G.vars.map.layers[i]); - } - } - return layers; - }, - - zoomToVisibleExtent: function() { - if (!G.vars.lockPosition) { - var bounds = []; - - var layers = this.getLayersByType(G.conf.map_layer_type_thematic); - for (var i = 0; i < layers.length; i++) { - if (layers[i].getDataExtent() && layers[i].visibility) { - bounds.push(layers[i].getDataExtent()); - } - } - - if (bounds.length === 1) { - G.vars.map.zoomToExtent(bounds[0]); - } - else if (bounds.length > 1) { - var extended = bounds[0]; - for (var i = 1; i < bounds.length; i++) { - extended.extend(bounds[i]); - } - G.vars.map.zoomToExtent(extended); - } - } - G.vars.lockPosition = false; - }, - - setZIndexByLayerType: function(type, index) { - for (var i = 0; i < G.vars.map.layers.length; i++) { - if (G.vars.map.layers[i].layerType == type) { - G.vars.map.layers[i].setZIndex(index); - } - } - }, - - setOpacityByLayerType: function(type, opacity) { - for (var i = 0; i < G.vars.map.layers.length; i++) { - if (G.vars.map.layers[i].layerType == type) { - G.vars.map.layers[i].setOpacity(opacity); - } - else if (G.vars.map.layers[i].overlayType == type) { - G.vars.map.layers[i].setOpacity(opacity); - } - } - }, - - findArrayValue: function(array, value) { - for (var i = 0; i < array.length; i++) { - if (value == array[i]) { - return true; - } - } - return false; - }, - - compareObjToObj: function(obj1, obj2, exceptions) { - for (p in obj1) { - if (obj1[p] !== obj2[p]) { - if (!G.util.findArrayValue(exceptions, p)) { - return false; - } - } - } - return true; - }, - - cutString: function(str, len) { - if (str.length > len) { - str = str.substr(0,len) + '..'; - } - return str; - }, - - getOrganisationUnitIdStringFromFeatures: function(features) { - var str = ''; - for (var i = 0; i < features.length; i++) { - str += features[i].attributes.id; - str += i < (features.length - 1) ? ',' : ''; - } - return str; - }, - - geoJsonDecode: function(doc) { - doc = Ext.util.JSON.decode(doc); - var geojson = {}; - geojson.type = 'FeatureCollection'; - geojson.crs = { - type: 'EPSG', - properties: { - code: '4326' - } - }; - geojson.features = []; - for (var i = 0; i < doc.length; i++) { - geojson.features.push({ - geometry: { - type: doc[i].t == 1 ? 'MultiPolygon' : 'Point', - coordinates: doc[i].c - }, - properties: { - id: doc[i].i, - name: doc[i].n, - value: doc[i].v, - hcwc: doc[i].h - } - }); - } - return geojson; - }, - - mapValueDecode: function(r) { - var r = Ext.util.JSON.decode(r.responseText), - mapvalues = []; - for (var i = 0; i < r.length; i++) { - mapvalues.push({ - oi: r[i][0], - v: r[i][1] - }); - } - return mapvalues; - }, - - mapView: { - layer: function(id) { - var w = new Ext.Window({ - id: 'mapviewlayer_w', - title: '' + G.i18n.favorite + '', - layout: 'fit', - modal: true, - width: 150, - height: 98, - items: [ - { - xtype: 'panel', - bodyStyle: 'padding:14px;', - items: [ - { html: G.i18n.open_which_layer } - ] - } - ], - bbar: [ - '->', - { - xtype: 'button', - iconCls: 'icon-thematic1', - hideLabel: true, - handler: function() { - G.util.mapView.mapView.call(choropleth, id); - Ext.getCmp('mapviewlayer_w').destroy(); - } - }, - { - xtype: 'button', - iconCls: 'icon-thematic2', - hideLabel: true, - handler: function() { - G.util.mapView.mapView.call(point, id); - Ext.getCmp('mapviewlayer_w').destroy(); - } - } - ] - }); - var c = Ext.getCmp('center').x; - var e = Ext.getCmp('east').x; - w.setPagePosition(c+((e-c)/2)-(w.width/2), Ext.getCmp('east').y + 100); - w.show(); - }, - - mapView: function(id) { - var store = G.stores.mapView; - if (!store.isLoaded) { - store.load({scope: this, callback: function() { - var mapView = store.getAt(store.find('id', id)).data; - G.util.mapView.launch.call(this, mapView); - }}); - } - else { - var mapView = store.getAt(store.find('id', id)).data; - G.util.mapView.launch.call(this, mapView); - } - }, - - launch: function(mapView) { - if (!this.window.isShown) { - this.window.show(); - this.window.hide(); - } - this.mapView = mapView; - this.updateValues = true; - - this.legend.value = this.mapView.mapLegendType; - this.legend.method = this.mapView.method || this.legend.method; - this.legend.classes = this.mapView.classes || this.legend.classes; - - G.vars.map.setCenter(new OpenLayers.LonLat(this.mapView.longitude, this.mapView.latitude), this.mapView.zoom); - - this.valueType.value = this.mapView.mapValueType; - this.cmp.mapValueType.setValue(this.valueType.value); - - this.setMapView(); - } - } -}; - -G.date = { - getNowHMS: function(date) { - date = date || new Date(); - return G.date.getDoubleDigit(date.getHours()) + ':' + - G.date.getDoubleDigit(date.getMinutes()) + ':' + - G.date.getDoubleDigit(date.getSeconds()); - }, - - getDoubleDigit: function(unit) { - unit = '' + unit; - return unit.length < 2 ? '0' + unit : unit; - } -}; - -G.vars = { - map: null, - - parameter: null, - - mask: null, - - activePanel: { - value: G.conf.thematicMap, - setPolygon: function() { - this.value = G.conf.thematicMap; - }, - setPoint: function() { - this.value = G.conf.thematicMap2; - }, - setSymbol: function() { - this.value = G.conf.thematicMap3; - }, - setCentroid: function() { - this.value = G.conf.thematicMap4; - }, - isPolygon: function() { - return this.value === G.conf.thematicMap; - }, - isPoint: function() { - return this.value === G.conf.thematicMap2; - }, - isSymbol: function() { - return this.value === G.conf.thematicMap3; - }, - isCentroid: function() { - return this.value === G.conf.thematicMap4; - } - }, - - activeWidget: null, - - lockPosition: false, - - relocate: {}, - - mouseMove: {} -}; - -G.user = { - isAdmin: false -}; - -G.system = { - infrastructuralPeriodType: null, - - rootNode: null -}; - -G.func = { - storeLoadListener: function() { - this.isLoaded = true; - }, - - loadStart: function() { - G.vars.mask.msg = G.i18n.loading; - G.vars.mask.show(); - }, - - loadEnd: function() { - G.vars.mask.hide(); - } -}; - -G.cls = { - vectorLayerButton: function(iconCls, tooltip, widget) { - return new Ext.Button({ - iconCls: iconCls, - tooltip: tooltip, - widget: widget, - style: 'margin-top:1px', - enableItems: function(bool) { - var menuItems = widget == boundary ? [2,3,5,6,8] : [2,3,5,6,7,9]; - for (var i = 0, items = this.menu.items.items; i < menuItems.length; i++) { - if (bool) { - items[menuItems[i]].enable(); - } - else { - items[menuItems[i]].disable(); - } - } - }, - handler: function() { - this.enableItems(this.widget.layer.features ? this.widget.layer.features.length : false); - }, - listeners: { - 'afterrender': function(b) { - this.menu = new Ext.menu.Menu({ - parent: b, - items: [ - { - text: G.i18n.edit_layer + '..', - iconCls: 'menu-layeroptions-edit', - scope: this, - handler: function() { - this.widget.window.show(this.id); - } - }, - '-', - { - text: G.i18n.refresh, - iconCls: 'menu-layeroptions-refresh', - scope: this, - handler: function() { - this.widget.updateValues = true; - this.widget.classify(); - } - }, - { - text: G.i18n.clear , - iconCls: 'menu-layeroptions-clear', - scope: this, - handler: function() { - this.widget.formValues.clearForm.call(this.widget, true); - } - }, - '-', - { - text: G.i18n.filter + '..', - iconCls: 'menu-layeroptions-filter', - scope: this, - handler: function() { - this.widget.filtering.showFilteringWindow.call(this.widget); - } - }, - { - text: G.i18n.search + '..', - iconCls: 'menu-layeroptions-locate', - showSearchWindow: function() { - var layer = this.parentMenu.parent.widget.layer; - - var data = []; - for (var i = 0; i < layer.features.length; i++) { - data.push([layer.features[i].data.id || i, layer.features[i].data.name]); - } - - if (data.length) { - var featureStore = new Ext.data.ArrayStore({ - mode: 'local', - idProperty: 'id', - fields: ['id','name'], - sortInfo: {field: 'name', direction: 'ASC'}, - autoDestroy: true, - data: data - }); - - this.window = new Ext.Window({ - title: '' + G.i18n.organisationunit_search +'', - layout: 'fit', - width: G.conf.window_width, - height: G.util.getMultiSelectHeight() + 140, - items: [ - { - xtype: 'form', - bodyStyle:'padding:8px', - labelWidth: G.conf.label_width, - items: [ - { html: '
' + G.i18n.locate_organisationunit_on_map + '
' }, - { - xtype: 'colorfield', - id: 'highlightcolor', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, - fieldLabel: G.i18n.highlight_color, - allowBlank: false, - width: G.conf.combo_width_fieldset, - value: "#0000FF" - }, - { - xtype: 'textfield', - emptyText: G.conf.emptytext, - labelSeparator: G.conf.labelseparator, - fieldLabel: G.i18n.text_filter, - width: G.conf.combo_width_fieldset, - enableKeyEvents: true, - listeners: { - 'keyup': function(tf) { - featureStore.filter('name', tf.getValue(), true, false); - } - } - }, - { html: '
' }, - { - xtype: 'grid', - height: G.util.getMultiSelectHeight(), - cm: new Ext.grid.ColumnModel({ - columns: [{id: 'name', header: 'Features', dataIndex: 'name', width: 250}] - }), - sm: new Ext.grid.RowSelectionModel({singleSelect:true}), - viewConfig: {forceFit: true}, - sortable: true, - autoExpandColumn: 'name', - store: featureStore, - listeners: { - 'cellclick': { - scope: this, - fn: function(g, ri, ci, e) { - layer.redraw(); - - var id, feature; - id = g.getStore().getAt(ri).data.id; - - for (var i = 0; i < layer.features.length; i++) { - if (layer.features[i].data.id == id) { - feature = layer.features[i]; - break; - } - } - var color = Ext.getCmp('highlightcolor').getValue(); - var symbolizer; - - if (feature.geometry.CLASS_NAME == G.conf.map_feature_type_multipolygon_class_name || - feature.geometry.CLASS_NAME == G.conf.map_feature_type_polygon_class_name) { - symbolizer = new OpenLayers.Symbolizer.Polygon({ - 'strokeColor': color, - 'fillColor': color - }); - } - else if (feature.geometry.CLASS_NAME == G.conf.map_feature_type_point_class_name) { - symbolizer = new OpenLayers.Symbolizer.Point({ - 'pointRadius': 7, - 'fillColor': color - }); - } - - layer.drawFeature(feature,symbolizer); - } - } - } - } - ] - } - ], - listeners: { - 'hide': function() { - layer.redraw(); - } - } - }); - this.window.setPagePosition(G.conf.window_x_left,G.conf.window_y_left); - this.window.show(this.parentMenu.parent.id); - } - else { - Ext.message.msg(false, '' + layer.name + ': ' + G.i18n.no_features_rendered); - } - }, - handler: function() { - this.showSearchWindow(); - } - }, - { - name: 'labels', - text: G.i18n.labels + '..', - iconCls: 'menu-layeroptions-labels', - cmp: { - fontSize: new Ext.form.NumberField({ - name: 'fontsize', - fieldLabel: G.i18n.font_size, - labelSeparator: G.conf.labelseparator, - width: G.conf.combo_number_width_small, - enableKeyEvents: true, - allowDecimals: false, - allowNegative: false, - value: 13, - emptyText: 13, - listeners: { - 'keyup': { - scope: this, - fn: function(nf) { - var item = this.menu.find('name','labels')[0]; - - if (this.widget.labels) { - this.widget.labels = false; - G.util.labels.vector.toggleFeatureLabels(this.widget, nf.getValue(), item.cmp.strong.getValue(), - item.cmp.italic.getValue(), item.cmp.color.getValue()); - } - } - } - } - }), - strong: new Ext.form.Checkbox({ - fieldLabel: '' + G.i18n.bold_ + '', - labelSeparator: G.conf.labelseparator, - listeners: { - 'check': { - scope: this, - fn: function(chb, checked) { - var item = this.menu.find('name','labels')[0]; - - if (this.widget.labels) { - this.widget.labels = false; - G.util.labels.vector.toggleFeatureLabels(this.widget, item.cmp.fontSize.getValue(), - checked, item.cmp.italic.getValue(), item.cmp.color.getValue()); - } - } - } - } - }), - italic: new Ext.form.Checkbox({ - fieldLabel: '' + G.i18n.italic + '', - labelSeparator: G.conf.labelseparator, - listeners: { - 'check': { - scope: this, - fn: function(chb, checked) { - var item = this.menu.find('name','labels')[0]; - - if (this.widget.labels) { - this.widget.labels = false; - G.util.labels.vector.toggleFeatureLabels(this.widget, item.cmp.fontSize.getValue(), - item.cmp.strong.getValue(), checked, item.cmp.color.getValue()); - } - } - } - } - }), - color: new Ext.ux.ColorField({ - fieldLabel: G.i18n.color, - labelSeparator: G.conf.labelseparator, - allowBlank: false, - width: G.conf.combo_width_fieldset, - value: "#000000", - listeners: { - 'select': { - scope: this, - fn: function(cf) { - var item = this.menu.find('name','labels')[0]; - - if (this.widget.labels) { - this.widget.labels = false; - G.util.labels.vector.toggleFeatureLabels(this.widget, item.cmp.fontSize.getValue(), - item.cmp.strong.getValue(), item.cmp.italic.getValue(), cf.getValue()); - } - } - } - } - }) - }, - showLabelWindow: function() { - var layer = this.parentMenu.parent.widget.layer; - if (layer.features.length) { - if (this.cmp.labelWindow) { - this.cmp.labelWindow.show(); - } - else { - this.cmp.labelWindow = new Ext.Window({ - title: '' + G.i18n.labels + '', - layout: 'fit', - closeAction: 'hide', - width: G.conf.window_width, - height: 200, - items: [ - { - xtype: 'form', - bodyStyle: 'padding:8px', - labelWidth: G.conf.label_width, - items: [ - {html: '
' + G.i18n.show_hide_feature_labels + '
'}, - this.cmp.fontSize, - this.cmp.strong, - this.cmp.italic, - this.cmp.color - ] - } - ], - bbar: [ - '->', - { - xtype: 'button', - iconCls: 'icon-assign', - hideLabel: true, - text: G.i18n.showhide, - scope: this, - handler: function() { - if (layer.features.length) { - G.util.labels.vector.toggleFeatureLabels(layer.widget, this.cmp.fontSize.getValue(), - this.cmp.strong.getValue(), this.cmp.italic.getValue(), this.cmp.color.getValue()); - } - else { - Ext.message.msg(false, '' + layer.name + ': ' + Gi.i18n.no_features_rednered ); - } - } - } - ] - }); - this.cmp.labelWindow.setPagePosition(G.conf.window_x_left,G.conf.window_y_left); - this.cmp.labelWindow.show(this.parentMenu.parent.id); - } - } - else { - Ext.message.msg(false, '' + layer.name + ': ' + Gi.i18n.no_features_rednered ); - } - }, - handler: function() { - this.showLabelWindow(); - } - }, - '-', - { - text: G.i18n.opacity, - iconCls: 'menu-layeroptions-opacity', - menu: { - items: G.conf.opacityItems, - listeners: { - 'itemclick': { - scope: this, - fn: function(item) { - this.widget.layer.setOpacity(item.text); - } - } - } - } - }, - '-', - { - name: 'history', - text: G.i18n.history, - iconCls: 'menu-history', - disabled: true, - menu: {}, - addMenu: function() { - this.menu = new Ext.menu.Menu({ - defaults: { - itemCls: 'x-menu-item x-menu-item-custom' - }, - items: [], - listeners: { - 'add': function(menu) { - var items = menu.items.items; - var keys = menu.items.keys; - items.unshift(items.pop()); - keys.unshift(keys.pop()); - - if (items.length > 10) { - items[items.length-1].destroy(); - } - }, - 'click': { - scope: this, - fn: function(menu, item) { - G.util.mapView.launch.call(this.parentMenu.parent.widget, item.mapView); - } - } - } - }); - }, - addItem: function(scope) { - if (!this.menu.items) { - this.addMenu(); - } - - var mapView = scope.formValues.getAllValues.call(scope); - mapView.widget = scope; - mapView.timestamp = G.date.getNowHMS(); - var c1 = ''; - var c2 = ''; - var spanEnd = ''; - mapView.label = '' + - c1 + mapView.timestamp + spanEnd + - c2 + mapView.parentOrganisationUnitName + spanEnd + - c1 + '( ' + mapView.organisationUnitLevelName + ' )' + spanEnd + - c2 + (mapView.mapValueType == G.conf.map_value_type_indicator ? mapView.indicatorName : mapView.dataElementName) + spanEnd + - c1 + mapView.periodName + spanEnd + - spanEnd; - - for (var i = 0; i < this.menu.items.items.length; i++) { - if (G.util.compareObjToObj(mapView, this.menu.items.items[i].mapView, ['longitude','latitude','zoom','widget','timestamp','label'])) { - this.menu.items.items[i].destroy(); - } - } - - this.menu.addMenuItem({ - html: mapView.label, - mapView: mapView - }); - - this.enable(); - } - } - ] - }); - - this.widget.button = this; - } - } - }); - } -}; === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Facility.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Facility.js 2012-10-16 16:06:44 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/Facility.js 2012-10-25 12:07:10 +0000 @@ -36,20 +36,19 @@ applyClassification: function(options) { this.updateOptions(options); - var store = GIS.store.groupsByGroupSet, - groupRecords = store.data.items; + var items = GIS.store.groupsByGroupSet.data.items; - var rules = new Array(groupRecords.length); - for (var i = 0; i < groupRecords.length; i++) { + var rules = new Array(items.length); + for (var i = 0; i < items.length; i++) { var rule = new OpenLayers.Rule({ symbolizer: { 'pointRadius': 8, - 'externalGraphic': '../../images/' + groupRecords[i].data.image + 'externalGraphic': '../../images/orgunitgroup/' + items[i].data.symbol }, filter: new OpenLayers.Filter.Comparison({ type: OpenLayers.Filter.Comparison.EQUAL_TO, property: this.indicator, - value: groupRecords[i].data.name + value: items[i].data.name }) }); rules[i] = rule; @@ -65,7 +64,7 @@ } var config = this.widget.getLegendConfig(), - storeRecords = GIS.store.groupsByGroupSet.data.items, + items = GIS.store.groupsByGroupSet.data.items, element; this.legendDiv.update(""); @@ -84,9 +83,9 @@ element.style.height = "5px"; this.legendDiv.appendChild(element); - for (var i = 0; i < storeRecords.length; i++) { + for (var i = 0; i < items.length; i++) { var element = document.createElement("div"); - element.style.backgroundImage = 'url(../../images/' + storeRecords[i].data.image + ')'; + element.style.backgroundImage = 'url(../../images/orgunitgroup/' + items[i].data.symbol + ')'; element.style.backgroundRepeat = 'no-repeat'; element.style.width = "25px"; element.style.height = "18px"; @@ -95,7 +94,7 @@ this.legendDiv.appendChild(element); element = document.createElement("div"); - element.innerHTML = storeRecords[i].data.name; + element.innerHTML = items[i].data.name; this.legendDiv.appendChild(element); element = document.createElement("div"); === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js 2012-10-22 18:38:37 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Boundary.js 2012-10-25 12:21:55 +0000 @@ -93,7 +93,7 @@ doc = GIS.util.geojson.decode(doc, this); } else { - alert("no coordinates"); //todo //i18n + alert('No valid coordinates found'); //todo //i18n } this.layer.removeFeatures(this.layer.features); @@ -527,10 +527,10 @@ return model; }, - validateModel: function(model) { + validateModel: function(model) { if (!model.level || !Ext.isNumber(model.level)) { GIS.logg.push([model.level, this.xtype + '.level: number']); - //alert("validation failed"); //todo + alert('No level selected'); //todo return false; } if (!model.levelName || !Ext.isString(model.levelName)) { @@ -540,7 +540,7 @@ } if (!model.parentId || !Ext.isString(model.parentId)) { GIS.logg.push([model.parentId, this.xtype + '.parentId: string']); - //alert("validation failed"); //todo + alert('No parent organisation unit selected'); //todo return false; } if (!model.parentName || !Ext.isString(model.parentName)) { @@ -555,7 +555,7 @@ } if (model.parentLevel > model.level) { GIS.logg.push([model.parentLevel, model.level, this.xtype + '.parentLevel: number <= ' + this.xtype + '.level']); - //alert("validation failed"); //todo + alert('Level cannot be higher than parent level'); //todo return false; } === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js 2012-10-22 18:38:37 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Facility.js 2012-10-25 12:23:33 +0000 @@ -97,6 +97,45 @@ } }) }, + + decode: function(doc) { + var feature, + group, + attr, + geojson = { + type: 'FeatureCollection', + crs: { + type: 'EPSG', + properties: { + code: '4326' + } + }, + features: [] + }; + + doc = Ext.decode(doc); + + for (var i = 0; i < doc.geojson.length; i++) { + attr = doc.geojson[i]; + + feature = { + geometry: { + type: parseInt(attr.ty) === 1 ? 'MultiPolygon' : 'Point', + coordinates: attr.co + }, + properties: { + id: attr.uid, + internalId: attr.iid, + name: attr.na + } + }; + feature.properties = Ext.Object.merge(feature.properties, attr.groupSets); + + geojson.features.push(feature); + } + + return geojson; + }, setUrl: function(url) { this.url = url; @@ -110,12 +149,11 @@ if (!doc || !doc.documentElement) { doc = request.responseText; } - if (doc.length) { - doc = GIS.util.geojson.decode(doc, this); + doc = this.decode(doc); } else { - alert("no coordinates"); //todo //i18n + alert('No valid coordinates found'); //todo //i18n } this.layer.removeFeatures(this.layer.features); @@ -184,7 +222,7 @@ store.load({ scope: this, callback: function() { - if (this.tmpModel.updateGui) { // When favorite, load store and continue execution + if (this.tmpModel.updateGui) { // If favorite, load store and continue execution if (this.tmpModel.updateOrganisationUnit) { this.loadOrganisationUnits(); } @@ -341,7 +379,6 @@ onClickSelect = function fn(feature) { var showInfo, showRelocate, - drill, menu, isPoint = feature.geometry.CLASS_NAME === GIS.conf.finals.openLayers.point_classname; @@ -583,67 +620,10 @@ }); }; - // Drill or float - drill = function(direction) { - var store = GIS.store.organisationUnitLevels; - - store.loadFn( function() { - var store = GIS.store.organisationUnitLevels; - - if (direction === 'up') { - var rootNode = GIS.init.rootNodes[0]; - - that.config.level = that.model.level - 1; - that.config.levelName = store.getAt(store.find('level', that.config.level)).data.name; - that.config.parentId = rootNode.id; - that.config.parentName = rootNode.text; - that.config.parentLevel = rootNode.level; - that.config.parentPath = '/' + GIS.init.rootNodes[0].id; - } - else if (direction === 'down') { - that.config.level = that.model.level + 1; - that.config.levelName = store.getAt(store.find('level', that.config.level)).data.name; - that.config.parentId = feature.attributes.id; - that.config.parentName = feature.attributes.name; - that.config.parentLevel = that.model.level; - that.config.parentPath = feature.attributes.path; - } - - that.config.updateOrganisationUnit = true; - that.config.updateGui = true; - - that.execute(); - }); - }; - // Menu - var menuItems = [ - Ext.create('Ext.menu.Item', { - text: 'Float up', - iconCls: 'gis-menu-item-icon-float', - disabled: !that.model.hasCoordinatesUp, - scope: this, - handler: function() { - drill('up'); - } - }), - Ext.create('Ext.menu.Item', { - text: 'Drill down', - iconCls: 'gis-menu-item-icon-drill', - cls: 'gis-menu-item-first', - disabled: !feature.attributes.hcwc, - scope: this, - handler: function() { - drill('down'); - } - }) - ]; + var menuItems = []; - if (isPoint) { - menuItems.push({ - xtype: 'menuseparator' - }); - + if (isPoint) { menuItems.push( Ext.create('Ext.menu.Item', { text: GIS.i18n.relocate, iconCls: 'gis-menu-item-icon-relocate', @@ -819,13 +799,13 @@ validateModel: function(model) { if (!model.groupSet || !Ext.isString(model.groupSet)) { GIS.logg.push([model.groupSet, this.xtype + '.parentId: string']); - //alert("validation failed"); //todo + alert('No group set selected'); //todo //i18n return false; } if (!model.level || !Ext.isNumber(model.level)) { GIS.logg.push([model.level, this.xtype + '.level: number']); - //alert("validation failed"); //todo + alert('No level selected'); //todo return false; } if (!model.levelName || !Ext.isString(model.levelName)) { @@ -835,7 +815,7 @@ } if (!model.parentId || !Ext.isString(model.parentId)) { GIS.logg.push([model.parentId, this.xtype + '.parentId: string']); - //alert("validation failed"); //todo + alert('No parent organisation unit selected'); //todo return false; } if (!model.parentName || !Ext.isString(model.parentName)) { @@ -850,7 +830,7 @@ } if (model.parentLevel > model.level) { GIS.logg.push([model.parentLevel, model.level, this.xtype + '.parentLevel: number <= ' + this.xtype + '.level']); - //alert("validation failed"); //todo + alert('Level cannot be higher than parent level'); //todo return false; } @@ -879,7 +859,6 @@ for (var i = 0; i < this.layer.features.length; i++) { var feature = this.layer.features[i]; feature.attributes.label = feature.attributes.name; - feature.attributes.value = 0; } this.loadLegend(); @@ -933,7 +912,7 @@ this.store.features.loadFeatures(this.layer.features); // Update filter window - if (this.cmp.filterWindow && this.cmp.filterWindow.isVisible()) { + if (this.cmp.filterWindow && this.cmp.filterWindow.isVisible()) { this.cmp.filterWindow.filter(); } === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js 2012-10-23 09:01:59 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic1.js 2012-10-25 15:26:14 +0000 @@ -217,7 +217,7 @@ doc = GIS.util.geojson.decode(doc, this); } else { - alert("no coordinates"); //todo //i18n + alert('No valid coordinates found'); //todo //i18n } this.layer.removeFeatures(this.layer.features); @@ -444,7 +444,7 @@ } } }); - + this.cmp.periodType = Ext.create('Ext.form.field.ComboBox', { editable: false, valueField: 'id', @@ -1522,7 +1522,7 @@ } if (!model.indicator || !Ext.isString(model.indicator)) { GIS.logg.push([model.indicator, this.xtype + '.indicator: string']); - //alert("validation failed"); //todo + alert('No indicator selected'); //todo //i18n return false; } } @@ -1534,7 +1534,7 @@ } if (!model.dataElement || !Ext.isString(model.dataElement)) { GIS.logg.push([model.dataElement, this.xtype + '.dataElement: string']); - //alert("validation failed"); //todo + alert('No data element selected'); //todo //i18n return false; } } @@ -1546,7 +1546,7 @@ } if (!model.period || !Ext.isString(model.period)) { GIS.logg.push([model.period, this.xtype + '.period: string']); - //alert("validation failed"); //todo + alert('No period selected'); //todo //i18n return false; } @@ -1585,14 +1585,14 @@ else if (model.legendType === GIS.conf.finals.widget.legendtype_predefined) { if (!model.legendSet || !Ext.isString(model.legendSet)) { GIS.logg.push([model.legendSet, this.xtype + '.legendSet: string']); - //alert("validation failed"); //todo + alert('No legend set selected'); //todo //i18n return false; } } if (!model.level || !Ext.isNumber(model.level)) { GIS.logg.push([model.level, this.xtype + '.level: number']); - //alert("validation failed"); //todo + alert('No level selected'); //todo return false; } if (!model.levelName || !Ext.isString(model.levelName)) { @@ -1602,7 +1602,7 @@ } if (!model.parentId || !Ext.isString(model.parentId)) { GIS.logg.push([model.parentId, this.xtype + '.parentId: string']); - //alert("validation failed"); //todo + alert('No parent organisation unit selected'); //todo return false; } if (!model.parentName || !Ext.isString(model.parentName)) { @@ -1617,7 +1617,7 @@ } if (model.parentLevel > model.level) { GIS.logg.push([model.parentLevel, model.level, this.xtype + '.parentLevel: number <= ' + this.xtype + '.level']); - //alert("validation failed"); //todo + alert('Level cannot be higher than parent level'); //todo return false; } @@ -1668,7 +1668,7 @@ features = []; if (values.length === 0) { - alert("no data"); //todo Ext.message.msg(false, GIS.i18n.current_selection_no_data); + alert('No aggregated data values found'); //todo Ext.message.msg(false, GIS.i18n.current_selection_no_data); GIS.mask.hide(); return; } === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js 2012-10-23 09:01:59 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/widgets/geostat/Thematic2.js 2012-10-25 12:21:55 +0000 @@ -217,7 +217,7 @@ doc = GIS.util.geojson.decode(doc, this); } else { - alert("no coordinates"); //todo //i18n + alert('No valid coordinates found'); //todo //i18n } this.layer.removeFeatures(this.layer.features); @@ -1522,7 +1522,7 @@ } if (!model.indicator || !Ext.isString(model.indicator)) { GIS.logg.push([model.indicator, this.xtype + '.indicator: string']); - //alert("validation failed"); //todo + alert('No indicator selected'); //todo //i18n return false; } } @@ -1534,7 +1534,7 @@ } if (!model.dataElement || !Ext.isString(model.dataElement)) { GIS.logg.push([model.dataElement, this.xtype + '.dataElement: string']); - //alert("validation failed"); //todo + alert('No data element selected'); //todo //i18n return false; } } @@ -1546,7 +1546,7 @@ } if (!model.period || !Ext.isString(model.period)) { GIS.logg.push([model.period, this.xtype + '.period: string']); - //alert("validation failed"); //todo + alert('No period selected'); //todo //i18n return false; } @@ -1585,14 +1585,14 @@ else if (model.legendType === GIS.conf.finals.widget.legendtype_predefined) { if (!model.legendSet || !Ext.isString(model.legendSet)) { GIS.logg.push([model.legendSet, this.xtype + '.legendSet: string']); - //alert("validation failed"); //todo + alert('No legend set selected'); //todo //i18n return false; } } if (!model.level || !Ext.isNumber(model.level)) { GIS.logg.push([model.level, this.xtype + '.level: number']); - //alert("validation failed"); //todo + alert('No level selected'); //todo return false; } if (!model.levelName || !Ext.isString(model.levelName)) { @@ -1602,7 +1602,7 @@ } if (!model.parentId || !Ext.isString(model.parentId)) { GIS.logg.push([model.parentId, this.xtype + '.parentId: string']); - //alert("validation failed"); //todo + alert('No parent organisation unit selected'); //todo return false; } if (!model.parentName || !Ext.isString(model.parentName)) { @@ -1617,7 +1617,7 @@ } if (model.parentLevel > model.level) { GIS.logg.push([model.parentLevel, model.level, this.xtype + '.parentLevel: number <= ' + this.xtype + '.level']); - //alert("validation failed"); //todo + alert('Level cannot be higher than parent level'); //todo return false; } @@ -1668,7 +1668,7 @@ features = []; if (values.length === 0) { - alert("no data"); //todo Ext.message.msg(false, GIS.i18n.current_selection_no_data); + alert('No aggregated data values found'); //todo Ext.message.msg(false, GIS.i18n.current_selection_no_data); GIS.mask.hide(); return; } === removed file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/periodtype.js' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/periodtype.js 2012-09-24 14:16:43 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/periodtype.js 1970-01-01 00:00:00 +0000 @@ -1,405 +0,0 @@ -// generatePeriods config object: { boolean offset, boolean filterFuturePeriods, boolean reversePeriods } - -function PeriodType() -{ - var monthNames = ['January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December'], - - format_yyyymmdd = function(date) { - var y = date.getFullYear(), - m = new String(date.getMonth() + 1), - d = new String(date.getDate()); - m = m.length < 2 ? '0' + m : m; - d = d.length < 2 ? '0' + d : d; - return y + '-' + m + '-' + d; - }, - - filterFuturePeriods = function( periods ) { - var array = [], - now = new Date(); - - for ( var i = 0; i < periods.length; i++ ) - { - if ( new Date( periods[i]['startDate'] ) <= now ) - { - array.push(periods[i]); - } - } - - return array; - }; - - var periodTypes = []; - periodTypes['Daily'] = new DailyPeriodType( format_yyyymmdd, filterFuturePeriods ); - periodTypes['Weekly'] = new WeeklyPeriodType( format_yyyymmdd, filterFuturePeriods ); - periodTypes['Monthly'] = new MonthlyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); - periodTypes['BiMonthly'] = new BiMonthlyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); - periodTypes['Quarterly'] = new QuarterlyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); - periodTypes['SixMonthly'] = new SixMonthlyPeriodType( monthNames, filterFuturePeriods ); - periodTypes['Yearly'] = new YearlyPeriodType( format_yyyymmdd, filterFuturePeriods ); - periodTypes['FinancialOct'] = new FinancialOctoberPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); - periodTypes['FinancialJuly'] = new FinancialJulyPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); - periodTypes['FinancialApril'] = new FinancialAprilPeriodType( format_yyyymmdd, monthNames, filterFuturePeriods ); - - this.get = function( key ) - { - return periodTypes[key]; - }; -} - -function DailyPeriodType( format_yyyymmdd, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset; - date = new Date( '01 Jan ' + year ); - - while ( date.getFullYear() === year ) - { - var period = {}; - period['startDate'] = format_yyyymmdd( date ); - period['endDate'] = period['startDate']; - period['name'] = period['startDate']; - //period['id'] = 'Daily_' + period['startDate']; - period['iso'] = period['startDate'].replace( /-/g, '' ); - period['id'] = period['iso']; - periods.push( period ); - date.setDate( date.getDate() + 1 ); - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods.reverse() : periods; - - return periods; - }; -} - -function WeeklyPeriodType( format_yyyymmdd, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '01 Jan ' + year ), - day = date.getDay(), - week = 1; - - if ( day <= 4 ) - { - date.setDate( date.getDate() - ( day - 1 ) ); - } - else - { - date.setDate( date.getDate() + ( 8 - day ) ); - } - - while ( date.getFullYear() <= year ) - { - var period = {}; - period['startDate'] = format_yyyymmdd( date ); - //period['id'] = 'Weekly_' + period['startDate']; - period['iso'] = year + 'W' + week; - period['id'] = period['iso']; - date.setDate( date.getDate() + 6 ); - period['endDate'] = format_yyyymmdd( date ); - period['name'] = 'W' + week + ' - ' + period['startDate'] + ' - ' + period['endDate']; - periods.push( period ); - date.setDate( date.getDate() + 1 ); - week++; - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods.reverse() : periods; - - return periods; - }; -} - -function MonthlyPeriodType( format_yyyymmdd, monthNames, fnFilter ) -{ - var format_iso = function(date) { - var y = date.getFullYear(), - m = new String(date.getMonth() + 1); - m = m.length < 2 ? '0' + m : m; - return y + m; - }; - - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '31 Dec ' + year ); - - while ( date.getFullYear() === year ) - { - var period = {}; - period['endDate'] = format_yyyymmdd( date ); - date.setDate( 1 ); - period['startDate'] = format_yyyymmdd( date ); - period['name'] = monthNames[date.getMonth()] + ' ' + date.getFullYear(); - //period['id'] = 'Monthly_' + period['startDate']; - period['iso'] = format_iso( date ); - period['id'] = period['iso']; - periods.push( period ); - date.setDate( 0 ); - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods : periods.reverse(); - // Months are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. - - return periods; - }; -} - -function BiMonthlyPeriodType( format_yyyymmdd, monthNames, fnFilter ) -{ - var format_iso = function( date ) { - var y = date.getFullYear(), - m = new String(date.getMonth() + 1); - m = m.length < 2 ? '0' + m : m; - return y + m + 'B'; - }; - - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '31 Dec ' + year ); - - while ( date.getFullYear() === year ) - { - var period = {}; - period['endDate'] = format_yyyymmdd( date ); - date.setDate( 0 ); - date.setDate( 1 ); - period['startDate'] = format_yyyymmdd( date ); - period['name'] = monthNames[date.getMonth()] + ' - ' + monthNames[date.getMonth() + 1] + ' ' + date.getFullYear(); - //period['id'] = 'BiMonthly_' + period['startDate']; - period['iso'] = format_iso( date ); - period['id'] = period['iso']; - periods.push(period); - date.setDate( 0 ); - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods : periods.reverse(); - // Bi-months are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. - - return periods; - }; -} - -function QuarterlyPeriodType( format_yyyymmdd, monthNames, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '31 Dec ' + year ), - quarter = 4; - - while ( date.getFullYear() === year ) - { - var period = {}; - period['endDate'] = format_yyyymmdd( date ); - date.setDate( 0 ); - date.setDate( 0 ); - date.setDate( 1 ); - period['startDate'] = format_yyyymmdd( date ); - period['name'] = monthNames[date.getMonth()] + ' - ' + monthNames[date.getMonth() + 2] + ' ' + date.getFullYear(); - //period['id'] = 'Quarterly_' + period['startDate']; - period['iso'] = year + 'Q' + quarter; - period['id'] = period['iso']; - periods.push(period); - date.setDate( 0 ); - quarter--; - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods : periods.reverse(); - // Quarters are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. - - return periods; - }; -} - -function SixMonthlyPeriodType( monthNames, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset; - - var period = {}; - period['startDate'] = year + '-01-01'; - period['endDate'] = year + '-06-30'; - period['name'] = monthNames[0] + ' - ' + monthNames[5] + ' ' + year; - //period['id'] = 'SixMonthly_' + period['startDate']; - period['iso'] = year + 'S1'; - period['id'] = period['iso']; - periods.push(period); - - period = {}; - period['startDate'] = year + '-07-01'; - period['endDate'] = year + '-12-31'; - period['name'] = monthNames[6] + ' - ' + monthNames[11] + ' ' + year; - //period['id'] = 'SixMonthly_' + period['startDate']; - period['iso'] = year + 'S2'; - period['id'] = period['iso']; - periods.push(period); - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods.reverse() : periods; - - return periods; - }; -} - -function YearlyPeriodType( format_yyyymmdd, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '31 Dec ' + year ); - - while ( ( year - date.getFullYear() ) < 10 ) - { - var period = {}; - period['endDate'] = format_yyyymmdd( date ); - date.setMonth( 0, 1 ); - period['startDate'] = format_yyyymmdd( date ); - period['name'] = date.getFullYear().toString(); - //period['id'] = 'Yearly_' + period['startDate']; - period['iso'] = date.getFullYear().toString(); - period['id'] = period['iso'].toString(); - periods.push(period); - date.setDate(0); - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods : periods.reverse(); - // Years are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. - - return periods; - }; -} - -function FinancialOctoberPeriodType( format_yyyymmdd, monthNames, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '30 Sep ' + ( year + 1 ) ); - - for ( var i = 0; i < 10; i++ ) - { - var period = {}; - period['endDate'] = format_yyyymmdd( date ); - date.setYear( date.getFullYear() - 1 ); - date.setDate( date.getDate() + 1 ); - period['startDate'] = format_yyyymmdd( date ); - period['name'] = monthNames[9] + ' ' + date.getFullYear() + ' - ' + monthNames[8] + ' ' + ( date.getFullYear() + 1 ); - period['id'] = 'FinancialOct_' + period['startDate']; - periods.push( period ); - date.setDate( date.getDate() - 1 ); - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods : periods.reverse(); - // FinancialOctober periods are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. - - return periods; - }; -} - -function FinancialJulyPeriodType( format_yyyymmdd, monthNames, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '30 Jun ' + ( year + 1 ) ); - - for ( var i = 0; i < 10; i++ ) - { - var period = {}; - period['endDate'] = format_yyyymmdd( date ); - date.setYear( date.getFullYear() - 1 ); - date.setDate( date.getDate() + 1 ); - period['startDate'] = format_yyyymmdd( date ); - period['name'] = monthNames[6] + ' ' + date.getFullYear() + ' - ' + monthNames[5] + ' ' + ( date.getFullYear() + 1 ); - period['id'] = 'FinancialJuly_' + period['startDate']; - periods.push( period ); - date.setDate( date.getDate() - 1 ); - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods : periods.reverse(); - // FinancialJuly periods are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. - - return periods; - }; -} - -function FinancialAprilPeriodType( format_yyyymmdd, monthNames, fnFilter ) -{ - this.generatePeriods = function( config ) - { - var periods = [], - offset = parseInt(config.offset), - isFilter = config.filterFuturePeriods, - isReverse = config.reversePeriods, - year = new Date().getFullYear() + offset, - date = new Date( '31 Mar ' + ( year + 1 ) ); - - for ( var i = 0; i < 10; i++ ) - { - var period = {}; - period['endDate'] = format_yyyymmdd( date ); - date.setYear( date.getFullYear() - 1 ); - date.setDate( date.getDate() + 1 ); - period['startDate'] = format_yyyymmdd( date ); - period['name'] = monthNames[3] + ' ' + date.getFullYear() + ' - ' + monthNames[2] + ' ' + ( date.getFullYear() + 1 ); - period['id'] = 'FinancialApril_' + period['startDate']; - periods.push( period ); - date.setDate( date.getDate() - 1 ); - } - - periods = isFilter ? fnFilter( periods ) : periods; - periods = isReverse ? periods : periods.reverse(); - // FinancialApril periods are collected backwards. If isReverse is true, then do nothing. Else reverse to correct order and return. - - return periods; - }; -} === 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-23 17:28:27 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css 2012-10-25 12:07:10 +0000 @@ -185,17 +185,27 @@ border-radius: 2px; } +.gis-toolbar-btn-menu-download .x-btn-icon, +.gis-toolbar-btn-menu-download .x-btn-default-small-icon button { + width: 28px !important; + height: 28px !important; +} + +.gis-btn-icon-download { + background: url('../images/download_22.png') no-repeat; +} + /* Toolbar */ .x-toolbar-default { background-image: none; background-color: #F3F3F3; background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #F1F1F1), color-stop(100%, whiteSmoke)); - background-image: -webkit-linear-gradient(top, #F1F1F1,whiteSmoke); - background-image: -moz-linear-gradient(top, #F1F1F1,whiteSmoke); - background-image: -o-linear-gradient(top, #F1F1F1,whiteSmoke); - background-image: -ms-linear-gradient(top, #F1F1F1,whiteSmoke); - background-image: linear-gradient(top, #F1F1F1,whiteSmoke); + background-image: -webkit-linear-gradient(top, #F1F1F1, whiteSmoke); + background-image: -moz-linear-gradient(top, #F1F1F1, whiteSmoke); + background-image: -o-linear-gradient(top, #F1F1F1, whiteSmoke); + background-image: -ms-linear-gradient(top, #F1F1F1, whiteSmoke); + background-image: linear-gradient(top, #F1F1F1, whiteSmoke); } /* Toolbar btn */ === modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonFacilities.vm' --- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonFacilities.vm 2012-10-16 14:19:02 +0000 +++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonFacilities.vm 2012-10-25 12:07:10 +0000 @@ -1,1 +1,33 @@ -#set($size=$object.size()){"properties":{},"geojson":[#foreach($unit in $object){"ty":#if(${unit.featureType}=="Point")"2"#else"1"#end,"co":$!encoder.jsonEncode($!{unit.validCoordinates}),"uid":"$!{unit.uid}","iid":$!{unit.id},"na":"$!encoder.jsonEncode(${unit.name})"#foreach($set in $groupSets)#set($n=$velocityCount - 1),"$!encoder.jsonEncode(${set.getName()})":"$!encoder.jsonEncode(${unit.groupNames[$n]})"#end}#if($velocityCount<$size),#end#end]} \ No newline at end of file + +#set($size=$object.size()) +#set($groupSetSize=$groupSets.size()) +{ + "properties":{}, + "geojson":[ + + #foreach($unit in $object) + + { + + "ty": #if(${unit.featureType}=="Point")"2"#else"1"#end, + "co":$!encoder.jsonEncode($!{unit.validCoordinates}), + "uid":"$!{unit.uid}", + "iid":$!{unit.id}, + "na":"$!encoder.jsonEncode(${unit.name})", + + "groupSets": { + + #foreach($set in $groupSets) + #set( $index = ( $velocityCount - 1 ) ) + #set( $key = $!encoder.jsonEncode( ${set.name} ) ) + #set( $val = $!encoder.jsonEncode( $unit.groupNames.get(${index}) ) ) + "${key}":"${val}" + #if($velocityCount<$groupSetSize),#end + + #end + } + }#if($velocityCount<$size),#end + + #end + ] +} \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html' --- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2012-10-24 10:45:58 +0000 +++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/index.html 2012-10-24 13:10:34 +0000 @@ -20,7 +20,7 @@ - +