=== modified file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java' --- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java 2012-05-11 08:58:29 +0000 +++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/LoadDataSetsAction.java 2012-05-15 06:05:09 +0000 @@ -98,17 +98,18 @@ sources.add( selectionManager.getSelectedOrganisationUnit() ); Collection _dataSets = dataSetService.getDataSetsBySources( sources ); - - Collection authorityGroups = currentUserService.getCurrentUser().getUserCredentials().getUserAuthorityGroups(); - - for( UserAuthorityGroup UserAuthorityGroup : authorityGroups ) + + Collection authorityGroups = currentUserService.getCurrentUser().getUserCredentials() + .getUserAuthorityGroups(); + + for ( UserAuthorityGroup UserAuthorityGroup : authorityGroups ) { _dataSets.retainAll( UserAuthorityGroup.getDataSets() ); } dataSets.addAll( _dataSets ); Collections.sort( dataSets, new DataSetNameComparator() ); - + return SUCCESS; } === removed file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/PageInitAction.java' --- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/PageInitAction.java 2012-05-03 02:23:12 +0000 +++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/PageInitAction.java 1970-01-01 00:00:00 +0000 @@ -1,60 +0,0 @@ -package org.hisp.dhis.de.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 com.opensymphony.xwork2.Action; -import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; - -/** - * @author Lars Helge Overland - */ -public class PageInitAction - implements Action -{ - // ------------------------------------------------------------------------- - // Dependencies - // ------------------------------------------------------------------------- - - private OrganisationUnitSelectionManager selectionManager; - - public void setSelectionManager( OrganisationUnitSelectionManager selectionManager ) - { - this.selectionManager = selectionManager; - } - - // ------------------------------------------------------------------------- - // Action implementation - // ------------------------------------------------------------------------- - - public String execute() - { - selectionManager.clearSelectedOrganisationUnits(); - - return SUCCESS; - } -} === added file 'local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowHospitalEntryFormAction.java' --- local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowHospitalEntryFormAction.java 1970-01-01 00:00:00 +0000 +++ local/vn/dhis-web-dataentry-hospital/src/main/java/org/hisp/dhis/de/action/ShowHospitalEntryFormAction.java 2012-05-15 06:05:09 +0000 @@ -0,0 +1,71 @@ +package org.hisp.dhis.de.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 org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; +import org.springframework.beans.factory.annotation.Autowired; + +import com.opensymphony.xwork2.Action; + +/** + * @author Dang Duy Hieu + * @version $Id$ + */ +public class ShowHospitalEntryFormAction + implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + @Autowired + private OrganisationUnitSelectionManager selectionManager; + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private OrganisationUnit unit; + + public OrganisationUnit getUnit() + { + return unit; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() + { + unit = selectionManager.getSelectedOrganisationUnit(); + + return SUCCESS; + } +} === modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml' --- local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml 2012-05-11 08:28:02 +0000 +++ local/vn/dhis-web-dataentry-hospital/src/main/resources/META-INF/dhis/beans.xml 2012-05-15 06:05:09 +0000 @@ -11,9 +11,8 @@ - - - + === modified file 'local/vn/dhis-web-dataentry-hospital/src/main/resources/struts.xml' --- local/vn/dhis-web-dataentry-hospital/src/main/resources/struts.xml 2012-05-10 16:18:43 +0000 +++ local/vn/dhis-web-dataentry-hospital/src/main/resources/struts.xml 2012-05-15 06:05:09 +0000 @@ -8,7 +8,7 @@ - + /main.vm /dhis-web-dataentry-hospital/select.vm === modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js' --- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js 2012-05-11 03:39:22 +0000 +++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/javascript/form.js 2012-05-15 06:05:09 +0000 @@ -31,6 +31,9 @@ // Currently selected organisation unit identifier var currentOrganisationUnitId = null; +// The current selected orgunit name +var currentOrganisationUnitName = ""; + // Currently selected data set identifier var currentDataSetId = null; @@ -68,42 +71,53 @@ * download updated forms from server */ -function organisationUnitSelected( orgUnits, orgUnitNames ) +function organisationUnitSelectedHospitals( orgUnits, orgUnitNames ) { clearEntryForm(); - + currentOrganisationUnitId = orgUnits[0]; - var organisationUnitName = orgUnitNames[0]; - - $( '#selectedOrganisationUnit' ).html( organisationUnitName ); - $( '#currentOrganisationUnit' ).html( organisationUnitName ); + currentOrganisationUnitName = orgUnitNames[0]; + + loadDataSets( currentOrganisationUnitName ); +} + +selection.setListenerFunction( organisationUnitSelectedHospitals ); + +function loadDataSets( _unitName ) +{ + if ( _unitName ) + { + jQuery( '#selectedOrganisationUnit' ).html( _unitName ); + jQuery( '#currentOrganisationUnit' ).html( _unitName ); - $.ajax({ - url: 'loadDataSet.action', - dataType: 'json', - success: function( json ) - { - var dataSetList = json.dataSets; - - $( '#selectedDataSetId' ).removeAttr( 'disabled' ); - - var dataSetId = $( '#selectedDataSetId option:selected' ).val(); - var periodId = $( '#selectedPeriodId option:selected' ).val(); - - clearListById( 'selectedDataSetId' ); - //addOptionById( 'selectedDataSetId', '-1', '[ ' + i18n_select_data_set + ' ]' ); - - var dataSetValid = false; - - for ( i in dataSetList ) + jQuery.ajax({ + type: 'GET', + url: 'loadDataSet.action', + dataType: 'json', + //async: false, + success: function( json ) { - $('#selectedDataSetId').append(''); + var dataSetList = json.dataSets; + + $( '#selectedDataSetId' ).removeAttr( 'disabled' ); + + var dataSetId = $( '#selectedDataSetId option:selected' ).val(); + var periodId = $( '#selectedPeriodId option:selected' ).val(); + + clearListById( 'selectedDataSetId' ); + //addOptionById( 'selectedDataSetId', '-1', '[ ' + i18n_select_data_set + ' ]' ); + + var dataSetValid = false; + + for ( i in dataSetList ) + { + $('#selectedDataSetId').append(''); + } + + enable('selectedDataSetId'); } - - enable('selectedDataSetId'); - } - - }); + }); + } } function addEventListeners() === modified file 'local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/menu.vm' --- local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/menu.vm 2012-05-03 02:23:12 +0000 +++ local/vn/dhis-web-dataentry-hospital/src/main/webapp/dhis-web-dataentry-hospital/menu.vm 2012-05-15 06:05:09 +0000 @@ -1,6 +1,7 @@ === modified file 'local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js' --- local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2012-05-12 15:59:33 +0000 +++ local/vn/dhis-web-spreadsheet-reporting/src/main/webapp/dhis-web-spreadsheet-reporting/javascript/export.js 2012-05-15 06:05:09 +0000 @@ -25,26 +25,31 @@ function getExportReportsByGroup( selectedOrgUnitName ) { + var groupId = getFieldValue( 'group' ); + if ( selectedOrgUnitName ) { setInnerHTML( "selectedOrganisationUnit", selectedOrgUnitName ); - - jQuery.postJSON( 'getExportReportsByGroup.action', - { - group: getFieldValue( 'group' ) - }, - function ( json ) - { - jQuery('#exportReport').empty(); - jQuery.each( json.exportReports, function(i, item){ - addOptionById( 'exportReport', item.id + '_' + item.periodType + '_' + item.reportType, item.name ); + + if ( groupId ) + { + jQuery.postJSON( 'getExportReportsByGroup.action', + { + group: groupId + }, + function ( json ) + { + jQuery('#exportReport').empty(); + jQuery.each( json.exportReports, function(i, item){ + addOptionById( 'exportReport', item.id + '_' + item.periodType + '_' + item.reportType, item.name ); + }); + + currentPeriodOffset = 0; + + reportSelected(); + displayPeriodsInternal(); }); - - currentPeriodOffset = 0; - - reportSelected(); - displayPeriodsInternal(); - }); + } } }