← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 4008: indentation fixes

 

------------------------------------------------------------
revno: 4008
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2011-06-23 17:38:00 +0300
message:
  indentation fixes
modified:
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/criteria.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js
  dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportConfiguration.js
  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/tallySheet.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-reporting/src/main/webapp/dhis-web-reporting/javascript/criteria.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/criteria.js	2011-03-15 23:26:14 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/criteria.js	2011-06-23 14:38:00 +0000
@@ -1,37 +1,35 @@
-
 // -------------------------------------------------------------------------
 // Public methods
 // -------------------------------------------------------------------------
 
 function toggleDataType()
-{	
-  $( "#indicatorGroupDiv" ).toggle();
-  $( "#dataElementGroupDiv" ).toggle();
+{
+    $( "#indicatorGroupDiv" ).toggle();
+    $( "#dataElementGroupDiv" ).toggle();
 }
 
 function showCriteria()
 {
-  $( "div#criteria" ).show( "fast" );
+    $( "div#criteria" ).show( "fast" );
 }
 
 function hideCriteria()
 {
-  $( "div#criteria" ).hide( "fast" );
+    $( "div#criteria" ).hide( "fast" );
 }
 
 function showPivot()
 {
-  $( "div#pivot" ).show( "fast" );
+    $( "div#pivot" ).show( "fast" );
 }
 
 function hidePivot()
 {
-  $( "div#pivot" ).hide( "fast" );
+    $( "div#pivot" ).hide( "fast" );
 }
 
 function hideDivs()
 {
-  hideCriteria();
-  hidePivot();
+    hideCriteria();
+    hidePivot();
 }
-

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js	2011-03-19 22:30:32 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataCompleteness.js	2011-06-23 14:38:00 +0000
@@ -1,59 +1,59 @@
-
 var isOrganisationUnit = false;
 
 function organisationUnitSelected( units )
 {
-	isOrganisationUnit = units && units.length > 0;
+    isOrganisationUnit = units && units.length > 0;
 }
 
 function getPeriods( periodTypeList, availableList, selectedList, timespan )
 {
-	$( "#periodId" ).removeAttr( "disabled" );
-	
-	getAvailablePeriods( periodTypeList, availableList, selectedList, timespan );
+    $( "#periodId" ).removeAttr( "disabled" );
+
+    getAvailablePeriods( periodTypeList, availableList, selectedList, timespan );
 }
 
 function displayCompleteness()
 {
     var criteria = $( "input[name='criteria']:checked" ).val();
     var dataSetId = $( "#dataSetId" ).val();
-    var periodList = byId( "periodId" );    
+    var periodList = byId( "periodId" );
     var periodId = periodList.options.length > 0 ? $( "#periodId" ).val() : null;
-    
-	if ( !completenessIsValid( periodId ) )
-	{
-		return false;
-	}
-	
+
+    if ( !completenessIsValid( periodId ) )
+    {
+        return false;
+    }
+
     showLoader();
-        
-    var url = "getDataCompleteness.action" + "?periodId=" + periodId + "&criteria=" + criteria + 
-    	"&dataSetId=" + dataSetId + "&type=html";
-        
-    $( "#contentDiv" ).load( url, function() {
-    	hideLoader();
+
+    var url = "getDataCompleteness.action" + "?periodId=" + periodId + "&criteria=" + criteria + "&dataSetId="
+            + dataSetId + "&type=html";
+
+    $( "#contentDiv" ).load( url, function()
+    {
+        hideLoader();
         pageInit();
     } );
 }
 
 function completenessIsValid( periodId )
 {
-	if ( !isOrganisationUnit )
-	{
-		setHeaderDelayMessage( i18n_please_select_org_unit );
-		return false;
-	}
-	
-	if ( periodId == null )
-	{
-		setHeaderDelayMessage( i18n_please_select_period );
-		return false;
-	}
-	
-	return true;
+    if ( !isOrganisationUnit )
+    {
+        setHeaderDelayMessage( i18n_please_select_org_unit );
+        return false;
+    }
+
+    if ( periodId == null )
+    {
+        setHeaderDelayMessage( i18n_please_select_period );
+        return false;
+    }
+
+    return true;
 }
 
 function getCompleteness( type )
 {
-	window.location.href = "getDataCompleteness.action?type=" + type;
+    window.location.href = "getDataCompleteness.action?type=" + type;
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2011-05-31 11:18:52 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/dataSetReport.js	2011-06-23 14:38:00 +0000
@@ -1,4 +1,3 @@
-
 // -----------------------------------------------------------------------------
 // Validation
 // ----------------------------------------------------------------------------
@@ -10,16 +9,16 @@
     selectedOrganisationUnitIds = ids;
 }
 
-if ( typeof( selectionTreeSelection ) != "undefined" )
+if ( typeof ( selectionTreeSelection ) != "undefined" )
 {
     selectionTreeSelection.setListenerFunction( setSelectedOrganisationUnitIds );
 }
 
 function getPeriods( periodTypeList, availableList, selectedList, timespan )
 {
-	$( "#periodId" ).removeAttr( "disabled" );
-	
-	getAvailablePeriods( periodTypeList, availableList, selectedList, timespan );
+    $( "#periodId" ).removeAttr( "disabled" );
+
+    getAvailablePeriods( periodTypeList, availableList, selectedList, timespan );
 }
 
 function validateDataSetReport()
@@ -39,12 +38,12 @@
         setMessage( i18n_select_organisation_unit );
         return false;
     }
-    
-    document.getElementById( "reportForm" ).submit();
+
+    document.getElementById( "reportForm" ).submit();
 }
 
 function exportDataSetReport( type )
 {
-	var url = "generateDataSetReport.action?useLast=true&dataSetId=" + $( "#dataSetId" ).val() + "&type=" + type;
-	window.location.href = url;
+    var url = "generateDataSetReport.action?useLast=true&dataSetId=" + $( "#dataSetId" ).val() + "&type=" + type;
+    window.location.href = url;
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js	2010-09-16 09:43:15 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/document.js	2011-06-23 14:38:00 +0000
@@ -1,16 +1,15 @@
-
 function removeDocument( id )
 {
-	removeItem( id, "", i18n_confirm_remove_report, "removeDocument.action" );
+    removeItem( id, "", i18n_confirm_remove_report, "removeDocument.action" );
 }
 
 function addDocumentToDashboard( id )
 {
     var dialog = window.confirm( i18n_confirm_add_to_dashboard );
-    
+
     if ( dialog )
     {
-        var request = new Request(); 
+        var request = new Request();
         request.send( "addDocumentToDashboard.action?id=" + id );
     }
 }
@@ -18,22 +17,21 @@
 function toggleExternal()
 {
     var external = getListValue( "external" );
-    
+
     if ( external == "true" )
     {
         document.getElementById( "fileDiv" ).style.display = "none";
         document.getElementById( "urlDiv" ).style.display = "block";
-		$('#url').attr('class','{validate:{required:true}}');
-		$('#upload').attr('class','');
-    }
-    else
+        $( '#url' ).attr( 'class', '{validate:{required:true}}' );
+        $( '#upload' ).attr( 'class', '' );
+    } else
     {
         document.getElementById( "fileDiv" ).style.display = "block";
         document.getElementById( "urlDiv" ).style.display = "none";
-		if( byId('id').value == "")
-		{
-			$('#upload').attr('class','{validate:{required:true}}');
-			$('#url').attr('class','');
-		}
+        if ( byId( 'id' ).value == "" )
+        {
+            $( '#upload' ).attr( 'class', '{validate:{required:true}}' );
+            $( '#url' ).attr( 'class', '' );
+        }
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2011-03-10 10:22:31 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/generateReport.js	2011-06-23 14:38:00 +0000
@@ -1,4 +1,3 @@
-
 var MODE_REPORT = "report";
 var MODE_TABLE = "table";
 
@@ -12,7 +11,7 @@
 
 function paramOrganisationUnitSet( id )
 {
-	paramOrganisationUnit = id;
+    paramOrganisationUnit = id;
 }
 
 // -----------------------------------------------------------------------------
@@ -21,14 +20,14 @@
 
 function validationError()
 {
-	if ( $( "#selectionTree" ).length && paramOrganisationUnit == null )
-	{
-		setMessage( i18n_please_select_unit );
-		return true;
-	}
-	
-	return false;
-}	
+    if ( $( "#selectionTree" ).length && paramOrganisationUnit == null )
+    {
+        setMessage( i18n_please_select_unit );
+        return true;
+    }
+
+    return false;
+}
 
 // -----------------------------------------------------------------------------
 // Report
@@ -36,38 +35,37 @@
 
 function generateReport( type )
 {
-	reportType = type != null && type != "" ? type : "pdf";
-	
-	if ( validationError() )
-	{
-		return false;
-	}
-		
+    reportType = type != null && type != "" ? type : "pdf";
+
+    if ( validationError() )
+    {
+        return false;
+    }
+
     setWaitMessage( i18n_please_wait );
-    
+
     var doDataMart = ( $( "#doDataMart" ).length && $( "#doDataMart" ).val() == "true" );
-    
+
     if ( doDataMart )
-    {    
-	    var url = "createTable.action?" + getUrlParams();
-	    
-	    var request = new Request();
-	    request.setCallbackSuccess( getReportStatus );    
-	    request.send( url );
-    }
-    else
-    {
-    	viewReport();
+    {
+        var url = "createTable.action?" + getUrlParams();
+
+        var request = new Request();
+        request.setCallbackSuccess( getReportStatus );
+        request.send( url );
+    } else
+    {
+        viewReport();
     }
 }
 
 function getReportStatus()
-{   
+{
     var url = "getStatus.action";
-    
+
     var request = new Request();
     request.setResponseTypeXML( "status" );
-    request.setCallbackSuccess( reportStatusReceived );    
+    request.setCallbackSuccess( reportStatusReceived );
     request.send( url );
 }
 
@@ -75,13 +73,12 @@
 {
     var statusMessage = getElementValue( xmlObject, "statusMessage" );
     var finished = getElementValue( xmlObject, "finished" );
-    
+
     if ( finished == "true" )
     {
         setMessage( i18n_process_completed );
-    	viewReport();
-    }
-    else
+        viewReport();
+    } else
     {
         setTimeout( "getReportStatus();", 1500 );
     }
@@ -89,35 +86,35 @@
 
 function viewReport( urlParams )
 {
-	var mode = $( "#mode" ).val();
-	
-	setMessage( i18n_process_completed );
-	
+    var mode = $( "#mode" ).val();
+
+    setMessage( i18n_process_completed );
+
     if ( mode == MODE_REPORT )
     {
-    	window.location.href = "renderReport.action?type=" + reportType + "&" + getUrlParams();
-    }
-    else // MODE_TABLE
+        window.location.href = "renderReport.action?type=" + reportType + "&" + getUrlParams();
+    } else
+    // MODE_TABLE
     {
-    	window.location.href = "exportTable.action?type=html&" + getUrlParams();
+        window.location.href = "exportTable.action?type=html&" + getUrlParams();
     }
 }
 
 function getUrlParams()
 {
-	 var url = "id=" + $( "#id" ).val() + "&mode=" + $( "#mode" ).val();
-	    
+    var url = "id=" + $( "#id" ).val() + "&mode=" + $( "#mode" ).val();
+
     if ( $( "#reportingPeriod" ).length )
     {
         url += "&reportingPeriod=" + $( "#reportingPeriod" ).val();
     }
-        
+
     if ( paramOrganisationUnit != null )
     {
         url += "&organisationUnitId=" + paramOrganisationUnit;
     }
-	
-	return url;
+
+    return url;
 }
 
 // -----------------------------------------------------------------------------
@@ -126,9 +123,9 @@
 
 function exportReport( type )
 {
-	var url = "exportTable.action?type=" + type + "&useLast=true";
-	
-	url += $( "#id" ).length ? ( "&id=" + $( "#id" ).val() ) : "";
-	
-	window.location.href = url;
+    var url = "exportTable.action?type=" + type + "&useLast=true";
+
+    url += $( "#id" ).length ? ( "&id=" + $( "#id" ).val() ) : "";
+
+    window.location.href = url;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js	2011-01-31 19:47:04 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/lists.js	2011-06-23 14:38:00 +0000
@@ -1,40 +1,39 @@
-
 // -------------------------------------------------------------------------
 // Data retrieval methods
 // -------------------------------------------------------------------------
 
 function getDataElements()
 {
-	var dataElementGroupList = document.getElementById( "dataElementGroupId" );
-	var dataElementGroupId = dataElementGroupList.options[ dataElementGroupList.selectedIndex ].value;
-	
-	if ( dataElementGroupId != null )
-	{
-		var url = "../dhis-web-commons-ajax/getDataElements.action?id=" + dataElementGroupId + "&aggregate=true";
-				
-		var request = new Request();
-	    request.setResponseTypeXML( 'dataElement' );
-	    request.setCallbackSuccess( getDataElementsReceived );
-	    request.send( url );
-	}
+    var dataElementGroupList = document.getElementById( "dataElementGroupId" );
+    var dataElementGroupId = dataElementGroupList.options[dataElementGroupList.selectedIndex].value;
+
+    if ( dataElementGroupId != null )
+    {
+        var url = "../dhis-web-commons-ajax/getDataElements.action?id=" + dataElementGroupId + "&aggregate=true";
+
+        var request = new Request();
+        request.setResponseTypeXML( 'dataElement' );
+        request.setCallbackSuccess( getDataElementsReceived );
+        request.send( url );
+    }
 }
 
 function getDataElementsReceived( xmlObject )
-{   
+{
     var availableDataElements = document.getElementById( "availableDataElements" );
     var selectedDataElements = document.getElementById( "selectedDataElements" );
-    
+
     clearList( availableDataElements );
-    
+
     var dataElements = xmlObject.getElementsByTagName( "dataElement" );
-    
+
     for ( var i = 0; i < dataElements.length; i++ )
     {
-        var id = dataElements[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var dataElementName = dataElements[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
+        var id = dataElements[i].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+        var dataElementName = dataElements[i].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
         if ( listContains( selectedDataElements, id ) == false )
-        {               
+        {
             var option = document.createElement( "option" );
             option.value = id;
             option.text = dataElementName;
@@ -46,11 +45,11 @@
 function getCategoryComboDataElements()
 {
     var categoryComboId = getListValue( "categoryComboId" );
-    
+
     if ( categoryComboId != null )
     {
         var url = "getCategoryComboDataElements.action?categoryComboId=" + categoryComboId;
-        
+
         var request = new Request();
         request.setResponseTypeXML( 'dataElement' );
         request.setCallbackSuccess( getCategoryComboDataElementsReceived );
@@ -59,20 +58,20 @@
 }
 
 function getCategoryComboDataElementsReceived( xmlObject )
-{   
+{
     var availableDataElements = document.getElementById( "availableDataElements" );
     var selectedDataElements = document.getElementById( "selectedDataElements" );
-    
+
     clearList( availableDataElements );
     clearList( selectedDataElements );
-    
+
     var dataElements = xmlObject.getElementsByTagName( "dataElement" );
-    
+
     for ( var i = 0; i < dataElements.length; i++ )
     {
-        var id = dataElements[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var dataElementName = dataElements[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
+        var id = dataElements[i].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+        var dataElementName = dataElements[i].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
         var option = document.createElement( "option" );
         option.value = id;
         option.text = dataElementName;
@@ -82,36 +81,36 @@
 
 function getIndicators()
 {
-	var indicatorGroupList = document.getElementById( "indicatorGroupId" );
-	var indicatorGroupId = indicatorGroupList.options[ indicatorGroupList.selectedIndex ].value;
-	
-	if ( indicatorGroupId != null )
-	{
-		var url = "../dhis-web-commons-ajax/getIndicators.action?id=" + indicatorGroupId;
-		
-		var request = new Request();
-	    request.setResponseTypeXML( 'indicator' );
-	    request.setCallbackSuccess( getIndicatorsReceived );
-	    request.send( url );	    
-	}
+    var indicatorGroupList = document.getElementById( "indicatorGroupId" );
+    var indicatorGroupId = indicatorGroupList.options[indicatorGroupList.selectedIndex].value;
+
+    if ( indicatorGroupId != null )
+    {
+        var url = "../dhis-web-commons-ajax/getIndicators.action?id=" + indicatorGroupId;
+
+        var request = new Request();
+        request.setResponseTypeXML( 'indicator' );
+        request.setCallbackSuccess( getIndicatorsReceived );
+        request.send( url );
+    }
 }
 
 function getIndicatorsReceived( xmlObject )
-{   
+{
     var availableIndicators = document.getElementById( "availableIndicators" );
     var selectedIndicators = document.getElementById( "selectedIndicators" );
-    
+
     clearList( availableIndicators );
-    
+
     var indicators = xmlObject.getElementsByTagName( "indicator" );
-    
+
     for ( var i = 0; i < indicators.length; i++ )
     {
-        var id = indicators[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var indicatorName = indicators[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
+        var id = indicators[i].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+        var indicatorName = indicators[i].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
         if ( listContains( selectedIndicators, id ) == false )
-        {               
+        {
             var option = document.createElement( "option" );
             option.value = id;
             option.text = indicatorName;
@@ -122,36 +121,36 @@
 
 function getOrganisationUnits()
 {
-	var organisationUnitLevelList = document.getElementById( "organisationUnitLevel" );
-	var organisationUnitLevel = organisationUnitLevelList.options[ organisationUnitLevelList.selectedIndex ].value;
-	
-	if ( organisationUnitLevel != null )
-	{
-		var url = "../dhis-web-commons-ajax/getOrganisationUnits.action?level=" + organisationUnitLevel;
-		
-		var request = new Request();
-	    request.setResponseTypeXML( 'organisationUnit' );
-	    request.setCallbackSuccess( getOrganisationUnitsReceived );
-	    request.send( url );	    
-	}
+    var organisationUnitLevelList = document.getElementById( "organisationUnitLevel" );
+    var organisationUnitLevel = organisationUnitLevelList.options[organisationUnitLevelList.selectedIndex].value;
+
+    if ( organisationUnitLevel != null )
+    {
+        var url = "../dhis-web-commons-ajax/getOrganisationUnits.action?level=" + organisationUnitLevel;
+
+        var request = new Request();
+        request.setResponseTypeXML( 'organisationUnit' );
+        request.setCallbackSuccess( getOrganisationUnitsReceived );
+        request.send( url );
+    }
 }
 
 function getOrganisationUnitsReceived( xmlObject )
-{   
+{
     var availableOrganisationUnits = document.getElementById( "availableOrganisationUnits" );
     var selectedOrganisationUnits = document.getElementById( "selectedOrganisationUnits" );
-    
+
     clearList( availableOrganisationUnits );
-    
+
     var organisationUnits = xmlObject.getElementsByTagName( "organisationUnit" );
-    
+
     for ( var i = 0; i < organisationUnits.length; i++ )
     {
-        var id = organisationUnits[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var organisationUnitName = organisationUnits[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
+        var id = organisationUnits[i].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+        var organisationUnitName = organisationUnits[i].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
         if ( listContains( selectedOrganisationUnits, id ) == false )
-        {                       
+        {
             var option = document.createElement( "option" );
             option.value = id;
             option.text = organisationUnitName;
@@ -163,32 +162,32 @@
 function getOrganisationUnitsToSelected()
 {
     var organisationUnitLevelList = document.getElementById( "organisationUnitLevel" );
-    var organisationUnitLevel = organisationUnitLevelList.options[ organisationUnitLevelList.selectedIndex ].value;
-    
+    var organisationUnitLevel = organisationUnitLevelList.options[organisationUnitLevelList.selectedIndex].value;
+
     if ( organisationUnitLevel != null )
     {
         var url = "../dhis-web-commons-ajax/getOrganisationUnits.action?level=" + organisationUnitLevel;
-        
+
         var request = new Request();
         request.setResponseTypeXML( 'organisationUnit' );
         request.setCallbackSuccess( getOrganisationUnitsToSelectedReceived );
-        request.send( url );        
+        request.send( url );
     }
 }
 
 function getOrganisationUnitsToSelectedReceived( xmlObject )
-{   
+{
     var selectedOrganisationUnits = document.getElementById( "selectedOrganisationUnits" );
-    
+
     clearList( selectedOrganisationUnits );
-    
+
     var organisationUnits = xmlObject.getElementsByTagName( "organisationUnit" );
-    
+
     for ( var i = 0; i < organisationUnits.length; i++ )
     {
-        var id = organisationUnits[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var organisationUnitName = organisationUnits[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
+        var id = organisationUnits[i].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+        var organisationUnitName = organisationUnits[i].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
         var option = document.createElement( "option" );
         option.value = id;
         option.text = organisationUnitName;
@@ -198,32 +197,32 @@
 
 function getOrganisationUnitChildren()
 {
-	var organisationUnitList = document.getElementById( "availableOrganisationUnits" );
-	var organisationUnitId = organisationUnitList.options[ organisationUnitList.selectedIndex ].value;
-	
-	if ( organisationUnitId != null )
-	{
-		var url = "../dhis-web-commons-ajax/getOrganisationUnitChildren.action?id=" + organisationUnitId;
-		
-		var request = new Request();
-	    request.setResponseTypeXML( 'organisationUnit' );
-	    request.setCallbackSuccess( getOrganisationUnitChildrenReceived );
-	    request.send( url );	
-	}
+    var organisationUnitList = document.getElementById( "availableOrganisationUnits" );
+    var organisationUnitId = organisationUnitList.options[organisationUnitList.selectedIndex].value;
+
+    if ( organisationUnitId != null )
+    {
+        var url = "../dhis-web-commons-ajax/getOrganisationUnitChildren.action?id=" + organisationUnitId;
+
+        var request = new Request();
+        request.setResponseTypeXML( 'organisationUnit' );
+        request.setCallbackSuccess( getOrganisationUnitChildrenReceived );
+        request.send( url );
+    }
 }
 
 function getOrganisationUnitChildrenReceived( xmlObject )
 {
     var selectedOrganisationUnits = document.getElementById( "selectedOrganisationUnits" );
-    
+
     var organisationUnits = xmlObject.getElementsByTagName( "organisationUnit" );
-    
+
     for ( var i = 0; i < organisationUnits.length; i++ )
     {
-        var id = organisationUnits[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        
-        var organisationUnitName = organisationUnits[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
+        var id = organisationUnits[i].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+
+        var organisationUnitName = organisationUnits[i].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
         if ( listContains( selectedOrganisationUnits, id ) == false )
         {
             var option = document.createElement( "option" );
@@ -237,12 +236,12 @@
 function getPeriodsToSelected()
 {
     var periodTypeList = document.getElementById( "periodTypeId" );
-    var periodTypeId = periodTypeList.options[ periodTypeList.selectedIndex ].value;
-    
+    var periodTypeId = periodTypeList.options[periodTypeList.selectedIndex].value;
+
     if ( periodTypeId != null )
-    {       
+    {
         var url = "../dhis-web-commons-ajax/getPeriods.action?name=" + periodTypeId;
-        
+
         var request = new Request();
         request.setResponseTypeXML( 'period' );
         request.setCallbackSuccess( getPeriodsToSelectedReceived );
@@ -251,18 +250,18 @@
 }
 
 function getPeriodsToSelectedReceived( xmlObject )
-{   
+{
     var selectedPeriods = document.getElementById( "selectedPeriods" );
-    
+
     clearList( selectedPeriods );
-    
+
     var periods = xmlObject.getElementsByTagName( "period" );
-    
-    for ( var i = 0; i < periods.length; i++)
+
+    for ( var i = 0; i < periods.length; i++ )
     {
-        var id = periods[ i ].getElementsByTagName( "id" )[0].firstChild.nodeValue;
-        var periodName = periods[ i ].getElementsByTagName( "name" )[0].firstChild.nodeValue;
-        
+        var id = periods[i].getElementsByTagName( "id" )[0].firstChild.nodeValue;
+        var periodName = periods[i].getElementsByTagName( "name" )[0].firstChild.nodeValue;
+
         var option = document.createElement( "option" );
         option.value = id;
         option.text = periodName;

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js	2011-02-28 02:42:12 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/orgUnitDistribution.js	2011-06-23 14:38:00 +0000
@@ -1,66 +1,77 @@
-
 var selectedOrganisationUnit = null;
 
-var distributionDivs = ["chartDiv","tableDiv","loaderDiv"];
-
-function organisationUnitSelected( units ) {
-	if ( units && units[0] ) {	
-		selectedOrganisationUnit = units[0];
-	}
-	else {
-		selectedOrganisationUnit = null;
-	}
-}
-
-function displayOrgUnitDistribution() {
-	if ( inputInvalid() ) {
-		return false;
-	}
-	
-	displayDiv( "loaderDiv", distributionDivs );
-	
-	var groupSetId = $( "#groupSetId" ).val();
-	var url = "getOrgUnitDistribution.action?groupSetId=" + groupSetId + "&type=html&r=" + getRandomNumber();
-	$( "#tableDiv" ).load( url, function() {
-		displayDiv( "tableDiv", distributionDivs );
-		pageInit();
-	} );
-}
-
-function getOrgUnitDistribution( type ) {	
-	if ( inputInvalid() ) {
-		return false;
-	}
-	
-	var groupSetId = $( "#groupSetId" ).val();
-	var url = "getOrgUnitDistribution.action?groupSetId=" + groupSetId + "&type=" + type + "&r=" + getRandomNumber();
-	window.location.href = url;
-}
-
-function displayOrgUnitDistributionChart() {
-	if ( inputInvalid() ) {
-		return false;
-	}
-	
-	displayDiv( "chartDiv", distributionDivs );
-	$( "#chartImg" ).attr( "src", "../images/ajax-loader-circle.gif" );
-	var groupSetId = $( "#groupSetId" ).val();
-	var source = "getOrgUnitDistributionChart.action?groupSetId=" + groupSetId + "&r=" + getRandomNumber();
-	$( "#chartImg" ).attr( "src", source );
-}
-
-function inputInvalid() {
-	var groupSetId = $( "#groupSetId" ).val();
-	
-	if ( groupSetId == null || groupSetId == 0 ) {
-		setHeaderDelayMessage( i18n_select_group_set );
-		return true;
-	}
-	
-	if ( selectedOrganisationUnit == null || selectedOrganisationUnit == "" ) {
-		setHeaderDelayMessage( i18n_select_org_unit );
-		return true;
-	}
-	
-	return false;
+var distributionDivs = [ "chartDiv", "tableDiv", "loaderDiv" ];
+
+function organisationUnitSelected( units )
+{
+    if ( units && units[0] )
+    {
+        selectedOrganisationUnit = units[0];
+    } else
+    {
+        selectedOrganisationUnit = null;
+    }
+}
+
+function displayOrgUnitDistribution()
+{
+    if ( inputInvalid() )
+    {
+        return false;
+    }
+
+    displayDiv( "loaderDiv", distributionDivs );
+
+    var groupSetId = $( "#groupSetId" ).val();
+    var url = "getOrgUnitDistribution.action?groupSetId=" + groupSetId + "&type=html&r=" + getRandomNumber();
+    $( "#tableDiv" ).load( url, function()
+    {
+        displayDiv( "tableDiv", distributionDivs );
+        pageInit();
+    } );
+}
+
+function getOrgUnitDistribution( type )
+{
+    if ( inputInvalid() )
+    {
+        return false;
+    }
+
+    var groupSetId = $( "#groupSetId" ).val();
+    var url = "getOrgUnitDistribution.action?groupSetId=" + groupSetId + "&type=" + type + "&r=" + getRandomNumber();
+    window.location.href = url;
+}
+
+function displayOrgUnitDistributionChart()
+{
+    if ( inputInvalid() )
+    {
+        return false;
+    }
+
+    displayDiv( "chartDiv", distributionDivs );
+    $( "#chartImg" ).attr( "src", "../images/ajax-loader-circle.gif" );
+    var groupSetId = $( "#groupSetId" ).val();
+    var source = "getOrgUnitDistributionChart.action?groupSetId=" + groupSetId + "&r=" + getRandomNumber();
+    $( "#chartImg" ).attr( "src", source );
+}
+
+function inputInvalid()
+{
+    var groupSetId = $( "#groupSetId" ).val();
+
+    if ( groupSetId == null || groupSetId == 0 )
+    {
+        setHeaderDelayMessage( i18n_select_group_set );
+        return true;
+    }
+
+    if ( selectedOrganisationUnit == null || selectedOrganisationUnit == "" )
+    {
+        setHeaderDelayMessage( i18n_select_org_unit );
+        return true;
+    }
+
+    return false;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js	2011-06-17 17:53:38 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js	2011-06-23 14:38:00 +0000
@@ -1,4 +1,3 @@
-
 // -----------------------------------------------------------------------------
 // Global variables
 // -----------------------------------------------------------------------------
@@ -6,7 +5,8 @@
 var indicators = []; // Array->associative array (id,name)
 var periods = []; // Array->associative array (id,name)
 var orgunits = []; // Array->associative array (id,name)
-var data = []; // Associative array [(indicator-period-orgunit), (indicatorValue)]
+var data = []; // Associative array [(indicator-period-orgunit),
+                // (indicatorValue)]
 
 var sizes = []; // Associative array (dimension, size)
 
@@ -33,73 +33,68 @@
  */
 function organisationUnitSelected( orgunits )
 {
-	organisationUnitId = orgunits ? orgunits[0] : null;
+    organisationUnitId = orgunits ? orgunits[0] : null;
 }
 
 /**
- * This method is called from the UI and is responsible for retrieving data from 
+ * This method is called from the UI and is responsible for retrieving data from
  * the server and setting the global variables.
  */
 function getData()
 {
-  if ( organisationUnitId == -1 )
-  {
-	setHeaderDelayMessage( i18n_selected_organisation_unit );
-  }
-  else
-  {
-	  clearGlobalVariables();
-	  
-	  var dataType = $( "#dataType" ).val();
-	  var indicatorGroupId = $( "#indicatorGroup" ).val();
-	  var dataElementGroupId = $( "#dataElementGroup" ).val();
-	  var startDate = $( "#startDate" ).val();
-	  var endDate = $( "#endDate" ).val();
-	  var periodTypeName = $( "#periodType" ).val();
-	  
-	  document.getElementById( "dataLabel" ).innerHTML = i18n_start_date + ": " + startDate + 
-		", " + i18n_end_date + ": " + endDate + ", " + i18n_period_type + ": " + periodTypeName;
-	  
-	  var url = "getPivotTable.action";
-	  
-	  var groupId = dataType == DATA_TYPE_INDICATOR ? indicatorGroupId : dataElementGroupId;
-	  
-	  currentDataType = dataType;
-	  
-	  hideDivs();
-	  
-	  showLoader();
-	  
-	  $.getJSON(
-		url,
-		{
-		  "dataType": dataType,
-		  "groupId": groupId,
-		  "periodTypeName": periodTypeName, 
-		  "startDate": startDate, 
-		  "endDate": endDate, 
-		  "organisationUnitId": organisationUnitId 
-		},
-		function( json ) 
-		{
-		  var pivot = json.pivotTable;
-		  
-		  indicators = pivot.indicators;
-		  periods = pivot.periods;
-		  orgunits = pivot.organisationUnits;
-		  
-		  sizes["indicator"] = pivot.sizeIndicators;
-		  sizes["period"] = pivot.sizePeriods;
-		  sizes["orgunit"] = pivot.sizeOrganisationUnits;
-		  
-		  data = pivot.indicatorValues[0];
-		  
-		  hideLoader();
-		  
-		  generateTable();
-		}
-	  );
-  }
+    if ( organisationUnitId == -1 )
+    {
+        setHeaderDelayMessage( i18n_selected_organisation_unit );
+    } else
+    {
+        clearGlobalVariables();
+
+        var dataType = $( "#dataType" ).val();
+        var indicatorGroupId = $( "#indicatorGroup" ).val();
+        var dataElementGroupId = $( "#dataElementGroup" ).val();
+        var startDate = $( "#startDate" ).val();
+        var endDate = $( "#endDate" ).val();
+        var periodTypeName = $( "#periodType" ).val();
+
+        document.getElementById( "dataLabel" ).innerHTML = i18n_start_date + ": " + startDate + ", " + i18n_end_date
+                + ": " + endDate + ", " + i18n_period_type + ": " + periodTypeName;
+
+        var url = "getPivotTable.action";
+
+        var groupId = dataType == DATA_TYPE_INDICATOR ? indicatorGroupId : dataElementGroupId;
+
+        currentDataType = dataType;
+
+        hideDivs();
+
+        showLoader();
+
+        $.getJSON( url, {
+            "dataType" : dataType,
+            "groupId" : groupId,
+            "periodTypeName" : periodTypeName,
+            "startDate" : startDate,
+            "endDate" : endDate,
+            "organisationUnitId" : organisationUnitId
+        }, function( json )
+        {
+            var pivot = json.pivotTable;
+
+            indicators = pivot.indicators;
+            periods = pivot.periods;
+            orgunits = pivot.organisationUnits;
+
+            sizes["indicator"] = pivot.sizeIndicators;
+            sizes["period"] = pivot.sizePeriods;
+            sizes["orgunit"] = pivot.sizeOrganisationUnits;
+
+            data = pivot.indicatorValues[0];
+
+            hideLoader();
+
+            generateTable();
+        } );
+    }
 }
 
 /**
@@ -107,13 +102,13 @@
  */
 function pivotData()
 {
-  pivotIndicator = document.getElementById( "indicatorBox" ).checked;
-  pivotPeriod = document.getElementById( "periodBox" ).checked;
-  pivotOrgunit = document.getElementById( "orgunitBox" ).checked;
-  
-  hideDivs();
-  
-  generateTable();
+    pivotIndicator = document.getElementById( "indicatorBox" ).checked;
+    pivotPeriod = document.getElementById( "periodBox" ).checked;
+    pivotOrgunit = document.getElementById( "orgunitBox" ).checked;
+
+    hideDivs();
+
+    generateTable();
 }
 
 /**
@@ -121,64 +116,63 @@
  */
 function viewChart( chartIndicators, chartDimension )
 {
-  var chartWidth = 750;
-    
-  var url = "generateChart.action";
-    
-  if ( chartIndicators == "single" && chartDimension == "period" )
-  {
-    url += "?indicatorId=" + currentIndicator + "&organisationUnitId=" + currentOrgunit + "&dimension=period&regression=true";
-    
-    for ( p in periods )
-    {
-      url += "&periodId=" + periods[p].id;
-    }
-  }
-  else if ( chartIndicators == "single" && chartDimension == "orgunit" )
-  {
-    url += "?indicatorId=" + currentIndicator + "&periodId=" + currentPeriod + "&dimension=organisationUnit&regression=false";
-    
-    for ( o in orgunits )
-    {
-      url += "&organisationUnitId=" + orgunits[o].id;
-    }
-  }
-  else if ( chartIndicators == "all" && chartDimension == "period" )
-  {
-    url += "?organisationUnitId=" + currentOrgunit + "&dimension=period&regression=false&chartWidth=950";
-    
-    for ( i in indicators )
-    {
-      url += "&indicatorId=" + indicators[i].id;
-    }
-    
-    for ( p in periods )
-    {
-      url += "&periodId=" + periods[p].id;
-    }
-    
-    chartWidth = 1000;
-  }
-  else if ( chartIndicators == "all" && chartDimension == "orgunit" )
-  {
-    url += "?periodId=" + currentPeriod + "&dimension=organisationUnit&regression=false&chartWidth=950";
-    
-    for ( i in indicators )
-    {
-      url += "&indicatorId=" + indicators[i].id;
-    }
-    
-    for ( o in orgunits )
-    {
-      url += "&organisationUnitId=" + orgunits[o].id;
-    }
-    
-    chartWidth = 1000;
-  }
-  
-  hideDropDown();
-  
-  openChartDialog( url, chartWidth );  
+    var chartWidth = 750;
+
+    var url = "generateChart.action";
+
+    if ( chartIndicators == "single" && chartDimension == "period" )
+    {
+        url += "?indicatorId=" + currentIndicator + "&organisationUnitId=" + currentOrgunit
+                + "&dimension=period&regression=true";
+
+        for ( p in periods )
+        {
+            url += "&periodId=" + periods[p].id;
+        }
+    } else if ( chartIndicators == "single" && chartDimension == "orgunit" )
+    {
+        url += "?indicatorId=" + currentIndicator + "&periodId=" + currentPeriod
+                + "&dimension=organisationUnit&regression=false";
+
+        for ( o in orgunits )
+        {
+            url += "&organisationUnitId=" + orgunits[o].id;
+        }
+    } else if ( chartIndicators == "all" && chartDimension == "period" )
+    {
+        url += "?organisationUnitId=" + currentOrgunit + "&dimension=period&regression=false&chartWidth=950";
+
+        for ( i in indicators )
+        {
+            url += "&indicatorId=" + indicators[i].id;
+        }
+
+        for ( p in periods )
+        {
+            url += "&periodId=" + periods[p].id;
+        }
+
+        chartWidth = 1000;
+    } else if ( chartIndicators == "all" && chartDimension == "orgunit" )
+    {
+        url += "?periodId=" + currentPeriod + "&dimension=organisationUnit&regression=false&chartWidth=950";
+
+        for ( i in indicators )
+        {
+            url += "&indicatorId=" + indicators[i].id;
+        }
+
+        for ( o in orgunits )
+        {
+            url += "&organisationUnitId=" + orgunits[o].id;
+        }
+
+        chartWidth = 1000;
+    }
+
+    hideDropDown();
+
+    openChartDialog( url, chartWidth );
 }
 
 function openChartDialog( url, width )
@@ -203,14 +197,15 @@
  */
 function viewChartMenu( indicatorId, periodId, orgunitId )
 {
-  if ( currentDataType == DATA_TYPE_INDICATOR ) // Currently indicators only supported
-  {
-    currentIndicator = indicatorId;
-    currentPeriod = periodId;
-    currentOrgunit = orgunitId;
-  
-    showDropDown( "pivotMenu" );
-  }
+    if ( currentDataType == DATA_TYPE_INDICATOR ) // Currently indicators only
+                                                    // supported
+    {
+        currentIndicator = indicatorId;
+        currentPeriod = periodId;
+        currentOrgunit = orgunitId;
+
+        showDropDown( "pivotMenu" );
+    }
 }
 
 /**
@@ -218,8 +213,8 @@
  */
 function loadListeners()
 {
-  var table = document.getElementById( "pivotTable" ); 
-  table.addEventListener( "click", setPosition, false );
+    var table = document.getElementById( "pivotTable" );
+    table.addEventListener( "click", setPosition, false );
 }
 
 // -----------------------------------------------------------------------------
@@ -227,279 +222,283 @@
 // -----------------------------------------------------------------------------
 
 /**
-* This method sets the position of the pivot menu, and is registered as a 
-* callback function for mouse click events.
-*/
+ * This method sets the position of the pivot menu, and is registered as a
+ * callback function for mouse click events.
+ */
 function setPosition( e )
 {
-  var left = e.pageX + "px";
-  var top = e.pageY + "px";
-  
-  var pivotMenu = document.getElementById( "pivotMenu" );
-  
-  pivotMenu.style.left = left;
-  pivotMenu.style.top = top;
+    var left = e.pageX + "px";
+    var top = e.pageY + "px";
+
+    var pivotMenu = document.getElementById( "pivotMenu" );
+
+    pivotMenu.style.left = left;
+    pivotMenu.style.top = top;
 }
 
 /**
  * This method is responsible for generating the pivot table.
  */
 function generateTable()
-{   
-  var columnIndicators = pivotIndicator ? indicators : [null];
-  var columnPeriods = pivotPeriod ? periods : [null];
-  var columnOrgunits = pivotOrgunit ? orgunits : [null];
-  
-  var rowIndicators = pivotIndicator ? [null] : indicators;
-  var rowPeriods = pivotPeriod ? [null] : periods;
-  var rowOrgunits = pivotOrgunit ? [null] : orgunits;
-
-  var table = document.getElementById( "pivotTable" );
-
-  clearTable( table );
-  
-  var columns = getColumns( columnIndicators, columnPeriods, columnOrgunits );
-  var rows = getRows( rowIndicators, rowPeriods, rowOrgunits );
-  
-  var columnDimensions = getColumnDimensions();
-  var rowDimensions = getRowDimensions();
-  
-  var colSpans = getSpans( columnDimensions );
-  var rowSpans = getSpans( rowDimensions );
-
-  var html = "<tr>";
-
-  // ---------------------------------------------------------------------------
-  // Column headers
-  // ---------------------------------------------------------------------------
-
-  for ( d in columnDimensions )
-  {
-    for ( rowDimension in rowDimensions ) // Make space for row header
-    {
-      html += "<td class='row'></td>"; 
-    }
-    
-    var dimension = columnDimensions[d];
-    var colSpan = colSpans[dimension];
-    
-    for ( c in columns )
-    {
-      var modulus = c % colSpan;
-      
-      if ( modulus == 0 )
-      {
-        html += "<td class='column' colspan='" + colSpan + "'>" + columns[c][dimension]  + "</td>";
-      }
-    }
-    
-    html += "</tr>";
-  }
-  
-  // ---------------------------------------------------------------------------
-  // Rows
-  // ---------------------------------------------------------------------------
-
-  for ( r in rows )
-  {
-    html += "<tr>";    
-    
-    for ( d in rowDimensions ) // Row headers
-    {
-      var dimension = rowDimensions[d];
-      var rowSpan = rowSpans[dimension];
-      var modulus = r % rowSpan;
-      
-      if ( modulus == 0 )
-      {
-        html += "<td class='row' rowspan='" + rowSpan + "'>" + rows[r][dimension] + "</td>";
-      }
-    }
-    
-    for ( c in columns ) // Values
-    {
-      var value = getValue( columns[c], rows[r] );
-      
-      var ids = mergeArrays( columns[c], rows[r] );
-      
-      html += "<td class='cell' onclick='viewChartMenu( \"" + ids.indicatorId + "\", \"" + ids.periodId + "\", \"" + ids.orgunitId + "\" )'>" + value + "</td>";
-    }
-    
-    html += "</tr>";
-  }
-  
-  table.innerHTML = html;
-  
-  hidePivot();
+{
+    var columnIndicators = pivotIndicator ? indicators : [ null ];
+    var columnPeriods = pivotPeriod ? periods : [ null ];
+    var columnOrgunits = pivotOrgunit ? orgunits : [ null ];
+
+    var rowIndicators = pivotIndicator ? [ null ] : indicators;
+    var rowPeriods = pivotPeriod ? [ null ] : periods;
+    var rowOrgunits = pivotOrgunit ? [ null ] : orgunits;
+
+    var table = document.getElementById( "pivotTable" );
+
+    clearTable( table );
+
+    var columns = getColumns( columnIndicators, columnPeriods, columnOrgunits );
+    var rows = getRows( rowIndicators, rowPeriods, rowOrgunits );
+
+    var columnDimensions = getColumnDimensions();
+    var rowDimensions = getRowDimensions();
+
+    var colSpans = getSpans( columnDimensions );
+    var rowSpans = getSpans( rowDimensions );
+
+    var html = "<tr>";
+
+    // ---------------------------------------------------------------------------
+    // Column headers
+    // ---------------------------------------------------------------------------
+
+    for ( d in columnDimensions )
+    {
+        for ( rowDimension in rowDimensions ) // Make space for row header
+        {
+            html += "<td class='row'></td>";
+        }
+
+        var dimension = columnDimensions[d];
+        var colSpan = colSpans[dimension];
+
+        for ( c in columns )
+        {
+            var modulus = c % colSpan;
+
+            if ( modulus == 0 )
+            {
+                html += "<td class='column' colspan='" + colSpan + "'>" + columns[c][dimension] + "</td>";
+            }
+        }
+
+        html += "</tr>";
+    }
+
+    // ---------------------------------------------------------------------------
+    // Rows
+    // ---------------------------------------------------------------------------
+
+    for ( r in rows )
+    {
+        html += "<tr>";
+
+        for ( d in rowDimensions ) // Row headers
+        {
+            var dimension = rowDimensions[d];
+            var rowSpan = rowSpans[dimension];
+            var modulus = r % rowSpan;
+
+            if ( modulus == 0 )
+            {
+                html += "<td class='row' rowspan='" + rowSpan + "'>" + rows[r][dimension] + "</td>";
+            }
+        }
+
+        for ( c in columns ) // Values
+        {
+            var value = getValue( columns[c], rows[r] );
+
+            var ids = mergeArrays( columns[c], rows[r] );
+
+            html += "<td class='cell' onclick='viewChartMenu( \"" + ids.indicatorId + "\", \"" + ids.periodId
+                    + "\", \"" + ids.orgunitId + "\" )'>" + value + "</td>";
+        }
+
+        html += "</tr>";
+    }
+
+    table.innerHTML = html;
+
+    hidePivot();
 }
 
 /**
-* @param dimensions array -> dimensions
-*
-* @return associative array ( dimension, span )
-*/
+ * @param dimensions array -> dimensions
+ * 
+ * @return associative array ( dimension, span )
+ */
 function getSpans( dimensions )
 {
-  var spans = [];
-  
-  var lastIndex = ( dimensions.length - 1 );
-  
-  var span = 1;
-  
-  for ( var i=lastIndex; i>=0; i-- )
-  {
-    var dimension = dimensions[i];
-    
-    spans[dimension] = span;
-    
-    var dimensionSize = sizes[dimension];
-    
-    span = ( span * dimensionSize );
-  }
-  
-  return spans;
+    var spans = [];
+
+    var lastIndex = ( dimensions.length - 1 );
+
+    var span = 1;
+
+    for ( var i = lastIndex; i >= 0; i-- )
+    {
+        var dimension = dimensions[i];
+
+        spans[dimension] = span;
+
+        var dimensionSize = sizes[dimension];
+
+        span = ( span * dimensionSize );
+    }
+
+    return spans;
 }
 
 /**
-* @param columnIndicators array -> associative array ( indicatorId, indicatorName )
-* @param columnPeriods array -> associative array ( periodId, periodName )
-* @param columnOrgunits array -> associative array ( orgunitId, orgunitName )
-*
-* @return array -> associative array ( indicatorId, indicator, periodId, period, orgunitId, orgunit )
-*/
+ * @param columnIndicators array -> associative array ( indicatorId,
+ *            indicatorName )
+ * @param columnPeriods array -> associative array ( periodId, periodName )
+ * @param columnOrgunits array -> associative array ( orgunitId, orgunitName )
+ * 
+ * @return array -> associative array ( indicatorId, indicator, periodId,
+ *         period, orgunitId, orgunit )
+ */
 function getColumns( columnIndicators, columnPeriods, columnOrgunits )
 {
-  var columns = [];
-  var columnsIndex = 0;
+    var columns = [];
+    var columnsIndex = 0;
 
-  for ( var i=0; i<columnIndicators.length; i++ )
-  {
-    for ( var j=0; j<columnPeriods.length; j++ )
+    for ( var i = 0; i < columnIndicators.length; i++ )
     {
-      for ( var k=0; k<columnOrgunits.length; k++ )
-      {
-        var column = [];
-        
-        if ( columnIndicators[i] != null )
-        {
-          column["indicatorId"] = columnIndicators[i].id;
-          column["indicator"] = columnIndicators[i].name;
-        }
-        
-        if ( columnPeriods[j] != null )
-        {
-          column["periodId"] = columnPeriods[j].id;
-          column["period"] = columnPeriods[j].name;
-        }
-        
-        if ( columnOrgunits[k] != null )
-        {
-          column["orgunitId"] = columnOrgunits[k].id;
-          column["orgunit"] = columnOrgunits[k].name;
-        }
-        
-        columns[columnsIndex++] = column;     
-      }
+        for ( var j = 0; j < columnPeriods.length; j++ )
+        {
+            for ( var k = 0; k < columnOrgunits.length; k++ )
+            {
+                var column = [];
+
+                if ( columnIndicators[i] != null )
+                {
+                    column["indicatorId"] = columnIndicators[i].id;
+                    column["indicator"] = columnIndicators[i].name;
+                }
+
+                if ( columnPeriods[j] != null )
+                {
+                    column["periodId"] = columnPeriods[j].id;
+                    column["period"] = columnPeriods[j].name;
+                }
+
+                if ( columnOrgunits[k] != null )
+                {
+                    column["orgunitId"] = columnOrgunits[k].id;
+                    column["orgunit"] = columnOrgunits[k].name;
+                }
+
+                columns[columnsIndex++] = column;
+            }
+        }
     }
-  }
-  
-  return columns;
+
+    return columns;
 }
 
 /**
-* @param rowIndicators array -> associative array ( indicatorId, indicatorName )
-* @param rowPeriods array -> associative array ( periodId, periodName )
-* @param rowOrgunits array -> associative array ( orgunitId, orgunitName )
-*
-* @return array -> associative array ( indicatorId, indicator, periodId, period, orgunitId, orgunit )
-*/
+ * @param rowIndicators array -> associative array ( indicatorId, indicatorName )
+ * @param rowPeriods array -> associative array ( periodId, periodName )
+ * @param rowOrgunits array -> associative array ( orgunitId, orgunitName )
+ * 
+ * @return array -> associative array ( indicatorId, indicator, periodId,
+ *         period, orgunitId, orgunit )
+ */
 function getRows( rowIndicators, rowPeriods, rowOrgunits )
 {
-  var rows = [];
-  var rowsIndex = 0;
+    var rows = [];
+    var rowsIndex = 0;
 
-  for ( var i=0; i<rowIndicators.length; i++ )
-  {
-    for ( var j=0; j<rowPeriods.length; j++ )
+    for ( var i = 0; i < rowIndicators.length; i++ )
     {
-      for ( var k=0; k<rowOrgunits.length; k++ )
-      {
-        var row = [];
-        
-        if ( rowIndicators[i] != null )
-        {
-          row["indicatorId"] = rowIndicators[i].id;
-          row["indicator"] = rowIndicators[i].name;
-        }
-        
-        if ( rowPeriods[j] != null )
-        {
-          row["periodId"] = rowPeriods[j].id;
-          row["period"] = rowPeriods[j].name;
-        }
-        
-        if ( rowOrgunits[k] != null )
-        {
-          row["orgunitId"] = rowOrgunits[k].id;
-          row["orgunit"] = rowOrgunits[k].name;
-        }
-        
-        rows[rowsIndex++] = row;
-      }
+        for ( var j = 0; j < rowPeriods.length; j++ )
+        {
+            for ( var k = 0; k < rowOrgunits.length; k++ )
+            {
+                var row = [];
+
+                if ( rowIndicators[i] != null )
+                {
+                    row["indicatorId"] = rowIndicators[i].id;
+                    row["indicator"] = rowIndicators[i].name;
+                }
+
+                if ( rowPeriods[j] != null )
+                {
+                    row["periodId"] = rowPeriods[j].id;
+                    row["period"] = rowPeriods[j].name;
+                }
+
+                if ( rowOrgunits[k] != null )
+                {
+                    row["orgunitId"] = rowOrgunits[k].id;
+                    row["orgunit"] = rowOrgunits[k].name;
+                }
+
+                rows[rowsIndex++] = row;
+            }
+        }
     }
-  }
-  
-  return rows;
+
+    return rows;
 }
 
 /**
-* @return array -> dimension
-*/
+ * @return array -> dimension
+ */
 function getColumnDimensions()
 {
-  var dimensions = [];
-   
-  if ( pivotIndicator )
-  {
-    dimensions[dimensions.length] = "indicator";
-  }
-  
-  if ( pivotPeriod )
-  {
-    dimensions[dimensions.length] = "period";
-  }
-  
-  if ( pivotOrgunit )
-  {
-    dimensions[dimensions.length] = "orgunit";
-  }
-  
-  return dimensions;
+    var dimensions = [];
+
+    if ( pivotIndicator )
+    {
+        dimensions[dimensions.length] = "indicator";
+    }
+
+    if ( pivotPeriod )
+    {
+        dimensions[dimensions.length] = "period";
+    }
+
+    if ( pivotOrgunit )
+    {
+        dimensions[dimensions.length] = "orgunit";
+    }
+
+    return dimensions;
 }
 
 /**
-* @return array -> dimension
-*/
+ * @return array -> dimension
+ */
 function getRowDimensions()
 {
-  var dimensions = [];
-   
-  if ( !pivotIndicator )
-  {
-    dimensions[dimensions.length] = "indicator";
-  }
-  
-  if ( !pivotPeriod )
-  {
-    dimensions[dimensions.length] = "period";
-  }
-  
-  if ( !pivotOrgunit )
-  {
-    dimensions[dimensions.length] = "orgunit";
-  }
-  
-  return dimensions;
+    var dimensions = [];
+
+    if ( !pivotIndicator )
+    {
+        dimensions[dimensions.length] = "indicator";
+    }
+
+    if ( !pivotPeriod )
+    {
+        dimensions[dimensions.length] = "period";
+    }
+
+    if ( !pivotOrgunit )
+    {
+        dimensions[dimensions.length] = "orgunit";
+    }
+
+    return dimensions;
 }
 
 /**
@@ -510,12 +509,12 @@
  */
 function mergeArrays( array1, array2 )
 {
-  for ( a2 in array2 )
-  {
-    array1[a2] = array2[a2];
-  }
-  
-  return array1;
+    for ( a2 in array2 )
+    {
+        array1[a2] = array2[a2];
+    }
+
+    return array1;
 }
 
 /**
@@ -526,13 +525,13 @@
  */
 function getValue( column, row )
 {
-  var key = mergeArrays( column, row );
-  
-  var keyString = key.indicatorId + "-" + key.periodId + "-" + key.orgunitId;
-  
-  var value = data[keyString];
-   
-  return value != null ? value : "";
+    var key = mergeArrays( column, row );
+
+    var keyString = key.indicatorId + "-" + key.periodId + "-" + key.orgunitId;
+
+    var value = data[keyString];
+
+    return value != null ? value : "";
 }
 
 /**
@@ -540,10 +539,10 @@
  */
 function clearTable( table )
 {
-  while ( table.rows.length >  0 )
-  {
-    table.deleteRow( 0 );
-  }
+    while ( table.rows.length > 0 )
+    {
+        table.deleteRow( 0 );
+    }
 }
 
 /**
@@ -551,9 +550,9 @@
  */
 function clearGlobalVariables()
 {
-  indicators.length = 0;
-  periods.length = 0;
-  orgunits.length = 0;
-  data.length = 0;
-  sizes.length = 0;
+    indicators.length = 0;
+    periods.length = 0;
+    orgunits.length = 0;
+    data.length = 0;
+    sizes.length = 0;
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2011-02-22 23:05:45 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/report.js	2011-06-23 14:38:00 +0000
@@ -1,4 +1,3 @@
-
 function addReport()
 {
     document.getElementById( "reportForm" ).submit();
@@ -6,16 +5,16 @@
 
 function removeReport( id )
 {
-	removeItem( id, "", i18n_confirm_remove_report, "removeReport.action" );
+    removeItem( id, "", i18n_confirm_remove_report, "removeReport.action" );
 }
 
 function addToDashboard( id )
 {
     var dialog = window.confirm( i18n_confirm_add_to_dashboard );
-    
+
     if ( dialog )
     {
-        var request = new Request(); 
+        var request = new Request();
         request.send( "addReportToDashboard.action?id=" + id );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportConfiguration.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportConfiguration.js	2009-03-03 16:46:36 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/reportConfiguration.js	2011-06-23 14:38:00 +0000
@@ -1,22 +1,21 @@
-
 function homeChanged()
 {
-	var homeField = document.getElementById( "home" );
-	var directoryField = document.getElementById( "directory" );
-	
-	var homeValue = homeField.value;
-	
-	var index = homeValue.lastIndexOf( "/" );
-	
-	if ( index == -1 )
-	{
-		index = homeValue.lastIndexOf( "\\" );
-	}
-	
-	if ( index != -1 )
-	{
-	   var defaultDirectory = homeValue.substring( index + 1 );
-	   
-	   directoryField.value = defaultDirectory;
-	}
+    var homeField = document.getElementById( "home" );
+    var directoryField = document.getElementById( "directory" );
+
+    var homeValue = homeField.value;
+
+    var index = homeValue.lastIndexOf( "/" );
+
+    if ( index == -1 )
+    {
+        index = homeValue.lastIndexOf( "\\" );
+    }
+
+    if ( index != -1 )
+    {
+        var defaultDirectory = homeValue.substring( index + 1 );
+
+        directoryField.value = defaultDirectory;
+    }
 }

=== 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-05-28 14:40:32 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js	2011-06-23 14:38:00 +0000
@@ -1,4 +1,3 @@
-
 // -----------------------------------------------------------------------------
 // Save ReportTable
 // -----------------------------------------------------------------------------
@@ -8,7 +7,7 @@
     if ( validateCollections() )
     {
         var url = "validateTable.action?id=" + getFieldValue( "tableId" ) + "&name=" + getFieldValue( "tableName" );
-        
+
         var request = new Request();
         request.setResponseTypeXML( 'message' );
         request.setCallbackSuccess( saveTableReceived );
@@ -18,39 +17,38 @@
 
 function saveTableReceived( messageElement )
 {
-	var type = messageElement.getAttribute( 'type' );
+    var type = messageElement.getAttribute( 'type' );
     var message = messageElement.firstChild.nodeValue;
-    
+
     if ( type == "input" )
     {
         setMessage( message );
-        
+
         return false;
-    }
-    else if ( type == "success" )
-    {        
+    } else if ( type == "success" )
+    {
         selectTableForm();
-        
+
         document.getElementById( "tableForm" ).submit();
     }
 }
 
 function selectTableForm()
 {
-	selectAllById( "selectedDataElements" );
-	
-	if ( isNotNull( "selectedIndicators" ) )
-	{
-		selectAllById( "selectedIndicators" );
-	}
-    
+    selectAllById( "selectedDataElements" );
+
+    if ( isNotNull( "selectedIndicators" ) )
+    {
+        selectAllById( "selectedIndicators" );
+    }
+
     if ( isNotNull( "selectedDataSets" ) )
     {
-    	selectAllById( "selectedDataSets" );
+        selectAllById( "selectedDataSets" );
     }
-    
+
     selectAllById( "selectedPeriods" );
-    selectAllById( "selectedOrganisationUnits" );   
+    selectAllById( "selectedOrganisationUnits" );
 }
 
 // -----------------------------------------------------------------------------
@@ -59,7 +57,7 @@
 
 function removeTable( tableId, tableName )
 {
-	removeItem( tableId, tableName, i18n_confirm_delete, "removeTable.action" );
+    removeItem( tableId, tableName, i18n_confirm_delete, "removeTable.action" );
 }
 
 // -----------------------------------------------------------------------------
@@ -71,72 +69,71 @@
     if ( isChecked( "regression" ) && document.getElementById( "selectedOrganisationUnits" ).options.length > 1 )
     {
         setMessage( i18n_cannot_include_more_organisation_unit_regression );
-        
+
         return false;
     }
-        
-    if ( !hasElements( "selectedDataElements" ) && !hasElements( "selectedIndicators" ) && !hasElements( "selectedDataSets" ) )
+
+    if ( !hasElements( "selectedDataElements" ) && !hasElements( "selectedIndicators" )
+            && !hasElements( "selectedDataSets" ) )
     {
         setMessage( i18n_must_select_at_least_one_indictor_data_element_data_set );
-        
+
         return false;
     }
-        
+
     if ( !hasElements( "selectedOrganisationUnits" ) && !organisationUnitReportParamsChecked() )
     {
         setMessage( i18n_must_select_at_least_one_unit );
-        
+
         return false;
     }
-    
+
     if ( bothOrganisationUnitReportParamsChecked() )
     {
-    	setMessage( i18n_cannot_select_orgunit_and_parent_orgunit_param );
-    	
-    	return false;
+        setMessage( i18n_cannot_select_orgunit_and_parent_orgunit_param );
+
+        return false;
     }
-    
+
     if ( !hasElements( "selectedPeriods" ) && !relativePeriodsChecked() )
     {
         setMessage( i18n_must_select_at_least_one_period );
-        
+
         return false;
     }
-        
+
     return true;
 }
 
 function isTrue( elementId )
 {
     var value = document.getElementById( elementId ).value;
-    
+
     return value && value == "true" ? true : false;
 }
 
 function organisationUnitReportParamsChecked()
 {
-    return ( isChecked( "paramGrandParentOrganisationUnit" ) ||
-         isChecked( "paramParentOrganisationUnit" ) ||
-         isChecked( "paramOrganisationUnit" ) );
+    return ( isChecked( "paramGrandParentOrganisationUnit" ) || isChecked( "paramParentOrganisationUnit" ) || isChecked( "paramOrganisationUnit" ) );
 }
 
 function bothOrganisationUnitReportParamsChecked()
 {
-	var count = 0;
-	
-	if ( isChecked( "paramGrandParentOrganisationUnit" ) )
-	{
-		count++;
-	}
-	if ( isChecked( "paramParentOrganisationUnit" ) )
-	{
-		count++;
-	}
+    var count = 0;
+
+    if ( isChecked( "paramGrandParentOrganisationUnit" ) )
+    {
+        count++;
+    }
+    if ( isChecked( "paramParentOrganisationUnit" ) )
+    {
+        count++;
+    }
     if ( isChecked( "paramOrganisationUnit" ) )
     {
         count++;
     }
-    
+
     return count > 1;
 }
 
@@ -146,28 +143,28 @@
 
 function showTableDetails( tableId )
 {
-	var request = new Request();
+    var request = new Request();
     request.setResponseTypeXML( 'reportTable' );
     request.setCallbackSuccess( tableReceived );
-    request.send( 'getTable.action?id=' + tableId );	
+    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();
+    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();
 }
 
 function parseBool( bool )
 {
-	return ( bool == "true" ) ? i18n_yes : i18n_no;
+    return ( bool == "true" ) ? i18n_yes : i18n_no;
 }
 
 // -----------------------------------------------------------------------------
@@ -181,11 +178,10 @@
         check( "doIndicators" );
         uncheck( "doOrganisationUnits" );
         uncheck( "doPeriods" );
-        
+
         disable( "doOrganisationUnits" );
         disable( "doPeriods" );
-    }
-    else
+    } else
     {
         enable( "doOrganisationUnits" );
         enable( "doPeriods" );
@@ -194,12 +190,12 @@
 
 function toggleFixedOrganisationUnits()
 {
-	$( '#fixedOrganisationUnits' ).toggle( 'fast' );
+    $( '#fixedOrganisationUnits' ).toggle( 'fast' );
 }
 
 function toggleFixedPeriods()
 {
-	$( '#fixedPeriods' ).toggle( 'fast' );
+    $( '#fixedPeriods' ).toggle( 'fast' );
 }
 
 // -----------------------------------------------------------------------------
@@ -209,10 +205,10 @@
 function addReportTableToDashboard( id )
 {
     var dialog = window.confirm( i18n_confirm_add_report_table_to_dashboard );
-    
+
     if ( dialog )
     {
-        var request = new Request(); 
+        var request = new Request();
         request.send( "addReportTableToDashboard.action?id=" + id );
     }
 }

=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/tallySheet.js'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/tallySheet.js	2010-10-15 10:47:44 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/tallySheet.js	2011-06-23 14:38:00 +0000
@@ -2,95 +2,104 @@
 // Step 1 functions
 //----------------------------------------------------------------------------
 
-function continueToStepTwo() {
-
-	if (validateData()) {
-		setHeaderWaitMessage(i18n_processing + "...");
-		byId("tallySheetForm").submit();
-	}
+function continueToStepTwo()
+{
+    if ( validateData() )
+    {
+        setHeaderWaitMessage( i18n_processing + "..." );
+        byId( "tallySheetForm" ).submit();
+    }
 }
 
-//-----------------------------------------------------------------------------
+// -----------------------------------------------------------------------------
 // Step 2 functions
 // ----------------------------------------------------------------------------
 
-function setChecked(id) {
-
-	var value = byId("checkbox" + id).checked;
-	byId("checked" + id).value = value;
-	
-	if (value == true) {
-		if (byId("rows" + id).value == 0) {
-			byId("rows" + id).value = 1;
-		}
-	}
-}
-
-function doRecalculate() {
-	byId('recalculate').value = true;
-	byId('configureTallySheetForm').submit();
-}
-
-function selectAll() {
-
-	var length = document.configureTallySheetForm.checkbox.length;
-	
-	for (i = 0; i < length; i++) {
-		document.configureTallySheetForm.checkbox[i].checked = true;
-		document.configureTallySheetForm.checked[i].value = true;
-		if (document.configureTallySheetForm.rows[i].value == 0) {
-			document.configureTallySheetForm.rows[i].value = 1;
-		}
-	}
-}
-
-function selectNone() {
-
-	var length = document.configureTallySheetForm.checkbox.length;
-	
-	for (i = 0; i < length; i++) {
-		document.configureTallySheetForm.checkbox[i].checked = false;
-		document.configureTallySheetForm.checked[i].value = false;
-	}
-}
-
-function generatePdf() {
-
-	byId('configureTallySheetForm').action = "generateTallySheetPDF.action";
-	byId('configureTallySheetForm').submit();
-	byId('configureTallySheetForm').action = "configureTallySheetGenerator.action";
-}
-
-//-----------------------------------------------------------------------------
+function setChecked( id )
+{
+    var value = byId( "checkbox" + id ).checked;
+    byId( "checked" + id ).value = value;
+
+    if ( value == true )
+    {
+        if ( byId( "rows" + id ).value == 0 )
+        {
+            byId( "rows" + id ).value = 1;
+        }
+    }
+}
+
+function doRecalculate()
+{
+    byId( 'recalculate' ).value = true;
+    byId( 'configureTallySheetForm' ).submit();
+}
+
+function selectAll()
+{
+    var length = document.configureTallySheetForm.checkbox.length;
+
+    for ( i = 0; i < length; i++ )
+    {
+        document.configureTallySheetForm.checkbox[i].checked = true;
+        document.configureTallySheetForm.checked[i].value = true;
+        if ( document.configureTallySheetForm.rows[i].value == 0 )
+        {
+            document.configureTallySheetForm.rows[i].value = 1;
+        }
+    }
+}
+
+function selectNone()
+{
+    var length = document.configureTallySheetForm.checkbox.length;
+
+    for ( i = 0; i < length; i++ )
+    {
+        document.configureTallySheetForm.checkbox[i].checked = false;
+        document.configureTallySheetForm.checked[i].value = false;
+    }
+}
+
+function generatePdf()
+{
+    byId( 'configureTallySheetForm' ).action = "generateTallySheetPDF.action";
+    byId( 'configureTallySheetForm' ).submit();
+    byId( 'configureTallySheetForm' ).action = "configureTallySheetGenerator.action";
+}
+
+// -----------------------------------------------------------------------------
 // Validation
 // ----------------------------------------------------------------------------
 
 var selectedOrganisationUnitIds = null;
 
-function setSelectedOrganisationUnitIds(ids) {
-	selectedOrganisationUnitIds = ids;
+function setSelectedOrganisationUnitIds( ids )
+{
+    selectedOrganisationUnitIds = ids;
 }
 
-function validateData() {
-
-	var tallySheetName = byId("tallySheetName").value;
-
-	if (!getListValue("selectedDataSetId")
-			|| getListValue("selectedDataSetId") == "null") {
-		setHeaderDelayMessage(i18n_select_data_set);
-		return false;
-	}
-
-	if (!tallySheetName) {
-		setHeaderDelayMessage(i18n_type_tally_sheet_name);
-		return false;
-	}
-
-	if (selectedOrganisationUnitIds == null
-			|| selectedOrganisationUnitIds.length == 0) {
-		setHeaderDelayMessage(i18n_select_organisation_unit);
-		return false;
-	}
-
-	return true;
+function validateData()
+{
+    var tallySheetName = byId( "tallySheetName" ).value;
+
+    if ( !getListValue( "selectedDataSetId" ) || getListValue( "selectedDataSetId" ) == "null" )
+    {
+        setHeaderDelayMessage( i18n_select_data_set );
+        return false;
+    }
+
+    if ( !tallySheetName )
+    {
+        setHeaderDelayMessage( i18n_type_tally_sheet_name );
+        return false;
+    }
+
+    if ( selectedOrganisationUnitIds == null || selectedOrganisationUnitIds.length == 0 )
+    {
+        setHeaderDelayMessage( i18n_select_organisation_unit );
+        return false;
+    }
+
+    return true;
 }
\ No newline at end of file