Non-core contributed modules

Import questions hotpot

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Critical Critical
  • Resolution: Fixed
  • Affects Version/s: 1.9.11
  • Fix Version/s: None
  • Labels:
    None
  • Difficulty:
    Moderate
  • Affected Branches:
    MOODLE_19_STABLE

Description

In version 1.9.6 if you try to import a *.jqz a Quiz only shows "Parsing questions from import file." It is a bug and does not give you any further information. In the 1.9.5 does not happen. I looked and I have observed comes from changes in "question/format/hotpot/format.php". More specifically the functions that have been exported to "/mod/hotpot/lib.php". If those functions that have been exported, keep in format.php, the imports of the hotpot is working properly.

Sorry for my English.

Issue Links

Activity

Hide
Gordon Bateson added a comment -

Please could you confirm that you site is using the latest version of Moodle 1.9.6.

Also, please attach the jqz file that fails to get imported so we can test it.

thanks
Gordon

Show
Gordon Bateson added a comment - Please could you confirm that you site is using the latest version of Moodle 1.9.6. Also, please attach the jqz file that fails to get imported so we can test it. thanks Gordon
Hide
Gordon Bateson added a comment -

related to recent fix to merge similar code in "questions/formta/hotpot/format.lib" and "mod/hotpot/lib.php"

Show
Gordon Bateson added a comment - related to recent fix to merge similar code in "questions/formta/hotpot/format.lib" and "mod/hotpot/lib.php"
Hide
Pedro Jiménez added a comment -

Hello, I have version 1.9.6 downloaded on October 28, and is ""reference version".

Attachment file of hotpot questions not working in 1.9.6 and work in 1.9.5.

Thanks

Show
Pedro Jiménez added a comment - Hello, I have version 1.9.6 downloaded on October 28, and is ""reference version". Attachment file of hotpot questions not working in 1.9.6 and work in 1.9.5. Thanks
Hide
Jean-Luc Delghust added a comment -

Hello

I confirm the problem, same thing happens on our install (1.9.6), not only with .jqz but also with a *.jcl file.
One of our teachers uses that feature, at the moment I'm using a workaround but many thanks for looking into it!
I'm willing to provide any ifnormation necessary

thanks!

JLD

Show
Jean-Luc Delghust added a comment - Hello I confirm the problem, same thing happens on our install (1.9.6), not only with .jqz but also with a *.jcl file. One of our teachers uses that feature, at the moment I'm using a workaround but many thanks for looking into it! I'm willing to provide any ifnormation necessary thanks! JLD
Hide
Gordon Bateson added a comment -

Enabling Moodle debugging (Site administration -> Server -> Debugging) I got the following message:

Fatal error: Call to undefined function hotpot_charcode_to_utf8()
in question\format\hotpot\format.php(544) : regexp code on line 1

I transferred the missing function from an old version of the script and confirmed that the HP file could then be imported.

It looks like this issue would affect any HP file with non-ascii chars such as accented European chars or double byte chars from Asian languages.

many thanks for supplying the HP file to test on.

best regards
Gordon

Show
Gordon Bateson added a comment - Enabling Moodle debugging (Site administration -> Server -> Debugging) I got the following message: Fatal error: Call to undefined function hotpot_charcode_to_utf8() in question\format\hotpot\format.php(544) : regexp code on line 1 I transferred the missing function from an old version of the script and confirmed that the HP file could then be imported. It looks like this issue would affect any HP file with non-ascii chars such as accented European chars or double byte chars from Asian languages. many thanks for supplying the HP file to test on. best regards Gordon
Hide
Jean-Luc Delghust added a comment -

Thanks for the fix! Will it be included in tomorrow's weekly release? We'll be updating our platform soon, so I'd like to make sure we get this fix included.
Again, many thanks!

Show
Jean-Luc Delghust added a comment - Thanks for the fix! Will it be included in tomorrow's weekly release? We'll be updating our platform soon, so I'd like to make sure we get this fix included. Again, many thanks!
Hide
Gordon Bateson added a comment - - edited

I don' t know when the fix will be included in the Moodle downloads. it can happen in 1-day, but it can take longer.

If you don't find what you want in the latest download, then you can fix the issue on your site by adding the following function to "question/format/hotpot/format.php":

function hotpot_charcode_to_utf8($charcode) {
    // thanks to Miguel Perez: http://jp2.php.net/chr (19-Sep-2007)
    if ($charcode <= 0x7F) {
        // ascii char (roman alphabet + punctuation)
        return chr($charcode);
    }
    if ($charcode <= 0x7FF) {
        // 2-byte char
        return chr(($charcode >> 0x06) + 0xC0).chr(($charcode & 0x3F) + 128);
    }
    if ($charcode <= 0xFFFF) {
        // 3-byte char
        return chr(($charcode >> 0x0C) + 0xE0).chr((($charcode >> 0x06) & 0x3F) + 0x80).chr(($charcode & 0x3F) + 0x80);
    }
    if ($charcode <= 0x1FFFFF) {
        // 4-byte char
        return chr(($charcode >> 0x12) + 0xF0).chr((($charcode >> 0x0C) & 0x3F) + 0x80).chr((($charcode >> 0x06) & 0x3F) + 0x80).chr(($charcode & 0x3F) + 0x80);
    }
    // unidentified char code !!
    return ' '; 
}
Show
Gordon Bateson added a comment - - edited I don' t know when the fix will be included in the Moodle downloads. it can happen in 1-day, but it can take longer. If you don't find what you want in the latest download, then you can fix the issue on your site by adding the following function to "question/format/hotpot/format.php":
function hotpot_charcode_to_utf8($charcode) {
    // thanks to Miguel Perez: http://jp2.php.net/chr (19-Sep-2007)
    if ($charcode <= 0x7F) {
        // ascii char (roman alphabet + punctuation)
        return chr($charcode);
    }
    if ($charcode <= 0x7FF) {
        // 2-byte char
        return chr(($charcode >> 0x06) + 0xC0).chr(($charcode & 0x3F) + 128);
    }
    if ($charcode <= 0xFFFF) {
        // 3-byte char
        return chr(($charcode >> 0x0C) + 0xE0).chr((($charcode >> 0x06) & 0x3F) + 0x80).chr(($charcode & 0x3F) + 0x80);
    }
    if ($charcode <= 0x1FFFFF) {
        // 4-byte char
        return chr(($charcode >> 0x12) + 0xF0).chr((($charcode >> 0x0C) & 0x3F) + 0x80).chr((($charcode >> 0x06) & 0x3F) + 0x80).chr(($charcode & 0x3F) + 0x80);
    }
    // unidentified char code !!
    return ' '; 
}
Hide
Jean-Luc Delghust added a comment -

Thanks. As far as I can tell from http://cvs.moodle.org/moodle/question/format/hotpot/format.php?view=markup&pathrev=MOODLE_19_WEEKLY it has been included in today's release, so I think we'll be OK with the upgrade.

Again, many thanks for solving this issue, it's really helpful fr many colleagues here.

Show
Jean-Luc Delghust added a comment - Thanks. As far as I can tell from http://cvs.moodle.org/moodle/question/format/hotpot/format.php?view=markup&pathrev=MOODLE_19_WEEKLY it has been included in today's release, so I think we'll be OK with the upgrade. Again, many thanks for solving this issue, it's really helpful fr many colleagues here.
Hide
Andrew Davis added a comment -

The missing function is now present and I was able to import the supplied jqz file without any problems. Closing.

Show
Andrew Davis added a comment - The missing function is now present and I was able to import the supplied jqz file without any problems. Closing.

People

Vote (1)
Watch (5)

Dates

  • Created:
    Updated:
    Resolved: