← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 15959: GIS labels included in favorite + layer window gui optimized for small screens.

 

Merge authors:
  Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 15959 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-07-03 14:56:48 +0200
message:
  GIS labels included in favorite + layer window gui optimized for small screens.
added:
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/arrowupdouble.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/spinner_24.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_bold.png
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_italic.png
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java
  dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js
  dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css


--
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-api/src/main/java/org/hisp/dhis/mapping/MapView.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2014-04-15 13:22:03 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MapView.java	2014-07-02 14:26:19 +0000
@@ -102,6 +102,16 @@
     private Integer areaRadius;
     
     private Boolean hidden;
+    
+    private Boolean labels;
+    
+    private String labelFontSize;
+    
+    private String labelFontWeight;
+    
+    private String labelFontStyle;
+    
+    private String labelFontColor;
 
     // -------------------------------------------------------------------------
     // Transient properties
@@ -352,12 +362,77 @@
         return hidden;
     }
 
+    public void setLabels( Boolean labels )
+    {
+        this.labels = labels;
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public Boolean getLabels()
+    {
+        return labels;
+    }
+
     public void setHidden( Boolean hidden )
     {
         this.hidden = hidden;
     }
 
     @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public String getLabelFontSize()
+    {
+        return labelFontSize;
+    }
+
+    public void setLabelFontSize( String labelFontSize )
+    {
+        this.labelFontSize = labelFontSize;
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public String getLabelFontWeight()
+    {
+        return labelFontWeight;
+    }
+
+    public void setLabelFontWeight( String labelFontWeight )
+    {
+        this.labelFontWeight = labelFontWeight;
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public String getLabelFontStyle()
+    {
+        return labelFontStyle;
+    }
+
+    public void setLabelFontStyle( String labelFontStyle )
+    {
+        this.labelFontStyle = labelFontStyle;
+    }
+
+    @JsonProperty
+    @JsonView( { DetailedView.class, ExportView.class, DimensionalView.class } )
+    @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
+    public String getLabelFontColor()
+    {
+        return labelFontColor;
+    }
+
+    public void setLabelFontColor( String labelFontColor )
+    {
+        this.labelFontColor = labelFontColor;
+    }
+
+    @JsonProperty
     @JsonView( { DetailedView.class, ExportView.class } )
     @JacksonXmlProperty( namespace = DxfNamespaces.DXF_2_0)
     public String getParentGraph()
@@ -404,6 +479,11 @@
             organisationUnitGroupSet = mapView.getOrganisationUnitGroupSet();
             areaRadius = mapView.getAreaRadius();
             hidden = mapView.getHidden();
+            labels = mapView.getLabels();
+            labelFontSize = mapView.getLabelFontSize();
+            labelFontWeight = mapView.getLabelFontWeight();
+            labelFontStyle = mapView.getLabelFontStyle();
+            labelFontColor = mapView.getLabelFontColor();
         }
     }
 }

=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2014-03-14 13:27:22 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/mapping/hibernate/MapView.hbm.xml	2014-07-02 14:26:19 +0000
@@ -115,6 +115,16 @@
     <property name="areaRadius" />
 	  
 	<property name="hidden" />
+	  
+	<property name="labels" />
+	  
+	<property name="labelFontSize" />
+	  
+	<property name="labelFontWeight" />
+	  
+	<property name="labelFontStyle" />
+	  
+	<property name="labelFontColor" />
 
   </class>
 </hibernate-mapping>

=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/arrowupdouble.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/arrowupdouble.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/arrowupdouble.png	2014-07-02 16:26:00 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/spinner_24.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/spinner_24.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/spinner_24.png	2014-07-02 10:28:28 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_bold.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_bold.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_bold.png	2014-07-02 10:28:28 +0000 differ
=== added file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_italic.png'
Binary files dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_italic.png	1970-01-01 00:00:00 +0000 and dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/images/text_italic.png	2014-07-02 10:28:28 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-06-26 14:37:15 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/app.js	2014-07-03 12:55:11 +0000
@@ -273,6 +273,10 @@
 					}
 				}
 
+                if (!layers.length) {
+					return false;
+				}
+
 				for (var i = 0; i < layers.length; i++) {
 					var layer = layers[i],
 						id = layer.id,
@@ -782,7 +786,6 @@
 				});
 
 				this.numberField = Ext.create('Ext.form.field.Number', {
-					cls: 'gis-numberfield',
 					width: 47,
 					height: 18,
 					minValue: 0,
@@ -831,14 +834,16 @@
 			extend: 'Ext.panel.Panel',
 			alias: 'widget.checktextnumber',
 			layout: 'column',
+            bodyStyle: 'border: 0 none',
 			layer: null,
 			checkbox: null,
-			text: null,
+			checkboxBoxLabel: null,
 			numberField: null,
-			width: 184,
-			height: 22,
-			value: false,
+            numberFieldWidth: 70,
+			height: 24,
 			number: 5000,
+			value: false,
+            components: [],
 			getValue: function() {
 				return this.checkbox.getValue();
 			},
@@ -854,61 +859,227 @@
 				}
 			},
 			enable: function() {
-				this.numberField.enable();
+				for (var i = 0; i < this.components.length; i++) {
+                    this.components[i].enable();
+                }
 			},
 			disable: function() {
-				this.numberField.disable();
+				for (var i = 0; i < this.components.length; i++) {
+                    this.components[i].disable();
+                }
 			},
 			reset: function() {
-				this.checkbox.setValue(false);
 				this.numberField.setValue(this.number);
-				this.numberField.disable();
-			},
-			initComponent: function() {
-				var that = this,
-					padding = 6;
-
-				this.numberField = Ext.create('Ext.form.field.Number', {
-					cls: 'gis-numberfield',
-					fieldStyle: 'border-top-left-radius: 1px; border-bottom-left-radius: 1px',
-					style: 'padding-bottom: 3px',
-					width: 70,
-					height: 21,
-					minValue: 0,
-					maxValue: 9999999,
-					value: this.number,
-					allowBlank: false,
-					disabled: true
-				});
-
-				this.checkbox = Ext.create('Ext.form.field.Checkbox', {
-					width: this.width - this.numberField.width - padding,
-					boxLabel: this.text,
-					checked: this.value,
-					disabled: this.disabled,
-					boxLabelCls: 'x-form-cb-label-alt1',
-					listeners: {
-						change: function(chb, value) {
-							if (value) {
-								that.enable();
-							}
-							else {
-								that.disable();
-							}
-						}
-					}
-				});
-
-				this.items = [
-					{
-						width: this.checkbox.width + padding,
-						items: this.checkbox
-					},
-					{
-						width: this.numberField.width,
-						items: this.numberField
-					}
-				];
+
+				this.checkbox.setValue(false);
+                this.disable();
+			},
+			initComponent: function() {
+				var ct = this,
+                    padding = 2,
+                    onAdded = function(cmp) {
+                        ct.components.push(cmp);
+                    };
+
+                ct.items = [];
+
+				ct.numberField = Ext.create('Ext.form.field.Number', {
+                    cls: 'gis-numberfield',
+					width: ct.numberFieldWidth,
+					height: 21,
+					minValue: 0,
+					maxValue: 9999999,
+					allowBlank: false,
+					disabled: true,
+					value: ct.number,
+                    listeners: {
+                        added: onAdded
+                    }
+				});
+
+				ct.checkbox = Ext.create('Ext.form.field.Checkbox', {
+                    cls: 'gis-checkbox',
+					width: ct.width - ct.numberField.width,
+					boxLabel: ct.checkboxBoxLabel,
+					boxLabelCls: 'x-form-cb-label-alt1',
+					checked: ct.value,
+					disabled: ct.disabled,
+                    style: 'padding-left: 3px',
+					listeners: {
+						change: function(chb, value) {
+							if (value) {
+								ct.enable();
+							}
+							else {
+								ct.disable();
+							}
+						}
+					}
+				});
+
+                ct.items.push(ct.checkbox);
+                ct.items.push(ct.numberField);
+
+				this.callParent();
+			}
+		});
+
+		Ext.define('Ext.ux.panel.LabelPanel', {
+			extend: 'Ext.panel.Panel',
+			alias: 'widget.labelpanel',
+			layout: 'column',
+            bodyStyle: 'border: 0 none',
+            skipBoldButton: false,
+            skipColorButton: false,
+            checkboxWidth: 100,
+			chechboxBoxLabel: 'Show labels',
+            numberFieldValue: 11,
+            numberFieldWidth: 50,
+            colorButtonWidth: 87,
+            colorButtonColor: '000000',
+			width: 290,
+			height: 24,
+            value: false,
+            components: [],
+			getConfig: function() {
+                var config = {
+                    labels: this.checkbox.getValue(),
+                    labelFontSize: this.numberField.getValue() + 'px',
+                    labelFontStyle: this.italicButton.pressed ? 'italic' : 'normal'
+                };
+
+                if (!this.skipBoldButton) {
+                    config.labelFontWeight = this.boldButton.pressed ? 'bold' : 'normal';
+                }
+
+                if (!this.skipColorButton) {
+                    config.labelFontColor = '#' + this.colorButton.getValue();
+                }
+
+                return config;
+			},
+			setConfig: function(config) {
+                this.numberField.setValue(parseInt(config.labelFontSize));
+                this.italicButton.toggle(Ext.Array.contains(['italic', 'oblique'], config.labelFontStyle));
+
+                if (!this.skipBoldButton) {
+                    this.boldButton.toggle(Ext.Array.contains(['bold', 'bolder'], config.labelFontWeight) || (Ext.isNumber(parseInt(config.labelFontWeight)) && parseInt(config.labelFontWeight) >= 700));
+                }
+
+                if (!this.skipColorButton) {
+                    this.colorButton.setValue(config.labelFontColor);
+                }
+
+                this.checkbox.setValue(config.labels);
+			},
+			enable: function() {
+				for (var i = 0; i < this.components.length; i++) {
+                    this.components[i].enable();
+                }
+			},
+			disable: function() {
+				for (var i = 0; i < this.components.length; i++) {
+                    this.components[i].disable();
+                }
+			},
+			reset: function() {
+                this.numberField.setValue(this.numberFieldValue);
+                this.boldButton.toggle(false);
+                this.italicButton.toggle(false);
+                this.colorButton.setValue(this.colorButtonColor);
+
+                this.checkbox.setValue(false);
+                this.disable();
+			},
+			initComponent: function() {
+				var ct = this,
+                    onAdded = function(cmp) {
+                        ct.components.push(cmp);
+                    };
+
+                ct.items = [];
+
+				ct.checkbox = Ext.create('Ext.form.field.Checkbox', {
+                    cls: 'gis-checkbox',
+					width: ct.checkboxWidth,
+					boxLabel: ct.chechboxBoxLabel,
+					checked: ct.value,
+					disabled: ct.disabled,
+					boxLabelCls: 'x-form-cb-label-alt1',
+                    style: 'padding-left: 3px',
+					listeners: {
+						change: function(chb, value) {
+							if (value) {
+								ct.enable();
+							}
+							else {
+								ct.disable();
+							}
+						}
+					}
+				});
+
+                ct.items.push(ct.checkbox);
+
+				ct.numberField = Ext.create('Ext.form.field.Number', {
+                    cls: 'gis-numberfield',
+					width: ct.numberFieldWidth,
+					height: 21,
+					minValue: 0,
+					maxValue: 9999999,
+					allowBlank: false,
+					disabled: true,
+					value: ct.numberFieldValue,
+                    listeners: {
+                        added: onAdded
+                    }
+				});
+
+                ct.items.push(ct.numberField);
+
+                if (!ct.skipBoldButton) {
+                    ct.boldButton = Ext.create('Ext.button.Button', {
+                        width: 24,
+                        height: 24,
+                        icon: 'images/text_bold.png',
+                        style: 'margin-left: 1px',
+                        disabled: true,
+                        enableToggle: true,
+                        listeners: {
+                            added: onAdded
+                        }
+                    });
+
+                    ct.items.push(ct.boldButton);
+                }
+
+                ct.italicButton = Ext.create('Ext.button.Button', {
+                    width: 24,
+                    height: 24,
+                    icon: 'images/text_italic.png',
+                    style: 'margin-left: 1px',
+					disabled: true,
+                    enableToggle: true,
+                    listeners: {
+                        added: onAdded
+                    }
+                });
+
+                ct.items.push(ct.italicButton);
+
+                if (!ct.skipColorButton) {
+                    ct.colorButton = Ext.create('Ext.ux.button.ColorButton', {
+                        width: ct.colorButtonWidth,
+                        height: 24,
+                        style: 'margin-left: 1px',
+                        value: ct.colorButtonColor,
+                        listeners: {
+                            added: onAdded
+                        }
+                    });
+
+                    ct.items.push(ct.colorButton);
+                }
 
 				this.callParent();
 			}
@@ -1518,22 +1689,6 @@
 			alwaysEnabled: true
 		});
 
-		item = {
-			text: GIS.i18n.labels,
-			iconCls: 'gis-menu-item-icon-labels',
-			handler: function() {
-                var window = layer.labelWindow || (layer.labelWidow = GIS.app.LabelWindow(layer));
-
-                if (layer.id === 'boundary') {
-                    window.updateLabels();
-                }
-                else {
-                    window.show();
-                }
-			}
-		};
-		items.push(item);
-
 		if (!(layer.id === gis.layer.boundary.id || layer.id === gis.layer.facility.id || layer.id === gis.layer.event.id)) {
 			item = {
 				text: GIS.i18n.filter + '..',
@@ -1674,7 +1829,7 @@
 
 	GIS.app.WidgetWindow = function(layer, width, padding) {
 		width = width || gis.conf.layout.widget.window_width;
-		padding = padding || 5;
+		padding = padding || 0;
 
 		return Ext.create('Ext.window.Window', {
 			//autoShow: true,
@@ -1739,105 +1894,101 @@
 
 		button = Ext.create('Ext.ux.button.ColorButton', {
 			width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width,
+            height: 24,
 			value: '0000ff'
 		});
 
 		window = Ext.create('Ext.window.Window', {
 			title: GIS.i18n.organisationunit_search,
-			layout: 'fit',
 			iconCls: 'gis-window-title-icon-search',
-			cls: 'gis-container-default',
-			width: gis.conf.layout.tool.window_width,
+            bodyStyle: 'background-color: #fff; padding: 1px',
 			resizable: false,
-			height: 400,
+			height: 380,
 			items: [
-				{
-					cls: 'gis-container-inner',
-					items: [
-						{
-							layout: 'column',
-							cls: 'gis-container-inner',
-							items: [
-								{
-									cls: 'gis-panel-html-label',
-									html: GIS.i18n.highlight_color + ':',
-									width: gis.conf.layout.tool.itemlabel_width
-								},
-								button
-							]
-						},
-						{
-							cls: 'gis-panel-html-separator'
-						},
-						{
-							layout: 'column',
-							cls: 'gis-container-inner',
-							items: [
-								{
-									cls: 'gis-panel-html-label',
-									html: GIS.i18n.text_filter + ':',
-									width: gis.conf.layout.tool.itemlabel_width
-								},
-								{
-									xtype: 'textfield',
-									cls: 'gis-textfield',
-									width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width,
-									enableKeyEvents: true,
-									listeners: {
-										keyup: function() {
-											store.clearFilter();
-											if (this.getValue()) {
-												store.filter('name', this.getValue());
-											}
-											store.sortStore();
-										}
-									}
-								}
-							]
-						},
-						{
-							xtype: 'grid',
-							cls: 'gis-grid',
-							height: 290,
-							width: gis.conf.layout.tool.item_width,
-							scroll: 'vertical',
-							hideHeaders: true,
-							columns: [{
-								id: 'name',
-								text: 'Organisation units',
-								dataIndex: 'name',
-								sortable: false,
-								width: gis.conf.layout.tool.item_width
-							}],
-							store: layer.core.featureStore,
-							listeners: {
-								select: function(grid, record) {
-									var feature = layer.getFeaturesByAttribute('id', record.data.id)[0],
-										color = button.getValue(),
-										symbolizer;
-
-									layer.redraw();
-
-									if (feature.geometry.CLASS_NAME === gis.conf.finals.openLayers.point_classname) {
-										symbolizer = new OpenLayers.Symbolizer.Point({
-											pointRadius: 6,
-											fillColor: '#' + color,
-											strokeWidth: 1
-										});
-									}
-									else {
-										symbolizer = new OpenLayers.Symbolizer.Polygon({
-											strokeColor: '#' + color,
-											fillColor: '#' + color
-										});
-									}
-
-									layer.drawFeature(feature, symbolizer);
-								}
-							}
-						}
-					]
-				}
+                {
+                    layout: 'column',
+                    cls: 'gis-container-inner',
+                    items: [
+                        {
+                            cls: 'gis-panel-html-label',
+                            html: GIS.i18n.highlight_color + ':',
+                            width: gis.conf.layout.tool.itemlabel_width
+                        },
+                        button
+                    ]
+                },
+                {
+                    xtype: 'container',
+                    height: 1
+                },
+                {
+                    layout: 'column',
+                    cls: 'gis-container-inner',
+                    items: [
+                        {
+                            cls: 'gis-panel-html-label',
+                            html: GIS.i18n.text_filter + ':',
+                            width: gis.conf.layout.tool.itemlabel_width
+                        },
+                        {
+                            xtype: 'textfield',
+                            cls: 'gis-textfield',
+                            width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width,
+                            enableKeyEvents: true,
+                            listeners: {
+                                keyup: function() {
+                                    store.clearFilter();
+                                    if (this.getValue()) {
+                                        store.filter('name', this.getValue());
+                                    }
+                                    store.sortStore();
+                                }
+                            }
+                        }
+                    ]
+                },
+                {
+                    xtype: 'grid',
+                    cls: 'gis-grid',
+                    bodyStyle: 'border: 0 none',
+                    height: 290,
+                    width: gis.conf.layout.tool.item_width,
+                    scroll: 'vertical',
+                    hideHeaders: true,
+                    columns: [{
+                        id: 'name',
+                        text: 'Organisation units',
+                        dataIndex: 'name',
+                        sortable: false,
+                        width: gis.conf.layout.tool.item_width
+                    }],
+                    store: layer.core.featureStore,
+                    listeners: {
+                        select: function(grid, record) {
+                            var feature = layer.getFeaturesByAttribute('id', record.data.id)[0],
+                                color = button.getValue(),
+                                symbolizer;
+
+                            layer.redraw();
+
+                            if (feature.geometry.CLASS_NAME === gis.conf.finals.openLayers.point_classname) {
+                                symbolizer = new OpenLayers.Symbolizer.Point({
+                                    pointRadius: 6,
+                                    fillColor: '#' + color,
+                                    strokeWidth: 1
+                                });
+                            }
+                            else {
+                                symbolizer = new OpenLayers.Symbolizer.Polygon({
+                                    strokeColor: '#' + color,
+                                    fillColor: '#' + color
+                                });
+                            }
+
+                            layer.drawFeature(feature, symbolizer);
+                        }
+                    }
+                }
 			],
 			listeners: {
 				render: function() {
@@ -1862,7 +2013,9 @@
 			window;
 
 		greaterNumberField = Ext.create('Ext.form.field.Number', {
-			width: gis.conf.layout.tool.itemlabel_width,
+            cls: 'gis-numberfield',
+            fieldLabel: 'Greater than',
+            width: 200,
 			value: parseInt(layer.core.minVal),
 			listeners: {
 				change: function() {
@@ -1872,7 +2025,10 @@
 		});
 
 		lowerNumberField = Ext.create('Ext.form.field.Number', {
-			width: gis.conf.layout.tool.itemlabel_width,
+            cls: 'gis-numberfield',
+            fieldLabel: 'And/or lower than',
+            style: 'margin-bottom: 0',
+            width: 200,
 			value: parseInt(layer.core.maxVal) + 1,
 			listeners: {
 				change: function() {
@@ -1923,55 +2079,52 @@
 		window = Ext.create('Ext.window.Window', {
 			title: 'Filter by value',
 			iconCls: 'gis-window-title-icon-filter',
-			cls: 'gis-container-default',
-			width: gis.conf.layout.tool.window_width,
+            bodyStyle: 'background-color: #fff; padding: 1px',
 			resizable: false,
 			filter: filter,
-			items: {
-				layout: 'fit',
-				cls: 'gis-container-inner',
-				items: [
-					{
-						cls: 'gis-container-inner',
-						html: '<b>Show</b> organisation units with values..'
-					},
-					{
-						cls: 'gis-panel-html-separator'
-					},
-					{
-						cls: 'gis-panel-html-separator'
-					},
-					{
-						layout: 'column',
-						height: 22,
-						cls: 'gis-container-inner',
-						items: [
-							{
-								cls: 'gis-panel-html-label',
-								html: 'Greater than:',
-								width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width
-							},
-							greaterNumberField
-						]
-					},
-					{
-						cls: 'gis-panel-html-separator'
-					},
-					{
-						layout: 'column',
-						height: 22,
-						cls: 'gis-container-inner',
-						items: [
-							{
-								cls: 'gis-panel-html-label',
-								html: 'And/or lower than:',
-								width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width
-							},
-							lowerNumberField
-						]
-					}
-				]
-			},
+			items: [
+                {
+                    xtype: 'container',
+                    style: 'padding: 4px; border: 0 none',
+                    html: '<b>Show</b> organisation units with values..'
+                },
+                {
+                    xtype: 'container',
+                    height: 7
+                },
+                greaterNumberField,
+                lowerNumberField
+                //{
+                    //layout: 'column',
+                    //height: 22,
+                    //cls: 'gis-container-inner',
+                    //items: [
+                        //{
+                            //cls: 'gis-panel-html-label',
+                            //html: 'Greater than:',
+                            //width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width
+                        //},
+                        //greaterNumberField
+                    //]
+                //},
+					//{
+						//cls: 'gis-panel-html-separator'
+					//},
+					//{
+						//layout: 'column',
+						//height: 22,
+						//cls: 'gis-container-inner',
+						//items: [
+							//{
+								//cls: 'gis-panel-html-label',
+								//html: 'And/or lower than:',
+								//width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width
+							//},
+							//lowerNumberField
+						//]
+					//}
+				//]
+			],
 			bbar: [
 				'->',
 				{
@@ -2070,183 +2223,6 @@
 		return window;
 	};
 
-	GIS.app.LabelWindow = function(layer) {
-		var fontSize,
-			strong,
-			italic,
-			color,
-			getValues,
-			updateLabels,
-			window;
-
-		fontSize = Ext.create('Ext.form.field.Number', {
-			width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width,
-			allowDecimals: false,
-			minValue: 8,
-			value: 13,
-			emptyText: 13,
-			listeners: {
-				change: function() {
-					updateLabels();
-				}
-			}
-		});
-
-		strong = Ext.create('Ext.form.field.Checkbox', {
-			listeners: {
-				change: function() {
-					updateLabels();
-				}
-			}
-		});
-
-		italic = Ext.create('Ext.form.field.Checkbox', {
-			listeners: {
-				change: function() {
-					updateLabels();
-				}
-			}
-		});
-
-		button = Ext.create('Ext.ux.button.ColorButton', {
-			width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width,
-			value: '0000ff'
-		});
-
-		color = Ext.create('Ext.ux.button.ColorButton', {
-			width: gis.conf.layout.tool.item_width - gis.conf.layout.tool.itemlabel_width,
-			value: '000000',
-			menuHandler: function() {
-				updateLabels();
-			}
-		});
-
-		getLabelConfig = function(isLabel) {
-			var style = {
-				fontSize: fontSize.getValue(),
-				strong: strong.getValue(),
-				italic: italic.getValue(),
-				color: color.getValue()
-            };
-
-            if (isLabel) {
-                style.label = '\${label}';
-                style.fontFamily = 'arial,sans-serif,ubuntu,consolas';
-			}
-
-            return style;
-		};
-
-		updateLabels = function() {
-            var loader = layer.core.getLoader();
-            loader.hideMask = true;
-
-            if (layer.hasLabels) {
-                layer.hasLabels = false;
-
-                if (layer.id === 'boundary') {
-                    layer.core.setFeatureLabelStyle(false);
-                }
-                else {
-                    layer.styleMap = GIS.core.StyleMap(layer.id);
-                    loader.loadLegend();
-                }
-            }
-            else {
-                layer.hasLabels = true;
-
-                if (layer.id === 'boundary') {
-                    layer.core.setFeatureLabelStyle(true);
-                }
-                else {
-                    layer.styleMap = GIS.core.StyleMap(layer.id, getLabelConfig(true));
-                    loader.loadLegend();
-                }
-            }
-		};
-
-		window = Ext.create('Ext.window.Window', {
-			title: GIS.i18n.labels,
-			iconCls: 'gis-window-title-icon-labels',
-			cls: 'gis-container-default',
-			width: gis.conf.layout.tool.window_width,
-			resizable: false,
-			closeAction: 'hide',
-            updateLabels: updateLabels,
-			items: {
-				layout: 'fit',
-				cls: 'gis-container-inner',
-				items: [
-					//{
-						//layout: 'column',
-						//cls: 'gis-container-inner',
-						//items: [
-							//{
-								//cls: 'gis-panel-html-label',
-								//html: GIS.i18n.font_size,
-								//width: gis.conf.layout.tool.itemlabel_width
-							//},
-							//fontSize
-						//]
-					//},
-					{
-						layout: 'column',
-						cls: 'gis-container-inner',
-						items: [
-							{
-								cls: 'gis-panel-html-label',
-								html: '<b>' + GIS.i18n.bold_ + '</b>:',
-								width: gis.conf.layout.tool.itemlabel_width
-							},
-							strong
-						]
-					},
-					{
-						layout: 'column',
-						cls: 'gis-container-inner',
-						items: [
-							{
-								cls: 'gis-panel-html-label',
-								html: '<i>' + GIS.i18n.italic + '</i>:',
-								width: gis.conf.layout.tool.itemlabel_width
-							},
-							italic
-						]
-					},
-					{
-						layout: 'column',
-						cls: 'gis-container-inner',
-						items: [
-							{
-								cls: 'gis-panel-html-label',
-								html: GIS.i18n.color + ':',
-								width: gis.conf.layout.tool.itemlabel_width
-							},
-							color
-						]
-					}
-				]
-			},
-			bbar: [
-				'->',
-				{
-					xtype: 'button',
-					text: GIS.i18n.showhide,
-					handler: function() {
-                        updateLabels();
-					}
-				}
-			],
-			listeners: {
-				render: function() {
-					gis.util.gui.window.setPositionTopLeft(this);
-				}
-			}
-		});
-
-		return window;
-	};
-
 	GIS.app.SharingWindow = function(sharing) {
 
 		// Objects
@@ -5100,12 +5076,6 @@
 
 			organisationUnitLevel.clearValue();
 			organisationUnitGroup.clearValue();
-
-			// Layer options
-			//if (layer.labelWindow) {
-				//layer.labelWindow.destroy();
-				//layer.labelWindow = null;
-			//}
 		};
 
 		setGui = function(view) { //todo
@@ -5232,11 +5202,10 @@
 
 	GIS.app.LayerWidgetFacility = function(layer) {
 
-		// Stores
 		var infrastructuralDataElementValuesStore,
 
-		// Components
 			groupSet,
+            icons,
 
 			treePanel,
 			userOrganisationUnit,
@@ -5247,18 +5216,21 @@
 			toolMenu,
 			tool,
 			toolPanel,
+            organisationUnit,
 
+            labelPanel,
 			areaRadius,
-
-		// Functions
-
-			//createSelectHandlers,
+            options,
+
 			reset,
 			setGui,
 			getView,
 			validateView,
 
-			panel;
+			accordionBody,
+            accordion,
+
+            accordionPanels = [];
 
 		// Stores
 
@@ -5270,10 +5242,11 @@
 
 		groupSet = Ext.create('Ext.form.field.ComboBox', {
 			cls: 'gis-combo',
+			fieldLabel: 'Group set',
             editable: false,
             valueField: 'id',
             displayField: 'name',
-            emptyText: GIS.i18n.select_groupset,
+            emptyText: 'Organisation unit group set',
             mode: 'remote',
             forceSelection: true,
             width: gis.conf.layout.widget.item_width,
@@ -5282,9 +5255,23 @@
             store: gis.store.groupSets
         });
 
+        icons = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + 'Organisation unit group icons' + '</div>',
+			hideCollapseTool: true,
+            items: [
+                groupSet
+            ],
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
+
 		treePanel = Ext.create('Ext.tree.Panel', {
 			cls: 'gis-tree',
-			height: 200,
+			height: 247,
 			style: 'border-top: 1px solid #ddd; padding-top: 1px',
 			displayField: 'name',
 			width: gis.conf.layout.widget.item_width,
@@ -5586,12 +5573,11 @@
 			cls: 'gis-combo',
 			multiSelect: true,
 			style: 'margin-bottom:0',
-			width: gis.conf.layout.widget.item_width - 38,
+			width: gis.conf.layout.widget.item_width - 37,
 			valueField: 'level',
 			displayField: 'name',
 			emptyText: GIS.i18n.select_organisation_unit_levels,
 			editable: false,
-			hidden: true,
 			store: {
 				fields: ['id', 'name', 'level'],
 				data: gis.init.organisationUnitLevels
@@ -5602,12 +5588,11 @@
 			cls: 'gis-combo',
 			multiSelect: true,
 			style: 'margin-bottom:0',
-			width: gis.conf.layout.widget.item_width - 38,
+			width: gis.conf.layout.widget.item_width - 37,
 			valueField: 'id',
 			displayField: 'name',
 			emptyText: GIS.i18n.select_organisation_unit_groups,
 			editable: false,
-			hidden: true,
 			store: gis.store.organisationUnitGroup
 		});
 
@@ -5707,15 +5692,68 @@
 		toolPanel = Ext.create('Ext.panel.Panel', {
 			width: 36,
 			bodyStyle: 'border:0 none; text-align:right',
-			style: 'margin-right:2px',
+			style: 'margin-right:1px',
 			items: tool
 		});
 
+        organisationUnit = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + GIS.i18n.organisation_units + '</div>',
+			hideCollapseTool: true,
+            items: [
+                {
+                    layout: 'column',
+                    bodyStyle: 'border:0 none',
+                    style: 'padding-bottom:1px',
+                    items: [
+                        toolPanel,
+                        {
+                            layout: 'column',
+                            bodyStyle: 'border:0 none',
+                            items: [
+                                userOrganisationUnit,
+                                userOrganisationUnitChildren,
+                                userOrganisationUnitGrandChildren,
+                                organisationUnitLevel,
+                                organisationUnitGroup
+                            ]
+                        }
+                    ]
+                },
+                treePanel
+            ],
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
+
+        labelPanel = Ext.create('Ext.ux.panel.LabelPanel');
+
 		areaRadius = Ext.create('Ext.ux.panel.CheckTextNumber', {
 			width: gis.conf.layout.widget.item_width,
-			text: GIS.i18n.show_circular_area + ':'
+			checkboxBoxLabel: GIS.i18n.show_circular_area + ':'
 		});
 
+        options = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + 'Options' + '</div>',
+			hideCollapseTool: true,
+            items: [
+                labelPanel,
+                {
+                    xtype: 'container',
+                    height: 1
+                },
+                areaRadius
+            ],
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
 		// Functions
 
 		reset = function(skipTree) {
@@ -5732,10 +5770,6 @@
 				layer.filterWindow.destroy();
 				layer.filterWindow = null;
 			}
-			if (layer.labelWindow) {
-				layer.labelWindow.destroy();
-				layer.labelWindow = null;
-			}
 
 			if (layer.circleLayer & !skipTree) {
 				layer.circleLayer.deactivateControls();
@@ -5828,7 +5862,10 @@
 
 				treePanel.selectGraphMap(view.parentGraphMap);
 
-				// Area radius
+                // labels
+                labelPanel.setConfig(view);
+
+				// area radius
 				areaRadius.setValue(!!view.areaRadius, !!view.areaRadius ? view.areaRadius : null);
 			}();
 
@@ -5858,6 +5895,8 @@
 				id: groupSet.getValue()
 			};
 
+            Ext.apply(view, labelPanel.getConfig());
+
 			view.areaRadius = areaRadius.getValue() ? areaRadius.getNumber() : null;
 
 			view.opacity = layer.item.getOpacity();
@@ -5881,7 +5920,38 @@
 			return view;
 		};
 
-		panel = Ext.create('Ext.panel.Panel', {
+        accordionBody = Ext.create('Ext.panel.Panel', {
+			layout: 'accordion',
+			activeOnTop: true,
+			cls: 'ns-accordion',
+			bodyStyle: 'border:0 none; margin-bottom:1px',
+			height: 354,
+			items: function() {
+				var panels = [
+					icons,
+					organisationUnit,
+					options
+				];
+
+				last = panels[panels.length - 1];
+				last.cls = 'ns-accordion-last';
+
+				return panels;
+			}(),
+            listeners: {
+                afterrender: function() { // nasty workaround
+                    for (var i = accordionPanels.length - 1; i >= 0; i--) {
+                        accordionPanels[i].expand();
+                    }
+                }
+            }
+		});
+
+		accordion = Ext.create('Ext.panel.Panel', {
+			bodyStyle: 'border-style:none; padding:1px; padding-bottom:0',
+			items: accordionBody,
+			panels: accordionPanels,
+
 			map: layer.map,
 			layer: layer,
 			menu: layer.menu,
@@ -5894,71 +5964,35 @@
 			},
 
 			infrastructuralDataElementValuesStore: infrastructuralDataElementValuesStore,
+			getExpandedPanel: function() {
+				for (var i = 0, panel; i < this.panels.length; i++) {
+					if (!this.panels[i].collapsed) {
+						return this.panels[i];
+					}
+				}
 
-			cls: 'gis-form-widget el-border-0',
-			border: false,
-			items: [
-				{
-					xtype: 'form',
-					cls: 'el-border-0',
-					items: [
-						{
-							html: GIS.i18n.organisationunit_groupset,
-							cls: 'gis-form-subtitle-first'
-						},
-						groupSet,
-						{
-							html: GIS.i18n.organisation_units,
-							cls: 'gis-form-subtitle'
-						},
-						{
-							layout: 'column',
-							bodyStyle: 'border:0 none',
-							style: 'padding-bottom:2px',
-							items: [
-								toolPanel,
-								{
-									width: gis.conf.layout.widget.item_width - 38,
-									layout: 'column',
-									bodyStyle: 'border:0 none',
-									items: [
-										userOrganisationUnit,
-										userOrganisationUnitChildren,
-										userOrganisationUnitGrandChildren,
-										organisationUnitLevel,
-										organisationUnitGroup
-									]
-								}
-							]
-						},
-						treePanel,
-						{
-							html: GIS.i18n.surrounding_areas,
-							cls: 'gis-form-subtitle'
-						},
-						areaRadius
-					]
-				}
-			],
+				return null;
+			},
+			getFirstPanel: function() {
+				return this.panels[0];
+			},
 			listeners: {
+				added: function() {
+					layer.accordion = this;
+				},
 				render: function() {
 					toolMenu.clickHandler('level');
 				}
 			}
 		});
 
-		//createSelectHandlers();
-
-		return panel;
+		return accordion;
 	};
 
 	GIS.app.LayerWidgetBoundary = function(layer) {
 
-		// Stores
 		var infrastructuralDataElementValuesStore,
 
-		// Components
-
 			treePanel,
 			userOrganisationUnit,
 			userOrganisationUnitChildren,
@@ -5968,14 +6002,20 @@
 			toolMenu,
 			tool,
 			toolPanel,
-
-		// Functions
+            organisationUnit,
+
+            labelPanel,
+            label,
+
 			reset,
 			setGui,
 			getView,
 			validateView,
 
-			panel;
+            accordionBody,
+            accordion,
+
+			accordionPanels = [];
 
 		// Stores
 
@@ -5987,7 +6027,7 @@
 
 		treePanel = Ext.create('Ext.tree.Panel', {
 			cls: 'gis-tree',
-			height: 200,
+			height: 247,
 			style: 'border-top: 1px solid #ddd; padding-top: 1px',
 			displayField: 'name',
 			width: gis.conf.layout.widget.item_width,
@@ -6289,7 +6329,7 @@
 			cls: 'gis-combo',
 			multiSelect: true,
 			style: 'margin-bottom:0',
-			width: gis.conf.layout.widget.item_width - 38,
+			width: gis.conf.layout.widget.item_width - 37,
 			valueField: 'level',
 			displayField: 'name',
 			emptyText: GIS.i18n.select_organisation_unit_levels,
@@ -6305,7 +6345,7 @@
 			cls: 'gis-combo',
 			multiSelect: true,
 			style: 'margin-bottom:0',
-			width: gis.conf.layout.widget.item_width - 38,
+			width: gis.conf.layout.widget.item_width - 37,
 			valueField: 'id',
 			displayField: 'name',
 			emptyText: GIS.i18n.select_organisation_unit_groups,
@@ -6410,10 +6450,58 @@
 		toolPanel = Ext.create('Ext.panel.Panel', {
 			width: 36,
 			bodyStyle: 'border:0 none; text-align:right',
-			style: 'margin-right:2px',
+			style: 'margin-right:1px',
 			items: tool
 		});
 
+        organisationUnit = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + GIS.i18n.organisation_units + '</div>',
+			hideCollapseTool: true,
+            items: [
+                {
+                    layout: 'column',
+                    bodyStyle: 'border:0 none',
+                    style: 'padding-bottom:1px',
+                    items: [
+                        toolPanel,
+                        {
+                            layout: 'column',
+                            bodyStyle: 'border:0 none',
+                            items: [
+                                userOrganisationUnit,
+                                userOrganisationUnitChildren,
+                                userOrganisationUnitGrandChildren,
+                                organisationUnitLevel,
+                                organisationUnitGroup
+                            ]
+                        }
+                    ]
+                },
+                treePanel
+            ],
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
+
+        labelPanel = Ext.create('Ext.ux.panel.LabelPanel', {
+            skipBoldButton: true,
+            skipColorButton: true
+        });
+
+        label = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + GIS.i18n.labels + '</div>',
+			hideCollapseTool: true,
+            items: labelPanel,
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
 		// Functions
 
 		reset = function(skipTree) {
@@ -6445,10 +6533,6 @@
 				layer.searchWindow.destroy();
 				layer.searchWindow = null;
 			}
-			if (layer.labelWindow) {
-				layer.labelWindow.destroy();
-				layer.labelWindow = null;
-			}
 		};
 
 		setGui = function(view) {
@@ -6524,6 +6608,8 @@
 
 			view.rows = [treePanel.getDimension()];
 
+            Ext.apply(view, labelPanel.getConfig());
+
 			return validateView(view);
 		};
 
@@ -6537,7 +6623,37 @@
 			return view;
 		};
 
-		panel = Ext.create('Ext.panel.Panel', {
+        accordionBody = Ext.create('Ext.panel.Panel', {
+			layout: 'accordion',
+			activeOnTop: true,
+			cls: 'ns-accordion',
+			bodyStyle: 'border:0 none; margin-bottom:1px',
+			height: 328,
+			items: function() {
+				var panels = [
+					organisationUnit,
+                    label
+				];
+
+				last = panels[panels.length - 1];
+				last.cls = 'ns-accordion-last';
+
+				return panels;
+			}(),
+            listeners: {
+                afterrender: function() { // nasty workaround
+                    for (var i = accordionPanels.length - 1; i >= 0; i--) {
+                        accordionPanels[i].expand();
+                    }
+                }
+            }
+		});
+
+		accordion = Ext.create('Ext.panel.Panel', {
+			bodyStyle: 'border-style:none; padding:1px; padding-bottom:0',
+			items: accordionBody,
+			panels: accordionPanels,
+
 			map: layer.map,
 			layer: layer,
 			menu: layer.menu,
@@ -6550,44 +6666,22 @@
 			},
 
 			infrastructuralDataElementValuesStore: infrastructuralDataElementValuesStore,
+			getExpandedPanel: function() {
+				for (var i = 0, panel; i < this.panels.length; i++) {
+					if (!this.panels[i].collapsed) {
+						return this.panels[i];
+					}
+				}
 
-			cls: 'gis-form-widget el-border-0',
-			border: false,
-			items: [
-				{
-					xtype: 'form',
-					cls: 'el-border-0',
-					//width: 270,
-					items: [
-						{
-							html: GIS.i18n.organisation_units,
-							cls: 'gis-form-subtitle-first'
-						},
-						{
-							layout: 'column',
-							bodyStyle: 'border:0 none',
-							style: 'padding-bottom:2px',
-							items: [
-								toolPanel,
-								{
-									width: gis.conf.layout.widget.item_width - 38,
-									layout: 'column',
-									bodyStyle: 'border:0 none',
-									items: [
-										userOrganisationUnit,
-										userOrganisationUnitChildren,
-										userOrganisationUnitGrandChildren,
-										organisationUnitLevel,
-										organisationUnitGroup
-									]
-								}
-							]
-						},
-						treePanel
-					]
-				}
-			],
+				return null;
+			},
+			getFirstPanel: function() {
+				return this.panels[0];
+			},
 			listeners: {
+				added: function() {
+					layer.accordion = this;
+				},
 				render: function() {
 					toolMenu.clickHandler('level');
 				}
@@ -6596,23 +6690,21 @@
 
 		//createSelectHandlers();
 
-		return panel;
+		return accordion;
 	};
 
 	GIS.app.LayerWidgetThematic = function(layer) {
 
-		// Stores
 		var indicatorsByGroupStore,
 			dataElementsByGroupStore,
+            dataSetStore,
 			periodsByTypeStore,
 			infrastructuralDataElementValuesStore,
 			legendsByLegendSetStore,
 
-		// Togglers
 			valueTypeToggler,
 			legendTypeToggler,
 
-		// Components
 			valueType,
 			indicatorGroup,
 			indicator,
@@ -6625,6 +6717,20 @@
 			period,
 			periodPrev,
 			periodNext,
+            periodTypePanel,
+            data,
+
+			treePanel,
+			userOrganisationUnit,
+			userOrganisationUnitChildren,
+			userOrganisationUnitGrandChildren,
+			organisationUnitLevel,
+			organisationUnitGroup,
+			toolMenu,
+			tool,
+			toolPanel,
+            organisationUnit,
+
 			legendType,
 			legendSet,
 			classes,
@@ -6633,32 +6739,23 @@
 			colorHigh,
 			radiusLow,
 			radiusHigh,
-
-			treePanel,
-			userOrganisationUnit,
-			userOrganisationUnitChildren,
-			userOrganisationUnitGrandChildren,
-			organisationUnitLevel,
-			organisationUnitGroup,
-			toolMenu,
-			tool,
-			toolPanel,
-
-			periodTypePanel,
-			methodPanel,
-			lowPanel,
-			highPanel,
-
-		// Functions
-			//createSelectHandlers,
+            methodPanel,
+            lowPanel,
+            highPanel,
+            legend,
+
+            labelPanel,
+            label,
+
 			reset,
 			setGui,
 			getView,
 
-		// Convenience
-			dimConf = gis.conf.finals.dimension,
+            accordionBody,
+            accordion,
 
-			panel;
+            accordionPanels = [],
+			dimConf = gis.conf.finals.dimension;
 
 		// Stores
 
@@ -6721,7 +6818,7 @@
 				var path;
 
 				if (Ext.isString(uid)) {
-                    path = '/dataElements.json?fields=id,name&domainType=aggregate&paging=false&filter=dataElement.dataElementGroups.id:eq:' + uid;
+                    path = '/dataElements.json?fields=id,name&domainType=aggregate&paging=false&filter=dataElementGroups.id:eq:' + uid;
 				}
 				else if (uid === 0) {
 					path = '/dataElements.json?fields=id,name&domainType=aggregate&paging=false';
@@ -6907,6 +7004,7 @@
 		// Components
 
 		valueType = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.value_type,
 			editable: false,
 			valueField: 'id',
@@ -6932,6 +7030,7 @@
 		});
 
 		indicatorGroup = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.indicator_group,
 			editable: false,
 			valueField: 'id',
@@ -6955,6 +7054,7 @@
 		});
 
 		indicator = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.indicator,
 			editable: false,
 			valueField: 'id',
@@ -6996,6 +7096,7 @@
 		});
 
 		dataElementGroup = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.dataelement_group,
 			editable: false,
 			valueField: 'id',
@@ -7031,6 +7132,7 @@
 		});
 
 		dataElement = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.dataelement,
 			editable: false,
 			valueField: 'id',
@@ -7082,6 +7184,7 @@
 		});
 
 		dataElementDetailLevel = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			style: 'margin-left:2px',
 			queryMode: 'local',
 			editable: false,
@@ -7118,6 +7221,7 @@
 		});
 
 		dataSet = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.dataset,
 			editable: false,
 			valueField: 'id',
@@ -7131,6 +7235,7 @@
 		});
 
 		periodType = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			editable: false,
 			valueField: 'id',
 			displayField: 'name',
@@ -7177,6 +7282,7 @@
 		});
 
 		period = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.period,
 			editable: false,
 			valueField: 'id',
@@ -7194,8 +7300,9 @@
 		periodPrev = Ext.create('Ext.button.Button', {
 			xtype: 'button',
 			text: '<',
-			width: 20,
-			style: 'margin-left: 3px',
+			width: 22,
+            height: 24,
+			style: 'margin-left: 1px',
 			handler: function() {
 				if (periodType.getValue()) {
 					periodType.periodOffset--;
@@ -7207,8 +7314,9 @@
 		periodNext = Ext.create('Ext.button.Button', {
 			xtype: 'button',
 			text: '>',
-			width: 20,
-			style: 'margin-left: 3px',
+			width: 22,
+            height: 24,
+			style: 'margin-left: 1px',
 			scope: this,
 			handler: function() {
 				if (periodType.getValue() && periodType.periodOffset < 0) {
@@ -7218,15 +7326,513 @@
 			}
 		});
 
+		periodTypePanel = Ext.create('Ext.panel.Panel', {
+			layout: 'hbox',
+            bodyStyle: 'border:0 none',
+			items: [
+				{
+					html: GIS.i18n.period_type + ':',
+					width: 100,
+					bodyStyle: 'border:0 none',
+					style: 'padding: 3px 0 0 4px'
+				},
+				periodType,
+				periodPrev,
+				periodNext
+			]
+		});
+
+        data = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + 'Data and periods' + '</div>',
+			hideCollapseTool: true,
+            items: [
+                valueType,
+                indicatorGroup,
+                indicator,
+                dataElementGroup,
+                dataElementPanel,
+                dataSet,
+                periodTypePanel,
+                period,
+            ],
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
+
+		treePanel = Ext.create('Ext.tree.Panel', {
+			cls: 'gis-tree',
+			height: 247,
+			style: 'border-top: 1px solid #ddd; padding-top: 1px',
+			displayField: 'name',
+			width: gis.conf.layout.widget.item_width,
+			rootVisible: false,
+			autoScroll: true,
+			multiSelect: true,
+			rendered: false,
+			reset: function() {
+				var rootNode = this.getRootNode().findChild('id', gis.init.rootNodes[0].id);
+				this.collapseAll();
+				this.expandPath(rootNode.getPath());
+				this.getSelectionModel().select(rootNode);
+			},
+			selectRootIf: function() {
+				if (this.getSelectionModel().getSelection().length < 1) {
+					var node = this.getRootNode().findChild('id', gis.init.rootNodes[0].id);
+					if (this.rendered) {
+						this.getSelectionModel().select(node);
+					}
+					return node;
+				}
+			},
+			isPending: false,
+			recordsToSelect: [],
+			recordsToRestore: [],
+			multipleSelectIf: function(map, doUpdate) {
+				if (this.recordsToSelect.length === gis.util.object.getLength(map)) {
+					this.getSelectionModel().select(this.recordsToSelect);
+					this.recordsToSelect = [];
+					this.isPending = false;
+
+					if (doUpdate) {
+						update();
+					}
+				}
+			},
+			multipleExpand: function(id, map, doUpdate) {
+				var that = this,
+					rootId = gis.conf.finals.root.id,
+					path = map[id];
+
+				if (path.substr(0, rootId.length + 1) !== ('/' + rootId)) {
+					path = '/' + rootId + path;
+				}
+
+				that.expandPath(path, 'id', '/', function() {
+					record = Ext.clone(that.getRootNode().findChild('id', id, true));
+					that.recordsToSelect.push(record);
+					that.multipleSelectIf(map, doUpdate);
+				});
+			},
+            select: function(url, params) {
+                if (!params) {
+                    params = {};
+                }
+                Ext.Ajax.request({
+                    url: url,
+                    method: 'GET',
+                    params: params,
+                    scope: this,
+                    success: function(r) {
+                        var a = Ext.decode(r.responseText).organisationUnits;
+                        this.numberOfRecords = a.length;
+                        for (var i = 0; i < a.length; i++) {
+                            this.multipleExpand(a[i].id, a[i].path);
+                        }
+                    }
+                });
+            },
+			getParentGraphMap: function() {
+				var selection = this.getSelectionModel().getSelection(),
+					map = {};
+
+				if (Ext.isArray(selection) && selection.length) {
+					for (var i = 0, pathArray, key; i < selection.length; i++) {
+						pathArray = selection[i].getPath().split('/');
+						map[pathArray.pop()] = pathArray.join('/');
+					}
+				}
+
+				return map;
+			},
+			selectGraphMap: function(map, update) {
+				if (!gis.util.object.getLength(map)) {
+					return;
+				}
+
+				this.isPending = true;
+
+				for (var key in map) {
+					if (map.hasOwnProperty(key)) {
+						treePanel.multipleExpand(key, map, update);
+					}
+				}
+			},
+            store: Ext.create('Ext.data.TreeStore', {
+				fields: ['id', 'name', 'hasChildren'],
+				proxy: {
+					type: 'rest',
+					format: 'json',
+					noCache: false,
+					extraParams: {
+						fields: 'children[id,name,children::isNotEmpty|rename(hasChildren)&paging=false'
+					},
+					url: gis.init.contextPath + '/api/organisationUnits',
+					reader: {
+						type: 'json',
+						root: 'children'
+					},
+					sortParam: false
+				},
+				sorters: [{
+					property: 'name',
+					direction: 'ASC'
+				}],
+				root: {
+					id: gis.conf.finals.root.id,
+					expanded: true,
+					children: gis.init.rootNodes
+				},
+				listeners: {
+					load: function(store, node, records) {
+						Ext.Array.each(records, function(record) {
+                            if (Ext.isBoolean(record.data.hasChildren)) {
+                                record.set('leaf', !record.data.hasChildren);
+                            }
+                        });
+					}
+				}
+			}),
+			xable: function(values) {
+				for (var i = 0; i < values.length; i++) {
+					if (!!values[i]) {
+						this.disable();
+						return;
+					}
+				}
+
+				this.enable();
+			},
+			getDimension: function() {
+				var r = treePanel.getSelectionModel().getSelection(),
+					config = {
+						dimension: gis.conf.finals.dimension.organisationUnit.objectName,
+						items: []
+					};
+
+				if (toolMenu.menuValue === 'orgunit') {
+					if (userOrganisationUnit.getValue() || userOrganisationUnitChildren.getValue() || userOrganisationUnitGrandChildren.getValue()) {
+						if (userOrganisationUnit.getValue()) {
+							config.items.push({
+								id: 'USER_ORGUNIT',
+								name: ''
+							});
+						}
+						if (userOrganisationUnitChildren.getValue()) {
+							config.items.push({
+								id: 'USER_ORGUNIT_CHILDREN',
+								name: ''
+							});
+						}
+						if (userOrganisationUnitGrandChildren.getValue()) {
+							config.items.push({
+								id: 'USER_ORGUNIT_GRANDCHILDREN',
+								name: ''
+							});
+						}
+					}
+					else {
+						for (var i = 0; i < r.length; i++) {
+							config.items.push({id: r[i].data.id});
+						}
+					}
+				}
+				else if (toolMenu.menuValue === 'level') {
+					var levels = organisationUnitLevel.getValue();
+
+					for (var i = 0; i < levels.length; i++) {
+						config.items.push({
+							id: 'LEVEL-' + levels[i],
+							name: ''
+						});
+					}
+
+					for (var i = 0; i < r.length; i++) {
+						config.items.push({
+							id: r[i].data.id,
+							name: ''
+						});
+					}
+				}
+				else if (toolMenu.menuValue === 'group') {
+					var groupIds = organisationUnitGroup.getValue();
+
+					for (var i = 0; i < groupIds.length; i++) {
+						config.items.push({
+							id: 'OU_GROUP-' + groupIds[i],
+							name: ''
+						});
+					}
+
+					for (var i = 0; i < r.length; i++) {
+						config.items.push({
+							id: r[i].data.id,
+							name: ''
+						});
+					}
+				}
+
+				return config.items.length ? config : null;
+			},
+			listeners: {
+				beforeitemexpand: function() {
+					var rts = treePanel.recordsToSelect;
+
+					if (!treePanel.isPending) {
+						treePanel.recordsToRestore = treePanel.getSelectionModel().getSelection();
+					}
+				},
+				itemexpand: function() {
+					if (!treePanel.isPending && treePanel.recordsToRestore.length) {
+						treePanel.getSelectionModel().select(treePanel.recordsToRestore);
+						treePanel.recordsToRestore = [];
+					}
+				},
+				render: function() {
+					this.rendered = true;
+				},
+				afterrender: function() {
+					this.getSelectionModel().select(0);
+				},
+				itemcontextmenu: function(v, r, h, i, e) {
+					v.getSelectionModel().select(r, false);
+
+					if (v.menu) {
+						v.menu.destroy();
+					}
+					v.menu = Ext.create('Ext.menu.Menu', {
+						id: 'treepanel-contextmenu',
+						showSeparator: false,
+						shadow: false
+					});
+					if (!r.data.leaf) {
+						v.menu.add({
+							id: 'treepanel-contextmenu-item',
+							text: gis.i18n.select_all_children,
+							icon: 'images/node-select-child.png',
+							handler: function() {
+								r.expand(false, function() {
+									v.getSelectionModel().select(r.childNodes, true);
+									v.getSelectionModel().deselect(r);
+								});
+							}
+						});
+					}
+					else {
+						return;
+					}
+
+					v.menu.showAt(e.xy);
+				}
+			}
+		});
+
+		userOrganisationUnit = Ext.create('Ext.form.field.Checkbox', {
+			columnWidth: 0.30,
+			style: 'padding-top:2px; padding-left:3px; margin-bottom:0',
+			boxLabelCls: 'x-form-cb-label-alt1',
+			boxLabel: 'User OU',
+			labelWidth: gis.conf.layout.form_label_width,
+			handler: function(chb, checked) {
+				treePanel.xable([checked, userOrganisationUnitChildren.getValue(), userOrganisationUnitGrandChildren.getValue()]);
+			}
+		});
+
+		userOrganisationUnitChildren = Ext.create('Ext.form.field.Checkbox', {
+			columnWidth: 0.30,
+			style: 'padding-top:2px; margin-bottom:0',
+			boxLabelCls: 'x-form-cb-label-alt1',
+			boxLabel: 'Children',
+			labelWidth: gis.conf.layout.form_label_width,
+			handler: function(chb, checked) {
+				treePanel.xable([checked, userOrganisationUnit.getValue(), userOrganisationUnitGrandChildren.getValue()]);
+			}
+		});
+
+		userOrganisationUnitGrandChildren = Ext.create('Ext.form.field.Checkbox', {
+			columnWidth: 0.40,
+			style: 'padding-top:2px; margin-bottom:0',
+			boxLabelCls: 'x-form-cb-label-alt1',
+			boxLabel: 'Grand children',
+			labelWidth: gis.conf.layout.form_label_width,
+			handler: function(chb, checked) {
+				treePanel.xable([checked, userOrganisationUnit.getValue(), userOrganisationUnitChildren.getValue()]);
+			}
+		});
+
+		organisationUnitLevel = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
+			multiSelect: true,
+			style: 'margin-bottom:0',
+			width: gis.conf.layout.widget.item_width - 37,
+			valueField: 'level',
+			displayField: 'name',
+			emptyText: GIS.i18n.select_organisation_unit_levels,
+			editable: false,
+			store: {
+				fields: ['id', 'name', 'level'],
+				data: gis.init.organisationUnitLevels
+			}
+		});
+
+		organisationUnitGroup = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
+			multiSelect: true,
+			style: 'margin-bottom:0',
+			width: gis.conf.layout.widget.item_width - 37,
+			valueField: 'id',
+			displayField: 'name',
+			emptyText: GIS.i18n.select_organisation_unit_groups,
+			editable: false,
+			store: gis.store.organisationUnitGroup
+		});
+
+		toolMenu = Ext.create('Ext.menu.Menu', {
+			shadow: false,
+			showSeparator: false,
+			menuValue: 'level',
+			clickHandler: function(param) {
+				if (!param) {
+					return;
+				}
+
+				var items = this.items.items;
+				this.menuValue = param;
+
+				// Menu item icon cls
+				for (var i = 0; i < items.length; i++) {
+					if (items[i].setIconCls) {
+						if (items[i].param === param) {
+							items[i].setIconCls('gis-menu-item-selected');
+						}
+						else {
+							items[i].setIconCls('gis-menu-item-unselected');
+						}
+					}
+				}
+
+				// Gui
+				if (param === 'orgunit') {
+					userOrganisationUnit.show();
+					userOrganisationUnitChildren.show();
+					userOrganisationUnitGrandChildren.show();
+					organisationUnitLevel.hide();
+					organisationUnitGroup.hide();
+
+					if (userOrganisationUnit.getValue() || userOrganisationUnitChildren.getValue()) {
+						treePanel.disable();
+					}
+				}
+				else if (param === 'level') {
+					userOrganisationUnit.hide();
+					userOrganisationUnitChildren.hide();
+					userOrganisationUnitGrandChildren.hide();
+					organisationUnitLevel.show();
+					organisationUnitGroup.hide();
+					treePanel.enable();
+				}
+				else if (param === 'group') {
+					userOrganisationUnit.hide();
+					userOrganisationUnitChildren.hide();
+					userOrganisationUnitGrandChildren.hide();
+					organisationUnitLevel.hide();
+					organisationUnitGroup.show();
+					treePanel.enable();
+				}
+			},
+			items: [
+				{
+					xtype: 'label',
+					text: 'Selection mode',
+					style: 'padding:7px 5px 5px 7px; font-weight:bold; border:0 none'
+				},
+				{
+					text: GIS.i18n.select_organisation_units + '&nbsp;&nbsp;',
+					param: 'orgunit',
+					iconCls: 'gis-menu-item-selected'
+				},
+				{
+					text: 'Select levels' + '&nbsp;&nbsp;',
+					param: 'level',
+					iconCls: 'gis-menu-item-unselected'
+				},
+				{
+					text: 'Select groups' + '&nbsp;&nbsp;',
+					param: 'group',
+					iconCls: 'gis-menu-item-unselected'
+				}
+			],
+			listeners: {
+				afterrender: function() {
+					this.getEl().addCls('gis-btn-menu');
+				},
+				click: function(menu, item) {
+					this.clickHandler(item.param);
+				}
+			}
+		});
+
+		tool = Ext.create('Ext.button.Button', {
+			cls: 'gis-button-organisationunitselection',
+			iconCls: 'gis-button-icon-gear',
+			width: 36,
+			height: 24,
+			menu: toolMenu
+		});
+
+		toolPanel = Ext.create('Ext.panel.Panel', {
+			width: 36,
+			bodyStyle: 'border:0 none; text-align:right',
+			style: 'margin-right:1px',
+			items: tool
+		});
+
+        organisationUnit = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + GIS.i18n.organisation_units + '</div>',
+			hideCollapseTool: true,
+            items: [
+                {
+                    layout: 'column',
+                    bodyStyle: 'border:0 none',
+                    style: 'padding-bottom:1px',
+                    items: [
+                        toolPanel,
+                        {
+                            layout: 'column',
+                            bodyStyle: 'border:0 none',
+                            items: [
+                                userOrganisationUnit,
+                                userOrganisationUnitChildren,
+                                userOrganisationUnitGrandChildren,
+                                organisationUnitLevel,
+                                organisationUnitGroup
+                            ]
+                        }
+                    ]
+                },
+                treePanel
+            ],
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
+
 		legendType = Ext.create('Ext.form.field.ComboBox', {
-			editable: false,
-			valueField: 'id',
-			displayField: 'name',
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.legend_type,
+			labelWidth: gis.conf.layout.widget.itemlabel_width,
+			editable: false,
+			valueField: 'id',
+			displayField: 'name',
+			queryMode: 'local',
 			value: gis.conf.finals.widget.legendtype_automatic,
-			queryMode: 'local',
 			width: gis.conf.layout.widget.item_width,
-			labelWidth: gis.conf.layout.widget.itemlabel_width,
 			store: Ext.create('Ext.data.ArrayStore', {
 				fields: ['id', 'name'],
 				data: [
@@ -7242,6 +7848,7 @@
 		});
 
 		legendSet = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			fieldLabel: GIS.i18n.legendset,
 			editable: false,
 			valueField: 'id',
@@ -7253,6 +7860,7 @@
 		});
 
 		classes = Ext.create('Ext.form.field.Number', {
+            cls: 'gis-numberfield',
 			editable: false,
 			valueField: 'id',
 			displayField: 'id',
@@ -7261,7 +7869,8 @@
 			minValue: 1,
 			maxValue: 7,
 			width: 50,
-			style: 'margin-right: 3px',
+            fieldStyle: 'height: 24px',
+			style: 'margin-right: 1px',
 			store: Ext.create('Ext.data.ArrayStore', {
 				fields: ['id'],
 				data: [[1], [2], [3], [4], [5], [6], [7]]
@@ -7269,12 +7878,13 @@
 		});
 
 		method = Ext.create('Ext.form.field.ComboBox', {
+			cls: 'gis-combo',
 			editable: false,
 			valueField: 'id',
 			displayField: 'name',
 			queryMode: 'local',
 			value: 3,
-			width: 135,
+			width: 137,
 			store: Ext.create('Ext.data.ArrayStore', {
 				fields: ['id', 'name'],
 				data: [
@@ -7285,20 +7895,23 @@
 		});
 
 		colorLow = Ext.create('Ext.ux.button.ColorButton', {
-			style: 'margin-right: 3px',
-			width: 135,
+			style: 'margin-right: 1px',
+			width: 137,
+            height: 24,
 			value: 'ff0000',
 			scope: this
 		});
 
 		colorHigh = Ext.create('Ext.ux.button.ColorButton', {
-			style: 'margin-right: 3px',
-			width: 135,
+			style: 'margin-right: 1px',
+			width: 137,
+            height: 24,
 			value: '00ff00',
 			scope: this
 		});
 
 		radiusLow = Ext.create('Ext.form.field.Number', {
+            cls: 'gis-numberfield',
 			width: 50,
 			allowDecimals: false,
 			minValue: 1,
@@ -7306,476 +7919,39 @@
 		});
 
 		radiusHigh = Ext.create('Ext.form.field.Number', {
+            cls: 'gis-numberfield',
 			width: 50,
 			allowDecimals: false,
 			minValue: 1,
 			value: 15
 		});
 
-		treePanel = Ext.create('Ext.tree.Panel', {
-			cls: 'gis-tree',
-			height: 200,
-			style: 'border-top: 1px solid #ddd; padding-top: 1px',
-			displayField: 'name',
-			width: gis.conf.layout.widget.item_width,
-			rootVisible: false,
-			autoScroll: true,
-			multiSelect: true,
-			rendered: false,
-			reset: function() {
-				var rootNode = this.getRootNode().findChild('id', gis.init.rootNodes[0].id);
-				this.collapseAll();
-				this.expandPath(rootNode.getPath());
-				this.getSelectionModel().select(rootNode);
-			},
-			selectRootIf: function() {
-				if (this.getSelectionModel().getSelection().length < 1) {
-					var node = this.getRootNode().findChild('id', gis.init.rootNodes[0].id);
-					if (this.rendered) {
-						this.getSelectionModel().select(node);
-					}
-					return node;
-				}
-			},
-			isPending: false,
-			recordsToSelect: [],
-			recordsToRestore: [],
-			multipleSelectIf: function(map, doUpdate) {
-				if (this.recordsToSelect.length === gis.util.object.getLength(map)) {
-					this.getSelectionModel().select(this.recordsToSelect);
-					this.recordsToSelect = [];
-					this.isPending = false;
-
-					if (doUpdate) {
-						update();
-					}
-				}
-			},
-			multipleExpand: function(id, map, doUpdate) {
-				var that = this,
-					rootId = gis.conf.finals.root.id,
-					path = map[id];
-
-				if (path.substr(0, rootId.length + 1) !== ('/' + rootId)) {
-					path = '/' + rootId + path;
-				}
-
-				that.expandPath(path, 'id', '/', function() {
-					record = Ext.clone(that.getRootNode().findChild('id', id, true));
-					that.recordsToSelect.push(record);
-					that.multipleSelectIf(map, doUpdate);
-				});
-			},
-            select: function(url, params) {
-                if (!params) {
-                    params = {};
-                }
-                Ext.Ajax.request({
-                    url: url,
-                    method: 'GET',
-                    params: params,
-                    scope: this,
-                    success: function(r) {
-                        var a = Ext.decode(r.responseText).organisationUnits;
-                        this.numberOfRecords = a.length;
-                        for (var i = 0; i < a.length; i++) {
-                            this.multipleExpand(a[i].id, a[i].path);
-                        }
-                    }
-                });
-            },
-			getParentGraphMap: function() {
-				var selection = this.getSelectionModel().getSelection(),
-					map = {};
-
-				if (Ext.isArray(selection) && selection.length) {
-					for (var i = 0, pathArray, key; i < selection.length; i++) {
-						pathArray = selection[i].getPath().split('/');
-						map[pathArray.pop()] = pathArray.join('/');
-					}
-				}
-
-				return map;
-			},
-			selectGraphMap: function(map, update) {
-				if (!gis.util.object.getLength(map)) {
-					return;
-				}
-
-				this.isPending = true;
-
-				for (var key in map) {
-					if (map.hasOwnProperty(key)) {
-						treePanel.multipleExpand(key, map, update);
-					}
-				}
-			},
-            store: Ext.create('Ext.data.TreeStore', {
-				fields: ['id', 'name', 'hasChildren'],
-				proxy: {
-					type: 'rest',
-					format: 'json',
-					noCache: false,
-					extraParams: {
-						fields: 'children[id,name,children::isNotEmpty|rename(hasChildren)&paging=false'
-					},
-					url: gis.init.contextPath + '/api/organisationUnits',
-					reader: {
-						type: 'json',
-						root: 'children'
-					},
-					sortParam: false
-				},
-				sorters: [{
-					property: 'name',
-					direction: 'ASC'
-				}],
-				root: {
-					id: gis.conf.finals.root.id,
-					expanded: true,
-					children: gis.init.rootNodes
-				},
-				listeners: {
-					load: function(store, node, records) {
-						Ext.Array.each(records, function(record) {
-                            if (Ext.isBoolean(record.data.hasChildren)) {
-                                record.set('leaf', !record.data.hasChildren);
-                            }
-                        });
-					}
-				}
-			}),
-			xable: function(values) {
-				for (var i = 0; i < values.length; i++) {
-					if (!!values[i]) {
-						this.disable();
-						return;
-					}
-				}
-
-				this.enable();
-			},
-			getDimension: function() {
-				var r = treePanel.getSelectionModel().getSelection(),
-					config = {
-						dimension: gis.conf.finals.dimension.organisationUnit.objectName,
-						items: []
-					};
-
-				if (toolMenu.menuValue === 'orgunit') {
-					if (userOrganisationUnit.getValue() || userOrganisationUnitChildren.getValue() || userOrganisationUnitGrandChildren.getValue()) {
-						if (userOrganisationUnit.getValue()) {
-							config.items.push({
-								id: 'USER_ORGUNIT',
-								name: ''
-							});
-						}
-						if (userOrganisationUnitChildren.getValue()) {
-							config.items.push({
-								id: 'USER_ORGUNIT_CHILDREN',
-								name: ''
-							});
-						}
-						if (userOrganisationUnitGrandChildren.getValue()) {
-							config.items.push({
-								id: 'USER_ORGUNIT_GRANDCHILDREN',
-								name: ''
-							});
-						}
-					}
-					else {
-						for (var i = 0; i < r.length; i++) {
-							config.items.push({id: r[i].data.id});
-						}
-					}
-				}
-				else if (toolMenu.menuValue === 'level') {
-					var levels = organisationUnitLevel.getValue();
-
-					for (var i = 0; i < levels.length; i++) {
-						config.items.push({
-							id: 'LEVEL-' + levels[i],
-							name: ''
-						});
-					}
-
-					for (var i = 0; i < r.length; i++) {
-						config.items.push({
-							id: r[i].data.id,
-							name: ''
-						});
-					}
-				}
-				else if (toolMenu.menuValue === 'group') {
-					var groupIds = organisationUnitGroup.getValue();
-
-					for (var i = 0; i < groupIds.length; i++) {
-						config.items.push({
-							id: 'OU_GROUP-' + groupIds[i],
-							name: ''
-						});
-					}
-
-					for (var i = 0; i < r.length; i++) {
-						config.items.push({
-							id: r[i].data.id,
-							name: ''
-						});
-					}
-				}
-
-				return config.items.length ? config : null;
-			},
-			listeners: {
-				beforeitemexpand: function() {
-					var rts = treePanel.recordsToSelect;
-
-					if (!treePanel.isPending) {
-						treePanel.recordsToRestore = treePanel.getSelectionModel().getSelection();
-					}
-				},
-				itemexpand: function() {
-					if (!treePanel.isPending && treePanel.recordsToRestore.length) {
-						treePanel.getSelectionModel().select(treePanel.recordsToRestore);
-						treePanel.recordsToRestore = [];
-					}
-				},
-				render: function() {
-					this.rendered = true;
-				},
-				afterrender: function() {
-					this.getSelectionModel().select(0);
-				},
-				itemcontextmenu: function(v, r, h, i, e) {
-					v.getSelectionModel().select(r, false);
-
-					if (v.menu) {
-						v.menu.destroy();
-					}
-					v.menu = Ext.create('Ext.menu.Menu', {
-						id: 'treepanel-contextmenu',
-						showSeparator: false,
-						shadow: false
-					});
-					if (!r.data.leaf) {
-						v.menu.add({
-							id: 'treepanel-contextmenu-item',
-							text: gis.i18n.select_all_children,
-							icon: 'images/node-select-child.png',
-							handler: function() {
-								r.expand(false, function() {
-									v.getSelectionModel().select(r.childNodes, true);
-									v.getSelectionModel().deselect(r);
-								});
-							}
-						});
-					}
-					else {
-						return;
-					}
-
-					v.menu.showAt(e.xy);
-				}
-			}
-		});
-
-		userOrganisationUnit = Ext.create('Ext.form.field.Checkbox', {
-			columnWidth: 0.30,
-			style: 'padding-top:2px; padding-left:3px; margin-bottom:0',
-			boxLabelCls: 'x-form-cb-label-alt1',
-			boxLabel: 'User OU',
-			labelWidth: gis.conf.layout.form_label_width,
-			handler: function(chb, checked) {
-				treePanel.xable([checked, userOrganisationUnitChildren.getValue(), userOrganisationUnitGrandChildren.getValue()]);
-			}
-		});
-
-		userOrganisationUnitChildren = Ext.create('Ext.form.field.Checkbox', {
-			columnWidth: 0.30,
-			style: 'padding-top:2px; margin-bottom:0',
-			boxLabelCls: 'x-form-cb-label-alt1',
-			boxLabel: 'Children',
-			labelWidth: gis.conf.layout.form_label_width,
-			handler: function(chb, checked) {
-				treePanel.xable([checked, userOrganisationUnit.getValue(), userOrganisationUnitGrandChildren.getValue()]);
-			}
-		});
-
-		userOrganisationUnitGrandChildren = Ext.create('Ext.form.field.Checkbox', {
-			columnWidth: 0.40,
-			style: 'padding-top:2px; margin-bottom:0',
-			boxLabelCls: 'x-form-cb-label-alt1',
-			boxLabel: 'Grand children',
-			labelWidth: gis.conf.layout.form_label_width,
-			handler: function(chb, checked) {
-				treePanel.xable([checked, userOrganisationUnit.getValue(), userOrganisationUnitChildren.getValue()]);
-			}
-		});
-
-		organisationUnitLevel = Ext.create('Ext.form.field.ComboBox', {
-			cls: 'gis-combo',
-			multiSelect: true,
-			style: 'margin-bottom:0',
-			width: gis.conf.layout.widget.item_width - 38,
-			valueField: 'level',
-			displayField: 'name',
-			emptyText: GIS.i18n.select_organisation_unit_levels,
-			editable: false,
-			store: {
-				fields: ['id', 'name', 'level'],
-				data: gis.init.organisationUnitLevels
-			}
-		});
-
-		organisationUnitGroup = Ext.create('Ext.form.field.ComboBox', {
-			cls: 'gis-combo',
-			multiSelect: true,
-			style: 'margin-bottom:0',
-			width: gis.conf.layout.widget.item_width - 38,
-			valueField: 'id',
-			displayField: 'name',
-			emptyText: GIS.i18n.select_organisation_unit_groups,
-			editable: false,
-			store: gis.store.organisationUnitGroup
-		});
-
-		toolMenu = Ext.create('Ext.menu.Menu', {
-			shadow: false,
-			showSeparator: false,
-			menuValue: 'level',
-			clickHandler: function(param) {
-				if (!param) {
-					return;
-				}
-
-				var items = this.items.items;
-				this.menuValue = param;
-
-				// Menu item icon cls
-				for (var i = 0; i < items.length; i++) {
-					if (items[i].setIconCls) {
-						if (items[i].param === param) {
-							items[i].setIconCls('gis-menu-item-selected');
-						}
-						else {
-							items[i].setIconCls('gis-menu-item-unselected');
-						}
-					}
-				}
-
-				// Gui
-				if (param === 'orgunit') {
-					userOrganisationUnit.show();
-					userOrganisationUnitChildren.show();
-					userOrganisationUnitGrandChildren.show();
-					organisationUnitLevel.hide();
-					organisationUnitGroup.hide();
-
-					if (userOrganisationUnit.getValue() || userOrganisationUnitChildren.getValue()) {
-						treePanel.disable();
-					}
-				}
-				else if (param === 'level') {
-					userOrganisationUnit.hide();
-					userOrganisationUnitChildren.hide();
-					userOrganisationUnitGrandChildren.hide();
-					organisationUnitLevel.show();
-					organisationUnitGroup.hide();
-					treePanel.enable();
-				}
-				else if (param === 'group') {
-					userOrganisationUnit.hide();
-					userOrganisationUnitChildren.hide();
-					userOrganisationUnitGrandChildren.hide();
-					organisationUnitLevel.hide();
-					organisationUnitGroup.show();
-					treePanel.enable();
-				}
-			},
-			items: [
-				{
-					xtype: 'label',
-					text: 'Selection mode',
-					style: 'padding:7px 5px 5px 7px; font-weight:bold; border:0 none'
-				},
-				{
-					text: GIS.i18n.select_organisation_units + '&nbsp;&nbsp;',
-					param: 'orgunit',
-					iconCls: 'gis-menu-item-selected'
-				},
-				{
-					text: 'Select levels' + '&nbsp;&nbsp;',
-					param: 'level',
-					iconCls: 'gis-menu-item-unselected'
-				},
-				{
-					text: 'Select groups' + '&nbsp;&nbsp;',
-					param: 'group',
-					iconCls: 'gis-menu-item-unselected'
-				}
-			],
-			listeners: {
-				afterrender: function() {
-					this.getEl().addCls('gis-btn-menu');
-				},
-				click: function(menu, item) {
-					this.clickHandler(item.param);
-				}
-			}
-		});
-
-		tool = Ext.create('Ext.button.Button', {
-			cls: 'gis-button-organisationunitselection',
-			iconCls: 'gis-button-icon-gear',
-			width: 36,
-			height: 24,
-			menu: toolMenu
-		});
-
-		toolPanel = Ext.create('Ext.panel.Panel', {
-			width: 36,
-			bodyStyle: 'border:0 none; text-align:right',
-			style: 'margin-right:2px',
-			items: tool
-		});
-
-		periodTypePanel = Ext.create('Ext.panel.Panel', {
-			layout: 'hbox',
-			items: [
-				{
-					html: GIS.i18n.period_type + ':',
-					width: 100,
-					bodyStyle: 'color: #444',
-					style: 'padding: 3px 0 0 4px'
-				},
-				periodType,
-				periodPrev,
-				periodNext
-			]
-		});
-
-		methodPanel = Ext.create('Ext.panel.Panel', {
-			layout: 'hbox',
-			items: [
-				{
-					html: GIS.i18n.classes_method,
-					width: 100,
-					bodyStyle: 'color: #444',
-					style: 'padding: 3px 0 0 4px'
+		methodPanel = Ext.create('Ext.container.Container', {
+			layout: 'hbox',
+            height: 25,
+            bodyStyle: 'border: 0 none; margin-bottom:1px',
+			items: [
+				{
+					html: GIS.i18n.classes_method + ':',
+					width: 100,
+					style: 'padding: 4px 0 0 4px',
+                    bodyStyle: 'border: 0 none'
 				},
 				classes,
 				method
 			]
 		});
 
-		lowPanel = Ext.create('Ext.panel.Panel', {
+		lowPanel = Ext.create('Ext.container.Container', {
 			layout: 'hbox',
+            height: 25,
+            bodyStyle: 'border: 0 none',
 			items: [
 				{
-					html: GIS.i18n.low_color_size,
+					html: GIS.i18n.low_color_size + ':',
 					width: 100,
-					bodyStyle: 'color: #444',
-					style: 'padding: 3px 0 0 4px'
+					style: 'padding: 4px 0 0 4px',
+                    bodyStyle: 'border: 0 none'
 				},
 				colorLow,
 				radiusLow
@@ -7784,18 +7960,51 @@
 
 		highPanel = Ext.create('Ext.panel.Panel', {
 			layout: 'hbox',
+            height: 25,
+            bodyStyle: 'border: 0 none',
 			items: [
 				{
-					html: GIS.i18n.high_color_size,
+					html: GIS.i18n.high_color_size + ':',
 					width: 100,
-					bodyStyle: 'color: #444',
-					style: 'padding: 3px 0 0 4px'
+					style: 'padding: 4px 0 0 4px',
+                    bodyStyle: 'border: 0 none'
 				},
 				colorHigh,
 				radiusHigh
 			]
 		});
 
+        legend = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + GIS.i18n.legend + '</div>',
+			hideCollapseTool: true,
+            items: [
+                legendType,
+                legendSet,
+                methodPanel,
+                lowPanel,
+                highPanel,
+            ],
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
+
+        labelPanel = Ext.create('Ext.ux.panel.LabelPanel');
+
+        label = Ext.create('Ext.panel.Panel', {
+			title: '<div class="ns-panel-title-data">' + GIS.i18n.labels + '</div>',
+			hideCollapseTool: true,
+            items: labelPanel,
+			listeners: {
+				added: function() {
+					accordionPanels.push(this);
+				}
+			}
+        });
+
 		// Functions
 
 		reset = function(skipTree) {
@@ -7812,10 +8021,6 @@
 				layer.filterWindow.destroy();
 				layer.filterWindow = null;
 			}
-			if (layer.labelWindow) {
-				layer.labelWindow.destroy();
-				layer.labelWindow = null;
-			}
 
 			// Components
 			if (!layer.window.isRendered) {
@@ -7967,6 +8172,9 @@
 				}
 
 				treePanel.selectGraphMap(view.parentGraphMap);
+
+                // labels
+                labelPanel.setConfig(view);
 			}();
 
 			setLayerGui = function() {
@@ -8026,6 +8234,8 @@
 			view.radiusHigh = parseInt(radiusHigh.getValue());
 			view.opacity = layer.item.getOpacity();
 
+            Ext.apply(view, labelPanel.getConfig());
+
 			if (legendType.getValue() === gis.conf.finals.widget.legendtype_predefined && legendSet.getValue()) {
 				view.legendSet = {
 					id: legendSet.getValue()
@@ -8035,7 +8245,39 @@
 			return gis.api.layout.Layout(view);
 		};
 
-		panel = Ext.create('Ext.panel.Panel', {
+        accordionBody = Ext.create('Ext.panel.Panel', {
+			layout: 'accordion',
+			activeOnTop: true,
+			cls: 'ns-accordion',
+			bodyStyle: 'border:0 none; margin-bottom:1px',
+			height: 380,
+			items: function() {
+				var panels = [
+					data,
+					organisationUnit,
+					legend,
+                    label
+				];
+
+				last = panels[panels.length - 1];
+				last.cls = 'ns-accordion-last';
+
+				return panels;
+			}(),
+            listeners: {
+                afterrender: function() { // nasty workaround
+                    for (var i = accordionPanels.length - 1; i >= 0; i--) {
+                        accordionPanels[i].expand();
+                    }
+                }
+            }
+		});
+
+		accordion = Ext.create('Ext.panel.Panel', {
+			bodyStyle: 'border-style:none; padding:1px; padding-bottom:0',
+			items: accordionBody,
+			panels: accordionPanels,
+
 			map: layer.map,
 			layer: layer,
 			menu: layer.menu,
@@ -8048,64 +8290,41 @@
 			},
 
 			infrastructuralDataElementValuesStore: infrastructuralDataElementValuesStore,
-
-			cls: 'gis-form-widget el-border-0',
-			border: false,
-			items: [
-				{
-					xtype: 'form',
-					cls: 'el-border-0',
-					items: [
-						{
-							html: GIS.i18n.data_options,
-							cls: 'gis-form-subtitle-first'
-						},
-						valueType,
-						indicatorGroup,
-						indicator,
-						dataElementGroup,
-						dataElementPanel,
-						dataSet,
-						periodTypePanel,
-						period,
-						{
-							html: GIS.i18n.legend_options,
-							cls: 'gis-form-subtitle'
-						},
-						legendType,
-						legendSet,
-						methodPanel,
-						lowPanel,
-						highPanel,
-						{
-							html: GIS.i18n.organisation_units,
-							cls: 'gis-form-subtitle'
-						},
-						{
-							layout: 'column',
-							bodyStyle: 'border:0 none',
-							style: 'padding-bottom:2px',
-							items: [
-								toolPanel,
-								{
-									width: gis.conf.layout.widget.item_width - 38,
-									layout: 'column',
-									bodyStyle: 'border:0 none',
-									items: [
-										userOrganisationUnit,
-										userOrganisationUnitChildren,
-										userOrganisationUnitGrandChildren,
-										organisationUnitLevel,
-										organisationUnitGroup
-									]
-								}
-							]
-						},
-						treePanel
-					]
+			setThisHeight: function(mx) {
+                return 450;
+				//var panelHeight = this.panels.length * 28,
+					//height;
+
+                //mx = mx || 0;
+
+				//if (westRegion.hasScrollbar) {
+					//height = panelHeight + mx;
+					//this.setHeight(viewport.getHeight() - 2);
+					//accordionBody.setHeight(height - 2);
+				//}
+				//else {
+					//height = westRegion.getHeight() - ns.core.conf.layout.west_fill;
+					//mx += panelHeight;
+					//accordion.setHeight((height > mx ? mx : height) - 2);
+					//accordionBody.setHeight((height > mx ? mx : height) - 2);
+				//}
+			},
+			getExpandedPanel: function() {
+				for (var i = 0, panel; i < this.panels.length; i++) {
+					if (!this.panels[i].collapsed) {
+						return this.panels[i];
+					}
 				}
-			],
+
+				return null;
+			},
+			getFirstPanel: function() {
+				return this.panels[0];
+			},
 			listeners: {
+				added: function() {
+					layer.accordion = this;
+				},
 				render: function() {
 					toolMenu.clickHandler('level');
 				}
@@ -8114,7 +8333,7 @@
 
 		//createSelectHandlers();
 
-		return panel;
+		return accordion;
 	};
 
 	createViewport = function() {
@@ -8201,6 +8420,14 @@
                             delete view.legendSet.colors;
                             delete view.legendSet.names;
                         }
+
+                        if (!view.labels) {
+                            delete view.labels;
+                            delete view.labelFontSize;
+                            delete view.labelFontWeight;
+                            delete view.labelFontStyle;
+                            delete view.labelFontColor;
+                        }
                     }
                 }
 
@@ -8920,3 +9147,4 @@
         });
 	}();
 });
+

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-06-20 14:57:15 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/core.js	2014-07-03 12:55:11 +0000
@@ -214,7 +214,7 @@
 				shadow: false,
 				resizable: false,
 				items: {
-					html: feature.attributes.label
+					html: feature.attributes.popupText
 				}
 			});
 
@@ -738,7 +738,7 @@
 		});
 	};
 
-	GIS.core.StyleMap = function(id, labelConfig) {
+	GIS.core.StyleMap = function(config) {
 		var defaults = {
 				fillOpacity: 1,
 				strokeColor: '#fff',
@@ -757,14 +757,15 @@
                 labelYOffset: 13
 			};
 
-		if (labelConfig) {
-            defaults.label = labelConfig.label;
-            defaults.fontFamily = labelConfig.fontFamily;
-			defaults.fontSize = (labelConfig.fontSize || 13) + 'px';
-			defaults.fontWeight = labelConfig.strong ? 'bold' : 'normal';
-			defaults.fontStyle = labelConfig.italic ? 'italic' : 'normal';
-			defaults.fontColor = labelConfig.color ? (labelConfig.color.split('').shift() !== '#' ? '#' + labelConfig.color : labelConfig.color) : '#000000';
-		}
+        defaults.label = '\${label}';
+        defaults.fontFamily = 'arial,sans-serif,roboto,helvetica neue,helvetica,consolas';
+
+        if (config) {
+            defaults.fontSize = config.labelFontSize;
+            defaults.fontWeight = config.labelFontWeight;
+            defaults.fontStyle = config.labelFontStyle;
+            defaults.fontColor = config.labelFontColor;
+        }
 
 		return new OpenLayers.StyleMap({
 			'default': defaults,
@@ -779,7 +780,7 @@
 					force:true
 				})
 			],
-			styleMap: GIS.core.StyleMap(id),
+			styleMap: GIS.core.StyleMap(),
 			visibility: false,
 			displayInLayerSwitcher: false,
 			layerType: gis.conf.finals.layer.type_vector,
@@ -1384,7 +1385,7 @@
 			features = features || layer.core.featureStore.features;
 
 			for (var i = 0; i < features.length; i++) {
-				features[i].attributes.label = features[i].attributes.name;
+				features[i].attributes.popupText = features[i].attributes.name + ' (' + features[i].attributes[view.organisationUnitGroupSet.id] + ')';
 			}
 
 			layer.removeFeatures(layer.features);
@@ -1401,6 +1402,14 @@
 
 			view = view || layer.core.view;
 
+            // labels
+            for (var i = 0, attr; i < layer.features.length; i++) {
+                attr = layer.features[i].attributes;
+                attr.label = view.labels ? attr.name : '';
+            }
+
+            layer.styleMap = GIS.core.StyleMap(view);
+
             success = function(r) {
                 var data = r.organisationUnitGroups,
                     options = {
@@ -1560,6 +1569,13 @@
 					}
 					return gis.conf.finals.widget.loadtype_organisationunit;
 				}
+
+                if (doExecute) {
+                    loader.zoomToVisibleExtent = false;
+                    loadLegend(view);
+                }
+
+                return gis.conf.finals.widget.loadtype_legend;
 			}
 			else {
 				if (doExecute) {
@@ -1649,24 +1665,25 @@
 			features = features || layer.core.featureStore.features;
 
 			for (var i = 0; i < features.length; i++) {
-				features[i].attributes.label = features[i].attributes.name;
 				features[i].attributes.value = 0;
+                features[i].attributes.popupText = features[i].attributes.name;
 			}
 
 			layer.removeFeatures(layer.features);
 			layer.addFeatures(features);
 
-            // labels
-            if (layer.hasLabels) {
-                layer.core.setFeatureLabelStyle(true, true);
-            }
-
 			loadLegend(view);
 		};
 
 		loadLegend = function(view) {
 			view = view || layer.core.view;
 
+            // labels
+            for (var i = 0, feature; i < layer.features.length; i++) {
+                attr = layer.features[i].attributes;
+                attr.label = view.labels ? attr.name : '';
+            }
+
 			var options = {
 				indicator: gis.conf.finals.widget.value,
 				method: 2,
@@ -1680,6 +1697,9 @@
 
 			layer.core.applyClassification(options);
 
+            // labels
+            layer.core.setFeatureLabelStyle(view.labels, false, view);
+
 			afterLoad(view);
 		};
 
@@ -2034,7 +2054,8 @@
 
 					if (featureMap.hasOwnProperty(id) && valueMap.hasOwnProperty(id)) {
 						feature.attributes.value = valueMap[id];
-						feature.attributes.label = feature.attributes.name + ' (' + feature.attributes.value + ')';
+                        feature.attributes.popupText = feature.attributes.name + ' (' + feature.attributes.value + ')';
+
 						newFeatures.push(feature);
 					}
 				}
@@ -2078,6 +2099,14 @@
 
 			view = view || layer.core.view;
 
+            // labels
+            for (var i = 0, feature; i < layer.features.length; i++) {
+                attr = layer.features[i].attributes;
+                attr.label = view.labels ? attr.name + ' (' + attr.value + ')' : '';
+            }
+
+            layer.styleMap = GIS.core.StyleMap(view);
+
 			addNames = function(response) {
 
 				// All dimensions
@@ -2351,7 +2380,7 @@
 				widget: {
 					item_width: 288,
 					itemlabel_width: 95,
-					window_width: 310
+					window_width: 306
 				},
 				tool: {
 					item_width: 228,
@@ -2948,7 +2977,6 @@
 
                     if (Ext.Array.contains([gis.layer.thematic1.id, gis.layer.thematic2.id, gis.layer.thematic3.id, gis.layer.thematic4.id], config.layer)) {
                         if (!config.columns) {
-                            console.log('Data dimension is invalid', config.columns);
                             return;
                         }
                     }
@@ -2996,6 +3024,22 @@
 					layout.radiusHigh = Ext.isNumber(config.radiusHigh) && !Ext.isEmpty(config.radiusHigh) ? config.radiusHigh : 15;
 					layout.opacity = Ext.isNumber(config.opacity) && !Ext.isEmpty(config.opacity) ? config.opacity : gis.conf.layout.layer.opacity;
 					layout.areaRadius = config.areaRadius;
+
+                    layout.labels = !!config.labels;
+
+                    layout.labelFontSize = config.labelFontSize || '11px';
+                    layout.labelFontSize = parseInt(layout.labelFontSize) + 'px';
+
+                    layout.labelFontWeight = Ext.isString(config.labelFontWeight) || Ext.isNumber(config.labelFontWeight) ? config.labelFontWeight : 'normal';
+                    layout.labelFontWeight = Ext.Array.contains(['normal', 'bold', 'bolder', 'lighter'], layout.labelFontWeight) ? layout.labelFontWeight : 'normal';
+                    layout.labelFontWeight = Ext.isNumber(parseInt(layout.labelFontWeight)) && parseInt(layout.labelFontWeight) <= 1000 ? layout.labelFontWeight.toString() : layout.labelFontWeight;
+
+                    layout.labelFontStyle = Ext.Array.contains(['normal', 'italic', 'oblique'], config.labelFontStyle) ? config.labelFontStyle : 'normal';
+
+                    layout.labelFontColor = Ext.isString(config.labelFontColor) || Ext.isNumber(config.labelFontColor) ? config.labelFontColor : 'normal';
+                    layout.labelFontColor = Ext.isNumber(config.labelFontColor) ? config.labelFontColor.toString() : config.labelFontColor;
+                    layout.labelFontColor = layout.labelFontColor.charAt(0) !== '#' ? '#' + layout.labelFontColor : layout.labelFontColor;
+
                     layout.hidden = !!config.hidden;
 
 					layout.userOrganisationUnit = isOu;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js	2014-05-08 13:36:05 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/scripts/mapfish/core/GeoStat/all.js	2014-07-02 16:07:40 +0000
@@ -424,7 +424,7 @@
         this.layer.redraw();
     },
 
-    setFeatureLabelStyle: function(isLabel, skipDraw) {
+    setFeatureLabelStyle: function(isLabel, skipDraw, view) {
         for (var i = 0, feature, style, label; i < this.layer.features.length; i++) {
             feature = this.layer.features[i];
             style = feature.style;
@@ -435,6 +435,13 @@
                 style.fontWeight = style.strokeWidth > 1 ? 'bold' : 'normal';
                 style.labelAlign = 'cr';
                 style.labelYOffset = 13;
+
+                if (view.labelFontSize) {
+                    style.fontSize = view.labelFontSize;
+                }
+                if (view.labelFontStyle) {
+                    style.fontStyle = view.labelFontStyle;
+                }
             }
             else {
                 style.label = null;

=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css	2014-06-20 13:25:49 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/app/styles/style.css	2014-07-03 12:41:11 +0000
@@ -46,7 +46,6 @@
 
 html * {
 	font-family: arial, sans-serif, liberation sans, consolas !important;
-	font-size: 11px !important;
 }
 
 	/* Scrollbar Webkit */
@@ -124,6 +123,8 @@
 .gis-panel-html-label .x-panel-body {
 	height: 22px;
 	line-height: 18px;
+    padding-right: 5px;
+    padding-left: 4px;
 }
 
 .x-splitter-collapsed .x-layout-split-bottom { /* Hide expand arrow when east panel is collapsed */
@@ -136,6 +137,11 @@
 	clear: none;
 	display: block;
 	margin-bottom: 2px !important;
+    font-size: 11px;
+}
+
+.x-panel-body, .x-window-body {
+    font-size: 11px;
 }
 
 
@@ -232,6 +238,78 @@
 
 
 /*----------------------------------------------------------------------------
+ * NS Accordion
+ *--------------------------------------------------------------------------*/
+
+	/* accordion title bar, shared */
+.ns-accordion .x-accordion-item .x-accordion-hd {
+	padding: 6px 5px 4px 8px;
+	border: 0 none;
+	cursor: pointer;
+	border-radius: 0;
+    background-image: none;
+    background-color: #e0e0e0;
+    background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(0%, #dedede), color-stop(100%, #e6e6e6)) !important;
+    background-image: -webkit-linear-gradient(top, #dddddd, #e6e6e6) !important;
+    background-image: -moz-linear-gradient(top, #dddddd, #e6e6e6) !important;
+    background-image: -o-linear-gradient(top, #dddddd, #e6e6e6) !important;
+    background-image: -ms-linear-gradient(top, #dddddd, #e6e6e6) !important;
+    background-image: linear-gradient(top, #dddddd, #e6e6e6) !important;
+}
+	/* accordion title dock, default, collapsed */
+.ns-accordion .collapsed .x-accordion-hd {
+	padding-bottom: 5px !important;
+}
+
+	/* accordion title dock outer, shared */
+.ns-accordion .x-accordion-item {
+	border-radius: 1px;
+}
+	/* accordion title dock outer, default */
+.ns-accordion .x-accordion-item {
+	border: 1px solid #c5c5c5;
+	border-bottom: 0 none;
+}
+	/* accordion title dock outer, last */
+.ns-accordion .ns-accordion-last {
+	border: 1px solid #c5c5c5;
+}
+
+	/* accordion title dock text, shared */
+.ns-accordion .x-accordion-hd .x-panel-header-text {
+	font-weight: bold;
+	cursor: pointer;
+}
+
+	/* accordion item body */
+.ns-accordion .x-accordion-body {
+	padding: 1px;
+	border-top: 1px solid #c5c5c5 !important;
+}
+
+.ns-accordion .x-accordion-hd-sibling-expanded {
+	-moz-box-shadow: none;
+	-webkit-box-shadow: none;
+	-o-box-shadow: none;
+	box-shadow: none;
+}
+
+.ns-accordion .ns-toolbar-multiselect-left, .ns-accordion .ns-toolbar-multiselect-right {
+	margin-bottom: 0;
+}
+
+	/* accordion combo box */
+.ns-accordion .ns-combo .x-form-text, .ns-accordion .ns-combo .x-form-trigger {
+	height: 24px;
+	padding-top: 1px;
+}
+	/* accordion combo box label */
+.ns-accordion .ns-combo .x-form-item-label {
+	padding: 4px 0 0;
+}
+
+
+/*----------------------------------------------------------------------------
  * Combobox
  *--------------------------------------------------------------------------*/
 
@@ -256,6 +334,16 @@
  * GIS Combobox
  *--------------------------------------------------------------------------*/
 
+.gis-combo {
+    margin-bottom: 1px;
+}
+
+    /* Form label */
+.gis-combo .x-form-item-label-left {
+    padding-top: 4px;
+    padding-left: 4px;
+}
+
 	/* Combobox text position*/
 .gis-combo .x-form-text {
     padding-left: 5px;
@@ -871,6 +959,7 @@
 .gis-grid .x-grid-cell-inner {
 	padding-top: 3px;
 	padding-bottom: 3px;
+    font-size: 10px;
 }
 
 .gis-grid .x-column-header-text {
@@ -907,6 +996,10 @@
  * GIS Textfield
  *--------------------------------------------------------------------------*/
 
+.gis-textfield {
+    margin-bottom: 1px;
+}
+
 .gis-textfield input.x-form-text {
 	border-radius: 1px;
 	height: 24px;
@@ -954,6 +1047,22 @@
     position: relative;
     top: -2px;
     padding-left: 4px;
+    font-size: 11px;
+}
+
+
+/*----------------------------------------------------------------------------
+ * GIS Checkbox
+ *--------------------------------------------------------------------------*/
+
+.gis-checkbox {
+    margin-bottom: 1px;
+}
+
+    /* Form label */
+.gis-checkbox .x-form-item-label-left {
+    padding-top: 4px;
+    padding-left: 4px;
 }
 
 
@@ -961,11 +1070,35 @@
  * GIS Numberfield
  *--------------------------------------------------------------------------*/
 
-.gis-numberfield input.x-form-text {
-	border-top-left-radius: 1px;
-	border-bottom-left-radius: 1px;
-}
-
+.gis-numberfield {
+    margin-bottom: 1px;
+}
+
+    /* Form label */
+.gis-numberfield .x-form-item-label-left {
+    padding-top: 4px;
+    padding-left: 4px;
+}
+
+.gis-numberfield .x-form-field {
+    height: 24px !important;
+}
+
+.gis-numberfield .x-form-spinner-up,
+.gis-numberfield .x-form-spinner-down {
+    height: 12px !important;
+    background-image: url('../images/spinner_24.png');
+}
+
+.gis-numberfield .x-form-spinner-down {
+    background-position: 0 -12px;
+}
+.gis-numberfield .x-form-spinner-down-over {
+    background-position: -17px -12px;
+}
+.gis-numberfield .x-form-spinner-down-click {
+    background-position: -34px -12px;
+}
 
 /*----------------------------------------------------------------------------
  * GIS Label