Recent Changes - Search:

Information

Installation

Documentation

UsingEJSWithMoodle

Since version 4.37 (build 121201 or later), EJS introduces new features for embedding its applets into a Moodle course. Since version 5.0, you can also add EJS javascript simulations to Moodle. This page will show you how to benefit from these new capabilities. To see an example of what can you do by combining Moodle and EJS visit http://unilabs.dia.uned.es

What's this all about?

Moodle is a learning management system that lets educators create online courses with a focus on interaction and collaborative construction of content. EJS simulations can now be added to Moodle courses, as activities, in a really easy way. This new feature couples the advantages of the EJS simulations with the course management facilities of Moodle.

Video Tutorials

What is EJSApp? https://youtu.be/RsRS_ERQs0c

EJSApp: Core Plugins https://youtu.be/Oql5h_ravGE

EJSApp: Collaborative Sessions https://youtu.be/DOOoq2rUJYE

Remote Labs and the EJSApp Booking System https://youtu.be/YGlTTMmkaC0

UNEDLabs: A Network of Virtual and Remote Laboratories https://youtu.be/QC6-bmW1Y4c

Open Source Physics Plugin: Access to the ComPADRE digital library directly from Moodle https://youtu.be/6rUgWDkoZKM

Export your simulation from EJS

In EJS, you only need to export the simulation as a JAR file (if you are working in the Java mode) or as a html + js file (if you are working in the Javascript mode). For this:

  • Create or open an existing simulation with EJS. Use the latest available EJS release (or, at least, a release later than EJS_4.3.7_121201),
  • Deploy the simulation using the Package current simulation option.

Use the required Moodle plugin

In Moodle, you will need to install a plugin in order to make things work. Follow these steps:

  • Download the EJSApp (EJS Application) plugin either from Moodle.org or from Github. In the first direction (Moodle webpage), you will always find the latest stable version available while in the second one (Github) you will find the latest version in development. You can find more information about how to install this plugin here.
  • Install it as any other Moodle module plugin. This means you just have to unzip the ejsapp folder into your /mod folder of your Moodle installation. Then, go to your Moodle site, log in as administrator, go to Notifications if needed, and accept the installation messages Moodle will prompt you. You can find a detailed tutorial about how to install Moodle plugins here.
  • You can now use the plugin for adding the EJS applet or javascript created in the previous section to any of your Moodle courses. For that, enter the course in which you want to add the EJS application, turn editing mode on and select EJSApp from the options available at the Add an activity pull-down menu. This is the procedure for Moodle 2.0, 2.1 and 2.2.
  • In case you are using Moodle 2.3 or higher, the procedure is exactly the same but the option is called Add an activity or resource and it does not display a pull-down menu but a new pop-up menu. Select EJSApp from there.

Important! For Unix Moodle servers (e.g., Linux and Mac systems), EJSApp requires that (i) the apache user is the owner of the "jarfiles" dir inside the "ejsapp" dir, and (ii) it has permissions to read, write and execute the jarfiles dir.

Advanced features

Saving/loading files from EJS into Moodle

An EJS applet added to a Moodle course using the ejsapp plugin, will be automatically able to save files (either plain text, images or simulations state files in .xml format) to a private files repository block of Moodle.

However, you will need to download and install the EJSApp File Browser (download from Moodle, download from Github) Moodle plugin. Note this is a block plugin (not a module) and so, it should be placed inside the /blocks folder of Moodle. Again, you can obtain more information about installing Moodle plugins here. This block can be added to your Moodle site as any other block in Moodle. More information about blocks can be found here.

There are four ways you can send data from an EJS application to the EJSApp File Browser block:

  • Use the EJS native method _saveText() to save a text file.
  • Use the EJS native method _saveImage() to save an image file.
  • Use the EJS native method _saveState() to save the complete list of variables that define the current state of the simulation into an .xml file.
  • Use the EJS native method _saveVariables() to save only some selected variables of the current state of the simulation (also into an .xml file).

And there are three ways you can read data (text or .xml files previously stored in the EJSApp File Browser block) with an EJS application:

  • Use the EJS native method _readText() to get the content stored in a plain text file.
  • Use the EJS native method _readState() to read the complete list of variables of the simulation from an .xml file.
  • Use the EJS native method _readVariables(null,List<String> vars) to read a selected list of variables of the simulation from an .xml file.

EJS and Moodle will take care of the rest!

ATTENTION: In some operating systems, applets are required to be signed in order to allow them to save files.

Finally, when you save an .xml simulation state file, the EJSApp File Browser will identify and mark it in a different way (with the icon). If you click in it, Moodle will redirect you to the appropiate ejsapp activity instance, load the EJS applet, read the .xml file and load the simulation state previously saved. Next figure shows an example of the EJSApp File Browser block listing some files saved by means of the EJS applets added to the site.

Users fo an EJS applet in Moodle can also load simulation states directly from the application rather than clicking on them in the EJSApp File Browser block. This is done by right-clicking over the simulation and selecting the option State input/output and then Read state in the menu. This actually calls the EJS native method _readState().

After that, a new menu will open, showing all the state files saved with that ejsapp activity. Select one, press the Accept button and the state will be loaded.

Collaborative sessions with EJS in Moodle

EJS applets added to a Moodle course using the ejsapp plugin, can support synchronous collaborative work. To obtain this feature you just need two things:

1) Go to the Information menu of EJS, select the Run options tab and mark the Add support for collaborative applets before packaging your EJS simulation ar a JAR file.

2) Download and install the EJSApp Collab Session (download from Moodle, download from Github) Moodle plugin. Note this is a block plugin (not a module) and so, it should be placed inside the /blocks folder of Moodle. Again, you can obtain more information about installing Moodle plugins here. This block can be added to your Moodle site as any other block in Moodle. More information about blocks can be found here.

Once you add the EJSApp Collab Session block to a course in which you have at least one EJSApp activity with a JAR compiled with collaborative support, the Moodle block will be visible and you will be able to use it for creating collaborative working sessions.

Booking system for remote laboratories

To add an EJS booking system instance follow the same steps described for adding an EJSApp activity but look for the EJSApp Booking System in the resource menu instead of the activity menu. In order to benefit from this tool, you need to download and install the EJSApp Booking System (download from Moodle, download from Github) Moodle plugin. Next figure shows an example of an EJSApp booking system instance in a Moodle course.

Users that access this resource can use the application to make bookings in any remote laboratory added as EJSApp activities instances in the Moodle courses they are enrolled to.

ComPADRE-OSP digital library repository

The OSP plugin for Moodle lets you download any EJS application stored in the OSP-Compadre library (either if they are based on Java or Javascript) directly from your Moodle. When used in combination with the EJSApp plugin, you will be able not only to access, search and download these applications but also to add them automatically to your Moodle courses as activities.

Edit - History - Print - Recent Changes - Search
Page last modified on February 25, 2018, at 11:54 PM