dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09138
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 2355: (GIS) Minor CSS fix + Improved code: Lazy rendering.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 2355 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2010-12-13 11:16:49 +0100
message:
(GIS) Minor CSS fix + Improved code: Lazy rendering.
modified:
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css
dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2010-12-11 19:53:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/css/style.css 2010-12-13 06:26:10 +0000
@@ -272,7 +272,7 @@
/* Ext Window */
.window-info {
padding:0 0 8px 0;
- font:bold 11px lucida sans unicode,arial;
+ font:bold 11px arial;
color:#444;
}
.window-info-grey {
=== modified file 'dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js'
--- dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-12-11 19:53:11 +0000
+++ dhis-2/dhis-web/dhis-web-mapping/src/main/webapp/dhis-web-mapping/mapping/script/index.js 2010-12-13 10:13:59 +0000
@@ -574,32 +574,6 @@
},
{
xtype: 'button',
- id: 'dashboardview_b',
- iconCls: 'icon-assign',
- hideLabel: true,
- text: i18n_add,
- handler: function() {
- var v = Ext.getCmp('favorite_cb').getValue();
- var rv = Ext.getCmp('favorite_cb').getRawValue();
-
- if (!v) {
- Ext.message.msg(false, i18n_please_select_a_map_view);
- return;
- }
-
- Ext.Ajax.request({
- url: GLOBAL.conf.path_mapping + 'addMapViewToDashboard' + GLOBAL.conf.type,
- method: 'POST',
- params: {id:v},
- success: function(r) {
- Ext.message.msg(true, i18n_favorite + ' <span class="x-msg-hl">' + rv + '</span> ' + i18n_added_to_dashboard);
- Ext.getCmp('favorite_cb').clearValue();
- }
- });
- }
- },
- {
- xtype: 'button',
id: 'deleteview_b',
iconCls: 'icon-remove',
hideLabel: true,
@@ -631,7 +605,33 @@
}
});
}
- }
+ },
+ {
+ xtype: 'button',
+ id: 'dashboardview_b',
+ iconCls: 'icon-assign',
+ hideLabel: true,
+ text: i18n_add,
+ handler: function() {
+ var v = Ext.getCmp('favorite_cb').getValue();
+ var rv = Ext.getCmp('favorite_cb').getRawValue();
+
+ if (!v) {
+ Ext.message.msg(false, i18n_please_select_a_map_view);
+ return;
+ }
+
+ Ext.Ajax.request({
+ url: GLOBAL.conf.path_mapping + 'addMapViewToDashboard' + GLOBAL.conf.type,
+ method: 'POST',
+ params: {id:v},
+ success: function(r) {
+ Ext.message.msg(true, i18n_favorite + ' <span class="x-msg-hl">' + rv + '</span> ' + i18n_added_to_dashboard);
+ Ext.getCmp('favorite_cb').clearValue();
+ }
+ });
+ }
+ }
]
});
@@ -828,586 +828,7 @@
});
/* Section: predefined map legend set */
- var newPredefinedMapLegendPanel = new Ext.Panel({
- id: 'newpredefinedmaplegend_p',
- title: i18n_legend,
- items: [
- {
- xtype: 'form',
- bodyStyle: 'padding: 8px 8px 5px 8px',
- items: [
- {html: '<div class="window-info">Register new legend</div>'},
- {
- xtype: 'textfield',
- id: 'predefinedmaplegendname_tf',
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_display_name,
- width: GLOBAL.conf.combo_width_fieldset
- },
- {
- xtype: 'numberfield',
- id: 'predefinedmaplegendstartvalue_nf',
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_start_value,
- width: GLOBAL.conf.combo_number_width_small
- },
- {
- xtype: 'numberfield',
- id: 'predefinedmaplegendendvalue_nf',
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_end_value,
- width: GLOBAL.conf.combo_number_width_small
- },
- {
- xtype: 'colorfield',
- id: 'predefinedmaplegendcolor_cp',
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_color,
- allowBlank: false,
- width: GLOBAL.conf.combo_width_fieldset,
- value:"#C0C0C0"
- },
- {html: '<div class="window-p"></div>'},
- {html: '<div class="window-info">Delete legend</div>'},
- {
- xtype: 'combo',
- id: 'predefinedmaplegend_cb',
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- selectOnFocus: true,
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_legend,
- width: GLOBAL.conf.combo_width_fieldset,
- minListWidth: GLOBAL.conf.combo_width_fieldset,
- store: GLOBAL.stores.predefinedMapLegend
- }
- ]
- },
- {
- xtypes: 'form',
- items: [
- {
- xtype: 'toolbar',
- style: 'padding-top:4px',
- items: [
- '->',
- {
- xtype: 'button',
- id: 'newpredefinedmaplegend_b',
- text: i18n_register,
- iconCls: 'icon-add',
- handler: function() {
- var mln = Ext.getCmp('predefinedmaplegendname_tf').getValue();
- var mlsv = parseFloat(Ext.getCmp('predefinedmaplegendstartvalue_nf').getValue());
- var mlev = parseFloat(Ext.getCmp('predefinedmaplegendendvalue_nf').getValue());
- var mlc = Ext.getCmp('predefinedmaplegendcolor_cp').getValue();
-
- if (!Ext.isNumber(parseFloat(mlsv)) || !Ext.isNumber(mlev)) {
- Ext.message.msg(false, 'Input invalid');
- return;
- }
-
- if (!mln || !mlsv || !mlev || !mlc) {
- Ext.message.msg(false, i18n_form_is_not_complete);
- return;
- }
-
- if (!GLOBAL.util.validateInputNameLength(mln)) {
- Ext.message.msg(false, i18n_name + ': ' + i18n_max + ' 25 ' + i18n_characters);
- return;
- }
-
- if (GLOBAL.stores.predefinedMapLegend.find('name', mln) !== -1) {
- Ext.message.msg(false, i18n_legend + '<span class="x-msg-hl">' + mln + '</span> ' + i18n_already_exists);
- return;
- }
-
- Ext.Ajax.request({
- url: GLOBAL.conf.path_mapping + 'addOrUpdateMapLegend' + GLOBAL.conf.type,
- method: 'POST',
- params: {name: mln, startValue: mlsv, endValue: mlev, color: mlc},
- success: function(r) {
- Ext.message.msg(true, i18n_legend + ' <span class="x-msg-hl">' + mln + '</span> ' + i18n_was_registered);
- GLOBAL.stores.predefinedMapLegend.load();
- Ext.getCmp('predefinedmaplegendname_tf').reset();
- Ext.getCmp('predefinedmaplegendstartvalue_nf').reset();
- Ext.getCmp('predefinedmaplegendendvalue_nf').reset();
- Ext.getCmp('predefinedmaplegendcolor_cp').reset();
- }
- });
- }
- },
- {
- xtype: 'button',
- id: 'deletepredefinedmaplegend_b',
- text: i18n_delete,
- iconCls: 'icon-remove',
- handler: function() {
- var mlv = Ext.getCmp('predefinedmaplegend_cb').getValue();
- var mlrv = Ext.getCmp('predefinedmaplegend_cb').getRawValue();
-
- if (!mlv) {
- Ext.message.msg(false, i18n_please_select_a_legend);
- return;
- }
-
- Ext.Ajax.request({
- url: GLOBAL.conf.path_mapping + 'deleteMapLegend' + GLOBAL.conf.type,
- method: 'POST',
- params: {id: mlv},
- success: function(r) {
- Ext.message.msg(true, i18n_legend + ' <span class="x-msg-hl">' + mlrv + '</span> ' + i18n_was_deleted);
- GLOBAL.stores.predefinedMapLegend.load();
- Ext.getCmp('predefinedmaplegend_cb').clearValue();
- }
- });
- }
- }
- ]
- }
- ]
- }
- ],
- listeners: {
- expand: function() {
- predefinedMapLegendSetWindow.setHeight(Ext.isChrome ? 348:346);
- },
- collapse: function() {
- predefinedMapLegendSetWindow.setHeight(123);
- }
- }
- });
-
- var newPredefinedMapLegendSetPanel = new Ext.Panel({
- id: 'newpredefinedmaplegendset_p',
- title: i18n_legendset,
- items: [
- {
- xtype: 'form',
- bodyStyle: 'padding: 8px 8px 5px 8px',
- items: [
- {html: '<div class="window-info">Register new legend set</div>'},
- {
- xtype: 'textfield',
- id: 'predefinedmaplegendsetname_tf',
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_display_name,
- width: GLOBAL.conf.combo_width_fieldset
- },
- {html: '<div class="window-field-label">'+i18n_legends+'</div>'},
- {
- xtype: 'multiselect',
- id: 'predefinednewmaplegend_ms',
- hideLabel: true,
- dataFields: ['id', 'name', 'startValue', 'endValue', 'color', 'displayString'],
- valueField: 'id',
- displayField: 'displayString',
- width: GLOBAL.conf.multiselect_width,
- height: GLOBAL.util.getMultiSelectHeight() / 2,
- store: GLOBAL.stores.predefinedMapLegend
- },
- {html: '<div class="window-p"></div>'},
- {html: '<div class="window-info">Delete legend set</div>'},
- {
- xtype: 'combo',
- id: 'predefinedmaplegendsetindicator_cb',
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- selectOnFocus: true,
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_legendset,
- width: GLOBAL.conf.combo_width_fieldset,
- minListWidth: GLOBAL.conf.combo_width_fieldset,
- store:GLOBAL.stores.predefinedMapLegendSet
- }
- ]
- },
- {
- xtype: 'form',
- items: [
- {
- xtype: 'toolbar',
- style: 'padding-top:4px',
- items: [
- '->',
- {
- xtype: 'button',
- id: 'newpredefinedmaplegendset_b',
- text: i18n_register,
- iconCls: 'icon-add',
- handler: function() {
- var mlsv = Ext.getCmp('predefinedmaplegendsetname_tf').getValue();
- var mlms = Ext.getCmp('predefinednewmaplegend_ms').getValue();
- var array = [];
-
- if (mlms) {
- array = mlms.split(',');
- if (array.length > 1) {
- for (var i = 0; i < array.length; i++) {
- var sv = GLOBAL.stores.predefinedMapLegend.getById(array[i]).get('startValue');
- var ev = GLOBAL.stores.predefinedMapLegend.getById(array[i]).get('endValue');
- for (var j = 0; j < array.length; j++) {
- if (j != i) {
- var temp_sv = GLOBAL.stores.predefinedMapLegend.getById(array[j]).get('startValue');
- var temp_ev = GLOBAL.stores.predefinedMapLegend.getById(array[j]).get('endValue');
- for (var k = sv+1; k < ev; k++) {
- if (k > temp_sv && k < temp_ev) {
- Ext.message.msg(false, i18n_overlapping_legends_are_not_allowed);
- return;
- }
- }
- }
- }
- }
- }
- }
- else {
- Ext.message.msg(false, i18n_please_select_at_least_one_legends);
- return;
- }
-
- if (!mlsv) {
- Ext.message.msg(false, i18n_form_is_not_complete);
- return;
- }
-
- array = mlms.split(',');
- var params = '?mapLegends=' + array[0];
- if (array.length > 1) {
- for (var l = 1; l < array.length; l++) {
- array[l] = '&mapLegends=' + array[l];
- params += array[l];
- }
- }
-
- Ext.Ajax.request({
- url: GLOBAL.conf.path_mapping + 'addOrUpdateMapLegendSet.action' + params,
- method: 'POST',
- params: {name: mlsv, type: GLOBAL.conf.map_legend_type_predefined},
- success: function(r) {
- Ext.message.msg(true, i18n_new_legend_set+' <span class="x-msg-hl">' + mlsv + '</span> ' + i18n_was_registered);
- GLOBAL.stores.predefinedMapLegendSet.load();
- Ext.getCmp('predefinedmaplegendsetname_tf').reset();
- Ext.getCmp('predefinednewmaplegend_ms').reset();
- }
- });
- }
- },
- {
- xtype: 'button',
- id: 'deletepredefinedmaplegendset_b',
- text: i18n_delete,
- iconCls: 'icon-remove',
- handler: function() {
- var mlsv = Ext.getCmp('predefinedmaplegendsetindicator_cb').getValue();
- var mlsrv = Ext.getCmp('predefinedmaplegendsetindicator_cb').getRawValue();
-
- if (!mlsv) {
- Ext.message.msg(false, i18n_please_select_a_legend_set);
- return;
- }
-
- Ext.Ajax.request({
- url: GLOBAL.conf.path_mapping + 'deleteMapLegendSet' + GLOBAL.conf.type,
- method: 'POST',
- params: {id: mlsv},
- success: function(r) {
- Ext.message.msg(true, i18n_legendset + ' <span class="x-msg-hl">' + mlsrv + '</span> ' + i18n_was_deleted);
- GLOBAL.stores.predefinedMapLegendSet.load();
- Ext.getCmp('predefinedmaplegendsetindicator_cb').clearValue();
- if (mlsv == Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue) {
- Ext.getCmp('predefinedmaplegendsetindicator2_cb').clearValue();
- }
- if (mlsv == Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue) {
- Ext.getCmp('predefinedmaplegendsetdataelement_cb').clearValue();
- }
- }
- });
- }
- }
- ]
- }
- ]
- }
- ],
- listeners: {
- expand: function() {
- predefinedMapLegendSetWindow.setHeight((GLOBAL.util.getMultiSelectHeight() / 2) + (Ext.isChrome ? 299:295));
- },
- collapse: function() {
- predefinedMapLegendSetWindow.setHeight(123);
- }
- }
- });
-
- var assignPredefinedMapLegendSetIndicatorPanel = new Ext.Panel({
- id: 'assignpredefinedmaplegendsetindicator_p',
- title: i18n_indicators,
- items: [
- {
- xtype: 'form',
- bodyStyle: 'padding: 8px 8px 5px 8px',
- items: [
- {html: '<div class="window-info">Assign indicators to legend set</div>'},
- {
- xtype: 'combo',
- id: 'predefinedmaplegendsetindicator2_cb',
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- selectOnFocus: true,
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_legendset,
- width: GLOBAL.conf.combo_width_fieldset,
- minListWidth: GLOBAL.conf.combo_width_fieldset,
- store: GLOBAL.stores.predefinedMapLegendSet,
- listeners: {
- 'select': {
- fn: function(cb, record) {
- var indicators = record.data.indicators || [];
- var indicatorString = '';
-
- for (var i = 0; i < indicators.length; i++) {
- indicatorString += indicators[i];
- if (i < indicators.length-1) {
- indicatorString += ',';
- }
- }
-
- Ext.getCmp('predefinedmaplegendsetindicator_ms').setValue(indicatorString);
- }
- }
- }
- },
- {html: '<div class="window-field-label">' + i18n_indicators + '</div>'},
- {
- xtype: 'multiselect',
- id: 'predefinedmaplegendsetindicator_ms',
- hideLabel:true,
- dataFields: ['id', 'shortName'],
- valueField: 'id',
- displayField: 'shortName',
- width:GLOBAL.conf.multiselect_width,
- height: GLOBAL.util.getMultiSelectHeight(),
- store:GLOBAL.stores.indicator
- }
- ]
- },
- {
- xtype: 'form',
- items: [
- {
- xtype: 'toolbar',
- style: 'padding-top:4px',
- items: [
- '->',
- {
- xtype: 'button',
- id: 'assignpredefinedmaplegendsetindicator_b',
- text: i18n_assign,
- iconCls: 'icon-assign',
- handler: function() {
- var ls = Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue();
- var lsrw = Ext.getCmp('predefinedmaplegendsetindicator2_cb').getRawValue();
- var lims = Ext.getCmp('predefinedmaplegendsetindicator_ms').getValue();
-
- if (!ls) {
- Ext.message.msg(false, i18n_please_select_a_legend_set);
- return;
- }
-
- if (!lims) {
- Ext.message.msg(false, i18n_please_select_at_least_one_indicator);
- return;
- }
-
- var array = [];
- array = lims.split(',');
- var params = '?indicators=' + array[0];
-
- if (array.length > 1) {
- for (var i = 1; i < array.length; i++) {
- array[i] = '&indicators=' + array[i];
- params += array[i];
- }
- }
-
- Ext.Ajax.request({
- url: GLOBAL.conf.path_mapping + 'assignIndicatorsToMapLegendSet.action' + params,
- method: 'POST',
- params: {id: ls},
- success: function(r) {
- Ext.message.msg(true, i18n_legendset+' <span class="x-msg-hl">' + lsrw + '</span> ' + i18n_was_updated);
- GLOBAL.stores.predefinedMapLegendSet.load();
- }
- });
- }
- }
- ]
- }
- ]
- }
- ],
- listeners: {
- expand: function() {
- predefinedMapLegendSetWindow.setHeight(GLOBAL.util.getMultiSelectHeight() + (Ext.isChrome ? 243:240));
-
- if (!GLOBAL.stores.indicator.isLoaded) {
- GLOBAL.stores.indicator.load();
- }
- },
- collapse: function() {
- predefinedMapLegendSetWindow.setHeight(123);
- }
- }
- });
-
- var assignPredefinedMapLegendSetDataElementPanel = new Ext.Panel({
- id: 'assignpredefinedmaplegendsetdataelement_p',
- title: i18n_dataelements,
- items: [
- {
- xtype: 'form',
- bodyStyle: 'padding: 8px 8px 5px 8px',
- items: [
- {html: '<div class="window-info">Assign data elements to legend set</div>'},
- {
- xtype: 'combo',
- id: 'predefinedmaplegendsetdataelement_cb',
- editable: false,
- valueField: 'id',
- displayField: 'name',
- mode: 'remote',
- forceSelection: true,
- triggerAction: 'all',
- selectOnFocus: true,
- emptyText: GLOBAL.conf.emptytext,
- labelSeparator: GLOBAL.conf.labelseparator,
- fieldLabel: i18n_legendset,
- width: GLOBAL.conf.combo_width_fieldset,
- minListWidth: GLOBAL.conf.combo_width_fieldset,
- store: GLOBAL.stores.predefinedMapLegendSet,
- listeners:{
- 'select': {
- fn: function(cb, record) {
- var dataElements = record.data.dataElements || [];
- var dataElementString = '';
-
- for (var i = 0; i < dataElements.length; i++) {
- dataElementString += dataElements[i];
- if (i < dataElements.length-1) {
- dataElementString += ',';
- }
- }
-
- Ext.getCmp('predefinedmaplegendsetdataelement_ms').setValue(dataElementString);
- }
- }
- }
- },
- {html: '<div class="window-field-label">' + i18n_dataelements + '</div>'},
- {
- xtype: 'multiselect',
- id: 'predefinedmaplegendsetdataelement_ms',
- hideLabel: true,
- dataFields: ['id', 'shortName'],
- valueField: 'id',
- displayField: 'shortName',
- width: GLOBAL.conf.multiselect_width,
- height: GLOBAL.util.getMultiSelectHeight(),
- store: GLOBAL.stores.dataElement
- }
- ]
- },
- {
- xtype: 'form',
- items: [
- {
- xtype: 'toolbar',
- style: 'padding-top:4px',
- items: [
- '->',
- {
- xtype: 'button',
- id: 'assignpredefinedmaplegendsetdataelement_b',
- text: i18n_assign,
- iconCls: 'icon-assign',
- handler: function() {
- var ls = Ext.getCmp('predefinedmaplegendsetdataelement_cb').getValue();
- var lsrw = Ext.getCmp('predefinedmaplegendsetdataelement_cb').getRawValue();
- var lims = Ext.getCmp('predefinedmaplegendsetdataelement_ms').getValue();
-
- if (!ls) {
- Ext.message.msg(false, i18n_please_select_a_legend_set);
- return;
- }
-
- if (!lims) {
- Ext.message.msg(false, i18n_please_select_at_least_one_indicator);
- return;
- }
-
- var array = [];
- array = lims.split(',');
- var params = '?dataElements=' + array[0];
-
- if (array.length > 1) {
- for (var i = 1; i < array.length; i++) {
- array[i] = '&dataElements=' + array[i];
- params += array[i];
- }
- }
-
- Ext.Ajax.request({
- url: GLOBAL.conf.path_mapping + 'assignDataElementsToMapLegendSet.action' + params,
- method: 'POST',
- params: {id: ls},
- success: function(r) {
- Ext.message.msg(true, i18n_legendset+' <span class="x-msg-hl">' + lsrw + '</span> ' + i18n_was_updated);
- GLOBAL.stores.predefinedMapLegendSet.load();
- }
- });
- }
- }
- ]
- }
- ]
- }
- ],
- listeners: {
- expand: function() {
- predefinedMapLegendSetWindow.setHeight(GLOBAL.util.getMultiSelectHeight() + (Ext.isChrome ? 241:238));
-
- if (!GLOBAL.stores.dataElement.isLoaded) {
- GLOBAL.stores.dataElement.load();
- }
- },
- collapse: function() {
- predefinedMapLegendSetWindow.setHeight(123);
- }
- }
- });
-
- var predefinedMapLegendSetWindow = new Ext.Window({
+ var predefinedMapLegendSetWindow = new Ext.Window({
id: 'predefinedmaplegendset_w',
title: '<span id="window-predefinedlegendset-title">'+i18n_predefined_legend_sets+'</span>',
layout: 'fit',
@@ -1419,10 +840,581 @@
xtype: 'panel',
layout: 'accordion',
items: [
- newPredefinedMapLegendPanel,
- newPredefinedMapLegendSetPanel,
- assignPredefinedMapLegendSetIndicatorPanel,
- assignPredefinedMapLegendSetDataElementPanel
+ {
+ id: 'newpredefinedmaplegend_p',
+ title: i18n_legend,
+ items: [
+ {
+ xtype: 'form',
+ bodyStyle: 'padding: 8px 8px 5px 8px',
+ items: [
+ {html: '<div class="window-info">Register new legend</div>'},
+ {
+ xtype: 'textfield',
+ id: 'predefinedmaplegendname_tf',
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_display_name,
+ width: GLOBAL.conf.combo_width_fieldset
+ },
+ {
+ xtype: 'numberfield',
+ id: 'predefinedmaplegendstartvalue_nf',
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_start_value,
+ width: GLOBAL.conf.combo_number_width_small
+ },
+ {
+ xtype: 'numberfield',
+ id: 'predefinedmaplegendendvalue_nf',
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_end_value,
+ width: GLOBAL.conf.combo_number_width_small
+ },
+ {
+ xtype: 'colorfield',
+ id: 'predefinedmaplegendcolor_cp',
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_color,
+ allowBlank: false,
+ width: GLOBAL.conf.combo_width_fieldset,
+ value:"#C0C0C0"
+ },
+ {html: '<div class="window-p"></div>'},
+ {html: '<div class="window-info">Delete legend</div>'},
+ {
+ xtype: 'combo',
+ id: 'predefinedmaplegend_cb',
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_legend,
+ width: GLOBAL.conf.combo_width_fieldset,
+ minListWidth: GLOBAL.conf.combo_width_fieldset,
+ store: GLOBAL.stores.predefinedMapLegend
+ }
+ ]
+ },
+ {
+ xtypes: 'form',
+ items: [
+ {
+ xtype: 'toolbar',
+ style: 'padding-top:4px',
+ items: [
+ '->',
+ {
+ xtype: 'button',
+ id: 'newpredefinedmaplegend_b',
+ text: i18n_register,
+ iconCls: 'icon-add',
+ handler: function() {
+ var mln = Ext.getCmp('predefinedmaplegendname_tf').getValue();
+ var mlsv = parseFloat(Ext.getCmp('predefinedmaplegendstartvalue_nf').getValue());
+ var mlev = parseFloat(Ext.getCmp('predefinedmaplegendendvalue_nf').getValue());
+ var mlc = Ext.getCmp('predefinedmaplegendcolor_cp').getValue();
+
+ if (!Ext.isNumber(parseFloat(mlsv)) || !Ext.isNumber(mlev)) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ return;
+ }
+
+ if (!mln || !mlsv || !mlev || !mlc) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ return;
+ }
+
+ if (!GLOBAL.util.validateInputNameLength(mln)) {
+ Ext.message.msg(false, i18n_name + ': ' + i18n_max + ' 25 ' + i18n_characters);
+ return;
+ }
+
+ if (GLOBAL.stores.predefinedMapLegend.find('name', mln) !== -1) {
+ Ext.message.msg(false, i18n_legend + '<span class="x-msg-hl">' + mln + '</span> ' + i18n_already_exists);
+ return;
+ }
+
+ Ext.Ajax.request({
+ url: GLOBAL.conf.path_mapping + 'addOrUpdateMapLegend' + GLOBAL.conf.type,
+ method: 'POST',
+ params: {name: mln, startValue: mlsv, endValue: mlev, color: mlc},
+ success: function(r) {
+ Ext.message.msg(true, i18n_legend + ' <span class="x-msg-hl">' + mln + '</span> ' + i18n_was_registered);
+ GLOBAL.stores.predefinedMapLegend.load();
+ Ext.getCmp('predefinedmaplegendname_tf').reset();
+ Ext.getCmp('predefinedmaplegendstartvalue_nf').reset();
+ Ext.getCmp('predefinedmaplegendendvalue_nf').reset();
+ Ext.getCmp('predefinedmaplegendcolor_cp').reset();
+ }
+ });
+ }
+ },
+ {
+ xtype: 'button',
+ id: 'deletepredefinedmaplegend_b',
+ text: i18n_delete,
+ iconCls: 'icon-remove',
+ handler: function() {
+ var mlv = Ext.getCmp('predefinedmaplegend_cb').getValue();
+ var mlrv = Ext.getCmp('predefinedmaplegend_cb').getRawValue();
+
+ if (!mlv) {
+ Ext.message.msg(false, i18n_please_select_a_legend);
+ return;
+ }
+
+ Ext.Ajax.request({
+ url: GLOBAL.conf.path_mapping + 'deleteMapLegend' + GLOBAL.conf.type,
+ method: 'POST',
+ params: {id: mlv},
+ success: function(r) {
+ Ext.message.msg(true, i18n_legend + ' <span class="x-msg-hl">' + mlrv + '</span> ' + i18n_was_deleted);
+ GLOBAL.stores.predefinedMapLegend.load();
+ Ext.getCmp('predefinedmaplegend_cb').clearValue();
+ }
+ });
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ listeners: {
+ expand: function() {
+ predefinedMapLegendSetWindow.setHeight(Ext.isChrome ? 348:346);
+ },
+ collapse: function() {
+ predefinedMapLegendSetWindow.setHeight(123);
+ }
+ }
+ },
+
+ {
+ title: i18n_legendset,
+ items: [
+ {
+ xtype: 'form',
+ bodyStyle: 'padding: 8px 8px 5px 8px',
+ items: [
+ {html: '<div class="window-info">Register new legend set</div>'},
+ {
+ xtype: 'textfield',
+ id: 'predefinedmaplegendsetname_tf',
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_display_name,
+ width: GLOBAL.conf.combo_width_fieldset
+ },
+ {html: '<div class="window-field-label">'+i18n_legends+'</div>'},
+ {
+ xtype: 'multiselect',
+ id: 'predefinednewmaplegend_ms',
+ hideLabel: true,
+ dataFields: ['id', 'name', 'startValue', 'endValue', 'color', 'displayString'],
+ valueField: 'id',
+ displayField: 'displayString',
+ width: GLOBAL.conf.multiselect_width,
+ height: GLOBAL.util.getMultiSelectHeight() / 2,
+ store: GLOBAL.stores.predefinedMapLegend
+ },
+ {html: '<div class="window-p"></div>'},
+ {html: '<div class="window-info">Delete legend set</div>'},
+ {
+ xtype: 'combo',
+ id: 'predefinedmaplegendsetindicator_cb',
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_legendset,
+ width: GLOBAL.conf.combo_width_fieldset,
+ minListWidth: GLOBAL.conf.combo_width_fieldset,
+ store:GLOBAL.stores.predefinedMapLegendSet
+ }
+ ]
+ },
+ {
+ xtype: 'form',
+ items: [
+ {
+ xtype: 'toolbar',
+ style: 'padding-top:4px',
+ items: [
+ '->',
+ {
+ xtype: 'button',
+ id: 'newpredefinedmaplegendset_b',
+ text: i18n_register,
+ iconCls: 'icon-add',
+ handler: function() {
+ var mlsv = Ext.getCmp('predefinedmaplegendsetname_tf').getValue();
+ var mlms = Ext.getCmp('predefinednewmaplegend_ms').getValue();
+ var array = [];
+
+ if (mlms) {
+ array = mlms.split(',');
+ if (array.length > 1) {
+ for (var i = 0; i < array.length; i++) {
+ var sv = GLOBAL.stores.predefinedMapLegend.getById(array[i]).get('startValue');
+ var ev = GLOBAL.stores.predefinedMapLegend.getById(array[i]).get('endValue');
+ for (var j = 0; j < array.length; j++) {
+ if (j != i) {
+ var temp_sv = GLOBAL.stores.predefinedMapLegend.getById(array[j]).get('startValue');
+ var temp_ev = GLOBAL.stores.predefinedMapLegend.getById(array[j]).get('endValue');
+ for (var k = sv+1; k < ev; k++) {
+ if (k > temp_sv && k < temp_ev) {
+ Ext.message.msg(false, i18n_overlapping_legends_are_not_allowed);
+ return;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ else {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ return;
+ }
+
+ if (!mlsv) {
+ Ext.message.msg(false, i18n_form_is_not_complete);
+ return;
+ }
+
+ array = mlms.split(',');
+ var params = '?mapLegends=' + array[0];
+ if (array.length > 1) {
+ for (var l = 1; l < array.length; l++) {
+ array[l] = '&mapLegends=' + array[l];
+ params += array[l];
+ }
+ }
+
+ Ext.Ajax.request({
+ url: GLOBAL.conf.path_mapping + 'addOrUpdateMapLegendSet.action' + params,
+ method: 'POST',
+ params: {name: mlsv, type: GLOBAL.conf.map_legend_type_predefined},
+ success: function(r) {
+ Ext.message.msg(true, i18n_new_legend_set+' <span class="x-msg-hl">' + mlsv + '</span> ' + i18n_was_registered);
+ GLOBAL.stores.predefinedMapLegendSet.load();
+ Ext.getCmp('predefinedmaplegendsetname_tf').reset();
+ Ext.getCmp('predefinednewmaplegend_ms').reset();
+ }
+ });
+ }
+ },
+ {
+ xtype: 'button',
+ id: 'deletepredefinedmaplegendset_b',
+ text: i18n_delete,
+ iconCls: 'icon-remove',
+ handler: function() {
+ var mlsv = Ext.getCmp('predefinedmaplegendsetindicator_cb').getValue();
+ var mlsrv = Ext.getCmp('predefinedmaplegendsetindicator_cb').getRawValue();
+
+ if (!mlsv) {
+ Ext.message.msg(false, i18n_please_select_a_legend_set);
+ return;
+ }
+
+ Ext.Ajax.request({
+ url: GLOBAL.conf.path_mapping + 'deleteMapLegendSet' + GLOBAL.conf.type,
+ method: 'POST',
+ params: {id: mlsv},
+ success: function(r) {
+ Ext.message.msg(true, i18n_legendset + ' <span class="x-msg-hl">' + mlsrv + '</span> ' + i18n_was_deleted);
+ GLOBAL.stores.predefinedMapLegendSet.load();
+ Ext.getCmp('predefinedmaplegendsetindicator_cb').clearValue();
+ if (mlsv == Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue) {
+ Ext.getCmp('predefinedmaplegendsetindicator2_cb').clearValue();
+ }
+ if (mlsv == Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue) {
+ Ext.getCmp('predefinedmaplegendsetdataelement_cb').clearValue();
+ }
+ }
+ });
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ listeners: {
+ expand: function() {
+ predefinedMapLegendSetWindow.setHeight((GLOBAL.util.getMultiSelectHeight() / 2) + (Ext.isChrome ? 299:295));
+ },
+ collapse: function() {
+ predefinedMapLegendSetWindow.setHeight(123);
+ }
+ }
+ },
+
+ {
+ title: i18n_indicators,
+ items: [
+ {
+ xtype: 'form',
+ bodyStyle: 'padding: 8px 8px 5px 8px',
+ items: [
+ {html: '<div class="window-info">Assign indicators to legend set</div>'},
+ {
+ xtype: 'combo',
+ id: 'predefinedmaplegendsetindicator2_cb',
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_legendset,
+ width: GLOBAL.conf.combo_width_fieldset,
+ minListWidth: GLOBAL.conf.combo_width_fieldset,
+ store: GLOBAL.stores.predefinedMapLegendSet,
+ listeners: {
+ 'select': {
+ fn: function(cb, record) {
+ var indicators = record.data.indicators || [];
+ var indicatorString = '';
+
+ for (var i = 0; i < indicators.length; i++) {
+ indicatorString += indicators[i];
+ if (i < indicators.length-1) {
+ indicatorString += ',';
+ }
+ }
+
+ Ext.getCmp('predefinedmaplegendsetindicator_ms').setValue(indicatorString);
+ }
+ }
+ }
+ },
+ {html: '<div class="window-field-label">' + i18n_indicators + '</div>'},
+ {
+ xtype: 'multiselect',
+ id: 'predefinedmaplegendsetindicator_ms',
+ hideLabel:true,
+ dataFields: ['id', 'shortName'],
+ valueField: 'id',
+ displayField: 'shortName',
+ width:GLOBAL.conf.multiselect_width,
+ height: GLOBAL.util.getMultiSelectHeight(),
+ store:GLOBAL.stores.indicator
+ }
+ ]
+ },
+ {
+ xtype: 'form',
+ items: [
+ {
+ xtype: 'toolbar',
+ style: 'padding-top:4px',
+ items: [
+ '->',
+ {
+ xtype: 'button',
+ id: 'assignpredefinedmaplegendsetindicator_b',
+ text: i18n_assign,
+ iconCls: 'icon-assign',
+ handler: function() {
+ var ls = Ext.getCmp('predefinedmaplegendsetindicator2_cb').getValue();
+ var lsrw = Ext.getCmp('predefinedmaplegendsetindicator2_cb').getRawValue();
+ var lims = Ext.getCmp('predefinedmaplegendsetindicator_ms').getValue();
+
+ if (!ls) {
+ Ext.message.msg(false, i18n_please_select_a_legend_set);
+ return;
+ }
+
+ if (!lims) {
+ Ext.message.msg(false, i18n_please_select_at_least_one_indicator);
+ return;
+ }
+
+ var array = [];
+ array = lims.split(',');
+ var params = '?indicators=' + array[0];
+
+ if (array.length > 1) {
+ for (var i = 1; i < array.length; i++) {
+ array[i] = '&indicators=' + array[i];
+ params += array[i];
+ }
+ }
+
+ Ext.Ajax.request({
+ url: GLOBAL.conf.path_mapping + 'assignIndicatorsToMapLegendSet.action' + params,
+ method: 'POST',
+ params: {id: ls},
+ success: function(r) {
+ Ext.message.msg(true, i18n_legendset+' <span class="x-msg-hl">' + lsrw + '</span> ' + i18n_was_updated);
+ GLOBAL.stores.predefinedMapLegendSet.load();
+ }
+ });
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ listeners: {
+ expand: function() {
+ predefinedMapLegendSetWindow.setHeight(GLOBAL.util.getMultiSelectHeight() + (Ext.isChrome ? 243:240));
+
+ if (!GLOBAL.stores.indicator.isLoaded) {
+ GLOBAL.stores.indicator.load();
+ }
+ },
+ collapse: function() {
+ predefinedMapLegendSetWindow.setHeight(123);
+ }
+ }
+ },
+
+ {
+ title: i18n_dataelements,
+ items: [
+ {
+ xtype: 'form',
+ bodyStyle: 'padding: 8px 8px 5px 8px',
+ items: [
+ {html: '<div class="window-info">Assign data elements to legend set</div>'},
+ {
+ xtype: 'combo',
+ id: 'predefinedmaplegendsetdataelement_cb',
+ editable: false,
+ valueField: 'id',
+ displayField: 'name',
+ mode: 'remote',
+ forceSelection: true,
+ triggerAction: 'all',
+ selectOnFocus: true,
+ emptyText: GLOBAL.conf.emptytext,
+ labelSeparator: GLOBAL.conf.labelseparator,
+ fieldLabel: i18n_legendset,
+ width: GLOBAL.conf.combo_width_fieldset,
+ minListWidth: GLOBAL.conf.combo_width_fieldset,
+ store: GLOBAL.stores.predefinedMapLegendSet,
+ listeners:{
+ 'select': {
+ fn: function(cb, record) {
+ var dataElements = record.data.dataElements || [];
+ var dataElementString = '';
+
+ for (var i = 0; i < dataElements.length; i++) {
+ dataElementString += dataElements[i];
+ if (i < dataElements.length-1) {
+ dataElementString += ',';
+ }
+ }
+
+ Ext.getCmp('predefinedmaplegendsetdataelement_ms').setValue(dataElementString);
+ }
+ }
+ }
+ },
+ {html: '<div class="window-field-label">' + i18n_dataelements + '</div>'},
+ {
+ xtype: 'multiselect',
+ id: 'predefinedmaplegendsetdataelement_ms',
+ hideLabel: true,
+ dataFields: ['id', 'shortName'],
+ valueField: 'id',
+ displayField: 'shortName',
+ width: GLOBAL.conf.multiselect_width,
+ height: GLOBAL.util.getMultiSelectHeight(),
+ store: GLOBAL.stores.dataElement
+ }
+ ]
+ },
+ {
+ xtype: 'form',
+ items: [
+ {
+ xtype: 'toolbar',
+ style: 'padding-top:4px',
+ items: [
+ '->',
+ {
+ xtype: 'button',
+ id: 'assignpredefinedmaplegendsetdataelement_b',
+ text: i18n_assign,
+ iconCls: 'icon-assign',
+ handler: function() {
+ var ls = Ext.getCmp('predefinedmaplegendsetdataelement_cb').getValue();
+ var lsrw = Ext.getCmp('predefinedmaplegendsetdataelement_cb').getRawValue();
+ var lims = Ext.getCmp('predefinedmaplegendsetdataelement_ms').getValue();
+
+ if (!ls) {
+ Ext.message.msg(false, i18n_please_select_a_legend_set);
+ return;
+ }
+
+ if (!lims) {
+ Ext.message.msg(false, i18n_please_select_at_least_one_indicator);
+ return;
+ }
+
+ var array = [];
+ array = lims.split(',');
+ var params = '?dataElements=' + array[0];
+
+ if (array.length > 1) {
+ for (var i = 1; i < array.length; i++) {
+ array[i] = '&dataElements=' + array[i];
+ params += array[i];
+ }
+ }
+
+ Ext.Ajax.request({
+ url: GLOBAL.conf.path_mapping + 'assignDataElementsToMapLegendSet.action' + params,
+ method: 'POST',
+ params: {id: ls},
+ success: function(r) {
+ Ext.message.msg(true, i18n_legendset+' <span class="x-msg-hl">' + lsrw + '</span> ' + i18n_was_updated);
+ GLOBAL.stores.predefinedMapLegendSet.load();
+ }
+ });
+ }
+ }
+ ]
+ }
+ ]
+ }
+ ],
+ listeners: {
+ expand: function() {
+ predefinedMapLegendSetWindow.setHeight(GLOBAL.util.getMultiSelectHeight() + (Ext.isChrome ? 241:238));
+
+ if (!GLOBAL.stores.dataElement.isLoaded) {
+ GLOBAL.stores.dataElement.load();
+ }
+ },
+ collapse: function() {
+ predefinedMapLegendSetWindow.setHeight(123);
+ }
+ }
+ }
]
}
],