dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #09271
Re: [Branch ~dhis2-devs-core/dhis2/trunk] Rev 2406: Added a new method getParamString() in common.js which is used to replace getArrayValueOfListById...
================================
Tran Thanh Tri
HISP Viet Nam
Cell phone: +84903670967
================================
On 21 December 2010 14:14, <noreply@xxxxxxxxxxxxx> wrote:
> ------------------------------------------------------------
> revno: 2406
> committer: Hieu <hieu.hispvietnam@xxxxxxxxx>
> branch nick: dhis2
> timestamp: Tue 2010-12-21 14:10:25 +0700
> message:
> Added a new method getParamString() in common.js which is used to replace
> getArrayValueOfListById() in list.js and fixed bugs NullPointerException.
> modified:
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java
>
> 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/lists.js
>
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js
>
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js
>
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm
>
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm
>
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js
>
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.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/reportexcel/ReportExcel.java'
> ---
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java
> 2010-08-31 08:12:53 +0000
> +++
> dhis-2/dhis-api/src/main/java/org/hisp/dhis/reportexcel/ReportExcel.java
> 2010-12-21 07:10:25 +0000
> @@ -41,7 +41,6 @@
> */
> public abstract class ReportExcel
> {
> -
> private int id;
>
> private String name;
>
> === 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
> 2010-12-14 11:36:39 +0000
> +++
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/commons.js
> 2010-12-21 07:10:25 +0000
> @@ -669,6 +669,22 @@
> }
>
> /**
> + * Returns a query string with all element values in the select list and
> + * the specified param.
> + */
> +function getParamString( elementId, param )
> +{
> + var result = "";
> +
> + jQuery.each( jQuery( "#" + elementId ).children(), function( i,
> item ){
> + result += param + "=" + item.value;
> + result += (i < jQuery( "#" + elementId
> ).children().length-1) ? "&" : "";
> + });
>
Hi Hieu. This code should change to, it will better
var list = jQuery( "#" + elementId ).children();
list.each(function(i, item){
result += param + "=" + item.value;
result += i<list.length-1?"&":"";
});
> +
>
> + return result;
> +}
> +
> +/**
> * Creates an option and adds it to the list.
> *
> * @param list the list.
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js'
> ---
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js
> 2010-10-21 07:29:06 +0000
> +++
> dhis-2/dhis-web/dhis-web-commons-resources/src/main/webapp/dhis-web-commons/javascripts/lists.js
> 2010-12-21 07:10:25 +0000
> @@ -430,10 +430,9 @@
> } );
> }
>
> -
> function getSelectedTextById( id )
> {
> - var list = byId( id );
> + var list = byId( id );
> return list[list.selectedIndex].text;
> }
>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js
> 2010-10-06 06:32:31 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/webapp/dhis-web-maintenance-dataadmin/javascript/datasetLockReport.js
> 2010-12-21 07:10:25 +0000
> @@ -10,26 +10,23 @@
>
> function validateCollectiveDataLockingForm( form )
> {
> - $.postJSON(
> - "validateCollectiveDataLocking.action",
> - {
> - selectedPeriods: getArrayValueOfListById(
> "selectedPeriods" ),
> - selectedDataSets: getArrayValueOfListById(
> "selectedDataSets" )
> - },
> - function( json )
> - {
> - if ( json.response == "input" )
> - {
> - setHeaderDelayMessage( json.message );
> - }
> - else
> - {
> - selectAllById( "selectedPeriods" );
> - selectAllById( "selectedDataSets" );
> - form.submit();
> - }
> - }
> - );
> + var url = "validateCollectiveDataLocking.action?";
> + url += getParamString( "selectedPeriods", "selectedPeriods"
> );
> + url += "&" + getParamString( "selectedDataSets",
> "selectedDataSets" );
> +
> + $.postJSON( url, function( json )
> + {
> + if ( json.response == "input" )
> + {
> + setHeaderDelayMessage( json.message );
> + }
> + else
> + {
> + selectAllById( "selectedPeriods" );
> + selectAllById( "selectedDataSets" );
> + form.submit();
> + }
> + });
> }
>
> //
> ------------------------------------------------------------------------------
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js
> 2010-09-24 04:42:54 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/webapp/dhis-web-maintenance-datadictionary/javascript/categoryCombo.js
> 2010-12-21 07:10:25 +0000
> @@ -30,10 +30,13 @@
>
> function validateSelectedCategories( form )
> {
> - jQuery.postJSON( "validateDataElementCategoryCombo.action",
> - { selectedCategories: getArrayValueOfListById(
> 'selectedList' ) },
> - function( json ){
> - if( json.response == 'success' ) form.submit();
> - else markInvalid( 'selectedCategories',
> json.message );
> - });
> + var url = "validateDataElementCategoryCombo.action?";
> + url += getParamString( "selectedList", "selectedCategories"
> );
> +
> + jQuery.postJSON( url, function( json )
> + {
> + if( json.response == 'success' ) form.submit();
> + else markInvalid( 'selectedCategories', json.message );
> + });
> +
> }
> \ No newline at end of file
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm
> 2010-10-13 07:27:34 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/webapp/dhis-web-maintenance-dataset/showAssignMultiDataSetForm.vm
> 2010-12-21 07:10:25 +0000
> @@ -99,10 +99,11 @@
>
> function reload()
> {
> - jQuery.post( "mergeAssignedOrgunits.action",
> - { selectedDataSets: getArrayValueOfListById(
> 'selectedDataSets' )
> - },
> - function( xml ){
> + var url = "mergeAssignedOrgunits.action?";
> + url += getParamString( "selectedDataSets",
> "selectedDataSets" );
> +
> + jQuery.post( url, function( xml )
> + {
> var responseLen = jQuery( xml
> ).find('unitId').length;
> var selectedListLen =
> byId('selectedDataSets').options.length;
>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm
> 2010-12-09 22:05:52 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/addOrganisationUnitGroupSetForm.vm
> 2010-12-21 07:10:25 +0000
> @@ -4,25 +4,9 @@
>
> checkValueIsExist( "name",
> "validateOrganisationUnitGroupSet.action");
>
> - changeCompulsory( getFieldValue( 'compulsory' ) );
> -
> + changeCompulsory( getFieldValue( 'compulsory' ) );
> });
>
> - function validateAddOrganisationGroupSet( form )
> - {
> - jQuery.postJSON('validateOrganisationUnitGroupSet.action',
> - {selectedGroups:
> getArrayValueOfListById('selectedGroups')},
> - function( json ){
> - if( json.response == 'success' ){
> - markValid( 'selectedGroups' );
> - form.submit();
> - }else{
> - markInvalid( 'selectedGroups',
> json.message );
> - }
> - });
> -
> - }
> -
> </script>
>
> <h3>$i18n.getString( "create_new_org_unit_group_set" ) #openHelp(
> "ou_groupsets_edit" )</h3>
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js
> 2010-11-08 07:00:05 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/javascript/organisationUnitGroupSet.js
> 2010-12-21 07:10:25 +0000
> @@ -55,16 +55,17 @@
>
> function validateAddOrganisationGroupSet( form )
> {
> - jQuery.postJSON('validateOrganisationUnitGroupSet.action',
> - {selectedGroups:
> getArrayValueOfListById('selectedGroups')},
> - function( json ){
> - if( json.response == 'success' ){
> - markValid( 'selectedGroups' );
> - selectAllById( 'selectedGroups' );
> - form.submit();
> - }else{
> - markInvalid( 'selectedGroups', json.message
> );
> - }
> - });
> -
> + var url = "validateOrganisationUnitGroupSet.action?";
> + url += getParamString( 'selectedGroups', 'selectedGroups'
> );
> +
> + jQuery.postJSON( url, function( json )
> + {
> + if( json.response == 'success' ){
> + markValid( 'selectedGroups' );
> + selectAllById( 'selectedGroups' );
> + form.submit();
> + }else{
> + markInvalid( 'selectedGroups', json.message );
> + }
> + });
> }
> \ No newline at end of file
>
> === modified file
> 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.vm'
> ---
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.vm
> 2010-12-09 22:05:52 +0000
> +++
> dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/webapp/dhis-web-maintenance-organisationunit/updateOrganisationUnitGroupSetForm.vm
> 2010-12-21 07:10:25 +0000
> @@ -4,8 +4,7 @@
>
> checkValueIsExist( "name",
> "validateOrganisationUnitGroupSet.action", {id:
> $organisationUnitGroupSet.id});
>
> - changeCompulsory( getFieldValue( 'compulsory' ) );
> -
> + changeCompulsory( getFieldValue( 'compulsory' ) );
> });
>
> </script>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-devs
> Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-devs
> More help : https://help.launchpad.net/ListHelp
>
>
Follow ups
References