Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Working OpenMRS installation with XForms Module installed

  • Install OpenMRS
  • Install the XForms Module
  • Configure xform module
    • Login to your OpenMRS installation and select "Administration" from the menu bar
    • Select Manage Global Properties from the Maintenance section.
      • Scroll down to xforms.showModelXmlTab and type "true" in place of the "false".
      • Locate xforms.showXformsSourceTab and type "true" in place of the "false".
      • Create a new property called xforms.xsltJR and paste the following XSLT stylesheet as it's value:
        Code Block
        <?xml version='1.0' encoding='UTF-8'?>
        <xsl:stylesheet version='2.0' xmlns:xsl='http://www.w3.org/1999/XSL/Transform' xmlns:fn='http://www.w3.org/2005/xpath-functions' xmlns:xf='http://www.w3.org/2002/xforms' >
        <xsl:output method='xml' version='1.0' encoding='UTF-8'/>
        <xsl:template match='/'>
        
        
        <html xmlns='http://www.w3.org/1999/xhtml' xmlns:xf='http://www.w3.org/2002/xforms' xmlns:xsd='http://www.w3.org/2001/XMLSchema' xmlns:xs='http://www.w3.org/2001/XMLSchema'
        xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xmlns:ev='http://www.w3.org/2001/xml-events' xmlns:jr='http://openrosa.org/javarosa'>
        <head>
        <title>
        <xsl:value-of select='/xf:xforms/xf:model/xf:instance/*/@name'/>
        </title>
        
        <xf:model>
        <xsl:copy-of select='/xf:xforms/xf:model/xf:instance' />
        
        <xsl:for-each select='/xf:xforms/xf:model/xf:bind'>
        
        <xsl:copy>
        <xsl:attribute name='id'>
        <xsl:value-of select='@id' />
        </xsl:attribute>
        
        <xsl:attribute name='nodeset'>
        <xsl:value-of select='@nodeset' />
        </xsl:attribute>
        
        <xsl:if test='string-length(normalize-space(@type)) > 0'>
        <xsl:attribute name='type'>
        <xsl:value-of select='@type' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@visible)) > 0'>
        <xsl:attribute name='visible'>
        <xsl:value-of select='@visible' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@readonly)) > 0'>
        <xsl:attribute name='readonly'>
        <xsl:value-of select='@readonly' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@required)) > 0'>
        <xsl:attribute name='required'>
        <xsl:value-of select='@required' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@locked)) > 0'>
        <xsl:attribute name='readonly'>
        <xsl:value-of select='@locked' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@calculate)) > 0'>
        <xsl:attribute name='calculate'>
        <xsl:value-of select='@calculate' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@relevant)) > 0'>
        <xsl:attribute name='relevant'>
        <xsl:value-of select='@relevant' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@constraint)) > 0'>
        <xsl:attribute name='constraint'>
        <xsl:value-of select='@constraint' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test='string-length(normalize-space(@message)) > 0'>
        <xsl:attribute name='jr:ConstraintMSG'>
        <xsl:value-of select='@message' />
        </xsl:attribute>
        </xsl:if>
        
        <xsl:if test="@id='patient.patient_id'">
        <xsl:attribute name="jr:preload">
        <xsl:text>context</xsl:text>
        </xsl:attribute>
        
        <xsl:attribute name="jr:preloadParams">
        <xsl:text>preloaded-patient-id</xsl:text>
        </xsl:attribute>
        </xsl:if>
        
        </xsl:copy>
        
        </xsl:for-each>
        </xf:model>
        </head>
        <body>
        <xsl:for-each select='/xf:xforms/*'>
        <xsl:if test='local-name() \!= "model"'>
        <xsl:copy-of select='.' />
        </xsl:if>
        </xsl:for-each>
        </body>
        </html>
        
        </xsl:template>
        </xsl:stylesheet>
        
        If copying and pasting doesn't work try copying and pasting from this text file from the cell-life dev server.  projects:xforms.xsltJR.txt

Use Cases

...

  • Failure to enter a valid base URL (for example omitting the port number), or if the server is unreachable causes  an "Unhandled exception. Close application?" error, if the user has not logged in previously.
  • The login is insecure.  The username and password are passed through a URL post to OpenMRS. On some phones, it shows the URL including the password in plain text when the user verifies that they want to connect to the server.  The username and password are also included in the PostURL in the program settings for anyone to see.
  • An "Exit" option should be added to each major section of the program, or some means of navigating to the main screen so you can exit properly.
  • If a bad password is entered, it stores it in the PostURL setting, and you are unable to send forms.
  • MAJOR: Was unable to send forms because the patient_id didn't exist in OpenMRS.  The form should accept the patient identifier, not the internal OpenMRS patient_id.  If the patient_id doesn't exist, it should be sent to a default patient, and/or the user should be notified there is a problem with the ID.

xForms Bugs (XForms 3.8.8)

  • Security flaw: it shows the forms without a valid username and password.
  • Forms appear in OpenMRS-jr when downloaded even if they are not marked as published in OpenMRS. - I originally had this as an OpenMRS-jr error, but I believe the xForms module should handle this.  First it should check on the user privileges and if the user doesn't have the "View Unpublished Forms" privilege, it should not include the unpublished forms in the form list.  It should never include forms that are retired in the xformslist when downloaded to mobile devices.

xForms 3.9.3 and later

...

9.3 and later

  • When attempting to access http://192.168.4.14:8080/openmrs/module/xforms/patientDownload.form?downloadCohorts=true&serializerKey=xforms.cohortSerializer&uname=admin&pw=test it gives an error "Privileges required: [projects:View Patient Cohorts]".  This makes it incompatible with the current version of OpenMRS-jr.  This is a change for the better in the long-run, as the username and password in the URL was a security flaw in 3.8.8.
  • Forms appear in OpenMRS-jr when downloaded even if they are not marked as published in OpenMRS. - I originally had this as an OpenMRS-jr error, but I believe the xForms module should handle this.  First it should check on the user privileges and if the user doesn't have the "View Unpublished Forms" privilege, it should not include the unpublished forms in the form list.  It should never include forms that are retired in the xformslist when downloaded to mobile devices.