Comments (16)
Hi, thank you for reporting this problem and the very useful additional information!
I have fixed this problem and published the new version in the Moodle plugin database.
Best regards
Andreas
from moodle-mod_unilabel.
Hi, thanks for the quick answer!
However it's still not working.
M.mod_folder.init_tree
is still called and tries to initialize folder_tree0
which does not exist.
The only place I found js_init_call
is in mod/folder/renderer.php
. From what I understand it should only be called when there is a folder tree. Maybe it's a bug in mod_folder?
Best regards
from moodle-mod_unilabel.
Hi, after my patch I could not reproduce the problem anymore :(.
Can you provide some kind of step by step instructions to reproduce this problem?
Thank you!
Best regards
Andreas
from moodle-mod_unilabel.
Hi, sure, here are the steps :
- Add a folder activity with Display folder contents set to Inline on a course page
- Add a Unilabel activity of type Carousel
- Edit content of the Unilabel activity
No Javascript is loaded and we can see the error in the Console : Uncaught TypeError: this._el is null
- Change the folder activity and set Display folder contents to On a separate page
- Edit content of the Unilabel activity
Everything is working normally.
Thank you!
from moodle-mod_unilabel.
Hi, I am really sorry, but I still can't reproduce this problem anymore.
Do you really upgraded your unilabel plugin to version (2023042305 - Moodle 4.1, 2023062801 - Moodle 4.2)?
Do you use some non core course format or theme?
Did you clear all caches in your browser?
Best regards
Andreas
from moodle-mod_unilabel.
Hi @grabs,
we also ran in this issue. I just checked your recommendations.
- plugin version: 2023062801 on Moodle 4.2
- format_topics
- with cleared cache.
I also tried different browsers (e.g., FF or Chrome) and the error still occurs.
Is there anything more, I can help debugging?
Best regards
Thomas
from moodle-mod_unilabel.
Hi,
please have a look at my screenshots. That's the way I tested it.
I don't know what else I can test.
Maybe I missed something?
Best regards
Andreas
Screenshots
from moodle-mod_unilabel.
Hi,
I have followed your instructions exactly and I still get the error. If I find some time in the next weeks, I will try our steps against a vanilla Moodle just with mod_unilabel installed.
from moodle-mod_unilabel.
Hi Thomas, sorry for the long waiting.
I finally found the real problem. The activity picker inside the unilabel caused the error. While looking for activities it implicitly called the function "folder_cm_info_view()" which injected the troubling YUI code.
This should now be fixed.
Best regards
Andreas
from moodle-mod_unilabel.
Answering on behalf of @tholudwig: I just retested with and without your update and can confirm it works now.
However, maybe the API function has_view()
would be the better fitting function to use.
Also: In some cases user might want to link to labels, folders learningmaps etc. directly shown on the course page. In this case one could think about still displaying them in the activity chooser. The URL could be generated like here:
Thank you very much!
from moodle-mod_unilabel.
Hi, I'm not sure exactly what you mean.
The API function has_view()
already is used to exclude labels.
The problem on this issue was the activity "folder" which has a view page. If an instance of folder is displayed inline it loads all its YUI crap just by checking the availability. The only way I can decide whether to show it in the picker or not was to check the url.
If you have a better way, I am open for it.
Best
Andreas
from moodle-mod_unilabel.
Hi, thanks for your fast response! I try to be more precise :)
I looked at your referenced commit and you are excluding the activities by checking if get_url()
is empty. However, calling get_url()
will trigger obtain_dynamic_data()
which can lead to bigger resource usage. As far as I can see, modinfolib has a specific API function has_view()
for a coursemodule info object that check's if there's an url without calling obtain_dynamic_data()
, see https://github.com/moodle/moodle/blob/513f3b02c76e0321b3c57ca8014d3100b4da8d94/lib/modinfolib.php#L1675
Just a very small difference of course, but in addition to the thoughts about performance, there also might be plugins which implement these both API methods differently.
The second suggestion I was trying to make was not to exclude activities without view page at all, because teachers might sometimes maybe want to link these as well. For this case one still could just link to the corresponding course page/section and use an anchor to make the course page scroll to whereever the course module is on the page like block_floatingbutton does it.
from moodle-mod_unilabel.
Hi, I still don't get what you mean.
the method has_view()
does not give me any clue of whether or not a folder is displayed inline. So give me an example how I can get this info.
Your second suggestions (btw. is unrelated to this issue) I don't understand too. A label for example has no url I can use in an href. I only could reference the section the label is assigned to. But this would be wrong in my opinion. I don't know the floating button plugin and I don't know what goal it has.
Best
Andreas
from moodle-mod_unilabel.
-
Did you look at the link I provided? Here is the PHPDoc:
It clearly states that the functionhas_view()
says if the course module has a view page or not. And it's basic implementation also does more or less similar things like callingempty($cm->get_url())
. So as a course module developer I would have to overwrite this function If I want to declare, if my course module has a view page or not. -
Yes, a little bit unrelated, but not completely, because with your fix you are just removing all course modules from the list of available course modules which do not have a view page. But maybe you want to keep them and instead of using
get_url()
to retrieve a url, you might want to generate the view link itself like block_floatingbutton does. Again, I provided the exact link where this is being done there. This way users would also be able to link course modules without a view page. The link would just open the course in the right section and scroll to the activity by using an anchor.
from moodle-mod_unilabel.
Hi, maybe take a look at
. You can see that I already use thehas_view()
method. But that doesn't give me any info about a folder that is displayed inline.But maybe I have completely misunderstood you or vice versa. Best you bring me an example (example in the sense of code), then I can see what you really mean.
I disagree that linking a section as a workaround for labels is a good idea. If you really want to link a section, you can just copy and paste the link into the text box.
Best
Andreas
from moodle-mod_unilabel.
Hi again and thank you very much for your detailed reply.
-
I had another look and I'm very sorry for the confusion. You are totally right that you are already using the
has_view
function there (for some reason I did not see it for the first time(s), again sorry). I was just assuming that this function should do what theempty($activityinfo->url)
check does later on, but apparently it does not: Itin general
declares if there is a view page, but mod_folder later on declares inobtain_dynamic_data
that it will be displayed inline, so thehas_view
function does not return this state. Despite PHPDoc describe the behavior properly, I'm wondering if this is intended. So forget whatever I suggested, I was wrong there, sorry again :) -
Yes, my intention was not to link the whole section, but generate a link like
$CFG->wwwroot/course/view.php?id=COURSEID&expandsection=SECTIONNUM_WHERE_MODULE_IS_DISPLAYED#module-MODULE_ID
. But I agree, that this might not be 100% stable in some course formats and it's discussable if this makes sense. Just wanted to show an possibility how one could handle these view-page-less coursemodules differently.
Thanks again for the fix!
from moodle-mod_unilabel.
Related Issues (20)
- Settings not stored
- Wish HOT 1
- Cannot move unilabel to the right on the main class page HOT 1
- Bug? Unilabel-Grid with GRID-Format failed HOT 9
- Theme "moove" HOT 12
- Problem with links under the navigation menu HOT 2
- Restore issue HOT 1
- Overriding plugin templates through theme HOT 2
- Disable autimatic slides HOT 1
- Handling of slides without image, HTML code in alt-attribute HOT 1
- Unilabel plugin does not work carousel for student. HOT 1
- feature: for subplugin grid (or a new subplugin based on grid) should support a dropdown with course activitys HOT 1
- Error with grid feature after moodle upgrade from 3.11.15 to 4.2.1 HOT 5
- Grid: hyphenation for wrapping long words HOT 1
- Unilabel Update fails on Moodle 4.3 HOT 2
- inputfield for title
- Glossary entry window opens several times HOT 1
- Carousel: Background color and text color of the caption
- error with adding new elements to the grid HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moodle-mod_unilabel.