=== added directory 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry' === added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java' --- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/GetOrganisationUnitAction.java 2013-12-31 07:59:05 +0000 @@ -0,0 +1,124 @@ +package org.hisp.dhis.pbf.dataentry; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.pbf.api.Lookup; +import org.hisp.dhis.pbf.api.LookupService; + +import com.opensymphony.xwork2.Action; + +public class GetOrganisationUnitAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private LookupService lookupService; + + public void setLookupService( LookupService lookupService ) + { + this.lookupService = lookupService; + } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + private String message; + + public String getMessage() + { + return message; + } + + private String orgUnitId; + + public String getOrgUnitId() + { + return orgUnitId; + } + + public void setOrgUnitId( String orgUnitId ) + { + this.orgUnitId = orgUnitId; + } + + private List dataSets = new ArrayList(); + + public List getDataSets() + { + return dataSets; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() throws Exception + { + OrganisationUnit organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId ); + + dataSets = new ArrayList( organisationUnit.getDataSets() ); + + List lookups = new ArrayList( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) ); + + List pbfDataSets = new ArrayList(); + + for( Lookup lookup : lookups ) + { + Integer dataSetId = Integer.parseInt( lookup.getValue() ); + + DataSet dataSet = dataSetService.getDataSet( dataSetId ); + if( dataSet != null ) + { + pbfDataSets.add(dataSet); + + } + } + + dataSets.retainAll( pbfDataSets ); + Collections.sort(dataSets); + + /* + for( DataSet dataSet : dataSets ) + { + System.out.println(" dataSet ---" + dataSet.getId() +" -- " + dataSet.getName() ); + } + */ + + if ( dataSets.size() > 0 ) + { + message = organisationUnit.getName(); + return SUCCESS; + + } + else + { + message = organisationUnit.getName(); + + return INPUT; + } + + } + +} === added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java' --- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadDataEntryFormAction.java 2013-12-31 07:59:05 +0000 @@ -0,0 +1,190 @@ +package org.hisp.dhis.pbf.dataentry; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.hisp.dhis.dataelement.DataElement; +import org.hisp.dhis.dataelement.DataElementCategoryCombo; +import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo; +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.datavalue.DataValue; +import org.hisp.dhis.datavalue.DataValueService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodType; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + */ +public class LoadDataEntryFormAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private DataValueService dataValueService; + + public void setDataValueService( DataValueService dataValueService ) + { + this.dataValueService = dataValueService; + } + + // ------------------------------------------------------------------------- + // Comparator + // ------------------------------------------------------------------------- +/* + private Comparator dataElementComparator; + + public void setDataElementComparator( Comparator dataElementComparator ) + { + this.dataElementComparator = dataElementComparator; + } +*/ + // ------------------------------------------------------------------------- + // Input/Output + // ------------------------------------------------------------------------- + + private String orgUnitId; + + public void setOrgUnitId( String orgUnitId ) + { + this.orgUnitId = orgUnitId; + } + + private int dataSetId; + + public void setDataSetId( int dataSetId ) + { + this.dataSetId = dataSetId; + } + + private String selectedPeriodId; + + public void setSelectedPeriodId( String selectedPeriodId ) + { + this.selectedPeriodId = selectedPeriodId; + } + + private List dataElements = new ArrayList(); + + public List getDataElements() + { + return dataElements; + } + + private OrganisationUnit organisationUnit; + + public OrganisationUnit getOrganisationUnit() + { + return organisationUnit; + } + + public Map dataValueMap; + + public Map getDataValueMap() + { + return dataValueMap; + } + + private DataSet dataSet; + + public DataSet getDataSet() + { + return dataSet; + } + + private Period period; + + public Period getPeriod() + { + return period; + } + + private List optionCombos = new ArrayList(); + + public List getOptionCombos() + { + return optionCombos; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + + public String execute() + { + + dataValueMap = new HashMap(); + + organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId ); + + dataSet = dataSetService.getDataSet( dataSetId ); + + period = PeriodType.getPeriodFromIsoString( selectedPeriodId ); + + dataElements = new ArrayList( dataSet.getDataElements() ); + + optionCombos = new ArrayList(); + + for( DataElement dataElement : dataElements ) + { + //DataElementCategoryOptionCombo decoc = dataElementCategoryService.getDefaultDataElementCategoryOptionCombo(); + + DataElementCategoryCombo dataElementCategoryCombo = dataElement.getCategoryCombo(); + + optionCombos = new ArrayList( dataElementCategoryCombo.getOptionCombos() ); + + for( DataElementCategoryOptionCombo decombo : optionCombos ) + { + DataValue dataValue = new DataValue(); + + dataValue = dataValueService.getDataValue( dataElement, period, organisationUnit, decombo ); + + String value = ""; + + if ( dataValue != null ) + { + value = dataValue.getValue(); + } + + String key = dataElement.getId()+ ":" + decombo.getId(); + + dataValueMap.put( key, value ); + } + + } + + /* + for( DataElementCategoryOptionCombo decombo : optionCombos ) + { + System.out.println(" decombo ---" + decombo.getId() +" -- " + decombo.getName() ); + } + */ + + + return SUCCESS; + } + +} + === added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadNextPrePeriodsAction.java' --- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadNextPrePeriodsAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadNextPrePeriodsAction.java 2013-12-31 07:59:05 +0000 @@ -0,0 +1,121 @@ +package org.hisp.dhis.pbf.dataentry; + +import java.util.Calendar; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.period.CalendarPeriodType; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodType; +import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; +import org.hisp.dhis.system.util.FilterUtils; +import org.hisp.dhis.util.SessionUtils; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + */ + +public class LoadNextPrePeriodsAction implements Action +{ + + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private I18nFormat format; + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private int dataSetId; + + public void setDataSetId( int dataSetId ) + { + this.dataSetId = dataSetId; + } + + private int year; + + public void setYear( int year ) + { + this.year = year; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + private List periods; + + public List getPeriods() + { + return periods; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() throws Exception + { + + DataSet dataset = dataSetService.getDataSet( dataSetId ); + + String periodType = dataset.getPeriodType().getName(); + + + //periodType = periodType != null && !periodType.isEmpty() ? periodType : MonthlyPeriodType.NAME; + + CalendarPeriodType _periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodType ); + + int thisYear = Calendar.getInstance().get( Calendar.YEAR ); + + int currentYear = (Integer) SessionUtils.getSessionVar( SessionUtils.KEY_CURRENT_YEAR, thisYear ); + + Calendar cal = PeriodType.createCalendarInstance(); + + // Cannot go to next year if current year equals this year + + if ( !( currentYear == thisYear && year > 0 ) ) + { + cal.set( Calendar.YEAR, currentYear ); + cal.add( Calendar.YEAR, year ); + + SessionUtils.setSessionVar( SessionUtils.KEY_CURRENT_YEAR, cal.get( Calendar.YEAR ) ); + } + + periods = _periodType.generatePeriods( cal.getTime() ); + + FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() ); + + Collections.reverse( periods ); + + + for ( Period period : periods ) + { + period.setName( format.formatPeriod( period ) ); + } + + return SUCCESS; + } + + +} === added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadPeriodsAction.java' --- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadPeriodsAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/LoadPeriodsAction.java 2013-12-31 07:59:05 +0000 @@ -0,0 +1,100 @@ +package org.hisp.dhis.pbf.dataentry; + +import java.util.ArrayList; +import java.util.Calendar; +import java.util.Collection; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.i18n.I18nFormat; +import org.hisp.dhis.period.CalendarPeriodType; +import org.hisp.dhis.period.Period; +import org.hisp.dhis.period.PeriodType; +import org.hisp.dhis.system.filter.PastAndCurrentPeriodFilter; +import org.hisp.dhis.system.util.FilterUtils; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + */ + +public class LoadPeriodsAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + private I18nFormat format; + + public void setFormat( I18nFormat format ) + { + this.format = format; + } + + // ------------------------------------------------------------------------- + // Input + // ------------------------------------------------------------------------- + + private int dataSetId; + + public void setDataSetId( int dataSetId ) + { + this.dataSetId = dataSetId; + } + + // ------------------------------------------------------------------------- + // Output + // ------------------------------------------------------------------------- + + + private List periods = new ArrayList(); + + public Collection getPeriods() + { + return periods; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() throws Exception + { + + DataSet dataset = dataSetService.getDataSet( dataSetId ); + + String periodType = dataset.getPeriodType().getName(); + + CalendarPeriodType _periodType = (CalendarPeriodType) CalendarPeriodType.getPeriodTypeByName( periodType ); + + Calendar cal = PeriodType.createCalendarInstance(); + + periods = _periodType.generatePeriods( cal.getTime() ); + + //periods = new ArrayList( periodService.getPeriodsByPeriodType( periodType ) ); + + FilterUtils.filter( periods, new PastAndCurrentPeriodFilter() ); + + Collections.reverse( periods ); + //Collections.sort( periods ); + for ( Period period : periods ) + { + //System.out.println("ISO Date : " + period.getIsoDate() ); + + period.setName( format.formatPeriod( period ) ); + } + + return SUCCESS; + } +} + === added file 'local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/PageInitAction.java' --- local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/PageInitAction.java 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/java/org/hisp/dhis/pbf/dataentry/PageInitAction.java 2013-12-31 07:59:05 +0000 @@ -0,0 +1,136 @@ +package org.hisp.dhis.pbf.dataentry; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; + +import org.hisp.dhis.dataset.DataSet; +import org.hisp.dhis.dataset.DataSetService; +import org.hisp.dhis.organisationunit.OrganisationUnit; +import org.hisp.dhis.organisationunit.OrganisationUnitService; +import org.hisp.dhis.ouwt.manager.OrganisationUnitSelectionManager; +import org.hisp.dhis.pbf.api.Lookup; +import org.hisp.dhis.pbf.api.LookupService; + +import com.opensymphony.xwork2.Action; + +/** + * @author Mithilesh Kumar Thakur + */ +public class PageInitAction implements Action +{ + // ------------------------------------------------------------------------- + // Dependencies + // ------------------------------------------------------------------------- + + private OrganisationUnitSelectionManager selectionManager; + + public void setSelectionManager( OrganisationUnitSelectionManager selectionManager ) + { + this.selectionManager = selectionManager; + } + + private OrganisationUnitService organisationUnitService; + + public void setOrganisationUnitService( OrganisationUnitService organisationUnitService ) + { + this.organisationUnitService = organisationUnitService; + } + + private LookupService lookupService; + + public void setLookupService( LookupService lookupService ) + { + this.lookupService = lookupService; + } + + private DataSetService dataSetService; + + public void setDataSetService( DataSetService dataSetService ) + { + this.dataSetService = dataSetService; + } + + + // ------------------------------------------------------------------------- + // Input/output + // ------------------------------------------------------------------------- + + private OrganisationUnit organisationUnit; + + public OrganisationUnit getOrganisationUnit() + { + return organisationUnit; + } + + private String orgUnitId; + + public void setOrgUnitId( String orgUnitId ) + { + this.orgUnitId = orgUnitId; + } + + private List dataSets = new ArrayList(); + + public List getDataSets() + { + return dataSets; + } + + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + + public String execute() throws Exception + { + //selectionManager.clearSelectedOrganisationUnits(); + + organisationUnit = selectionManager.getSelectedOrganisationUnit(); + + if( organisationUnit == null ) + { + System.out.println("Organisationunit is null"); + } + else + { + System.out.println("Organisationunit is not null ---" + organisationUnit.getId() ); + } + + if( organisationUnit == null && orgUnitId != null ) + { + organisationUnit = organisationUnitService.getOrganisationUnit( orgUnitId ); + + } + + dataSets = new ArrayList( organisationUnit.getDataSets() ); + + List lookups = new ArrayList( lookupService.getAllLookupsByType( Lookup.DS_PBF_TYPE ) ); + + List pbfDataSets = new ArrayList(); + + for( Lookup lookup : lookups ) + { + Integer dataSetId = Integer.parseInt( lookup.getValue() ); + + DataSet dataSet = dataSetService.getDataSet( dataSetId ); + if( dataSet != null ) + { + pbfDataSets.add(dataSet); + + } + } + + dataSets.retainAll( pbfDataSets ); + Collections.sort(dataSets); + /* + for( DataSet dataSet : dataSets ) + { + System.out.println(" dataSet ---" + dataSet.getId() +" -- " + dataSet.getName() ); + } + */ + + return SUCCESS; + } +} + + === modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml' --- local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2013-12-24 12:23:11 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/resources/META-INF/dhis/beans.xml 2013-12-31 07:59:05 +0000 @@ -99,4 +99,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file === modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties' --- local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties 2013-12-11 12:08:01 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/resources/org/hisp/dhis/pbf/i18n_module.properties 2013-12-31 07:59:05 +0000 @@ -1,3 +1,20 @@ pbf_setup = PBF Setup dataelement_tariff_management = Tariff Management Dataelement -pbf_management = PBF Management \ No newline at end of file +pbf_management = PBF Management + +dataentry = Data Entry +bank_details_management = Bank Details Management + +pbf_dataentry = PBF Data Entry + +dataset = Dataset +select_dataSet = Select Dataset +prev_year = Prev year +next_year = Next year +entry = Entry +earlier_periods = Earlier periods +later_periods = Later periods +select = Select +period = Period + +dataelement = Data Element \ No newline at end of file === modified file 'local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml' --- local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2013-12-24 12:23:11 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/resources/struts.xml 2013-12-31 07:59:05 +0000 @@ -2,6 +2,7 @@ + @@ -62,6 +63,44 @@ plainTextError F_BANKDATA_UPDATE + + + + + + + + + /main.vm + /dhis-web-maintenance-pbf/dataEntrySelection.vm + /dhis-web-maintenance-pbf/menuDataEntry.vm + ../dhis-web-commons/ouwt/ouwt.js,javascript/pbfDataEntry.js + style/dataentry.css + + + + + /dhis-web-commons/ajax/jsonResponseSuccess.vm + /dhis-web-commons/ajax/jsonResponseInput.vm + + + + + /dhis-web-maintenance-pbf/jsonPeriods.vm + + + + + /dhis-web-maintenance-pbf/jsonPeriods.vm + + + + + /content.vm + /dhis-web-maintenance-pbf/loadDataEntryForm.vm + + + \ No newline at end of file === added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/css/dataentry.css' --- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/css/dataentry.css 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/css/dataentry.css 2013-12-31 07:59:05 +0000 @@ -0,0 +1,102 @@ + +#currentSelection +{ + padding: 6px; + background-color: #eee; + border: 1px solid #bbb; + font-size: 14px; + text-align: right; + position: fixed; + top: 55px; + right: 10px; + filter: alpha(opacity=85); + opacity: 0.85; + border-radius: 3px; +} + +#actions +{ + float: right; + width: 160px; + text-align: right; +} + +#closeCurrentSelection +{ + float:left; + cursor:pointer; + margin-right:5px; +} + +#contentDiv +{ + margin-bottom: 8px; +} + +#completenessDiv +{ + display: none; + width: 386px; + height: 29px; +} + +#infoDiv +{ + display: none; + width: 386px; + height: 20px; +} + +#completedByDiv +{ + display: none; +} + +.currentRow +{ + background-color: #d5ffc5; + padding-right: 50px; +} + +.hidden +{ + display: none; +} + +input[type=text],textarea +{ + padding-left: 0; + padding-right: 0; + margin-top: 1px; + margin-bottom: 1px; +} + +.formSection td +{ + padding-right: 2px; + padding-left: 2px; + height: 28px; + white-space: nowrap; +} + +.formSection th +{ + text-align: center; + min-width: 46px; +} + +.sectionFilter +{ + padding: 5px; + border: solid 1px #f0f0f0; + outline: 0; + color: #333; + height: 14px; +} + +.historyHeader +{ + color: #606060; + font-size: 17px; + padding: 5px 0; +} === added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/dataEntrySelection.vm' --- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/dataEntrySelection.vm 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/dataEntrySelection.vm 2013-12-31 07:59:05 +0000 @@ -0,0 +1,85 @@ + + +

$i18n.getString( "pbf_dataentry" )

+ +
+
+ + + +
+ +
+ + + + + + + + + + + + + + + + +
+ +
+ + +
+
+ + +#parse( "/dhis-web-commons/loader/loader.vm" ) +
+ +

+    +    +

+ + +
+ + \ No newline at end of file === added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js' --- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/javascript/pbfDataEntry.js 2013-12-31 07:59:05 +0000 @@ -0,0 +1,193 @@ + +function orgUnitHasBeenSelected( orgUnitIds ) +{ + $( '#dataEntryFormDiv' ).html( '' ); + + document.getElementById('selectedOrgunitID').value = orgUnitIds; + + //alert( orgUnitIds ); + + if( orgUnitIds != null && orgUnitIds != "" ) + { + $.getJSON( 'getOrganisationUnit.action', {orgUnitId:orgUnitIds[0]} + , function( json ) + { + var type = json.response; + setFieldValue('orgUnitName', json.message ); + setFieldValue('selectedOrgunitName', json.message ); + + if( type == 'success' ) + { + enable('dataSetId'); + setFieldValue('orgUnitName', json.message ); + setFieldValue('selectedOrgunitName', json.message ); + } + else if( type == 'input' ) + { + disable('dataSetId'); + disable('selectedPeriodId'); + disable('prevButton'); + disable('nextButton'); + + setFieldValue('orgUnitName', json.message ); + setFieldValue('selectedOrgunitName', json.message ); + } + } ); + } +} + +selection.setListenerFunction( orgUnitHasBeenSelected ); + + +function loadDataEntryForm() +{ + var orgUnitId = $( '#selectedOrgunitID' ).val(); + + + + + var dataSetId = $( '#dataSetId' ).val(); + + + + $( '#dataEntryFormDiv' ).html(''); + + $( '#saveButton' ).removeAttr( 'disabled' ); + + + var selectedPeriodId = $( '#selectedPeriodId' ).val(); + + if ( selectedPeriodId == "-1" && dataSetId == "-1" ) + { + $( '#dataEntryFormDiv' ).html(''); + document.getElementById( "saveButton" ).disabled = true; + return false; + } + + else + { + jQuery('#loaderDiv').show(); + + jQuery('#dataEntryFormDiv').load('loadDataEntryForm.action', + { + orgUnitId:orgUnitId, + dataSetId:dataSetId, + selectedPeriodId:selectedPeriodId + }, function() + { + showById('dataEntryFormDiv'); + jQuery('#loaderDiv').hide(); + }); + hideLoader(); + } + +} + + + + + + + + + + + + + + + + + + + + + + + + + +// load periods +function loadPeriods() +{ + $( '#dataEntryFormDiv' ).html( '' ); + + var orgUnitId = $( '#selectedOrgunitID' ).val(); + + var dataSetId = $( '#dataSetId' ).val(); + + + if ( dataSetId == "-1" ) + { + showWarningMessage( i18n_select_dataset ); + + document.getElementById( "selectedPeriodId" ).disabled = true; + document.getElementById( "prevButton" ).disabled = true; + document.getElementById( "nextButton" ).disabled = true; + return false; + } + + else + { + + enable('selectedPeriodId'); + + enable('prevButton'); + enable('nextButton'); + + var url = 'loadPeriods.action?dataSetId=' + dataSetId; + + var list = document.getElementById( 'selectedPeriodId' ); + + clearList( list ); + + addOptionToList( list, '-1', '[ Select ]' ); + + $.getJSON( url, function( json ) { + for ( i in json.periods ) { + addOptionToList( list, json.periods[i].isoDate, json.periods[i].name ); + } + } ); + + } +} + + +//next and pre periods +function getAvailablePeriodsTemp( availablePeriodsId, selectedPeriodsId, year ) +{ + $( '#dataEntryFormDiv' ).html( '' ); + + var dataSetId = $( '#dataSetId' ).val(); + + var availableList = document.getElementById( availablePeriodsId ); + var selectedList = document.getElementById( selectedPeriodsId ); + + clearList( selectedList ); + + addOptionToList( selectedList, '-1', '[ Select ]' ); + + $.getJSON( "getAvailableNextPrePeriods.action", { + "dataSetId": dataSetId , + "year": year }, + function( json ) { + + for ( i in json.periods ) { + addOptionToList( selectedList, json.periods[i].isoDate, json.periods[i].name ); + } + + } ); +} + + + + + + + + + + + + + === added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonPeriods.vm' --- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonPeriods.vm 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/jsonPeriods.vm 2013-12-31 07:59:05 +0000 @@ -0,0 +1,13 @@ +#set( $size = $periods.size() ) +{ "periods": [ +#foreach( $period in $periods ) + { + "id": $!{period.id}, + "startDate": "$!format.formatDate( ${period.startDate} )", + "endDate": "$!format.formatDate( ${period.endDate} )", + "name": "$!format.formatPeriod( ${period} )", + "externalId": "$!{period.externalId}", + "isoDate": "$!{period.isoDate}" + }#if( $velocityCount < $size ),#end +#end +] } === added file 'local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.vm' --- local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.vm 1970-01-01 00:00:00 +0000 +++ local/in/dhis-web-maintenance-pbf/src/main/webapp/dhis-web-maintenance-pbf/loadDataEntryForm.vm 2013-12-31 07:59:05 +0000 @@ -0,0 +1,53 @@ +## Macro for generating the jQuery validation rules +#macro( validate $type $require ) + #if( $type == "NUMBER" || $type == "number" ) + {validate:{ number:true #if($require), required:true #end }} + + #elseif( $type == "int" ) + {validate:{ integer:true #if($require), required:true #end }} + + #elseif( $type == "positiveNumber" ) + {validate:{ positive_integer:true #if($require), required:true #end }} + + #elseif( $type == "negativeNumber" ) + {validate:{ negative_integer:true #if($require), required:true #end }} + + + #elseif( $require ) + {validate:{required:true}} + #end +#end + + +#set( $tabIndex = 1 ) +#if ( $dataElements.size() > 0) + + + + + + #foreach($optionCombo in $optionCombos ) + + #end + + + + #set( $mark = false ) + #foreach($dataElement in $dataElements ) + + + + #foreach($optionCombo in $optionCombos ) + #set( $valueMapId = $dataElement.id + ':' + $optionCombo.id ) + #set( $dataValue = "" ) + #set( $dataValue = $!dataValueMap.get( $valueMapId ) ) + + #end + + #set( $tabIndex = $tabIndex + 1 ) + #set( $mark = !$mark) + #end + +
$i18n.getString( "dataelement" )$encoder.htmlEncode( $optionCombo.name )

$i18n.getString( "pbf_dataentry" ) 

+
    + + +
+
+ +#parse( "/dhis-web-commons/ouwt/orgunittreesearch.vm" ) \ No newline at end of file