dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29084
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14626: update teAttribute UI, show scope when unique is selected, remove period scope
------------------------------------------------------------
revno: 14626
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Thu 2014-04-03 15:06:06 +0700
message:
update teAttribute UI, show scope when unique is selected, remove period scope
modified:
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java
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/javascript/addAttributeForm.js
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/updateAttributeForm.js
dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/webapp/dhis-web-maintenance-program/updateAttibuteForm.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-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2014-03-26 17:39:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/AddAttributeAction.java 2014-04-03 08:06:06 +0000
@@ -175,7 +175,7 @@
inherit = (inherit == null) ? false : true;
attribute.setInherit( inherit );
- if ( valueType.equals( TrackedEntityAttribute.VALUE_TYPE_LOCAL_ID ) )
+ if ( unique )
{
orgunitScope = (orgunitScope == null) ? false : orgunitScope;
programScope = (programScope == null) ? false : programScope;
=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2014-03-26 17:39:16 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-program/src/main/java/org/hisp/dhis/trackedentity/action/trackedentityattribute/UpdateAttributeAction.java 2014-04-03 08:06:06 +0000
@@ -184,7 +184,7 @@
inherit = (inherit == null) ? false : true;
attribute.setInherit( inherit );
- if ( valueType.equals( TrackedEntityAttribute.VALUE_TYPE_LOCAL_ID ) )
+ if ( unique )
{
orgunitScope = (orgunitScope == null) ? false : orgunitScope;
programScope = (programScope == null) ? false : programScope;
=== 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 07:30:22 +0000
+++ 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
@@ -80,39 +80,22 @@
</select>
</td>
</tr>
-
+
<tr name='localIdField' style='display:none;'>
- <th colspan='2'><label for="type">$i18n.getString( "scope" )</label></th>
- </tr>
+ <th colspan='2'><label for="type">$i18n.getString( "scope" )</label></th>
+ </tr>
- <tr name='localIdField' style='display:none;'>
- <td><label for="type">$i18n.getString( "orgunit" )</label></td>
- <td>
- <input type='checkbox' id="orgunitScope" name="orgunitScope" value='true' >
- </td>
- <td></td>
- </tr>
-
- <tr name='localIdField' style='display:none;'>
- <td><label for="type">$i18n.getString( "program" )</label></td>
- <td>
- <input type='checkbox' id="programScope" name="programScope" value='true' >
- </td>
- <td></td>
- </tr>
-
- <tr name='localIdField' style='display:none;'>
- <td><label for="type">$i18n.getString( "period_type" )</label></td>
- <td>
- <select type='checkbox' id="periodTypeName" name="periodTypeName" >
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ( $periodType in $periodTypes )
- <option value="$periodType.name">$i18n.getString( $periodType.name )</option>
- #end
- </select>
- </td>
- <td></td>
- </tr>
+ <tr name='localIdField' style='display:none;'>
+ <td><label for="type">$i18n.getString( "orgunit" )</label></td>
+ <td><input type='checkbox' id="orgunitScope" name="orgunitScope" value='true' ></td>
+ <td></td>
+ </tr>
+
+ <tr name='localIdField' style='display:none;'>
+ <td><label for="type">$i18n.getString( "program" )</label></td>
+ <td><input type='checkbox' id="programScope" name="programScope" value='true' ></td>
+ <td></td>
+ </tr>
</tbody>
=== 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-03-26 17:39:16 +0000
+++ 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
@@ -1,9 +1,13 @@
-jQuery(document).ready( function(){
+$(document).ready( function(){
validation( 'addAttributeForm', function(form){
form.submit();
- })
+ });
checkValueIsExist( "name", "validateAttribute.action");
checkValueIsExist( "shortName", "validateAttribute.action");
checkValueIsExist( "code", "validateAttribute.action");
-});
\ No newline at end of file
+
+ $('#unique').on('click', function() {
+ $("[name='localIdField']").toggle();
+ });
+});
=== 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-03-20 05:43:18 +0000
+++ 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
@@ -1,4 +1,3 @@
-
$(function() {
dhis2.contextmenu.makeContextMenu({
menuId: 'contextMenu',
@@ -15,63 +14,59 @@
}
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");
+ jQuery('[name=localIdField]').hide();
+ }
+ else if( type == 'localId' ) {
+ jQuery('[name=localIdField]').show();
+ hideById("optionSetRow");
+ }
+ else {
+ jQuery('[name=localIdField]').hide();
+ hideById("optionSetRow");
+ }
}
-
=== 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-03-26 17:39:16 +0000
+++ 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
@@ -1,9 +1,17 @@
-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
+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();
+ });
+});
=== 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 07:30:22 +0000
+++ 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
@@ -77,6 +77,9 @@
</td>
</tr>
+programScope: $attribute.programScope
+orgunitScope: $attribute.orgunitScope
+
<tr name='localIdField' #if($attribute.valueType!='localId' ) style='display:none;' #end >
<th colspan='2'><label for="type">$i18n.getString( "scope" )</label></th>
</tr>
@@ -88,7 +91,7 @@
</td>
<td></td>
</tr>
-
+
<tr name='localIdField' #if($attribute.valueType!='localId' ) style='display:none;' #end>
<td><label for="type">$i18n.getString( "program" )</label></td>
<td>
@@ -96,20 +99,7 @@
</td>
<td></td>
</tr>
-
- <tr name='localIdField' #if($attribute.valueType!='localId' ) style='display:none;' #end>
- <td><label for="type">$i18n.getString( "period_type" )</label></td>
- <td>
- <select type='checkbox' id="periodTypeName" name="periodTypeName" >
- <option value="">[$i18n.getString( "please_select" )]</option>
- #foreach ( $periodType in $periodTypes )
- <option value="$periodType.name" #if( $attribute.periodType.name==$periodType.name ) selected #end>$i18n.getString( $periodType.name )</option>
- #end
- </select>
- </td>
- <td></td>
- </tr>
-
+
</tbody>
<tr>