← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8983: Minor fix for filter function in anonymous program.

 

------------------------------------------------------------
revno: 8983
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Tue 2012-11-13 11:54:30 +0700
message:
  Minor fix for filter function in anonymous program.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm
  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/singleEvent.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css


--
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-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-11-12 15:26:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-11-13 04:54:30 +0000
@@ -51,15 +51,16 @@
 					<input type="text" id='endDate' name='endDate' style="width:240px;">
 				</td>
 				<td>
-					<input type="button" class='large-button' id='advancedBtn' value='$i18n.getString( "filter" )' onclick="showFilterForm();" style="width:140px;">
-					<input type="button" class='large-button' id='listBtn' value="$i18n.getString( 'update' )" onclick='updateEvents();'>
+					<input type="button" class='large-button' id='filterBtn' name="filterBtn" value='$i18n.getString( "filter" )' onclick="showFilterForm();">
+					<input type="button" class='large-button' id='listBtn' value="$i18n.getString( 'update' )" onclick="validateSearchEvents(false);">&nbsp;
 				</td>
 			</tr>
+			<tr><td>&nbsp;</td></tr>
 			<tr id='minimized-advanced-search' class="hidden">
-				<td align='right' colspan='5'>
+				<td align='right' colspan='5' height="50px">
 					$i18n.getString('you_have_active_filters')&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
 					<input type="button" class='large-button' value="$i18n.getString('show_all')" onclick='showFilterForm()'>
-					<input type="button" class='large-button' value="$i18n.getString('clear_all')" onclick='removeAllOption()'>
+					<input type="button" class='large-button' value="$i18n.getString('clear_all')" onclick='removeAllOption()'>&nbsp;
 				</td>
 			</tr>
 		</table>

=== 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	2012-11-12 15:26:14 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-11-13 04:54:30 +0000
@@ -3,6 +3,7 @@
 {
 	hideById('dataEntryInfor');
 	hideById('advanced-search');
+	hideById('minimized-advanced-search');
 	hideById('listDiv');
 	showById('mainLinkLbl');
 	setFieldValue("listAll", true);
@@ -37,7 +38,7 @@
 {
 	disable('listBtn');
 	disable('addBtn');
-	disable('advancedBtn');
+	disable('filterBtn');
 	disable('removeBtn');
 	jQuery('#criteriaDiv :input').each( function( idx, item ){
 		disable(this.id);
@@ -48,7 +49,7 @@
 {
 	enable('listBtn');
 	enable('addBtn');
-	enable('advancedBtn');
+	enable('filterBtn');
 	enable('removeBtn');
 	jQuery('#criteriaDiv :input').each( function( idx, item ){
 		enable(this.id);
@@ -89,17 +90,15 @@
 			clearListById('searchObjectId');
 			clearListById('displayInReports');
 			
-			jQuery( '#searchObjectId').append( '<option value="" >[' + i18n_please_select + ']</option>' );
+			jQuery( '[name=searchObjectId]').append( '<option value="" >[' + i18n_please_select + ']</option>' );
 			for ( i in json.programStageDataElements ) {
-				jQuery( '[id=searchObjectId]').append( '<option value="' + json.programStageDataElements[i].id + '" type="' + json.programStageDataElements[i].type +'">' + json.programStageDataElements[i].name + '</option>' );
-				
+				jQuery( '[name=searchObjectId]').append( '<option value="' + json.programStageDataElements[i].id + '" type="' + json.programStageDataElements[i].type +'">' + json.programStageDataElements[i].name + '</option>' );
 				if( json.programStageDataElements[i].displayInReports=='true' ){
 					jQuery( '#displayInReports').append( '<option value="' + json.programStageDataElements[i].id + '"></option>');
 				}
 			}
 			
 			enableCriteriaDiv();
-			
 			validateSearchEvents( true );
 		});
 }
@@ -206,24 +205,30 @@
 
 function validateSearchEvents( listAll )
 {	
+	listAll = eval(listAll);
+	setFieldValue('listAll', listAll );
+	
 	var flag = true;
-	if( listAll=="false" )
+	if( !listAll )
 	{
 		if( getFieldValue('startDate')=="" || getFieldValue('endDate')=="" ){
 			showWarningMessage( i18n_specify_a_date );
 			flag = false;
 		}
 		
-		if(flag && getFieldValue('filter') == "true" )
+		if(flag && !listAll && jQuery('#filterBtn').attr("disabled")=="disabled" )
 		{
-			jQuery( '#advancedSearchTB tr' ).each( function( i, row ){
-				jQuery( this ).find(':input').each( function( idx, item ){
-					var input = jQuery( item );
-					if( input.attr('type') != 'button' && idx==0 && input.val()=='' ){
-						showWarningMessage( i18n_specify_data_element );
-						flag = false;
-					}
-				})
+			jQuery( '#advancedSearchTB tr' ).each( function( index, row ){
+				if( index>1 )
+				{
+					jQuery( row ).find(':input').each( function( idx, item ){
+						var input = jQuery( item );
+						if( input.attr('type') != 'button' && idx==0 && input.val()=='' ){
+							showWarningMessage( i18n_specify_data_element );
+							flag = false;
+						}
+					})
+				}
 			});
 		}
 	}
@@ -237,7 +242,6 @@
 {
 	hideById('dataEntryInfor');
 	hideById('listDiv');
-	setFieldValue('listAll', listAll );
 	
 	var params = '';
 	jQuery( '#displayInReports option' ).each( function( i, item ){
@@ -245,7 +249,7 @@
 		params += '&searchingValues=de_' + input.val() + '_false_';
 	});
 	
-	if(listAll=='true'){	
+	if(listAll){	
 		params += '&startDate=';
 		params += '&endDate=';
 	}
@@ -254,25 +258,28 @@
 		var searchingValue = '';
 		params += '&startDate=' + getFieldValue('startDate');
 		params += '&endDate=' + getFieldValue('endDate');
-		jQuery( '#advancedSearchTB tr' ).each( function(){
-			jQuery( this ).find(':input').each( function( idx, item ){
-				var input = jQuery( 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();
-					}
+		jQuery( '#advancedSearchTB tr' ).each( function(index, row){
+			if( index>1 )
+			{
+				jQuery( row ).find(':input').each( function( idx, item ){
+					var input = jQuery( 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();
+						}
+					}
+				});
+				
+				if( value !=''){
+					searchingValue += getValueFormula(value);
 				}
-			});
-			
-			if( value !=''){
-				searchingValue += getValueFormula(value);
+				params += '&searchingValues=' + searchingValue;
+				searchingValue = '';
+				value = '';
 			}
-			params += '&searchingValues=' + searchingValue;
-			searchingValue = '';
-			value = '';
 		})
 	}
 	
@@ -295,12 +302,18 @@
 			
 			var searchInfor = (listAll) ? i18n_list_all_events : i18n_search_events_by_dataelements;
 			setInnerHTML( 'searchInforTD', searchInfor);
-	
-			if(getFieldValue('filter')=='true')
+			
+			if(!listAll && jQuery('#filterBtn').attr("disabled")=="disabled")
 			{
 				showById('minimized-advanced-search');
 				hideById('advanced-search');
 			}
+			else
+			{
+				hideById('minimized-advanced-search');
+				hideById('advanced-search');
+				showById('filterBtn');
+			}
 	
 			showById('listDiv');
 			hideById('loaderDiv');
@@ -308,11 +321,6 @@
     });
 }
 
-function updateEvents()
-{
-	validateSearchEvents( false );
-}
-
 function getValueFormula( value )
 {
 	if( value.indexOf('"') != value.lastIndexOf('"') )
@@ -497,14 +505,13 @@
 {
 	showById('advanced-search');
 	hideById('minimized-advanced-search');
-	disable('advancedBtn');
+	disable('filterBtn');
+	setFieldValue('listAll', false);
 }
 
 function removeAllOption()
 {
-	enable('advancedBtn');
-	setFieldValue('filter', false);
-	jQuery('#advancedBtn').attr("isShown", false);
+	enable('filterBtn');
 	jQuery( '#advancedSearchTB tr' ).each( function( i, row ){
 		if(i>2){
 			jQuery(this).remove();
@@ -520,7 +527,5 @@
 	});
 	jQuery('#searchObjectId').val("");
 	jQuery('#searchText').val("");
-	hideById('advanced-search');
-	hideById('minimized-advanced-search');
-	searchEvents( false );
+	searchEvents( eval(getFieldValue("listAll")) );
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2012-11-09 08:34:16 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/singleEvent.js	2012-11-13 04:54:30 +0000
@@ -117,11 +117,11 @@
 				addData( programId, patientId );
 			}
 			else if ( type == 'error' ){
-				setMessage( i18n_program_enrollment_failed + ':' + '\n' + message );
+				showWarningMessage( i18n_program_enrollment_failed + ':' + '\n' + message );
 				removePatientInSingleProgram(patientId);
 			}
 			else if ( type == 'input' ){
-				setMessage( json.message );
+				showWarningMessage( json.message );
 				removePatientInSingleProgram(patientId);
 			}
 			jQuery('#loaderDiv').hide();
@@ -298,7 +298,7 @@
 				showSelectedDataRecoding(patientId, programId );
 			}
 			else if ( type == 'input' ){
-				setMessage( json.message );
+				showWarningMessage( json.message );
 			}
 		});
 }
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-11-09 15:15:25 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-11-13 04:54:30 +0000
@@ -152,7 +152,7 @@
 .entryScreen
 {
 	margin-bottom: 20px;
-	width: 95%;
+	width: 70%;
 	font-size: 13px; 
 	line-height: 18px;
 }