← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 471: GIS updates:

 

------------------------------------------------------------
revno: 471
committer: Jan Henrik Overland janhenrik.overland@xxxxxxxxx
branch nick: trunk
timestamp: Sat 2009-08-08 23:17:08 +0700
message:
  GIS updates:
  - show admin panels checkbox now disabled when map source type is not set to 'shapefile'
  - loading mask added to mapping layer and static layer to improve user interaction
modified:
  gis/dhis-web-mapping/src/main/webapp/mapping/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
  gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Static.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 'gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js'
--- gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js	2009-08-04 07:36:02 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mapping/geostat/geostat.js	2009-08-08 16:17:08 +0000
@@ -6,7 +6,7 @@
     Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
     
     Ext.override(Ext.layout.FormLayout, {
-    renderItem : function(c, position, target){
+    renderItem : function(c, position, target) {
         if(c && !c.rendered && c.isFormField && c.inputType != 'hidden'){
             var args = [
                    c.id, c.fieldLabel,
@@ -41,102 +41,103 @@
     });
     
     Ext.override(Ext.form.Checkbox, {
-	onRender: function(ct, position){
-		Ext.form.Checkbox.superclass.onRender.call(this, ct, position);
-		if(this.inputValue !== undefined){
-			this.el.dom.value = this.inputValue;
-		}
-		//this.el.addClass('x-hidden');
-		this.innerWrap = this.el.wrap({
-			//tabIndex: this.tabIndex,
-			cls: this.baseCls+'-wrap-inner'
-		});
-		this.wrap = this.innerWrap.wrap({cls: this.baseCls+'-wrap'});
-		this.imageEl = this.innerWrap.createChild({
-			tag: 'img',
-			src: Ext.BLANK_IMAGE_URL,
-			cls: this.baseCls
-		});
-		if(this.boxLabel){
-			this.labelEl = this.innerWrap.createChild({
-				tag: 'label',
-				htmlFor: this.el.id,
-				cls: 'x-form-cb-label',
-				html: this.boxLabel
-			});
-		}
-		//this.imageEl = this.innerWrap.createChild({
-			//tag: 'img',
-			//src: Ext.BLANK_IMAGE_URL,
-			//cls: this.baseCls
-		//}, this.el);
-		if(this.checked){
-			this.setValue(true);
-		}else{
-			this.checked = this.el.dom.checked;
-		}
-		this.originalValue = this.checked;
-	},
-	afterRender: function(){
-		Ext.form.Checkbox.superclass.afterRender.call(this);
-		//this.wrap[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
-		this.imageEl[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
-	},
-	initCheckEvents: function(){
-		//this.innerWrap.removeAllListeners();
-		this.innerWrap.addClassOnOver(this.overCls);
-		this.innerWrap.addClassOnClick(this.mouseDownCls);
-		this.innerWrap.on('click', this.onClick, this);
-		//this.innerWrap.on('keyup', this.onKeyUp, this);
-	},
-	onFocus: function(e) {
-		Ext.form.Checkbox.superclass.onFocus.call(this, e);
-		//this.el.addClass(this.focusCls);
-		this.innerWrap.addClass(this.focusCls);
-	},
-	onBlur: function(e) {
-		Ext.form.Checkbox.superclass.onBlur.call(this, e);
-		//this.el.removeClass(this.focusCls);
-		this.innerWrap.removeClass(this.focusCls);
-	},
-	onClick: function(e){
-		if (e.getTarget().htmlFor != this.el.dom.id) {
-			if (e.getTarget() !== this.el.dom) {
-				this.el.focus();
-			}
-			if (!this.disabled && !this.readOnly) {
-				this.toggleValue();
-			}
-		}
-		//e.stopEvent();
-	},
-	onEnable: Ext.form.Checkbox.superclass.onEnable,
-	onDisable: Ext.form.Checkbox.superclass.onDisable,
-	onKeyUp: undefined,
-	setValue: function(v) {
-		var checked = this.checked;
-		this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
-		if(this.rendered){
-			this.el.dom.checked = this.checked;
-			this.el.dom.defaultChecked = this.checked;
-			//this.wrap[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
-			this.imageEl[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
-		}
-		if(checked != this.checked){
-			this.fireEvent("check", this, this.checked);
-			if(this.handler){
-				this.handler.call(this.scope || this, this, this.checked);
-			}
-		}
-	},
-	getResizeEl: function() {
-		//if(!this.resizeEl){
-			//this.resizeEl = Ext.isSafari ? this.wrap : (this.wrap.up('.x-form-element', 5) || this.wrap);
-		//}
-		//return this.resizeEl;
-		return this.wrap;
-	}
+        onRender: function(ct, position) {
+            Ext.form.Checkbox.superclass.onRender.call(this, ct, position);
+            if(this.inputValue !== undefined) {
+                this.el.dom.value = this.inputValue;
+            }
+            //this.el.addClass('x-hidden');
+            this.innerWrap = this.el.wrap({
+                //tabIndex: this.tabIndex,
+                cls: this.baseCls+'-wrap-inner'
+            });
+            this.wrap = this.innerWrap.wrap({cls: this.baseCls+'-wrap'});
+            this.imageEl = this.innerWrap.createChild({
+                tag: 'img',
+                src: Ext.BLANK_IMAGE_URL,
+                cls: this.baseCls
+            });
+            if(this.boxLabel){
+                this.labelEl = this.innerWrap.createChild({
+                    tag: 'label',
+                    htmlFor: this.el.id,
+                    cls: 'x-form-cb-label',
+                    html: this.boxLabel
+                });
+            }
+            //this.imageEl = this.innerWrap.createChild({
+                //tag: 'img',
+                //src: Ext.BLANK_IMAGE_URL,
+                //cls: this.baseCls
+            //}, this.el);
+            if(this.checked){
+                this.setValue(true);
+            }else{
+                this.checked = this.el.dom.checked;
+            }
+            this.originalValue = this.checked;
+        },
+        afterRender: function() {
+            Ext.form.Checkbox.superclass.afterRender.call(this);
+            //this.wrap[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
+            this.imageEl[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
+        },
+        initCheckEvents: function() {
+            //this.innerWrap.removeAllListeners();
+            this.innerWrap.addClassOnOver(this.overCls);
+            this.innerWrap.addClassOnClick(this.mouseDownCls);
+            this.innerWrap.on('click', this.onClick, this);
+            //this.innerWrap.on('keyup', this.onKeyUp, this);
+        },
+        onFocus: function(e) {
+            Ext.form.Checkbox.superclass.onFocus.call(this, e);
+            //this.el.addClass(this.focusCls);
+            this.innerWrap.addClass(this.focusCls);
+        },
+        onBlur: function(e) {
+            Ext.form.Checkbox.superclass.onBlur.call(this, e);
+            //this.el.removeClass(this.focusCls);
+            this.innerWrap.removeClass(this.focusCls);
+        },
+        onClick: function(e) {
+            if (e.getTarget().htmlFor != this.el.dom.id) {
+                if (e.getTarget() !== this.el.dom) {
+                    this.el.focus();
+                }
+                if (!this.disabled && !this.readOnly) {
+                    this.toggleValue();
+                }
+            }
+            //e.stopEvent();
+        },
+        onEnable: Ext.form.Checkbox.superclass.onEnable,
+        onDisable: Ext.form.Checkbox.superclass.onDisable,
+        onKeyUp: undefined,
+        setValue: function(v) {
+            var checked = this.checked;
+            this.checked = (v === true || v === 'true' || v == '1' || String(v).toLowerCase() == 'on');
+            if(this.rendered){
+                this.el.dom.checked = this.checked;
+                this.el.dom.defaultChecked = this.checked;
+                //this.wrap[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
+                this.imageEl[this.checked ? 'addClass' : 'removeClass'](this.checkedCls);
+            }
+            if(checked != this.checked) {
+                this.fireEvent("check", this, this.checked);
+                if(this.handler){
+                    this.handler.call(this.scope || this, this, this.checked);
+                }
+            }
+        },
+        getResizeEl: function() {
+            //if(!this.resizeEl){
+                //this.resizeEl = Ext.isSafari ? this.wrap : (this.wrap.up('.x-form-element', 5) || this.wrap);
+            //}
+            //return this.resizeEl;
+            return this.wrap;
+        }
     });
+    
     Ext.override(Ext.form.Radio, {
         checkedCls: 'x-form-radio-checked'
     });
@@ -145,11 +146,18 @@
     map = new OpenLayers.Map($('olmap'));
     this.myMap = map;
 
-    features = null;
-    features_choropleth = null;
-    features_mapping = null;
-    
-    mask = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
+//    features = null;
+    FEATURES_CHOROPLETH = null;
+    FEATURES_MAPPING = null;
+    
+    MASK = new Ext.LoadMask(Ext.getBody(), {msg:"Please wait..."});
+    
+    printConfigUrl = '../../pdf/info.json';
+    
+    layerOverrides = {
+        "OpenLayers WMS": {overview: true},
+        Countries: { format: 'image/svg+xml' }
+    };
     
     MAPDATA = null;
     URL = null;
@@ -215,15 +223,19 @@
     {
         var h = screen.height;
         
-        if (h <= 800) { return 120; }
-        else if (h <= 1050) { return 310; }
-        else if  (h <= 1200) { return 530; }
-        else { return 900; }
+        if (h <= 800) {
+            return 120;
+        }
+        else if (h <= 1050) {
+            return 310;
+        }
+        else if (h <= 1200) {
+            return 530;
+        }
+        else {
+            return 900;
+        }
     }
-    
-/*    var jpl_wms = new OpenLayers.Layer.WMS("Satellite",
-                                           "http://labs.metacarta.com/wms-c/Basic.py?";, 
-                                           {layers: 'satellite', format: 'image/png'});*/
 
     var vmap0 = new OpenLayers.Layer.WMS("OpenLayers WMS",
                                            "http://labs.metacarta.com/wms/vmap0";, 
@@ -232,6 +244,10 @@
     var local_wfs = new OpenLayers.Layer.WMS("Africa",
                                              "../../../geoserver/wfs?", 
                                              {layers: 'world:africa'});
+                                                 
+/*    var jpl_wms = new OpenLayers.Layer.WMS("Satellite",
+                                           "http://labs.metacarta.com/wms-c/Basic.py?";, 
+                                           {layers: 'satellite', format: 'image/png'});*/
                                    
     var choroplethLayer = new OpenLayers.Layer.Vector(CHOROPLETH_LAYERNAME, {
         'visibility': true,
@@ -1428,8 +1444,6 @@
                                 mapping.show();
                                 shapefilePanel.show();
                                 Ext.getCmp('west').doLayout();
-                                
-                                
                             }
                             else
                             {
@@ -1497,6 +1511,13 @@
 
                                                 Ext.getCmp('map_cb').reset();
                                                 Ext.getCmp('mapview_cb').reset();
+                                                
+                                                if (MAPSOURCE == 'shapefile') {
+                                                    Ext.getCmp('register_chb').enable();
+                                                }
+                                                else if (MAPSOURCE == 'database') {
+                                                    Ext.getCmp('register_chb').disable();
+                                                }
                                             },
                                             failure: function()
                                             {
@@ -1522,11 +1543,18 @@
                 fn: function()
                 {
                     Ext.getCmp('mapsource_cb').setValue(MAPSOURCE);
+                    
+                    if (MAPSOURCE == 'shapefile') {
+                        Ext.getCmp('register_chb').enable();
+                    }
+                    else if (MAPSOURCE == 'database') {
+                        Ext.getCmp('register_chb').disable();
+                    }
                 }
             }
-        }        
+        }
     });
-       
+    
     // WIDGETS
     
     choropleth = new mapfish.widgets.geostat.Choropleth({
@@ -1701,7 +1729,7 @@
                     shapefilePanel,
                     mapping,
                     adminPanel,
-                    static1                    
+                    static1
                 ]
             },
             
@@ -1730,12 +1758,9 @@
     
     map.addControl(new OpenLayers.Control.ZoomBox());
     
-    map.events.on(
-    {
-        changelayer: function(e)
-        {
-            if (e.property == 'visibility' && e.layer == static1Layer)
-            {
+    map.events.on({
+        changelayer: function(e) {
+            if (e.property == 'visibility' && e.layer == static1Layer) {
                 if (static1Layer.visibility) {
                     selectFeatureChoropleth.deactivate();
                     
@@ -1949,7 +1974,7 @@
             }
         }
         
-        features_choropleth = features;
+        FEATURES_CHOROPLETH = features;
             
         var options = {};
         
@@ -1966,7 +1991,7 @@
         choropleth.coreComp.applyClassification();
         choropleth.classificationApplied = true;
         
-        mask.hide();
+        MASK.hide();
     }
     else
     {
@@ -2006,7 +2031,7 @@
                     }
                 }
                 
-                features_choropleth = features;
+                FEATURES_CHOROPLETH = features;
                 
                 var options = {};
                 
@@ -2023,7 +2048,7 @@
                 choropleth.coreComp.applyClassification();
                 choropleth.classificationApplied = true;
                 
-                mask.hide();
+                MASK.hide();
             },
             failure: function()
             {
@@ -2165,7 +2190,7 @@
         }
     }
     
-    features_mapping = features;
+    FEATURES_MAPPING = features;
     
     var options = {};
         
@@ -2186,6 +2211,8 @@
     mapping.coreComp.updateOptions(options);
     mapping.coreComp.applyClassification();
     mapping.classificationApplied = true;
+    
+    MASK.hide();
 }
 
 // AUTO MAPPING

=== 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-08-04 07:36:02 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Choropleth.js	2009-08-08 16:17:08 +0000
@@ -810,7 +810,7 @@
                 return;
         }
 
-        mask.show();
+        MASK.show();
 
         loadMapData('choropleth');
     },

=== 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-07-13 11:45:16 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Mapping.js	2009-08-08 16:17:08 +0000
@@ -411,6 +411,8 @@
                 return;
         }
         
+        MASK.show();
+        
         loadMapData('assignment');
     },
 

=== modified file 'gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Static.js'
--- gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Static.js	2009-06-19 18:32:35 +0000
+++ gis/dhis-web-mapping/src/main/webapp/mfbase/mapfish/widgets/geostat/Static.js	2009-08-08 16:17:08 +0000
@@ -142,15 +142,13 @@
     
     initComponent : function() {
     
-        this.items = [
-
-        ];
+        this.items = [];
 
         mapfish.widgets.geostat.Choropleth.superclass.initComponent.apply(this);
     },
     
     setUrl: function(url) {
-    
+        MASK.show();
         this.url = url;
         this.coreComp.setUrl(this.url);
     },
@@ -161,6 +159,7 @@
      *      Called on Ajax request success.
      */
     requestSuccess: function(request) {
+        MASK.hide();    
         this.ready = true;
         this.classify(false);
 
@@ -202,10 +201,7 @@
      *      the widget isn't ready, or no indicator is specified, or no
      *      method is specified.
      */
-     classify: function(exception)
-    {
-
-    },
+    classify: function(exception) {},
 
     /**
      * Method: onRender