PDA

View Full Version : Lianja.showDocument( ) explained



barrymavin
2012-10-22, 01:15
The Lianja system object which is available to all supported scripting languages has some interesting functionality.

You can use this functionality to handle events in WebViewWidgets enabling them to interact with the contents of other sections and WebViewWidgets within an App. This provides custom actions for the Lianja ART architecture (http://www.lianja.com/resources/blog/39-coding-tips/145-lianja-is-all-about-art) which is based on Actions Rules and Transitions, enabling seamless interaction between all visual elements in the UI.

You can use Lianja.showDocument( ) like this in your code:



Lianja.showDocument( "command" )


The "command" should be specified as a character expression and can take any of the following forms:



//
// load an app
// -------------
//
// app:name
// app:name:page
// app:name:page:section[?args...]
//
// e.g.
//
Lianja.showDocument("app:lianjademo")
Lianja.showDocument("app:lianjademo:employees")
Lianja.showDocument("app:lianjademo:employees:section1?action=goto:4")

// select a page
// -------------
//
// page:name
// page:name:section[?args...]
//
// e.g.
//
Lianja.showDocument("page:employees")
Lianja.showDocument("page:employees:section1?action=goto:4")

// perform an action on a section
// ------------------------------
//
// section:name
// [?action=search&text=value]
// [?action=first]
// [?action=last]
// [?action=next]
// [?action=previous]
// [?action=add]
// [?action=delete]
// [?action=save]
// [?action=cancel]
// [?action=move:n]
// [?action=goto:n]
// [?action=refresh]
//
// e.g.
//
Lianja.showDocument("section1?action=search&text=Buchanan")

//
// execute custom code
// -------------------
//
// recital:command
// vfp:command
// python:command
// jscript:command
// php:command
//
// e.g.
//
Lianja.showDocument("vfp:do myform")

//
// execute using desktop association
// ---------------------------------
//
// http://www.google.com
// myspreadsheet.xlsx
// myspecialapp.exe
// lianja --app myapp --username myusername --password mypassword
// lianja mform.prg
//
// e.g.
//
Lianja.showDocument("http://www.google.com")
Lianja.showDocument("myspreadsheet.xlsx")


As you can see this can be used with great effect in both your Apps and as the "Tile URL" (specified in the App Settings) for dynamic tiles which are available in Beta10. This provides the ability to create a modern and secure UX for end-users where tiles in the App Center dashboard can invoke external content providers.

Its also worth pointing out that the "command" that can be given as the parameter to showDocument() can also be specified in WebView sections as the href="command" in HTML5 hyperlinks.