Monday, March 15, 2010

Custom Tag

We decided the best (easiest?) way to handle our problem is to create a custom tag and add it to the openmrs tag library. With a custom tag, you can have a parameter that the corresponding class can access. So for our tag, we pass in the observation and in the PreviewComplexObsTag class we take that observation and determine what needs to be returned. For ComplexObs that have image handlers, we return a link to the full size image and an icon that when moused over pops up a preview of the image. The popup is accomplished using the jQuery code I found earlier in the semester. If the Complex Ob has a text handler, it simply returns a link to the text document.

We are planning on generating a thumbnail version of a given image on the fly in this tag's class. Getting the image data from the obs and generating a thumbnail isn't actually that hard, but the issue we are having is how to save it to the file system and how to access it later. We figured out that the thumbnail should be able to be accessed using the obsId parameter and the view parameter when calling the get obs method in the servlet.

No comments:

Post a Comment