dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #23927
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11665: (PT) No click handler added to empty cells.
Merge authors:
Jan Henrik Øverland (janhenrik-overland)
------------------------------------------------------------
revno: 11665 [merge]
committer: Jan Henrik Overland <janhenrik.overland@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2013-08-14 14:22:18 +0200
message:
(PT) No click handler added to empty cells.
modified:
dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/check.png
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js
dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm
dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.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-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-06-26 15:56:41 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/resources/org/hisp/dhis/pivot/i18n_module.properties 2013-08-13 14:49:26 +0000
@@ -126,4 +126,6 @@
select_boundaries_and_level=Select boundaries and level
select_organisation_unit_level=Select organisation unit level
totals=Totals
-details=Details
\ No newline at end of file
+details=Details
+select_boundaries_and_groups=Select boundaries and groups
+select_organisation_unit_groups=Select organisation unit groups
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/check.png'
Binary files dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/check.png 2013-06-26 12:18:21 +0000 and dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/images/check.png 2013-08-13 14:49:26 +0000 differ
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-08-13 11:46:30 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/app.js 2013-08-13 14:49:26 +0000
@@ -472,6 +472,18 @@
{property: 'name', direction: 'ASC'}
]
});
+
+ store.organisationUnitGroup = Ext.create('Ext.data.Store', {
+ fields: ['id', 'name'],
+ proxy: {
+ type: 'ajax',
+ url: init.contextPath + conf.finals.ajax.path_api + conf.finals.ajax.organisationunitgroup_getall,
+ reader: {
+ type: 'json',
+ root: 'organisationUnitGroups'
+ }
+ }
+ });
pt.store = store;
}());
@@ -3498,10 +3510,23 @@
}
});
+ organisationUnitGroup = Ext.create('Ext.form.field.ComboBox', {
+ cls: 'pt-combo',
+ multiSelect: true,
+ style: 'margin-bottom:0',
+ width: pt.conf.layout.west_fieldset_width - pt.conf.layout.west_width_padding - 38,
+ valueField: 'id',
+ displayField: 'name',
+ emptyText: PT.i18n.select_organisation_unit_groups,
+ editable: false,
+ hidden: true,
+ store: pt.store.organisationUnitGroup
+ });
+
toolMenu = Ext.create('Ext.menu.Menu', {
shadow: false,
showSeparator: false,
- menuValue: 'explicit',
+ menuValue: 'orgunit',
clickHandler: function(param) {
var items = this.items.items;
this.menuValue = param;
@@ -3517,31 +3542,44 @@
}
// Gui
- if (param === 'explicit') {
+ if (param === 'orgunit') {
userOrganisationUnit.show();
userOrganisationUnitChildren.show();
organisationUnitLevel.hide();
+ organisationUnitGroup.hide();
if (userOrganisationUnit.getValue() || userOrganisationUnitChildren.getValue()) {
treePanel.disable();
}
}
- else if (param === 'boundary') {
+ else if (param === 'level') {
userOrganisationUnit.hide();
userOrganisationUnitChildren.hide();
organisationUnitLevel.show();
+ organisationUnitGroup.hide();
+ treePanel.enable();
+ }
+ else if (param === 'group') {
+ userOrganisationUnit.hide();
+ userOrganisationUnitChildren.hide();
+ organisationUnitLevel.hide();
+ organisationUnitGroup.show();
treePanel.enable();
}
},
items: [
{
text: PT.i18n.select_organisation_units + ' ',
- param: 'explicit',
+ param: 'orgunit',
iconCls: 'pt-menu-item-selected'
},
{
text: PT.i18n.select_boundaries_and_level + ' ',
- param: 'boundary'
+ param: 'level'
+ },
+ {
+ text: PT.i18n.select_boundaries_and_groups + ' ',
+ param: 'group'
}
],
listeners: {
@@ -3582,7 +3620,7 @@
items: []
};
- if (toolMenu.menuValue === 'explicit') {
+ if (toolMenu.menuValue === 'orgunit') {
if (userOrganisationUnit.getValue() || userOrganisationUnitChildren.getValue()) {
if (userOrganisationUnit.getValue()) {
config.items.push({
@@ -3603,7 +3641,7 @@
}
}
}
- else if (toolMenu.menuValue === 'boundary') {
+ else if (toolMenu.menuValue === 'level') {
for (var i = 0; i < r.length; i++) {
config.items.push({
id: 'LEVEL-' + organisationUnitLevel.getValue() + '-' + r[i].data.id,
@@ -3611,6 +3649,18 @@
});
}
}
+ else if (toolMenu.menuValue === 'group') {
+ var groupIds = organisationUnitGroup.getValue();
+
+ //for (var i = 0; i < r.length; i++) {
+ for (var j = 0; j < groupIds.length; j++) {
+ config.items.push({
+ id: 'OU_GROUP-' + groupIds[j],// + '-' + r[i].data.id,
+ name: ''
+ });
+ }
+ //}
+ }
return config.items.length ? config : null;
},
@@ -3634,7 +3684,8 @@
items: [
userOrganisationUnit,
userOrganisationUnitChildren,
- organisationUnitLevel
+ organisationUnitLevel,
+ organisationUnitGroup
]
}
]
@@ -4447,11 +4498,11 @@
}
if (level) {
- toolMenu.clickHandler('boundary');
+ toolMenu.clickHandler('level');
organisationUnitLevel.setValue(level);
}
else {
- toolMenu.clickHandler('explicit');
+ toolMenu.clickHandler('orgunit');
userOrganisationUnit.setValue(isOu);
userOrganisationUnitChildren.setValue(isOuc);
}
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-08-13 11:46:30 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/app/scripts/core.js 2013-08-14 12:20:44 +0000
@@ -11,7 +11,7 @@
}
// mode
- PT.isDebug = false;
+ PT.isDebug = true;
// html5
PT.isSessionStorage = 'sessionStorage' in window && window['sessionStorage'] !== null;
@@ -470,8 +470,7 @@
}());
// init
- (function() {
-
+ (function() {
// sort and extend dynamic dimensions
init.dimensions = util.array.sortObjectsByString(init.dimensions);
@@ -493,7 +492,6 @@
// api
(function() {
-
api.layout = {};
api.response = {};
@@ -1225,6 +1223,17 @@
return false;
}(),
+ isGroup = function() {
+ if (xOuDimension && Ext.isArray(xOuDimension.ids)) {
+ for (var i = 0; i < xOuDimension.ids.length; i++) {
+ if (xOuDimension.ids[i].substr(0,8) === 'OU_GROUP') {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }(),
co = dimConf.category.objectName,
ou = dimConf.organisationUnit.objectName,
layout;
@@ -1245,7 +1254,7 @@
dim.items = dim.items.concat(pt.init.user.ouc);
}
}
- else if (isLevel) {
+ else if (isLevel || isGroup) {
// Items: get ids from metadata -> items
for (var j = 0, ids = Ext.clone(response.metaData[dim.dimensionName]); j < ids.length; j++) {
@@ -1644,15 +1653,18 @@
for (var key in uuidDimUuidsMap) {
if (uuidDimUuidsMap.hasOwnProperty(key)) {
valueElement = Ext.get(key);
-
- valueElement.dom.pt = pt;
- valueElement.dom.setAttribute('onclick', 'this.pt.util.pivot.onMouseClick(this.id);');
+
+ if (parseFloat(valueElement.dom.textContent)) {
+ valueElement.dom.pt = pt;
+ valueElement.dom.setAttribute('onclick', 'this.pt.engine.onMouseClick(this.id, this.pt);');
+ }
}
}
};
getTableHtml = function(xColAxis, xRowAxis, xResponse) {
- var getTdHtml,
+ var getRoundedHtmlValue,
+ getTdHtml,
doSubTotals,
doTotals,
getColAxisHtmlArray,
@@ -1662,7 +1674,6 @@
getGrandTotalHtmlArray,
getTotalHtmlArray,
getHtml,
-
getUniqueFactor = function(xAxis) {
if (!xAxis) {
return null;
@@ -1681,14 +1692,17 @@
return null;
},
-
colUniqueFactor = getUniqueFactor(xColAxis),
rowUniqueFactor = getUniqueFactor(xRowAxis),
-
valueItems = [],
valueObjects = [],
totalColObjects = [],
htmlArray;
+
+ getRoundedHtmlValue = function(value, dec) {
+ dec = dec || 2;
+ return parseFloat(pt.util.number.roundIf(value, 2)).toString();
+ };
getTdHtml = function(config) {
var bgColor,
@@ -1723,7 +1737,7 @@
colSpan = config.colSpan ? 'colspan="' + config.colSpan + '" ' : '';
rowSpan = config.rowSpan ? 'rowspan="' + config.rowSpan + '" ' : '';
- htmlValue = config.collapsed ? ' ' : config.htmlValue || config.value || ' ';
+ htmlValue = config.collapsed ? '' : config.htmlValue || config.value || '';
htmlValue = config.type !== 'dimension' ? pt.util.number.pp(htmlValue, layout.digitGroupSeparator) : htmlValue;
displayDensity = conf.pivot.displayDensity[config.displayDensity] || conf.pivot.displayDensity[layout.displayDensity];
fontSize = conf.pivot.fontSize[config.fontSize] || conf.pivot.fontSize[layout.fontSize];
@@ -1923,7 +1937,7 @@
}
else {
value = 0;
- htmlValue = ' ';
+ htmlValue = '';
empty = true;
}
@@ -1960,7 +1974,7 @@
type: 'valueTotal',
cls: 'pivot-value-total',
value: total,
- htmlValue: Ext.Array.contains(empty, false) ? parseFloat(pt.util.number.roundIf(total, 2)).toString() : ' ',
+ htmlValue: Ext.Array.contains(empty, false) ? getRoundedHtmlValue(total) : '',
empty: !Ext.Array.contains(empty, false)
});
@@ -2025,7 +2039,7 @@
type: 'valueSubtotal',
cls: 'pivot-value-subtotal',
value: rowSubTotal,
- htmlValue: Ext.Array.contains(empty, false) ? parseFloat(pt.util.number.roundIf(rowSubTotal, 2)).toString() : ' ',
+ htmlValue: Ext.Array.contains(empty, false) ? getRoundedHtmlValue(rowSubTotal) : '',
empty: !Ext.Array.contains(empty, false),
collapsed: !Ext.Array.contains(collapsed, false)
});
@@ -2060,7 +2074,7 @@
obj.collapsed = Ext.Array.contains(collapsed, true);
if (i === 0) {
- obj.htmlValue = ' ';
+ obj.htmlValue = '';
obj.colSpan = xRowAxis.dims;
}
else {
@@ -2107,7 +2121,7 @@
tmpValueObjects[tmpCount++].push({
type: item.type === 'value' ? 'valueSubtotal' : 'valueSubtotalTotal',
value: subTotal,
- htmlValue: Ext.Array.contains(empty, false) ? parseFloat(pt.util.number.roundIf(subTotal, 2)).toString() : ' ',
+ htmlValue: Ext.Array.contains(empty, false) ? getRoundedHtmlValue(subTotal) : '',
collapsed: collapsed,
cls: item.type === 'value' ? 'pivot-value-subtotal' : 'pivot-value-subtotal-total'
});
@@ -2133,7 +2147,7 @@
type: 'valueTotalSubgrandtotal',
cls: 'pivot-value-total-subgrandtotal',
value: subTotal,
- htmlValue: Ext.Array.contains(empty, false) ? parseFloat(pt.util.number.roundIf(subTotal, 2)).toString() : ' ',
+ htmlValue: Ext.Array.contains(empty, false) ? getRoundedHtmlValue(subTotal) : '',
empty: !Ext.Array.contains(empty, false),
collapsed: !Ext.Array.contains(collapsed, false)
});
@@ -2199,7 +2213,7 @@
totalColObjects.push({
type: 'valueTotal',
value: total,
- htmlValue: Ext.Array.contains(empty, false) ? parseFloat(pt.util.number.roundIf(total, 2)).toString() : ' ',
+ htmlValue: Ext.Array.contains(empty, false) ? getRoundedHtmlValue(total) : '',
empty: !Ext.Array.contains(empty, false),
cls: 'pivot-value-total'
});
@@ -2224,7 +2238,7 @@
tmp.push({
type: 'valueTotalSubgrandtotal',
value: subTotal,
- htmlValue: Ext.Array.contains(empty, false) ? parseFloat(pt.util.number.roundIf(subTotal, 2)).toString() : ' ',
+ htmlValue: Ext.Array.contains(empty, false) ? getRoundedHtmlValue(subTotal) : '',
empty: !Ext.Array.contains(empty, false),
cls: 'pivot-value-total-subgrandtotal'
});
@@ -2263,7 +2277,7 @@
a.push(getTdHtml({
type: 'valueGrandTotal',
cls: 'pivot-value-grandtotal',
- htmlValue: Ext.Array.contains(empty, false) ? parseFloat(pt.util.number.roundIf(total, 2)).toString() : ' ',
+ htmlValue: Ext.Array.contains(empty, false) ? getRoundedHtmlValue(total) : '',
empty: !Ext.Array.contains(empty, false)
}));
}
@@ -2485,7 +2499,7 @@
}
};
- engine.onMouseHover = function(uuid, event, param) {
+ engine.onMouseHover = function(uuid, event, param, pt) {
var dimUuids;
if (param === 'chart') {
@@ -2508,7 +2522,7 @@
}
};
- engine.onMouseClick = function(uuid) {
+ engine.onMouseClick = function(uuid, pt) {
var that = this,
uuids = pt.uuidDimUuidsMap[uuid],
layoutConfig = Ext.clone(pt.layout),
@@ -2557,11 +2571,11 @@
listeners: {
render: function() {
this.getEl().on('mouseover', function() {
- that.onMouseHover(uuid, 'mouseover', 'chart');
+ that.onMouseHover(uuid, 'mouseover', 'chart', pt);
});
this.getEl().on('mouseout', function() {
- that.onMouseHover(uuid, 'mouseout', 'chart');
+ that.onMouseHover(uuid, 'mouseout', 'chart', pt);
});
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm'
--- dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-06-26 15:56:41 +0000
+++ dhis-2/dhis-web/dhis-web-pivot/src/main/webapp/dhis-web-pivot/i18n.vm 2013-08-13 14:49:26 +0000
@@ -128,4 +128,6 @@
select_organisation_unit_level: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_level' ) , "'")',
totals: '$encoder.jsEscape($i18n.getString( 'totals' ) , "'")',
details: '$encoder.jsEscape($i18n.getString( 'details' ) , "'")',
+ select_boundaries_and_groups: '$encoder.jsEscape($i18n.getString( 'select_boundaries_and_groups' ) , "'")',
+ select_organisation_unit_groups: '$encoder.jsEscape($i18n.getString( 'select_organisation_unit_groups' ) , "'")'
};
=== modified file 'dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js'
--- dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js 2013-08-13 11:46:30 +0000
+++ dhis-2/dhis-web/dhis-web-visualizer/src/main/webapp/dhis-web-visualizer/app/scripts/plugin.js 2013-08-14 11:51:10 +0000
@@ -2,8 +2,8 @@
// load trend line lib
Ext.Loader.setConfig({enabled: true});
- Ext.Loader.setPath('trendline', '../../dhis-web-commons/javascripts');
- Ext.require('trendline.simpleRegression');
+ Ext.Loader.setPath('regression', '../../dhis-web-commons/javascripts');
+ Ext.require('regression.simpleRegression');
// chart tips css
var css = '.dv-chart-tips { \n border-radius: 2px; \n padding: 0px 3px 1px; \n border: 2px solid #777; \n background-color: #f1f1f1; \n } \n';