=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm 2014-04-03 08:06:06 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/addAttributeForm.vm 2014-04-04 11:49:44 +0000 @@ -4,7 +4,7 @@ #sharingCreateNotification( "trackedEntityAttribute" ) -
+ @@ -67,35 +67,53 @@ + - - + - - + + - - - - - - - - - - - + + + + + + + + + + + + + + + + + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeForm.js 2014-04-03 08:06:06 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/addAttributeForm.js 2014-04-04 11:49:44 +0000 @@ -1,13 +1,9 @@ -$(document).ready( function(){ +jQuery(document).ready( function(){ validation( 'addAttributeForm', function(form){ form.submit(); - }); + }) checkValueIsExist( "name", "validateAttribute.action"); checkValueIsExist( "shortName", "validateAttribute.action"); checkValueIsExist( "code", "validateAttribute.action"); - - $('#unique').on('click', function() { - $("[name='localIdField']").toggle(); - }); -}); +}); \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js 2014-04-03 08:06:06 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/attribute.js 2014-04-04 11:49:44 +0000 @@ -1,3 +1,4 @@ + $(function() { dhis2.contextmenu.makeContextMenu({ menuId: 'contextMenu', @@ -14,59 +15,66 @@ } function showAttributeDetails( context ) { - jQuery.getJSON('getAttribute.action', { id: context.id }, - function( json ) { - setInnerHTML('nameField', json.attribute.name); - setInnerHTML('descriptionField', json.attribute.description); - setInnerHTML('optionSetField', json.attribute.optionSet); - - var unique = ( json.attribute.unique == 'true') ? i18n_yes : i18n_no; - setInnerHTML('uniqueField', unique); - - var inherit = ( json.attribute.inherit == 'true') ? i18n_yes : i18n_no; - setInnerHTML('inheritField', inherit); - - var valueType = json.attribute.valueType; - var typeMap = attributeTypeMap(); - setInnerHTML('valueTypeField', typeMap[valueType]); - - showDetails(); - }); + jQuery.getJSON( 'getAttribute.action', { id: context.id }, + function ( json ) { + setInnerHTML( 'nameField', json.attribute.name ); + setInnerHTML( 'descriptionField', json.attribute.description ); + setInnerHTML( 'optionSetField', json.attribute.optionSet ); + + var unique = ( json.attribute.unique == 'true') ? i18n_yes : i18n_no; + setInnerHTML( 'uniqueField', unique ); + + var inherit = ( json.attribute.inherit == 'true') ? i18n_yes : i18n_no; + setInnerHTML( 'inheritField', inherit ); + + var valueType = json.attribute.valueType; + var typeMap = attributeTypeMap(); + setInnerHTML( 'valueTypeField', typeMap[valueType] ); + + showDetails(); + }); } -function attributeTypeMap() { - var typeMap = []; - typeMap['number'] = i18n_number; - typeMap['string'] = i18n_text; - typeMap['bool'] = i18n_yes_no; - typeMap['trueOnly'] = i18n_yes_only; - typeMap['date'] = i18n_date; - typeMap['phoneNumber'] = i18n_phone_number; - typeMap['trackerAssociate'] = i18n_tracker_associate; - typeMap['combo'] = i18n_attribute_combo_type; - return typeMap; +function attributeTypeMap() +{ + var typeMap = []; + typeMap['number'] = i18n_number; + typeMap['string'] = i18n_text; + typeMap['bool'] = i18n_yes_no; + typeMap['trueOnly'] = i18n_yes_only; + typeMap['date'] = i18n_date; + typeMap['phoneNumber'] = i18n_phone_number; + typeMap['trackerAssociate'] = i18n_tracker_associate; + typeMap['combo'] = i18n_attribute_combo_type; + return typeMap; } // ----------------------------------------------------------------------------- // Remove Attribute // ----------------------------------------------------------------------------- -function removeAttribute( context ) { - removeItem(context.id, context.name, i18n_confirm_delete, 'removeAttribute.action'); +function removeAttribute( context ) +{ + removeItem( context.id, context.name, i18n_confirm_delete, 'removeAttribute.action' ); } + function typeOnChange() { - var type = getFieldValue('valueType'); - if( type == "combo" ) { - showById("optionSetRow"); - jQuery('[name=localIdField]').hide(); - } - else if( type == 'localId' ) { - jQuery('[name=localIdField]').show(); - hideById("optionSetRow"); - } - else { - jQuery('[name=localIdField]').hide(); - hideById("optionSetRow"); - } + var type = getFieldValue('valueType'); + if( type=="combo"){ + showById("optionSetRow"); + enable("optionSetId"); + jQuery('[name=localIdField]').hide(); + } + else if( type == 'localId' ) { + jQuery('[name=localIdField]').show(); + hideById("optionSetRow"); + disable("optionSetId"); + } + else { + jQuery('[name=localIdField]').hide(); + hideById("optionSetRow"); + disable("optionSetId"); + } } + === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/updateAttributeForm.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/updateAttributeForm.js 2014-04-03 08:06:06 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/javascript/updateAttributeForm.js 2014-04-04 11:49:44 +0000 @@ -1,17 +1,9 @@ -jQuery(document).ready(function() { - validation('updateAttributeForm', function( form ) { - form.submit(); - }); - - checkValueIsExist("name", "validateAttribute.action", {id: getFieldValue('id')}); - checkValueIsExist("shortName", "validateAttribute.action", {id: getFieldValue('id')}); - checkValueIsExist("code", "validateAttribute.action", {id: getFieldValue('id')}); - - if( $('#unique').is(':checked') ) { - $("[name='localIdField']").show(); - } - - $('#unique').on('click', function() { - $("[name='localIdField']").toggle(); - }); -}); +jQuery(document).ready( function(){ + validation( 'updateAttributeForm', function(form){ + form.submit(); + }); + + checkValueIsExist( "name", "validateAttribute.action", {id:getFieldValue('id')}); + checkValueIsExist( "shortName", "validateAttribute.action", {id:getFieldValue('id')}); + checkValueIsExist( "code", "validateAttribute.action", {id:getFieldValue('id')}); +}); \ No newline at end of file === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm 2014-04-03 08:06:06 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.vm 2014-04-04 11:49:44 +0000 @@ -63,6 +63,7 @@ + @@ -77,9 +78,6 @@ -programScope: $attribute.programScope -orgunitScope: $attribute.orgunitScope - @@ -91,7 +89,7 @@ - + - + + + + + + +
+ +
+ +
+ +
@@ -99,7 +97,20 @@
+ +