dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15037
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5268: (GIS) Performance improvements when getting geojson from server.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 5268 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2011-12-02 14:27:03 +0100
message:
(GIS) Performance improvements when getting geojson from server.
added:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitInfoFacilityAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminFacilityInfo.vm
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojson.vm
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/resources/mapfish/widgets/geostat/Choropleth.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2011-11-12 12:54:31 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetGeoJsonAction.java 2011-12-02 13:24:16 +0000
@@ -31,9 +31,6 @@
import java.util.Collection;
import org.hisp.dhis.organisationunit.OrganisationUnit;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
-import org.hisp.dhis.organisationunit.OrganisationUnitGroupSetPopulator;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.system.filter.OrganisationUnitWithCoordinatesFilter;
import org.hisp.dhis.system.filter.OrganisationUnitWithValidPointCoordinateFilter;
@@ -59,13 +56,6 @@
this.organisationUnitService = organisationUnitService;
}
- private OrganisationUnitGroupService organisationUnitGroupService;
-
- public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
- {
- this.organisationUnitGroupService = organisationUnitGroupService;
- }
-
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -108,36 +98,27 @@
Collection<OrganisationUnit> organisationUnits = organisationUnitService.getOrganisationUnitsAtLevel( level,
parent );
-
+
FilterUtils.filter( organisationUnits, new OrganisationUnitWithCoordinatesFilter() );
FilterUtils.filter( organisationUnits, new OrganisationUnitWithValidPointCoordinateFilter() );
- OrganisationUnitGroupSet typeGroupSet = organisationUnitGroupService
- .getOrganisationUnitGroupSetByName( OrganisationUnitGroupSetPopulator.NAME_TYPE );
-
object = new ArrayList<OrganisationUnit>();
for ( OrganisationUnit unit : organisationUnits )
{
- if ( unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
- {
- unit.setType( unit.getGroupNameInGroupSet( typeGroupSet ) );
- }
-
- else
+ if ( !unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
{
object.add( unit );
}
+ }
- }
-
for ( OrganisationUnit unit : organisationUnits )
{
if ( unit.getFeatureType().equals( OrganisationUnit.FEATURETYPE_POINT ) )
{
object.add( unit );
- }
+ }
}
return SUCCESS;
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitInfoFacilityAction.java'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitInfoFacilityAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetOrganisationUnitInfoFacilityAction.java 2011-12-02 13:24:16 +0000
@@ -0,0 +1,101 @@
+package org.hisp.dhis.mapping.action;
+
+/*
+ * Copyright (c) 2004-2010, University of Oslo
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are met:
+ * * Redistributions of source code must retain the above copyright notice, this
+ * list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above copyright notice,
+ * this list of conditions and the following disclaimer in the documentation
+ * and/or other materials provided with the distribution.
+ * * Neither the name of the HISP project nor the names of its contributors may
+ * be used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
+ * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupService;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSet;
+import org.hisp.dhis.organisationunit.OrganisationUnitGroupSetPopulator;
+import org.hisp.dhis.organisationunit.OrganisationUnitService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Jan Henrik Overland
+ * @version $Id$
+ */
+public class GetOrganisationUnitInfoFacilityAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnitService organisationUnitService;
+
+ public void setOrganisationUnitService( OrganisationUnitService organisationUnitService )
+ {
+ this.organisationUnitService = organisationUnitService;
+ }
+
+ private OrganisationUnitGroupService organisationUnitGroupService;
+
+ public void setOrganisationUnitGroupService( OrganisationUnitGroupService organisationUnitGroupService )
+ {
+ this.organisationUnitGroupService = organisationUnitGroupService;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private OrganisationUnit object;
+
+ public OrganisationUnit getObject()
+ {
+ return object;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ throws Exception
+ {
+ object = organisationUnitService.getOrganisationUnit( id );
+
+ OrganisationUnitGroupSet typeGroupSet = organisationUnitGroupService
+ .getOrganisationUnitGroupSetByName( OrganisationUnitGroupSetPopulator.NAME_TYPE );
+
+ object.setType( object.getGroupNameInGroupSet( typeGroupSet ) );
+
+ return SUCCESS;
+ }
+}
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-12-01 15:43:25 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml 2011-12-02 13:24:16 +0000
@@ -57,6 +57,15 @@
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
+ <bean id="org.hisp.dhis.mapping.action.GetOrganisationUnitInfoFacilityAction"
+ class="org.hisp.dhis.mapping.action.GetOrganisationUnitInfoFacilityAction"
+ scope="prototype">
+ <property name="organisationUnitService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ <property name="organisationUnitGroupService"
+ ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
+ </bean>
+
<!-- UserSetting -->
<bean id="org.hisp.dhis.mapping.action.GetMapUserSettingsAction"
@@ -300,8 +309,6 @@
scope="prototype">
<property name="organisationUnitService"
ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
- <property name="organisationUnitGroupService"
- ref="org.hisp.dhis.organisationunit.OrganisationUnitGroupService" />
</bean>
<bean id="org.hisp.dhis.mapping.action.GetGeoJsonFacilitiesAction"
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-11-22 13:58:34 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/resources/struts.xml 2011-12-02 13:24:16 +0000
@@ -78,6 +78,12 @@
</result>
</action>
+ <action name="getFacilityInfo"
+ class="org.hisp.dhis.mapping.action.GetOrganisationUnitInfoFacilityAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-mapping/jsonminFacilityInfo.vm</result>
+ </action>
+
<!-- OrganisationUnitLevel -->
<action name="getOrganisationUnitLevels"
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojson.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojson.vm 2011-12-01 15:49:20 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojson.vm 2011-12-02 13:24:16 +0000
@@ -1,1 +1,1 @@
-#set($size=$object.size()){"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":#if($!{unit.featureType}=="Point")"Point"#else "MultiPolygon"#end,"coordinates":$!encoder.jsonEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode(${unit.name})"#if($!{unit.featureType}!="Point"),"hcwc":$!{unit.hasChildrenWithCoordinates()}#end#if($!{unit.featureType}=="Point"),"type":"$!encoder.jsonEncode(${unit.type})","code":"$!encoder.jsonEncode(${unit.code})","cp":"$!encoder.jsonEncode(${unit.contactPerson})","ad":"$!encoder.jsonEncode(${unit.address})","em":"$!encoder.jsonEncode(${unit.email})","pn":"$!encoder.jsonEncode(${unit.phoneNumber})"#end}}#if($velocityCount<$size),#end#end],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
+#set($size=$object.size()){"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":#if($!{unit.featureType}=="Point")"Point"#else"MultiPolygon"#end,"coordinates":$!encoder.jsonEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode(${unit.name})"#if($!{unit.featureType}!="Point"),"hcwc":$!{unit.hasChildrenWithCoordinates()}#end}}#if($velocityCount<$size),#end#end],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
=== 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 2011-11-23 11:55:26 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/geojsonFacilities.vm 2011-12-02 13:24:16 +0000
@@ -1,1 +1,1 @@
-#set($size=$object.size()){"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":"Point","coordinates":$!encoder.jsonEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!encoder.jsonEncode(${unit.name})","code":"$!encoder.jsonEncode(${unit.code})","cp":"$!encoder.jsonEncode(${unit.contactPerson})","ad":"$!encoder.jsonEncode(${unit.address})","em":"$!encoder.jsonEncode(${unit.email})","pn":"$!encoder.jsonEncode(${unit.phoneNumber})"#foreach($set in $groupSets)#set($n=$velocityCount - 1),"$!encoder.jsonEncode(${set.getName()})":"$!encoder.jsonEncode(${unit.groupNames[$n]})"#end}}#if($velocityCount<$size),#end#end],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
+#set($size=$object.size()){"type":"FeatureCollection","features":[#foreach($unit in $object){"geometry":{"type":"Point","coordinates":$!encoder.jsonEncode($!{unit.validCoordinates})},"properties":{"id":"$!{unit.id}","name":"$!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],"crs":{"type":"EPSG","properties":{"code":"4326"}}}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminFacilityInfo.vm'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminFacilityInfo.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/jsonminFacilityInfo.vm 2011-12-02 13:24:16 +0000
@@ -0,0 +1,1 @@
+{"ty":"$!encoder.jsonEncode(${object.type})","co":"$!encoder.jsonEncode(${object.code})","cp":"$!encoder.jsonEncode(${object.contactPerson})","ad":"$!encoder.jsonEncode(${object.address})","em":"$!encoder.jsonEncode(${object.email})","pn":"$!encoder.jsonEncode(${object.phoneNumber})"}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-12-01 17:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Choropleth.js 2011-12-02 13:26:11 +0000
@@ -1034,101 +1034,110 @@
}
scope.featureOptions.menu = new Ext.menu.Menu({
- showInfo: function() {
- if (scope.featureOptions.info) {
- scope.featureOptions.info.destroy();
- }
-
- scope.featureOptions.info = new Ext.Window({
- title: '<span class="window-information-title">Facility information sheet</span>',
- layout: 'table',
- width: G.conf.window_width + 178,
- height: G.util.getMultiSelectHeight() + 100,
- bodyStyle: 'background-color:#fff',
- defaults: {
- bodyStyle: 'vertical-align:top',
- labelSeparator: G.conf.labelseparator,
- emptyText: G.conf.emptytext
- },
- layoutConfig: {
- columns: 2
- },
- items: [
- {
- xtype: 'panel',
- layout: 'anchor',
- bodyStyle: 'padding:8px 4px 8px 8px',
- width: 160,
- items: [
- {html: '<div class="window-info">' + G.i18n.name + '<p style="font-weight:normal">' + feature.attributes.name + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.type + '<p style="font-weight:normal">' + feature.attributes.type + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.code + '<p style="font-weight:normal">' + feature.attributes.code + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.address + '<p style="font-weight:normal">' + feature.attributes.ad + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.contact_person + '<p style="font-weight:normal">' + feature.attributes.cp + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.email + '<p style="font-weight:normal">' + feature.attributes.em + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.phone_number + '<p style="font-weight:normal">' + feature.attributes.pn + '</p></div>'}
- ]
- },
- {
- xtype: 'form',
- bodyStyle: 'padding:8px 8px 8px 4px',
- width: G.conf.window_width + 20,
- labelWidth: G.conf.label_width,
- items: [
- {html: '<div class="window-info">' + G.i18n.infrastructural_data + '</div>'},
- {
- xtype: 'combo',
- name: 'period',
- fieldLabel: G.i18n.period,
- typeAhead: true,
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- selectOnFocus: true,
- width: G.conf.combo_width,
- store: G.stores.infrastructuralPeriodsByType,
- lockPosition: false,
- listeners: {
- 'select': function(cb) {
- scope.infrastructuralPeriod = cb.getValue();
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
- scope.stores.infrastructuralDataElementMapValue.load();
+ showInfo: function() {
+ Ext.Ajax.request({
+ url: G.conf.path_mapping + 'getFacilityInfo' + G.conf.type,
+ method: 'POST',
+ params: {id: feature.attributes.id},
+ success: function(r) {
+ var ou = Ext.util.JSON.decode(r.responseText);
+
+ if (scope.featureOptions.info) {
+ scope.featureOptions.info.destroy();
+ }
+
+ scope.featureOptions.info = new Ext.Window({
+ title: '<span class="window-information-title">Facility information sheet</span>',
+ layout: 'table',
+ width: G.conf.window_width + 178,
+ height: G.util.getMultiSelectHeight() + 100,
+ bodyStyle: 'background-color:#fff',
+ defaults: {
+ bodyStyle: 'vertical-align:top',
+ labelSeparator: G.conf.labelseparator,
+ emptyText: G.conf.emptytext
+ },
+ layoutConfig: {
+ columns: 2
+ },
+ items: [
+ {
+ xtype: 'panel',
+ layout: 'anchor',
+ bodyStyle: 'padding:8px 4px 8px 8px',
+ width: 160,
+ items: [
+ {html: '<div class="window-info">' + G.i18n.name + '<p style="font-weight:normal">' + feature.attributes.name + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.type + '<p style="font-weight:normal">' + ou.ty + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.code + '<p style="font-weight:normal">' + ou.co + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.address + '<p style="font-weight:normal">' + ou.ad + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.contact_person + '<p style="font-weight:normal">' + ou.cp + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.email + '<p style="font-weight:normal">' + ou.em + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.phone_number + '<p style="font-weight:normal">' + ou.pn + '</p></div>'}
+ ]
+ },
+ {
+ xtype: 'form',
+ bodyStyle: 'padding:8px 8px 8px 4px',
+ width: G.conf.window_width + 20,
+ labelWidth: G.conf.label_width,
+ items: [
+ {html: '<div class="window-info">' + G.i18n.infrastructural_data + '</div>'},
+ {
+ xtype: 'combo',
+ name: 'period',
+ fieldLabel: G.i18n.period,
+ typeAhead: true,
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ width: G.conf.combo_width,
+ store: G.stores.infrastructuralPeriodsByType,
+ lockPosition: false,
+ listeners: {
+ 'select': function(cb) {
+ scope.infrastructuralPeriod = cb.getValue();
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+ }
+ },
+ {html: '<div style="padding:4px 0 0 0"></div>'},
+ {
+ xtype: 'grid',
+ height: G.util.getMultiSelectHeight(),
+ width: 242,
+ cm: new Ext.grid.ColumnModel({
+ columns: [
+ {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
+ {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
+ ]
+ }),
+ disableSelection: true,
+ viewConfig: {forceFit: true},
+ store: scope.stores.infrastructuralDataElementMapValue
}
- }
- },
- {html: '<div style="padding:4px 0 0 0"></div>'},
- {
- xtype: 'grid',
- height: G.util.getMultiSelectHeight(),
- width: 242,
- cm: new Ext.grid.ColumnModel({
- columns: [
- {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
- {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
- ]
- }),
- disableSelection: true,
- viewConfig: {forceFit: true},
- store: scope.stores.infrastructuralDataElementMapValue
+ ]
}
]
+ });
+
+ if (scope.infrastructuralPeriod) {
+ scope.featureOptions.info.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
}
- ]
+ scope.featureOptions.info.setPagePosition(Ext.getCmp('east').x - (scope.featureOptions.info.width + 15), Ext.getCmp('center').y + 41);
+ scope.featureOptions.info.show();
+ scope.featureOptions.menu.destroy();
+ }
});
-
- if (scope.infrastructuralPeriod) {
- scope.featureOptions.info.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
- scope.stores.infrastructuralDataElementMapValue.load();
- }
- scope.featureOptions.info.setPagePosition(Ext.getCmp('east').x - (scope.featureOptions.info.width + 15), Ext.getCmp('center').y + 41);
- scope.featureOptions.info.show();
- scope.featureOptions.menu.destroy();
},
showRelocate: function() {
if (scope.featureOptions.coordinate) {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-12-01 17:31:30 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Point.js 2011-12-02 13:26:11 +0000
@@ -1034,101 +1034,110 @@
}
scope.featureOptions.menu = new Ext.menu.Menu({
- showInfo: function() {
- if (scope.featureOptions.info) {
- scope.featureOptions.info.destroy();
- }
-
- scope.featureOptions.info = new Ext.Window({
- title: '<span class="window-information-title">Facility information sheet</span>',
- layout: 'table',
- width: G.conf.window_width + 178,
- height: G.util.getMultiSelectHeight() + 100,
- bodyStyle: 'background-color:#fff',
- defaults: {
- bodyStyle: 'vertical-align:top',
- labelSeparator: G.conf.labelseparator,
- emptyText: G.conf.emptytext
- },
- layoutConfig: {
- columns: 2
- },
- items: [
- {
- xtype: 'panel',
- layout: 'anchor',
- bodyStyle: 'padding:8px 4px 8px 8px',
- width: 160,
- items: [
- {html: '<div class="window-info">' + G.i18n.name + '<p style="font-weight:normal">' + feature.attributes.name + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.type + '<p style="font-weight:normal">' + feature.attributes.type + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.code + '<p style="font-weight:normal">' + feature.attributes.code + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.address + '<p style="font-weight:normal">' + feature.attributes.ad + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.contact_person + '<p style="font-weight:normal">' + feature.attributes.cp + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.email + '<p style="font-weight:normal">' + feature.attributes.em + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.phone_number + '<p style="font-weight:normal">' + feature.attributes.pn + '</p></div>'}
- ]
- },
- {
- xtype: 'form',
- bodyStyle: 'padding:8px 8px 8px 4px',
- width: G.conf.window_width + 20,
- labelWidth: G.conf.label_width,
- items: [
- {html: '<div class="window-info">' + G.i18n.infrastructural_data + '</div>'},
- {
- xtype: 'combo',
- name: 'period',
- fieldLabel: G.i18n.period,
- typeAhead: true,
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- selectOnFocus: true,
- width: G.conf.combo_width,
- store: G.stores.infrastructuralPeriodsByType,
- lockPosition: false,
- listeners: {
- 'select': function(cb) {
- scope.infrastructuralPeriod = cb.getValue();
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
- scope.stores.infrastructuralDataElementMapValue.load();
+ showInfo: function() {
+ Ext.Ajax.request({
+ url: G.conf.path_mapping + 'getFacilityInfo' + G.conf.type,
+ method: 'POST',
+ params: {id: feature.attributes.id},
+ success: function(r) {
+ var ou = Ext.util.JSON.decode(r.responseText);
+
+ if (scope.featureOptions.info) {
+ scope.featureOptions.info.destroy();
+ }
+
+ scope.featureOptions.info = new Ext.Window({
+ title: '<span class="window-information-title">Facility information sheet</span>',
+ layout: 'table',
+ width: G.conf.window_width + 178,
+ height: G.util.getMultiSelectHeight() + 100,
+ bodyStyle: 'background-color:#fff',
+ defaults: {
+ bodyStyle: 'vertical-align:top',
+ labelSeparator: G.conf.labelseparator,
+ emptyText: G.conf.emptytext
+ },
+ layoutConfig: {
+ columns: 2
+ },
+ items: [
+ {
+ xtype: 'panel',
+ layout: 'anchor',
+ bodyStyle: 'padding:8px 4px 8px 8px',
+ width: 160,
+ items: [
+ {html: '<div class="window-info">' + G.i18n.name + '<p style="font-weight:normal">' + feature.attributes.name + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.type + '<p style="font-weight:normal">' + ou.ty + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.code + '<p style="font-weight:normal">' + ou.co + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.address + '<p style="font-weight:normal">' + ou.ad + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.contact_person + '<p style="font-weight:normal">' + ou.cp + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.email + '<p style="font-weight:normal">' + ou.em + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.phone_number + '<p style="font-weight:normal">' + ou.pn + '</p></div>'}
+ ]
+ },
+ {
+ xtype: 'form',
+ bodyStyle: 'padding:8px 8px 8px 4px',
+ width: G.conf.window_width + 20,
+ labelWidth: G.conf.label_width,
+ items: [
+ {html: '<div class="window-info">' + G.i18n.infrastructural_data + '</div>'},
+ {
+ xtype: 'combo',
+ name: 'period',
+ fieldLabel: G.i18n.period,
+ typeAhead: true,
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ width: G.conf.combo_width,
+ store: G.stores.infrastructuralPeriodsByType,
+ lockPosition: false,
+ listeners: {
+ 'select': function(cb) {
+ scope.infrastructuralPeriod = cb.getValue();
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+ }
+ },
+ {html: '<div style="padding:4px 0 0 0"></div>'},
+ {
+ xtype: 'grid',
+ height: G.util.getMultiSelectHeight(),
+ width: 242,
+ cm: new Ext.grid.ColumnModel({
+ columns: [
+ {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
+ {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
+ ]
+ }),
+ disableSelection: true,
+ viewConfig: {forceFit: true},
+ store: scope.stores.infrastructuralDataElementMapValue
}
- }
- },
- {html: '<div style="padding:4px 0 0 0"></div>'},
- {
- xtype: 'grid',
- height: G.util.getMultiSelectHeight(),
- width: 242,
- cm: new Ext.grid.ColumnModel({
- columns: [
- {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
- {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
- ]
- }),
- disableSelection: true,
- viewConfig: {forceFit: true},
- store: scope.stores.infrastructuralDataElementMapValue
+ ]
}
]
+ });
+
+ if (scope.infrastructuralPeriod) {
+ scope.featureOptions.info.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
}
- ]
+ scope.featureOptions.info.setPagePosition(Ext.getCmp('east').x - (scope.featureOptions.info.width + 15), Ext.getCmp('center').y + 41);
+ scope.featureOptions.info.show();
+ scope.featureOptions.menu.destroy();
+ }
});
-
- if (scope.infrastructuralPeriod) {
- scope.featureOptions.info.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
- scope.stores.infrastructuralDataElementMapValue.load();
- }
- scope.featureOptions.info.setPagePosition(Ext.getCmp('east').x - (scope.featureOptions.info.width + 15), Ext.getCmp('center').y + 41);
- scope.featureOptions.info.show();
- scope.featureOptions.menu.destroy();
},
showRelocate: function() {
if (scope.featureOptions.coordinate) {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-12-01 15:49:20 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/resources/mapfish/widgets/geostat/Symbol.js 2011-12-02 13:26:11 +0000
@@ -515,107 +515,116 @@
};
var onClickSelect = function onClickSelect(feature) {
- if (feature.geometry.CLASS_NAME == G.conf.map_feature_type_point_class_name) {
+ if (feature.geometry.CLASS_NAME == G.conf.map_feature_type_point_class_name) {
if (scope.featureOptions.menu) {
scope.featureOptions.menu.destroy();
}
scope.featureOptions.menu = new Ext.menu.Menu({
- showInfo: function() {
- if (scope.featureOptions.info) {
- scope.featureOptions.info.destroy();
- }
-
- scope.featureOptions.info = new Ext.Window({
- title: '<span class="window-information-title">Facility information sheet</span>',
- layout: 'table',
- width: G.conf.window_width + 178,
- height: G.util.getMultiSelectHeight() + 100,
- bodyStyle: 'background-color:#fff',
- defaults: {
- bodyStyle: 'vertical-align:top',
- labelSeparator: G.conf.labelseparator,
- emptyText: G.conf.emptytext
- },
- layoutConfig: {
- columns: 2
- },
- items: [
- {
- xtype: 'panel',
- layout: 'anchor',
- bodyStyle: 'padding:8px 4px 8px 8px',
- width: 160,
- items: [
- {html: '<div class="window-info">' + G.i18n.name + '<p style="font-weight:normal">' + feature.attributes.name + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.type + '<p style="font-weight:normal">' + feature.attributes.Type + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.code + '<p style="font-weight:normal">' + feature.attributes.code + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.address + '<p style="font-weight:normal">' + feature.attributes.ad + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.contact_person + '<p style="font-weight:normal">' + feature.attributes.cp + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.email + '<p style="font-weight:normal">' + feature.attributes.em + '</p></div>'},
- {html: '<div class="window-info">' + G.i18n.phone_number + '<p style="font-weight:normal">' + feature.attributes.pn + '</p></div>'}
- ]
- },
- {
- xtype: 'form',
- bodyStyle: 'padding:8px 8px 8px 4px',
- width: G.conf.window_width + 20,
- labelWidth: G.conf.label_width,
- items: [
- {html: '<div class="window-info">' + G.i18n.infrastructural_data + '</div>'},
- {
- xtype: 'combo',
- name: 'period',
- fieldLabel: G.i18n.period,
- typeAhead: true,
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- selectOnFocus: true,
- width: G.conf.combo_width,
- store: G.stores.infrastructuralPeriodsByType,
- lockPosition: false,
- listeners: {
- 'select': function(cb) {
- scope.infrastructuralPeriod = cb.getValue();
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
- scope.stores.infrastructuralDataElementMapValue.load();
+ showInfo: function() {
+ Ext.Ajax.request({
+ url: G.conf.path_mapping + 'getFacilityInfo' + G.conf.type,
+ method: 'POST',
+ params: {id: feature.attributes.id},
+ success: function(r) {
+ var ou = Ext.util.JSON.decode(r.responseText);
+
+ if (scope.featureOptions.info) {
+ scope.featureOptions.info.destroy();
+ }
+
+ scope.featureOptions.info = new Ext.Window({
+ title: '<span class="window-information-title">Facility information sheet</span>',
+ layout: 'table',
+ width: G.conf.window_width + 178,
+ height: G.util.getMultiSelectHeight() + 100,
+ bodyStyle: 'background-color:#fff',
+ defaults: {
+ bodyStyle: 'vertical-align:top',
+ labelSeparator: G.conf.labelseparator,
+ emptyText: G.conf.emptytext
+ },
+ layoutConfig: {
+ columns: 2
+ },
+ items: [
+ {
+ xtype: 'panel',
+ layout: 'anchor',
+ bodyStyle: 'padding:8px 4px 8px 8px',
+ width: 160,
+ items: [
+ {html: '<div class="window-info">' + G.i18n.name + '<p style="font-weight:normal">' + feature.attributes.name + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.type + '<p style="font-weight:normal">' + ou.ty + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.code + '<p style="font-weight:normal">' + ou.co + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.address + '<p style="font-weight:normal">' + ou.ad + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.contact_person + '<p style="font-weight:normal">' + ou.cp + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.email + '<p style="font-weight:normal">' + ou.em + '</p></div>'},
+ {html: '<div class="window-info">' + G.i18n.phone_number + '<p style="font-weight:normal">' + ou.pn + '</p></div>'}
+ ]
+ },
+ {
+ xtype: 'form',
+ bodyStyle: 'padding:8px 8px 8px 4px',
+ width: G.conf.window_width + 20,
+ labelWidth: G.conf.label_width,
+ items: [
+ {html: '<div class="window-info">' + G.i18n.infrastructural_data + '</div>'},
+ {
+ xtype: 'combo',
+ name: 'period',
+ fieldLabel: G.i18n.period,
+ typeAhead: true,
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ width: G.conf.combo_width,
+ store: G.stores.infrastructuralPeriodsByType,
+ lockPosition: false,
+ listeners: {
+ 'select': function(cb) {
+ scope.infrastructuralPeriod = cb.getValue();
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', cb.getValue());
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
+ }
+ }
+ },
+ {html: '<div style="padding:4px 0 0 0"></div>'},
+ {
+ xtype: 'grid',
+ height: G.util.getMultiSelectHeight(),
+ width: 242,
+ cm: new Ext.grid.ColumnModel({
+ columns: [
+ {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
+ {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
+ ]
+ }),
+ disableSelection: true,
+ viewConfig: {forceFit: true},
+ store: scope.stores.infrastructuralDataElementMapValue
}
- }
- },
- {html: '<div style="padding:4px 0 0 0"></div>'},
- {
- xtype: 'grid',
- height: G.util.getMultiSelectHeight(),
- width: 242,
- cm: new Ext.grid.ColumnModel({
- columns: [
- {id: 'dataElementName', header: 'Data element', dataIndex: 'dataElementName', sortable: true, width: 150},
- {id: 'value', header: 'Value', dataIndex: 'value', sortable: true, width: 50}
- ]
- }),
- disableSelection: true,
- viewConfig: {forceFit: true},
- store: scope.stores.infrastructuralDataElementMapValue
+ ]
}
]
+ });
+
+ if (scope.infrastructuralPeriod) {
+ scope.featureOptions.info.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
+ scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
+ scope.stores.infrastructuralDataElementMapValue.load();
}
- ]
+ scope.featureOptions.info.setPagePosition(Ext.getCmp('east').x - (scope.featureOptions.info.width + 15), Ext.getCmp('center').y + 41);
+ scope.featureOptions.info.show();
+ scope.featureOptions.menu.destroy();
+ }
});
-
- if (scope.infrastructuralPeriod) {
- scope.featureOptions.info.find('name', 'period')[0].setValue(scope.infrastructuralPeriod);
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('periodId', scope.infrastructuralPeriod);
- scope.stores.infrastructuralDataElementMapValue.setBaseParam('organisationUnitId', feature.attributes.id);
- scope.stores.infrastructuralDataElementMapValue.load();
- }
- scope.featureOptions.info.setPagePosition(Ext.getCmp('east').x - (scope.featureOptions.info.width + 15), Ext.getCmp('center').y + 41);
- scope.featureOptions.info.show();
- scope.featureOptions.menu.destroy();
},
showRelocate: function() {
if (scope.featureOptions.coordinate) {