dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #14231
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4758: (wip) Showed details - DataMart, Reporting, and Validation Rule - Done.
------------------------------------------------------------
revno: 4758
committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-09-29 13:40:09 +0700
message:
(wip) Showed details - DataMart, Reporting, and Validation Rule - Done.
removed:
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseDataMartExport.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChart.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseTable.vm
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRule.vm
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRuleGroup.vm
added:
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonDataMartExport.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChartGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportTableGroup.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonTable.vm
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRule.vm
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRuleGroup.vm
modified:
dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportGroup.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportTableGroup.js
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js
dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/general.js
dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRuleGroup.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-datamart/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml 2011-06-23 14:44:17 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/resources/struts.xml 2011-09-29 06:40:09 +0000
@@ -65,12 +65,15 @@
<!-- Ajax requests -->
<action name="getDataMartExport" class="org.hisp.dhis.datamart.action.GetDataMartExportAction">
- <result name="success" type="velocity-xml">/dhis-web-datamart/responseDataMartExport.vm</result>
+ <result name="success" type="velocity-json">
+ /dhis-web-datamart/jsonDataMartExport.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
<action name="validateDataMartExport" class="org.hisp.dhis.datamart.action.ValidateDataMartExportAction">
- <result name="success" type="velocity-xml">../dhis-web-commons/ajax/xmlResponseSuccess.vm</result>
- <result name="input" type="velocity-xml">../dhis-web-commons/ajax/xmlResponseInput.vm</result>
+ <result name="success" type="velocity-json">../dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="input" type="velocity-json">../dhis-web-commons/ajax/jsonResponseInput.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
</package>
=== modified file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js 2011-08-01 18:58:07 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/javascript/datamart.js 2011-09-29 06:40:09 +0000
@@ -167,21 +167,15 @@
function showDataMartExportDetails( id )
{
- var request = new Request();
- request.setResponseTypeXML( 'dataMartExport' );
- request.setCallbackSuccess( dataMartExportReceived );
- request.send( 'getDataMartExport.action?id=' + id );
-}
-
-function dataMartExportReceived( xmlObject )
-{
- setInnerHTML( "nameField", getElementValue( xmlObject, "name" ) );
- setInnerHTML( "dataElementField", getElementValue( xmlObject, "dataElements" ) );
- setInnerHTML( "indicatorField", getElementValue( xmlObject, "indicators" ) );
- setInnerHTML( "organisationUnitField", getElementValue( xmlObject, "organisationUnits" ) );
- setInnerHTML( "periodField", getElementValue( xmlObject, "periods" ) );
-
- showDetails();
+ jQuery.post( 'getDataMartExport.action', { id: id }, function ( json ) {
+ setInnerHTML( "nameField", json.dataMartExport.name );
+ setInnerHTML( "dataElementField", json.dataMartExport.dataElements );
+ setInnerHTML( "indicatorField", json.dataMartExport.indicators );
+ setInnerHTML( "organisationUnitField", json.dataMartExport.organisationUnits );
+ setInnerHTML( "periodField", json.dataMartExport.periods );
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
@@ -192,34 +186,25 @@
{
if ( validateCollections() )
{
- var url = "validateDataMartExport.action?id=" +
- getFieldValue( "id" ) + "&name=" + getFieldValue( "name" );
-
- var request = new Request();
- request.setResponseTypeXML( 'message' );
- request.setCallbackSuccess( saveExportReceived );
- request.send( url );
- }
-}
-
-function saveExportReceived( messageElement )
-{
- var type = messageElement.getAttribute( 'type' );
- var message = messageElement.firstChild.nodeValue;
-
- if ( type == "input" )
- {
- setMessage( message );
- }
- else if ( type == "success" )
- {
- selectAllById( "selectedDataElements" );
- selectAllById( "selectedIndicators" );
- selectAllById( "selectedOrganisationUnits" );
- selectAllById( "selectedPeriods" );
-
- document.getElementById( "exportForm" ).submit();
- }
+ jQuery.postJSON( 'validateDataMartExport.action', {
+ id: getFieldValue( "id" ),
+ name: getFieldValue( "name" )
+ }, function ( json ) {
+ if ( json.response == "input" )
+ {
+ setMessage( json.message );
+ }
+ else if ( json.response == "success" )
+ {
+ selectAllById( "selectedDataElements" );
+ selectAllById( "selectedIndicators" );
+ selectAllById( "selectedOrganisationUnits" );
+ selectAllById( "selectedPeriods" );
+
+ byId( "exportForm" ).submit();
+ }
+ });
+ }
}
// -----------------------------------------------------------------------------
=== added file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonDataMartExport.vm'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonDataMartExport.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/jsonDataMartExport.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,9 @@
+{ "dataMartExport":
+ {
+ "name": "$!encoder.jsonEncode( ${dataMartExport.name )}",
+ "dataElements": "$!{dataMartExport.dataElements.size()}",
+ "indicators": "$!{dataMartExport.indicators.size()}",
+ "organisationUnits": "$!{dataMartExport.organisationUnits.size()}",
+ "periods": "$!{dataMartExport.periods.size()}"
+ }
+}
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseDataMartExport.vm'
--- dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseDataMartExport.vm 2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-datamart/src/main/webapp/dhis-web-datamart/responseDataMartExport.vm 1970-01-01 00:00:00 +0000
@@ -1,8 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<dataMartExport>
- <name>$encoder.xmlEncode( $dataMartExport.name )</name>
- <dataElements>$dataMartExport.dataElements.size()</dataElements>
- <indicators>$dataMartExport.indicators.size()</indicators>
- <organisationUnits>$dataMartExport.organisationUnits.size()</organisationUnits>
- <periods>$dataMartExport.periods.size()</periods>
-</dataMartExport>
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-09-07 11:00:47 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2011-09-29 06:40:09 +0000
@@ -99,7 +99,7 @@
</action>
<action name="getChart" class="org.hisp.dhis.reporting.chart.action.GetChartAction">
- <result name="success" type="velocity-xml">/dhis-web-reporting/responseChart.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-reporting/jsonChart.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
@@ -158,7 +158,7 @@
</action>
<action name="getChartGroup" class="org.hisp.dhis.reporting.chartgroup.action.GetChartGroupAction">
- <result name="success" type="velocity-xml">/dhis-web-reporting/responseChartGroup.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-reporting/jsonChartGroup.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
@@ -268,7 +268,7 @@
</action>
<action name="getReportGroup" class="org.hisp.dhis.reporting.reportgroup.action.GetReportGroupAction">
- <result name="success" type="velocity-xml">/dhis-web-reporting/responseReportGroup.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-reporting/jsonReportGroup.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
@@ -327,7 +327,7 @@
</action>
<action name="getTable" class="org.hisp.dhis.reporting.tablecreator.action.GetTableAction">
- <result name="success" type="velocity-xml">/dhis-web-reporting/responseTable.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-reporting/jsonTable.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
@@ -409,7 +409,7 @@
</action>
<action name="getReportTableGroup" class="org.hisp.dhis.reporting.reporttablegroup.action.GetReportTableGroupAction">
- <result name="success" type="velocity-xml">/dhis-web-reporting/responseReportTableGroup.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-reporting/jsonReportTableGroup.vm</result>
<param name="onExceptionReturn">plainTextError</param>
</action>
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js 2011-06-22 18:29:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chart.js 2011-09-29 06:40:09 +0000
@@ -33,38 +33,32 @@
function showChartDetails( chartId )
{
- var request = new Request();
- request.setResponseTypeXML( 'chart' );
- request.setCallbackSuccess( chartReceived );
- request.send( 'getChart.action?id=' + chartId );
-}
-
-function chartReceived( xmlObject )
-{
- var indicators = parseInt( getElementValue( xmlObject, 'indicators' ) );
- var dataElements = parseInt( getElementValue( xmlObject, 'dataElements' ) );
-
- setInnerHTML( 'titleField', getElementValue( xmlObject, 'title' ) );
- setInnerHTML( 'dimensionField', getElementValue( xmlObject, 'dimension' ) );
-
- if ( dataElements === 0 )
- {
- $( '#dataElementsView' ).hide();
- $( '#indicatorsView' ).show();
-
- $( '#indicatorsField' ).text( indicators );
- } else
- {
- $( '#dataElementsView' ).show();
- $( '#indicatorsView' ).hide();
-
- $( '#dataElementsField' ).text( dataElements );
- }
-
- setInnerHTML( 'periodsField', getElementValue( xmlObject, 'periods' ) );
- setInnerHTML( 'organisationUnitsField', getElementValue( xmlObject, 'organisationUnits' ) );
-
- showDetails();
+ jQuery.post( 'getChart.action', { id: chartId }, function ( json ) {
+ var indicators = parseInt( json.chart.indicators );
+ var dataElements = parseInt( json.chart.dataElements );
+
+ setInnerHTML( 'titleField', json.chart.title );
+ setInnerHTML( 'dimensionField', json.chart.dimension );
+
+ if ( dataElements === 0 )
+ {
+ $( '#dataElementsView' ).hide();
+ $( '#indicatorsView' ).show();
+
+ $( '#indicatorsField' ).text( indicators );
+ } else
+ {
+ $( '#dataElementsView' ).show();
+ $( '#indicatorsView' ).hide();
+
+ $( '#dataElementsField' ).text( dataElements );
+ }
+
+ setInnerHTML( 'periodsField', json.chart.periods );
+ setInnerHTML( 'organisationUnitsField', json.chart.organisationUnits );
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js 2011-07-21 06:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/chartGroup.js 2011-09-29 06:40:09 +0000
@@ -1,17 +1,11 @@
function showChartGroupDetails( chartGroupId )
{
- var request = new Request();
- request.setResponseTypeXML( 'chartGroup' );
- request.setCallbackSuccess( chartGroupReceived );
- request.send( 'getChartGroup.action?id=' + chartGroupId );
-}
-
-function chartGroupReceived( chartGroupElement )
-{
- setInnerHTML( 'nameField', getElementValue( chartGroupElement, 'name' ) );
- setInnerHTML( 'memberCountField', getElementValue( chartGroupElement, 'memberCount' ) );
-
- showDetails();
+ jQuery.post( 'getChartGroup.action', { id: chartGroupId }, function ( json ) {
+ setInnerHTML( 'nameField', json.chartGroup.name );
+ setInnerHTML( 'memberCountField', json.chartGroup.memberCount );
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportGroup.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportGroup.js 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportGroup.js 2011-09-29 06:40:09 +0000
@@ -1,17 +1,11 @@
function showReportGroupDetails( reportGroupId )
{
- var request = new Request();
- request.setResponseTypeXML( 'reportGroup' );
- request.setCallbackSuccess( reportGroupReceived );
- request.send( 'getReportGroup.action?id=' + reportGroupId );
-}
-
-function reportGroupReceived( reportGroupElement )
-{
- setInnerHTML( 'nameField', getElementValue( reportGroupElement, 'name' ) );
- setInnerHTML( 'memberCountField', getElementValue( reportGroupElement, 'memberCount' ) );
-
- showDetails();
+ jQuery.post( 'getReportGroup.action', { id: reportGroupId }, function ( json ) {
+ setInnerHTML( 'nameField', json.reportGroup.name );
+ setInnerHTML( 'memberCountField', json.reportGroup.memberCount );
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportTableGroup.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportTableGroup.js 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportTableGroup.js 2011-09-29 06:40:09 +0000
@@ -1,17 +1,12 @@
function showReportTableGroupDetails( reportTableGroupId )
{
- var request = new Request();
- request.setResponseTypeXML( 'reportTableGroup' );
- request.setCallbackSuccess( reportTableGroupReceived );
- request.send( 'getReportTableGroup.action?id=' + reportTableGroupId );
-}
-
-function reportTableGroupReceived( reportTableGroupElement )
-{
- setInnerHTML( 'nameField', getElementValue( reportTableGroupElement, 'name' ) );
- setInnerHTML( 'memberCountField', getElementValue( reportTableGroupElement, 'memberCount' ) );
-
- showDetails();
+ jQuery.post( 'getReportTableGroup.action', { id: reportTableGroupId },
+ function ( json ) {
+ setInnerHTML( 'nameField', json.reportTableGroup.name );
+ setInnerHTML( 'memberCountField', json.reportTableGroup.memberCount );
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2011-09-14 15:17:22 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2011-09-29 06:40:09 +0000
@@ -148,23 +148,17 @@
function showTableDetails( tableId )
{
- var request = new Request();
- request.setResponseTypeXML( 'reportTable' );
- request.setCallbackSuccess( tableReceived );
- request.send( 'getTable.action?id=' + tableId );
-}
-
-function tableReceived( xmlObject )
-{
- setInnerHTML( 'nameField', getElementValue( xmlObject, 'name' ) );
- setInnerHTML( 'indicatorsField', getElementValue( xmlObject, 'indicators' ) );
- setInnerHTML( 'periodsField', getElementValue( xmlObject, 'periods' ) );
- setInnerHTML( 'unitsField', getElementValue( xmlObject, 'units' ) );
- setInnerHTML( 'doIndicatorsField', parseBool( getElementValue( xmlObject, 'doIndicators' ) ) );
- setInnerHTML( 'doPeriodsField', parseBool( getElementValue( xmlObject, 'doPeriods' ) ) );
- setInnerHTML( 'doUnitsField', parseBool( getElementValue( xmlObject, 'doUnits' ) ) );
-
- showDetails();
+ jQuery.post( 'getTable.action', { id: tableId }, function ( json ) {
+ setInnerHTML( 'nameField', json.table.name );
+ setInnerHTML( 'indicatorsField', json.table.indicators );
+ setInnerHTML( 'periodsField', json.table.periods );
+ setInnerHTML( 'unitsField', json.table.units );
+ setInnerHTML( 'doIndicatorsField', parseBool( json.table.doIndicators ) );
+ setInnerHTML( 'doPeriodsField', parseBool( json.table.doPeriods ) );
+ setInnerHTML( 'doUnitsField', parseBool( json.table.doUnits ) );
+
+ showDetails();
+ });
}
function parseBool( bool )
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChart.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,11 @@
+{ "chart":
+ {
+ "id": "$!{chart.id}",
+ "title": "$!encoder.jsonEncode( ${chart.title} )",
+ "dimension": "$!encoder.jsonEncode( ${chart.dimension} )",
+ "indicators": "$!{chart.indicators.size()}",
+ "dataElements": "$!{chart.dataElements.size()}",
+ "periods": "$!{chart.periods.size()}",
+ "organisationUnits": "$!{chart.organisationUnits.size()}"
+ }
+}
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChartGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChartGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonChartGroup.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,7 @@
+{ "chartGroup":
+ {
+ "id": "$!{chartGroup.id}",
+ "name": "$!encoder.jsonEncode( ${chartGroup.name} )",
+ "memberCount": "${chartGroup.getMembers().size()}"
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportGroup.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,7 @@
+{ "reportGroup":
+ {
+ "id": "$!{reportGroup.id}",
+ "name": "$!encoder.jsonEncode( ${reportGroup.name} )",
+ "memberCount": "$!{reportGroup.getMembers().size()}"
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportTableGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportTableGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonReportTableGroup.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,7 @@
+{ "reportTableGroup":
+ {
+ "id": "${reportTableGroup.id}",
+ "name": "$!encoder.jsonEncode( ${reportTableGroup.name} )",
+ "memberCount": "$!{reportTableGroup.getMembers().size()}"
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonTable.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonTable.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/jsonTable.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,12 @@
+{ "table":
+ {
+ "id": "$!{table.id}",
+ "name": "$!encoder.jsonEncode( ${table.name} )",
+ "indicators": "$!{table.indicators.size()}",
+ "periods": "$!{table.periods.size()}",
+ "units": "$!{table.units.size()}",
+ "doIndicators": "$!{table.doIndicators}",
+ "doPeriods": "$!{table.doPeriods}",
+ "doUnits": "$!{table.doUnits}"
+ }
+}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChart.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChart.vm 2011-06-10 13:15:44 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChart.vm 1970-01-01 00:00:00 +0000
@@ -1,10 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<chart>
- <id>$chart.id</id>
- <title>$encoder.xmlEncode( $chart.title )</title>
- <dimension>$encoder.xmlEncode( $chart.dimension )</dimension>
- <indicators>$chart.indicators.size()</indicators>
- <dataElements>$chart.dataElements.size()</dataElements>
- <periods>$chart.periods.size()</periods>
- <organisationUnits>$chart.organisationUnits.size()</organisationUnits>
-</chart>
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm 2011-07-21 06:51:02 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseChartGroup.vm 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<chartGroup>
- <id>$chartGroup.id</id>
- <name>$!encoder.xmlEncode( $chartGroup.name )</name>
- <memberCount>$chartGroup.getMembers().size()</memberCount>
-</chartGroup>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportGroup.vm 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportGroup.vm 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<reportGroup>
- <id>$reportGroup.id</id>
- <name>$!encoder.xmlEncode( $reportGroup.name )</name>
- <memberCount>$reportGroup.getMembers().size()</memberCount>
-</reportGroup>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableGroup.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableGroup.vm 2011-07-21 09:09:42 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseReportTableGroup.vm 1970-01-01 00:00:00 +0000
@@ -1,6 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<reportTableGroup>
- <id>$reportTableGroup.id</id>
- <name>$!encoder.xmlEncode( $reportTableGroup.name )</name>
- <memberCount>$reportTableGroup.getMembers().size()</memberCount>
-</reportTableGroup>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseTable.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseTable.vm 2011-03-20 22:35:55 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/responseTable.vm 1970-01-01 00:00:00 +0000
@@ -1,11 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<table>
- <id>$table.id</id>
- <name>$encoder.xmlEncode( $table.name )</name>
- <indicators>$table.indicators.size()</indicators>
- <periods>$table.periods.size()</periods>
- <units>$table.units.size()</units>
- <doIndicators>$table.doIndicators</doIndicators>
- <doPeriods>$table.doPeriods</doPeriods>
- <doUnits>$table.doUnits</doUnits>
-</table>
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2011-09-26 09:31:56 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/struts.xml 2011-09-29 06:40:09 +0000
@@ -25,7 +25,8 @@
</action>
<action name="getValidationRule" class="org.hisp.dhis.validationrule.action.GetValidationRuleAction">
- <result name="success" type="velocity-xml">/dhis-web-validationrule/responseValidationRule.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-validationrule/jsonValidationRule.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
<action name="showAddValidationRuleForm" class="org.hisp.dhis.validationrule.action.GetPeriodTypesAction">
@@ -88,7 +89,8 @@
</action>
<action name="getValidationRuleGroup" class="org.hisp.dhis.validationrule.action.validationrulegroup.GetValidationRuleGroupAction">
- <result name="success" type="velocity-xml">/dhis-web-validationrule/responseValidationRuleGroup.vm</result>
+ <result name="success" type="velocity-json">/dhis-web-validationrule/jsonValidationRuleGroup.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
</action>
<action name="removeValidationRuleGroup" class="org.hisp.dhis.validationrule.action.validationrulegroup.RemoveValidationRuleGroupAction">
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/general.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/general.js 2011-07-28 08:10:02 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/general.js 2011-09-29 06:40:09 +0000
@@ -1,29 +1,23 @@
function showValidationRuleDetails( validationId )
{
- var request = new Request();
- request.setResponseTypeXML( 'validationRule' );
- request.setCallbackSuccess( validationRuleReceived );
- request.send( 'getValidationRule.action?id=' + validationId );
-}
-
-function validationRuleReceived( validationElement )
-{
- setInnerHTML( 'nameField', getElementValue( validationElement, 'name' ) );
-
- var description = getElementValue( validationElement, 'description' );
- setInnerHTML( 'descriptionField', description ? description : '[' + i18n_none + ']' );
-
- var leftSideDescription = getElementValue( validationElement, 'leftSideDescription' );
- setInnerHTML( 'leftSideDescriptionField', leftSideDescription ? leftSideDescription : '[' + i18n_none + ']' );
-
- var operator = getElementValue( validationElement, 'operator' );
- setInnerHTML( 'operatorField', i18nalizeOperator( operator ) );
-
- var rightSideDescription = getElementValue( validationElement, 'rightSideDescription' );
- setInnerHTML( 'rightSideDescriptionField', rightSideDescription ? rightSideDescription : '[' + i18n_none + ']' );
-
- showDetails();
+ jQuery.post( 'getValidationRule.action', { id: validationId }, function ( json ) {
+ setInnerHTML( 'nameField', json.validationRule.name );
+
+ var description = json.validationRule.description;
+ setInnerHTML( 'descriptionField', description ? description : '[' + i18n_none + ']' );
+
+ var leftSideDescription = json.validationRule.leftSideDescription;
+ setInnerHTML( 'leftSideDescriptionField', leftSideDescription ? leftSideDescription : '[' + i18n_none + ']' );
+
+ var operator = json.validationRule.operator;
+ setInnerHTML( 'operatorField', i18nalizeOperator( operator ) );
+
+ var rightSideDescription = json.validationRule.rightSideDescription;
+ setInnerHTML( 'rightSideDescriptionField', rightSideDescription ? rightSideDescription : '[' + i18n_none + ']' );
+
+ showDetails();
+ });
}
function i18nalizeOperator( operator )
=== modified file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRuleGroup.js'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRuleGroup.js 2011-08-19 21:33:57 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/javascript/validationRuleGroup.js 2011-09-29 06:40:09 +0000
@@ -4,19 +4,13 @@
function showValidationRuleGroupDetails( id )
{
- var request = new Request();
- request.setResponseTypeXML( 'validationRuleGroup' );
- request.setCallbackSuccess( validationRuleGroupReceived );
- request.send( 'getValidationRuleGroup.action?id=' + id );
-}
-
-function validationRuleGroupReceived( xmlObject )
-{
- setInnerHTML( 'nameField', getElementValue( xmlObject, 'name' ) );
- setInnerHTML( 'descriptionField', getElementValue( xmlObject, 'description' ) );
- setInnerHTML( 'memberCountField', getElementValue( xmlObject, 'memberCount' ) );
-
- showDetails();
+ jQuery.post( 'getValidationRuleGroup.action', { 'id': id }, function ( json ) {
+ setInnerHTML( 'nameField', json.validationRuleGroup.name );
+ setInnerHTML( 'descriptionField', json.validationRuleGroup.description );
+ setInnerHTML( 'memberCountField', json.validationRuleGroup.memberCount );
+
+ showDetails();
+ });
}
// -----------------------------------------------------------------------------
=== added file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRule.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRule.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRule.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,10 @@
+{ "validationRule":
+ {
+ "name": "$!encoder.jsonEncode( ${validationRule.name} )",
+ "description": "$!encoder.jsonEncode( ${validationRule.description} )",
+ "type": "$!encoder.jsonEncode( ${validationRule.type} )",
+ "operator": "${validationRule.operator}",
+ "leftSideDescription": "$!encoder.jsonEncode( ${validationRule.leftSide.description} )",
+ "rightSideDescription": "$!encoder.jsonEncode( ${validationRule.rightSide.description} )"
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRuleGroup.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRuleGroup.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/jsonValidationRuleGroup.vm 2011-09-29 06:40:09 +0000
@@ -0,0 +1,8 @@
+{ "validationRuleGroup":
+ {
+ "id": "$!{validationRuleGroup.id}",
+ "name": "$!encoder.jsonEncode( ${validationRuleGroup.name} )",
+ "description": "$!encoder.jsonEncode( ${validationRuleGroup.description} )",
+ "memberCount": "$!{memberCount}"
+ }
+}
=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRule.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRule.vm 2011-05-31 05:38:55 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRule.vm 1970-01-01 00:00:00 +0000
@@ -1,9 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<validationRule>
- <name>$!encoder.xmlEncode( $validationRule.name )</name>
- <description>$!encoder.xmlEncode( $validationRule.description )</description>
- <type>$!encoder.xmlEncode( $validationRule.type )</type>
- <operator>$validationRule.operator</operator>
- <leftSideDescription>$!encoder.xmlEncode( $validationRule.leftSide.description )</leftSideDescription>
- <rightSideDescription>$!encoder.xmlEncode( $validationRule.rightSide.description )</rightSideDescription>
-</validationRule>
\ No newline at end of file
=== removed file 'dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRuleGroup.vm'
--- dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRuleGroup.vm 2009-09-05 09:34:43 +0000
+++ dhis-2/dhis-web/dhis-web-validationrule/src/main/webapp/dhis-web-validationrule/responseValidationRuleGroup.vm 1970-01-01 00:00:00 +0000
@@ -1,7 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<validationRuleGroup>
- <id>$!validationRuleGroup.id</id>
- <name>$!encoder.xmlEncode( $validationRuleGroup.name )</name>
- <description>$!encoder.xmlEncode( $validationRuleGroup.description )</description>
- <memberCount>$memberCount</memberCount>
-</validationRuleGroup>