catalyst / moodle-mod_subcourse

Subcourse module for Moodle
https://moodle.org/plugins/mod_subcourse
GNU General Public License v3.0
24 stars 41 forks source link

Go to Course button should have the option to open in a new window #27

Closed nsheehan closed 5 years ago

nsheehan commented 6 years ago

We've just started testing the plugin and it looks great. Our only issue is when using the Subcourse activity module, when you click on Go to Course it open in the current window making it more difficult for the student to return to the main course. If you can point me at the file that controls the layout of the Subcourse activity page I can add target="_blank", I have not been able to find the correct file.

Thank you

mudrd8mz commented 6 years ago

It should be this line https://github.com/mudrd8mz/moodle-mod_subcourse/blob/2ed7fa3c1610119109fc8e2e4a670b01acae475d/view.php#L136 I have not tested but it should be enough if it reads

['class' => 'btn btn-secondary', 'target' => '_blank']
amjohnson46 commented 5 years ago

Hi David, I tried your edit here and it didn't work. This would be a great feature. Do you have any other suggestions? Thanks

mudrd8mz commented 5 years ago

Hi. Weird it does not work for you. I just tried and it does work for me. The said change makes the link having the expected target attribute, and clicking the button opens the referenced course in a new tab (which is the behaviour for new windows I have set in my browser).

amjohnson46 commented 5 years ago

Hi David, Could this possibly depend on the theme? I'm using Boost in Moodle 3.5.3. Using the Webbrowser inspector, I see that links that open in a new window have the property onclick set to "window.open(URL); return false;". When I add the code above, the onclick is still set to "". I made sure to purge the caches after the edit. Is there anything else I need to purge/reset? Thanks for your help, Aaron

amjohnson46 commented 5 years ago

Hi David, I think I figured it out. Above you and Niall were talking about the button within the Subcourse page. Sorry I missed that. I always select the "Redirect to the referenced course" option and so was hoping for this behavior on the link that shows on the course page. Can you direct me to the correct line for that link? Thanks, Aaron

mudrd8mz commented 5 years ago

Ah. I see! Same feature like the URL resource module has then. I'll have to look how it is done there.

lrsmith2 commented 5 years ago

Hi, David. I have a client who also dearly wants this feature to work with "Redirect to referenced course" option. Thank you for the help!

amjohnson46 commented 5 years ago

Hi David, Yes, copying the URL resource settings for "Appearance" would be perfect. More than I need, but a great solution. Thanks, Aaron

mudrd8mz commented 5 years ago

The master branch now contains this feature implemented. I think I'll be able to release a new version soon.

image

amjohnson46 commented 5 years ago

Excellent! Thanks, David. I think this will be a great improvement for a resource/plugin that I use extensively.

lrsmith2 commented 5 years ago

Thanks so much, David. I have been able to successfully test it on my local installation to see if that will work for my client. Next step will be to load it on their test site. I will let you know their feedback. Much appreciated!

lrsmith2 commented 5 years ago

Hi, David. I ran into a validation error on the client's test site (which is a couple of versions behind my 3.4 local where the plugin DID work). Client is running latest 3.2.9 stable due to other plugin dependencies not yet allowing them to go to a higher version. Can you tell me what version is recommended as base absolute for your master branch? I got "[Error] Required Moodle Version [2017051500]" but am having trouble locating which version that build reference goes to in Moodle's archive of releases. I might need to recommend another upgrade and again weigh pros/cons of what they will lose/gain with them, but am checking here first to see how high they would need to go for this to work. Thanks!

mudrd8mz commented 5 years ago

@lrsmith2 the latest Subcourse requires Moodle 3.3 or higher. The version build number for Moodle 3.3 is that 2017051500 which is what the module declares as required minimum. You can find these numerical version numbers at https://docs.moodle.org/dev/Releases#Moodle_3.3

Hope this helps.

lrsmith2 commented 5 years ago

Extremely helpful as always, David. I knew I was probably looking in the wrong place for the version comparisons. At least going from 3.2.9 to 3.3 won't likely be as big a deal as getting them to 3.4, so that is good.

amjohnson46 commented 5 years ago

Hi David, any idea on when a new version will be released with this feature? I've tried manually adding it to my site, but have run into problems (probably my fault).

Cancel that, I just got it working. Thanks again for a great plugin.

Thanks, Aaron

amjohnson46 commented 5 years ago

Hi David, sorry to keep bugging you today. I like the new version. The ability to open the subcourse in a new window is really helpful.

One slight issue: I've started using the Completion Progress block. The progress bar in this block not only shows what items still need to be completed, but each section of the progress bar is a link to that item as well. It would be nice if this link was also opened in a new window. Not sure if that is in your plugin or the Completion Progress block. Very much just a nice to have bit; I imagine getting different plugins to communicate properly could be quite challenging.

Thanks, Aaron

mudrd8mz commented 5 years ago

I just released a new version 7.2.0 with this new feature.

Sorry, there is no easy (if possible) way for one plugin to control how another plugin works. In theory, if the Completion Progress block does its job right, then it should respect modules' ...subcourse_get_coursemodule_info() callbacks and obtain things via something similar to get_array_of_activities(). Then, it might be doable. But it is a task for the maintainers of the block. Thank you for understading.

lrsmith2 commented 5 years ago

Got it. Thank you!