From: thepurpleblob <thepurpleblob>
Date: Thu, 10 Jul 2008 15:06:19 +0000 (+0000)
Subject: MDL-15008
X-Git-Url: http://git.mjollnir.org/gw?a=commitdiff_plain;h=f94902db28f0b332195e94bdb345cf5c5025a124;p=moodle.git

MDL-15008
Make question import/export formats fully pluggable, especially in respect of languages.
---

diff --git a/lang/en_utf8/help/quiz/formataiken.html b/lang/en_utf8/help/qformat_aiken/aiken.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formataiken.html
rename to lang/en_utf8/help/qformat_aiken/aiken.html
diff --git a/lang/en_utf8/help/quiz/formatblackboard.html b/lang/en_utf8/help/qformat_blackboard/blackboard.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatblackboard.html
rename to lang/en_utf8/help/qformat_blackboard/blackboard.html
diff --git a/lang/en_utf8/help/quiz/formatblackboard_6.html b/lang/en_utf8/help/qformat_blackboard_six/blackboard_six.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatblackboard_6.html
rename to lang/en_utf8/help/qformat_blackboard_six/blackboard_six.html
diff --git a/lang/en_utf8/help/quiz/formatexamview.html b/lang/en_utf8/help/qformat_examview/examview.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatexamview.html
rename to lang/en_utf8/help/qformat_examview/examview.html
diff --git a/lang/en_utf8/help/quiz/formatgift.html b/lang/en_utf8/help/qformat_gift/gift.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatgift.html
rename to lang/en_utf8/help/qformat_gift/gift.html
diff --git a/lang/en_utf8/help/quiz/formathotpot.html b/lang/en_utf8/help/qformat_hotpot/hotpot.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formathotpot.html
rename to lang/en_utf8/help/qformat_hotpot/hotpot.html
diff --git a/lang/en_utf8/help/quiz/formatlearnwise.html b/lang/en_utf8/help/qformat_learnwise/learnwise.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatlearnwise.html
rename to lang/en_utf8/help/qformat_learnwise/learnwise.html
diff --git a/lang/en_utf8/help/quiz/formatmissingword.html b/lang/en_utf8/help/qformat_missingword/missingword.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatmissingword.html
rename to lang/en_utf8/help/qformat_missingword/missingword.html
diff --git a/lang/en_utf8/help/quiz/formatmultianswer.html b/lang/en_utf8/help/qformat_multianswer/multianswer.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatmultianswer.html
rename to lang/en_utf8/help/qformat_multianswer/multianswer.html
diff --git a/lang/en_utf8/help/quiz/formatqti2.html b/lang/en_utf8/help/qformat_qti2/qti2.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatqti2.html
rename to lang/en_utf8/help/qformat_qti2/qti2.html
diff --git a/lang/en_utf8/help/quiz/formatwebct.html b/lang/en_utf8/help/qformat_webct/webct.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatwebct.html
rename to lang/en_utf8/help/qformat_webct/webct.html
diff --git a/lang/en_utf8/help/quiz/formatxhtml.html b/lang/en_utf8/help/qformat_xhtml/xhtml.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatxhtml.html
rename to lang/en_utf8/help/qformat_xhtml/xhtml.html
diff --git a/lang/en_utf8/help/quiz/formatxml.html b/lang/en_utf8/help/qformat_xml/xml.html
similarity index 100%
rename from lang/en_utf8/help/quiz/formatxml.html
rename to lang/en_utf8/help/qformat_xml/xml.html
diff --git a/lang/en_utf8/quiz.php b/lang/en_utf8/quiz.php
index 3060013bd7..9a6fa1ea1b 100644
--- a/lang/en_utf8/quiz.php
+++ b/lang/en_utf8/quiz.php
@@ -75,7 +75,7 @@ $string['backtoquestionlist'] = 'Back to Question List';
 $string['backtoquiz'] = 'Back to quiz editing';
 $string['bestgrade'] = 'Best grade';
 $string['blackboard'] = 'Blackboard';
-$string['blackboard_6'] = 'Blackboard V6+';
+$string['blackboard_six'] = 'Blackboard V6+';
 $string['braceerror'] = 'Could not find {...} around answers';
 $string['bothattempts'] = 'Show students with and without attempts';
 $string['calculated'] = 'Calculated';
diff --git a/lib/moodlelib.php b/lib/moodlelib.php
index 12fda35534..7edf1d88fe 100644
--- a/lib/moodlelib.php
+++ b/lib/moodlelib.php
@@ -5008,6 +5008,7 @@ function places_to_search_for_lang_strings() {
         'filter_' => array('filter'),
         'format_' => array('course/format'),
         'qtype_' => array('question/type'),
+        'qformat_' => array('question/format'),
         'report_' => array($CFG->admin.'/report', 'course/report', 'mod/quiz/report'),
         'repository'=>array('repository'),
         'resource_' => array('mod/resource/type'),
diff --git a/question/export_form.php b/question/export_form.php
index 11d85135af..dac89f48a5 100644
--- a/question/export_form.php
+++ b/question/export_form.php
@@ -14,9 +14,9 @@ class question_export_form extends moodleform {
         $mform->addElement('header','fileformat',get_string('fileformat','quiz'));
         $fileformatnames = get_import_export_formats('export');
         $radioarray = array();
-        foreach ($fileformatnames as $id => $fileformatname) {
-            $radioelement = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id);
-            $radioelement->setHelpButton(array("format{$id}",$fileformatname,'quiz'));
+        foreach ($fileformatnames as $shortname => $fileformatname) {
+            $radioelement = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$shortname);
+            $radioelement->setHelpButton(array("$shortname",$fileformatname,"qformat_$shortname"));
             $radioarray[] = $radioelement;
         }
         $mform->addGroup($radioarray,'format','',array('<br />'),false);
diff --git a/question/format/blackboard_6/format.php b/question/format/blackboard_six/format.php
similarity index 99%
rename from question/format/blackboard_6/format.php
rename to question/format/blackboard_six/format.php
index 62a16cc35e..14be8c3a11 100644
--- a/question/format/blackboard_6/format.php
+++ b/question/format/blackboard_six/format.php
@@ -15,7 +15,7 @@
  */
 require_once ("$CFG->libdir/xmlize.php");
 
-class qformat_blackboard_6 extends qformat_default {
+class qformat_blackboard_six extends qformat_default {
     function provide_import() {
         return true;
     }
diff --git a/question/import_form.php b/question/import_form.php
index f417970557..6e5a7766a0 100644
--- a/question/import_form.php
+++ b/question/import_form.php
@@ -15,9 +15,9 @@ class question_import_form extends moodleform {
         $mform->addElement('header','fileformat', get_string('fileformat','quiz'));
         $fileformatnames = get_import_export_formats('import');
         $radioarray = array();
-        foreach ($fileformatnames as $id => $fileformatname) {
-            $radioelement = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id );
-            $radioelement->setHelpButton(array("format{$id}",$fileformatname,'quiz'));
+        foreach ($fileformatnames as $shortname => $fileformatname) {
+            $radioelement = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$shortname );
+            $radioelement->setHelpButton(array("$shortname",$fileformatname,"qformat_$shortname"));
             $radioarray[] = $radioelement;
         }
         $mform->addGroup($radioarray,'format', '', array('<br />'), false);