Skip to content

JClic startup parameters

Francesc Busquets edited this page Nov 11, 2015 · 1 revision

JClic Player and JClic Applet can be started with specific parameters that allow to control several variables and settings.

Table of Contents

Parameters recognized by JClic

The parameters currently recognized by JClic are:

activityPack Absolute or relative file path or URL of the project that must be loaded when JClic starts. In JClicPlayer this is the default parameter.
sequence Works only in applets, to indicate the sequence label that will be used as a start point into the JClic project.
language Two-letter code (639-2) of the language to be used by JClic in system messages and menus. Ex.: "pt" to indicate Portuguese.
country Optional code specifying a local variant of the language. Ex.: "BR" to indicate Brazilian Portuguese.
variant Another optional variable that can be used in conjunction with the preceding two.
skin JClic skin that will be used at start. Ex.: "@orange.xml"
cookie Optional session cookie value. Currently not used.
reporter Name of the reports engine class. Ex.: "TCPReporter"
reporterParams Parameters passed to the reports engine. This parameter can have multiple key-value pairs inside, separated by semi-colons. The parameters currently used are:
user User id
key A special key that will be saved in the database. This is used for example in the Moodle module of JClic to store the current Moodle session value.
context Another special key that will be saved in the database. It can indicate, for example, the type of course where the activities are being done.
groupCodeFilter xxx
userCodeFilter xxx
path In TCPReporter only, complete path to the reports server. Ex.: localhost:9000/reports
protocol In TCPReporter only, protocol to be used to communicate with the reports server. Possible values are "http" and "https" (since JClic 0.2.2.0)
lap
exitUrl Parameter used in applets to specify the URL where the browser should navigate to when JClic finds the exit command.
infoUrlFrame Optional parameter that indicates the name of the frame where the info documents will be displayed. Default is "_blank"
systemSounds This indicates if JClic must play or not system sounds. Possible values are "true" and "false".
compressImages This parameter decides if JClic will compress images in order to make it fit into the cells. Default is "true".
lookAndFeel

Passing parameters to JClic Player

In JClic Player, settings must be appended to the command line, in the form -key=value. Multiple parameters can be written in the same line separated by spaces. Some special parameter values can have sub-parameters. This sub-parameters are separated by semi-colons (";").

JClic player command line example

This is an example of a command line invoking JClic and passing some parameters to it: <pre>java -jar jclicplayer.jar myproject.jclic.zip -language=en -reporter=TCPReporter -reporterParams=path=myServer:9000/reports;user=johnsmith -systemSounds=false'''</pre>

This is the explanation of each fragment of this command line:

java -jar jclicplayer.jar This command, if written from the directory where JClic is installed, starts the program.
myproject.jclic.zip This is the project file that will be automatically loaded when JClic starts. It is the default parameter, so no key is needed.
-language=en JClic will use the English language in system messages and menus.
-reporter=TCPReporter The class edu.xtec.jclic.report.TCPReporter will be used as a reporting engine
-reporterParams=path=myServer:9000/reports;user=johnsmith Two parameters will be passed to the reports engine: the path to the server and the user identifier.
-systemSounds=false JClic will not emit event and other system sounds.

Passing parameters to JClic Applet

Applets can receive parameters in two ways:

Using the <applet> tag

Parameters are passed with tags of type <param key="value"> placed into the <applet> tag. In this example, generated by the JClicMoodle module, the applet will be 600 x 400 pixels, it will wear the "green" skin, an activity pack from the clicZone library will be automatically loaded, and results will ber reported every 5 seconds to a special moodle path in "myserver.com", with the user ID "10":

<pre> <applet code="JClicApplet" codebase="http://clic.xtec.net/dist/jclic" archive="jclic.jar" width="600" height="400"> <param name="type" value="application/x-java-applet;version=1.4"> <param name="scriptable" value="false"> <param name="activityPack" value="http://clic.xtec.net/projects/bombers/jclic/bombers.jclic.zip"> <param name="skin" value="@green.xml"> <param name="reporter" value="TCPReporter"> <param name="reporterparams" value="path=myserver.com;service=/moodle18/mod/jclic/action/beans.php;user=10;key=1;lap=5"> </applet> </pre>

Using the jclicplugin.js file

The JavaScript file jclicplugin.js simplifies the scripting of JClic applets. Its functions have name similar to the parameters, preceded by "set" (Ex.: setSkin(value)). See the script for the list of all implemented functions.

JavaScript example

This example embeds a JClic applet of 750 x 464 pixels in a web page, with the orange skin and settings for a reports system:

<pre> <html> <head> ... <script language="JavaScript" src="http://clic.xtec.net/dist/jclic/jclicplugin.js" type="text/javascript"></script> ... </head> <body> ... <script language="JavaScript" type="text/javascript"> setLanguage('en'); setExitUrl('http://www.yahoo.com'); setSkin('@orange.xml'); setReporter('TCPReporter','path=myserver.com:9000/reports;user=johnsmith;key=ABC567'); writePlugin('project=http://clic.xtec.net/projects/llums/jclic/llums.jclic.zip', '750', '464', '100%', '100%'); </script> ... </html> </pre>

Clone this wiki locally