Moodle
  1. Moodle
  2. MDL-11461

Ressource/types/... help files not available

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.8.3, 1.9
    • Fix Version/s: 1.8.6
    • Component/s: Documentation, Resource
    • Labels:
      None
    • Rank:
      28518

      Description

      The informations about the types of help files are not available via the ressource/types.html file.

      http://19.moodle.de/help.php?module=moodle&file=resource/types.html&forcelang=
      This link openes the ressource/types/*.html files and integrates them in the window.

      Actual only the resource/types/label.html is integrated.

      The screenshot shows two different views on the same help file.
      left side : actual version right side: elder version.

      This behaviour is not related to the translation!

      The ressources/types*.html files should also be available in the settings page for the ressource.

      1. MDL-11461.patch
        2 kB
        Jérôme Mouneyrac
      1. help_ress.png
        144 kB

        Activity

        Hide
        Helen Foster added a comment -

        Moodle 1.8 is also affected.

        Show
        Helen Foster added a comment - Moodle 1.8 is also affected.
        Hide
        Valery Fremaux added a comment -

        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. }

        }
        }
        }

        Show
        Valery Fremaux added a comment - 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. } } } }
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Assigning this to Jérôme... ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Assigning this to Jérôme... ciao
        Hide
        Jérôme Mouneyrac added a comment -

        Patch attached. Thank you Valery

        Show
        Jérôme Mouneyrac added a comment - Patch attached. Thank you Valery
        Hide
        Eloy Lafuente (stronk7) added a comment -

        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

        Show
        Eloy Lafuente (stronk7) added a comment - 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
        Hide
        Jérôme Mouneyrac added a comment -

        new patch attached (I fixed XHTML issue too)

        Show
        Jérôme Mouneyrac added a comment - new patch attached (I fixed XHTML issue too)
        Hide
        Eloy Lafuente (stronk7) added a comment -

        Looks perfect for me. If it also works... +1 :-D

        Thanks, ciao

        Show
        Eloy Lafuente (stronk7) added a comment - Looks perfect for me. If it also works... +1 :-D Thanks, ciao
        Hide
        Jérôme Mouneyrac added a comment -

        commited and tested in 1.8 Stable, 1.9 Stable and HEAD

        Show
        Jérôme Mouneyrac added a comment - commited and tested in 1.8 Stable, 1.9 Stable and HEAD
        Hide
        Helen Foster added a comment -

        Ralf, thanks for reporting this issue, Valery and Eloy, thanks for your contributions, and Jerome, thanks for fixing it

        Show
        Helen Foster added a comment - Ralf, thanks for reporting this issue, Valery and Eloy, thanks for your contributions, and Jerome, thanks for fixing it

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: