Icons aren't shown on the icon picker window

Issue #17 resolved
Iñigo Zendegi Urzelai created an issue

Hi,

When I try to pick a different icon for a tile, a pop-up opens but there is no icon shown:

I’m using the last version of the plugin available (3.7.0.6), and it happens both on Moodle 3.5 & 3.7, and both on Firefox & Chrome.

Comments (19)

  1. David Watson repo owner

    Hi did you previously use an older version of the plugin without this problem?

    The icons in this window are loaded using JavaScript. Do you have any errors showing in console? If yes please can you share?

  2. Danielli Urbieta Rocha

    Hi,

    I have the same problem using Moodle 3.6 and 3.7. With the older version of the plugin did not have this problem.

  3. David Watson repo owner

    Thanks which theme are you using? If not Boost, do you still see the issue if you use Boost theme?

    If you right click and then do Inspect > Console, do you see any red error messages? If yes, what do they say?

  4. Danielli Urbieta Rocha

    I used the Boost theme and it's still the same. The console does not show any errors.

  5. David Watson repo owner

    Okay I will give this some thought and put some changes into one of the beta releases

  6. Iñigo Zendegi Urzelai reporter

    Danielli’s same case here: I’ve tried Boost & classic themes and none of them shows errors in the console.

    Just in case it gives you a clue, I see on the inspector a empty div where I guess should be the icons:

  7. Iñigo Zendegi Urzelai reporter

    Hi David,

    I’ve tested the new version and now the pop-up doesn’t open at all, and I see this message in the console:

    Fail when getting icon set first.js:39:143

    methodFactory <moodleurl>/lib/requirejs.php/1559304174/core/first.js:39
    k <moodleurl>/lib/requirejs.php/1559304174/core/first.js:420
    execCb <moodleurl>/lib/javascript.php/1559304174/lib/requirejs/require.min.js:1
    check <moodleurl>/lib/javascript.php/1559304174/lib/requirejs/require.min.js:1
    enable <moodleurl>/lib/javascript.php/1559304174/lib/requirejs/require.min.js:1
    init <moodleurl>/lib/javascript.php/1559304174/lib/requirejs/require.min.js:1
    o <moodleurl>/lib/javascript.php/1559304174/lib/requirejs/require.min.js:1

  8. David Watson repo owner

    Good that is one of the new messages I added. Will take a look. What theme are you using?

  9. Iñigo Zendegi Urzelai reporter

    We usually use Fordson, which is Boost based, but this test throws that message both on Fordson, Boost and Classic.

  10. David Watson repo owner

    Okay can you switch your debug level to “Developer” temporarily (Site Admin > Development > Debug Messages (the top item)) and then trigger that error again, and tell me what it says directly under the “Fail when getting icon set” message? Probably “Exception…” something?

  11. Iñigo Zendegi Urzelai reporter

    Yes, on the developer mode the console shows also this message:

    Object { message: "Error reading from database", errorcode: "dmlreadexception", backtrace: "* line 486 of /lib/dml/moodle_database.php: dml_read_exception thrown\n* line 248 of /lib/dml/pgsql_native_moodle_database.php: call to moodle_database->query_end()\n* line 859 of /lib/dml/pgsql_native_moodle_database.php: call to pgsql_native_moodle_database->query_end()\n* line 474 of /course/format/tiles/classes/tile_photo.php: call to pgsql_native_moodle_database->get_records_sql()\n* line 661 of /course/format/tiles/externallib.php: call to format_tiles\\tile_photo::get_photo_library_photos()\n* line 244 of /lib/externallib.php: call to format_tiles_external::get_icon_set()\n* line 59 of /lib/ajax/service.php: call to external_api::call_external_function()\n", link: "<moodleurl>", moreinfourl: "https://docs.moodle.org/37/en/error/moodle/dmlreadexception", debuginfo: "ERROR: syntax error at or near \"=\"\nLINE 3: ...t = $1 AND filearea = $2 AND (contextid = $3 || userid = $4)\n ^\nSELECT id, component, filearea, contextid, itemid, filepath, filename, filesize, mimetype\n FROM m_files\n WHERE component = $1 AND filearea = $2 AND (contextid = $3 || userid = $4)\n AND filename != '.'\n AND filepath = $5\n AND timemodified >= $6 AND mimetype IN ($7,$8,$9)\n AND filesize <= $10 AND filesize > 0\n ORDER BY timemodified DESC LIMIT 20\n[array (\n 0 => 'format_tiles',\n 1 => 'tilephoto',\n 2 => 1375,\n 3 => '2',\n 4 => '/tilephoto/',\n 5 => 1527772061,\n 6 => 'image/gif',\n 7 => 'image/jpeg',\n 8 => 'image/png',\n 9 => 716800,\n)]\nError code: dmlreadexception" }

  12. David Watson repo owner

    I have proposed a temporary fix for this under commits 94a2500 and cb379e9. I don’t have postgres installed and won’t be able to for a while, so I hope this might help until then.

    Can you try it? You only need to replace one file - classes/tile_photo.php - with the new one now available under Downloads. If you prefer, you can wait until I upload this to moodle.org in the next beta version (in the next few days)

  13. Iñigo Zendegi Urzelai reporter

    The fix worked here, too.

    Anyway, that query keeps broken, and looking at it seems to me that the error can be at line 467:

    WHERE component = :component AND filearea = :filearea AND (contextid = :contextid || userid = :userid)

    The “||“ (concat) operator makes no sense there, as it should be a logical operator; giving that a single “|“ is that kind of operator I guess that “|“ was the operator you wanted to use; changing “||“ --> “|“ fixes the query:

    WHERE component = :component AND filearea = :filearea AND (contextid = :contextid | userid = :userid)

    And using “OR“ instead of “|“ makes the query even more readable and I think it doesn’t change the query:

    WHERE component = :component AND filearea = :filearea AND (contextid = :contextid OR userid = :userid)

  14. David Watson repo owner

    You’re right I wanted ‘OR’. I will change this in the next release. When I put || that was habit from Java

  15. Log in to comment