Changeset 5132
- Timestamp:
- 08/02/08 03:24:03 (5 months ago)
- Files:
-
- openmrs-modules/personportrait/.classpath (modified) (1 diff)
- openmrs-modules/personportrait/lib-common/simple-xml-1.7.2.jar (added)
- openmrs-modules/personportrait/web/module/portlets/jquery-1.2.6.js (added)
- openmrs-modules/personportrait/web/module/portlets/personPortraitDashboardPortlet.jsp (modified) (4 diffs)
- openmrs-modules/personportrait/web/module/portlets/upload.jsp (added)
- openmrs-modules/personportrait/web/src/org/openmrs/module/personportrait/web/controller/PersonPortraitFormController.java (modified) (1 diff)
- openmrs-modules/personportrait/web/src/org/openmrs/module/personportrait/web/dwr/PersonPortraitDWRService.java (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
openmrs-modules/personportrait/.classpath
r5075 r5132 9 9 <classpathentry kind="lib" path="lib-common/servlet-api.jar"/> 10 10 <classpathentry kind="lib" path="lib-common/spring-2.0.jar"/> 11 <classpathentry kind="lib" path="lib-common/commons-fileupload-1.1.1.jar"/>12 <classpathentry kind="lib" path="lib-common/web-openmrs-api-1.3.0.12.4984.jar"/>13 <classpathentry kind="lib" path="lib-common/openmrs-api-1.3.0.12.4984.jar"/>14 <classpathentry kind="lib" path="lib-common/portlet-api-1.0.jar"/>15 <classpathentry kind="lib" path="lib-common/dwr-1.1.3mod.jar"/>16 <classpathentry kind="lib" path="lib-common/taglibs-response-1.1.jar"/>17 <classpathentry kind="lib" path="lib-common/taglibs-request-1.1.jar"/>18 <classpathentry kind="lib" path="lib-common/taglibs-standard-1.1.jar"/>19 11 <classpathentry kind="lib" path="lib-common/jsp-api.jar"/> 20 <classpathentry kind="lib" path="lib-common/taglibs-page-1.1.jar"/> 12 <classpathentry kind="lib" path="lib-common/openmrs-api-1.3.0.12.5080.jar"/> 13 <classpathentry kind="lib" path="lib-common/web-openmrs-api-1.3.0.12.5080.jar"/> 14 <classpathentry kind="lib" path="lib-common/simple-xml-1.7.2.jar"/> 21 15 <classpathentry kind="output" path="build"/> 22 16 </classpath> openmrs-modules/personportrait/web/module/portlets/personPortraitDashboardPortlet.jsp
r5081 r5132 1 <%@ include file="/WEB-INF/template/include.jsp" %>1 <%@ include file="/WEB-INF/template/include.jsp" %> 2 2 3 3 <script src='<%= request.getContextPath() %>/dwr/interface/PersonPortraitDWRService.js'></script> … … 5 5 <html> 6 6 <body> 7 8 <script type="text/javascript">9 function uploadPersonImage() {10 alert("Start Upload");11 PersonPortraitDWRService.uploadImage(request);12 alert("End Upload");13 }14 </script>15 7 8 <script type="text/javascript"> 9 <%@ include file="jquery-1.2.6.js" %> 10 var $j = jQuery.noConflict(); 11 12 var personPortrait; 13 var imageTypes=["bmp","gif","png","jpg","jpeg"]; 14 15 $j.fn.copyImage = function(src, f){ 16 return this.each(function(){ 17 var img = new Image(); 18 img.src = src; 19 img.onload = f; 20 this.appendChild(img); 21 }); 22 } 23 24 function uploadPersonImage() { 25 var filePath = $j('#imageFile').val(); 26 27 // Check the file extension 28 var extension=filePath.substring(filePath.lastIndexOf(".")+1,filePath.length).toLowerCase(); 29 for (var i=0; i<imageTypes.length; i++) 30 if (imageTypes[i]==extension) break; 31 32 alert("File Path: "+filePath); 33 personPortrait= new Image(); 34 if (i<imageTypes.length) { 35 $j('#personPortrait.src').val(filePath); 36 37 PersonPortraitDWRService.uploadImage($j('#personPortrait').val()); 38 alert('Complete'); 39 } 40 else { 41 alert("The image is not valid.\n"+ 42 "Please load an image with an extention of one of the following:\n\n"+ 43 imageTypes.join(", ")); 44 45 $j("#photo").copyImage("http://localhost:8080/openmrs/images/patient_M.gif",function(){ 46 alert("The default image is loaded"); 47 }); 48 } 49 } 50 </script> 51 52 16 53 <div id="personPortraitUploadBoxHeader" class="boxHeader${model.patientVariation}"> 17 54 <spring:message code="personportrait.portrait.upload" /> … … 19 56 20 57 <div id="personPortraitUploadBox" class="box${model.patientVariation}"> 58 <br> 21 59 <form name="uploadForm" action="" enctype="multipart/form-data" method="post"> 22 <input type="file" name="imageFile"/>23 <input type="submit" value='<spring:message code="general.submit" />' onClick="uploadPersonImage()">60 <input type="file" id="imageFile" name="imageFile"/> 61 <input TYPE="button" name='Upload' value="Upload Portrait" onClick="uploadPersonImage();document.uploadForm.submit()"> 24 62 </form> 63 <br> 25 64 </div> 26 65 … … 30 69 31 70 <div id="personPortraitViewBox" class="box${model.patientVariation}"> 32 <span style="color:#0000FF;">Patient Most Recent Portrait</span> 33 71 <img alt="" id="photoField" src=""> 72 </div> 73 <div id="photo"> 74 34 75 </div> 35 76 openmrs-modules/personportrait/web/src/org/openmrs/module/personportrait/web/controller/PersonPortraitFormController.java
r5081 r5132 126 126 127 127 // Save the obs object 128 Context.getObsService().createObs(obsImage);128 // Context.getObsService().createObs(obsImage); 129 129 130 130 // String msg = getMessageSourceAccessor().getMessage("Info", "ID="+dataImage.getTitle()); openmrs-modules/personportrait/web/src/org/openmrs/module/personportrait/web/dwr/PersonPortraitDWRService.java
r5081 r5132 14 14 import org.openmrs.Location; 15 15 import org.openmrs.Obs; 16 import org.openmrs.Patient; 16 17 import org.openmrs.api.PatientService; 17 18 import org.openmrs.api.context.Context; … … 20 21 import org.springframework.web.multipart.MultipartFile; 21 22 import org.springframework.web.multipart.MultipartHttpServletRequest; 23 24 import com.sun.medialib.mlib.Image; 22 25 23 26 public class PersonPortraitDWRService { … … 29 32 } 30 33 31 public void uploadImage( HttpServletRequest request) {34 public void uploadImage(Image image) { 32 35 log.info("Getting Person Image"); 33 36 34 HttpSession httpSession = request.getSession(); 37 /* 38 HttpSession httpSession = request.getSession(); 35 39 36 40 if (Context.isAuthenticated()) { … … 60 64 61 65 PatientService ps = Context.getPatientService(); 62 // Patient patient = ps.getPatient( patientId);66 // Patient patient = ps.getPatient("patientId"); 63 67 64 68 String conceptName = Context.getAdministrationService().getGlobalProperty("personportrait.person_portrait_concept"); … … 86 90 Context.getObsService().createObs(obsImage); 87 91 Integer id = obsImage.getObsId(); 88 //httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "ID="+id);92 httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, "ID="+id); 89 93 90 94 Obs obs = Context.getObsService().getObs(id); 91 //httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, ""+obs.getDateCreated());95 httpSession.setAttribute(WebConstants.OPENMRS_MSG_ATTR, ""+obs.getDateCreated()); 92 96 } 93 97 } … … 99 103 } 100 104 } 105 */ 101 106 } 102 107 }