### Eclipse Workspace Patch 1.0
#P moodle 19dev
Index: question/import_form.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/import_form.php,v
retrieving revision 1.5.2.2
diff -u -r1.5.2.2 import_form.php
--- question/import_form.php 15 Jan 2008 15:25:03 -0000 1.5.2.2
+++ question/import_form.php 20 Apr 2008 13:34:05 -0000
@@ -16,11 +16,18 @@
$fileformatnames = get_import_export_formats('import');
$radioarray = array();
foreach ($fileformatnames as $id => $fileformatname) {
- $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id );
+ $formatname = $fileformatname->formatname;
+ $fileformat = $fileformatname->fileformat;
+ $hashelpfile = $fileformatname->hashelpfile;
+ $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$formatname,$id);
+ if ($hashelpfile) {
+ $thisradioarray = end($radioarray);
+ $thisradioarray->setHelpButton(array('import', $formatname, 'qformat_'.$fileformat));
+ $thisradioarray->_text.=' '.$thisradioarray->_helpbutton;
+ }
}
$mform->addGroup($radioarray,'format', '', array('
'), false);
$mform->addRule('format', null, 'required', null, 'client' );
- $mform->setHelpButton('format', array('import', get_string('importquestions', 'quiz'), 'quiz'));
//--------------------------------------------------------------------------------
$mform->addElement('header','general', get_string('general', 'form'));
Index: question/format.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/format.php,v
retrieving revision 1.35.2.6
diff -u -r1.35.2.6 format.php
--- question/format.php 9 Apr 2008 03:03:49 -0000 1.35.2.6
+++ question/format.php 20 Apr 2008 13:34:05 -0000
@@ -37,6 +37,13 @@
return false;
}
+ function has_import_help_file() {
+ return false;
+ }
+ function has_export_help_file() {
+ return false;
+ }
+
// Accessor methods
/**
Index: question/export_form.php
===================================================================
RCS file: /cvsroot/moodle/moodle/question/export_form.php,v
retrieving revision 1.3.2.1
diff -u -r1.3.2.1 export_form.php
--- question/export_form.php 2 Nov 2007 16:20:18 -0000 1.3.2.1
+++ question/export_form.php 20 Apr 2008 13:34:05 -0000
@@ -15,10 +15,17 @@
$fileformatnames = get_import_export_formats('export');
$radioarray = array();
foreach ($fileformatnames as $id => $fileformatname) {
- $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$fileformatname,$id);
+ $formatname = $fileformatname->formatname;
+ $fileformat = $fileformatname->fileformat;
+ $hashelpfile = $fileformatname->hashelpfile;
+ $radioarray[] = &MoodleQuickForm::createElement('radio','format','',$formatname,$id);
+ if ($hashelpfile) {
+ $thisradioarray = end($radioarray);
+ $thisradioarray->setHelpButton(array('export', $formatname, 'qformat_'.$fileformat));
+ $thisradioarray->_text.=' '.$thisradioarray->_helpbutton;
+ }
}
$mform->addGroup($radioarray,'format','',array('
'),false);
- $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
$mform->addRule('format',null,'required',null,'client');
//--------------------------------------------------------------------------------
@@ -35,13 +42,6 @@
$mform->disabledIf('categorygroup', 'cattofile', 'notchecked');
$mform->setDefault('cattofile', 1);
$mform->setDefault('contexttofile', 1);
-
-
-// $fileformatnames = get_import_export_formats('export');
-// $mform->addElement('select', 'format', get_string('fileformat','quiz'), $fileformatnames);
-// $mform->setDefault('format', 'gift');
-// $mform->setHelpButton('format', array('export', get_string('exportquestions', 'quiz'), 'quiz'));
-
$mform->addElement('text', 'exportfilename', get_string('exportname', 'quiz'), array('size'=>40));
$mform->setDefault('exportfilename', $defaultfilename);
$mform->setType('exportfilename', PARAM_CLEANFILE);
Index: lib/questionlib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/questionlib.php,v
retrieving revision 1.119.2.5
diff -u -r1.119.2.5 questionlib.php
--- lib/questionlib.php 28 Feb 2008 12:52:59 -0000 1.119.2.5
+++ lib/questionlib.php 20 Apr 2008 13:34:05 -0000
@@ -1831,8 +1831,8 @@
global $CFG;
$fileformats = get_list_of_plugins("question/format");
-
$fileformatname=array();
+ $fileformatnames = array();
require_once( "{$CFG->dirroot}/question/format.php" );
foreach ($fileformats as $key => $fileformat) {
$format_file = $CFG->dirroot . "/question/format/$fileformat/format.php";
@@ -1844,21 +1844,29 @@
}
$classname = "qformat_$fileformat";
$format_class = new $classname();
+ $hashelpfile = false;
if ($type=='import') {
$provided = $format_class->provide_import();
+ $hashelpfile = $format_class->has_import_help_file();
}
else {
$provided = $format_class->provide_export();
+ $hashelpfile = $format_class->has_export_help_file();
}
if ($provided) {
+ $fileformatnames[$fileformat]->fileformat = $fileformat;
$formatname = get_string($fileformat, 'quiz');
if ($formatname == "[[$fileformat]]") {
- $formatname = $fileformat; // Just use the raw folder name
+ if ($hashelpfile) {
+ $formatname = get_string($fileformat, $classname);
+ } else {
+ $formatname = $fileformat; // Just use the raw folder name
+ }
}
- $fileformatnames[$fileformat] = $formatname;
+ $fileformatnames[$fileformat]->formatname = $formatname;
+ $fileformatnames[$fileformat]->hashelpfile = $hashelpfile;
}
}
- natcasesort($fileformatnames);
return $fileformatnames;
}
Index: lib/moodlelib.php
===================================================================
RCS file: /cvsroot/moodle/moodle/lib/moodlelib.php,v
retrieving revision 1.960.2.73
diff -u -r1.960.2.73 moodlelib.php
--- lib/moodlelib.php 18 Apr 2008 07:55:38 -0000 1.960.2.73
+++ lib/moodlelib.php 20 Apr 2008 13:34:04 -0000
@@ -5077,6 +5077,7 @@
'enrol_' => array('enrol'),
'filter_' => array('filter'),
'format_' => array('course/format'),
+ 'qformat_' => array('question/format'),
'qtype_' => array('question/type'),
'report_' => array($CFG->admin.'/report', 'course/report', 'mod/quiz/report'),
'resource_' => array('mod/resource/type'),