← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 7322: css for Provided-elsewhere checkbox in dataentry form.

 

------------------------------------------------------------
revno: 7322
committer: Tran Chau <tran.hispvietnam@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2012-06-18 15:38:51 +0700
message:
  css for Provided-elsewhere checkbox in dataentry form.
removed:
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/customcheckbox.gif
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.css
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.js
modified:
  dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java
  dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js
  dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm
  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-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java'
--- dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-06-18 07:02:55 +0000
+++ dhis-2/dhis-services/dhis-service-patient/src/main/java/org/hisp/dhis/program/DefaultProgramDataEntryService.java	2012-06-18 08:38:51 +0000
@@ -967,14 +967,15 @@
     private String addProvidedElsewherCheckbox( String appendCode, PatientDataValue patientDataValue,
         ProgramStage programStage )
     {
-        appendCode += "<label for=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\" title=\"is provided by another Facility ?\" ></label><input name=\"providedByAnotherFacility\"  title=\"is provided by another Facility ?\"  id=\"$PROGRAMSTAGEID_$DATAELEMENTID_facility\"  type=\"checkbox\" ";
+        String id = "$PROGRAMSTAGEID_$DATAELEMENTID_facility";
+        appendCode += "<div id=\"span_" + id + "\" class=\"provided-elsewhere\"><input name=\"providedByAnotherFacility\" title=\"is provided by another Facility ?\"  id=\"" + id + "\"  type=\"checkbox\" ";
 
         if ( patientDataValue != null && patientDataValue.getProvidedElsewhere() )
         {
             appendCode += " checked=\"checked\" ";
         }
 
-        appendCode += "onChange=\"updateProvidingFacility( $DATAELEMENTID, this )\"  >";
+        appendCode += "onChange=\"updateProvidingFacility( $DATAELEMENTID, this )\"  ></div>";
 
         return appendCode;
 

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-06-15 04:41:31 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/resources/struts.xml	2012-06-18 08:38:51 +0000
@@ -75,8 +75,7 @@
 			class="org.hisp.dhis.caseentry.action.caseentry.LoadDataEntryAction">
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-caseentry/dataEntryForm.vm</param>
-			<param name="javascripts">javascript/customcheckbox/prettyCheckboxes.js</param>
-			<param name="stylesheets">style/style.css,javascript/customcheckbox/prettyCheckboxes.css</param>
+			<param name="stylesheets">style/style.css</param>
 		</action>
 
 		<action name="completeDataEntry"
@@ -197,8 +196,7 @@
 			class="org.hisp.dhis.caseentry.action.caseentry.GetDataRecordsAction">
 			<result name="success" type="velocity">/content.vm</result>
 			<param name="page">/dhis-web-caseentry/dataentryRecords.vm</param>
-			<param name="javascripts">javascript/customcheckbox/prettyCheckboxes.js</param>
-			<param name="stylesheets">style/style.css,javascript/customcheckbox/prettyCheckboxes.css</param>
+			<param name="stylesheets">style/style.css</param>
 		</action>
 
 		<action name="viewProgramStageRecords"

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-06-15 06:16:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/dataEntryForm.vm	2012-06-18 08:38:51 +0000
@@ -29,12 +29,6 @@
 	#if( $customDataEntryFormCode )
 		<div id="customEntryScreenContainer">
 		   $customDataEntryFormCode
-
-			<script type="text/javascript"> 
-				#if( $!programStageInstance.programStage.program.displayProvidedOtherFacility == 'true' )
-					initCustomCheckboxes();
-				#end
-			</script>
 		</div>
 	#else
 		<table id="defaultEntryScreenContainer" class='entryScreen formSection'>
@@ -43,7 +37,9 @@
 			<tr>
 				<th>$i18n.getString( "data_element" )</th>                   
 				<th>$i18n.getString( "entry" )</th>
+				#if( $!programStageInstance.programStage.program.isRegistration() == 'true')
 				<th>$i18n.getString( "provided_elsewhere" )</th>
+				#end
 			</tr>
 		#set( $dataElementRowCount = 0 )
 		#set( $mark = true )
@@ -87,18 +83,19 @@
 							datePicker($programStageDataElement.programStage.id + '-' + $programStageDataElement.dataElement.id + '-val', false);
 						</script> 
 					#else
-						<input name="entryfield" options='$hasOptionSet' #if($hasOptionSet == 'true') class='optionset' #end dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
+						<input name="entryfield" options='$hasOptionSet' #if($hasOptionSet == 'true') #end dataElementId='$programStageDataElement.dataElement.id' data="{compulsory: $programStageDataElement.compulsory, deName:'$programStageDataElement.dataElement.name', deType:'$programStageDataElement.dataElement.getDetailedNumberType()' }" id="$id" type="text" value="$!encoder.htmlEncode( $patientDataValue.value )" onchange="saveVal( $programStageDataElement.dataElement.id )" onkeypress="return keyPress(event, this)" tabindex="$tabIndex">
 					#end
 				</td> 
-
-				<td style='width: 50px;' align='center'>
+				#if( $!programStageInstance.programStage.program.isRegistration() == 'true' )
+				<td style='width:20px;' align='center'>
 					#set( $id = $programStageDataElement.programStage.id + '_' + $programStageDataElement.dataElement.id + '_facility' )
 					#if( $programStageDataElement.allowProvidedElsewhere == 'true')
-						<input style='width: 250px;' name="$id" id="$id" type="checkbox"
-							onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" 
-							#if($patientDataValue.providedElsewhere == 'true') checked #end />
+						<div id='span_$id' class='provided-elsewhere'>
+							<input class='provided-elsewhere' name="$id" id="$id" type="checkbox" onclick="updateProvidingFacility( $programStageDataElement.dataElement.id, this )" #if($patientDataValue.providedElsewhere == 'true') checked #end />
+						</div>
 					#end
 				</td>
+				#end
 			</tr>
 		#end				
 		#set( $tabIndex = $tabIndex + 1 )

=== removed directory 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox'
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/customcheckbox.gif'
Binary files dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/customcheckbox.gif	2010-02-22 09:19:15 +0000 and dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/customcheckbox.gif	1970-01-01 00:00:00 +0000 differ
=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.css'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.css	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.css	1970-01-01 00:00:00 +0000
@@ -1,47 +0,0 @@
-/* ------------------------------------------------------------------------
-	This you can customize
-------------------------------------------------------------------------- */
-
-	label.checkbox span.holder {
-		height: 61px; /* Total height of your checkbox image */
-		background: url(customcheckbox.gif) 0 -1px no-repeat; /* Path to your checkbox image */
-	}
-	
-	label.radio span.holder {
-		height: 61px; /* Total height of your radio buttons image */
-		background: url(../images/prettyCheckboxes/radio.gif) 0 -1px no-repeat; /* Path to your radio button image */
-	}
-	
-	label.checkbox.error span.holder { top: -42px !important; } /* Background position on mouseover */
-	
-	label.checked span.holder { top: -21px !important; } /* Background position when checked */
-
-
-/* ------------------------------------------------------------------------
-	Customize at your own risk
-------------------------------------------------------------------------- */
-
-	label.list {
-		float: left; clear: left;
-		margin: 0 0 5px 0;
-	}
-	
-	label.inline {
-		float: left; 
-	}
-	
-		input.hiddenCheckbox {
-			position: absolute; left: -10000px; /* Hide the input */
-		}
-	
-		label.prettyCheckbox span.holderWrap {
-			display: block; float: left;
-			position: relative;
-			overflow: hidden;
-		}
-		
-		label.prettyCheckbox span.holder {
-			display: block;
-			position: absolute;
-			top: 0; left: 0;
-		}
\ No newline at end of file

=== removed file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.js	2010-02-22 09:19:15 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/customcheckbox/prettyCheckboxes.js	1970-01-01 00:00:00 +0000
@@ -1,100 +0,0 @@
-/* ------------------------------------------------------------------------
-	prettyCheckboxes
-	
-	Developped By: Stephane Caron (http://www.no-margin-for-errors.com)
-	Inspired By: All the non user friendly custom checkboxes solutions ;)
-	Version: 1.1
-	
-	Copyright: Feel free to redistribute the script/modify it, as
-			   long as you leave my infos at the top.
-------------------------------------------------------------------------- */
-	
-	jQuery.fn.prettyCheckboxes = function(settings) {
-		settings = jQuery.extend({
-					checkboxWidth: 17,
-					checkboxHeight: 17,
-					className : 'prettyCheckbox',
-					display: 'inline'
-				}, settings);
-
-		$(this).each(function(){
-			// Find the label
-			$label = $('label[for="'+$(this).attr('id')+'"]');
-			// Add the checkbox holder to the label
-			$label.prepend("<span class='holderWrap'><span class='holder'></span></span>");
-
-			// If the checkbox is checked, display it as checked
-			if($(this).is(':checked')) { $label.addClass('checked'); };
-
-			// Assign the class on the label
-			$label.addClass(settings.className).addClass($(this).attr('type')).addClass(settings.display);
-
-			// Assign the dimensions to the checkbox display
-			$label.find('span.holderWrap').width(settings.checkboxWidth).height(settings.checkboxHeight);
-			$label.find('span.holder').width(settings.checkboxWidth);
-
-			// Hide the checkbox
-			$(this).addClass('hiddenCheckbox');
-
-			// Associate the click event
-			$label.bind('click',function(){
-				$('input#' + $(this).attr('for')).triggerHandler('click');
-				
-				if($('input#' + $(this).attr('for')).is(':checkbox')){
-//					$(this).toggleClass('checked');
-					$('input#' + $(this).attr('for')).checked = true;
-					
-					$(this).find('span.holder').css('top',0);
-				}else{
-					$toCheck = $('input#' + $(this).attr('for'));
-
-					// Uncheck all radio
-					$('input[name="'+$toCheck.attr('name')+'"]').each(function(){
-						$('label[for="' + $(this).attr('id')+'"]').removeClass('checked');	
-					});
-
-					$(this).addClass('checked');
-					$toCheck.checked = true;
-				};
-			});
-			
-			$('input#' + $label.attr('for')).bind('keypress',function(e){
-				if(e.keyCode == 32){
-					if($.browser.msie){
-						$('label[for="'+$(this).attr('id')+'"]').toggleClass("checked");
-					}else{
-						$(this).trigger('click');
-					}
-					return false;
-				};
-			});
-			
-			//@Modified by Viet Nguyen
-			// Change the width of the parent td, so this checkbox will stay inline...
-			jQuery(this).parent("td:first").addClass("inputColumn");
-			
-		});
-	};
-	
-	checkAllPrettyCheckboxes = function(caller, container){
-		if($(caller).is(':checked')){
-			// Find the label corresponding to each checkbox and click it
-			$(container).find('input[type=checkbox]:not(:checked)').each(function(){
-				$('label[for="'+$(this).attr('id')+'"]').trigger('click');
-				if($.browser.msie){
-					$(this).attr('checked','checked');
-				}else{
-					$(this).trigger('click');
-				};
-			});
-		}else{
-			$(container).find('input[type=checkbox]:checked').each(function(){
-				$('label[for="'+$(this).attr('id')+'"]').trigger('click');
-				if($.browser.msie){
-					$(this).attr('checked','');
-				}else{
-					$(this).trigger('click');
-				};
-			});
-		};
-	};
\ No newline at end of file

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-06-18 02:36:01 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/javascript/entry.js	2012-06-18 08:38:51 +0000
@@ -1,6 +1,8 @@
 var SUCCESS_COLOR = '#ccffcc';
 var ERROR_COLOR = '#ccccff';
 var SAVING_COLOR = '#ffffcc';
+var SUCCESS = 'success';
+var ERROR = 'error';
 	
 //--------------------------------------------------------------------------------------------
 // Load program-stages by the selected program
@@ -236,8 +238,9 @@
 {
 	var programStageId = byId( 'programStageId' ).value;
 	var checked= checkField.checked;
-    checkField.style.backgroundColor = SAVING_COLOR;
-	
+	var spanField = byId( 'span_' + checkField.id );
+	spanField.style.backgroundColor = SAVING_COLOR;
+    
     var facilitySaver = new FacilitySaver( dataElementId, checked, SUCCESS_COLOR );
     facilitySaver.save();
     
@@ -481,11 +484,11 @@
         var code = parseInt( codeElement.firstChild.nodeValue );
         if ( code == 0 )
         {
-            markValue( SUCCESS_COLOR );
+            markValue( SUCCESS );
         }
         else
         {
-            markValue( ERROR_COLOR );
+            markValue( ERROR );
             window.alert( i18n_saving_value_failed_status_code + '\n\n' + code );
         }
     }
@@ -499,14 +502,14 @@
     function markValue( result )
     {
 		var programStageId = byId( 'programStageId' ).value;
-        if( result == 'success' )
+		var element = byId('span_' + programStageId + '_' + dataElementId + '_facility');
+        if( result == SUCCESS )
         {
-            jQuery('label[for="' + programStageId + '_facility"]').toggleClass('checked');
+            element.style.backgroundColor = SUCCESS_COLOR;
         }
-        else if( result == 'error' )
+        else if( result == ERROR )
         {
-            jQuery('label[for="' + programStageId + '_facility"]').removeClass('checked');
-            jQuery('label[for="' + programStageId + '_facility"]').addClass('error');
+            element.style.backgroundColor = ERROR_COLOR;
         }
     }
 }
@@ -709,11 +712,6 @@
     }
 };
 
-function initCustomCheckboxes()
-{
-    jQuery('input[type=checkbox]').prettyCheckboxes();
-}
-
 function entryFormContainerOnReady()
 {
 	var currentFocus = undefined;

=== modified file 'dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm'
--- dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2012-06-15 07:11:51 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/relationshipList.vm	2012-06-18 08:38:51 +0000
@@ -48,7 +48,7 @@
 </table>
 
 <div class='button-list'>
-	<input type="button" style='width:170px;' value="$i18n.getString( 'seach_available_patients' )" onclick="javascript:showAddRelationship('$patient.id')" >
+	<input type="button" style='width:170px;' value="$i18n.getString( 'seach_available_patient' )" onclick="javascript:showAddRelationship('$patient.id')" >
 	<input type="button" style='width:170px;' value="$i18n.getString( 'add_new_patient' )" onclick="javascript:showAddRelationshipPatient( '$patient.id',false )" >
 	<input type="button" style='width:170px;' value="$i18n.getString( 'back_to_registration' )" onclick="onClickBackBtn();" >
 </div>

=== 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-06-15 06:16:17 +0000
+++ dhis-2/dhis-web/dhis-web-caseentry/src/main/webapp/dhis-web-caseentry/style/style.css	2012-06-18 08:38:51 +0000
@@ -142,6 +142,11 @@
 	width:222px; 
 }
 
+div.provided-elsewhere{
+	width:20px; 
+	height:20px; 
+}
+
 .optionset-small-button{
 	font-size: .8em !important;
 }