------------------------------------------------------------ revno: 19988 committer: Morten Olav Hansen <morte...@gmail.com> branch nick: dhis2 timestamp: Fri 2015-09-04 15:14:19 +0700 message: update add/update de ui to use value types modified: 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/dataElementForm.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-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 2015-09-02 05:15:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/AddDataElementAction.java 2015-09-04 08:14:19 +0000 @@ -122,20 +122,6 @@ this.domainType = domainType; } - private String numberType; - - public void setNumberType( String numberType ) - { - this.numberType = numberType; - } - - private String textType; - - public void setTextType( String textType ) - { - this.textType = textType; - } - private String valueType; public void setValueType( String valueType ) @@ -222,8 +208,7 @@ { DataElement dataElement = new DataElement(); - DataElementCategoryCombo categoryCombo = dataElementCategoryService - .getDataElementCategoryCombo( selectedCategoryComboId ); + DataElementCategoryCombo categoryCombo = dataElementCategoryService.getDataElementCategoryCombo( selectedCategoryComboId ); OptionSet optionSet = optionService.getOptionSet( selectedOptionSetId ); OptionSet commentOptionSet = optionService.getOptionSet( selectedCommentOptionSetId ); @@ -235,18 +220,7 @@ dataElement.setDescription( StringUtils.trimToNull( description ) ); dataElement.setFormName( StringUtils.trimToNull( formName ) ); dataElement.setDomainType( DataElementDomain.fromValue( domainType ) ); - dataElement.setType( valueType ); - - if ( DataElement.VALUE_TYPE_STRING.equalsIgnoreCase( valueType ) ) - { - dataElement.setTextType( textType ); - } - else - { - dataElement.setNumberType( numberType ); - } - - dataElement.setValueType( ValueType.getFromDataElement( dataElement ) ); + dataElement.setValueType( ValueType.valueOf( valueType) ); dataElement.setAggregationOperator( aggregationOperator ); dataElement.setUrl( url ); dataElement.setZeroIsSignificant( zeroIsSignificant ); === 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 2015-09-02 05:15:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelement/UpdateDataElementAction.java 2015-09-04 08:14:19 +0000 @@ -135,13 +135,6 @@ this.domainType = domainType; } - private String numberType; - - public void setNumberType( String numberType ) - { - this.numberType = numberType; - } - private String valueType; public void setValueType( String valueType ) @@ -149,13 +142,6 @@ this.valueType = valueType; } - private String textType; - - public void setTextType( String textType ) - { - this.textType = textType; - } - private String aggregationOperator; public void setAggregationOperator( String aggregationOperator ) @@ -255,20 +241,7 @@ dataElement.setDescription( StringUtils.trimToNull( description ) ); dataElement.setFormName( StringUtils.trimToNull( formName ) ); dataElement.setDomainType( DataElementDomain.fromValue( domainType ) ); - dataElement.setType( valueType ); - - if ( DataElement.VALUE_TYPE_STRING.equalsIgnoreCase( valueType ) ) - { - dataElement.setTextType( textType ); - dataElement.setNumberType( null ); - } - else - { - dataElement.setNumberType( numberType ); - dataElement.setTextType( null ); - } - - dataElement.setValueType( ValueType.getFromDataElement( dataElement ) ); + dataElement.setValueType( ValueType.valueOf( valueType ) ); 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 2015-08-25 07:43:48 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/org/hisp/dhis/dd/i18n_module.properties 2015-09-04 08:14:19 +0000 @@ -172,6 +172,7 @@ update_category_option=Update category option move_selected=Move selected number_value_type=Number type +number=Number int=Integer positive_integer=Positive Integer zero_positive_int=Positive or Zero Integer === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm 2015-09-02 05:15:31 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/dataElementForm.vm 2015-09-04 08:14:19 +0000 @@ -1,38 +1,38 @@ <script type="text/javascript"> - jQuery(document).ready( function() { - #if( $update ) - validation2( 'updateDataElementForm', function( form ) - #else - validation2( 'addDataElementForm', function( form ) - #end - { - dhis2.select.selectAll( jQuery( '#aggregationLevels' ) ); - form.submit(); - }, { - 'beforeValidateHandler' : function() - { - setFieldValue( 'submitCategoryComboId', getFieldValue( 'selectedCategoryComboId' ) ); - setFieldValue( 'submitValueType', getFieldValue( 'valueType' ) ); - enable('aggregationOperatorSelect'); - #tblDynamicAttributesJavascript() - }, - 'rules' : getValidationRules( "dataElement" ) - } ); - - #if( $update ) - checkValueIsExist( "name", "validateDataElement.action", {id:getFieldValue('id')}); - checkValueIsExist( "shortName", "validateDataElement.action", {id:getFieldValue('id')}); - checkValueIsExist( "code", "validateDataElement.action", {id:getFieldValue('id')}); - - updateAggreationOperation( getFieldValue('valueType') ); - #else - checkValueIsExist( "name", "validateDataElement.action" ); - checkValueIsExist( "shortName", "validateDataElement.action" ); - checkValueIsExist( "code", "validateDataElement.action" ); - #end - }); - - var previousName = '$!encoder.jsEscape( $!dataElement.name, "'" )'; + jQuery(document).ready(function() { + #if( $update ) + validation2('updateDataElementForm', function(form) + #else + validation2( 'addDataElementForm', function(form) + #end + { + dhis2.select.selectAll(jQuery('#aggregationLevels')); + form.submit(); + } + , { + 'beforeValidateHandler': function() { + setFieldValue('submitCategoryComboId', getFieldValue('selectedCategoryComboId')); + setFieldValue('submitValueType', getFieldValue('valueType')); + enable('aggregationOperatorSelect'); + #tblDynamicAttributesJavascript() + }, + 'rules': getValidationRules("dataElement") + } ); + + #if( $update ) + checkValueIsExist("name", "validateDataElement.action", { id: getFieldValue('id') }); + checkValueIsExist("shortName", "validateDataElement.action", { id: getFieldValue('id') }); + checkValueIsExist("code", "validateDataElement.action", { id: getFieldValue('id') }); + + updateAggreationOperation(getFieldValue('valueType')); + #else + checkValueIsExist("name", "validateDataElement.action"); + checkValueIsExist("shortName", "validateDataElement.action"); + checkValueIsExist("code", "validateDataElement.action"); + #end + }); + + var previousName = '$!encoder.jsEscape( $!dataElement.name, "'" )'; </script> #if( $update ) @@ -88,40 +88,22 @@ <td><label for="valueType">$i18n.getString( "value_type" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td> <td> <select id="valueType" name="valueType" 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="bool" #if( $!dataElement.type == 'bool' ) selected="selected" #end >$i18n.getString( "yes_no" )</option> - <option value="trueOnly" #if( $!dataElement.type == 'trueOnly' ) selected="selected" #end >$i18n.getString( "yes_only" )</option> - <option value="date" #if( $!dataElement.type == 'date' ) selected="selected" #end >$i18n.getString( "date" )</option> - <option value="username" #if( $!dataElement.type == 'username' ) selected="selected" #end >$i18n.getString( "user_name" )</option> + <option value="INTEGER" #if( $!dataElement.valueType == 'INTEGER' ) selected="selected" #end >$i18n.getString( "int" )</option> + <option value="INTEGER_POSITIVE" #if( $!dataElement.valueType == 'INTEGER_POSITIVE' ) selected="selected" #end >$i18n.getString( "positive_integer" )</option> + <option value="INTEGER_NEGATIVE" #if( $!dataElement.valueType == 'INTEGER_NEGATIVE' ) selected="selected" #end >$i18n.getString( "negative_integer" )</option> + <option value="INTEGER_ZERO_OR_POSITIVE" #if( $!dataElement.valueType == 'INTEGER_ZERO_OR_POSITIVE' ) selected="selected" #end >$i18n.getString( "zero_positive_int" )</option> + <option value="NUMBER" #if( $!dataElement.valueType == 'NUMBER' ) selected="selected" #end >$i18n.getString( "number" )</option> + <option value="UNIT_INTERVAL" #if( $!dataElement.valueType == 'UNIT_INTERVAL' ) selected="selected" #end >$i18n.getString( "unit_interval" )</option> + <option value="PERCENTAGE" #if( $!dataElement.valueType == 'PERCENTAGE' ) selected="selected" #end >$i18n.getString( "percentage" )</option> + <option value="TEXT" #if( $!dataElement.valueType == 'TEXT' ) selected="selected" #end >$i18n.getString( "text" )</option> + <option value="LONG_TEXT" #if( $!dataElement.valueType == 'LONG_TEXT' ) selected="selected" #end >$i18n.getString( "long_text" )</option> + <option value="DATE" #if( $!dataElement.valueType == 'DATE' ) selected="selected" #end >$i18n.getString( "date" )</option> + <option value="USERNAME" #if( $!dataElement.valueType == 'USERNAME' ) selected="selected" #end >$i18n.getString( "user_name" )</option> + <option value="BOOLEAN" #if( $!dataElement.valueType == 'BOOLEAN' ) selected="selected" #end >$i18n.getString( "yes_no" )</option> + <option value="TRUE_ONLY" #if( $!dataElement.valueType == 'TRUE_ONLY' ) selected="selected" #end >$i18n.getString( "yes_only" )</option> </select> </td> </tr> - <tr id='numberTypeTR' #if( $!dataElement.id > 0 && $!dataElement.type != 'int' ) style="display:none" #end> - <td><label for="numberValueType">$i18n.getString( "number_value_type" )</label></td> - <td> - <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="posInt" #if( $!dataElement.numberType == 'posInt' ) selected="selected" #end>$i18n.getString( "positive_integer" )</option> - <option value="negInt" #if( $!dataElement.numberType == 'negInt' ) selected="selected" #end>$i18n.getString( "negative_integer" )</option> - <option value="zeroPositiveInt" #if( $!dataElement.numberType == 'zeroPositiveInt' ) selected="selected" #end>$i18n.getString( "zero_positive_int" )</option> - <option value="unitInterval" #if( $!dataElement.numberType == 'unitInterval' ) selected="selected" #end>$i18n.getString( "unit_interval" )</option> - <option value="percentage" #if( $!dataElement.numberType == 'percentage' ) selected="selected" #end>$i18n.getString( "percentage" )</option> - </select> - <script> - </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"> - <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="aggregationOperatorSelect" id="lblOperator">$i18n.getString( "aggregation_operator" ) <em title="$i18n.getString( 'required' )" class="required">*</em></label></td> <td>
_______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp