Documentation page

19 Jul 2010

Remember that this installation procedure is only intended for system administrators with particular needs, or in case the automatic installation has failed.

Follow these instructions:

  1. Unzip wiris-quizzes-x.x.x.xx.zip in the root directory of Moodle. The folder wiris-quizzes will be created.
  2. Copy the following folders:
    • From wiris-quizzes/questiontypes to question/type. There are 6 folders which contain the new question types used by WIRIS Quizzes, which will be added to Moodle’s question types.
  3. Edit the following Moodle files:
    1. lib/questionlib.php
      1. Make a copy of this file; copy lib/questionlib.php to lib/questionlib.php.old . The name of the backup file is important because it could be used in case of update or uninstallation.
      2. Open lib/questionlib.php with a plain text editor.
      3. Search for the following string in the text:
        						if ($menuname) {
        
      4. Add, immediately after this line, the following three lines:

        						/**** start WIRIS plugin ****/
        if (array_key_exists($name . "wiris", $QTYPES)) continue;
        /**** end WIRIS Plugin ****/
        
        
      5. Hence, this fragment of file will look like this:

        						foreach ($QTYPES as $name => $qtype) {
            $menuname = $qtype->menu_name();
            if ($menuname) {
                /**** start WIRIS plugin ****/
                if (array_key_exists($name . 'wiris', $QTYPES)) continue;
                /**** end WIRIS Plugin ****/
                $menu_options[$name] = $menuname;
            }
        }
        
    2. question/question.php
      1. Just as before, make a copy of this file and call it question/question.php.old .
      2. Open question/question.php with a plain text editor.
      3. Search for the following line in the text:
        						// Validate the question category.
        
      4. Add, immediately before this line, the following four lines:
        						/**** begin WIRIS Plugin ****/
        if (array_key_exists($question->qtype . 'wiris', $QTYPES))
        $question->qtype = $question->qtype . 'wiris';
        /**** end WIRIS Plugin ****/
        
      5. Hence, this fragment of file will look like this:
        						print_error('notenoughdatatoeditaquestion', 'question', $returnurl);
        }
        
        /**** begin WIRIS Plugin ****/
        if (array_key_exists($question->qtype . 'wiris', $QTYPES))
        $question->qtype = $question->qtype . 'wiris';
        /**** end WIRIS Plugin ****/
        
        // Validate the question category.
        if (!$category = get_record('question_categories', 'id', $question->category)) {
        
  4. Configure Quizzes by editing its configuration file:
    1. Find the configuration file of Quizzes: wiris-quizzes/wrsqz_config.php .
    2. Make a copy of this file, and call it wiris-quizzes/wrsqz_config.php.old .
    3. Open wiris-quizzes/wrsqz_config.php with a plain text editor. It will have the following content:
      				<?php
      global $CFG;
      
      $CFG->wirisquizzes_serverhost='services.wiris.com';
      $CFG->wirisquizzes_serverport='80';
      $CFG->wirisquizzes_serverpath='/quizzes/qwirisservlet';
      
      $CFG->wirisquizzes_imagedir = 'wiris-quizzes/imagecache';
      
      //Plot images style options.
      $CFG->wirisquizzes_plotborderstyle = 'solid';
      $CFG->wirisquizzes_plotborderwidth = '1px';
      $CFG->wirisquizzes_plotbordercolor = '#8888ff';
      $CFG->wirisquizzes_plotmargin = '5px';
      ?>
      
    4. Each line with the form:
      				$CFG->wirisquizzes_xxx = yyy;

      is the definition of a configuration parameter of Quizzes. In most cases, and especially in test or demo installations, you will not have to change any of these parameters. In a production environment, however, it is very likely that you will have to modify the first three parameters, related to the WIRIS Quizzes remote server (see Which WIRIS Quizzes service server must be selected?). Next we explain the meaning of each parameter.

      Parameter Description
      $CFG->wirisquizzes_serverhost The address of the remote web server where it has been installed the WIRIS Quizzes service. By default, 'services.wiris.com'
      $CFG->wirisquizzes_serverport The port where the WIRIS Quizzes is found in the above server. By default, '80'.
      $CFG->wirisquizzes_serverpath The route, relative to the server address, in which the WIRIS Quizes server can be found. For instance, if the service is at http://services.wiris.com/quizzes/qwirisservlet, this property should be '/quizzes/qwirisservlet'. Usually this parameter will not have to modified.
      $CFG->wirisquizzes_imagedir The folder, relative to the Moodle data folder (usually moodledata), where images generated by Quizzes are stored. Don’t get this mixed with the folder where the WIRIS Plugin stores formulae images, although they can be the same. By default, 'wiris-quizzes/imagecache'.
      $CFG->wirisquizzes_plotborderstyle The style of the border used for the images of graphics generated by Quizzes. The syntax is that of CSS stylesheets. By default, 'solid'.
      $CFG->wirisquizzes_plotborderwidth The width of the border used for the images of graphics generated by Quizzes. The syntax is that of CSS stylesheets. By default, '1px'.
      $CFG->wirisquizzes_plotbordercolor The color of the border used for the images of graphics generated by Quizzes. The syntax is that of CSS stylesheets. By default, '#8888ff'.
      $CFG->wirisquizzes_plotmargin The margin used for the images of graphics generated by Quizzes. The syntax is that of CSS stylesheets. For example, '5px'.
      $CFG->wirisquizzes_maxconnections Number of maximum simultaneous connections to WIRIS quizzes services.

       
  5. Create the tables needed for Quizzes in Moodle’s database. Except in very unusual cases, this process can be done automatically. Just open your browser and write this address in the navigation bar: http://<your_moodle>/wiris-quizzes/installdb.php . In case an error happens, you can find the database specification in Moodle XMLDB format at wiris-quizzes/install/db/install.xml. Vea Which tables does WIRIS Quizzes create in Moodle’s database? y How to create manually the tables WIRIS Quizzes needs? in case you need it.
15 Jul 2010

Moodle Quiz Module allows you to define questionnaire-like activities in a course. A questionnaire consists of a set of questions, probably of different types. Read the information on moodle.org about this module if you are not familiar with it. From now on, Moodle basic terminology on questionnaires will be adopted.

WIRIS quizzes improves the types of questions in Moodle in order to add additional options aimed at posing strong maths questions. These options are displayed by clicking Show Advanced.

This manual offers a gradual and detailed view of WIRIS quizzes. It can be read linearly, or individual articles can be checked through the menu or through the following list:

9 Apr 2010

WIRIS Editor works with MathML but under some circumstances it modifies slightly the XML encoding.

This is done when the application that uses WIRIS editor does not allow inserting XML. For example, Moodle filters some HTML tags (APPLET, OBJECT, EMBED, etc.) and all unrecognized XML tags, and so it removes any MathML formula. This also occurs when the MathML appears inside an HTML attribute (for example, the SRC attribute of an IMG tag) and the browser, wrongly, tries to parse it.

In these situations, the 5 reserved characters of XML are replaced by other characters as shown in the following table:

Original XML characterReplacing character
< (#3C)« (#AB)
> (#3E)» (#BB)
& (#26)§ (#A7)
" (#22)¨ (#A8)
' (#27)´ (#B4)

For example,

Original XML fragmentReplaced XML fragment
<math xmlns="…">
  <msqrt>
     <mn>&pi;</mn>
  </msqrt>
</math>
«math xmlns=¨…¨»
  «msqrt»
    «mn»§pi; «/mn»
  «/msqrt»
«/math»

Then, recovering the MathML from the modified version is as simple as undoing the replacement. We provide as attached file an XSLT that does this replacement.

6 Apr 2010

Mathematical operations can be nested, and so symbols can contain expressions with symbols. Many symbols expand to match the size of their contents; note, for instance, the variable size of the square root symbol and the conjugation bar:

symbol matching

Normally we will also want our parentheses to scale depending on their contents, but this will not happen if we type them with the keyboard, since this will result in “normal” characters that do not scale, just as an “a” does not scale. If we want to use parentheses that do scale, we will have to use the , , and  icons in the General tab. By the way, this ensures that all couples of parenthesis are well closed and nested.

Let us see one example, by writing

«math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«msup»«mfenced»«mrow»«mn»1«/mn»«mo»+«/mo»«mfrac»«mi»x«/mi»«mn»2«/mn»«/mfrac»«/mrow»«/mfenced»«mn»3«/mn»«/msup»«/math»

Write the base of the power
Select it
Click on the  icon
Select all of the parenthesis
Click on the  icon in the General tab
Click on the exponent and type 3
If instead of using the  icon we had used the ( and ) keys, the result would have been this:

If your formulae look a little bit odd, remember that, when several symbols are nested, there can be subtle differences depending on the exact order of nesting. For instance, consider «math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«msub»«mover accent=¨true¨»«mi»x«/mi»«mo»§#8594;«/mo»«/mover»«mn»0«/mn»«/msub»«/math» and «math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mover accent=¨true¨»«msub»«mi»x«/mi»«mn»0«/mn»«/msub»«mo»§#8594;«/mo»«/mover»«/math»; the first is «math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«mover accent=¨true¨»«mi»x«/mi»«mo»§#8594;«/mo»«/mover»«/math» “initialized”, while the second is «math xmlns=¨http://www.w3.org/1998/Math/MathML¨»«msub»«mi»x«/mi»«mn»0«/mn»«/msub»«/math» “vectorized”, so that the vector arrow extends over 0 only in the second case.

15 Mar 2010

It is possible to check whether the WIRIS cas server is running via a command line.

Type the following in the folder where the WIRIS cas is installed:

cd server
java Server --test-active

The return status of the above command will be 0 upon success and 1 when the server is not running or an error occurs.

You will get something like

[FINE:] Is Active check
[FINE:] host=localhost
[FINE:] port=31416
[FINE:] Opening socket...
[FINE:] Socket opened successfully.
[FINE:] Sending 'accept connections'...
[FINE:] Sent successfully.
[FINE:] Receiving...
[FINE:] Result received successfully.
[FINE:] Test performed successfully.