From 646791794dd7db1966888bb0a80181d5160213dc Mon Sep 17 00:00:00 2001 From: Tim Hunt Date: Thu, 3 Nov 2011 11:16:14 +0000 Subject: [PATCH] MDL-29808 qformats: use standard pluginname string and add version.php AMOS BEGIN MOV [aiken,qformat_aiken],[pluginname,qformat_aiken] MOV [aiken_help,qformat_aiken],[pluginname_help,qformat_aiken] MOV [aiken_link,qformat_aiken],[pluginname_link,qformat_aiken] MOV [blackboard,qformat_blackboard],[pluginname,qformat_blackboard] MOV [blackboard_help,qformat_blackboard],[pluginname_help,qformat_blackboard] MOV [blackboard_six,qformat_blackboard_six],[pluginname,qformat_blackboard_six] MOV [blackboard_six_help,qformat_blackboard_six],[pluginname_help,qformat_blackboard_six] MOV [examview,qformat_examview],[pluginname,qformat_examview] MOV [examview_help,qformat_examview],[pluginname_help,qformat_examview] MOV [gift_help,qformat_gift],[pluginname_help,qformat_gift] MOV [gift_link,qformat_gift],[pluginname_link,qformat_gift] MOV [learnwise,qformat_learnwise],[pluginname,qformat_learnwise] MOV [learnwise_help,qformat_learnwise],[pluginname_help,qformat_learnwise] MOV [missingword,qformat_missingword],[pluginname,qformat_missingword] MOV [missingword_help,qformat_missingword],[pluginname_help,qformat_missingword] MOV [missingword_link,qformat_missingword],[pluginname_link,qformat_missingword] MOV [multianswer,qformat_multianswer],[pluginname,qformat_multianswer] MOV [multianswer_help,qformat_multianswer],[pluginname_help,qformat_multianswer] MOV [multianswer_link,qformat_multianswer],[pluginname_link,qformat_multianswer] MOV [webct_help,qformat_webct],[pluginname_help,qformat_webct] MOV [webct_link,qformat_webct],[pluginname_link,qformat_webct] MOV [xhtml,qformat_xhtml],[pluginname,qformat_xhtml] MOV [xhtml_help,qformat_xhtml],[pluginname_help,qformat_xhtml] MOV [xhtml_link,qformat_xhtml],[pluginname_link,qformat_xhtml] MOV [xml_help,qformat_xml],[pluginname_help,qformat_xml] MOV [xml_link,qformat_xml],[pluginname_link,qformat_xml] AMOS END --- lib/pluginlib.php | 16 --------- lib/questionlib.php | 6 +--- mod/lesson/lib.php | 3 +- question/export_form.php | 8 +++-- .../format/aiken/lang/en/qformat_aiken.php | 6 ++-- question/format/aiken/version.php | 33 +++++++++++++++++++ .../blackboard/lang/en/qformat_blackboard.php | 4 +-- question/format/blackboard/version.php | 33 +++++++++++++++++++ .../lang/en/qformat_blackboard_six.php | 4 +-- question/format/blackboard_six/version.php | 33 +++++++++++++++++++ .../examview/lang/en/qformat_examview.php | 4 +-- question/format/examview/version.php | 33 +++++++++++++++++++ question/format/gift/lang/en/qformat_gift.php | 6 ++-- question/format/gift/version.php | 33 +++++++++++++++++++ .../learnwise/lang/en/qformat_learnwise.php | 4 +-- question/format/learnwise/version.php | 33 +++++++++++++++++++ .../lang/en/qformat_missingword.php | 6 ++-- question/format/missingword/version.php | 33 +++++++++++++++++++ .../lang/en/qformat_multianswer.php | 6 ++-- question/format/multianswer/version.php | 33 +++++++++++++++++++ question/format/upgrade.txt | 17 ++++++++++ .../format/webct/lang/en/qformat_webct.php | 5 ++- question/format/webct/version.php | 33 +++++++++++++++++++ .../format/xhtml/lang/en/qformat_xhtml.php | 6 ++-- question/format/xhtml/version.php | 33 +++++++++++++++++++ question/format/xml/lang/en/qformat_xml.php | 5 ++- question/format/xml/version.php | 33 +++++++++++++++++++ question/import_form.php | 8 +++-- 28 files changed, 420 insertions(+), 57 deletions(-) create mode 100644 question/format/aiken/version.php create mode 100644 question/format/blackboard/version.php create mode 100644 question/format/blackboard_six/version.php create mode 100644 question/format/examview/version.php create mode 100644 question/format/gift/version.php create mode 100644 question/format/learnwise/version.php create mode 100644 question/format/missingword/version.php create mode 100644 question/format/multianswer/version.php create mode 100644 question/format/upgrade.txt create mode 100644 question/format/webct/version.php create mode 100644 question/format/xhtml/version.php create mode 100644 question/format/xml/version.php diff --git a/lib/pluginlib.php b/lib/pluginlib.php index 9c51d5be364..d79ba180398 100644 --- a/lib/pluginlib.php +++ b/lib/pluginlib.php @@ -1432,22 +1432,6 @@ class plugintype_qtype extends plugintype_base implements plugin_information { } } -/** - * Class for question formats - */ -class plugintype_qformat extends plugintype_base implements plugin_information { - - /** - * @see plugin_information::init_display_name() - */ - public function init_display_name() { - if (get_string_manager()->string_exists('pluginname', $this->component)) { - $this->displayname = get_string('pluginname', $this->component); - } else { - $this->displayname = get_string($this->name, $this->component); - } - } -} /** * Class for authentication plugins diff --git a/lib/questionlib.php b/lib/questionlib.php index 683488ad65f..1bfe045e44f 100644 --- a/lib/questionlib.php +++ b/lib/questionlib.php @@ -1207,11 +1207,7 @@ function get_import_export_formats($type) { if ($provided) { list($notused, $fileformat) = explode('_', $component, 2); - if (get_string_manager()->string_exists('pluginname', $component)) { - $fileformatnames[$fileformat] = get_string('pluginname', $component); - } else { - $fileformatnames[$fileformat] = get_string($fileformat, $component); - } + $fileformatnames[$fileformat] = get_string('pluginname', $component); } } diff --git a/mod/lesson/lib.php b/mod/lesson/lib.php index 4790b5815a2..3b515e82f79 100644 --- a/mod/lesson/lib.php +++ b/mod/lesson/lib.php @@ -876,8 +876,7 @@ function lesson_get_import_export_formats($type) { $provided = $format_class->provide_export(); } if ($provided) { - $formatname = get_string($fileformat, 'qformat_'.$fileformat); - $fileformatnames[$fileformat] = $formatname; + $fileformatnames[$fileformat] = get_string('pluginname', 'qformat_'.$fileformat); } } natcasesort($fileformatnames); diff --git a/question/export_form.php b/question/export_form.php index 7a95abbba80..b8a27ca7bfe 100644 --- a/question/export_form.php +++ b/question/export_form.php @@ -51,8 +51,12 @@ class question_export_form extends moodleform { foreach ($fileformatnames as $shortname => $fileformatname) { $currentgrp1 = array(); $currentgrp1[] = $mform->createElement('radio', 'format', '', $fileformatname, $shortname); - $mform->addGroup($currentgrp1, "formathelp[$i]", '', array('
'), false); - $mform->addHelpButton("formathelp[$i]", $shortname, 'qformat_' . $shortname); + $mform->addGroup($currentgrp1, "formathelp[$i]", ' ', array('
'), false); + + if (get_string_manager()->string_exists('pluginname_help', 'qformat_' . $shortname)) { + $mform->addHelpButton("formathelp[$i]", 'pluginname', 'qformat_' . $shortname); + } + $i++ ; } $mform->addRule("formathelp[0]", null, 'required', null, 'client'); diff --git a/question/format/aiken/lang/en/qformat_aiken.php b/question/format/aiken/lang/en/qformat_aiken.php index b84c9ccc7dd..d9e27e628a7 100644 --- a/question/format/aiken/lang/en/qformat_aiken.php +++ b/question/format/aiken/lang/en/qformat_aiken.php @@ -23,6 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['aiken'] = 'Aiken format'; -$string['aiken_help'] = 'This is a simple format for importing multiple choice questions from a text file.'; -$string['aiken_link'] = 'qformat/aiken'; +$string['pluginname'] = 'Aiken format'; +$string['pluginname_help'] = 'This is a simple format for importing multiple choice questions from a text file.'; +$string['pluginname_link'] = 'qformat/aiken'; diff --git a/question/format/aiken/version.php b/question/format/aiken/version.php new file mode 100644 index 00000000000..426a3863488 --- /dev/null +++ b/question/format/aiken/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage aiken + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_aiken'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/blackboard/lang/en/qformat_blackboard.php b/question/format/blackboard/lang/en/qformat_blackboard.php index 2f3fd16557e..6f68e214657 100644 --- a/question/format/blackboard/lang/en/qformat_blackboard.php +++ b/question/format/blackboard/lang/en/qformat_blackboard.php @@ -23,5 +23,5 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['blackboard'] = 'Blackboard'; -$string['blackboard_help'] = 'Blackboard format enables questions saved in the Blackboard version 5 "POOL" type export format to be imported.'; +$string['pluginname'] = 'Blackboard'; +$string['pluginname_help'] = 'Blackboard format enables questions saved in the Blackboard version 5 "POOL" type export format to be imported.'; diff --git a/question/format/blackboard/version.php b/question/format/blackboard/version.php new file mode 100644 index 00000000000..6b1cb8233f2 --- /dev/null +++ b/question/format/blackboard/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage blackboard + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_blackboard'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/blackboard_six/lang/en/qformat_blackboard_six.php b/question/format/blackboard_six/lang/en/qformat_blackboard_six.php index 94e5ead7e70..75ff1e1e190 100644 --- a/question/format/blackboard_six/lang/en/qformat_blackboard_six.php +++ b/question/format/blackboard_six/lang/en/qformat_blackboard_six.php @@ -23,5 +23,5 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['blackboard_six'] = 'Blackboard V6+'; -$string['blackboard_six_help'] = 'Blackboard V6+ format enables questions saved in Blackboard\'s export format to be imported via zip file. It provides limited support for Blackboard Version 6 and 7.'; +$string['pluginname'] = 'Blackboard V6+'; +$string['pluginname_help'] = 'Blackboard V6+ format enables questions saved in Blackboard\'s export format to be imported via zip file. It provides limited support for Blackboard Version 6 and 7.'; diff --git a/question/format/blackboard_six/version.php b/question/format/blackboard_six/version.php new file mode 100644 index 00000000000..8825ab4f002 --- /dev/null +++ b/question/format/blackboard_six/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage blackboard_six + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_blackboard_six'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/examview/lang/en/qformat_examview.php b/question/format/examview/lang/en/qformat_examview.php index e02cb2fecff..970778f59ec 100644 --- a/question/format/examview/lang/en/qformat_examview.php +++ b/question/format/examview/lang/en/qformat_examview.php @@ -23,5 +23,5 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['examview'] = 'Examview'; -$string['examview_help'] = 'Examview format enables the import of questions from Examview 4 XML files. For newer versions of Examview, Blackboard format may be used.'; +$string['pluginname'] = 'Examview'; +$string['pluginname_help'] = 'Examview format enables the import of questions from Examview 4 XML files. For newer versions of Examview, Blackboard format may be used.'; diff --git a/question/format/examview/version.php b/question/format/examview/version.php new file mode 100644 index 00000000000..cbf765499d4 --- /dev/null +++ b/question/format/examview/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage examview + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_examview'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/gift/lang/en/qformat_gift.php b/question/format/gift/lang/en/qformat_gift.php index 46cc524307a..d990a6b60de 100644 --- a/question/format/gift/lang/en/qformat_gift.php +++ b/question/format/gift/lang/en/qformat_gift.php @@ -24,10 +24,6 @@ */ $string['braceerror'] = 'Could not find {...} around answers'; -$string['gift'] = 'Gift format'; -$string['gift_help'] = 'Gift format enables multiple-choice, true-false, short answer, matching, missing word, numerical and essay questions to be imported or exported via text file.'; -$string['gift_link'] = 'qformat/gift'; -$string['gift'] = 'GIFT format'; $string['giftleftbraceerror'] = 'Could not find a {'; $string['giftmatchingformat'] = 'Matching question answers are improperly formatted'; $string['giftnonumericalanswers'] = 'No answers found for numerical question'; @@ -37,3 +33,5 @@ $string['giftrightbraceerror'] = 'Could not find a }'; $string['importminerror'] = 'There is an error in the question. There are not enough answers for this question type'; $string['nohandler'] = 'No handler for question type {$a}'; $string['pluginname'] = 'Gift format'; +$string['pluginname_help'] = 'Gift format enables multiple-choice, true-false, short answer, matching, missing word, numerical and essay questions to be imported or exported via text file.'; +$string['pluginname_link'] = 'qformat/gift'; diff --git a/question/format/gift/version.php b/question/format/gift/version.php new file mode 100644 index 00000000000..c13f4da5b02 --- /dev/null +++ b/question/format/gift/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage gift + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_gift'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/learnwise/lang/en/qformat_learnwise.php b/question/format/learnwise/lang/en/qformat_learnwise.php index 794bd4bfe09..f94cf1da6b5 100644 --- a/question/format/learnwise/lang/en/qformat_learnwise.php +++ b/question/format/learnwise/lang/en/qformat_learnwise.php @@ -23,5 +23,5 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['learnwise'] = 'Learnwise format'; -$string['learnwise_help'] = 'This format enables the import of multiple choice questions saved in Learnwise\'s XML format.'; +$string['pluginname'] = 'Learnwise format'; +$string['plugidnname_help'] = 'This format enables the import of multiple choice questions saved in Learnwise\'s XML format.'; diff --git a/question/format/learnwise/version.php b/question/format/learnwise/version.php new file mode 100644 index 00000000000..df1db5f8cc8 --- /dev/null +++ b/question/format/learnwise/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage learnwise + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_learnwise'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/missingword/lang/en/qformat_missingword.php b/question/format/missingword/lang/en/qformat_missingword.php index 3e42e72db01..0e190a3c0d4 100644 --- a/question/format/missingword/lang/en/qformat_missingword.php +++ b/question/format/missingword/lang/en/qformat_missingword.php @@ -23,6 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['missingword'] = 'Missing word format'; -$string['missingword_help'] = 'Missing word format enables questions to be imported via text file.'; -$string['missingword_link'] = 'Missing word format'; +$string['pluginname'] = 'Missing word format'; +$string['pluginname_help'] = 'Missing word format enables questions to be imported via text file.'; +$string['pluginname_link'] = 'Missing word format'; diff --git a/question/format/missingword/version.php b/question/format/missingword/version.php new file mode 100644 index 00000000000..7be5b6e1004 --- /dev/null +++ b/question/format/missingword/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage missingword + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_missingword'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/multianswer/lang/en/qformat_multianswer.php b/question/format/multianswer/lang/en/qformat_multianswer.php index 54745fddb97..a118737f576 100644 --- a/question/format/multianswer/lang/en/qformat_multianswer.php +++ b/question/format/multianswer/lang/en/qformat_multianswer.php @@ -23,6 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['multianswer'] = 'Embedded answers (Cloze)'; -$string['multianswer_help'] = 'Embedded answers (Cloze) format enables the import of a passage of text with questions such as multiple-choice and short answer embedded within it.'; -$string['multianswer_link'] = 'question/type/multianswer'; +$string['pluginname'] = 'Embedded answers (Cloze)'; +$string['pluginname_help'] = 'Embedded answers (Cloze) format enables the import of a passage of text with questions such as multiple-choice and short answer embedded within it.'; +$string['pluginname_link'] = 'question/type/multianswer'; diff --git a/question/format/multianswer/version.php b/question/format/multianswer/version.php new file mode 100644 index 00000000000..8f528ca079c --- /dev/null +++ b/question/format/multianswer/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage multianswer + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_multianswer'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/upgrade.txt b/question/format/upgrade.txt new file mode 100644 index 00000000000..1516b9cd521 --- /dev/null +++ b/question/format/upgrade.txt @@ -0,0 +1,17 @@ +This files describes API changes for question import/export format plugins. + +=== 2.2 === + +* The plugin name used to be defined in a string called the same thing as the +format, with assoicated help strings, for example: + +$string['aiken'] = 'Aiken format'; +$string['aiken_help'] = 'This is a simple format ...'; +$string['aiken_link'] = 'qformat/aiken'; + +This needs to be changed to use the standard string name pluginname, as for +other plugin types. + +$string['pluginname'] = 'Aiken format'; +$string['pluginname_help'] = 'This is a simple format ...'; +$string['pluginname_link'] = 'qformat/aiken'; diff --git a/question/format/webct/lang/en/qformat_webct.php b/question/format/webct/lang/en/qformat_webct.php index fa655526cce..43a3b732279 100644 --- a/question/format/webct/lang/en/qformat_webct.php +++ b/question/format/webct/lang/en/qformat_webct.php @@ -28,10 +28,9 @@ $string['missinganswer'] = 'Too few :ANSWER, :Lx, :Rx statements for question li $string['missingquestion'] = 'Missing question label after line {$a}'; $string['paragraphquestion'] = 'Paragraph question'; $string['pluginname'] = 'WebCT format'; +$string['pluginname_help'] = 'WebCT format enables multiple-choice and short answer questions saved in WebCT\'s text-based format to be imported.'; +$string['pluginname_link'] = 'qformat/webct'; $string['questionnametoolong'] = 'Question name too long at line {$a} (255 char. max). It has been truncated.'; $string['unknowntype'] = 'Unknown type'; $string['warningsdetected'] = '{$a} warning(s) detected'; -$string['webct'] = 'WebCT format'; -$string['webct_help'] = 'WebCT format enables multiple-choice and short answer questions saved in WebCT\'s text-based format to be imported.'; -$string['webct_link'] = 'qformat/webct'; $string['wronggrade'] = 'Wrong grade (after line {$a}) :'; diff --git a/question/format/webct/version.php b/question/format/webct/version.php new file mode 100644 index 00000000000..feaae215a7e --- /dev/null +++ b/question/format/webct/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage webct + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_webct'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/xhtml/lang/en/qformat_xhtml.php b/question/format/xhtml/lang/en/qformat_xhtml.php index 8d96c57ed5e..e5492eb94aa 100644 --- a/question/format/xhtml/lang/en/qformat_xhtml.php +++ b/question/format/xhtml/lang/en/qformat_xhtml.php @@ -23,6 +23,6 @@ * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later */ -$string['xhtml'] = 'XHTML format'; -$string['xhtml_help'] = 'XHTML format enables all questions in the category to be exported to a single page of strict XHTML for possible use in another application.'; -$string['xhtml_link'] = 'qformat/xhtml'; +$string['pluginname'] = 'XHTML format'; +$string['pluginname_help'] = 'XHTML format enables all questions in the category to be exported to a single page of strict XHTML for possible use in another application.'; +$string['pluginname_link'] = 'qformat/xhtml'; diff --git a/question/format/xhtml/version.php b/question/format/xhtml/version.php new file mode 100644 index 00000000000..97b86b94f9c --- /dev/null +++ b/question/format/xhtml/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage xhtml + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_xhtml'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/format/xml/lang/en/qformat_xml.php b/question/format/xml/lang/en/qformat_xml.php index dff57d8d713..be4212dcc15 100644 --- a/question/format/xml/lang/en/qformat_xml.php +++ b/question/format/xml/lang/en/qformat_xml.php @@ -25,11 +25,10 @@ $string['invalidxml'] = 'Invalid XML file - string expected (use CDATA?)'; $string['pluginname'] = 'Moodle XML format'; +$string['pluginname_help'] = 'This is a Moodle-specific format for importing and exporting questions.'; +$string['pluginname_link'] = 'qformat/xml'; $string['truefalseimporterror'] = 'Warning: The true/false question \'{$a->questiontext}\' could not be imported properly. It was not clear whether the correct answer is true or false. The question has been imported assuming that the answer is \'{$a->answer}\'. If this is not correct, you will need to edit the question.'; $string['unsupportedexport'] = 'Question type {$a} is not supported by XML export'; -$string['xml'] = 'Moodle XML format'; -$string['xml_help'] = 'This is a Moodle-specific format for importing and exporting questions.'; -$string['xml_link'] = 'qformat/xml'; $string['xmlimportnoname'] = 'Missing question name in XML file'; $string['xmlimportnoquestion'] = 'Missing question text in XML file'; $string['xmltypeunsupported'] = 'Question type {$a} is not supported by XML import'; diff --git a/question/format/xml/version.php b/question/format/xml/version.php new file mode 100644 index 00000000000..6c6eefae90c --- /dev/null +++ b/question/format/xml/version.php @@ -0,0 +1,33 @@ +. + +/** + * Version information for the calculated question type. + * + * @package qformat + * @subpackage xml + * @copyright 2011 The Open University + * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later + */ + +defined('MOODLE_INTERNAL') || die(); + +$plugin->component = 'qformat_xml'; +$plugin->version = 2011102700; + +$plugin->requires = 2011102700; + +$plugin->maturity = MATURITY_STABLE; diff --git a/question/import_form.php b/question/import_form.php index a3b082b38b8..571e8cb008a 100644 --- a/question/import_form.php +++ b/question/import_form.php @@ -53,8 +53,12 @@ class question_import_form extends moodleform { foreach ($fileformatnames as $shortname => $fileformatname) { $currentgrp1 = array(); $currentgrp1[] = $mform->createElement('radio', 'format', '', $fileformatname, $shortname); - $mform->addGroup($currentgrp1, "formathelp[$i]", '', array('
'), false); - $mform->addHelpButton("formathelp[$i]", $shortname, 'qformat_' . $shortname); + $mform->addGroup($currentgrp1, "formathelp[$i]", ' ', array('
'), false); + + if (get_string_manager()->string_exists('pluginname_help', 'qformat_' . $shortname)) { + $mform->addHelpButton("formathelp[$i]", 'pluginname', 'qformat_' . $shortname); + } + $i++ ; } $mform->addRule("formathelp[0]", null, 'required', null, 'client');