← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 8958: Modify ui of anomymous program.

 

------------------------------------------------------------
revno: 8958
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2012-11-09 13:08:13 +0700
message:
  Modify ui of anomymous program.
modified:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties
  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/searchPatientCriteria.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css
  dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties


--
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/resources/org/hisp/dhis/caseentry/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-11-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/org/hisp/dhis/caseentry/i18n_module.properties	2012-11-09 06:08:13 +0000
@@ -470,4 +470,6 @@
 left_value = Left value
 right_value = Right value
 validation_rule = Validation rule
-add_filter = Add filter
\ No newline at end of file
+specify_a_date = Please specify a date
+clear_all = Clear all
+show_all = Show all
\ No newline at end of file

=== 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-09 03:14:42 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/anonymousRegistration.vm	2012-11-09 06:08:13 +0000
@@ -1,14 +1,7 @@
 <script type="text/javascript">
    jQuery(document).ready(	function(){
-		datePickerInRange( 'startDate' , 'endDate' );		
+		datePickerInRange( 'startDate' , 'endDate', false, false );		
 		disableCriteriaDiv();
-		
-		var date = new Date();
-		var d = date.getDate();
-		var m = date.getMonth() - 3;
-		var y = date.getFullYear();
-		var edate= new Date(y, m, d);
-		jQuery('#startDate').datepicker( "setDate" , edate );				
 	});
 </script>
 				
@@ -17,6 +10,7 @@
 <input type='hidden' id='programStageInstanceId' name='programStageInstanceId' value='0'>
 <input type='hidden' id='programStageId' name='programStageId' class='stage-object-selected'>
 <input type='hidden' id='isShowEventList' name='isShowEventList'>
+<input type='hidden' id='filter' name='filter' value='false'>
 
 <select multiple id='displayInReports' name='displayInReports' class='hidden'></select>
 
@@ -25,13 +19,13 @@
 		<table>		
 			<tr>
 				<td><label>$i18n.getString( "registering_unit" )</label></td>
-				<td colspan='2'><input type="text" id='orgunitName' name='orgunitName' #if( $orgunit ) value="$encoder.htmlEncode( $orgunit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end readonly></td>
+				<td><input type="text" id='orgunitName' name='orgunitName' #if( $orgunit ) value="$encoder.htmlEncode( $orgunit.name )" #else value="[$i18n.getString( 'please_select_village' )]" #end readonly></td>
 			</tr>
 			<tr>	       
 				<td>
 				  $i18n.getString("program") <em title="$i18n.getString( "required" )" class="required">*</em></label>
 				</td>		
-				<td colspan='2'>
+				<td>
 					<select type="text" id="programId" name="programId" onchange='getDataElements();'>
 						<option value="" psid="" reportDateDes="$i18n.getString('report_date')">[$i18n.getString("please_select")]</option>
 						#foreach( $program in $programs )
@@ -42,32 +36,34 @@
 					</select>
 					<input type='hidden' class='stage-object-selected hidden'>
 				</td>
-				<td>
-					<input type="button" class='large-button' id='addBtn' value='$i18n.getString( "add_new" )' onclick="setFieldValue('isShowEventList', true);showAddEventForm();">
-				</td>
-				<td>
+				<td></td>
+				<td>
+					<input type="button" class='large-button' id='addBtn' value='$i18n.getString( "add_new" )' onclick="showAddEventForm();">
 					<input type="button" id='removeBtn' value='$i18n.getString( "remove_empty_events" )' onclick="removeEmptyEvents();" style="width:140px;">
 				</td>
 			</tr>
 			<tr>
 				<td><label>$i18n.getString('from')</label></td>
 				<td>
-					<input type="text" id='startDate' name='startDate' style="width:90px;">
-				</td>
-				<td>
-					<label>$i18n.getString('to')</label>
-					<input type="text" id='endDate' name='endDate' style="width:90px;">
-				</td>
-				<td>
-					<input type="button" class='large-button' id='listBtn' value="$i18n.getString( 'update' )" onclick='validateSearchEvents( true );'>
-				</td>
-				<td>
-					<input type="button" class='large-button' id='advancedBtn' value='$i18n.getString( "add_filter" )' onclick="filterDivToogle();" isShown="false" style="width:140px;">
-				</td>
-				
+					<input type="text" id='startDate' name='startDate' style="width:240px;">
+				</td>
+				<td><label>$i18n.getString('to')</label></td>
+				<td>
+					<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='setFieldValue("isShowEventList", false);updateEvents();'>
+				</td>
 			</tr>
+		</table>	
+		
+		<table id='minimized-advanced-search' class="hidden">
+			<tr><td align='right'>
+				<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()'>
+			</td></tr>
 		</table>
-		
 		<table id='advanced-search' class='hidden'>
 			<col/>
 			<col/>
@@ -78,14 +74,14 @@
 					<td id='searchingAttributeIdTD'>
 						<select id="searchObjectId" name="searchObjectId" onchange='dataElementOnChange(this);'></select>
 					</td>		
-					<td>
-						<input type="text" id="searchText" name="searchText" value="$!searchText" style='margin-right:25px;'>
-					</td>
-					<td>
-						<input type="button" class='tiny-button' id='addSearchOptionBtn' name='addSearchOptionBtn' value='+' onclick='addAttributeOption()'>
-					</td>
-					<td>
-						<input type="button" class='large-button' id='searchBtn' name="searchBtn" value='$i18n.getString( "filter" )' onclick='setFieldValue("isShowEventList", false);validateSearchEvents( false )'>
+					<td style="padding-right:5px;">
+						<input type="text" id="searchText" name="searchText" value="$!searchText">
+					</td>
+					<td rowspan='30' valign='bottom' style="padding-bottom:5px">
+						<input type="button" class='tiny-button' id='addSearchOptionBtn' name='addSearchOptionBtn' value="+" onclick='addAttributeOption()'>
+					</td>
+					<td rowspan='30' valign='bottom' align='right' style="padding-bottom:5px">
+						<input type="button" class='large-button' id='addSearchOptionBtn' name='addSearchOptionBtn' value="$i18n.getString('clear_all')" onclick='removeAllOption()'>
 					</td>
 				</tr>
 			</tbody>
@@ -162,6 +158,8 @@
 	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
 	var i18n_add_filter = '$encoder.jsEscape( $i18n.getString( "add_filter" ) , "'")';
 	var i18n_clear_filter = '$encoder.jsEscape( $i18n.getString( "clear_filter" ) , "'")';
+	var i18n_specify_a_date = '$encoder.jsEscape( $i18n.getString( "specify_a_date" ) , "'")';
+	var i18n_clear = '$encoder.jsEscape( $i18n.getString( "clear" ) , "'")';
 	
 	isAjax = true;
 	contentDiv = '';

=== 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-08 06:20:53 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/anonymousRegistration.js	2012-11-09 06:08:13 +0000
@@ -91,6 +91,9 @@
 			}
 			
 			enableCriteriaDiv();
+			
+			validateSearchEvents( true );
+			setFieldValue('isShowEventList', true);
 		});
 }
 
@@ -167,15 +170,23 @@
 	var flag = true;
 	if( !listAll )
 	{
-		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;
-				}
-			})
-		});
+		if( getFieldValue('startDate')=="" || getFieldValue('endDate')=="" ){
+			showWarningMessage( i18n_specify_a_date );
+			flag = false;
+		}
+		
+		if(flag && getFieldValue('filter') == "true" )
+		{
+			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;
+					}
+				})
+			});
+		}
 	}
 	
 	if(flag){
@@ -190,18 +201,20 @@
 	setFieldValue('isShowEventList', listAll );
 	
 	var params = '';
-	params += '&startDate=' + getFieldValue('startDate');
-	params += '&endDate=' + getFieldValue('endDate');
-		
+	jQuery( '#displayInReports option' ).each( function( i, item ){
+		var input = jQuery( item );
+		params += '&searchingValues=de_' + input.val() + '_false_';
+	});
+	
 	if(listAll){	
-		jQuery( '#displayInReports option' ).each( function( i, item ){
-			var input = jQuery( item );
-			params += '&searchingValues=de_' + input.val() + '_false_';
-		});
+		params += '&startDate=';
+		params += '&endDate=';
 	}
 	else{
 		var value = '';
 		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 );
@@ -250,6 +263,16 @@
     });
 }
 
+function updateEvents()
+{
+	if(getFieldValue('filter')=='true')
+	{
+		showById('minimized-advanced-search');
+		hideById('advanced-search');
+	}
+	validateSearchEvents( false );
+}
+
 function getValueFormula( value )
 {
 	if( value.indexOf('"') != value.lastIndexOf('"') )
@@ -430,18 +453,34 @@
 	}
 }
 
-function filterDivToogle()
+function showFilterForm()
 {
 	jQuery('#advanced-search').toggle();
-	var isShown = jQuery('#advancedBtn').attr("isShown");
-	if( isShown=="false" ){
-		jQuery('#advancedBtn').val(i18n_clear_filter);
-		jQuery('#advancedBtn').attr("isShown", true );
-	}
-	else
-	{
-		jQuery('#advancedBtn').val(i18n_add_filter);
-		jQuery('#advancedBtn').attr("isShown", false);
-		searchEvents( true );
-	}
+	hideById('minimized-advanced-search');
+	disable('advancedBtn');
+	setFieldValue('filter', true);
+}
+
+function removeAllOption()
+{
+	enable('advancedBtn');
+	setFieldValue('filter', false);
+	jQuery('#advancedBtn').val(i18n_add_filter);
+	jQuery('#advancedBtn').attr("isShown", false);
+	jQuery( '#advancedSearchTB tr' ).each( function( i, row ){
+		if(i==0){
+			jQuery( this ).find(':input').each( function( idx, item ){
+				var input = jQuery( item );
+				if( input.attr('type') != 'button'){
+					input.val('');
+				}
+			});
+		}
+		else{
+			jQuery(this).remove();
+		}
+	});
+	hideById('advanced-search');
+	hideById('minimized-advanced-search');
+	searchEvents( false );
 }

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2012-10-18 04:43:40 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/searchPatientCriteria.vm	2012-11-09 06:08:13 +0000
@@ -81,13 +81,13 @@
 					<input type="text" id="searchText" name="searchText" value="$!searchText" onkeyup='searchPatientsOnKeyUp( event );' style='margin-right:25px;'>
 				</td>	
 				<td></td>
-				<td>
+				<td rowspan='30' valign='bottom' style="padding-bottom:5px">
 					<input type="button" class='tiny-button' value='+' onclick='addAttributeOption();'>
 				</td>
-				<td>
+				<td rowspan='30' valign='bottom' style="padding-bottom:5px">
 					<input type="button" class='large-button' value='$i18n.getString( "search" )' onclick='validateAdvancedSearch();' id='searchPatientBtn'>
-				</td>
-				<td>
+				</td rowspan='30' valign='bottom' style="padding-bottom:5px">
+				<td rowspan='30' valign='bottom' style="padding-bottom:5px" style="padding-bottom:5px">
 					<input type="button" class='large-button hidden' id='sendSmsToListBtn' value="$i18n.getString('send_message')" onclick="setFieldValue('sendToList', true);showSendSmsForm();" >
 				</td>
 			</tr>
@@ -102,6 +102,8 @@
 	var i18n_yes = '$encoder.jsEscape( $i18n.getString( "yes" ) , "'")';
 	var i18n_no = '$encoder.jsEscape( $i18n.getString( "no" ) , "'")';
 	var i18n_specify_search_criteria = '$encoder.jsEscape( $i18n.getString( "specify_search_criteria" ) , "'")';
+	var i18n_clear = '$encoder.jsEscape( $i18n.getString( "clear" ) , "'")';
+	
 	datePicker( 'startDueDate', true );
 	datePicker( 'endDueDate', true );
 	

=== 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-08 16:07:27 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-11-09 06:08:13 +0000
@@ -105,11 +105,23 @@
 {
   position: relative;
   border: 1px solid #a4d2a3;
-  padding: 5px;
-  margin-bottom: 10px;
+  background-color: #d5efd5;
+  padding-top: 10px;
+  padding-right: 20px;
+  padding-bottom: 5px;
+  padding-left: 20px;
+  margin-bottom: 15px;
   border-radius: 3px;
 }
 
+#minimized-advanced-search 
+{
+  position: relative;
+  border: 1px solid #a4d2a3;
+  background-color: #d5efd5;
+  width:100%;
+}
+
 /*----------------------------------------------------------------------------*/
 /* Button list
 /*----------------------------------------------------------------------------*/

=== modified file 'dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties'
--- dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-11-09 04:05:20 +0000
+++ dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-patient/src/main/resources/org/hisp/dhis/patient/i18n_module.properties	2012-11-09 06:08:13 +0000
@@ -320,5 +320,4 @@
 edit_right_side = Edit right side
 update_program_validation_rule = Edit program validation rule
 description_not_null = Description is not null
-expression_not_null = Expression is not null
-range_in_due_date = Range in due date
\ No newline at end of file
+expression_not_null = Expression is not null
\ No newline at end of file