Title: MPages Development Conference
1MPages Development Conference
- Code Includes / Libraries
- March 30, 2009 230 PM 300 PM
2Introduction
- Joshua Faulkenberry
- Lucile Packard Childrens Hospital at Stanford
- David Stone
- University of Washington
3Client-Side
- Code Includes / Libraries
4Client-side Libraries/Frameworks
- JavaScript Library
- A collection of pre-written JavaScript controls
which allow for easier development of
JavaScript-based applications, especially for
AJAX and other web-centric technologies - Some popular JavaScript Libraries
- Dojo, Ext, Google Web Toolkit, jQuery, MooTools,
Prototype, and YUI
5Client-side Libraries/Frameworks
- Prototype
- Prototype is a JavaScript library for Class
driven development, providing various functions
for developing web applications. - Extends the DOM and core JavaScript objects
- Provides a comprehensive library of base classes
6Client-side Libraries/Frameworks
- jQuery
- jQuery is a JavaScript library which follows
unobtrusive paradigm for application development
using JavaScript. jQuery is based on traversing
HTML documents using CSS Selectors. - Centered around chaining and binding methods to
objects and elements - Totally encapsulated
- Tons of plugins
- Our Recommendation for Most MPages Projects!!!
7JavaScript Libraries for MPages
- XMLCclRequest
- Facilitates asynchronous communication between
an MPage and the Cerner Backend - Modeled after JavaScripts XMLHttpRequest object
- Conforms to the W3Cs specification for
XMLHttpRequest (where possible) -
8mPages JavaScript Framework
- What is the mPages JavaScript Framework?
- mpages.js
- A JavaScript library (script) that provides a
standard toolkit to simplify and streamline MPage
development - Easy to use wrapper methods for APPLINK, CCLLINK
and other pre-defines MPage functions - Wrapper methods to simplify use of XMLCclRequest
object - Run-time JSON debugging
- A single namespace upon which to build all
JavaScript functionality within MPages
9mPages JavaScript Framework
- XMLCclRequest Wrapper Methods
- mPages.get()
- Returns response data as a text string
- mPages.getJSON()
- Returns response data as a JSON Object
- mPages.post()
- Posts data to a CCL script, Returns response data
as a text string
mPages.get(MY_CCL_SCRIPT, function(resulTxt)
alert(resultTxt) )
mPages.getJSON(MY_CCL_SCRIPT,
function(resultObj) alert(resultObj.myVal)
)
mPages.post(MY_CCL_SCRIPT, my, post,
string, function(resultObj)
alert(resultObj.myVal) )
10mPages JavaScript Framework
- Debugging JSON
- Add the seeJSON parameter and set it to TRUE
- Once the Response has been received, it is
formatted and prettified and output to the screen - The formatted JSONs structure can then be
verified by eye or copied and pasted into a JSON
validator
Var myCallback function(resultObj)
alert(resultObj.myVal) mPages.getJSON(MY_CCL_
SCRIPT, myCallback, seeJSON true )
11mPages JavaScript Framework
- Predefine Function Wrappers
- mPages.link()
- APPLINK replacement to simplify linking to
external URLs - mPages.aLink()
- Wrapper for the CCLLINK function to simplify
linking to HTML files store in the Cerner Backend - mPages.cLink()
- Wrapper for the CCLLINK function to simplify
linking to other CCL reports
mPages.link(http//www.lpch.org)
mPages.aLink( "\\\\cernerasp\\...\\my_page.html
" )
mPages(level"org").cLink( 'MY_CCL_REPORT',
'"some data", "more data" )
12Server-Side
- Code Includes / Libraries
13MPages Common Runtime
- What is MPages Common Runtime?
- mpages_common_runtime.prg
- It is a CCL function library (script) that
exposes functionality common to MPages
development? - HTML Output Buffer
- Run-time debugging and buffering
- Run-time error checking and buffering
- Run-time library
- Meaning its functionality is loaded at
run-time, versus a compile side include - Updates take affect immediately, without
extensive re-compiles.
14MPages Common Runtime
- Why should you use this Library?
- HTML Output Buffer
- Allows you to write HTML markup to a common
output buffer that can easily be output when it
is time to render. - Cleaner looking code that is easy to read.
- Based upon the response.write() architecture in
ASP. - Allows for code is multiple scripts written by
different programmers output to the same web
page. - Supports component based development.
- Debugging and Error Checking
- Allows for runtime debugging and support
- Allows for more graceful handling of runtime
errors - Debugging text and error messages go to common
buffer allowing multiple components that are part
of one page to output common debugging
information. Buffer can be output to file. - Very efficient, low overhead design (100,000
debugging checks per second) - Debugging levels can be turned up, down or off
(to limit impact) - Also supports script debugging using parser
- Detailed performance debugging (to the 10,000th
of a second)
15CCL Run-time Library Architecture
- Exposes functions for use
- Code is loaded at run-time
- Code is stored as a compiled script versus a
textual include - Encapsulated code will not impact other
functionality
16HTML Output Buffer
CCL Script
- WriteHTML(text)
- - Adds text as line in buffer
- PrintHTML(option)
- - Outputs buffer to report writer
- ClearHTML(option)
- - Clears output buffer
Execute mpages_common_runtime loads
library Call WriteHTML(lthtmlgt) Call
WriteHTML(ltbodygt) Call WriteHTML(Build2(Allergy
List ltbgt, strAllergies, lt/bgt)) Call
WriteHTML(lt/bodygt) Call WriteHTML(lt/htmlgt) Se
lect into OUTDEV From dummyt Detail call
PrintHTML(0) With formatvariable, maxcol50000
Output File
lthtmlgt ltbodygt Allergy list ltbgtAmoxicillin,
Tylenol, Peanutslt/bgt lt/bodygt lt/htmlgt
17Run-Time Debugging and Error Checking
CCL Script
- SetDebugLevel(level)
- - Sets debug level
- WriteDebug(text, level)
- - Writes text to debug log if level is gt
- ErrorCheck(code)
- - Checks for runtime errors and outputs to
debug/error buffer. Returns error code. - ErrorCheck2(text)
- - Checks for runtime errors and outputs to
debug/error buffer. Writes text to buffers if
error. - WriteParserDebug(CCL String)
- - Writes CCL query line to parser as well as
debug. Allows for script debugging. - PrintDebug(options)
- - Outputs debug buffer
- PrintError(options)
- - Outputs error buffer only
- Others
Execute mpages_common_runtime loads
library Call WriteDebug(Starting Query) Call
WriteParserDebug(Select into NL) Call
WriteParserDebug(From Dummt) Call Parser( go
, 1) Call ErrorCheck2(Error Occurred in
Query) Select into OUTDEV From
dummyt Detail call PrintDebug(1) With
formatvariable, maxcol50000
Output File
- 1/1/2009 112423111.01 Starting Query
- 1/1/2009 112423121.01 Select into NL
- 1/1/2009 112423121.01 From Dummt
- 1/1/2009 112423311.01 Error occurred on
line 3 (code 24, could not find table (dummt)... - 1/1/2009 112424411.01 Error Occurred in Query