e2train Learning & Performance Technology
Support
Return

System Calls

It is possible to make calls to the Kallidus system from the action of buttons and from the script of hot-text set in text fields.

  1. For buttons the actions onClick, onClickOn, onClickOff, onKeyPress, onEnter and onLeave can trigger Javascript commands, which communicate directly with the Kallidus system. Also, for pages the actions onEnter and onLeave can trigger Javascript commands.

Lines that make system calls contain two items,

<event>, <command line>

You can include multiple commands, for example the line

onClick,alert('Now go to the diagnostics page');goPage(9)

would display a message and then go to the page with id 9.

2.   For hot-text a javascript switch has to be included in the URL string. For example, after right-clicking on a text field, choosing the Edit text option from the context menu, selecting the text which is to be made 'hot', and clicking the link button produces the following dialog

By choosing type (other) and starting the URL line with the switch javascript: you can introduce a Kallidus command.

In both situations a range of Kallidus system command is available:

goFirstPage() goes to the first page of the lesson (usually the title).

goNextPage() goes to the next page of the lesson (subject to conditions).

goForward(n) goes forward n pages (not subject to conditions).

goPreviousPage() goes to the previous page of the lesson (i.e. the last page visited).

goBack(n) goes back n pages (irrespective of how got here).

goHyperLink(ref, options) displays the hyperlink in a new browser window. The parameter ref takes the form of a full URL e.g. 'www.e2train.com'. The optional parameter options lists the options required on the popup window. Default value is the string 'fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=yes,width=800,height=600'

showHint(w, h) shows the HTML document specifed in the page properties in a new window with width and height given by the optional parameters w and h. (Default values 600x400)

showDocument(ref, w, h, options) shows the HTML document referenced by the parameter ref (relative to the sub-directory for the current lesson i.e. the one containing the .pag files) in a new window with width and height given by the optional parameters w and h (Default values 600x400). The optional parameter options lists the options required on the popup window. (Default value is the string 'fullscreen=no,scrollbars=yes,resizable=yes,status=no,toolbar=no')

show(id) shows the object on the current page with a given id.

hide(id) shows the object on the current page with a given id.

getText(id) gets the text of a text field, a comboBox or an editBox on the current page with a given id. The result of this function call can be used, for example, in a javascript if statement.

setText(id, text) sets the text of a text field on the current page with a given id. Note that formatting will persist if set by the properties dialog. (Note that the original text will be placed back in the object when returning to the page and when the page is refreshed).

setState(id, state) sets the state of an animation cel on the current page with a given id.

getAnswer(id) get the answer given in a question component with a given id on the current page. The result for an editBox is the text, for a comboBox it is the zero-based index in the option list, and for radioButtons and checkBoxes it is 0 for unchecked and 1 for checked. For other types of object an error is returned.

getAnswer(id, pageID) get the answer given in a question component with a given id on page pageID. The value returned for an editBox is the text, for a comboBox it is the zero-based index in the option list, and for radioButtons and checkBoxes it is 0 for unchecked and 1 for checked. For other types of object an error is returned.

setAnswer(id, answer) sets the answer given in a question component with a given id on the current page. The value of the parameter answer should be the text of an editBox, a zero-based index for a comboBox, and a 0 or 1 respectively for unchecked and checked radioButtons and checkBoxes. Other types of object will not be affected.

setAnswer(id, answer, pageID) sets the answer given in a question component with a given id on the page pageID. The value of the parameter answer should be the text of an editBox, a zero-based index for a comboBox, and a 0 or 1 respectively for unchecked and checked radioButtons and checkBoxes. Other types of object will not be affected. Note that the database values will not be updated until the page referred to is actually shown.

lockAnswer(id) 'locks' the answer given in the question group with a given id. Further attempts are not allowed.

getScore() gets the total score for the lesson.

getScore(pageID) gets the total score for the answers on page pageID.

getScore(pageID, id) gets the score for the answer with a given id on page pageID.

getMaxScore() gets the maximum score for the lesson.

getMaxScore(pageID) gets the maximum score for the answers on page pageID.

getMaxScore(pageID, id) gets the score for the answer with a given id on page pageID.

getX(id) gets the x-coordinate of the object with a given id. For question components this value is relative to the top-left corner of the question group.

getY(id) gets the y-coordinate of the object with a given id. For question components this value is relative to the top-left corner of the question group.

setXY(id, x, y) sets the position of the object with a given id. For question components these value are relative to the top-left corner of the question group.

getID(nm) gets the id of the first object found with name nm on the current page. If the current object is a question component, then the search starts with the other components of the question group.

playFlash(id) plays the Flash movie with a given id..

rewindFlash(id) rewindss the Flash movie with a given id..

stopFlash(id) stops the Flash movie with a given id..

getFlashParameter(i) gets the value of the ith Flash parameter. There are three parameters, named param1, param2 and param3.

setFlashParameter(i, value) sets the value of the ith Flash parameter.

playMovie(), stopMovie(), pauseMovie(), rewindMovie()  can be used for the given Flash, Real and WMP movies with a given id.

setAction(cmd,milliseconds) can be used to set timeouts for actions.    

exitLesson() exits the lesson.

The local variable thisObj contains the id of the current object. The variable thisQ contains the id of the question box (if any) that contains the current object.  The variable thisPg contains the pageID of the current page.

There are two additional system calls that are available in the Catalog window to handle the import of objects. These are importCatalogObject(id), which imports the object with given id onto the lesson page, and importCatalogResource(name), which imports the resource file with name ‘name’ into the lesson library. Note that resources must be imported before an object if the object depends on the existence of the resource for proper display.

There are three additional system calls that are available in the Catalog window to handle navigation. These are goMenu(), navigates to the menu page, and goPrevious(), which goes to the previous catalog page, and goNext(), which goes to the next catalog page. Note that the calls goFirstPage(), goPreviousPage() and goNextPage() relate to the lesson pages.