← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 326: Now add several indicators when creating a new legend set.

 

------------------------------------------------------------
revno: 326
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Mon 2009-05-25 19:49:30 +0200
message:
  Now add several indicators when creating a new legend set.
modified:
  gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java
  gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml
  gis/dhis-web-mapping/src/main/resources/xwork.xml
  gis/dhis-web-mapping/src/main/webapp/mapping/geostat/config.js
  gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js
  gis/dhis-web-mapping/src/main/webapp/mapping/geostat/index.html

=== modified file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java'
--- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java	2009-05-22 17:15:35 +0000
+++ gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/AddMapLegendSetAction.java	2009-05-25 17:49:30 +0000
@@ -121,11 +121,14 @@
         legendSet.setClasses( classes );
         legendSet.setColorLow( colorLow );
         legendSet.setColorHigh( colorHigh );
-        legendSet.setIndicators( new HashSet<Indicator>() );        
+        legendSet.setIndicators( new HashSet<Indicator>() );
         
-        for ( String indicator : indicators )
+        if ( indicators != null )
         {
-            legendSet.getIndicators().add( indicatorService.getIndicator( Integer.valueOf( indicator ) ) );
+            for ( String indicator : indicators )
+            {
+                legendSet.getIndicators().add( indicatorService.getIndicator( Integer.valueOf( indicator ) ) );
+            }
         }
         
         mappingService.addMapLegendSet( legendSet );

=== modified file 'gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml'
--- gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml	2009-05-11 12:56:56 +0000
+++ gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml	2009-05-25 17:49:30 +0000
@@ -149,6 +149,13 @@
     <property name="indicatorService"
       ref="org.hisp.dhis.indicator.IndicatorService"/>
   </bean>
+	
+  <bean id="org.hisp.dhis.mapping.action.GetAllIndicatorsAction"
+    class="org.hisp.dhis.mapping.action.GetAllIndicatorsAction"
+    scope="prototype">
+    <property name="indicatorService"
+      ref="org.hisp.dhis.indicator.IndicatorService"/>
+  </bean>
   
   <!-- Period -->
   

=== modified file 'gis/dhis-web-mapping/src/main/resources/xwork.xml'
--- gis/dhis-web-mapping/src/main/resources/xwork.xml	2009-05-25 11:28:27 +0000
+++ gis/dhis-web-mapping/src/main/resources/xwork.xml	2009-05-25 17:49:30 +0000
@@ -94,6 +94,10 @@
     <action name="getIndicatorsByIndicatorGroup" class="org.hisp.dhis.mapping.action.GetIndicatorsByIndicatorGroupAction">
       <result name="success" type="velocity-json">/dhis-web-mapping/jsonminIndicators.vm</result>
     </action>
+	  
+	<action name="getAllIndicators" class="org.hisp.dhis.mapping.action.GetAllIndicatorsAction">
+      <result name="success" type="velocity-json">/dhis-web-mapping/jsonminIndicators.vm</result>
+    </action>  
     
     <!-- Period -->
     

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

=== modified file 'gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js'
--- gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js	2009-05-25 11:12:07 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js	2009-05-25 17:49:30 +0000
@@ -548,24 +548,15 @@
         minListWidth: combo_width + 26,
         store: existingMapsStore
     });
-    /*
-    var temptest = new Ext.ux.Multiselect(
-    {
-        store: existingMapsStore,
-        valueField: 'mapLayerPath',
-        displayField: 'name',
-        mode: 'remote',
-        id: 'testtemp'
-    });
-    */
+    
     var newMapPanel = new Ext.Panel(
     {   
         id: 'newmap_p',
         items:
         [   
             { html: '<p style="padding-bottom:4px">Map type:</p>' }, typeComboBox, { html: '<br>' },
-//            { html: '<p style="padding-bottom:4px">Organisation unit level:</p>' }, temptest, { html: '<br>' },
-//            { html: '<p style="padding-bottom:4px">Organisation unit:</p>' }, organisationUnitComboBox, { html: '<br>' },
+//            { html: '<p style="padding-bottom:4px">Organisation unit level:</p>' }, newMapComboBox, { html: '<br>' },
+//            { html: '<p style="padding-bottom:4px">Organisation unit:</p>' }, multi, { html: '<br>' },
             { html: '<p style="padding-bottom:4px">Organisation unit level:</p>' }, organisationUnitLevelComboBox, { html: '<br>' },
             { html: '<p style="padding-bottom:4px">Map name:</p>' }, newNameTextField, { html: '<br>' },
             { html: '<p style="padding-bottom:4px">Geoserver map layer path:</p>' }, mapLayerPathTextField, { html: '<br>' },
@@ -737,7 +728,7 @@
         minListWidth: combo_width + 26,
         value: "#FF0000"
     });
-    
+/*    
     var legendSetIndicatorGroupStore = new Ext.data.JsonStore({
         url: path + 'getAllIndicatorGroups' + type,
         baseParams: { format: 'json' },
@@ -754,7 +745,7 @@
         sortInfo: { field: 'name', direction: 'ASC' },
         autoLoad: false
     });
-    
+   
     var legendSetIndicatorGroupComboBox = new Ext.form.ComboBox({
         id: 'legendsetindicatorgroup_cb',
         typeAhead: true,
@@ -798,6 +789,32 @@
         minListWidth: combo_width + 26,
         store: legendSetIndicatorStore
     });
+*/
+/*
+    var legendSetIndicatorStore = new Ext.data.SimpleStore({
+        fields: ['id', 'name', 'title'],
+        data: [['AL', 'Alabama', 'The Heart of Dixie'], ['AK', 'Alaska', 'The Land of the Midnight Sun'], ['AZ', 'Arizona', 'The Grand Canyon State'],
+               ['WD', 'Sfdfs', 'The Heart of Dixie'], ['ED', 'BGgsdf', 'The Heart of Dixie'], ['DS', 'Fdwwd', 'The Heart of Dixie'],
+               ['FF', 'Ewwes', 'The Heart of Dixie']]
+    });
+*/    
+    var legendSetIndicatorStore = new Ext.data.JsonStore({
+        url: path + 'getAllIndicators' + type,
+        root: 'indicators',
+        fields: ['id', 'name'],
+        sortInfo: { field: 'name', direction: 'ASC' },
+        autoLoad: true
+    });
+    
+    var legendSetIndicatorMultiSelect = new Ext.ux.Multiselect({
+        id: 'legendsetindicator_ms',
+        dataFields: ['id', 'name'], 
+        valueField: 'id',
+        displayField: 'name',
+        width: gridpanel_width - 25,
+        height: multiselect_height,
+        store: legendSetIndicatorStore
+    });
     
     var legendSetStore = new Ext.data.JsonStore({
         url: path + 'getAllMapLegendSets' + type,
@@ -833,19 +850,35 @@
             var lc = Ext.getCmp('legendsetclasses_cb').getValue();            
             var llc = Ext.getCmp('legendsetlowcolor_cp').getValue();
             var lhc = Ext.getCmp('legendsethighcolor_cp').getValue();
-            var li = Ext.getCmp('legendsetindicator_cb').getValue();
+//            var li = Ext.getCmp('legendsetindicator_cb').getValue();
+            var lims = Ext.getCmp('legendsetindicator_ms').getValue();
             
-            if (!lc || !ln || !li)
+            if (!lc || !ln || !lims)
             {
                 Ext.MessageBox.alert('Error', 'Form is not complete');
                 return;
             }
             
+//            var params = '?name=' + ln + '&method=2&classes=' + lc + '&colorLow=' + llc + '&colorHigh=' + lhc;
+            var params;
+            var array = new Array();
+            array = lims.split(',');
+            
+            params = '?indicators=' + array[0];
+            
+            for (var i = 1; i < array.length; i++)
+            {
+                array[i] = '&indicators=' + array[i];
+                params += array[i];
+            }
+            
+            alert(params);
+            
             Ext.Ajax.request(
             {
-                url: path + 'addMapLegendSet' + type,
-                method: 'GET',
-                params: { name: ln, method: 2, classes: lc, colorLow: llc, colorHigh: lhc, indicators: li },
+                url: path + 'addMapLegendSet.action' + params,
+                method: 'POST',
+                params: { name: ln, method: 2, classes: lc, colorLow: llc, colorHigh: lhc },
 
                 success: function( responseObject )
                 {
@@ -919,8 +952,9 @@
             { html: '<p style="padding-bottom:4px">Classes:</p>' }, legendSetClassesComboBox, { html: '<br>' },
             { html: '<p style="padding-bottom:4px">Lowest value color:</p>' }, legendSetLowColorColorPalette, { html: '<br>' },
             { html: '<p style="padding-bottom:4px">Highest value color:</p>' }, legendSetHighColorColorPalette, { html: '<br>' },
-            { html: '<p style="padding-bottom:4px">Indicator group:</p>' }, legendSetIndicatorGroupComboBox, { html: '<br>' },
-            { html: '<p style="padding-bottom:4px">Indicator:</p>' }, legendSetIndicatorComboBox
+//            { html: '<p style="padding-bottom:4px">Indicator group:</p>' }, legendSetIndicatorGroupComboBox, { html: '<br>' },
+//            { html: '<p style="padding-bottom:4px">Indicator:</p>' }, legendSetIndicatorComboBox
+            { html: '<p style="padding-bottom:4px">Indicators:</p>' }, legendSetIndicatorMultiSelect
         ]
     });
     
@@ -1657,7 +1691,7 @@
     }
     
     var south_panel = Ext.getCmp('south-panel');
-    south_panel.body.dom.innerHTML = count_match + '<font color="#444444"> organisation units assigned (</font>' + count_orgunits/count_features + '<font color="#444444"> in database, </font>' + count_features + '<font color="#444444"> in shapefile).</font>';
+    south_panel.body.dom.innerHTML = count_match + '<font color="#444444"> organisation units assigned (database: </font>' + count_orgunits/count_features + '<font color="#444444">, shapefile: </font>' + count_features + '<font color="#444444">)</font>';
     
     Ext.getCmp('grid_gp').getStore().reload();
     loadMapData('assignment');

=== modified file 'gis/dhis-web-mapping/src/main/webapp/mapping/geostat/index.html'
--- gis/dhis-web-mapping/src/main/webapp/mapping/geostat/index.html	2009-05-22 17:15:35 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mapping/geostat/index.html	2009-05-25 17:49:30 +0000
@@ -10,24 +10,25 @@
 
     <!-- EXT colorField Extent -->
     <link rel="stylesheet" type="text/css" href="../../mfbase/ext-community-extensions/color-field.css" />
+    <link rel="stylesheet" type="text/css" href="../../mfbase/ext-community-extensions/multiselect.css" />
 
     <script type="text/javascript" src="../../mfbase/ext/adapter/ext/ext-base.js"></script>
     <script type="text/javascript" src="../../mfbase/ext/ext-all.js"></script>
 
     <!-- debug mode -->
     <script type="text/javascript" src="../../mfbase/openlayers/lib/OpenLayers.js"></script>
-    <script type="text/javascript" src="../../mfbase/openlayers/lib/OpenLayers/Control/newSelectFeature.js"></script>
     <script type="text/javascript" src="../../mfbase/mapfish/MapFish.js"></script>
 
     <!-- production mode -->
     <!--  <script type="text/javascript" src="../../mfbase/release/mapfish/MapFish.js"></script>  -->
     
-    <!-- EXT colorField Extent -->
+    <!-- EXT user extensions -->
+    <script type="text/javascript" src="../../mfbase/openlayers/lib/OpenLayers/Control/newSelectFeature.js"></script>
     <script type="text/javascript" src="../../mfbase/ext-community-extensions/color-field.js"></script>
-    <!--
-    <script type="text/javascript" src="../../mfbase/ext-community-extensions/Multiselect.js"></script>
     <script type="text/javascript" src="../../mfbase/ext-community-extensions/DDView.js"></script>
-    -->
+    <script type="text/javascript" src="../../mfbase/ext-community-extensions/MultiSelect.js"></script>
+    <script type="text/javascript" src="../../mfbase/ext-community-extensions/ItemSelector.js"></script>
+    
     <!-- Div script -->
     
     <script type="text/javascript" src="config.js"></script>



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