Skip to content
Snippets Groups Projects
Commit 396857e9 authored by Tim Hunt's avatar Tim Hunt
Browse files

Add a new configuration option for how maths is rendered.

Also:
* Clean up $ escaping in the language files. It is no longer needed.
* Compact the display of useful links on the settings page.
* Fix capitalisation of STACK in the language strings.
parent 668a359c
No related branches found
No related tags found
No related merge requests found
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/** /**
* Language strings for the Stack question type. * Language strings for the STACK question type.
* *
* @package qtype_stack * @package qtype_stack
* @copyright 2012 The Open University * @copyright 2012 The Open University
...@@ -95,7 +95,7 @@ $string['showvalidation'] = 'Show the validation'; ...@@ -95,7 +95,7 @@ $string['showvalidation'] = 'Show the validation';
$string['showvalidation_help'] = 'Setting this option displays any validation feedback from this input, including echoing back their expression in traditional two dimensional notation.'; $string['showvalidation_help'] = 'Setting this option displays any validation feedback from this input, including echoing back their expression in traditional two dimensional notation.';
$string['showvalidation_link'] = '%%WWWROOT%%/question/type/stack/doc/doc.php/Authoring/Inputs.md#Show_validation'; $string['showvalidation_link'] = '%%WWWROOT%%/question/type/stack/doc/doc.php/Authoring/Inputs.md#Show_validation';
$string['htmlfragment'] = 'You appear to have some HTML elements in your expression.'; $string['htmlfragment'] = 'You appear to have some HTML elements in your expression.';
$string['illegalcaschars'] = 'The characters @ and \$ are not allowed in CAS input.'; $string['illegalcaschars'] = 'The characters @ and $ are not allowed in CAS input.';
$string['inputheading'] = 'Input: {$a}'; $string['inputheading'] = 'Input: {$a}';
$string['inputtype'] = 'Input type'; $string['inputtype'] = 'Input type';
$string['inputtype_help'] = 'This determines the type of the input element, e.g. form field, true/false, text area.'; $string['inputtype_help'] = 'This determines the type of the input element, e.g. form field, true/false, text area.';
...@@ -254,17 +254,25 @@ $string['settingcasresultscache_desc'] = 'This setting determines whether calls ...@@ -254,17 +254,25 @@ $string['settingcasresultscache_desc'] = 'This setting determines whether calls
$string['settingcasresultscache_none'] = 'Do not cache'; $string['settingcasresultscache_none'] = 'Do not cache';
$string['settingcastimeout'] = 'CAS connection timeout'; $string['settingcastimeout'] = 'CAS connection timeout';
$string['settingcastimeout_desc'] = 'The timout to use when trying to connect to Maxima.'; $string['settingcastimeout_desc'] = 'The timout to use when trying to connect to Maxima.';
$string['settingmathsdisplay'] = 'Maths filter';
$string['settingmathsdisplay_mathjax'] = 'MathJax';
$string['settingmathsdisplay_tex'] = 'Moodle TeX filter';
$string['settingmathsdisplay_maths'] = 'OU maths filter';
$string['settingmathsdisplay_desc'] = 'The method used to display maths. If you select MathJax, then you will need to follow the instrucions on the Healthcheck page to set it up. If you select a filter, then you must ensure that filter is enabled on the Manage filters configuration page.';
$string['settingplatformtype'] = 'Platform type'; $string['settingplatformtype'] = 'Platform type';
$string['settingplatformtype_desc'] = 'Stack needs to know what sort of operating system it is running on. The Server and MaximaPool options give better performance at the cost of having to set up an additional server. The option "Linux (optimised)" is explained on the Optimising Maxima page in the documentation.'; $string['settingplatformtype_desc'] = 'STACK needs to know what sort of operating system it is running on. The Server and MaximaPool options give better performance at the cost of having to set up an additional server. The option "Linux (optimised)" is explained on the Optimising Maxima page in the documentation.';
$string['settingplatformtypeunix'] = 'Linux'; $string['settingplatformtypeunix'] = 'Linux';
$string['settingplatformtypeunixoptimised'] = 'Linux (optimised)'; $string['settingplatformtypeunixoptimised'] = 'Linux (optimised)';
$string['settingplatformtypewin'] = 'Windows'; $string['settingplatformtypewin'] = 'Windows';
$string['settingplatformtypeserver'] = 'Server'; $string['settingplatformtypeserver'] = 'Server';
$string['settingplatformtypemaximapool'] = 'MaximaPool'; $string['settingplatformtypemaximapool'] = 'MaximaPool';
$string['settingplatformmaximacommand'] = 'Maxima command'; $string['settingplatformmaximacommand'] = 'Maxima command';
$string['settingplatformmaximacommand_desc'] = 'Stack needs to know the shell command to start Maxima. If this is blank, Stack will make an educated guess.'; $string['settingplatformmaximacommand_desc'] = 'STACK needs to know the shell command to start Maxima. If this is blank, STACK will make an educated guess.';
$string['settingplatformplotcommand'] = 'Plot command'; $string['settingplatformplotcommand'] = 'Plot command';
$string['settingplatformplotcommand_desc'] = 'Stack needs to know the gnuplot command. If this is blank, Stack will make an educated guess.'; $string['settingplatformplotcommand_desc'] = 'STACK needs to know the gnuplot command. If this is blank, STACK will make an educated guess.';
$string['settingreplacedollars'] = 'Replace <code>$</code> and <code>$$</code>';
$string['settingreplacedollars_desc'] = 'Replace <code>$...$</code> and <code>$$...$$</code> delimiters in question text, in addition to <code>\\\\[...\\\\]</code> and <code>\\\\(...\\\\)</code>.';
$string['settingusefullinks'] = 'Useful links';
// Strings used by interaction elements. // Strings used by interaction elements.
$string['false'] = 'False'; $string['false'] = 'False';
...@@ -331,7 +339,7 @@ $string['chatintro'] = 'This page enables CAS text to be evaluated directly. It ...@@ -331,7 +339,7 @@ $string['chatintro'] = 'This page enables CAS text to be evaluated directly. It
$string['chattitle'] = 'Test the connection to the CAS'; $string['chattitle'] = 'Test the connection to the CAS';
$string['clearthecache'] = 'Clear the cache'; $string['clearthecache'] = 'Clear the cache';
$string['healthcheck'] = 'STACK healthcheck'; $string['healthcheck'] = 'STACK healthcheck';
$string['healthcheck_desc'] = 'The <a href="{$a->link}">healthcheck script</a> helps you verify that all aspects of Stack are working properly.'; $string['healthcheck_desc'] = 'The <a href="{$a->link}">healthcheck script</a> helps you verify that all aspects of STACK are working properly.';
$string['healthcheckcache_db'] = 'CAS results are being cached in the database.'; $string['healthcheckcache_db'] = 'CAS results are being cached in the database.';
$string['healthcheckcache_none'] = 'CAS results are not being cached.'; $string['healthcheckcache_none'] = 'CAS results are not being cached.';
$string['healthcheckcachestatus'] = 'The cache currently contains {$a} entries.'; $string['healthcheckcachestatus'] = 'The cache currently contains {$a} entries.';
...@@ -341,7 +349,7 @@ $string['healthcheckconfigintro2'] = 'Trying to automatically write the Maxima c ...@@ -341,7 +349,7 @@ $string['healthcheckconfigintro2'] = 'Trying to automatically write the Maxima c
$string['healthcheckconnect'] = 'Trying to connect to the CAS'; $string['healthcheckconnect'] = 'Trying to connect to the CAS';
$string['healthcheckconnectintro'] = 'We are trying to evaluate the following CAS text:'; $string['healthcheckconnectintro'] = 'We are trying to evaluate the following CAS text:';
$string['healthchecklatex'] = 'Check LaTeX is being converted correctly'; $string['healthchecklatex'] = 'Check LaTeX is being converted correctly';
$string['healthchecklatexintro'] = 'STACK generates LaTeX on the fly, and enables teachers to write LaTeX in questions. It assumes that LaTeX will be converted by a moodle filter. Below are samples of displayed and inline expressions in LaTeX which should be appear correctly in your browser. Problems here indicate incorrect moodle filter settings, not faults with STACK itself. Stack only uses the single and double dollar notation itself, but some question authors may be relying on the other forms.'; $string['healthchecklatexintro'] = 'STACK generates LaTeX on the fly, and enables teachers to write LaTeX in questions. It assumes that LaTeX will be converted by a moodle filter. Below are samples of displayed and inline expressions in LaTeX which should be appear correctly in your browser. Problems here indicate incorrect moodle filter settings, not faults with STACK itself. STACK only uses the single and double dollar notation itself, but some question authors may be relying on the other forms.';
$string['healthchecklatexmathjax'] = 'One way to get equiation rendering to work is to copy the following code into the <b>Within HEAD</b> setting on <a href="{$a}">Additional HTML</a>.'; $string['healthchecklatexmathjax'] = 'One way to get equiation rendering to work is to copy the following code into the <b>Within HEAD</b> setting on <a href="{$a}">Additional HTML</a>.';
$string['healthcheckmaximabat'] = 'The maxima.bat file is missing'; $string['healthcheckmaximabat'] = 'The maxima.bat file is missing';
$string['healthcheckmaximabatinfo'] = 'This script tried to automatically copy the maxima.bat script from inside "C:\Program files\Maxima-1.xx.y\bin" into "{$a}\stack". However, this seems not to have worked. Please copy this file manually.'; $string['healthcheckmaximabatinfo'] = 'This script tried to automatically copy the maxima.bat script from inside "C:\Program files\Maxima-1.xx.y\bin" into "{$a}\stack". However, this seems not to have worked. Please copy this file manually.';
......
...@@ -329,7 +329,7 @@ $string['stackCas_failedReturn'] = 'Maxima ei palauttanut vastauksia. ...@@ -329,7 +329,7 @@ $string['stackCas_failedReturn'] = 'Maxima ei palauttanut vastauksia.
// Used in castext.class.php. // Used in castext.class.php.
$string['stackCas_tooLong'] = 'CASText komento on liian pitkä.'; $string['stackCas_tooLong'] = 'CASText komento on liian pitkä.';
$string['stackCas_MissingAt'] = '@-merkki puuttuu.'; $string['stackCas_MissingAt'] = '@-merkki puuttuu.';
$string['stackCas_MissingDollar'] = '\$-merkki puuttuu'; $string['stackCas_MissingDollar'] = '$-merkki puuttuu';
$string['stackCas_MissingOpenHint'] = 'Missing opening hint'; $string['stackCas_MissingOpenHint'] = 'Missing opening hint';
$string['stackCas_MissingClosingHint'] = 'Missing closing /hint'; $string['stackCas_MissingClosingHint'] = 'Missing closing /hint';
$string['stackCas_MissingOpenDisplay'] = '[-merkki puuttuu'; $string['stackCas_MissingOpenDisplay'] = '[-merkki puuttuu';
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
// along with Stack. If not, see <http://www.gnu.org/licenses/>. // along with Stack. If not, see <http://www.gnu.org/licenses/>.
/** /**
* Version information for the Stack question type. * Configuration settings declaration information for the Stack question type.
* *
* @package qtype_stack * @package qtype_stack
* @copyright 2012 The Open University * @copyright 2012 The Open University
...@@ -24,6 +24,9 @@ ...@@ -24,6 +24,9 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
require_once(dirname(__FILE__) . '/settingslib.php');
// Options for connection to Maxima.
$settings->add(new admin_setting_configselect('qtype_stack/platform', $settings->add(new admin_setting_configselect('qtype_stack/platform',
get_string('settingplatformtype', 'qtype_stack'), get_string('settingplatformtype', 'qtype_stack'),
get_string('settingplatformtype_desc', 'qtype_stack'), 'linux', array( get_string('settingplatformtype_desc', 'qtype_stack'), 'linux', array(
...@@ -63,31 +66,32 @@ $settings->add(new admin_setting_configcheckbox('qtype_stack/casdebugging', ...@@ -63,31 +66,32 @@ $settings->add(new admin_setting_configcheckbox('qtype_stack/casdebugging',
get_string('settingcasdebugging', 'qtype_stack'), get_string('settingcasdebugging', 'qtype_stack'),
get_string('settingcasdebugging_desc', 'qtype_stack'), 0)); get_string('settingcasdebugging_desc', 'qtype_stack'), 0));
// Options for Maths display.
$settings->add(new admin_setting_configcheckbox('qtype_stack/ajaxvalidation', $settings->add(new admin_setting_configcheckbox('qtype_stack/ajaxvalidation',
get_string('settingajaxvalidation', 'qtype_stack'), get_string('settingajaxvalidation', 'qtype_stack'),
get_string('settingajaxvalidation_desc', 'qtype_stack'), 0)); get_string('settingajaxvalidation_desc', 'qtype_stack'), 0));
$settings->add(new admin_setting_heading('docs', $settings->add(new qtype_stack_admin_setting_maths_display_method('qtype_stack/mathsdisplay',
get_string('stackDoc_docs', 'qtype_stack'), get_string('settingmathsdisplay', 'qtype_stack'),
get_string('stackDoc_docs_desc', 'qtype_stack', get_string('settingmathsdisplay_desc', 'qtype_stack'), 'mathjax', null));
array('link' => (string) new moodle_url('/question/type/stack/doc/doc.php/')))));
$settings->add(new admin_setting_heading('healthcheck', $settings->add(new admin_setting_configcheckbox('qtype_stack/replacedollars',
get_string('healthcheck', 'qtype_stack'), get_string('settingreplacedollars', 'qtype_stack'),
get_string('healthcheck_desc', 'qtype_stack', get_string('settingreplacedollars_desc', 'qtype_stack'), false));
array('link' => (string) new moodle_url('/question/type/stack/healthcheck.php')))));
$settings->add(new admin_setting_heading('chat', // Useful links.
get_string('chattitle', 'qtype_stack'), $links = array(
get_string('stackDoc_docs_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/doc/doc.php/'))),
get_string('healthcheck_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/healthcheck.php'))),
get_string('chat_desc', 'qtype_stack', get_string('chat_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/caschat.php'))))); array('link' => (string) new moodle_url('/question/type/stack/caschat.php'))),
$settings->add(new admin_setting_heading('answertests',
get_string('stackInstall_testsuite_title', 'qtype_stack'),
get_string('stackInstall_testsuite_title_desc', 'qtype_stack', get_string('stackInstall_testsuite_title_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/answertests.php'))))); array('link' => (string) new moodle_url('/question/type/stack/answertests.php'))),
$settings->add(new admin_setting_heading('inputtests',
get_string('stackInstall_input_title', 'qtype_stack'),
get_string('stackInstall_input_title_desc', 'qtype_stack', get_string('stackInstall_input_title_desc', 'qtype_stack',
array('link' => (string) new moodle_url('/question/type/stack/studentinputs.php'))))); array('link' => (string) new moodle_url('/question/type/stack/studentinputs.php'))),
);
$settings->add(new admin_setting_heading('docs',
get_string('settingusefullinks', 'qtype_stack'),
'* ' . implode("\n* ", $links)));
<?php
// This file is part of Moodle - http://moodle.org/
//
// Moodle is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Configuration settings library code for the Stack question type.
*
* @package qtype_stack
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
defined('MOODLE_INTERNAL') || die();
/**
* Admin settings class for the STACK maths rendering method choices.
*
* Just so we can lazy-load the choices.
*
* @copyright 2011 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class qtype_stack_admin_setting_maths_display_method extends admin_setting_configselect {
public function load_choices() {
global $CFG;
if (is_array($this->choices)) {
return true;
}
$this->choices = array('mathjax' => get_string('settingmathsdisplay_mathjax', 'qtype_stack'));
$filters = get_plugin_list_with_file('filter', 'filter.php');
if (array_key_exists('tex', $filters)) {
$this->choices['tex'] = get_string('settingmathsdisplay_tex', 'qtype_stack');
}
if (array_key_exists('maths', $filters)) {
$this->choices['maths'] = get_string('settingmathsdisplay_maths', 'qtype_stack');
}
return true;
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment