Glossary Entry Dialog

Glossary Entry Dialog

by William Emmons -
Number of replies: 23

I had recently upgrade from 1.94 to 2.0.7 and have notice a big change in the way my Glossary autolink dialog appears.  Before, I was a popup window without nav buttons. It shows muliple entries from different glossaries.  I use 3 glossaries, Course, Teacher, Student. Each is allowed duplicate entries. For example there is 1 in Course, 2 in Teacher and 3 in Student for the term "salvation". All 6 entries would show in a scrollable dialog window.

With 2.0.7, it is not a std popup window, but a scriped window, that only shows 1 entry, not multiple.

Is there a way to go back to using a standard window instead of new dialog format? Also, way are multiple entries not shown?

I hope this is just a setting or two that can be changed.  If not, this completely removed the way we used multiple glossaries as a teaching structure.

Any and all help is greatly appreciated.

Thanks ahead of time.

Bill

Average of ratings: Useful (1)
In reply to William Emmons

Re: Glossary Entry Dialog

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@William,

As you have found out, the display of the Glossary "popup window" is quite different in Moodle 2 from what it was in earlier versions.

As far as I understand it, the main reason for the change was to completely remove from Moodle the "old-fashioned" popup window in favour of the more "modern' AJAX window. This has its advantages... and disadvantages, one of the disadvantages being, as you point out, that it is no longer possible to display more than one definition inside the popup window.

I'm afraid there is no setting available to change this new behaviour. Sorry. I also regret it.

Joseph

In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by William Emmons -

Joseph,

Thanks for quick response.  I was afraid that was going to be an answer.

Having the ability to display multiple entries is a MAJOR design that is used thought our whole teaching process. I feel like the Titanic and got that sinking feeling right now.

Could you direct me to the source that sets up the AJAX window, I assume it is where the autolinks are generated in every page. Would it be one of the view.php files, particularly the ../course/view.php?

I am a little familar with AJAX windows and they are simply a new display method, but have seen some with scroll bars, etc. I believe they could be coded to mimic a standard window. I agree that are "pretty", but.....

Looks like I will have to do some code changing if needed. But either way, it will be hundreds of hours of complete teaching redesign if I cannot find a solution to this.

In reply to William Emmons

Re: Glossary Entry Dialog

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@William,

As moderator of this Glossary forum and "amateur PHP programmer" I am a little familiar with parts of the Moodle Glossary code. However I have no idea where the code for the AJAX popup window might be located nor how it works.

If you could hack the code to provide multiple definitions to be shown - and also - provide scroll bars and positioning, it would be great. Do keep us posted.

ATB

Joseph

In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by Frank Ralf -
I'd like to look a bit into this but I don't know exactly what I have to do to reproduce this behavior. How do I trigger this "Glossary autolink dialog"?

tia
Frank

EDIT
I think I understand now. It's that window which you get when you actually click on an autolinked word instead of just hovering over it?
In reply to Frank Ralf

Re: Glossary Entry Dialog

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

Frank "It's that window which you get when you actually click on an autolinked word instead of just hovering over it?"

Yes, that's the one. Here are some screenshots showing the different behaviours in Moodle 1.9 and 2.

The new, AJAX-style popup window looks nicer than the old one, but... is lacking in a number of very useful features. Obviously a regression.

Joseph

Attachment 24-02-2012 15-55-40.jpg
Average of ratings: Useful (1)
In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by William Emmons -

The snapshot display exactly what I was discribing...thanks Joseph.

We use this multiple entry display to allow first, extra course level content to enhance the understanding of entry. This is fixed on a course.

When a teacher or teachers start a course, they can add entries in the teacher glossary to further enhance the understanding if they want. Ususall 1 per teacher.

Then we also allow students to enter personal info they may find and want to share with the class.  This encourages them to "help teach" especially if they are familiar with the subject. (several students could add entries, that must be accepted first of course).

This allows for great flexability with our teaching framework. As our teaching/learning community develops, we gleen from others each time the course is taught, fold in materials, suggestions, etc to further enhance the course as a whole. This work well for us.

Please let me know if someone finds the code areas or possible has a suggestion as how I could get the same results using other functions within Moodle.

Thanks everyone.

Bill

In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by Frank Ralf -
Thanks Joseph,

In the meantime I managed to reproduce that behavior on my development machine - quite a cool feature!

I haven't found out yet where the different behavior in Moodle 2.x is caused. I compared the
mod\glossary\showentry.php files which look nearly identical and also the function glossary_print_dynaentry() in lib.php which is responsible for displaying the entries.

I haven't even figured out where in the chain of events Moodle recognizes that there is more than one glossary entry at all as showentry.php is only called with one parameter in any case.

Will keep seraching wink

Frank

In reply to Frank Ralf

Re: Glossary Entry Dialog

by William Emmons -

Frank,

I found the same as I have been digging around the different files.

Since the glossary is a filter, I started looking into creating a glossary_legacy filter and display the results the 1.9.x way.

I am like you and cannot locate where is just diplays the first entry.

I am digging through 1.9.16 code now to figure out how it was done before 2.x.

Do you know if there is a flow diagram anywhere that you give you an idea of the entire autolinking & display process. That would be nice to have.

Will keep you updated with what I find also.

Thanks for your help.

In reply to William Emmons

Re: Glossary Entry Dialog

by Frank Ralf -
I think I've found the culprit. In Moodle 1.9 the popup is triggered via the following link:

/mod/glossary/showentry.php?courseid=1&concept=JavaScript

Whereas in Moodle 2.0 the syntax is different:

/mod/glossary/showentry.php?courseid=1&eid=1&displayformat=dictionary

Calling showentry using the "concept" parameter triggers the glossary_get_entries_search($concept, $courseid) function which fetches all entries for the given concept from the database.

There is no equivalent to this function when using the "eid" parameter so there is only the one entry with that entry id shown. If you manually change the syntax to the 1.9 format Moodle 2.0 will also show more than one entry (see screenshot).

So the issue must indeed be cured further upstream on the filter level which generates the link URL for calling "showentry.php".
Attachment Moodle 20 multiple glossary entries.jpg
In reply to Frank Ralf

Re: Glossary Entry Dialog

by William Emmons -

Great sluth work Ralph. 

So you were able to create by just tweeking the  showentry.php parms to use the 1.9 format....

Did you just issue the actual url  with the different parms?

This is good.  I tried to use the 2.0 and not specify the displayformat=dictionary, and the dialog fails. I thing it is due to the content, ie a picture being included that makes it fail. Simple text does not affect it.  This was noted in a comment withing the code where the displayformat is hardcoded to dictionary.  Apparently, they got that far and it got left that way.

In the mean time, I have been working on a different line of thought using a filter of my own, similar to glossary code, then generating a href using the old 1.9 format having an onclick pointing to a pop window. I am making a version of ../glossary/view.php calling it myview.php that used my own formating and CSS coding.  This will allow me to NOT modifiy code for now.

As for the 2.x dialog , I have been looking at the YUI code they use and believe that it could be changed to mimic full window functions. The "panel" container has all the fuctions of windows.  Once I get a working filter/myview working, then I will probably play around with trying to add the YUI ability to it. Using a filter setting to choose between using YUI panel or a window. Allow the user to choose.

Maybe this could lead to future changes to the current glossary / view coding to make it more like the 1.9 functionality. I perfer to have options instead of restrictions.

WIll keep you post if you like. Would like to have someone who has more coding experience that I to check to code and make sure it complies with moodle standards.

Thanks again

Bill

Average of ratings: Useful (1)
In reply to William Emmons

Re: Glossary Entry Dialog

by Frank Ralf -
Hi Bill,

Could you give me any pointers at which YUI code I would have to look? I find that YUI stuff utterly complicated.

tia
Frank
In reply to Frank Ralf

Re: Glossary Entry Dialog

by William Emmons -

Was playing with changing the code snippet within using Firebug in Firefox.

I inspected the link to display the snippet of code (I used a glossary entry that has 4 records)

I replaced the &eid= with &concept= and got an unexpected display when I clicked the link.

It showed 4 separate dialogs boxes on top of each other. I clicked ok on top, the next displayed, etc.  All 4 entries.  Go figure.

Average of ratings: Useful (1)
In reply to William Emmons

Re: Glossary Entry Dialog

by Frank Ralf -
Gosh! So the popup rendering mechanism seems to still get in the way.
So it looks as it's two fronts we're fighting. sad

Frank
In reply to Frank Ralf

Re: Glossary Entry Dialog

by Frank Ralf -

Looks like the problem on the filter level can easily be amended. Just change the url creation code in line 169 in filter/glossary/filter.php from

$link = new moodle_url('/mod/glossary/showentry.php', array( 'courseid'=>$courseid, 'eid'=>$concept->id, 'displayformat'=>'dictionary' ));

to

$link = new moodle_url('/mod/glossary/showentry.php', array( 'courseid'=>$courseid, 'concept'=>$concept->concept, 'displayformat'=>'dictionary' ));

Now we only have to solve the problem with the multiple YUI windows ...

In reply to Frank Ralf

Re: Glossary Entry Dialog

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Frank,

I supose you meant to replace that line in mod/glossary/filter.php

Your hack does display more than one entry if present in more than one glossary. Well, those several entries are displayed in AJAX windows on top of one another, but clicking on the first windows's OK button dismisses that window and shows the next, etc. which I find not so bad at all. Of course it looks nicer if the first window is larger than the second one, etc., as it so happens in my example screenshot. If it was the reverse, things would not look so neat.

What do you think?

Joseph

Attachment 29-02-2012 23-25-09.jpg
In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by Frank Ralf -
Hi Joseph,

I think the behavior of the popup window should be more customizable and more userfriendly. IMO it shouldn't be a modal window in the first place.

Frank
In reply to Frank Ralf

Re: Glossary Entry Dialog

by Frank Ralf -
@Joseph
No, the glossary filter code lives indeed in "filter/glossary/filter.php".

I've started to tamper a little with the glossary module's own YUI code in "\mod\glossary\yui\autolinker\autolinker.js" to see whether this has any effect on the behavior of the dialog box ... wink
In reply to Frank Ralf

Re: Glossary Entry Dialog

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@Franck,

Yes, starting with Moodle 2.2, the glossary's filter.php file was moved from mod/glossary/filter.php to filter/glossary/filter.php.wink

Good luck with your "tampering". It would be really useful if that Glossary AJAX popup window could have more features, namely be moveable, resizeable and scrollable...

Joseph

In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by Frank Ralf -
I think I'm on the right track. It's definitely the "autolinker.js" file which is responsible for the display of the glossary entries. And I think I have already found the culprit (but not the cure yet).

Instead of using the full fledged YUI overlay which is created in detail in that file it only uses an Alert Box for displaying the glossary entries:

new M.core.alert({
title:data.entries[key].concept,
message:data.entries[key].definition,
lightbox:false
});

That would explain all the bad behavior wink

The task at hand is now to find out how to use the overlay function for this purpose which would allow for much more customization.

Stay tuned!
Frank

In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by B E -

Actually, the first one (the older one) isn't modal, as labelled. It's non-modal (also called modeless), since it can clearly be left open (minimised, etc.). What you're calling the AJAX window is a classic case of modal (must be dismissed before user can continue).

 

In reply to Joseph Rézeau

Re: Glossary Entry Dialog

by William Emmons -

Joseph,

Was just looking at 2.0 release notes and found this line...

User comments (Glossaries, Databases, Blogs, etc) are now all consistently handled and displayed throughout Moodle, using AJAX if available

I wonder is this could be a short term solution, if I can find where it checks for AJAX and maybe trick it for the glossary autolinks....

I wonder that it does if a site did not have AJAX enabled?

Just another thougt!

Thanks

Bill

In reply to William Emmons

Re: Glossary Entry Dialog

by Joseph Rézeau -
Picture of Core developers Picture of Particularly helpful Moodlers Picture of Plugin developers Picture of Testers Picture of Translators

@William,

No, that is not related to the problem at hand. It only concerns the comments, not the hyperlinked popup window.

Joseph