dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #15884
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 5863: Create form to update/add optionset; add optionset into Add/Update data element form; load option...
------------------------------------------------------------
revno: 5863
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-02-06 09:56:02 +0700
message:
Create form to update/add optionset; add optionset into Add/Update data element form; load optionset into case-data-entry form in patient module.
added:
dhis-2/dhis-web/dhis-web-caseentry/java.exe.stackdump
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/patch.diff
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetListAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/ValidateOptionSetAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addOptionSetForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/optionSet.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/java.exe.stackdump
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java
dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseSelDataElementList.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties
--
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-api/src/main/java/org/hisp/dhis/option/OptionService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java 2012-02-03 08:17:56 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java 2012-02-06 02:56:02 +0000
@@ -44,6 +44,8 @@
OptionSet getOptionSet( String uid );
+ OptionSet getOptionSetByName( String name );
+
void deleteOptionSet( OptionSet optionSet );
Collection<OptionSet> getAllOptionSets();
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2012-02-03 08:17:56 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2012-02-06 02:56:02 +0000
@@ -66,6 +66,11 @@
return optionSetStore.getByUid( uid );
}
+ public OptionSet getOptionSetByName( String name )
+ {
+ return optionSetStore.getByName( name );
+ }
+
public void deleteOptionSet( OptionSet optionSet )
{
optionSetStore.delete( optionSet );
=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-01-11 06:17:35 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-02-06 02:56:02 +0000
@@ -56,7 +56,7 @@
private static final String UNKNOW_CLINIC = "unknow_clinic";
private static final String NOTAVAILABLE = "not_available";
-
+
private static final String OTHER_FACILITY = "other_facility";
private static final String DATA_ELEMENT_DOES_NOT_EXIST = "[ Data element does not exist ]";
@@ -133,9 +133,6 @@
result = populateCustomDataEntryForBoolean( result, dataValues, disabled, i18n, programStage,
programStageInstance, organisationUnit, mapDataValue );
- result = populateCustomDataEntryForCombo( result, dataValues, disabled, i18n, programStage,
- programStageInstance, organisationUnit, mapDataValue );
-
result = populateI18nStrings( result, i18n );
return result;
@@ -145,7 +142,7 @@
{
String result = populateCustomDataEntryForDate( htmlCode );
- result = populateCustomDataEntryForOption( result );
+ result = populateCustomDataEntryForBoolean( result );
result = populateCustomDataEntryForTextBox( result );
@@ -225,7 +222,7 @@
return (sb.toString().isEmpty()) ? htmlCode : sb.toString();
}
- private String populateCustomDataEntryForOption( String htmlCode )
+ private String populateCustomDataEntryForBoolean( String htmlCode )
{
// ---------------------------------------------------------------------
// Metadata code to add to HTML before outputting
@@ -265,7 +262,7 @@
int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
DataElement dataElement = dataElementService.getDataElement( dataElementId );
- if ( dataElement != null && !DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
+ if ( dataElement != null && !DataElement.VALUE_TYPE_BOOL.equals( dataElement.getType() ) )
{
continue;
}
@@ -360,234 +357,6 @@
return (sb.toString().isEmpty()) ? htmlCode : sb.toString();
}
- private String populateCustomDataEntryForTextBox( String dataEntryFormCode,
- Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
- ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit,
- Map<Integer, Collection<PatientDataValue>> mapDataValue )
- {
- // ---------------------------------------------------------------------
- // Inline Javascript to add to HTML before outputting
- // ---------------------------------------------------------------------
-
- final String jsCodeForInputs = " $DISABLED onchange=\"saveVal( $DATAELEMENTID, $OPTIONCOMBOID )\" data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE', provided:'$PROVIDED'}\" onkeypress=\"return keyPress(event, this)\" style=\" text-align:center;\" ";
-
- StringBuffer sb = new StringBuffer();
-
- // ---------------------------------------------------------------------
- // Pattern to match data elements in the HTML code
- // ---------------------------------------------------------------------
-
- Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
- Matcher dataElementMatcher = INPUT_PATTERN.matcher( dataEntryFormCode );
-
- // ---------------------------------------------------------------------
- // Iterate through all matching data element fields
- // ---------------------------------------------------------------------
-
- Map<Integer, DataElement> dataElementMap = getDataElementMap( programStage );
-
- while ( dataElementMatcher.find() )
- {
- // -----------------------------------------------------------------
- // Get HTML input field code
- // -----------------------------------------------------------------
-
- String compulsory = "null";
- String dataElementCode = dataElementMatcher.group( 1 );
-
- Matcher identifierMatcher = IDENTIFIER_PATTERN_TEXTBOX.matcher( dataElementCode );
-
- if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
- {
- // -------------------------------------------------------------
- // Get data element ID of data element
- // -------------------------------------------------------------
-
- int programStageId = Integer.parseInt( identifierMatcher.group( 1 ) );
-
- int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
-
- int optionComboId = Integer.parseInt( identifierMatcher.group( 3 ) );
-
- DataElement dataElement = null;
-
- String programStageName = programStage.getName();
-
- if ( programStageId != programStage.getId() )
- {
- dataElement = dataElementService.getDataElement( dataElementId );
-
- ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
- programStageName = otherProgramStage != null ? otherProgramStage.getName() : "N/A";
- }
- else
- {
- dataElement = dataElementMap.get( dataElementId );
- if ( dataElement == null )
- {
- return i18n.getString( "some_data_element_not_exist" );
- }
-
- ProgramStageDataElement psde = programStageDataElementService.get( programStage, dataElement );
-
- compulsory = BooleanUtils.toStringTrueFalse( psde.isCompulsory() );
- }
-
- if ( dataElement == null )
- {
- continue;
- }
-
- if ( !DataElement.VALUE_TYPE_INT.equals( dataElement.getType() )
- && !DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
- {
- continue;
- }
-
- // -------------------------------------------------------------
- // Find type of data element
- // -------------------------------------------------------------
-
- String dataElementType = dataElement.getDetailedNumberType();
-
- // -------------------------------------------------------------
- // Find existing value of data element in data set
- // -------------------------------------------------------------
-
- PatientDataValue patientDataValue = null;
-
- String dataElementValue = EMPTY;
-
- if ( programStageId != programStage.getId() )
- {
- Collection<PatientDataValue> patientDataValues = mapDataValue.get( programStageId );
-
- if ( patientDataValues == null )
- {
- ProgramStage otherProgramStage = programStageService.getProgramStage( programStageId );
- ProgramStageInstance otherProgramStageInstance = programStageInstanceService
- .getProgramStageInstance( programStageInstance.getProgramInstance(), otherProgramStage );
- patientDataValues = patientDataValueService.getPatientDataValues( otherProgramStageInstance );
- mapDataValue.put( programStageId, patientDataValues );
- }
-
- patientDataValue = getValue( patientDataValues, dataElementId, optionComboId );
-
- dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
- }
- else
- {
- patientDataValue = getValue( dataValues, dataElementId );
-
- dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
- }
-
- // -------------------------------------------------------------
- // Insert value of data element in output code
- // -------------------------------------------------------------
-
- if ( dataElementCode.contains( "value=\"\"" ) )
- {
- dataElementCode = dataElementCode.replace( "value=\"\"", "value=\"" + dataElementValue + "\"" );
- }
- else
- {
- dataElementCode += "value=\"" + dataElementValue + "\"";
- }
-
- // -------------------------------------------------------------
- // Insert title information - Data element id, name, type, min,
- // max
- // -------------------------------------------------------------
- DataElementCategoryOptionCombo optionCombo = categoryService
- .getDataElementCategoryOptionCombo( optionComboId );
-
- if ( dataElementCode.contains( "title=\"\"" ) )
- {
- dataElementCode = dataElementCode.replace( "title=\"\"", "title=\"" + dataElement.getId() + "."
- + dataElement.getName() + "-" + optionComboId + optionCombo.getName() + "-" + dataElementType
- + "\" " );
- }
- else
- {
- dataElementCode += "title=\"" + dataElement.getId() + "." + dataElement.getName() + "-"
- + optionComboId + optionCombo.getName() + "-" + dataElementType + "\" ";
- }
-
- // -------------------------------------------------------------
- // Append Javascript code and meta data (type/min/max) for
- // persisting to output code, and insert value and type for
- // fields
- // -------------------------------------------------------------
-
- String appendCode = dataElementCode;
-
- appendCode += jsCodeForInputs;
-
- appendCode += " />";
-
- // -----------------------------------------------------------
- // Check if this dataElement is from another programStage then
- // disable
- // If programStagsInstance is completed then disabled it
- // -----------------------------------------------------------
-
- disabled = "";
- if ( programStageId == programStage.getId() && !programStageInstance.isCompleted() )
- {
- // -----------------------------------------------------------
- // Add ProvidedByOtherFacility checkbox
- // -----------------------------------------------------------
-
- appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue, programStage );
- }
- else
- {
- disabled = "disabled=\"\"";
- }
-
- // -----------------------------------------------------------
- //
- // -----------------------------------------------------------
-
- String orgUnitName = i18n.getString( NOTAVAILABLE );
- String provided = "";
-
- if ( patientDataValue != null )
- {
- if ( patientDataValue.isProvidedByAnotherFacility() )
- {
- orgUnitName = i18n.getString( UNKNOW_CLINIC );
- provided = i18n.getString( OTHER_FACILITY );
- }
- else
- {
- orgUnitName = patientDataValue.getOrganisationUnit().getName();
- provided = patientDataValue.getOrganisationUnit().getName();
- }
- }
-
- appendCode = appendCode.replace( "$DATAELEMENTID", String.valueOf( dataElementId ) );
- appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
- appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
- appendCode = appendCode.replace( "$ORGUNITNAME", orgUnitName );
- appendCode = appendCode.replace( "$OPTIONCOMBOID", String.valueOf( optionComboId ) );
- appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
- appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
- appendCode = appendCode.replace( "$DISABLED", disabled );
- appendCode = appendCode.replace( "$COMPULSORY", compulsory );
- appendCode = appendCode.replace( "$SAVEMODE", "false" );
- appendCode = appendCode.replace( "$PROVIDED", provided );
-
- dataElementMatcher.appendReplacement( sb, appendCode );
- }
- }
-
- dataElementMatcher.appendTail( sb );
-
- return sb.toString();
- }
-
private String populateCustomDataEntryForBoolean( String dataEntryFormCode,
Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit,
@@ -778,7 +547,8 @@
// -----------------------------------------------------------
String orgUnitName = i18n.getString( NOTAVAILABLE );
- String provided = i18n.getString( NOTAVAILABLE );;
+ String provided = i18n.getString( NOTAVAILABLE );
+ ;
if ( patientDataValue != null )
{
if ( patientDataValue.isProvidedByAnotherFacility() )
@@ -806,8 +576,6 @@
appendCode = appendCode.replace( "i18n_select_value", i18n.getString( "select_value" ) );
appendCode = appendCode.replace( "$SAVEMODE", "false" );
-
-
appendCode = appendCode.replace( "$PROVIDED", provided );
appendCode = appendCode.replaceAll( "\\$", "\\\\\\$" );
@@ -821,16 +589,16 @@
return sb.toString();
}
- private String populateCustomDataEntryForCombo( String dataEntryFormCode, Collection<PatientDataValue> dataValues,
- String disabled, I18n i18n, ProgramStage programStage, ProgramStageInstance programStageInstance,
- OrganisationUnit organisationUnit, Map<Integer, Collection<PatientDataValue>> mapDataValue )
+ private String populateCustomDataEntryForTextBox( String dataEntryFormCode,
+ Collection<PatientDataValue> dataValues, String disabled, I18n i18n, ProgramStage programStage,
+ ProgramStageInstance programStageInstance, OrganisationUnit organisationUnit,
+ Map<Integer, Collection<PatientDataValue>> mapDataValue )
{
-
// ---------------------------------------------------------------------
// Inline Javascript to add to HTML before outputting
// ---------------------------------------------------------------------
- final String jsCodeForCombo = " name=\"entryselect\" $DISABLED data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', provided:'$PROVIDED'}\" onchange=\"saveOpt( $DATAELEMENTID )\" style=\" text-align:center;\" ";
+ final String jsCodeForInputs = " $DISABLED onchange=\"saveVal( $DATAELEMENTID, $OPTIONCOMBOID )\" data=\"{compulsory:$COMPULSORY, deName:'$DATAELEMENTNAME', deType:'$DATAELEMENTTYPE', provided:'$PROVIDED'}\" onkeypress=\"return keyPress(event, this)\" style=\" text-align:center;\" ";
StringBuffer sb = new StringBuffer();
@@ -838,6 +606,7 @@
// Pattern to match data elements in the HTML code
// ---------------------------------------------------------------------
+ Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
Matcher dataElementMatcher = INPUT_PATTERN.matcher( dataEntryFormCode );
// ---------------------------------------------------------------------
@@ -852,11 +621,10 @@
// Get HTML input field code
// -----------------------------------------------------------------
+ String compulsory = "null";
String dataElementCode = dataElementMatcher.group( 1 );
- Matcher identifierMatcher = IDENTIFIER_PATTERN_OTHERS.matcher( dataElementCode );
-
- String compulsory = "null";
+ Matcher identifierMatcher = IDENTIFIER_PATTERN_TEXTBOX.matcher( dataElementCode );
if ( identifierMatcher.find() && identifierMatcher.groupCount() > 0 )
{
@@ -865,8 +633,11 @@
// -------------------------------------------------------------
int programStageId = Integer.parseInt( identifierMatcher.group( 1 ) );
+
int dataElementId = Integer.parseInt( identifierMatcher.group( 2 ) );
+ int optionComboId = Integer.parseInt( identifierMatcher.group( 3 ) );
+
DataElement dataElement = null;
String programStageName = programStage.getName();
@@ -895,7 +666,9 @@
{
continue;
}
- if ( !DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
+
+ if ( !DataElement.VALUE_TYPE_INT.equals( dataElement.getType() )
+ && !DataElement.VALUE_TYPE_STRING.equals( dataElement.getType() ) )
{
continue;
}
@@ -904,14 +677,16 @@
// Find type of data element
// -------------------------------------------------------------
- String dataElementType = dataElement.getType();
+ String dataElementType = dataElement.getDetailedNumberType();
// -------------------------------------------------------------
// Find existing value of data element in data set
// -------------------------------------------------------------
PatientDataValue patientDataValue = null;
+
String dataElementValue = EMPTY;
+
if ( programStageId != programStage.getId() )
{
Collection<PatientDataValue> patientDataValues = mapDataValue.get( programStageId );
@@ -925,56 +700,76 @@
mapDataValue.put( programStageId, patientDataValues );
}
- patientDataValue = getValue( patientDataValues, dataElementId );
+ patientDataValue = getValue( patientDataValues, dataElementId, optionComboId );
dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
}
else
{
- patientDataValue = getValue( dataValues, dataElementId );
+ patientDataValue = getValue( dataValues, dataElementId, optionComboId );
dataElementValue = patientDataValue != null ? patientDataValue.getValue() : dataElementValue;
}
- String appendCode = dataElementCode.replaceFirst( "input", "select" );
- ;
- appendCode = appendCode.replace( "name=\"entryselect\"", jsCodeForCombo );
-
- appendCode += ">";
- appendCode += "<option value=\"\">" + i18n.getString( "no_value" ) + "</option>";
- for ( DataElementCategoryOptionCombo optionCombo : dataElement.getCategoryCombo().getOptionCombos() )
- {
- appendCode += "<option value=\"" + optionCombo.getId() + "\">" + optionCombo.getName()
- + "</option>";
- }
-
- // -------------------------------------------------------------
- // Insert value of data element in output code
- // -------------------------------------------------------------
-
- if ( patientDataValue != null )
- {
- appendCode = appendCode.replace( "<option value=\"" + patientDataValue.getOptionCombo().getId()
- + "\">", "<option value=\"" + patientDataValue.getOptionCombo().getId()
- + "\" selected=\"selected\">" );
- }
-
- appendCode += "</select>";
-
// -------------------------------------------------------------
// Insert title information - Data element id, name, type, min,
// max
// -------------------------------------------------------------
+
+ DataElementCategoryOptionCombo optionCombo = categoryService
+ .getDataElementCategoryOptionCombo( optionComboId );
if ( dataElementCode.contains( "title=\"\"" ) )
{
dataElementCode = dataElementCode.replace( "title=\"\"", "title=\"" + dataElement.getId() + "."
- + dataElement.getName() + " (" + dataElementType + ")\" " );
- }
- else
- {
- dataElementCode += "title=\"" + dataElement.getId() + "." + dataElement.getName() + " ("
- + dataElementType + ")\" ";
+ + dataElement.getName() + "-" + optionComboId + optionCombo.getName() + "-" + dataElementType
+ + "\" " );
+ }
+ else
+ {
+ dataElementCode += "title=\"" + dataElement.getId() + "." + dataElement.getName() + "-"
+ + optionComboId + optionCombo.getName() + "-" + dataElementType + "\" ";
+ }
+
+ // -------------------------------------------------------------
+ // Insert value of data element in output code
+ // -------------------------------------------------------------
+ String appendCode = dataElementCode;
+
+ if ( dataElement.getOptionSet() != null )
+ {
+ appendCode = appendCode.replaceFirst( "input", "select" );
+ appendCode = appendCode.replace( "name=\"entryfield\"", jsCodeForInputs );
+
+ appendCode += ">";
+ appendCode += "<option value=\"\">" + i18n.getString( "select_value" ) + "</option>";
+ for ( String option : dataElement.getOptionSet().getOptions() )
+ {
+ appendCode += "<option value=\"" + option + "\">" + option + "</option>";
+ }
+
+ if ( patientDataValue != null )
+ {
+ appendCode = appendCode.replace( "<option value=\"" + patientDataValue.getValue() + "\">",
+ "<option value=\"" + patientDataValue.getValue() + "\" selected=\"selected\">" );
+ }
+
+ appendCode += "</select>";
+ }
+ else
+ {
+ if ( appendCode.contains( "value=\"\"" ) )
+ {
+ appendCode = appendCode.replace( "value=\"\"", "value=\"" + dataElementValue + "\"" );
+ }
+ else
+ {
+ appendCode += "value=\"" + dataElementValue + "\"";
+ }
+
+ appendCode += jsCodeForInputs;
+
+ appendCode += " />";
}
// -----------------------------------------------------------
@@ -986,23 +781,24 @@
disabled = "";
if ( programStageId != programStage.getId() || programStageInstance.isCompleted() )
{
- disabled = "disabled";
+ disabled = "disabled=\"\"";
}
else
{
- // -----------------------------------------------------------
+ // ---------------------------------------------------------
// Add ProvidedByOtherFacility checkbox
- // -----------------------------------------------------------
+ // ---------------------------------------------------------
appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue, programStage );
}
-
+
// -----------------------------------------------------------
//
// -----------------------------------------------------------
String orgUnitName = i18n.getString( NOTAVAILABLE );
- String provided = i18n.getString( NOTAVAILABLE );
+ String provided = "";
+
if ( patientDataValue != null )
{
if ( patientDataValue.isProvidedByAnotherFacility() )
@@ -1021,16 +817,14 @@
appendCode = appendCode.replace( "$PROGRAMSTAGEID", String.valueOf( programStageId ) );
appendCode = appendCode.replace( "$PROGRAMSTAGENAME", programStageName );
appendCode = appendCode.replace( "$ORGUNITNAME", orgUnitName );
+ appendCode = appendCode.replace( "$OPTIONCOMBOID", String.valueOf( optionComboId ) );
appendCode = appendCode.replace( "$DATAELEMENTNAME", dataElement.getName() );
appendCode = appendCode.replace( "$DATAELEMENTTYPE", dataElementType );
appendCode = appendCode.replace( "$DISABLED", disabled );
appendCode = appendCode.replace( "$COMPULSORY", compulsory );
- appendCode = appendCode.replace( "i18n_select_value", i18n.getString( "select_value" ) );
appendCode = appendCode.replace( "$SAVEMODE", "false" );
appendCode = appendCode.replace( "$PROVIDED", provided );
- appendCode = appendCode.replaceAll( "\\$", "\\\\\\$" );
-
dataElementMatcher.appendReplacement( sb, appendCode );
}
}
@@ -1336,7 +1130,8 @@
* @param patientDataValue: currrent PatientDataValue
* @return full html code after append the check box
*/
- private String addProvidedByOtherFacilityCheckbox( String appendCode, PatientDataValue patientDataValue, ProgramStage programStage )
+ private String addProvidedByOtherFacilityCheckbox( String appendCode, PatientDataValue patientDataValue,
+ ProgramStage programStage )
{
appendCode += "<label for=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" title=\"is provided by another Facility ?\" ></label><input name=\"providedByAnotherFacility\" title=\"is provided by another Facility ?\" id=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" type=\"checkbox\" style=\"display:$DISPLAY;\" ";
@@ -1346,9 +1141,9 @@
}
appendCode += "onChange=\"updateProvidingFacility( $DATAELEMENTID, this )\" >";
- String display = ( programStage.getProgram().getAnonymous() ) ? "none" : "block";
+ String display = (programStage.getProgram().getAnonymous()) ? "none" : "block";
appendCode = appendCode.replace( "$DISPLAY", display );
-
+
return appendCode;
}
=== added file 'dhis-2/dhis-web/dhis-web-caseentry/java.exe.stackdump'
--- dhis-2/dhis-web/dhis-web-caseentry/java.exe.stackdump 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/java.exe.stackdump 2012-02-06 02:56:02 +0000
@@ -0,0 +1,12 @@
+Exception: STATUS_ACCESS_VIOLATION at eip=610C8439
+eax=00000000 ebx=00000001 ecx=00000000 edx=00000234 esi=00000000 edi=1AE5CCB0
+ebp=1AE5CAEC esp=1AE5CAC4 program=\\?\C:\Program Files (x86)\Java\jdk1.6.0_20\bin\java.exe, pid 2896, thread unknown (0x1544)
+cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
+Stack trace:
+Frame Function Args
+1AE5CAEC 610C8439 (00000000, 00000000, 00000000, 00000000)
+1AE5CBFC 610C8DD5 (00000000, 00000000, 00000000, 00000000)
+1AE5CCBC 610C9B3A (FFFFFFFF, FFFFFFFF, 74F734F3, FFFFFFFE)
+1AE5CD0C 61028182 (00000002, 44187AF8, 1AE5CE64, 00000002)
+1AE5CD98 763E6B59 (00000002, 1AE5CDD4, 763E69A4, 00000002)
+End of stack trace
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2011-11-15 08:44:02 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/LoadDataEntryAction.java 2012-02-06 02:56:02 +0000
@@ -35,8 +35,6 @@
import java.util.Map;
import org.hisp.dhis.caseentry.state.SelectedStateManager;
-import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -47,7 +45,6 @@
import org.hisp.dhis.program.ProgramInstance;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
-import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.program.ProgramStageService;
@@ -75,8 +72,6 @@
private ProgramStageInstanceService programStageInstanceService;
- private ProgramStageDataElementService programStageDataElementService;
-
private SelectedStateManager selectedStateManager;
// -------------------------------------------------------------------------
@@ -93,9 +88,7 @@
private List<ProgramStageDataElement> programStageDataElements = new ArrayList<ProgramStageDataElement>();
- private Map<Integer, PatientDataValue> patientDataValueMap;
-
- private Map<Integer, Collection<DataElementCategoryOptionCombo>> optionMap = new HashMap<Integer, Collection<DataElementCategoryOptionCombo>>();
+ private Map<String, PatientDataValue> patientDataValueMap;
private OrganisationUnit organisationUnit;
@@ -115,11 +108,6 @@
return program;
}
- public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
- {
- this.programStageDataElementService = programStageDataElementService;
- }
-
public void setProgramStageService( ProgramStageService programStageService )
{
this.programStageService = programStageService;
@@ -139,12 +127,7 @@
{
this.patientDataValueService = patientDataValueService;
}
-
- public Map<Integer, Collection<DataElementCategoryOptionCombo>> getOptionMap()
- {
- return optionMap;
- }
-
+
public OrganisationUnit getOrganisationUnit()
{
return organisationUnit;
@@ -175,7 +158,7 @@
return programStageDataElements;
}
- public Map<Integer, PatientDataValue> getPatientDataValueMap()
+ public Map<String, PatientDataValue> getPatientDataValueMap()
{
return patientDataValueMap;
}
@@ -210,18 +193,7 @@
if ( programStageInstance != null )
{
selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
-
- // ---------------------------------------------------------------------
- // Get CategoryOptions
- // ---------------------------------------------------------------------
-
- Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
-
- for ( DataElement dataElement : dataElements )
- {
- optionMap.put( dataElement.getId(), dataElement.getCategoryCombo().getOptionCombos() );
- }
-
+
// ---------------------------------------------------------------------
// Get data values
// ---------------------------------------------------------------------
@@ -229,11 +201,12 @@
Collection<PatientDataValue> patientDataValues = patientDataValueService
.getPatientDataValues( programStageInstance );
- patientDataValueMap = new HashMap<Integer, PatientDataValue>( patientDataValues.size() );
+ patientDataValueMap = new HashMap<String, PatientDataValue>( patientDataValues.size() );
for ( PatientDataValue patientDataValue : patientDataValues )
{
- patientDataValueMap.put( patientDataValue.getDataElement().getId(), patientDataValue );
+ String key = patientDataValue.getDataElement().getId() + "-" + patientDataValue.getOptionCombo().getId();
+ patientDataValueMap.put( key, patientDataValue );
}
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java 2012-01-11 05:31:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/java/org/hisp/dhis/caseentry/action/caseentry/ProgramStageCustomDataEntryAction.java 2012-02-06 02:56:02 +0000
@@ -27,11 +27,15 @@
package org.hisp.dhis.caseentry.action.caseentry;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import org.hisp.dhis.caseentry.state.SelectedStateManager;
import org.hisp.dhis.dataelement.DataElement;
-import org.hisp.dhis.dataelement.DataElementCategoryOptionCombo;
import org.hisp.dhis.dataentryform.DataEntryForm;
import org.hisp.dhis.i18n.I18n;
import org.hisp.dhis.organisationunit.OrganisationUnit;
@@ -44,7 +48,6 @@
import org.hisp.dhis.program.ProgramDataEntryService;
import org.hisp.dhis.program.ProgramStage;
import org.hisp.dhis.program.ProgramStageDataElement;
-import org.hisp.dhis.program.ProgramStageDataElementService;
import org.hisp.dhis.program.ProgramStageInstance;
import org.hisp.dhis.program.ProgramStageInstanceService;
import org.hisp.dhis.program.comparator.ProgramStageDataElementSortOrderComparator;
@@ -93,13 +96,6 @@
this.programDataEntryService = programDataEntryService;
}
- private ProgramStageDataElementService programStageDataElementService;
-
- public void setProgramStageDataElementService( ProgramStageDataElementService programStageDataElementService )
- {
- this.programStageDataElementService = programStageDataElementService;
- }
-
// -------------------------------------------------------------------------
// Output
// -------------------------------------------------------------------------
@@ -168,17 +164,10 @@
{
return dataElements;
}
-
- private Map<Integer, Collection<DataElementCategoryOptionCombo>> optionMap = new HashMap<Integer, Collection<DataElementCategoryOptionCombo>>();
-
- public Map<Integer, Collection<DataElementCategoryOptionCombo>> getOptionMap()
- {
- return optionMap;
- }
-
- private Map<Integer, PatientDataValue> patientDataValueMap;
-
- public Map<Integer, PatientDataValue> getPatientDataValueMap()
+
+ private Map<String, PatientDataValue> patientDataValueMap;
+
+ public Map<String, PatientDataValue> getPatientDataValueMap()
{
return patientDataValueMap;
}
@@ -263,18 +252,7 @@
selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
selectedStateManager.setSelectedProgramStageInstance( programStageInstance );
-
- // ---------------------------------------------------------------------
- // Get CategoryOptions
- // ---------------------------------------------------------------------
-
- Collection<DataElement> dataElements = programStageDataElementService.getListDataElement( programStage );
-
- for ( DataElement dataElement : dataElements )
- {
- optionMap.put( dataElement.getId(), dataElement.getCategoryCombo().getOptionCombos() );
- }
-
+
// ---------------------------------------------------------------------
// Get data values
// ---------------------------------------------------------------------
@@ -282,11 +260,12 @@
Collection<PatientDataValue> patientDataValues = patientDataValueService
.getPatientDataValues( programStageInstance );
- patientDataValueMap = new HashMap<Integer, PatientDataValue>( patientDataValues.size() );
+ patientDataValueMap = new HashMap<String, PatientDataValue>( patientDataValues.size() );
for ( PatientDataValue patientDataValue : patientDataValues )
{
- patientDataValueMap.put( patientDataValue.getDataElement().getId(), patientDataValue );
+ String key = patientDataValue.getDataElement().getId()+"-" + patientDataValue.getOptionCombo().getId();
+ patientDataValueMap.put( key, patientDataValue );
}
DataEntryForm dataEntryForm = programStage.getDataEntryForm();
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-01-15 02:14:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/META-INF/dhis/beans.xml 2012-02-06 02:56:02 +0000
@@ -145,8 +145,6 @@
ref="org.hisp.dhis.patientdatavalue.PatientDataValueService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- <property name="programStageDataElementService"
- ref="org.hisp.dhis.program.ProgramStageDataElementService" />
<property name="selectedStateManager"
ref="org.hisp.dhis.caseentry.state.SelectedStateManager" />
</bean>
@@ -221,8 +219,6 @@
ref="org.hisp.dhis.patient.PatientIdentifierService" />
<property name="programStageInstanceService"
ref="org.hisp.dhis.program.ProgramStageInstanceService" />
- <property name="programStageDataElementService"
- ref="org.hisp.dhis.program.ProgramStageDataElementService" />
</bean>
<!-- Visit Plan -->
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-02-01 09:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties 2012-02-06 02:56:02 +0000
@@ -468,4 +468,5 @@
intro_anonymous_event_reports = Create anonymous events report by reported date.
activity_planning = Activity Planning
back_to_main_menu = Back to main menu
-of = of
\ No newline at end of file
+of = of
+option_set = Option set
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-02-01 09:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-02-06 02:56:02 +0000
@@ -65,83 +65,78 @@
#set( $mark = true )
#set( $tabIndex = 1 )
#foreach( $programStageDataElement in $programStageDataElements )
- #set( $dataElementRowCount = $dataElementRowCount + 1 )
- #if( $mark )
- #set( $mark = false )
- #else
- #set( $mark = true )
- #end
- #set( $patientDataValue = false )
- #set( $patientDataValue = $patientDataValueMap.get( $programStageDataElement.dataElement.id ) )
- <tr #alternate( $mark )>
- ##dataElementRowCount
- <td>$dataElementRowCount</td>
- ##data element name
- <td class='text-column'>
- <span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
- $encoder.htmlEncode( $programStageDataElement.dataElement.name )
- #if ( $programStageDataElement.compulsory )
- <em title="$i18n.getString( "required" )" class="required">*</em>
- #end
- </span>
- ##type
- <span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>
- </td>
- ##entry
- <td>
- #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
- #if( $programStageDataElement.dataElement.type == "bool" )
- <select name="entryselect" #if($programStageInstance.completed) disabled="disabled" #end data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
- <option value="">[$i18n.getString( "select_value" )]</option>
- <option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
- <option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
- </select>
- #elseif( $programStageDataElement.dataElement.type == "string" && $programStageDataElement.dataElement.isMultiDimensional() )
- #set( $optionValues = $optionMap.get( $programStageDataElement.dataElement.id ) )
- <select name="entryselect" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
- <option value="">[$i18n.getString( "no_value" )]</option>
- #foreach( $optionValue in $optionValues )
- <option value="$optionValue.id" #if( $patientDataValue.value == $optionValue.id ) selected="selected" #end>$encoder.htmlEncode( $optionValue.name )</option>
+ #foreach( $optionCombo in $!programStageDataElement.dataElement.categoryCombo.optionCombos )
+ #set( $dataElementRowCount = $dataElementRowCount + 1 )
+ #set( $mark = !$mark )
+ #set( $patientDataValue = false )
+ #set( $key = $programStageDataElement.dataElement.id + '-' + $optionCombo.id)
+ #set( $patientDataValue = $patientDataValueMap.get( $key ) )
+ <tr #alternate( $mark )>
+ ##dataElementRowCount
+ <td>$dataElementRowCount</td>
+ ##data element name
+ <td class='text-column'>
+ <span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
+ $encoder.htmlEncode( $programStageDataElement.dataElement.name ) $optionCombo.name
+ #if ( $programStageDataElement.compulsory )
+ <em title="$i18n.getString( "required" )" class="required">*</em>
+ #end
+ </span>
+ ##type
+ <span id="value[$programStageDataElement.dataElement.id].type" class="hidden">$encoder.htmlEncode( $programStageDataElement.dataElement.type )</span></td>
+ </td>
+ ##entry
+ <td>
+ #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val' )
+ #if( $!programStageDataElement.dataElement.optionSet )
+ #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-' + $optionCombo.id + '-val' )
+ <select name="entryselect" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" onchange="saveVal( $programStageDataElement.dataElement.id, $optionCombo.id )" tabindex="$tabIndex">
+ <option value="">[$i18n.getString( "select_value" )]</option>
+ #foreach( $option in $programStageDataElement.dataElement.optionSet.options )
+ <option value="$option" #if( $patientDataValue.value == $option ) selected="selected" #end>$encoder.htmlEncode( $option )</option>
+ #end
+ </select>
+ #elseif( $programStageDataElement.dataElement.type == "bool" )
+ <select name="entryselect" #if($programStageInstance.completed) disabled="disabled" #end data="{compulsory: $programStageDataElement.compulsory }" id="$id" onchange="saveOpt( $programStageDataElement.dataElement.id )" tabindex="$tabIndex">
+ <option value="">[$i18n.getString( "select_value" )]</option>
+ <option value="true" #if( $patientDataValue.value == "true" ) selected="selected" #end>$i18n.getString( "yes" )</option>
+ <option value="false" #if( $patientDataValue.value == "false" ) selected="selected" #end>$i18n.getString( "no" )</option>
+ </select>
+ #elseif( $programStageDataElement.dataElement.type == "date" )
+ <input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveDate( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
+ #if(!$programStageInstance.completed)
+ <script type="text/javascript">
+ datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
+ </script>
#end
- </select>
- #elseif( $programStageDataElement.dataElement.type == "date" )
- <input type="text" data="{compulsory: $programStageDataElement.compulsory }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveDate( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" >
- #if(!$programStageInstance.completed)
- <script type="text/javascript">
- datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
- </script>
+ #else
+ #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-' + $optionCombo.id + '-val' )
+ <input name="entryfield" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id, $optionCombo.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
#end
+ </td>
+
+ ##providedByAnotherFacility
+ #set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
+ #if($programStageInstance.programInstance.program.anonymous == 'false')
+ <td>
+ #if ( $patientDataValue.value )
+ #if( !$patientDataValue.providedByAnotherFacility )
+ $patientDataValue.organisationUnit.name
+ <input name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
+ #else
+ $i18n.getString("other_facility")
+ <input name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
+ #end
+ #else
+ <input name="providedByAnotherFacility" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
+ #end
+ </td>
#else
- #foreach( $optionCombo in $programStageDataElement.dataElement.categoryCombo.optionCombos )
- #set( $id = $programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-' + $optionCombo.id + '-val' )
- <input name="entryfield" data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" #if($programStageInstance.completed) disabled="disabled" #end id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id, $optionCombo.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
- #end
- #end
- </td>
-
-
- ##providedByAnotherFacility
- #set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
- #if($programStageInstance.programInstance.program.anonymous == 'false')
- <td>
- #if ( $patientDataValue.value )
- #if( !$patientDataValue.providedByAnotherFacility )
- $patientDataValue.organisationUnit.name
- <input name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
- #else
- $i18n.getString("other_facility")
- <input name="providedByAnotherFacility" id="$id" type="hidden" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
- #end
- #else
- <input name="providedByAnotherFacility" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($programStageInstance.completed) disabled="disabled" #end >
- #end
- </td>
-
- #else
- <input name="providedByAnotherFacility" id="$id" type="hidden">
- #end
- </tr>
- #set( $tabIndex = $tabIndex + 1 )
+ <input name="providedByAnotherFacility" id="$id" type="hidden">
+ #end
+ </tr>
+ #set( $tabIndex = $tabIndex + 1 )
+ #end
#end
</table>
#end
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm 2012-02-01 09:10:08 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataRecordingSelect.vm 2012-02-06 02:56:02 +0000
@@ -95,4 +95,6 @@
loadProgramStages();
}
});
+
+ selection.setListenerFunction( organisationUnitSelected );
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-01-31 06:22:35 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js 2012-02-06 02:56:02 +0000
@@ -41,6 +41,7 @@
jQuery('#dueDateTR').attr('class','hidden');
enable('completeBtn');
enable('validationBtn');
+ hideById('currentSelection');
loadDataEntry();
}
@@ -148,6 +149,8 @@
name:'data'
});
var field = byId( fieldId );
+ //var fieldValue = ( field.name = 'entryselect' ) ?
+
var dataElementName = data.deName;
var type = data.deType;
var providedByAnotherFacility = document.getElementById( programStageId + '_' + dataElementId + '_facility' ).checked;
@@ -164,7 +167,6 @@
window.alert( i18n_value_must_integer + '\n\n' + dataElementName );
- field.select();
field.focus();
return;
@@ -173,7 +175,6 @@
{
field.style.backgroundColor = '#ffcc00';
window.alert( i18n_value_must_number + '\n\n' + dataElementName );
- field.select();
field.focus();
return;
@@ -182,7 +183,6 @@
{
field.style.backgroundColor = '#ffcc00';
window.alert( i18n_value_must_positive_integer + '\n\n' + dataElementName );
- field.select();
field.focus();
return;
@@ -191,7 +191,6 @@
{
field.style.backgroundColor = '#ffcc00';
window.alert( i18n_value_must_negative_integer + '\n\n' + dataElementName );
- field.select();
field.focus();
return;
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2011-12-28 06:21:57 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/form.js 2012-02-06 02:56:02 +0000
@@ -14,8 +14,6 @@
enable('listPatientBtn');
}
-selection.setListenerFunction( organisationUnitSelected );
-
//--------------------------------------------------------------------------------------------
// Show selected data-recording
//--------------------------------------------------------------------------------------------
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2012-01-03 06:11:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/multiDataEntry.js 2012-02-06 02:56:02 +0000
@@ -31,8 +31,6 @@
selection.setListenerFunction( multiDataEntryOrgunitSelected );
-
-
function selectProgram()
{
setInnerHTML('listPatient', '');
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/patch.diff'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/patch.diff 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/patch.diff 2012-02-06 02:56:02 +0000
@@ -0,0 +1,235 @@
+=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java'
+--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java 2012-02-03 08:17:56 +0000
++++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/option/OptionService.java 2012-02-03 14:47:55 +0000
+@@ -44,6 +44,8 @@
+
+ OptionSet getOptionSet( String uid );
+
++ OptionSet getOptionSetByName( String name );
++
+ void deleteOptionSet( OptionSet optionSet );
+
+ Collection<OptionSet> getAllOptionSets();
+
+=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java'
+--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2012-02-03 08:17:56 +0000
++++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/option/DefaultOptionService.java 2012-02-03 14:48:50 +0000
+@@ -66,6 +66,11 @@
+ return optionSetStore.getByUid( uid );
+ }
+
++ public OptionSet getOptionSetByName( String name )
++ {
++ return optionSetStore.getByName( name );
++ }
++
+ public void deleteOptionSet( OptionSet optionSet )
+ {
+ optionSetStore.delete( optionSet );
+
+=== modified file 'dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
+--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-01-11 06:17:35 +0000
++++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-02-04 07:47:01 +0000
+@@ -539,7 +539,7 @@
+ // Add ProvidedByOtherFacility checkbox
+ // -----------------------------------------------------------
+
+- appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue, programStage );
++ appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
+ }
+ else
+ {
+@@ -770,7 +770,7 @@
+ // Add ProvidedByOtherFacility checkbox
+ // -----------------------------------------------------------
+
+- appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue, programStage );
++ appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
+ }
+
+ // -----------------------------------------------------------
+@@ -994,7 +994,7 @@
+ // Add ProvidedByOtherFacility checkbox
+ // -----------------------------------------------------------
+
+- appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue, programStage );
++ appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
+ }
+
+ // -----------------------------------------------------------
+@@ -1223,7 +1223,7 @@
+ // Add ProvidedByOtherFacility checkbox
+ // ---------------------------------------------------------
+
+- appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue, programStage );
++ appendCode = addProvidedByOtherFacilityCheckbox( appendCode, patientDataValue );
+ }
+
+ // -------------------------------------------------------------
+@@ -1336,9 +1336,9 @@
+ * @param patientDataValue: currrent PatientDataValue
+ * @return full html code after append the check box
+ */
+- private String addProvidedByOtherFacilityCheckbox( String appendCode, PatientDataValue patientDataValue, ProgramStage programStage )
++ private String addProvidedByOtherFacilityCheckbox( String appendCode, PatientDataValue patientDataValue )
+ {
+- appendCode += "<label for=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" title=\"is provided by another Facility ?\" ></label><input name=\"providedByAnotherFacility\" title=\"is provided by another Facility ?\" id=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" type=\"checkbox\" style=\"display:$DISPLAY;\" ";
++ appendCode += "<label for=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" title=\"is provided by another Facility ?\" ></label><input name=\"providedByAnotherFacility\" title=\"is provided by another Facility ?\" id=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" type=\"checkbox\" ";
+
+ if ( patientDataValue != null && patientDataValue.isProvidedByAnotherFacility() )
+ {
+@@ -1346,9 +1346,6 @@
+ }
+ appendCode += "onChange=\"updateProvidingFacility( $DATAELEMENTID, this )\" >";
+
+- String display = ( programStage.getProgram().getAnonymous() ) ? "none" : "block";
+- appendCode = appendCode.replace( "$DISPLAY", display );
+-
+ return appendCode;
+
+ }
+
+=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
+--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-02 20:01:36 +0000
++++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-03 15:46:03 +0000
+@@ -333,4 +333,36 @@
+ <property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
+ </bean>
+
++ <!-- OptionSet -->
++
++ <bean id="org.hisp.dhis.dataadmin.action.option.GetOptionSetListAction" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetListAction"
++ scope="prototype">
++ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
++ </bean>
++
++ <bean id="org.hisp.dhis.dataadmin.action.option.AddOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.AddOptionSetAction"
++ scope="prototype">
++ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
++ </bean>
++
++ <bean id="org.hisp.dhis.dataadmin.action.option.UpdateOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.UpdateOptionSetAction"
++ scope="prototype">
++ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
++ </bean>
++
++ <bean id="org.hisp.dhis.dataadmin.action.option.RemoveOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.RemoveOptionSetAction"
++ scope="prototype">
++ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
++ </bean>
++
++ <bean id="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction"
++ scope="prototype">
++ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
++ </bean>
++
++ <bean id="org.hisp.dhis.dataadmin.action.option.ValidateOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.ValidateOptionSetAction"
++ scope="prototype">
++ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
++ </bean>
++
+ </beans>
+
+=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
+--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2012-01-28 17:42:13 +0000
++++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2012-02-04 07:19:38 +0000
+@@ -380,4 +380,14 @@
+ execute_now=Execute now
+ execute_tasks_confirmation=Are you sure you want to execute all tasks now? Task processing might fully utilize your system resources and slow down other operations.
+ no_aggregation=No aggregation
+-data_elements_in_data_set_not_in_form = Data elements in data set but not in form or sections
+\ No newline at end of file
++data_elements_in_data_set_not_in_form = Data elements in data set but not in form or sections
++option_set = Option set
++intro_option_set = Create the option values which would be included in data elements.
++add_option_set = Add option set
++options = Options
++option = Option
++add_option = Add Option
++option_name_already_exists = The option name already exists
++specify_option_name = Please specify a option name
++must_include_option = Please include one or more category options
++edit_option_set = Edit option set
+
+=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
+--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2011-11-24 13:19:36 +0000
++++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2012-02-04 06:38:16 +0000
+@@ -569,5 +569,61 @@
+ <param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
+ </action>
+
++
++ <!-- OptionSet -->
++
++ <action name="optionSet" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetListAction">
++ <result name="success" type="velocity">/main.vm</result>
++ <param name="page">/dhis-web-maintenance-dataadmin/optionSet.vm</param>
++ <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
++ <param name="javascripts">javascript/optionSet.js</param>
++ <param name="requiredAuthorities">F_OPTIONSET_MANAGEMENT</param>
++ </action>
++
++ <action name="showAddOptionSetForm" class="org.hisp.dhis.dataadmin.action.NoAction">
++ <result name="success" type="velocity">/main.vm</result>
++ <param name="page">/dhis-web-maintenance-dataadmin/addOptionSetForm.vm</param>
++ <param name="javascripts">javascript/optionSet.js</param>
++ <param name="requiredAuthorities">F_OPTIONSET_ADD</param>
++ </action>
++
++ <action name="addOptionSet" class="org.hisp.dhis.dataadmin.action.option.AddOptionSetAction">
++ <result name="success" type="redirect">optionSet.action</result>
++ <param name="requiredAuthorities">F_OPTIONSET_ADD</param>
++ </action>
++
++ <action name="showUpdateOptionSetForm" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction">
++ <result name="success" type="velocity">/main.vm</result>
++ <param name="page">/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm</param>
++ <param name="javascripts">javascript/optionSet.js</param>
++ <param name="requiredAuthorities">F_OPTIONSET_UPDATE</param>
++ </action>
++
++ <action name="updateOptionSet" class="org.hisp.dhis.dataadmin.action.option.UpdateOptionSetAction">
++ <result name="success" type="redirect">optionSet.action</result>
++ <param name="requiredAuthorities">F_OPTIONSET_UPDATE</param>
++ </action>
++
++ <action name="removeOptionSet" class="org.hisp.dhis.dataadmin.action.option.RemoveOptionSetAction">
++ <result name="success" type="velocity-json">
++ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
++ <param name="requiredAuthorities">F_OPTIONSET_DELETE</param>
++ </action>
++
++ <action name="validateOptionSet"
++ class="org.hisp.dhis.dataadmin.action.option.ValidateOptionSetAction">
++ <result name="success" type="velocity-json">
++ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
++ <result name="error" type="velocity-json">
++ /dhis-web-commons/ajax/jsonResponseError.vm</result>
++ <param name="onExceptionReturn">plainTextError</param>
++ </action>
++
++ <action name="getOptionSet"
++ class="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction">
++ <result name="success" type="velocity-json">
++ /dhis-web-maintenance-dataadmin/jsonOptionSet.vm</result>
++ </action>
++
+ </package>
+ </struts>
+
+=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
+--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-01-03 06:08:25 +0000
++++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-02-03 15:56:53 +0000
+@@ -167,7 +167,10 @@
+ F_VALIDATIONCRITERIA_DELETE=Delete Validation Criteria
+ F_VALIDATIONCRITERIA_UPDATE=Update Validation Criteria
+ F_SEND_MESSAGE=Send message
+-F_DV_ADMIN=Administrate Data Visualizer
++F_OPTIONSET_MANAGEMENT=Option Set Management
++F_OPTIONSET_ADD=Add Option Set
++F_OPTIONSET_UPDATE=Update Option Set
++F_OPTIONSET_DELETE=Delete Option Set
+
+ #-- User module ---------------------------------------------------------------#
+
+
=== added directory 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option'
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/AddOptionSetAction.java 2012-02-06 02:56:02 +0000
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.option;
+
+import java.util.Set;
+
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $AddOptionSetAction.java Feb 3, 2012 9:28:11 PM$
+ */
+public class AddOptionSetAction
+ implements Action
+{
+ // -------------------------------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------------------------------
+
+ private OptionService optionService;
+
+ // -------------------------------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------------------------------
+
+ private String name;
+
+ private Set<String> options;
+
+ // -------------------------------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------------------------------
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public void setOptions( Set<String> options )
+ {
+ this.options = options;
+ }
+
+ // -------------------------------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ OptionSet optionSet = new OptionSet(name);
+ optionSet.setOptions( options );
+
+ optionService.saveOptionSet( optionSet );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetAction.java 2012-02-06 02:56:02 +0000
@@ -0,0 +1,89 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.option;
+
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $GetOptionSetAction.java Feb 3, 2012 9:28:11 PM$
+ */
+public class GetOptionSetAction
+ implements Action
+{
+ // -------------------------------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------------------------------
+
+ private OptionService optionService;
+
+ // -------------------------------------------------------------------------------------------------
+ // Input/Output
+ // -------------------------------------------------------------------------------------------------
+
+ private Integer id;
+
+ private OptionSet optionSet;
+
+ // -------------------------------------------------------------------------------------------------
+ // Getters && Setters
+ // -------------------------------------------------------------------------------------------------
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
+ public OptionSet getOptionSet()
+ {
+ return optionSet;
+ }
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ optionSet = optionService.getOptionSet( id );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetListAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetListAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/GetOptionSetListAction.java 2012-02-06 02:56:02 +0000
@@ -0,0 +1,86 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.option;
+
+import java.util.Collection;
+
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $GetOptionSetListAction.java Feb 3, 2012 9:28:11 PM$
+ */
+public class GetOptionSetListAction
+ implements Action
+{
+ // -------------------------------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------------------------------
+
+ private OptionService optionService;
+
+ // -------------------------------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------------------------------
+
+ private String name;
+
+ private Collection<OptionSet> optionSets;
+
+ // -------------------------------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------------------------------
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
+ public Collection<OptionSet> getOptionSets()
+ {
+ return optionSets;
+ }
+
+ // -------------------------------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ optionSets = optionService.getAllOptionSets();
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionSetAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/RemoveOptionSetAction.java 2012-02-06 02:56:02 +0000
@@ -0,0 +1,81 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.option;
+
+import org.hisp.dhis.option.OptionService;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $RemoveOptionSetAction.java Feb 3, 2012 9:28:11 PM$
+ */
+public class RemoveOptionSetAction
+ implements Action
+{
+ // -------------------------------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------------------------------
+
+ private OptionService optionService;
+
+ // -------------------------------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------------------------------
+
+ private Integer id;
+
+ // -------------------------------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------------------------------
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ // -------------------------------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ optionService.deleteOptionSet( optionService.getOptionSet( id ) );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/UpdateOptionSetAction.java 2012-02-06 02:56:02 +0000
@@ -0,0 +1,102 @@
+/*
+ * 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.
+ */
+
+package org.hisp.dhis.dataadmin.action.option;
+
+import java.util.Set;
+
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $UpdateOptionSetAction.java Feb 3, 2012 9:28:11 PM$
+ */
+public class UpdateOptionSetAction
+ implements Action
+{
+ // -------------------------------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------------------------------
+
+ private OptionService optionService;
+
+ // -------------------------------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------------------------------
+
+ private Integer id;
+
+ private String name;
+
+ private Set<String> options;
+
+ // -------------------------------------------------------------------------------------------------
+ // Setters
+ // -------------------------------------------------------------------------------------------------
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ public void setOptions( Set<String> options )
+ {
+ this.options = options;
+ }
+
+ // -------------------------------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------------------------------
+
+ @Override
+ public String execute()
+ throws Exception
+ {
+ OptionSet optionSet = optionService.getOptionSet( id );
+ optionSet.setName( name );
+ optionSet.setOptions( options );
+
+ optionService.updateOptionSet( optionSet );
+
+ return SUCCESS;
+ }
+
+}
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/ValidateOptionSetAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/ValidateOptionSetAction.java 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/java/org/hisp/dhis/dataadmin/action/option/ValidateOptionSetAction.java 2012-02-06 02:56:02 +0000
@@ -0,0 +1,117 @@
+package org.hisp.dhis.dataadmin.action.option;
+
+/*
+ * 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.dataelement.DataElementCategory;
+import org.hisp.dhis.dataelement.DataElementCategoryService;
+import org.hisp.dhis.i18n.I18n;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
+
+import com.opensymphony.xwork2.Action;
+
+/**
+ * @author Chau Thu Tran
+ *
+ * @version $ValidateOptionSetAction.java Feb 3, 2012 9:28:11 PM$
+ */
+public class ValidateOptionSetAction
+ implements Action
+{
+ // -------------------------------------------------------------------------
+ // Dependencies
+ // -------------------------------------------------------------------------
+
+ private OptionService optionService;
+
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
+ private I18n i18n;
+
+ public void setI18n( I18n i18n )
+ {
+ this.i18n = i18n;
+ }
+
+ // -------------------------------------------------------------------------
+ // Input
+ // -------------------------------------------------------------------------
+
+ private Integer id;
+
+ public void setId( Integer id )
+ {
+ this.id = id;
+ }
+
+ private String name;
+
+ public void setName( String name )
+ {
+ this.name = name;
+ }
+
+ // -------------------------------------------------------------------------
+ // Output
+ // -------------------------------------------------------------------------
+
+ private String message;
+
+ public String getMessage()
+ {
+ return message;
+ }
+
+ // -------------------------------------------------------------------------
+ // Action implementation
+ // -------------------------------------------------------------------------
+
+ public String execute()
+ {
+ if ( name != null )
+ {
+ OptionSet match = optionService.getOptionSetByName( name );
+
+ if ( match != null && (id == null || match.getId() != id) )
+ {
+ message = i18n.getString( "name_in_use" );
+
+ return ERROR;
+ }
+ }
+
+ message = "ok";
+
+ return SUCCESS;
+ }
+
+}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-02 20:01:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/META-INF/dhis/beans.xml 2012-02-06 02:56:02 +0000
@@ -333,4 +333,36 @@
<property name="organisationUnitService" ref="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</bean>
+ <!-- OptionSet -->
+
+ <bean id="org.hisp.dhis.dataadmin.action.option.GetOptionSetListAction" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetListAction"
+ scope="prototype">
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.dataadmin.action.option.AddOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.AddOptionSetAction"
+ scope="prototype">
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.dataadmin.action.option.UpdateOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.UpdateOptionSetAction"
+ scope="prototype">
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.dataadmin.action.option.RemoveOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.RemoveOptionSetAction"
+ scope="prototype">
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction"
+ scope="prototype">
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
+ </bean>
+
+ <bean id="org.hisp.dhis.dataadmin.action.option.ValidateOptionSetAction" class="org.hisp.dhis.dataadmin.action.option.ValidateOptionSetAction"
+ scope="prototype">
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
+ </bean>
+
</beans>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2012-01-28 17:42:13 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/org/hisp/dhis/dataadmin/i18n_module.properties 2012-02-06 02:56:02 +0000
@@ -380,4 +380,16 @@
execute_now=Execute now
execute_tasks_confirmation=Are you sure you want to execute all tasks now? Task processing might fully utilize your system resources and slow down other operations.
no_aggregation=No aggregation
-data_elements_in_data_set_not_in_form = Data elements in data set but not in form or sections
\ No newline at end of file
+data_elements_in_data_set_not_in_form = Data elements in data set but not in form or sections
+option_set = Option set
+intro_option_set = Create the option values which would be included in data elements.
+option_set_management = Option set management
+add_option_set = Add option set
+options = Options
+option = Option
+add_option = Add Option
+option_name_already_exists = The option name already exists
+specify_option_name = Please specify a option name
+must_include_option = Please include one or more category options
+edit_option_set = Edit option set
+number_of_members = The number of members
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2011-11-24 13:19:36 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/struts.xml 2012-02-06 02:56:02 +0000
@@ -569,5 +569,61 @@
<param name="requiredAuthorities">F_SCHEDULING_ADMIN</param>
</action>
+
+ <!-- OptionSet -->
+
+ <action name="optionSet" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetListAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/optionSet.vm</param>
+ <param name="menu">/dhis-web-maintenance-dataadmin/menu.vm</param>
+ <param name="javascripts">javascript/optionSet.js</param>
+ <param name="requiredAuthorities">F_OPTIONSET_MANAGEMENT</param>
+ </action>
+
+ <action name="showAddOptionSetForm" class="org.hisp.dhis.dataadmin.action.NoAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/addOptionSetForm.vm</param>
+ <param name="javascripts">javascript/optionSet.js</param>
+ <param name="requiredAuthorities">F_OPTIONSET_ADD</param>
+ </action>
+
+ <action name="addOptionSet" class="org.hisp.dhis.dataadmin.action.option.AddOptionSetAction">
+ <result name="success" type="redirect">optionSet.action</result>
+ <param name="requiredAuthorities">F_OPTIONSET_ADD</param>
+ </action>
+
+ <action name="showUpdateOptionSetForm" class="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction">
+ <result name="success" type="velocity">/main.vm</result>
+ <param name="page">/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm</param>
+ <param name="javascripts">javascript/optionSet.js</param>
+ <param name="requiredAuthorities">F_OPTIONSET_UPDATE</param>
+ </action>
+
+ <action name="updateOptionSet" class="org.hisp.dhis.dataadmin.action.option.UpdateOptionSetAction">
+ <result name="success" type="redirect">optionSet.action</result>
+ <param name="requiredAuthorities">F_OPTIONSET_UPDATE</param>
+ </action>
+
+ <action name="removeOptionSet" class="org.hisp.dhis.dataadmin.action.option.RemoveOptionSetAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <param name="requiredAuthorities">F_OPTIONSET_DELETE</param>
+ </action>
+
+ <action name="validateOptionSet"
+ class="org.hisp.dhis.dataadmin.action.option.ValidateOptionSetAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseSuccess.vm</result>
+ <result name="error" type="velocity-json">
+ /dhis-web-commons/ajax/jsonResponseError.vm</result>
+ <param name="onExceptionReturn">plainTextError</param>
+ </action>
+
+ <action name="getOptionSet"
+ class="org.hisp.dhis.dataadmin.action.option.GetOptionSetAction">
+ <result name="success" type="velocity-json">
+ /dhis-web-maintenance-dataadmin/jsonOptionSet.vm</result>
+ </action>
+
</package>
</struts>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addOptionSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addOptionSetForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/addOptionSetForm.vm 2012-02-06 02:56:02 +0000
@@ -0,0 +1,75 @@
+<script type="text/javascript">
+ jQuery(document).ready( function() {
+ validation2( 'addOptionSetForm', function( form ){ form.submit() }, {
+ 'beforeValidateHandler': function() { listValidator( 'memberValidator', 'options' ); },
+ 'rules': getValidationRules("dateElementCategory")
+ });
+
+ checkValueIsExist( "name", "validateOptionSet.action");
+ });
+
+ var i18n_specify_option_name = '$encoder.jsEscape( $i18n.getString( "specify_option_name" ) , "'")';
+ var i18n_option_name_already_exists = '$encoder.jsEscape( $i18n.getString( "option_name_already_exists" ) , "'")';
+ var i18n_must_include_option = '$encoder.jsEscape( $i18n.getString( "must_include_option" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "add_option_set" )</h3>
+
+<form id="addOptionSetForm" name="addOptionSetForm" action="addOptionSet.action" method="post">
+ <table>
+ <tr>
+ <th colspan="4">$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td colspan="3"><input type="text" id="name" name="name" style="width:25em" class="{validate:{required:true,minlength:2}}" /></td>
+ </tr>
+ <tr>
+ <td colspan="4" style="height:15px"></td>
+ </tr>
+ <tr>
+ <th colspan="4">$i18n.getString( "options" )
+ <select id="memberValidator" style="display:none"/></th>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "option" )</label></td>
+ <td colspan="3"><input type="text" id="option" name="option" style="width:25em"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="3">
+ <input type="button" value="$i18n.getString( 'add_option' )" onclick="addOption()" style="width:200px"/>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <table>
+ <tr>
+ <td>
+ <select multiple size="10" id="options" name="options" style="width:300px">
+ </select>
+ </td>
+ <td>
+ <a href="javascript:moveUpSelectedOption( 'options' )"><img src="../images/move_up.png"/></a><br/><br/>
+ <a href="javascript:moveDownSelectedOption( 'options' )"><img src="../images/move_down.png"/></a><br/><br/>
+ <a href="javascript:removeSelectedOption( 'options' )"><img src="../images/delete.png"/></a>
+ </td>
+ </tr>
+ </table>
+ </td>
+
+ <td style="width:30px; text-align:center"> </td>
+ </tr>
+ <tr>
+ <td colspan="4" style="height:15px"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="3">
+ <input type="submit" value="$i18n.getString( 'add' )" style="width:100px">
+ <input type="button" onclick="window.location.href='optionSet.action'" value="$i18n.getString( 'cancel' )" style="width:100px"/></p>
+ </td>
+ </tr>
+ </table>
+</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm 2011-10-03 09:23:01 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/index.vm 2012-02-06 02:56:02 +0000
@@ -24,5 +24,6 @@
#introListImgItem( "getMinMaxValidationParams.action" "min_max_value_generation" "minmaxvaluegeneration" )
#introListImgItem( "showCache.action" "cache_statistics" "cachestatistics" )
#introListImgItem( "constant.action" "constant" "constant" )
+ #introListImgItem( "optionSet.action" "option_set" "resource" )
#introListImgItem( "attribute.action" "attribute" "constant" )
</ul>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/optionSet.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/optionSet.js 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/optionSet.js 2012-02-06 02:56:02 +0000
@@ -0,0 +1,44 @@
+// -----------------------------------------------------------------------------
+// View details
+// -----------------------------------------------------------------------------
+
+function showOptionSetDetails( optionSetId )
+{
+ jQuery.post( 'getOptionSet.action', { id:optionSetId },
+ function( json ) {
+ setInnerHTML( 'nameField', json.optionSet.name );
+ setInnerHTML( 'optionCount', json.optionSet.optionCount );
+ showDetails();
+ });
+}
+
+// -----------------------------------------------------------------------------
+// Remove category constant
+// -----------------------------------------------------------------------------
+
+function removeOptionSet ( optionSetId, optionSetName )
+{
+ removeItem( optionSetId, optionSetName, i18n_confirm_delete, 'removeOptionSet.action' );
+}
+
+// -----------------------------------------------------------------------------
+// Add options constant
+// -----------------------------------------------------------------------------
+
+function addOption()
+{
+ var value = getFieldValue( 'option' );
+
+ if ( value.length == 0 )
+ {
+ markInvalid( 'option', i18n_specify_option_name );
+ }
+ else if ( listContainsById( 'options', value, true ) )
+ {
+ markInvalid( 'option', i18n_option_name_already_exists );
+ }
+ else
+ {
+ addOptionById( 'options', value, value );
+ }
+}
\ No newline at end of file
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/jsonOptionSet.vm 2012-02-06 02:56:02 +0000
@@ -0,0 +1,7 @@
+{ "optionSet":
+ {
+ "id": "${optionSet.id}",
+ "name": "$!encoder.jsonEncode( ${optionSet.name} )",
+ "optionCount": "$!{optionSet.options.size()}"
+ }
+}
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm 2011-11-02 14:39:42 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/menu.vm 2012-02-06 02:56:02 +0000
@@ -17,6 +17,7 @@
<li><a href="displayPruneOrganisationUnitForm.action">$i18n.getString( "organisation_unit_pruning" ) </a></li>
<li><a href="getMinMaxValidationParams.action">$i18n.getString( "min_max_value_generation") </a></li>
<li><a href="constant.action">$i18n.getString( "constant") </a></li>
+ <li><a href="optionSet.action">$i18n.getString( "option_set") </a></li>
<li><a href="showCache.action">$i18n.getString( "cache_statistics" ) </a></li>
</ul>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/optionSet.vm 2012-02-06 02:56:02 +0000
@@ -0,0 +1,62 @@
+<script type="text/javascript">
+ jQuery(document).ready(function() {
+ tableSorter( 'listTable' );
+ });
+
+ var i18n_confirm_delete = '$encoder.jsEscape( $i18n.getString( "confirm_delete_constant" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "option_set_management" )</h3>
+
+<table class="mainPageTable">
+ <tr>
+ <td style="vertical-align:top">
+ <table class="listTable">
+ <col>
+ <col width="90">
+ <tr>
+ <td>
+ $i18n.getString( "filter_by_name" ): <input type="text" onkeyup="filterValues( this.value , 1)" style="width:250px"/>
+ </td>
+ <td colspan="3" style="text-align:right">
+ <input type="button" value="$i18n.getString( "add_new" )" onclick="window.location.href='showAddOptionSetForm.action'" style="width:70px">
+ </td>
+ </tr>
+ <tr>
+ <th>$i18n.getString( "name" )</th>
+ <th class="{sorter: false}">$i18n.getString( "operations" )</th>
+ </tr>
+ <tbody id="list">
+ #foreach( $optionSet in $optionSets )
+ <tr id="tr${optionSet.id}">
+ <td>$encoder.htmlEncode( $optionSet.name )</td>
+ <td style="text-align:right">
+ <a href="showUpdateOptionSetForm.action?id=$optionSet.id" title="$i18n.getString( 'edit' )"><img src="../images/edit.png" alt="$i18n.getString( 'edit' )"/></a>
+ <a href="javascript:removeOptionSet( $optionSet.id, '$encoder.jsEncode( $optionSet.name )' )" title="$i18n.getString( 'remove' )"><img src="../images/delete.png" alt="$i18n.getString( 'remove' )"/></a>
+ <a href="javascript:showOptionSetDetails( $optionSet.id )" title="$i18n.getString( 'show_details' )"><img src="../images/information.png" alt="$i18n.getString( 'show_details' )"/></a>
+ </td>
+ </tr>
+ #end
+ </tbody>
+ </table>
+ </td>
+
+ <td style="width:20em; padding-left:2em; vertical-align:top">
+
+ <div id="detailsArea" style="display:none">
+ <div style="float:right">
+ <a href="javascript:hideDetails()" title="$i18n.getString( 'hide_details' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_details' )"/></a>
+ </div>
+ <p><label>$i18n.getString( "name" ):</label><br/><span id="nameField"></span></p>
+ <p><label>$i18n.getString( "number_of_members" ):</label><br/><span id="optionCount"></span></p>
+ </div>
+
+ <div id="warningArea" style="position:fixed;right:10px;top:200px;display:none">
+ <div style="float:right">
+ <a href="javascript:hideWarning()" title="$i18n.getString( 'hide_warning' )"><img src="../images/close.png" alt="$i18n.getString( 'hide_warning' )"/></a>
+ </div>
+ <p><span id="warningField"></span></p>
+ </div>
+ </td>
+ </tr>
+</table>
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/updateOptionSetForm.vm 2012-02-06 02:56:02 +0000
@@ -0,0 +1,66 @@
+<script type="text/javascript">
+ jQuery(document).ready( function() {
+ validation2( 'updateOptionSetForm', function( form ){ form.submit() }, {
+ 'beforeValidateHandler': function() { listValidator( 'memberValidator', 'options' ); } });
+
+ checkValueIsExist( "name", "validateOptionSet.action",{id:getFieldValue('id')});
+ });
+
+ var i18n_specify_option_name = '$encoder.jsEscape( $i18n.getString( "specify_option_name" ) , "'")';
+ var i18n_option_name_already_exists = '$encoder.jsEscape( $i18n.getString( "option_name_already_exists" ) , "'")';
+ var i18n_must_include_option = '$encoder.jsEscape( $i18n.getString( "must_include_option" ) , "'")';
+</script>
+
+<h3>$i18n.getString( "edit_option_set" )</h3>
+
+<form id="updateOptionSetForm" name="updateOptionSetForm" action="updateOptionSet.action" method="post">
+ <input id='id' name='id' value='$optionSet.id' type='hidden'>
+ <table>
+ <tr>
+ <th colspan='2'>$i18n.getString( "details" )</th>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "name" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
+ <td ><input type="text" id="name" name="name" value='$optionSet.name' style="width:25em" class="{validate:{required:true,minlength:2}}" /></td>
+ </tr>
+ <tr>
+ <td style="height:15px"></td>
+ </tr>
+ <tr>
+ <th colspan='2'>$i18n.getString( "options" )
+ <select id="memberValidator" style="display:none"/></th>
+ </tr>
+ <tr>
+ <td><label>$i18n.getString( "option" )</label></td>
+ <td><input type="text" id="option" name="option" style="width:25em"/></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="2">
+ <input type="button" value="$i18n.getString( 'add_option' )" onclick="addOption()" style="width:200px"/>
+ </td>
+ </tr>
+ <tr>
+ <td></td>
+ <td>
+ <select multiple size="10" id="options" name="options" style="width:300px">
+ #foreach( $option in $optionSet.options )
+ <option value='$option'>$option</option>
+ #end
+ </select>
+ </td>
+ </td>
+ <td style="width:30px; text-align:center"> </td>
+ </tr>
+ <tr>
+ <td colspan="2" style="height:15px"></td>
+ </tr>
+ <tr>
+ <td></td>
+ <td colspan="2">
+ <input type="submit" value="$i18n.getString( 'update' )" style="width:100px">
+ <input type="button" onclick="window.location.href='optionSet.action'" value="$i18n.getString( 'cancel' )" style="width:100px"/></p>
+ </td>
+ </tr>
+ </table>
+</form>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2012-02-06 02:56:02 +0000
@@ -38,6 +38,8 @@
import org.hisp.dhis.dataelement.DataElementCategoryService;
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.system.util.ConversionUtils;
@@ -73,6 +75,13 @@
{
this.attributeService = attributeService;
}
+
+ private OptionService optionService;
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
// -------------------------------------------------------------------------
// Input
@@ -190,6 +199,13 @@
this.selectedGroups = selectedGroups;
}
+ private Integer selectedOptionSetId;
+
+ public void setSelectedOptionSetId( Integer selectedOptionSetId )
+ {
+ this.selectedOptionSetId = selectedOptionSetId;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -223,6 +239,8 @@
DataElementCategoryCombo categoryCombo = dataElementCategoryService
.getDataElementCategoryCombo( selectedCategoryComboId );
+
+ OptionSet optionSet = optionService.getOptionSet( selectedOptionSetId );
dataElement.setName( name );
dataElement.setAlternativeName( alternativeName );
@@ -240,6 +258,7 @@
dataElement.setCategoryCombo( categoryCombo );
dataElement.setAggregationLevels( new ArrayList<Integer>( ConversionUtils
.getIntegerCollection( aggregationLevels ) ) );
+ dataElement.setOptionSet( optionSet );
if ( jsonAttributeValues != null )
{
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java 2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowAddDataElementForm.java 2012-02-06 02:56:02 +0000
@@ -41,6 +41,8 @@
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
@@ -85,6 +87,13 @@
this.attributeService = attributeService;
}
+ private OptionService optionService;
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
@@ -131,6 +140,13 @@
return attributes;
}
+ private Collection<OptionSet> optionSets;
+
+ public Collection<OptionSet> getOptionSets()
+ {
+ return optionSets;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -142,13 +158,13 @@
dataElementGroups = dataElementService.getAllDataElementGroups();
- dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>(
- dataElementCategoryService.getAllDataElementCategoryCombos() );
+ dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService
+ .getAllDataElementCategoryCombos() );
organisationUnitLevels = organisationUnitService.getOrganisationUnitLevels();
- groupSets = new ArrayList<DataElementGroupSet>(
- dataElementService.getCompulsoryDataElementGroupSetsWithMembers() );
+ groupSets = new ArrayList<DataElementGroupSet>( dataElementService
+ .getCompulsoryDataElementGroupSetsWithMembers() );
attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
@@ -156,6 +172,8 @@
Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
Collections.sort( attributes, new AttributeSortOrderComparator() );
+ optionSets = optionService.getAllOptionSets();
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2012-01-25 17:11:43 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/ShowUpdateDataElementFormAction.java 2012-02-06 02:56:02 +0000
@@ -44,6 +44,8 @@
import org.hisp.dhis.dataelement.DataElementGroup;
import org.hisp.dhis.dataelement.DataElementGroupSet;
import org.hisp.dhis.dataelement.DataElementService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.organisationunit.OrganisationUnitLevel;
import org.hisp.dhis.organisationunit.OrganisationUnitService;
import org.hisp.dhis.system.util.AttributeUtils;
@@ -89,6 +91,13 @@
this.attributeService = attributeService;
}
+ private OptionService optionService;
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
// -------------------------------------------------------------------------
// Input/output
// -------------------------------------------------------------------------
@@ -163,6 +172,13 @@
return attributeValues;
}
+ private Collection<OptionSet> optionSets;
+
+ public Collection<OptionSet> getOptionSets()
+ {
+ return optionSets;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -172,8 +188,8 @@
defaultCategoryCombo = dataElementCategoryService
.getDataElementCategoryComboByName( DataElementCategoryCombo.DEFAULT_CATEGORY_COMBO_NAME );
- dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>(
- dataElementCategoryService.getAllDataElementCategoryCombos() );
+ dataElementCategoryCombos = new ArrayList<DataElementCategoryCombo>( dataElementCategoryService
+ .getAllDataElementCategoryCombos() );
dataElement = dataElementService.getDataElement( id );
@@ -188,8 +204,8 @@
organisationUnitLevels.removeAll( aggregationLevels );
- groupSets = new ArrayList<DataElementGroupSet>(
- dataElementService.getCompulsoryDataElementGroupSetsWithMembers() );
+ groupSets = new ArrayList<DataElementGroupSet>( dataElementService
+ .getCompulsoryDataElementGroupSetsWithMembers() );
attributes = new ArrayList<Attribute>( attributeService.getDataElementAttributes() );
@@ -199,6 +215,8 @@
Collections.sort( groupSets, IdentifiableObjectNameComparator.INSTANCE );
Collections.sort( attributes, new AttributeSortOrderComparator() );
+ optionSets = optionService.getAllOptionSets();
+
return SUCCESS;
}
}
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2011-12-26 10:07:59 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2012-02-06 02:56:02 +0000
@@ -32,6 +32,8 @@
import org.hisp.dhis.dataelement.*;
import org.hisp.dhis.dataset.DataSet;
import org.hisp.dhis.dataset.DataSetService;
+import org.hisp.dhis.option.OptionService;
+import org.hisp.dhis.option.OptionSet;
import org.hisp.dhis.system.util.AttributeUtils;
import org.hisp.dhis.system.util.ConversionUtils;
@@ -78,6 +80,13 @@
this.attributeService = attributeService;
}
+ private OptionService optionService;
+
+ public void setOptionService( OptionService optionService )
+ {
+ this.optionService = optionService;
+ }
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -215,6 +224,13 @@
this.jsonAttributeValues = jsonAttributeValues;
}
+ private Integer selectedOptionSetId;
+
+ public void setSelectedOptionSetId( Integer selectedOptionSetId )
+ {
+ this.selectedOptionSetId = selectedOptionSetId;
+ }
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -253,6 +269,8 @@
DataElementCategoryCombo categoryCombo = dataElementCategoryService
.getDataElementCategoryCombo( selectedCategoryComboId );
+
+ OptionSet optionSet = optionService.getOptionSet( selectedOptionSetId );
dataElement.setName( name );
dataElement.setAlternativeName( alternativeName );
@@ -270,6 +288,7 @@
dataElement.setCategoryCombo( categoryCombo );
dataElement.setAggregationLevels( new ArrayList<Integer>( ConversionUtils
.getIntegerCollection( aggregationLevels ) ) );
+ dataElement.setOptionSet( optionSet );
Set<DataSet> dataSets = dataElement.getDataSets();
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2012-01-05 20:39:23 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/META-INF/dhis/beans.xml 2012-02-06 02:56:02 +0000
@@ -58,6 +58,7 @@
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</property>
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<bean id="org.hisp.dhis.dd.action.dataelement.GetDataElementAction" class="org.hisp.dhis.dd.action.dataelement.GetDataElementAction"
@@ -86,6 +87,7 @@
<ref bean="org.hisp.dhis.dataelement.DataElementCategoryService" />
</property>
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<bean id="org.hisp.dhis.dd.action.dataelement.UpdateDataElementAction" class="org.hisp.dhis.dd.action.dataelement.UpdateDataElementAction"
@@ -100,6 +102,7 @@
<ref bean="org.hisp.dhis.dataset.DataSetService" />
</property>
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<bean id="org.hisp.dhis.dd.action.dataelement.ShowUpdateDataElementFormAction" class="org.hisp.dhis.dd.action.dataelement.ShowUpdateDataElementFormAction"
@@ -114,6 +117,7 @@
<ref bean="org.hisp.dhis.organisationunit.OrganisationUnitService" />
</property>
<property name="attributeService" ref="org.hisp.dhis.attribute.AttributeService" />
+ <property name="optionService" ref="org.hisp.dhis.option.OptionService" />
</bean>
<bean id="org.hisp.dhis.dd.action.dataelement.ValidateDataElementAction" class="org.hisp.dhis.dd.action.dataelement.ValidateDataElementAction"
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2011-12-14 08:10:22 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2012-02-06 02:56:02 +0000
@@ -356,3 +356,5 @@
form_name=Form name
compulsory=Compulsory
select_group=Select group
+option_set = Option set
+please_select = Please select
\ No newline at end of file
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2011-10-05 15:00:45 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2012-02-06 02:56:02 +0000
@@ -130,6 +130,16 @@
<td style="width:200px">$i18n.getString( "aggregation_levels" )</td>
<td><input type="checkbox" onclick="toggleById( 'aggregationLevelsContainer' )"/></td>
</tr>
+ <tr>
+ <td>$i18n.getString( 'option_set' )</td>
+ <td>
+ <select id="selectedOptionSetId" name="selectedOptionSetId" style="min-width: 244px;">
+ #foreach ( $optionSet in $optionSets )
+ <option value="$optionSet.id">$optionSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
</table>
<div id="aggregationLevelsContainer" style="border:1px solid #808080; padding:10px; width:465px; display:none;">
@@ -166,6 +176,7 @@
<select multiple size="4" id="aggregationLevels" name="aggregationLevels" style="width:450px" ondblclick="moveSelectedById( 'aggregationLevels', 'organisationUnitLevels' )"></select>
</td>
</tr>
+
</table>
</div>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2011-10-06 07:57:46 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2012-02-06 02:56:02 +0000
@@ -150,6 +150,17 @@
<td style="width:200px">$i18n.getString( "aggregation_levels" )</td>
<td><input type="checkbox" #if ( $dataElement.hasAggregationLevels() )checked="checked"#end onclick="toggleById( 'aggregationLevelsContainer' )"/></td>
</tr>
+ <tr>
+ <td>$i18n.getString( 'option_set' )</td>
+ <td>
+ <select id="selectedOptionSetId" name="selectedOptionSetId" style="min-width: 244px;">
+ <option value="0">[$i18n.getString('please_select')]</option>
+ #foreach ( $optionSet in $optionSets )
+ <option value="$optionSet.id" #if( $dataElement.optionSet.id == "$optionSet.id" ) selected #end >$optionSet.name</option>
+ #end
+ </select>
+ </td>
+ </tr>
</table>
<div id="aggregationLevelsContainer" style="border:1px solid #808080;padding:10px;width:465px;#if( !$dataElement.hasAggregationLevels() ) display:none;#else display:block;#end">
=== added file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/java.exe.stackdump'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/java.exe.stackdump 1970-01-01 00:00:00 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/java.exe.stackdump 2012-02-06 02:56:02 +0000
@@ -0,0 +1,12 @@
+Exception: STATUS_ACCESS_VIOLATION at eip=610C8439
+eax=00000000 ebx=00000001 ecx=00000000 edx=0000023C esi=00000000 edi=1B1FCCB0
+ebp=1B1FCAEC esp=1B1FCAC4 program=\\?\C:\Program Files (x86)\Java\jdk1.6.0_20\bin\java.exe, pid 6012, thread unknown (0xB70)
+cs=0023 ds=002B es=002B fs=0053 gs=002B ss=002B
+Stack trace:
+Frame Function Args
+1B1FCAEC 610C8439 (00000000, 00000000, 00000000, 00000000)
+1B1FCBFC 610C8DD5 (00000000, 00000000, 00000000, 00000000)
+1B1FCCBC 610C9B3A (FFFFFFFF, FFFFFFFF, 74F734F3, FFFFFFFE)
+1B1FCD0C 61028182 (00000002, C0B399B5, 1B1FCE64, 00000002)
+1B1FCD98 763E6B59 (00000002, 1B1FCDD4, 763E69A4, 00000002)
+End of stack trace
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2011-09-30 08:37:26 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2012-02-06 02:56:02 +0000
@@ -6,27 +6,24 @@
jQuery(function(){
dataElementSelector = jQuery("#dataElementSelection").dialog({
title: i18n_dataelement,
- minWidth: 650,
- minHeight: 250,
- width:650,
+ height: 350,
+ width:350,
autoOpen: false,
zIndex:99999
});
otherProgramStageDataElements = jQuery("#otherProgramStageDataElements").dialog({
title: i18n_dataelement_of_orther_program_stage,
- minWidth: 650,
- minHeight: 250,
- width:650,
+ height: 350,
+ width:350,
autoOpen: false,
zIndex:99999
});
existedDataEntry = jQuery("#existedDataEntry").dialog({
title: i18n_choose_existing_dataentry,
- minWidth: 400,
- minHeight: 80,
- width:400,
+ height: 350,
+ width:350,
autoOpen: false,
zIndex:99999
});
@@ -84,36 +81,20 @@
jQuery.post("getSelectedDataElements.action",{
associationId: id
}, function( xml ){
- jQuery( xml ).find( 'dataElement' ).each( function(i, item ){
- dataElements.append("<option value='" + jQuery( item ).find( "json" ).text() + "'>" + jQuery( item ).find( "name" ).text() + "</option>");
- dataElementIdsStore.append("<option value='" + jQuery( item ).find( "json" ).text() + "'>" + jQuery( item ).find( "name" ).text() + "</option>");
+ jQuery( xml ).find( 'dataElement' ).each( function(i, item ){
+ jQuery( item ).find( 'optionCombo' ).each( function(i, optionCombo ){
+ dataElements.append("<option value='" + jQuery( item ).find( "json" ).text()
+ + "' optionCombo='{\"id\":\"" + jQuery( optionCombo ).find( "optionComboid" ).text()
+ +"\",\"name\":\"" + jQuery( optionCombo ).find( "optionComboname" ).text() + "\" }'>"
+ + jQuery( item ).find( "name" ).text() + jQuery( optionCombo ).find( "optionComboname" ).text()
+ + "</option>");
+ dataElementIdsStore.append("<option value='" + jQuery( item ).find( "json" ).text() + "'>" + jQuery( item ).find( "name" ).text() + "</option>");
+ });
});
});
}
}
-function getOptionCombos( dataElement, target )
-{
- var dataElement = JSON.parse( dataElement );
-
- var optionCombo = jQuery( target );
-
- if( dataElement.type=='string' ){
- optionCombo.attr("multiple", "multiple" );
- }else{
- optionCombo.removeAttr( "multiple" );
- }
-
- jQuery.postJSON("../dhis-web-commons-ajax-json/getCategoryOptionCombos.action", {
- id: dataElement.id
- }, function( json ){
- optionCombo.empty();
- jQuery.each( json.categoryOptionCombos, function(i, item ){
- optionCombo.append( "<option value='{\"id\":\"" + item.id + "\",\"name\":\"" + item.name + "\",\"default\":\"" + item.default + "\"}' selected='true'>" + item.name + "</option>" );
- });
- });
-}
-
function getSelectedValues( jQueryString )
{
var result = new Array();
@@ -156,11 +137,11 @@
});
}
-function insertDataElement( source, associationId )
+function insertDataElement( source, programStageId )
{
var oEditor = jQuery("#designTextarea").ckeditorGet();
-
var dataElement = JSON.parse( jQuery( source + ' #dataElementIds').val() );
+ var optionCombo = JSON.parse( jQuery( source + ' #dataElementIds option:selected').attr('optionCombo') );
if( dataElement == null )
{
@@ -176,51 +157,29 @@
var dataElementName = dataElement.name;
var dataElementType = dataElement.type;
- var id = "";
-
var htmlCode = "";
-
- if( dataElementType == "string" )
- {
- if( categoryOptionCombos[0].default == 'true' )
- {
- var titleValue = dataElementId + "." + dataElementName
- + "-" + categoryOptionCombos[0].id + "." + categoryOptionCombos[0].id
- + " "+dataElementType+"\"";
- var displayName = dataElementName + "-" + categoryOptionCombos[0].name + " ]";
- id = associationId + "-" + dataElementId + "-" + categoryOptionCombos[0].id +"-val";
- htmlCode += "<input name=\"entryfield\" id=\""+ id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\" onkeypress=\"return keyPress(event, this)\" >";
- }else{
- var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
- var displayName = dataElementName;
- id = associationId + "-" + dataElementId + "-val";
- htmlCode = "<input name=\"entryselect\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
- }
- }
- else if ( dataElementType == "bool" )
+ var id = programStageId + "-" + dataElementId + "-val" ;
+
+ if ( dataElementType == "bool" )
{
var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
var displayName = dataElementName;
- id = associationId + "-" + dataElementId + "-val" ;
htmlCode = "<input name=\"entryselect\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
}
else if ( dataElementType == "date" )
{
var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
var displayName = dataElementName;
- id = associationId + "-" + dataElementId + "-val" ;
htmlCode = "<input name=\"entryfield\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
}
- else if ( dataElementType == "int" )
+ else if ( dataElementType == "int" || dataElementType == "string" )
{
- jQuery.each( categoryOptionCombos, function(i, item ){
- optionComboName = item.name;
- optionComboId = item.id;
- var titleValue = "-- " + dataElementId + "." + dataElementName + "-" + optionComboId + "." + optionComboName+" ("+dataElementType+") --";
- var displayName = dataElementName + "-" + optionComboName;
- id = associationId + "-" + dataElementId + "-" + optionComboId + "-val";
- htmlCode += "<input title=\"" + titleValue + "\" value=\"" + displayName + "\" name=\"entryfield\" id=\"" + id + "\" />";
- });
+ var optionComboName = optionCombo.name;
+ var optionComboId = optionCombo.id;
+ var titleValue = "-- " + dataElementId + "." + dataElementName + "-" + optionComboId + "." + optionComboName+" ("+dataElementType+") --";
+ var displayName = dataElementName + "-" + optionComboName;
+ id = programStageId + "-" + dataElementId + "-" + optionComboId + "-val";
+ htmlCode += "<input title=\"" + titleValue + "\" value=\"" + displayName + "\" name=\"entryfield\" id=\"" + id + "\" />";
}
if( checkExisted( id ) )
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseSelDataElementList.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseSelDataElementList.vm 2010-10-14 08:14:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/responseSelDataElementList.vm 2012-02-06 02:56:02 +0000
@@ -8,6 +8,14 @@
<shortName>$encoder.xmlEncode( $dataElement.shortName )</shortName>
<type>$dataElement.type</type>
<json>$dataElement.toJSON()</json>
+ <optionCombos>
+ #foreach( $optionCombo in $dataElement.categoryCombo.optionCombos)
+ <optionCombo>
+ <optionComboid>$optionCombo.id</optionComboid>
+ <optionComboname>$encoder.xmlEncode($optionCombo.name)</optionComboname>
+ </optionCombo>
+ #end
+ </optionCombos>
</dataElement>
#end
</dataElements>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm 2012-02-03 09:32:12 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm 2012-02-06 02:56:02 +0000
@@ -126,10 +126,20 @@
<tr>
<td>
<span class="bold">$i18n.getString( "dataelement" )</span><br>
+ </td>
+ </tr>
+ <tr>
+ <td>
<input type="text" style="min-width:290px" onkeyup="filterDataElements( this.value, '#dataElementSelection', '#dataElementIds')"/>
- <select id="dataElementIds" name="dataElementIds" style="min-width:300px" multiple="multiple" size="10" onchange="getOptionCombos( this.value, '#dataElementSelection #optionComboIds' )" class="{validate:{required:true}}">
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <select id="dataElementIds" name="dataElementIds" style="min-width:300px" multiple="multiple" size="10" ondblclick="insertDataElement( '#dataElementSelection', '$programStage.id')">
#foreach( $de in $dataElements)
- <option value='$de.toJSON()'>$encoder.htmlEncode( $de.name )</option>
+ #foreach( $optionCombo in $de.categoryCombo.optionCombos)
+ <option value='$de.toJSON()' optionCombo='{"id":"$optionCombo.id","name":"$optionCombo.name" }' >$encoder.htmlEncode( $de.name ) $optionCombo.name</option>
+ #end
#end
</select>
<select id="dataElementIdsStore" multiple="multiple" style="display:none">
@@ -138,15 +148,13 @@
#end
</select>
</td>
- <td>
- <span class="bold">$i18n.getString( "optioncombo" )</span><br>
- <select id="optionComboIds" name="optionComboIds" style="min-width:300px" size="10" class="{validate:{required:true}}"/>
- </td>
</tr>
<tr>
<td>
<input type="button" value="Insert" id="insert" name="insert" onclick="insertDataElement( '#dataElementSelection', '$programStage.id')"/>
</td>
+ </tr>
+ <tr>
<td>
<span id="message_"></span>
</td>
@@ -169,20 +177,26 @@
</tr>
<tr>
<td>
- <span class="bold">$i18n.getString( "dataelement" )</span><br>
+ <span class="bold">$i18n.getString( "dataelement" )</span>
+ </td>
+ </tr>
+ <tr>
+ <td>
<input type="text" style="min-width:290px" onkeyup="filterDataElements( this.value, '#otherProgramStageDataElements', '#dataElementIds')"/>
- <select id="dataElementIds" name="dataElementIds" style="min-width:300px" multiple="multiple" size="10" onchange="getOptionCombos( this.value, '#otherProgramStageDataElements #optionComboIds' )" class="{validate:{required:true}}"/>
+ </td>
+ </tr>
+ <tr>
+ <td>
+ <select id="dataElementIds" name="dataElementIds" style="min-width:300px" multiple="multiple" size="10" ondblclick="insertDataElement( '#otherProgramStageDataElements', byId('programStageIds').value )"/>
<select id="dataElementIdsStore" style="min-width:300px;display:none" multiple="multiple" size="10"/>
</td>
- <td>
- <span class="bold">$i18n.getString( "optioncombo" )</span><br>
- <select id="optionComboIds" name="optionComboIds" style="min-width:300px" size="10" class="{validate:{required:true}}"/>
- </td>
</tr>
<tr>
<td>
<input type="button" value="Insert" id="insert" name="insert" onclick="insertDataElement( '#otherProgramStageDataElements', byId('programStageIds').value )"/>
</td>
+ </tr>
+ <tr>
<td>
<span id="message_"></span>
</td>
@@ -202,5 +216,4 @@
<script>
var i18n_delete_program_data_entry_confirm = '$encoder.jsEscape( $i18n.getString( "delete_program_data_entry_confirm" ) , "'" )';
-
</script>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-01-03 06:08:25 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/org/hisp/dhis/user/i18n_module.properties 2012-02-06 02:56:02 +0000
@@ -167,7 +167,10 @@
F_VALIDATIONCRITERIA_DELETE=Delete Validation Criteria
F_VALIDATIONCRITERIA_UPDATE=Update Validation Criteria
F_SEND_MESSAGE=Send message
-F_DV_ADMIN=Administrate Data Visualizer
+F_OPTIONSET_MANAGEMENT=Option Set Management
+F_OPTIONSET_ADD=Add Option Set
+F_OPTIONSET_UPDATE=Update Option Set
+F_OPTIONSET_DELETE=Delete Option Set
#-- User module ---------------------------------------------------------------#