=== modified file 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js' --- dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-08-18 17:44:21 +0000 +++ dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js 2011-08-19 07:40:22 +0000 @@ -265,13 +265,23 @@ } /** + * Returns true if the given value not equals null or "null" string, false if not. + * + * @param value the given value. + */ +function isNotNull( value ) +{ + return ( value != null && trim(value) != "null" ); +} + +/** * Returns true if the element with the given identifier exists, false if not. * * @param elementId the identifier of the element. */ -function isNotNull( elementId ) +function isNotEmpty( elementId ) { - return jQuery("#" + elementId).length == 1; + return jQuery("#" + elementId).length == 1; } /** === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetAssignedGroupsByDataElementAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetAssignedGroupsByDataElementAction.java 2011-08-17 09:25:09 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/dataelementgroup/GetAssignedGroupsByDataElementAction.java 2011-08-19 07:40:22 +0000 @@ -1,7 +1,7 @@ package org.hisp.dhis.dd.action.dataelementgroup; /* - * Copyright (c) 2004-2010, University of Oslo + * Copyright (c) 2004-2011, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -67,23 +67,29 @@ this.dataElementId = dataElementId; } - private List dataElementGroups; + private List dataElementGroups = new ArrayList(); public List getDataElementGroups() { return dataElementGroups; } - @Override + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + public String execute() throws Exception { - DataElement dataElement = dataElementService.getDataElement( dataElementId ); - - dataElementGroups = new ArrayList( dataElementService - .getGroupsContainingDataElement( dataElement ) ); - - Collections.sort( dataElementGroups, new DataElementGroupNameComparator() ); + if ( dataElementId != null ) + { + DataElement dataElement = dataElementService.getDataElement( dataElementId ); + + dataElementGroups = new ArrayList( dataElementService + .getGroupsContainingDataElement( dataElement ) ); + + Collections.sort( dataElementGroups, new DataElementGroupNameComparator() ); + } return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ValidateIndicatorAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ValidateIndicatorAction.java 2011-05-05 21:15:45 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicator/ValidateIndicatorAction.java 2011-08-19 07:40:22 +0000 @@ -110,7 +110,6 @@ { if ( name != null ) { - Indicator match = indicatorService.getIndicatorByName( name ); if ( match != null && (id == null || match.getId() != id) ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetAssignedIndicatorGroupsAction.java' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetAssignedIndicatorGroupsAction.java 2010-05-06 13:24:03 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/java/org/hisp/dhis/dd/action/indicatorgroup/GetAssignedIndicatorGroupsAction.java 2011-08-19 07:40:22 +0000 @@ -1,7 +1,7 @@ package org.hisp.dhis.dd.action.indicatorgroup; /* - * Copyright (c) 2004-2010, University of Oslo + * Copyright (c) 2004-2011, University of Oslo * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -38,7 +38,6 @@ import com.opensymphony.xwork2.Action; - /** * @author Tran Thanh Tri * @version $Id: $ @@ -69,22 +68,28 @@ this.indicatorId = indicatorId; } - private List indicatorGroups; + private List indicatorGroups = new ArrayList(); public List getIndicatorGroups() { return indicatorGroups; } - @Override + // ------------------------------------------------------------------------- + // Action implementation + // ------------------------------------------------------------------------- + public String execute() throws Exception { - Indicator indicator = indicatorService.getIndicator( indicatorId ); - - indicatorGroups = new ArrayList( indicatorService.getGroupsContainingIndicator( indicator ) ); - - Collections.sort( indicatorGroups, new IndicatorGroupNameComparator() ); + if ( indicatorId != null ) + { + Indicator indicator = indicatorService.getIndicator( indicatorId ); + + indicatorGroups = new ArrayList( indicatorService.getGroupsContainingIndicator( indicator ) ); + + Collections.sort( indicatorGroups, new IndicatorGroupNameComparator() ); + } return SUCCESS; } === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js 2011-06-22 18:53:24 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/dataElementGroupEditorView.js 2011-08-19 07:40:22 +0000 @@ -31,7 +31,6 @@ } list_1.find( ":first" ).attr( "selected", "selected" ); list_2.find( ":first" ).attr( "selected", "selected" ); - } function loadAvailableGroups() @@ -71,15 +70,15 @@ function getDataElementsByGroup() { - loadAvailableDataElements(); + var id = jQuery( '#view_1 #dataElementGroups' ).val(); var filter_1 = jQuery( '#view_1 #selecteDataElementsFilter' ).val(); var list_1 = jQuery( "#view_1 #selectedDataElements" ); list_1.empty(); jQuery.postJSON( "../dhis-web-commons-ajax-json/getDataElements.action", { - id : jQuery( '#view_1 #dataElementGroups' ).val() + id : ( isNotNull( id ) ? id : -1 ) }, function( json ) { jQuery.each( json.dataElements, function( i, item ) @@ -143,7 +142,6 @@ function showAddGroupView2() { - jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'title', i18n_new ); jQuery( '#addDataElementGroupForm' ).dialog( 'option', 'buttons', [ { text : i18n_save, @@ -189,7 +187,6 @@ text : i18n_save, click : function() { - jQuery.postJSON( "validateDataElementGroup.action", { id : id, name : function() @@ -350,7 +347,7 @@ list_2.empty(); jQuery.postJSON( "getAssignedDataElementGroups.action", { - dataElementId : id + dataElementId : ( isNotNull( id ) ? id : -1 ) }, function( json ) { jQuery.each( json.dataElementGroups, function( i, item ) === modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js' --- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js 2011-06-22 18:53:24 +0000 +++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/indicatorGroupEditorView.js 2011-08-19 07:40:22 +0000 @@ -72,15 +72,15 @@ function getIndicatorsByGroup() { - loadAvailableIndicators(); + var id = jQuery( '#view_1 #indicatorGroups' ).val(); var filter_1 = jQuery( '#view_1 #selectedIndicatorsFilter' ).val(); var list_1 = jQuery( "#view_1 #selectedIndicators" ); list_1.empty(); jQuery.postJSON( "../dhis-web-commons-ajax-json/getIndicators.action", { - id : jQuery( '#view_1 #indicatorGroups' ).val() + id : ( isNotNull( id ) ? id : -1 ) }, function( json ) { jQuery.each( json.indicators, function( i, item ) @@ -153,7 +153,6 @@ text : i18n_save, click : function() { - jQuery.postJSON( "validateIndicatorGroup.action", { id : id, name : function() @@ -247,10 +246,9 @@ list_2.empty(); jQuery.postJSON( "getAssignedIndicatorGroups.action", { - indicatorId : id + indicatorId : ( isNotNull( id ) ? id : -1 ) }, function( json ) { - var availabelGroups_2 = jQuery( "#view_2 #availableGroups" ); availabelGroups_2.empty(); for ( var index in indicatorGroups ) @@ -270,9 +268,7 @@ jQuery( it ).remove(); } } ); - } ); - } ); } === modified file 'dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js' --- dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2011-06-23 14:38:00 +0000 +++ dhis-2/dhis-web/dhis-web-reporting/src/main/webapp/dhis-web-reporting/javascript/table.js 2011-08-19 07:40:22 +0000 @@ -37,12 +37,12 @@ { selectAllById( "selectedDataElements" ); - if ( isNotNull( "selectedIndicators" ) ) + if ( isNotEmpty( "selectedIndicators" ) ) { selectAllById( "selectedIndicators" ); } - if ( isNotNull( "selectedDataSets" ) ) + if ( isNotEmpty( "selectedDataSets" ) ) { selectAllById( "selectedDataSets" ); }