dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #00240
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 79: Assignment enhancements.
------------------------------------------------------------
revno: 79
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Wed 2009-03-18 15:42:57 +0530
message:
Assignment enhancements.
modified:
gis/dhis-gis-geostat/demos/geostat/config.js
gis/dhis-gis-geostat/demos/geostat/geostat.js
gis/dhis-gis-geostat/demos/geostat/index.html
gis/dhis-gis-geostat/mfbase/mapfish/widgets/geostat/Choropleth.js
=== modified file 'gis/dhis-gis-geostat/demos/geostat/config.js'
--- gis/dhis-gis-geostat/demos/geostat/config.js 2009-03-17 13:02:33 +0000
+++ gis/dhis-gis-geostat/demos/geostat/config.js 2009-03-18 10:12:57 +0000
@@ -4,24 +4,26 @@
// SHAPE FILES
hidden = '../../../geoserver/wfs?request=GetFeature&typename=who:india_st&outputformat=json&version=1.0.0'; // init widget map. not visible. should be as light as possible
-level_1 = '../../../geoserver/wfs?request=GetFeature&typename=who:india_st&outputformat=json&version=1.0.0'; // provinces
-level_2 = '../../../geoserver/wfs?request=GetFeature&typename=who:india_st&outputformat=json&version=1.0.0'; // districts
+level_1 = '../../../geoserver/wfs?request=GetFeature&typename=who:Indian_state&outputformat=json&version=1.0.0'; // provinces
+level_2 = '../../../geoserver/wfs?request=GetFeature&typename=who:Indian_state&outputformat=json&version=1.0.0'; // districts
level_3 = '../../../geoserver/wfs?request=GetFeature&typename=who:india_ds&outputformat=json&version=1.0.0'; // chiefdoms
+init_map = 'who:Indian_state';
+
shapefiles = new Array(hidden, level_1, level_2, level_3);
shpcols = {
1: [ { type: "Territory", // What kind of orgunit. Displayed in the info box.
- name: "STATE", // Shapefile column holding the name of the orgunit. Displayed in the info box.
+ name: "ST_NAME", // Shapefile column holding the name of the orgunit. Displayed in the info box.
geocode: "", // Shapefile column holding a unique value
value: "value" } ], // Must be set to "value"
2: [ { type: "State",
- name: "STATE",
- geocode: "STATE",
+ name: "ST_NAME",
+ geocode: "ST_NAME",
value: "value", // Must be set to "value"
- parent1: "STATE" } ], // Shapefile column holding the name of the parent orgunit (1 level above)
+ parent1: "" } ], // Shapefile column holding the name of the parent orgunit (1 level above)
3: [ { type: "District",
name: "DISTRICT",
@@ -41,7 +43,7 @@
pointLayer = 4; // the shpcols point layer number
-init_map = 'who:india_st';
+
init_longitude = 82;
init_latitude = 22;
init_zoom = 5;
@@ -58,5 +60,6 @@
north_height = 0;
south_height = 70; // viewport south
-gridpanel_width = 255;
+gridpanel_width = west_width - 15;
+gridpanel_height = 495;
combo_width = 150;
\ No newline at end of file
=== modified file 'gis/dhis-gis-geostat/demos/geostat/geostat.js'
--- gis/dhis-gis-geostat/demos/geostat/geostat.js 2009-03-17 13:02:33 +0000
+++ gis/dhis-gis-geostat/demos/geostat/geostat.js 2009-03-18 10:12:57 +0000
@@ -76,6 +76,10 @@
map.setCenter(new OpenLayers.LonLat(init_longitude, init_latitude), init_zoom); // config.js
+
+
+
+
// create choropleth widget
choropleth = new mapfish.widgets.geostat.Choropleth({
id: 'choropleth',
@@ -108,8 +112,9 @@
}
});
- // create proportional symbol layer
+ // create proportional symbol widget
var propSymbol = new mapfish.widgets.geostat.ProportionalSymbol({
+ id: 'propsymbol',
map: map,
layer: propSymbolLayer,
title: 'Proportional symbol',
@@ -148,6 +153,7 @@
{
// raw
region: 'north',
+ id: 'north',
el: 'north',
height: north_height
}),
@@ -161,7 +167,7 @@
minSize: 50,
maxSize: 200,
collapsible: true,
- title: 'Information',
+ title: 'Status',
margins: '0 0 0 0',
bodyStyle: 'padding:5px; font-family:tahoma; font-size:12px'
},
@@ -279,29 +285,41 @@
if (choropleth.selectedLevel == 1) {
var html = style + '<b>' + shpcols[choropleth.selectedLevel][0].type + ':</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].name] + '</p>';
- html += '<br>';
- html += style + '<b>Value:</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].value] + '</p>';
+
+ if (!choropleth.isAssignment)
+ {
+ html += '<br>';
+ html += style + '<b>Value:</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].value] + '</p>';
+ }
}
if (choropleth.selectedLevel == 2) {
var html = style + '<b>' + shpcols[choropleth.selectedLevel][0].type + ':</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].name] + '</p>';
html += style + '<b>' + shpcols[choropleth.selectedLevel-1][0].type + ':</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].parent1] + '</p>';
- html += '<br>';
- html += style + '<b>Value:</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].value] + '</p>';
+
+ if (!choropleth.isAssignment)
+ {
+ html += '<br>';
+ html += style + '<b>Value:</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].value] + '</p>';
+ }
}
if (choropleth.selectedLevel == 3) {
var html = style + '<b>' + shpcols[choropleth.selectedLevel][0].type + ':</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].name] + '</p>';
html += style + '<b>' + shpcols[choropleth.selectedLevel-1][0].type + ':</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].parent1] + '</p>';
html += style + '<b>' + shpcols[choropleth.selectedLevel-2][0].type + ':</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].parent2] + '</p>';
- html += '<br>';
- html += style + '<b>Value:</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].value] + '</p>';
+
+ if (!choropleth.isAssignment)
+ {
+ html += '<br>';
+ html += style + '<b>Value:</b>' + space + feature.attributes[shpcols[choropleth.selectedLevel][0].value] + '</p>';
+ }
}
popup_feature.html = html;
popup_feature.show();
- south_panel.body.dom.innerHTML = 'More information about the selected area may be listed here.';
+
}
@@ -317,7 +335,8 @@
function onClickSelectChoropleth(feature)
{
var selected = Ext.getCmp('grid_gp').getSelectionModel().getSelected();
- organisationUnitId = selected.data["id"],
+ organisationUnitId = selected.data["id"];
+ organisationUnit = selected.data["name"];
geoCode = feature.attributes[ shpcols[choropleth.selectedLevel][0].name ];
if (!selected)
@@ -334,7 +353,10 @@
success: function( responseObject )
{
- alert("OK");
+ var south_panel = Ext.getCmp('south-panel');
+ south_panel.body.dom.innerHTML = organisationUnit + '<font color="#444444"> assigned to </font>' + geoCode;
+ choropleth.gridStore.reload();
+ alert("funka");
},
failure: function()
{
@@ -431,6 +453,8 @@
var periodId = Ext.getCmp('period_cb').getValue();
var level = Ext.getCmp('level_cb').getValue();
+//alert(indicatorId+"\n"+ periodId+"\n"+level);
+
var url = 'http://localhost:' + localhost_port + '/dhis-webservice/getMapValues.service';
format = 'json';
@@ -481,14 +505,25 @@
function getAssignOrganisationUnitData()
{
- var layers = this.myMap.getLayersByName(choroplethLayerName);
- features = layers[0]["features"];
- var featuresLength = features.length;
-
- for ( var j=0; j < featuresLength; j++ )
+ var url = 'http://localhost:' + localhost_port + '/dhis-webservice/getOrganisationUnitsAtLevel.service';
+ var level = choropleth.selectedLevel;
+ var format = 'json';
+
+ Ext.Ajax.request(
{
- features[j].attributes["value"] = 0;
- }
+ url: url,
+ method: 'GET',
+ params: { level: level, format: format },
+
+ success: function( responseObject )
+ {
+ dataReceivedAssignOrganisationUnit( responseObject.responseText );
+ },
+ failure: function()
+ {
+ alert( 'Status', 'Error while retrieving data' );
+ }
+ });
}
@@ -542,3 +577,26 @@
}
}
}
+
+function dataReceivedAssignOrganisationUnit( responseText )
+{
+ var layers = this.myMap.getLayersByName(choroplethLayerName);
+ var level = choropleth.selectedLevel;
+ features = layers[0]["features"];
+ var featuresLength = features.length;
+ var data = Ext.util.JSON.decode(responseText);
+ var dataLength = data.organisationUnits.length;
+
+ for ( var j=0; j < featuresLength; j++ )
+ {
+ features[j].attributes["value"] = j;
+
+ for ( var i=0; i < dataLength; i++ )
+ {
+ if (features[j].attributes[shpcols[level][0].geocode] == data.organisationUnits[i].geoCode)
+ {
+ features[j].attributes["value"] = 1000;
+ }
+ }
+ }
+}
=== modified file 'gis/dhis-gis-geostat/demos/geostat/index.html'
--- gis/dhis-gis-geostat/demos/geostat/index.html 2009-03-17 13:02:33 +0000
+++ gis/dhis-gis-geostat/demos/geostat/index.html 2009-03-18 10:12:57 +0000
@@ -26,8 +26,9 @@
<script type="text/javascript" src="../../mfbase/ext-community-extensions/color-field.js"></script>
<!-- Div script -->
+
+ <script type="text/javascript" src="geostat.js"></script>
<script type="text/javascript" src="config.js"></script>
- <script type="text/javascript" src="geostat.js"></script>
<style>
.assigned-row {background-color: #DBFFDC}
.not-assigned-row {background-color: #FFEFD5}
@@ -50,9 +51,7 @@
<div id="olmap"></div>
- <div id="south">
- <p>More information may be displayed here.</p>
- </div>
+ <div id="south"></div>
<div id="position">
<div id="mouseposition"></div>
=== modified file 'gis/dhis-gis-geostat/mfbase/mapfish/widgets/geostat/Choropleth.js'
--- gis/dhis-gis-geostat/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-03-17 13:02:33 +0000
+++ gis/dhis-gis-geostat/mfbase/mapfish/widgets/geostat/Choropleth.js 2009-03-18 10:12:57 +0000
@@ -145,6 +145,8 @@
selectedValue : false,
+ isAssignment : false,
+
initComponent : function() {
@@ -402,7 +404,7 @@
width: combo_width,
store: new Ext.data.SimpleStore({
fields: ['value'],
- data: [[0], [1], [2], [3], [4], [5], [6], [7], [8], [9]]
+ data: [[1], [2], [3], [4], [5], [6], [7], [8], [9]]
})
},
@@ -513,6 +515,9 @@
gridStore.baseParams = { level: value, format: 'json' };
gridStore.reload();
+ var south = Ext.getCmp('south-panel');
+ Ext.getCmp('grid_gp').height = south.y - 500;
+
this.classify2(true);
},
scope: this
@@ -537,9 +542,8 @@
id: 'grid_gp',
store: gridStore,
columns: [ { header: 'Organisation units ', id: 'name', dataIndex: 'name', sortable: true } ],
- autoHeight: true,
- autoScroll: true,
width: gridpanel_width,
+ height: gridpanel_height,
view: gridView
}
@@ -608,6 +612,8 @@
*/
classify: function(exception) {
+ this.isAssignment = false;
+
if (!this.ready) {
if (exception) {
Ext.MessageBox.alert('Error', 'Component init not complete');
@@ -670,6 +676,8 @@
classify2: function(exception) {
+ this.isAssignment = true;
+
if (!this.ready) {
if (exception) {
Ext.MessageBox.alert('Error', 'Component init not complete');
@@ -702,13 +710,13 @@
// options.method = "CLASSIFY_BY_EQUAL_INTERVALS";
options.method = mapfish.GeoStat.Distribution[options.method];
- options.numClasses = 1;
+ options.numClasses = 2;
// options.colors = this.getColors();
var colorA = new mapfish.ColorRgb();
- colorA.setFromHex('#FFFFFF');
+ colorA.setFromHex('#FFEFD5');
var colorB = new mapfish.ColorRgb();
- colorB.setFromHex('#FFFFFF');
+ colorB.setFromHex('#DBFFDC');
options.colors = [colorA, colorB];
this.coreComp.updateOptions(options);
--
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.