← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 253: deleteMapOrganisationUnitRelation and deleteMapOrganisationUnitRelationsByMap GUI added.

 

------------------------------------------------------------
revno: 253
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Fri 2009-04-24 14:01:53 +0200
message:
  deleteMapOrganisationUnitRelation and deleteMapOrganisationUnitRelationsByMap GUI added.
modified:
  gis/dhis-web-mapping/src/main/webapp/demos/geostat/config.js
  gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js
  gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js
  gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js

=== modified file 'gis/dhis-web-mapping/src/main/webapp/demos/geostat/config.js'
--- gis/dhis-web-mapping/src/main/webapp/demos/geostat/config.js	2009-04-20 16:49:17 +0000
+++ gis/dhis-web-mapping/src/main/webapp/demos/geostat/config.js	2009-04-24 12:01:53 +0000
@@ -18,5 +18,5 @@
 south_height = 70; // viewport south
 
 gridpanel_width = west_width - 15;
-gridpanel_height = 495;
+gridpanel_height = 400;
 combo_width = 150;
\ No newline at end of file

=== modified file 'gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js'
--- gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js	2009-04-23 21:07:01 +0000
+++ gis/dhis-web-mapping/src/main/webapp/demos/geostat/geostat.js	2009-04-24 12:01:53 +0000
@@ -1169,8 +1169,10 @@
     var organisationUnit = selected.data['organisationUnit'];
     
     var uniqueColumn = mapData.map.uniqueColumn;
+    var nameColumn = mapData.map.nameColumn;
     var mlp = mapData.map.mapLayerPath;
     var featureId = feature.attributes[uniqueColumn];
+    var name = feature.attributes[nameColumn];
 
     Ext.Ajax.request( 
     {
@@ -1181,7 +1183,7 @@
         success: function( responseObject )
         {
             var south_panel = Ext.getCmp('south-panel');
-            south_panel.body.dom.innerHTML = organisationUnit + '<font color="#444444"> assigned to </font>' + featureId + "!";
+            south_panel.body.dom.innerHTML = organisationUnit + '<font color="#444444"> assigned to </font>' + name + "!";
             
             loadMapData('assignment');
         },
@@ -1285,7 +1287,6 @@
     });
 }
 
-
 function getChoroplethData()
 {
     var indicatorId = Ext.getCmp('indicator_cb').getValue();
@@ -1309,7 +1310,6 @@
     });
 }
 
-
 function getPointData()
 {
     var indicatorId = Ext.getCmp('indicator_cb').getValue();
@@ -1336,7 +1336,6 @@
     });
 }
 
-
 function getAssignOrganisationUnitData()
 {
     var mlp = mapData.map.mapLayerPath;
@@ -1459,4 +1458,4 @@
     }
     
     features_mapping = features;
-}
+}
\ No newline at end of file

=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js	2009-04-24 08:42:13 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js	2009-04-24 12:01:53 +0000
@@ -194,7 +194,7 @@
 
         legendStore = new Ext.data.JsonStore({
             url: path + 'getMapLegendSet' + type,
-            baseParams: { indicatorId: 52487, format: 'json' },
+            baseParams: { indicatorId: 52487 },
             root: 'mapLegendSet',
             fields: ['id', 'name'],
             autoLoad: true
@@ -250,12 +250,14 @@
                 'select': {
                     fn: function()
                     {
+/*                    
                         var legend_cb = Ext.getCmp('legend_cb');
                         var iId = Ext.getCmp('indicator_cb').getValue();
                         
-                        legend_cb.reset();
+//                        legend_cb.reset();
                         legend_cb.getStore().baseParams = { indicatorId: iId, format: 'json' };
                         legend_cb.getStore().reload();
+*/                        
                     }
                 }
             }
@@ -372,6 +374,7 @@
                 'select': {
                     fn: function()
                     {
+/*
                         var iId = Ext.getCmp('indicator_cb').getValue();
                        
                         Ext.Ajax.request(
@@ -393,8 +396,8 @@
                             {
                               alert( 'Status', 'Error while retrieving data' );
                             } 
-                            });
-                        
+                        });
+*/                        
                     },
                     scope: this
                 }

=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js	2009-04-23 13:08:41 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js	2009-04-24 12:01:53 +0000
@@ -158,7 +158,6 @@
 
         gridView = new Ext.grid.GridView({ 
             forceFit: true,
-            draggable: true,
             sortClasses: ['sort-asc'],
             getRowClass: function (row, index){
                 var cls = ''; 
@@ -199,9 +198,9 @@
                             var mlp = Ext.getCmp('maps_cb').getValue();
                             this.newUrl = mlp;
                             
-                            gridStore.baseParams = { mapLayerPath: mlp, format: 'json' };
-                            gridStore.reload();
-                                
+                            Ext.getCmp('grid_gp').getStore().baseParams = { mapLayerPath: mlp, format: 'json' };
+                            Ext.getCmp('grid_gp').getStore().reload();
+                            
                             this.classify(false);
                         },
                         scope: this
@@ -215,8 +214,8 @@
                 handler: function()
                 {
                     var mlp = Ext.getCmp('maps_cb').getValue();
-                    gridStore.baseParams = { mapLayerPath: mlp, format: 'json' };
-                    gridStore.reload();
+                    Ext.getCmp('grid_gp').getStore().baseParams = { mapLayerPath: mlp, format: 'json' };
+                    Ext.getCmp('grid_gp').getStore().reload();
                     
                     this.classify(true);
                 },
@@ -232,8 +231,83 @@
                 columns: [ { header: 'Organisation units ', id: 'organisationUnitId', dataIndex: 'organisationUnit', sortable: true } ],
                 width: gridpanel_width,
                 height: gridpanel_height,
-                view: gridView
-            }
+                view: gridView,
+                style: 'left:0px',
+                bbar: new Ext.StatusBar({
+                    defaultText: '',
+                    id: 'basic-statusbar',
+                    items:
+                    [
+                        {
+                            xtype: 'button',
+                            id: 'removerelation_b0',
+                            text: 'Remove relation',
+                            isVisible: false,
+                            handler: function()
+                            {
+                                if (!Ext.getCmp('grid_gp').getSelectionModel().getSelected())
+                                {
+                                    alert('First, select an organisation unit from the list');
+                                    return;
+                                }
+                                    
+                                var selected = Ext.getCmp('grid_gp').getSelectionModel().getSelected();
+                                var oui = selected.data['organisationUnitId'];
+                                var mlp = Ext.getCmp('maps_cb').getValue();
+                                
+                                Ext.Ajax.request( 
+                                {
+                                    url: path + 'deleteMapOrganisationUnitRelation' + type,
+                                    method: 'GET',
+                                    params: { mapLayerPath: mlp, organisationUnitId: oui },
+
+                                    success: function( responseObject )
+                                    {
+                                        var mlp = Ext.getCmp('maps_cb').getValue();
+                                        Ext.getCmp('grid_gp').getStore().baseParams = { mapLayerPath: mlp, format: 'json' };
+                                        Ext.getCmp('grid_gp').getStore().reload();
+                                    },
+                                    failure: function()
+                                    {
+                                        alert('Error while deleting MapOrganisationUnitRelation');
+                                    } 
+                                });
+                            },
+                            scope: this
+                        },
+                        
+                        {
+                            xtype: 'button',
+                            id: 'removeallrelations_b',
+                            text: 'Remove all relations',
+                            isVisible: false,
+                            handler: function()
+                            {
+                                var mlp = Ext.getCmp('maps_cb').getValue();
+                                
+                                Ext.Ajax.request( 
+                                {
+                                    url: path + 'deleteMapOrganisationUnitRelationsByMap' + type,
+                                    method: 'GET',
+                                    params: { mapLayerPath: mlp },
+
+                                    success: function( responseObject )
+                                    {
+                                        var mlp = Ext.getCmp('maps_cb').getValue();
+                                        Ext.getCmp('grid_gp').getStore().baseParams = { mapLayerPath: mlp, format: 'json' };
+                                        Ext.getCmp('grid_gp').getStore().reload();
+                                    },
+                                    failure: function()
+                                    {
+                                        alert('Error while deleting MapOrganisationUnitRelation');
+                                    } 
+                                });
+                            },
+                            scope: this
+                        }
+                    ]
+                })
+             }
         ];
 
         mapfish.widgets.geostat.Choropleth.superclass.initComponent.apply(this);



--
Trunk
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.