dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #18180
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7563: Add textType property for dataelement to display a field as textarea for custom dataentry form.
------------------------------------------------------------
revno: 7563
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-07-10 18:18:29 +0700
message:
Add textType property for dataelement to display a field as textarea for custom dataentry form.
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java
dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java
dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java
dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml
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/webapp/dhis-web-caseentry/dataEntryForm.vm
dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
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/UpdateDataElementAction.java
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/javascript/dataElement.js
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/resources/org/hisp/dhis/patient/i18n_module.properties
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/viewDataEntryForm.vm
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-07-04 01:37:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/dataelement/DataElement.java 2012-07-10 11:18:29 +0000
@@ -64,7 +64,7 @@
* <p/>
* DataElement acts as a DimensionSet in the dynamic dimensional model, and as a
* DimensionOption in the static DataElement dimension.
- *
+ *
* @author Kristian Nordal
*/
@JacksonXmlRootElement( localName = "dataElement", namespace = Dxf2Namespace.NAMESPACE )
@@ -87,7 +87,11 @@
public static final String VALUE_TYPE_NEGATIVE_INT = "negativeNumber";
public static final String VALUE_TYPE_TRUE_ONLY = "trueOnly";
-
+
+ public static final String VALUE_TYPE_TEXT = "text";
+
+ public static final String VALUE_TYPE_LONG_TEXT = "longText";
+
public static final String VALUE_TYPE_BOOL = "bool";
public static final String VALUE_TYPE_DATE = "date";
@@ -130,6 +134,11 @@
private String numberType;
/**
+ * The number type. Is relevant when type is TEXT.
+ */
+ private String textType;
+
+ /**
* The aggregation operator of this DataElement; e.g. DataElement.SUM og
* DataElement.AVERAGE.
*/
@@ -288,6 +297,16 @@
}
/**
+ * Returns the value type. If value type is string and the text type exists,
+ * the text type is returned, if the type is string and the text type does
+ * not exist string is returned.
+ */
+ public String getDetailedTextType()
+ {
+ return (type != null && type.equals( VALUE_TYPE_STRING ) && textType != null) ? textType : type;
+ }
+
+ /**
* Returns the PeriodType of the DataElement, based on the PeriodType of the
* DataSet which the DataElement is registered for.
*/
@@ -441,6 +460,16 @@
this.domainType = domainType;
}
+ public String getTextType()
+ {
+ return textType;
+ }
+
+ public void setTextType( String textType )
+ {
+ this.textType = textType;
+ }
+
@JsonProperty
@JsonView( { DetailedView.class, ExportView.class } )
@JacksonXmlProperty( namespace = Dxf2Namespace.NAMESPACE )
@@ -616,7 +645,8 @@
domainType = dataElement.getDomainType() == null ? domainType : dataElement.getDomainType();
type = dataElement.getType() == null ? type : dataElement.getType();
numberType = dataElement.getNumberType() == null ? numberType : dataElement.getNumberType();
- aggregationOperator = dataElement.getAggregationOperator() == null ? aggregationOperator : dataElement.getAggregationOperator();
+ aggregationOperator = dataElement.getAggregationOperator() == null ? aggregationOperator : dataElement
+ .getAggregationOperator();
categoryCombo = dataElement.getCategoryCombo() == null ? categoryCombo : dataElement.getCategoryCombo();
sortOrder = dataElement.getSortOrder() == null ? sortOrder : dataElement.getSortOrder();
url = dataElement.getUrl() == null ? url : dataElement.getUrl();
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java 2012-02-11 13:58:02 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/program/ProgramDataEntryService.java 2012-07-10 11:18:29 +0000
@@ -41,7 +41,7 @@
*/
public interface ProgramDataEntryService
{
- final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
+ final Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?|<textarea.*?)[/]?>", Pattern.DOTALL );
final Pattern IDENTIFIER_PATTERN_FIELD = Pattern.compile( "id=\"(\\d+)-(\\d+)-val\"" );
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java'
--- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-07-10 11:05:37 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/startup/TableAlteror.java 2012-07-10 11:18:29 +0000
@@ -156,6 +156,8 @@
executeSql( "ALTER TABLE organisationunit DROP COLUMN hasPatients" );
+ executeSql( "update dataelement set texttype='text' where valuetype='string'" );
+
// ---------------------------------------------------------------------
// Update tables for dimensional model
// ---------------------------------------------------------------------
=== modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml'
--- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2012-04-13 10:38:21 +0000
+++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/dataelement/hibernate/DataElement.hbm.xml 2012-07-10 11:18:29 +0000
@@ -28,6 +28,8 @@
<property name="type" column="valuetype" length="16" not-null="true" />
<property name="numberType" column="numbertype" length="16" />
+
+ <property name="textType" column="textType" length="16" />
<property name="domainType" column="domaintype" length="16" />
=== 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-07-10 06:14:34 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java 2012-07-10 11:18:29 +0000
@@ -119,7 +119,6 @@
// Pattern to match data elements in the HTML code
// ---------------------------------------------------------------------
- Pattern INPUT_PATTERN = Pattern.compile( "(<input.*?)[/]?>", Pattern.DOTALL );
Matcher dataElementMatcher = INPUT_PATTERN.matcher( htmlCode );
int tabindex = 0;
@@ -533,6 +532,9 @@
inputHTML += jsCodeForOnchange;
}
+ if( DataElement.VALUE_TYPE_LONG_TEXT.equals( dataElement.getDetailedTextType() ))
+ inputHTML += " >";
+
return inputHTML;
}
=== 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-07-05 06:29:29 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm 2012-07-10 11:18:29 +0000
@@ -49,7 +49,7 @@
#set( $patientDataValue = $patientDataValueMap.get( $key ) )
<tr #alternate( $mark )>
##data element name
- <td class='text-column'>
+ <td class='text-column' align='center'>
<span id="value[$programStageDataElement.dataElement.id].name" title="$!encoder.htmlEncode( $programStageDataElement.dataElement.description )">
$encoder.htmlEncode( $programStageDataElement.dataElement.formNameFallback )
#if ( $programStageDataElement.compulsory )
@@ -67,8 +67,9 @@
#else
#set( $hasOptionSet = 'false')
#end
-
- #if( $programStageDataElement.dataElement.type == "bool" )
+ #if( $programStageDataElement.dataElement.textType == "longText" )
+ <textarea name="entryfield" type="text" data="{compulsory: $programStageDataElement.compulsory }" id="$id" name="entryfield" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex" ></textarea>
+ #elseif( $programStageDataElement.dataElement.type == "bool" )
<select name="entryfield" 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>
=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-06-27 05:12:36 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css 2012-07-10 11:18:29 +0000
@@ -22,6 +22,10 @@
width: 265px;
}
+textarea {
+ width: 265px;
+}
+
.button-list
{
text-align:right;
=== 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 2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2012-07-10 11:18:29 +0000
@@ -75,7 +75,7 @@
{
this.attributeService = attributeService;
}
-
+
private OptionService optionService;
public void setOptionService( OptionService optionService )
@@ -143,6 +143,13 @@
this.numberType = numberType;
}
+ private String textType;
+
+ public void setTextType( String textType )
+ {
+ this.textType = textType;
+ }
+
private String valueType;
public void setValueType( String valueType )
@@ -200,12 +207,12 @@
}
private Integer selectedOptionSetId;
-
+
public void setSelectedOptionSetId( Integer selectedOptionSetId )
{
this.selectedOptionSetId = selectedOptionSetId;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -239,7 +246,7 @@
DataElementCategoryCombo categoryCombo = dataElementCategoryService
.getDataElementCategoryCombo( selectedCategoryComboId );
-
+
OptionSet optionSet = optionService.getOptionSet( selectedOptionSetId );
dataElement.setName( name );
@@ -252,6 +259,7 @@
dataElement.setDomainType( domainType );
dataElement.setType( valueType );
dataElement.setNumberType( numberType );
+ dataElement.setTextType ( textType );
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setZeroIsSignificant( zeroIsSignificant );
@@ -265,9 +273,9 @@
AttributeUtils.updateAttributeValuesFromJson( dataElement.getAttributeValues(), jsonAttributeValues,
attributeService );
}
-
+
dataElementService.addDataElement( dataElement );
-
+
for ( String id : selectedGroups )
{
DataElementGroup group = dataElementService.getDataElementGroup( Integer.parseInt( id ) );
@@ -280,7 +288,7 @@
}
dataElementService.updateDataElement( dataElement );
-
+
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 2012-02-06 02:56:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2012-07-10 11:18:29 +0000
@@ -86,7 +86,7 @@
{
this.optionService = optionService;
}
-
+
// -------------------------------------------------------------------------
// Input
// -------------------------------------------------------------------------
@@ -168,6 +168,13 @@
this.valueType = valueType;
}
+ private String textType;
+
+ public void setTextType( String textType )
+ {
+ this.textType = textType;
+ }
+
private String aggregationOperator;
public void setAggregationOperator( String aggregationOperator )
@@ -225,12 +232,12 @@
}
private Integer selectedOptionSetId;
-
+
public void setSelectedOptionSetId( Integer selectedOptionSetId )
{
this.selectedOptionSetId = selectedOptionSetId;
}
-
+
// -------------------------------------------------------------------------
// Action implementation
// -------------------------------------------------------------------------
@@ -269,7 +276,7 @@
DataElementCategoryCombo categoryCombo = dataElementCategoryService
.getDataElementCategoryCombo( selectedCategoryComboId );
-
+
OptionSet optionSet = optionService.getOptionSet( selectedOptionSetId );
dataElement.setName( name );
@@ -282,6 +289,7 @@
dataElement.setDomainType( domainType );
dataElement.setType( valueType );
dataElement.setNumberType( numberType );
+ dataElement.setTextType( textType );
dataElement.setAggregationOperator( aggregationOperator );
dataElement.setUrl( url );
dataElement.setZeroIsSignificant( zeroIsSignificant );
=== 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 2012-06-09 22:21:27 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2012-07-10 11:18:29 +0000
@@ -193,4 +193,6 @@
select_group=Select group
option_set=Option set
please_select=Please select
-formula=Formula
\ No newline at end of file
+formula=Formula
+long_text = Long text
+text_type = Text type
\ 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 2012-07-04 01:37:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/addDataElementForm.vm 2012-07-10 11:18:29 +0000
@@ -70,9 +70,9 @@
<tr>
<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select id="valueType" style="min-width:246px; margin: 0;" onchange="changeValueType( this.value )">
+ <select id="valueType" style="min-width:246px; margin: 0;" onchange="changeValueType( this.value )">
<option value="int" selected="selected" onclick="enable('numberType');">$i18n.getString( "number" )</option>
- <option value="string" onclick="disable('numberType');">$i18n.getString( "text" )</option>
+ <option value="string" onclick="disable('numberType');enable('textType')">$i18n.getString( "text" )</option>
<option value="bool" onclick="disable('numberType');">$i18n.getString( "yes_no" )</option>
<option value="trueOnly" onclick="disable('numberType');">$i18n.getString( "yes_only" )</option>
<option value="date" onclick="disable('numberType');">$i18n.getString( "date" )</option>
@@ -80,7 +80,7 @@
<input type="hidden" id="submitValueType" name="valueType"/>
</td>
</tr>
- <tr>
+ <tr id='numberTypeTR'>
<td><label for="numberValueType">$i18n.getString( "number_value_type" )</label></td>
<td>
<select id="numberType" name="numberType" style="min-width:246px; margin: 0;">
@@ -91,6 +91,15 @@
</select>
</td>
</tr>
+ <tr id='textTypeTR' style='display:none'>
+ <td><label for="textValueType">$i18n.getString( "text_type" )</label></td>
+ <td>
+ <select id="textType" name="textType" style="min-width:246px; margin: 0;" >
+ <option value="text" selected="selected">$i18n.getString( "text" )</option>
+ <option value="longText" >$i18n.getString( "long_text" )</option>
+ </select>
+ </td>
+ </tr>
<tr>
<td><label for="zeroIsSignificant ">$i18n.getString( "store_zero_data_values" )</label></td>
<td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2012-07-04 01:37:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElement.js 2012-07-10 11:18:29 +0000
@@ -10,10 +10,17 @@
{
if ( value == 'int' )
{
+ showById( 'numberTypeTR' );
+ hideById( 'textTypeTR' );
enable( 'zeroIsSignificant' );
} else
{
disable( 'zeroIsSignificant' );
+ hideById( 'numberTypeTR' );
+ hideById( 'textTypeTR' );
+ if( value=='string'){
+ showById( 'textTypeTR' );
+ }
}
updateAggreationOperation( value );
@@ -21,7 +28,7 @@
function updateAggreationOperation( value )
{
- if ( value == 'string' || value == 'date' )
+ if ( value == 'string' || value == 'date' || value == 'trueOnly' )
{
hideById( "aggregationOperator" );
} else
@@ -114,3 +121,4 @@
{
removeItem( dataElementId, dataElementName, i18n_confirm_delete, 'removeDataElement.action' );
}
+
=== 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 2012-07-04 01:37:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/updateDataElementForm.vm 2012-07-10 11:18:29 +0000
@@ -81,33 +81,37 @@
<tr #if( $calculatedDataElement ) style="display:none" #end>
<td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td>
<td>
- <select id="valueType" name="valueType" style="min-width:246px; margin: 0;">
- <option value="int" #if( $dataElement.type == 'int' ) selected="selected" #end onclick="enable('numberType');">$i18n.getString( "number" )</option>
- <option value="string" #if( $dataElement.type == 'string' ) selected="selected" #end onclick="disable('numberType');">$i18n.getString( "text" )</option>
- <option value="trueOnly" #if( $dataElement.type == 'trueOnly' ) selected="selected" #end onclick="disable('numberType');">$i18n.getString( "yes_only" )</option>
- <option value="bool" #if( $dataElement.type == 'bool' ) selected="selected" #end onclick="disable('numberType');">$i18n.getString( "yes_no" )</option>
- <option value="date" #if( $dataElement.type == 'date' ) selected="selected" #end onclick="disable('numberType');">$i18n.getString( "date" )</option>
+ <select id="valueType" name="valueType" style="min-width:246px;" onchange="changeValueType( this.value )">
+ <option value="int" #if( $dataElement.type == 'int' ) selected="selected" #end >$i18n.getString( "number" )</option>
+ <option value="string" #if( $dataElement.type == 'string' ) selected="selected" #end >$i18n.getString( "text" )</option>
+ <option value="trueOnly" #if( $dataElement.type == 'trueOnly' ) selected="selected" #end >$i18n.getString( "yes_only" )</option>
+ <option value="bool" #if( $dataElement.type == 'bool' ) selected="selected" #end >$i18n.getString( "yes_no" )</option>
+ <option value="date" #if( $dataElement.type == 'date' ) selected="selected" #end >$i18n.getString( "date" )</option>
</select>
</td>
</tr>
- <tr>
+ <tr id='numberTypeTR' #if( $dataElement.type != 'int' ) style="display:none" #end>
<td><label for="numberValueType">$i18n.getString( "number_value_type" )</label></td>
<td>
- <select id="numberType" name="numberType" style="min-width:246px; margin: 0;">
- <option value="number" #if( $dataElement.numberType == 'number' ) selected="selected" #end>$i18n.getString( "number" )</option>
+ <select id="numberType" name="numberType" >
+ <option value="number" #if( $dataElement.numberType == 'number' ) selected="selected" #end style="min-width:246px;">$i18n.getString( "number" )</option>
<option value="int" #if( $dataElement.numberType == 'int' ) selected="selected" #end>$i18n.getString( "int" )</option>
<option value="positiveNumber" #if( $dataElement.numberType == 'positiveNumber' ) selected="selected" #end>$i18n.getString( "positiveNumber" )</option>
<option value="negativeNumber" #if( $dataElement.numberType == 'negativeNumber' ) selected="selected" #end>$i18n.getString( "negativeNumber" )</option>
</select>
<script>
- if( '$dataElement.type' == 'int' ){
- enable('numberType');
- }else{
- disable('numberType');
- }
</script>
</td>
</tr>
+ <tr id='textTypeTR' #if( $dataElement.type != 'string' ) style='display:none;' #end>
+ <td><label for="textValueType">$i18n.getString( "text_type" )</label></td>
+ <td>
+ <select id="textType" name="textType" style="min-width:246px;" >
+ <option value="text" #if( $dataElement.textType == 'text' ) selected="selected" #end>$i18n.getString( "text" )</option>
+ <option value="longText" #if( $dataElement.textType == 'longText' ) selected="selected" #end >$i18n.getString( "long_text" )</option>
+ </select>
+ </td>
+ </tr>
<tr>
<td><label for="zeroIsSignificant ">$i18n.getString( "store_zero_data_values" )</label></td>
<td>
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-07-05 07:55:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties 2012-07-10 11:18:29 +0000
@@ -250,3 +250,5 @@
visited_program_stage = Visited program stage
number_of_patients = Number of patients
number_of_visits = Number of visits
+insert = Insert
+displayed_as_textarea = Displayed as textarea
=== 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 2012-07-04 01:37:02 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/javascript/viewDataEntryForm.js 2012-07-10 11:18:29 +0000
@@ -162,13 +162,13 @@
var displayName = dataElementName;
htmlCode = "<input type=\"checkbox\" title=\"" + titleValue + "\" name=\"entryselect\" id=\"" + id + "\" title=\"" + displayName + "\">";
}
- else if ( dataElementType == "date" )
+ else if ( dataElementType == "longText" )
{
var titleValue = "-- " + dataElementId + "." + dataElementName + " ("+dataElementType+") --";
var displayName = dataElementName;
- htmlCode = "<input title=\"" + titleValue + " \"name=\"entryfield\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\">";
- }
- else if ( dataElementType == "int" || dataElementType == "string" )
+ htmlCode = "<textarea title=\"" + titleValue + " \"name=\"entryfield\" id=\"" + id + "\" value=\"" + displayName + "\" title=\"" + displayName + "\" ></textarea>";
+ }
+ else if ( dataElementType == "int" || dataElementType == "text" )
{
var titleValue = "-- " + dataElementId + "." + dataElementName +" (" + dataElementType + ") --";
var displayName = dataElementName;
=== 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-04-03 10:29:04 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/webapp/dhis-web-maintenance-patient/viewDataEntryForm.vm 2012-07-10 11:18:29 +0000
@@ -137,13 +137,13 @@
<td>
<select id="dataElementIds" name="dataElementIds" style="min-width:300px" multiple="multiple" size="10" ondblclick="insertDataElement( '#dataElementSelection', '$programStage.id')">
#foreach( $de in $dataElements)
- #set($deJSON = '{' + '"id"' + ":" + $de.id + "," + '"name"' + ':"' + "$de.name" + '",' + '"shortName"' + ':"' + "$de.shortName" + '",' + '"type"' + ':"' + "$de.type" + '"}' );
+ #set($deJSON = '{' + '"id"' + ":" + $de.id + "," + '"name"' + ':"' + "$de.name" + '",' + '"shortName"' + ':"' + "$de.shortName" + '",' + '"type"' + ':"' + "$de.getDetailedTextType()" + '"}' );
<option value='$deJSON'>$encoder.htmlEncode( $de.name )</option>
#end
</select>
<select id="dataElementIdsStore" multiple="multiple" style="display:none">
#foreach( $de in $dataElements)
- #set($deJSON = '{' + '"id"' + ":" + $de.id + "," + '"name"' + ':"' + "$de.name" + '",' + '"shortName"' + ':"' + "$de.shortName" + '",' + '"type"' + ':"' + "$de.type" + '"}' );
+ #set($deJSON = '{' + '"id"' + ":" + $de.id + "," + '"name"' + ':"' + "$de.name" + '",' + '"shortName"' + ':"' + "$de.shortName" + '",' + '"type"' + ':"' + "$de.getDetailedTextType()" + '"}' );
<option value='$deJSON'>$encoder.htmlEncode( $de.name )</option>
#end
</select>