|
|
|
[
Permlink
| « Hide
]
Helen Foster - 29/Sep/07 02:21 PM
Moodle 1.8 is also affected.
Issue is in a change in the resource_get_type output.
This affects the include_help_for_each_resource($file, $langs, $helpdir) functon in help.html This function should extract the "type" value from the $typrec->type string that is now resource&type=<typename> Following code fixes the issue, recodeing the way this function gets files : Note that although I signal wherethe major fix is, it affects entire code of the function. Note again that I prepared the code for eventual reintegration of all module docs and language files within the module directory so that a module should be entirely self-contained. function include_help_for_each_resource($file, $langs, $helpdir) { global $CFG; require_once($CFG->dirroot .'/mod/resource/lib.php'); $typelist = resource_get_types(); //**** HERE IS THE FIX ****// foreach($typelist as $aType){ if (preg_match("/type=(.*)/", $aType->type, $matches)){ $typeset[] = $matches[1]; } } $typeset[] = 'label'; //$typeset['label'] = get_string('resourcetypelabel', 'resource'); foreach ($typeset as $type) { //**** HERE IS THE FIX END ****// foreach ($langs as $lang) { if (empty($lang)) { continue; } $filepath = "$helpdir/resource/type/{$type}.html"; // If that does not exist, try a fallback into the module code folder. if (!file_exists($filepath)) { $filepath = "$CFG->dirroot/mod/resource/lang/$lang/help/resource/type/{$type}.html"; } if (file_exists_and_readable($filepath)) { echo '<hr size="1" />'; @include($filepath); // The actual helpfile break; // Out of loop over languages. } } } } Assigning this to Jérôme... ciao :-)
Uhm...
perhaps... I would modify the resource_get_types() function to return one more attribute, say, $type->name or $type->code or something like that. And them, I'd use that new attribute directly in help.php Ciao :-) new patch attached (I fixed XHTML issue too)
Looks perfect for me. If it also works... +1 :-D
Thanks, ciao :-) commited and tested in 1.8 Stable, 1.9 Stable and HEAD
Ralf, thanks for reporting this issue, Valery and Eloy, thanks for your contributions, and Jerome, thanks for fixing it :-)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||