dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #22684
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 10981: Removed pivot table function in reporting module, replaced by dhis-web-pivot module.
------------------------------------------------------------
revno: 10981
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-05-24 13:59:41 +0200
message:
Removed pivot table function in reporting module, replaced by dhis-web-pivot module.
removed:
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableOptionsAction.java
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js
modified:
dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml
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/index.vm
dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable'
=== removed directory 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action'
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableAction.java 2013-04-30 11:25:21 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableAction.java 1970-01-01 00:00:00 +0000
@@ -1,157 +0,0 @@
-package org.hisp.dhis.reporting.pivottable.action;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.List;
-
-import org.hisp.dhis.common.Grid;
-import org.hisp.dhis.i18n.I18nFormat;
-import org.hisp.dhis.period.Period;
-import org.hisp.dhis.pivottable.PivotTable;
-import org.hisp.dhis.pivottable.PivotTableService;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class GetPivotTableAction
- implements Action
-{
- private static final String DEFAULT_TYPE = "json";
-
- // -------------------------------------------------------------------------
- // Dependencies
- // -------------------------------------------------------------------------
-
- private PivotTableService pivotTableService;
-
- public void setPivotTableService( PivotTableService pivotTableService )
- {
- this.pivotTableService = pivotTableService;
- }
-
- private I18nFormat format;
-
- public void setFormat( I18nFormat format )
- {
- this.format = format;
- }
-
- // -------------------------------------------------------------------------
- // Input
- // -------------------------------------------------------------------------
-
- private Integer dataType = 0;
-
- public void setDataType( Integer dataType )
- {
- this.dataType = dataType;
- }
-
- private Integer groupId = -1;
-
- public void setGroupId( Integer groupId )
- {
- this.groupId = groupId;
- }
-
- private String periodTypeName;
-
- public void setPeriodTypeName( String periodTypeName )
- {
- this.periodTypeName = periodTypeName;
- }
-
- private String startDate;
-
- public void setStartDate( String startDate )
- {
- this.startDate = startDate;
- }
-
- private String endDate;
-
- public void setEndDate( String endDate )
- {
- this.endDate = endDate;
- }
-
- private Integer organisationUnitId = 0;
-
- public void setOrganisationUnitId( Integer organisationUnitId )
- {
- this.organisationUnitId = organisationUnitId;
- }
-
- private String type;
-
- public void setType( String type )
- {
- this.type = type;
- }
-
- // -------------------------------------------------------------------------
- // Output
- // -------------------------------------------------------------------------
-
- private PivotTable pivotTable;
-
- public PivotTable getPivotTable()
- {
- return pivotTable;
- }
-
- private List<Grid> grids;
-
- public List<Grid> getGrids()
- {
- return grids;
- }
-
- // -------------------------------------------------------------------------
- // Action implementation
- // -------------------------------------------------------------------------
-
- public String execute()
- {
- pivotTable = pivotTableService.getPivotTable( dataType, groupId, periodTypeName, startDate, endDate, organisationUnitId );
-
- for ( Period period : pivotTable.getPeriods() )
- {
- period.setName( format.formatPeriod( period ) );
- }
-
- if ( type != null )
- {
- grids = pivotTableService.getGrids( pivotTable );
- }
-
- return type != null ? type : DEFAULT_TYPE;
- }
-}
=== removed file 'dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableOptionsAction.java'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableOptionsAction.java 2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/java/org/hisp/dhis/reporting/pivottable/action/GetPivotTableOptionsAction.java 1970-01-01 00:00:00 +0000
@@ -1,96 +0,0 @@
-package org.hisp.dhis.reporting.pivottable.action;
-
-/*
- * Copyright (c) 2004-2012, University of Oslo
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions are met:
- * * Redistributions of source code must retain the above copyright notice, this
- * list of conditions and the following disclaimer.
- * * Redistributions in binary form must reproduce the above copyright notice,
- * this list of conditions and the following disclaimer in the documentation
- * and/or other materials provided with the distribution.
- * * Neither the name of the HISP project nor the names of its contributors may
- * be used to endorse or promote products derived from this software without
- * specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
- * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
- * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-
-import org.hisp.dhis.common.comparator.IdentifiableObjectNameComparator;
-import org.hisp.dhis.dataelement.DataElementGroup;
-import org.hisp.dhis.dataelement.DataElementService;
-import org.hisp.dhis.indicator.IndicatorGroup;
-import org.hisp.dhis.indicator.IndicatorService;
-import org.hisp.dhis.period.PeriodType;
-
-import com.opensymphony.xwork2.Action;
-
-/**
- * @author Lars Helge Overland
- */
-public class GetPivotTableOptionsAction
- implements Action
-{
- private IndicatorService indicatorService;
-
- public void setIndicatorService( IndicatorService indicatorService )
- {
- this.indicatorService = indicatorService;
- }
-
- private DataElementService dataElementService;
-
- public void setDataElementService( DataElementService dataElementService )
- {
- this.dataElementService = dataElementService;
- }
-
- private List<PeriodType> periodTypes = PeriodType.getAvailablePeriodTypes();
-
- public List<PeriodType> getPeriodTypes()
- {
- return periodTypes;
- }
-
- private List<IndicatorGroup> indicatorGroups = new ArrayList<IndicatorGroup>();
-
- public List<IndicatorGroup> getIndicatorGroups()
- {
- return indicatorGroups;
- }
-
- private List<DataElementGroup> dataElementGroups = new ArrayList<DataElementGroup>();
-
- public List<DataElementGroup> getDataElementGroups()
- {
- return dataElementGroups;
- }
-
- @Override
- public String execute()
- throws Exception
- {
- indicatorGroups = new ArrayList<IndicatorGroup>( indicatorService.getAllIndicatorGroups() );
- dataElementGroups = new ArrayList<DataElementGroup>( dataElementService.getAllDataElementGroups() );
-
- Collections.sort( indicatorGroups, IdentifiableObjectNameComparator.INSTANCE );
- Collections.sort( dataElementGroups, IdentifiableObjectNameComparator.INSTANCE );
-
- return SUCCESS;
- }
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-05-22 16:45:15 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/META-INF/dhis/beans.xml 2013-05-24 11:59:41 +0000
@@ -127,19 +127,6 @@
scope="prototype">
</bean>
- <!-- PivotTable -->
-
- <bean id="org.hisp.dhis.reporting.pivottable.action.GetPivotTableOptionsAction" class="org.hisp.dhis.reporting.pivottable.action.GetPivotTableOptionsAction"
- scope="prototype">
- <property name="indicatorService" ref="org.hisp.dhis.indicator.IndicatorService" />
- <property name="dataElementService" ref="org.hisp.dhis.dataelement.DataElementService" />
- </bean>
-
- <bean id="org.hisp.dhis.reporting.pivottable.action.GetPivotTableAction" class="org.hisp.dhis.reporting.pivottable.action.GetPivotTableAction"
- scope="prototype">
- <property name="pivotTableService" ref="org.hisp.dhis.pivottable.PivotTableService" />
- </bean>
-
<!-- DataSet Report -->
<bean id="org.hisp.dhis.reporting.dataset.action.GetDataSetReportOptionsAction" class="org.hisp.dhis.reporting.dataset.action.GetDataSetReportOptionsAction"
=== 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 2013-05-23 13:58:43 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/resources/struts.xml 2013-05-24 11:59:41 +0000
@@ -162,21 +162,6 @@
<param name="stylesheets">style/dhis-web-reporting.css</param>
</action>
- <!-- PivotTable -->
-
- <action name="displayPivotTableForm" class="org.hisp.dhis.reporting.pivottable.action.GetPivotTableOptionsAction">
- <result name="success" type="velocity">/main.vm</result>
- <param name="page">/dhis-web-reporting/viewPivotTableForm.vm</param>
- <param name="hideMenu">true</param>
- <param name="javascripts">../dhis-web-commons/oust/oust.js,javascript/pivot.js</param>
- </action>
-
- <action name="getPivotTable" class="org.hisp.dhis.reporting.pivottable.action.GetPivotTableAction">
- <result name="xls" type="gridXlsResult" />
- <result name="json" type="velocity-json">/dhis-web-reporting/responsePivotTable.vm</result>
- <param name="onExceptionReturn">plainTextError</param>
- </action>
-
<!-- Data Completeness -->
<action name="displayViewDataCompletenessForm" class="org.hisp.dhis.reporting.completeness.action.GetDataCompletenessOptionsAction">
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/index.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/index.vm 2012-03-04 13:26:24 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/index.vm 2013-05-24 11:59:41 +0000
@@ -14,5 +14,4 @@
#introListImgItem( "displayViewDocumentForm.action" "resource" "resource" )
#introListImgItem( "displayOrgUnitDistribution.action" "orgunit_distribution_report" "distribution" )
#introListImgItem( "displayManageTableForm.action" "report_table" "reporttable" )
- #introListImgItem( "displayPivotTableForm.action" "pivot_table" "pivottable" )
</ul>
=== removed 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-12-22 16:01:28 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/pivot.js 1970-01-01 00:00:00 +0000
@@ -1,614 +0,0 @@
-// -----------------------------------------------------------------------------
-// Global variables
-// -----------------------------------------------------------------------------
-
-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 sizes = []; // Associative array (dimension, size)
-
-var pivotIndicator = true; // Should correspond to init value in form
-var pivotPeriod = false;
-var pivotOrgunit = false;
-
-var currentIndicator = 0;
-var currentPeriod = 0;
-var currentOrgunit = 0;
-
-var organisationUnitId = -1;
-
-var currentParams = null;
-
-var DATA_TYPE_INDICATOR = 0;
-var DATA_TYPE_DATA_ELEMENT = 1;
-var currentDataType = DATA_TYPE_INDICATOR;
-
-// -----------------------------------------------------------------------------
-// Public methods
-// -----------------------------------------------------------------------------
-
-/**
- * Callback method from oust.
- */
-function organisationUnitSelected( orgunits )
-{
- organisationUnitId = orgunits ? orgunits[0] : null;
-}
-
-/**
- * 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();
-
- currentParams = {
- "dataType" : dataType,
- "groupId" : groupId,
- "periodTypeName" : periodTypeName,
- "startDate" : startDate,
- "endDate" : endDate,
- "organisationUnitId" : organisationUnitId
- };
-
- $.getJSON( url, currentParams, 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();
- } );
- }
-}
-
-function exportXls()
-{
- if ( currentParams != null )
- {
- var url = "getPivotTable.action?dataType=" + currentParams.dataType +
- "&groupId=" + currentParams.groupId +
- "&periodTypeName=" + currentParams.periodTypeName +
- "&startDate=" + currentParams.startDate +
- "&endDate=" + currentParams.endDate +
- "&organisationUnitId=" + currentParams.organisationUnitId +
- "&type=xls";
-
- window.location.href = url;
- }
-}
-
-/**
- * This method is called from the UI and is responsible for pivoting the table.
- */
-function pivotData()
-{
- pivotIndicator = document.getElementById( "indicatorBox" ).checked;
- pivotPeriod = document.getElementById( "periodBox" ).checked;
- pivotOrgunit = document.getElementById( "orgunitBox" ).checked;
-
- hideDivs();
-
- generateTable();
-}
-
-/**
- * This method is called from the UI and shows a chart with the selected data.
- */
-function viewChart( chartIndicators, chartDimension )
-{
- var chartWidth = 750;
-
- var url = "generateChart.action";
-
- if ( chartIndicators == "single" && chartDimension == "period" )
- {
- url += "?indicatorId=" + currentIndicator + "&organisationUnitId=" + currentOrgunit +
- "&series=DATA&category=PERIOD&filter=ORGANISATIONUNIT®ression=true"
-
- for ( p in periods )
- {
- url += "&periodId=" + periods[p].id;
- }
- }
- else if ( chartIndicators == "single" && chartDimension == "orgunit" )
- {
- url += "?indicatorId=" + currentIndicator + "&periodId=" + currentPeriod +
- "&series=DATA&category=ORGANISATIONUNIT&filter=PERIOD";
-
- for ( o in orgunits )
- {
- url += "&organisationUnitId=" + orgunits[o].id;
- }
- }
- else if ( chartIndicators == "all" && chartDimension == "period" )
- {
- url += "?organisationUnitId=" + currentOrgunit +
- "&series=DATA&category=PERIOD&filter=ORGANISATIONUNIT&chartWidth=950®ression=true";
-
- 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 +
- "&series=DATA&category=ORGANISATIONUNIT&filter=PERIOD&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 )
-{
- $( "#chartImage" ).attr( "src", url );
- $( "#chartView" ).dialog( {
- autoOpen : true,
- modal : true,
- height : 570,
- width : width,
- resizable : false,
- title : "Chart"
- } );
-}
-
-/**
- * This method is called from the UI and will display the chart menu.
- *
- * @param indicatorId the indicator identifier
- * @param periodId the period identifier
- * @param orgunitId the organisation unit identifier
- */
-function viewChartMenu( indicatorId, periodId, orgunitId )
-{
- // Currently only indicators supported
-
- if ( currentDataType == DATA_TYPE_INDICATOR )
- {
- currentIndicator = indicatorId;
- currentPeriod = periodId;
- currentOrgunit = orgunitId;
-
- showDropDown( "pivotMenu" );
- }
-}
-
-// -----------------------------------------------------------------------------
-// Supportive methods
-// -----------------------------------------------------------------------------
-
-/**
- * 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;
-}
-
-/**
- * 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();
-}
-
-/**
- * @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;
-}
-
-/**
- * @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;
-
- for ( var i = 0; i < columnIndicators.length; i++ )
- {
- 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;
-}
-
-/**
- * @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;
-
- for ( var i = 0; i < rowIndicators.length; i++ )
- {
- 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 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;
-}
-
-/**
- * @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;
-}
-
-/**
- * @param array1 the first associative array.
- * @param array2 the second associative array.
- *
- * @return an associative array with the merged contents of the input arrays.
- */
-function mergeArrays( array1, array2 )
-{
- for ( a2 in array2 )
- {
- array1[a2] = array2[a2];
- }
-
- return array1;
-}
-
-/**
- * @param column associative array ( columnId, columnName )
- * @param row associative array ( rowId, rowName )
- *
- * @return the value for the given combination of dimension identifiers.
- */
-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 : "";
-}
-
-/**
- * Clears the table.
- */
-function clearTable( table )
-{
- while ( table.rows.length > 0 )
- {
- table.deleteRow( 0 );
- }
-}
-
-/**
- * Clears the global variables.
- */
-function clearGlobalVariables()
-{
- indicators.length = 0;
- periods.length = 0;
- orgunits.length = 0;
- data.length = 0;
- sizes.length = 0;
-}
-
-// -------------------------------------------------------------------------
-// Public methods
-// -------------------------------------------------------------------------
-
-function toggleDataType()
-{
- $( "#indicatorGroupDiv" ).toggle();
- $( "#dataElementGroupDiv" ).toggle();
-}
-
-function showCriteria()
-{
- $( "div#pivot" ).hide();
- $( "div#criteria" ).show( "fast" );
-}
-
-function hideCriteria()
-{
- $( "div#criteria" ).hide( "fast" );
-}
-
-function showPivot()
-{
- $( "div#criteria" ).hide();
- $( "div#pivot" ).show( "fast" );
-}
-
-function hidePivot()
-{
- $( "div#pivot" ).hide( "fast" );
-}
-
-function hideDivs()
-{
- hideCriteria();
- hidePivot();
-}
=== modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm'
--- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm 2013-03-05 19:00:51 +0000
+++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/menu.vm 2013-05-24 11:59:41 +0000
@@ -7,7 +7,6 @@
<li><a href="displayViewDocumentForm.action">$i18n.getString( "resource" ) </a></li>
<li><a href="displayOrgUnitDistribution.action">$i18n.getString( "organisation_unit_report" ) </a></li>
<li><a href="displayManageTableForm.action">$i18n.getString( "report_table" ) </a></li>
- <li><a href="displayPivotTableForm.action">$i18n.getString( "pivot_table" ) </a></li>
</ul>
#if( $auth.hasAccess( "dhis-web-reporting", "displayDataMartForm" ) )