OpenLaszlo

From FreemedDeveloperWiki, the FreeMED developers' Wiki.

Jump to: navigation, search

Contents

Proof of Concept

The Proof of Concept here is a patient selection widget test, which would allow the user to enter search criteria for a patient and have the 50 "best" results displayed in a table. Note that no complex table handling or other advanced features are implemented in this POC.

Development Hacks

  • Create a file called crossdomain.xml with these 3 lines:
<cross-domain-policy>
<allow-access-from domain="*" secure="false" />
</cross-domain-policy>

Laszlo Source

<canvas proxied="false" bgcolor="#aaaacc" width="500">
 <dataset name="patientData" src="http://localhost/freemed/test_laszlo.php" request="true" type="http"/>
 <view>
  <simplelayout axis="y" spacing="10"/>
  <view>
   <simplelayout axis="x" spacing="10"/>
   <statictext>Patient</statictext>
   <inputtext id="patientSearchText" bgcolor="#dddddd" width="200">test</inputtext>
   <button width="160">Search
     <method event="onclick">
      var data = canvas.datasets.patientData;
      var passedData = new LzParam();
      passedData.addValue("s", patientSearchText.getText(), true);
      data.setQueryString(passedData);
      data.doRequest();
     </method>
   </button>
  </view> 
  <grid datapath="patientData:/*" sizetoheader="false" width="500">
   <gridtext editable="false" width="50" datapath="position()" resizable="false" sortable="false">No.</gridtext>
   <gridtext datapath="@firstname">First</gridtext>
   <gridtext datapath="@lastname">Last</gridtext>
   <gridtext datapath="@patientid">ID</gridtext>
  </grid>
 </view>
</canvas>

PHP Source

This file would be placed in http://localhost/freemed/test_laszlo.php under a working FreeMED installation.

<?php Header('Content-type: text/xml'); ?>
<resultset>
<?php

if (strlen($_GET['s']) < 3) {
        // No results for "null" or too short search string.
} else {
        include "lib/freemed.php";
        $q = "SELECT ptlname, ptfname, ptdob, ptid, id FROM patient WHERE (".
                " ptlname LIKE '".addslashes($_GET['s'])."%' OR ".
                " ptfname LIKE '".addslashes($_GET['s'])."%' OR ".
                " ptid LIKE '".addslashes($_GET['s'])."%' ".
                " ) AND ptarchive=0 ORDER BY ptlname, ptfname LIMIT 50";
        $res = $GLOBALS['sql']->query($q);
        while ($r = $GLOBALS['sql']->fetch_array($res)) {
                print "<patient id=\"${r['id']}\" firstname=\"${r['ptfname']}\" ".
                         "lastname=\"${r['ptlname']}\" patientid=\"${r['ptid']}\" />\n";
        }
}

?>
</resultset>
Personal tools
Navigation