dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #17028
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 6644: (patient) Group headers in Tabular report.
------------------------------------------------------------
revno: 6644
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2012-04-19 17:02:59 +0700
message:
(patient) Group headers in Tabular report.
modified:
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm
--
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-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2012-04-19 02:48:18 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramStageInstanceService.java 2012-04-19 10:02:59 +0000
@@ -372,16 +372,25 @@
// Organisation units
int maxLevel = organisationUnitService.getMaxOfOrganisationUnitLevels();
- boolean hasHiddenOrgunits = !(hiddenCols.size() == idens.size() + attributes.size() + dataElements.size());
+ boolean hasMetaData = !(hiddenCols.size() == idens.size() + attributes.size() + dataElements.size());
int index = 0;
-
- if ( !hasHiddenOrgunits )
+
+ if ( !hasMetaData )
{
+ // Organisation units
for ( int i = level; i < maxLevel; i++ )
{
grid.addHeader( new GridHeader( organisationUnitService.getOrganisationUnitLevelByLevel( i )
.getName(), false, true ) );
}
+ // Fixed Attributes
+ if ( fixedAttributes != null && fixedAttributes.size() > 0 )
+ {
+ for ( String fixedAttribute : fixedAttributes )
+ {
+ grid.addHeader( new GridHeader( i18n.getString( fixedAttribute), false, true ) );
+ }
+ }
}
else
{
@@ -391,17 +400,19 @@
.getName(), hiddenCols.get( index ), true ) );
index++;
}
- }
-
- // Fixed Attributes
- if ( fixedAttributes != null && fixedAttributes.size() > 0 )
- {
- for ( String fixedAttribute : fixedAttributes )
+ // Fixed Attributes
+ if ( fixedAttributes != null && fixedAttributes.size() > 0 )
{
- grid.addHeader( new GridHeader( i18n.getString( fixedAttribute), hiddenCols.get( index ), true ) );
+ for ( String fixedAttribute : fixedAttributes )
+ {
+ grid.addHeader( new GridHeader( i18n.getString( fixedAttribute), hiddenCols.get( index ), true ) );
+ index ++;
+ }
}
}
+
+
// Identifier types
if ( idens != null && idens.size() > 0 )
{
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-04-18 10:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-04-19 10:02:59 +0000
@@ -326,4 +326,6 @@
phoneNumber = Phone number
deathdate = Death date
registrationDate = Date of registration
-dobType = DOB Type
\ No newline at end of file
+dobType = DOB Type
+report = Report
+et_no_program = Please select one program
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-04-19 02:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/app.js 2012-04-19 10:02:59 +0000
@@ -512,6 +512,7 @@
data: TR.value.values,
remoteSort:true,
autoLoad: false,
+ //groupField: 'col1',
proxy: {
type: 'memory',
reader: {
@@ -603,12 +604,24 @@
p.searchingValues = [];
if( TR.store.datatable && TR.store.datatable.data.length)
{
+ var cols = [];
var grid = TR.datatable.datatable;
+ var i = 0;
+ for( var index=1; index<grid.columns.length; index++)
+ {
+ var subCols = grid.columns[index].items;
+ for( var subIndex=0; subIndex<subCols.length; subIndex++)
+ {
+ cols[i] = subCols.getAt(subIndex);
+ i++;
+ }
+ }
+
var editor = grid.getStore().getAt(0);
- var colLen = grid.columns.length;
+ var colLen = cols.length;
for( var i=0; i<colLen; i++ )
{
- var col = grid.columns[i];
+ var col = cols[i];
if( col.name )
{
var dataIndex = col.dataIndex;
@@ -660,12 +673,24 @@
if( TR.store.datatable && TR.store.datatable.data.length)
{
+ var cols = [];
var grid = TR.datatable.datatable;
+ var i = 0;
+ for( var index=1; index<grid.columns.length; index++)
+ {
+ var subCols = grid.columns[index].items;
+ for( var subIndex=0; subIndex<subCols.length; subIndex++)
+ {
+ cols[i] = subCols.getAt(subIndex);
+ i++;
+ }
+ }
+
var editor = grid.getStore().getAt(0);
- var colLen = grid.columns.length;
+ var colLen = cols.length;
for( var i=0; i<colLen; i++ )
{
- var col = grid.columns[i];
+ var col = cols[i];
if( col.name )
{
var dataIndex = col.dataIndex;
@@ -674,7 +699,7 @@
{
value = TR.util.getValueFormula(value);
}
- p += "&searchingValues=" + col.name + col.hidden + "_" + value;
+ p += "&searchingValues=" + col.name + col.hidden + "_" + value;
}
}
}
@@ -693,7 +718,6 @@
p += "&searchingValues=" + 'de_' + r.data.id + '_false_';
});
}
-
return p;
},
validation: {
@@ -707,7 +731,7 @@
objects: function() {
if (TR.cmp.settings.program.getValue() == null) {
- TR.util.notification.error(TR.i18n.et_no_programs, TR.i18n.et_no_programs);
+ TR.util.notification.error(TR.i18n.et_no_programss, TR.i18n.et_no_programss);
return false;
}
@@ -759,28 +783,6 @@
TR.datatable = {
datatable: null,
getDataTable: function() {
- // column
- var cols = [];
- cols[0] = {
- header: TR.i18n.no,
- dataIndex: 'id',
- width: 50,
- height: TR.conf.layout.east_gridcolumn_height,
- sortable: false,
- draggable: false,
- groupable: true
- }
-
- cols[1] = {
- header: TR.i18n.report_date,
- dataIndex: 'col' + index,
- name:"reportdate_1" + "_",
- sortable: true,
- draggable: false,
- groupable: true,
- sortAscText: TR.i18n.asc,
- sortDescText: TR.i18n.desc
- };
var paramsLen = TR.cmp.params.identifierType.selected.store.data.length
+ TR.cmp.params.patientAttribute.selected.store.data.length
@@ -789,54 +791,83 @@
var metaDatatColsLen = TR.value.columns.length - paramsLen ;
var index = 2;
+ var dgCols = [];
+ dgCols[0] = {
+ header: TR.i18n.report_date,
+ dataIndex: 'col' + index,
+ sortable: true,
+ draggable: false,
+ sortAscText: TR.i18n.asc,
+ sortDescText: TR.i18n.desc
+ };
+
+ var i = 1;
for( index=2; index < metaDatatColsLen; index++ )
{
- cols[index] = {
+ dgCols[i] = {
header: TR.value.columns[index],
dataIndex: 'col' + index,
height: TR.conf.layout.east_gridcolumn_height,
name:"meta_" + index + "_",
sortable: false,
draggable: false,
- groupable: true,
sortAscText: TR.i18n.asc,
sortDescText: TR.i18n.desc
}
+ i++;
}
+ var idenCols = [];
+ i = 0;
TR.cmp.params.identifierType.selected.store.each( function(r) {
var dataIndex = "col" + index;
- cols[index] = {
+ idenCols[i] = {
header: r.data.name,
dataIndex: dataIndex,
width: 150,
height: TR.conf.layout.east_gridcolumn_height,
name: "iden_"+ r.data.id + "_",
sortable: false,
- draggable: false,
- groupable: true,
+ draggable: true,
+ renderer: function (val) {
+ if (val > 0) {
+ return '<span style="color:black;">' + val + '</span>';
+ } else if (val < 0) {
+ return '<span style="color:red;">' + val + '</span>';
+ }
+ return val;
+ },
editor: {
xtype: 'textfield',
allowBlank: true
}
};
index++;
+ i++;
});
+ i = 0;
+ var attrCols = [];
TR.cmp.params.patientAttribute.selected.store.each( function(r) {
var dataIndex = "col" + index;
- cols[index] = {
+ attrCols[i] = {
header: r.data.name,
dataIndex: dataIndex,
width: 150,
height: TR.conf.layout.east_gridcolumn_height,
name: "attr_"+ r.data.id + "_",
- groupable: true,
flex:1,
sortable: false,
- draggable: false,
- groupable: true,
+ draggable: true,
emptyText: TR.i18n.et_no_data,
+ renderer: function (val) {
+ if (val > 0) {
+ return '<span style="color:black;">' + val + '</span>';
+ } else if (val < 0) {
+ return '<span style="color:red;">' + val + '</span>';
+ }
+ return val;
+ },
editor: {
xtype: TR.value.valueTypes[index].valueType,
queryMode: 'local',
@@ -851,21 +882,31 @@
}
};
index++;
+ i++;
});
+ i = 0;
+ var deCols = [];
TR.cmp.params.dataelement.selected.store.each( function(r) {
var dataIndex = "col" + index;
- cols[index] = {
+ deCols[i] = {
header: r.data.name,
dataIndex: dataIndex,
width: 150,
height: TR.conf.layout.east_gridcolumn_height,
- groupable: true,
name: "de_"+ r.data.id + "_",
flex:1,
sortable: false,
- draggable: false,
- groupable: true,
+ draggable: true,
+ dragGroup: "dataElementGroup",
+ renderer: function (val) {
+ if (val > 0) {
+ return '<span style="color:black;">' + val + '</span>';
+ } else if (val < 0) {
+ return '<span style="color:red;">' + val + '</span>';
+ }
+ return val;
+ },
editor: {
xtype: TR.value.valueTypes[index].valueType,
queryMode: 'local',
@@ -880,13 +921,67 @@
}
};
index++;
+ i++;
});
+
+ // column
+ var cols = [];
+
+ cols[0] = {
+ header: TR.i18n.no,
+ dataIndex: 'id',
+ width: 50,
+ height: TR.conf.layout.east_gridcolumn_height,
+ sortable: false,
+ draggable: false,
+ menuDisabled: true
+ }
+
+ index = 1;
+ if( dgCols.length > 0 )
+ {
+ cols[index]={
+ text: TR.i18n.demographics,
+ columns: dgCols,
+ menuDisabled: true
+ }
+ index++;
+ }
+
+ if( idenCols.length > 0 )
+ {
+ cols[index]={
+ text: TR.i18n.identifiers,
+ columns: idenCols,
+ menuDisabled: true
+ }
+ index++;
+ }
+
+ if( attrCols.length > 0 )
+ {
+ cols[index]={
+ text: TR.i18n.attributes,
+ columns: attrCols,
+ menuDisabled: true
+ }
+ index++;
+ }
+
+ // Data element group header
+ cols[index]={
+ text: TR.i18n.data_elements,
+ columns: deCols,
+ menuDisabled: true
+ }
+
// grid
this.datatable = Ext.create('Ext.grid.Panel', {
height: TR.util.viewport.getSize().y - 68,
columns: cols,
scroll: 'both',
+ title: TR.cmp.settings.program.rawValue + " - " + TR.cmp.params.programStage.rawValue + " " + TR.i18n.report,
viewConfig: {
getRowClass: function(record, rowIndex, rp, ds){
if(rowIndex == 0){
@@ -983,7 +1078,7 @@
}
],
plugins: [
- Ext.create('Ext.grid.plugin.RowEditing', {
+ Ext.create('Ext.grid.plugin.CellEditing', {
clicksToEdit: 1,
editStyle: 'row',
clicksToMoveEditor: 1,
@@ -998,7 +1093,10 @@
}
},
edit: function( editor, e ){
- TR.exe.execute();
+ if( e.originalValue!=e.value )
+ {
+ TR.exe.execute();
+ }
}
}
})
@@ -1037,6 +1135,7 @@
});
}
+
TR.cmp.region.center.removeAll(true);
TR.cmp.region.center.add(this.datatable);
@@ -1071,8 +1170,8 @@
Ext.getCmp('previousPageBtn').enable();
Ext.getCmp('nextPageBtn').enable();
Ext.getCmp('lastPageBtn').enable();
- }
- }
+ }
+ }
};
TR.exe = {
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css 2012-04-19 02:48:18 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/app/css/style.css 2012-04-19 10:02:59 +0000
@@ -119,6 +119,7 @@
border: 1px solid transparent;
border-right: 0 none;
}
+
.tr-menugrid .x-grid-row .x-grid-cell-last, .tr-menugrid .x-grid-row-selected .x-grid-cell-last {
border: 1px solid transparent;
border-left: 0 none;
@@ -674,4 +675,4 @@
color: blue;
font-style: italic;
font-weight: weight;
-}
\ No newline at end of file
+}
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm 2012-04-18 10:28:39 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/i18n.vm 2012-04-19 10:02:59 +0000
@@ -5,7 +5,7 @@
attributes:'$encoder.jsEscape($i18n.getString( 'attributes' ) , "'")',
start_date:'$encoder.jsEscape($i18n.getString( 'start_date' ) , "'")',
end_date:'$encoder.jsEscape($i18n.getString( 'end_date' ) , "'")',
-et_no_programs:'$encoder.jsEscape($i18n.getString( 'et_no_programs' ) , "'")',
+et_no_program:'$encoder.jsEscape($i18n.getString( 'et_no_program' ) , "'")',
data_elements:'$encoder.jsEscape($i18n.getString( 'data_elements' ) , "'")',
program_stage:'$encoder.jsEscape($i18n.getString( 'program_stage' ) , "'")',
please_select:'[' + '$encoder.jsEscape($i18n.getString( 'please_select' ) , "'")' + ']',
@@ -53,4 +53,6 @@
dob_type:'$encoder.jsEscape($i18n.getString( 'dob_type' ) , "'")',
fixed_attributes:'$encoder.jsEscape($i18n.getString( 'fixed_attributes' ) , "'")',
dynamic_attributes:'$encoder.jsEscape($i18n.getString( 'dynamic_attributes' ) , "'")',
+report:'$encoder.jsEscape($i18n.getString( 'report' ) , "'")',
+demographics:'$encoder.jsEscape($i18n.getString( 'demographics' ) , "'")'
};
\ No newline at end of file