jsxgraph / moodle-filter_jsxgraph

moodle plug-in for JSXGraph
https://jsxgraph.org
1 stars 6 forks source link

fix version 1.5.0 on local #30

Closed alirahimifachr closed 1 year ago

alirahimifachr commented 1 year ago

https://github.com/jsxgraph/moodle-filter_jsxgraph/issues/29

alfredwassermann commented 1 year ago

Many thanks for the pull request. It is now merged into the code. However, I have two questions, sorry for my ignorance:

  1. Starting with line 564 of filter.php it is tested if a file exists:
            if ($tmp = fopen($url, 'r')) {
                $result[0] = 'error';
                $result[1] =
                    get_string('errorNotFound_pre', 'filter_jsxgraph') .
                    $serverversion .
                    get_string('errorNotFound_post', 'filter_jsxgraph');

                return $result;
            } else {
                if (isset($tmp)) {
                    fclose($tmp);
                }
            }

That looks as if the error is thrown if the file exists. Is this correct?

  1. Can you please school me which version of JSXGraph is used for the various import methods? See line 264 of filter.php
        if ($require === self::REQUIRE_WITH_KEY) {
                $codeprefix = "require(['jsxgraphcore'], function (JXG) { \n if ($cond) { \n";
                $codepostfix = "}\n });\n";
            } elseif($require === self::REQUIRE_WITH_PATH) {
                $codeprefix = "import JXG from '" . "../../filter/jsxgraph/jsxgraphcore.js" . "'; \nif ($cond) {";
                $codepostfix = "};";
            } elseif (self::REQUIRE_WITHOUT) {
             ...

REQUIRE_WITH_PATH does a CommonJS import of the *.js version. But I do not see ES6 imports. Didn't moodle switch to ES6 imports since version 3.8?

  1. What is the purpose of line 596?

Best wishes, Alfred