Script Events and Contexts


Back to Server Settings...

Since version 2.5 todo4teams can be configured and extended at various points through scripts. For example e-mail inboxes, text boxes, forms and groups can be extended with scripts. These scripts are written in JavaScript and can in principle get access to all Java objects used in todo4teams.  todo4teams uses the current script engine, which is delivered with current Java versions. When creating new scripts, the first line of a script should be the following:

//disable_rhino_compatibility

This will run the scripts without backward compatibility and help to identify error messages.

Events and Contexts

todostates_en.png
 Todo4teams executes scripts at specified events. For example the first event in the life-cycle of a todo-job, where a script can be executed, is submitting the job after it is created.

The scripts run in either in the todo-client ie "in the workplace of the user" or on the server. The above mentioned script, whre you submit the job, is for example executed in the todo-client.

Depending on whether a script is running on the client or on the server there are partially different actions. Thus e.g. the script-related sending of e-mails can only be triggered in server scripts.

Scripts are attached either to groups or to forms. The figure shows the possibility that scripts can be connected to events including their context. The red arrows show the flow from the creation of a job through its takeover up to the finishing.  

When submitting a new job the "Send Action" scripts of all selected forms are first executed. Here you can, for example, check that the form input is complete and the user will be asked for a supplement or correction. The next executed script is the "Send Action" connecting to the group of addressees. Here could, for example, be determined that a particular form must be activated and filled out, when addressing jobs to this group.

Once the user has pressed the "Send Button" and all the scripts mentioned above were carried out in the client context, the job is sent to the server and stored. There will run now the "Start Action" script addressing the group.

Incidentally, all the script actions are of course optional. If no scripts for the actions were saved, nothing happens and the job goes through its life cycle as usual.

The next script action now takes place in the execution of the job and is bound to the forms: Here again the contents of the form can be checked.

After the click of the editor on the "Finishing" button and the execution of this script the finishing of the job is stored on the server. There the "End Action" scripts of the activated forms and the addressed group are executed.

 Go to Introduction to Javascript...

     

Child Pages