=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js' --- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-10-09 11:13:44 +0000 +++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js 2013-10-09 19:44:17 +0000 @@ -390,7 +390,7 @@ setFieldValue( "programStageId", '' ); setFieldValue( "programId", '' ); - jQuery( '#advancedSearchTB [name=searchText]' ).val( '' ); + $( '#advancedSearchTB [name=searchText]' ).val( '' ); setFieldValue( 'orgunitId', orgUnits[0] ); setFieldValue( 'orgunitName', orgUnitNames[0] ); @@ -413,15 +413,15 @@ } function updateProgramList( arr ) { - jQuery( '#searchingAttributeIdTD [id=searchObjectId] option' ).remove(); - jQuery( '#advancedSearchTB [id=searchObjectId] option' ).remove(); + $( '#searchingAttributeIdTD [id=searchObjectId] option' ).remove(); + $( '#advancedSearchTB [id=searchObjectId] option' ).remove(); clearListById( 'displayInReports' ); clearListById( 'programId' ); - jQuery( '#programId' ).append( '' ); + $( '#programId' ).append( '' ); for ( var i = 0; i < arr.length; i++ ) { - jQuery( '#programId' ).append( + $( '#programId' ).append( '' ); - for ( i in json.programStageDataElements ) { - jQuery( '[name=searchObjectId]' ).append( '' ); - if ( json.programStageDataElements[i].displayInReports == 'true' ) { - jQuery( '#displayInReports' ).append( '' ); + $('[name=searchObjectId]').append(''); + for( i in json.programStageDataElements ) { + $('[name=searchObjectId]').append(''); + + if( json.programStageDataElements[i].displayInReports == 'true' ) { + $('#displayInReports').append(''); } } @@ -506,9 +507,9 @@ } function dataElementOnChange( this_ ) { - var container = jQuery( this_ ).parent().parent().attr( 'id' ); - var element = jQuery( '#' + container + ' [id=searchText]' ); - var valueType = jQuery( '#' + container + ' [id=searchObjectId] option:selected' ).attr( 'type' ); + var container = $( this_ ).parent().parent().attr( 'id' ); + var element = $( '#' + container + ' [id=searchText]' ); + var valueType = $( '#' + container + ' [id=searchObjectId] option:selected' ).attr( 'type' ); if ( valueType == 'date' ) { element.replaceWith( getDateField( container ) ); @@ -524,10 +525,10 @@ } else if ( valueType == 'optionset' ) { element.replaceWith( searchTextBox ); - autocompletedFilterField( container + " [id=searchText]", jQuery(this_).find("option:selected").attr('uid') ); + autocompletedFilterField( container + " [id=searchText]", $(this_).find("option:selected").attr('uid') ); } else if ( valueType == 'username' ) { - autocompletedUsernameField( jQuery( this_ ).attr( 'id' ) ); + autocompletedUsernameField( $( this_ ).attr( 'id' ) ); } else { element.replaceWith( searchTextBox ); @@ -536,7 +537,7 @@ } function autocompletedFilterField( idField, searchObjectId ) { - var input = jQuery( "#" + idField ); + var input = $( "#" + idField ); input.css( "width", "237px" ); input.autocomplete( { delay: 0, @@ -597,7 +598,7 @@ } function autocompletedUsernameField( idField ) { - var input = jQuery( "#" + idField ); + var input = $( "#" + idField ); input.parent().width( input.width() + 200 ); var dataElementId = input.attr( 'id' ).split( '-' )[1]; @@ -684,9 +685,9 @@ } function removeAllAttributeOption() { - jQuery( '#advancedSearchTB tbody tr' ).each( function ( i, item ) { + $( '#advancedSearchTB tbody tr' ).each( function ( i, item ) { if ( i > 0 ) { - jQuery( item ).remove(); + $( item ).remove(); } } ) } @@ -702,11 +703,11 @@ flag = false; } - if ( flag && !listAll && jQuery( '#filterBtn' ).attr( "disabled" ) == "disabled" ) { - jQuery( '#advancedSearchTB tr' ).each( function ( index, row ) { + if ( flag && !listAll && $( '#filterBtn' ).attr( "disabled" ) == "disabled" ) { + $( '#advancedSearchTB tr' ).each( function ( index, row ) { if ( index > 1 ) { - jQuery( row ).find( ':input' ).each( function ( idx, item ) { - var input = jQuery( item ); + $( row ).find( ':input' ).each( function ( idx, item ) { + var input = $( item ); if ( input.attr( 'type' ) != 'button' && idx == 0 && input.val() == '' ) { showWarningMessage( i18n_specify_data_element ); flag = false; @@ -733,8 +734,8 @@ hideById( 'listDiv' ); var params = 'anonynousEntryForm=true'; - jQuery( '#displayInReports option' ).each( function ( i, item ) { - var input = jQuery( item ); + $( '#displayInReports option' ).each( function ( i, item ) { + var input = $( item ); params += '&filterValues=de_' + input.val() + '_false_'; } ); @@ -750,16 +751,16 @@ if ( byId( "incompleted" ).checked ) { params += '&useCompletedEvents=false'; } - jQuery( '#advancedSearchTB tr' ).each( function ( index, row ) { + $( '#advancedSearchTB tr' ).each( function ( index, row ) { if ( index > 1 ) { - jQuery( row ).find( ':input' ).each( function ( idx, item ) { - var input = jQuery( item ); + $( row ).find( ':input' ).each( function ( idx, item ) { + var input = $( item ); if ( input.attr( 'type' ) != 'button' ) { if ( idx == 0 && input.val() != '' ) { searchingValue = 'de_' + input.val() + '_false_'; } else if ( input.val() != '' ) { - value += jQuery.trim( input.val() ).toLowerCase(); + value += $.trim( input.val() ).toLowerCase(); } } } ); @@ -777,7 +778,7 @@ params += '&facilityLB=selected'; params += '&level=0'; params += '&orgunitIds=' + getFieldValue( 'orgunitId' ); - params += '&programStageId=' + jQuery( '#programId option:selected' ).attr( 'psid' ); + params += '&programStageId=' + $( '#programId option:selected' ).attr( 'psid' ); params += '&orderByOrgunitAsc=false'; params += '&userOrganisationUnit=false'; params += '&userOrganisationUnitChildren=false'; @@ -807,7 +808,7 @@ var searchInfor = (listAll) ? i18n_list_all_events : i18n_search_events_by_dataelements; setInnerHTML( 'searchInforTD', searchInfor ); - if ( !listAll && jQuery( '#filterBtn' ).attr( "disabled" ) == "disabled" ) { + if ( !listAll && $( '#filterBtn' ).attr( "disabled" ) == "disabled" ) { showById( 'minimized-advanced-search' ); hideById( 'advanced-search' ); } @@ -870,7 +871,7 @@ function showUpdateEvent( programStageInstanceId ) { hideById( 'dataEntryMenu' ); showById( 'eventActionMenu' ); - jQuery( "[name=eventActionLink]" ).hide(); + $( "[name=eventActionLink]" ).hide(); hideById( 'selectDiv' ); hideById( 'searchDiv' ); hideById( 'listDiv' ); @@ -898,7 +899,7 @@ function showAddEventForm( isCreateEvent ) { showById( 'eventActionMenu' ); - jQuery( "[name=eventActionLink]" ).hide(); + $( "[name=eventActionLink]" ).hide(); hideById( 'dataEntryMenu' ); setInnerHTML( 'dataEntryFormDiv', '' ); hideById( 'selectDiv' ); @@ -909,7 +910,7 @@ hideById( 'actionDiv' ); showById( 'dataEntryInfor' ); setFieldValue( 'programStageInstanceId', '0' ); - setInnerHTML( 'programName', jQuery( '#programId option:selected' ).text() ); + setInnerHTML( 'programName', $( '#programId option:selected' ).text() ); if( isCreateEvent != undefined ){ addNewEvent(); } @@ -917,11 +918,11 @@ function addNewEvent() { var programStageInstanceId = getFieldValue( 'programStageInstanceId' ); - var programId = jQuery( '#programId option:selected' ).val(); + var programId = $( '#programId option:selected' ).val(); var executionDate = getFieldValue( 'executionDate' ); var orgunitId = getFieldValue( 'orgunitId' ); - jQuery( "#executionDate" ).css( 'background-color', SAVING_COLOR ); + $( "#executionDate" ).css( 'background-color', SAVING_COLOR ); service.saveExecutionDate( programId, programStageInstanceId, executionDate, orgunitId ); } @@ -934,9 +935,9 @@ var result = window.confirm( i18n_confirm_remove_empty_events ); if ( result ) { - jQuery.getJSON( "removeEmptyEvents.action", + $.getJSON( "removeEmptyEvents.action", { - programStageId: jQuery( '#selectDiv [id=programId] option:selected' ).attr( 'psid' ) + programStageId: $( '#selectDiv [id=programId] option:selected' ).attr( 'psid' ) }, function ( json ) { if ( json.response == 'success' ) { @@ -975,21 +976,21 @@ function removeAllOption() { enable( 'filterBtn' ); - jQuery( '#advancedSearchTB tr' ).each( function ( i, row ) { + $( '#advancedSearchTB tr' ).each( function ( i, row ) { if ( i > 2 ) { - jQuery( this ).remove(); + $( this ).remove(); } else if ( i == 2 ) { - jQuery( this ).find( ':input' ).each( function ( idx, item ) { - var input = jQuery( item ); + $( this ).find( ':input' ).each( function ( idx, item ) { + var input = $( item ); if ( input.attr( 'type' ) != 'button' ) { input.val( '' ); } } ); } } ); - jQuery( '#searchObjectId' ).val( "" ); - jQuery( '#searchText' ).val( "" ); + $( '#searchObjectId' ).val( "" ); + $( '#searchText' ).val( "" ); searchEvents( eval( getFieldValue( "listAll" ) ) ); } @@ -1009,7 +1010,7 @@ saveExecutionDate: function( programId, programStageInstanceId, executionDate, organisationUnitId ) { ajaxExecutionDate(programId, programStageInstanceId, executionDate, organisationUnitId).done(function ( json ) { if ( json.response == 'success' ) { - jQuery( "#executionDate" ).css( 'background-color', SUCCESS_COLOR ); + $( "#executionDate" ).css( 'background-color', SUCCESS_COLOR ); setFieldValue( 'programStageInstanceId', json.message ); if ( programStageInstanceId != json.message ) { @@ -1017,7 +1018,7 @@ } } else { - jQuery( "#executionDate" ).css( 'background-color', ERROR_COLOR ); + $( "#executionDate" ).css( 'background-color', ERROR_COLOR ); showWarningMessage( json.message ); } } ).fail( function () { @@ -1032,7 +1033,7 @@ programStageInstanceId = "local"+i; setFieldValue( 'programStageInstanceId', programStageInstanceId ); - jQuery( "#executionDate" ).css( 'background-color', SUCCESS_COLOR ); + $( "#executionDate" ).css( 'background-color', SUCCESS_COLOR ); showUpdateEvent( programStageInstanceId ); var data = {}; @@ -1045,7 +1046,7 @@ } else { // if we have a programStageInstanceId, just reuse that one setFieldValue( 'programStageInstanceId', programStageInstanceId ); - jQuery( "#executionDate" ).css( 'background-color', SUCCESS_COLOR ); + $( "#executionDate" ).css( 'background-color', SUCCESS_COLOR ); showUpdateEvent( programStageInstanceId ); } } ); @@ -1064,15 +1065,15 @@ })(); function updateDataForm() { - jQuery( '#inputCriteriaDiv' ).remove(); + $( '#inputCriteriaDiv' ).remove(); showById( 'programName' ); showById( 'actionDiv' ); - var programName = jQuery( '#programId option:selected' ).text(); - var programStageId = jQuery( '#programId option:selected' ).attr( 'psid' ); - jQuery( '.stage-object-selected' ).attr( 'psid', programStageId ); + var programName = $( '#programId option:selected' ).text(); + var programStageId = $( '#programId option:selected' ).attr( 'psid' ); + $( '.stage-object-selected' ).attr( 'psid', programStageId ); setInnerHTML( 'programName', programName ); - jQuery('#executionDate').css('width',430); - jQuery('#executionDate').css('margin-right',34); + $('#executionDate').css('width',430); + $('#executionDate').css('margin-right',34); if ( getFieldValue( 'completed' ) == 'true' ) { disable( "completeBtn" ); @@ -1087,10 +1088,10 @@ showById( 'dataEntryInfor' ); showById( 'entryFormContainer' ); - jQuery( "#entryForm :input" ).each( function () { - if ( ( jQuery( this ).attr( 'options' ) != null && jQuery( this ).attr( 'options' ) == 'true' ) - || ( jQuery( this ).attr( 'username' ) != null && jQuery( this ).attr( 'username' ) == 'true' ) ) { - var input = jQuery( this ); + $( "#entryForm :input" ).each( function () { + if ( ( $( this ).attr( 'options' ) != null && $( this ).attr( 'options' ) == 'true' ) + || ( $( this ).attr( 'username' ) != null && $( this ).attr( 'username' ) == 'true' ) ) { + var input = $( this ); input.parent().width( input.width() + 200 ); } } );