Idea: students' comments in little popups. Poetry Module? Bible Study Module?

Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Jan Dierckx -
Number of replies: 16
Demo is partly functioning. There is no code to download yet.

The idea: students help each other to gain a better understanding of a difficult text by adding comments to it. These comments are shown in little popups which appear when you hover over a little comment icon. Purpose is not to explain vocabulary (glossary is much better for that). For large comments the wiki is more suited.

At the moment students can not add comment icons to the text. Teacher has to add them inside the HTML editor by typing a command {note text=$field1}

The module uses Smarty to process the template. Students comments are passed to the template engine as arrays ($field1, $field2, etc....) You can use all of the features Smarty has built in to display the comments.
If you're happy with the way it looks, you can just use the function {note} which displays a popup filled with all the comments.

Student access (for adding comments) is possible: login as student1/student1
Mail me if you want teacher access.

Attachment poem.JPG
Average of ratings: -
In reply to Jan Dierckx

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Jan Dierckx -
If I wanted to give students the ability to add comment icons to the text (asking their peers for insights about a verse / word) what would be the best approach?
I thought about converting every word to a hyperlink with &number=xxx added to it. Clicking on a word would append a comment icon to it.
This does not seem an elegant solution. Is there javascript to know which word a user has selected?

I don't want to use regex replace because there is no guarantee a word is unique. The glossary module is far better suited to help students understand meaning/translation of words. I wanted to use this as a way to display  'inline comments' even if a comment is added to the same word.
(I can imagine students commenting every instance of the verb to be when they are commenting Martin Heidegger)

There are other bugs as well:
- the form's revert button doesn't function anymore.
- not all of Moodle's formatting can be displayed inside the popup
- popup will break if you try it smile
- navigation bar (yes, again, I never seem to get them right.)
- etc...

In reply to Jan Dierckx

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Michael Penney -
Maybe a line based side bar where students could add comments?

There would be a potential to add a pop-up link to every line, but only ones with comments would show the comment icon. Clicking or mousing over this would bring up a list of the comments?
In reply to Michael Penney

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Chardelle Busch -
Picture of Core developers

Hi Janne,

This is cool stuff.  You might check out this similar idea at: http://y-notes.sourceforge.net/   Although this is a java applet, the design might give you some ideas--e.g. comments are dated, comments can be private or shared...

Like Michael said, this would be really cool to add to a book page--kind of a focused, mini-discussion within a page if shared, or focused journal question if private--ooh I'm really liking this.

In reply to Chardelle Busch

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Jan Dierckx -
Thanks for your suggestions. Dated comments are no problem. I hesitate about making comments private. The bookmarks block allowed students to maintain private and shared bookmarks but it rapidly became unmanagable. I'd prefer automatically sharing comments, but after approval.

In reply to Michael Penney

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Tom Murdock -
I love this idea, too.

Bug 1341 had me dreaming...

Just as a glossary will link words in any resource, maybe an annotation could be particular to a specific resource.  The comments could be hyperlinked "glossary" items for those specific words or terms?

Thanks, Jan!
In reply to Michael Penney

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Jan Dierckx -
Adding a (hidden until used) popup icon to every line seems reasonable. I will try that. What form would a sidebar take? A frame? 
In reply to Jan Dierckx

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Michael Penney -
IMO, this is a great idea!

One of the big complaints I here about moving from paper to paperless is how students can't comment on documents read online like they can with printed text.

An nice solution would be to enable this for readings (maybe in book or multipage) to have a way for teachers to allow students to add comments, to enable comments that can be private (student only), or shared to a course or group.

Great work Jan!
In reply to Jan Dierckx

Re: Idea: students' comments in little popups... Smarty implementation!

by Dennis Daniels -
Using smarty across all of Moodle would allow for more niftiness like this one!

Could you characterize your implementation of smarty? Was it hard to get going?

Templates in Moodle are much needed and smarty offers that kind of flexibility... could you tell us more about the smarty aspect of your code?

best!
Denny
In reply to Dennis Daniels

Students' comments in little popups... Smarty implementation... why

by Jan Dierckx -
Some thoughts on using Smarty:
  • Most of the time students will only be reading the text with comments others have made. They will not be adding comments all the time. Collecting all of the comments from the database will slow down the display for every student who just wishes to look at the text. Smarty automatically keeps track of changes in the comments. When no changes have been made, Smarty displays a copy of the last version. That's at least one thing the module doesn't need to take care of itself.
    (Using this module to keep a private list of comments would greatly reduce this advantage, because then every student would need a private copy of the text with his comments)
  • The code to read a text from Moodles database and use it as a template, was clearly described in Smarty's documentation. I just copied it.
  • I started experimenting with the overlib functionality built in. This made a lot more sense to me than using regular expressions to replace some text with javascript functions.
  • It's easy to add new functions to Smarty, eg I added {note id=1} which displays all the comments people have made by clicking on the first icon.
    {note id=2 display=inline} does the same with the comments for the second icon, but displays them not in a popup but directly inside the text.
    If you know Smarty syntax, you can use {note id=3 assign=field3} and then all of the comments are stored in a variable $field3 which you can use inside your own template.
  • Now the downside: I am not sure if it's completely safe to let students enter comments which are afterwards processed by Smarty and include inside a javascript. Of course templates were meant to make it easier for the developer / designer. Maybe it's not a good idea to make them editable through a webinterface.
There is nothing in this module that couldn't be done by some very clever regular expressions... but I'm not that clever with regular expressions.
I will try to post something useful next week. Any ideas for a name for this module?

In reply to Jan Dierckx

Re: Students' comments in little popups... Smarty implementation... why

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
Yike! Let's get this right - you want to let students enter smarty code that will then be processed and displayed? I'm very nervous about this - it was never what smarty was intended for and must surely introduce some interesting security issues that would need some careful thought and testing.

There are already completely safe markup systems built into Moodle - look at the Markdown text format for instance - which is intended for this sort of thing and is becoming something of an industry standard.

While I am at it, a couple of thoughts about smarty and templating in PHP. I have done quite a lot of work using Smarty recently and used to be something of an advocate but have completely changed my mind. It really doesn't do anything that you can't do much more easily in straight PHP anyway. What template engines *are* good at is promoting good system design and by that I mean separation of (business) logic from display. However, this is still something that we can, and surely should, do in ordinary PHP. Our 'html' pages will still contain PHP but only in a minimal, simple sense to display data created in the logic area and to perform simple flow control. The extra layer of complexity is not needed.
In reply to Howard Miller

Smarty ... waste of time?

by Jan Dierckx -
Students will not enter Smarty code. Their comments are assigned to Smarty variables which a teacher can use when (s)he is writing a template. Howard, do you think this could cause a security threat?
I tested adding smarty commands as a student and they waren't parsed at all, just displayed literally. That's why I thought, unless there is a hole in the template engine, the teacher would be the only one able to screw up moodle by adding faulty Smarty commands (which, I agree, doesn't sound like much of a reassurance either mixed)
That said, Smarty is probably overkill for this module.

It's the javascript involved I am even more concerned about: Smarty places the students comments inside javascript calls to produce the popups. What if a smart student finds a way to add commands? After all overlib was also designed for use by site designers, not site visitors.

About your comments on Smarty: When I was trying to debug the PhotoFrame module, I really got lost inside the code: html framesets intertwined with php, forms to navigate and display the slide show, another form to add comment, table tags, ...
(partially of course because PhotoFrame was designed to have everything in one index.html. Add it to a directory with a bunch of pictures, and you're done. It wasn't meant to be included in Moodle)
I really started to dislike php because of all the html echoing that seemed necessary. Mind, the only programming I ever did before discovering Moodle and PHP was writing Excel macro's. Smarty seemed like a relief:
Use a decent html editor to make forms/tables/layout; use a good editor
to write the php part. 
In reply to Jan Dierckx

Re: Smarty ... waste of time?

by Howard Miller -
Picture of Core developers Picture of Documentation writers Picture of Particularly helpful Moodlers Picture of Peer reviewers Picture of Plugin developers
I'm no JavaScript expert so I don't feel qualified to comment - except to reiterate what you have already had concerns for yourself, that exposing 'designer' facilities to users will require some careful thought and testing.

The Smarty-or-not debate could clearly run for ever. However my argument comes down to this. In Smarty you calculate (for want of a better word) your data that you want displayed and load it into an object. You then 'call' the template page. The template page is written in another programming langauage albeit a simple and restricted one. Note that you didn't have to learn a new language - you know one - PHP. Now to make this work you program in just the same way you did using Smarty building your results for display into an object. Your display page is now just a PHP page, BUT it contains very limited PHP - you have to decide what PHP you *allow* yourself but it should be in line with the functionality Smarty gives you and you keep the PHP segments as small as possible - the page, link in Smarty, is 90% HTML. I just want to promote the design principles that Smarty steers you into rather than Smart itself - I don't think you need it.
In reply to Howard Miller

Re: Students' comments in little popups... Smarty implementation... why

by Michael Penney -
I'd have to agree with Howard, we've spent some time working with Smarty tmplates in the past (Xoops and some Postnuke mods, along with Xaraya which used its own templating code similar to Smarty) and generally found it to be more trouble for anything advanced than straight PHP.

I gather the benefits in some cases are in cacheing and rendering (you can avoid some db hits by storing infrequently...but changeable data in the templates) and you can extend a system somewhat without changeing the core code.

However, I'd agree that finding a way to make this work with the Moodle api, maybe with html files written and stored in moddata or in the database itself--or xml, it sounds to me like a project that might benefit from xml's ability to store lots of data and return it quickly?--), so that Moodle core security will apply, would be ideal for the long term life of the project.

I'd really love to see this project move forward, though, so if Smarty is the way you want to go and you think you can get it done and be secure, then go for itsmile.

PS, I agree with your comments regarding alot of php echo calls in the code. However, this is an example of what can be done with php, not what should be done nor a sign of a built in limit. IIRC PhotoFrame one of Martin's earliest projects(--and written for an earlier version of php more limited than the present)? In general, you do (and can) try to keep php and html separate when writing easy to work with and efficient php code (in other words, having alot of php echo calls in the code is generally the sign that someone was learning how to write php while the wrote that codesmile.

If you look at the Moodle code, you'll generally very little of thatsmile.


In reply to Jan Dierckx

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by N Hansen -
You got me thinking....Could this module be turned around so that a teacher could add comments to an assignment submitted by a student?thoughtful
In reply to N Hansen

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Audun Hauge -
It would be very nice to have a system where the teacher could comment on student-text online.
Trying to imagine a system I've come up with the following:
  • The student writes assignment online
  • The teacher can mark a region of text and add a comment as a popup
  • The student can re-edit the text
  • The teacher can comment again
Perhaps this should be done with versioning like in a wiki (original text+comments) -> (new text+comments) ---> ..

The main thing would be making the act of commenting as easy and intuitive as possible. Mark a region of text and click MakeAComment.

Would be truly nice ...
In reply to Audun Hauge

Re: Idea: students' comments in little popups. Poetry Module? Bible Study Module?

by Tom Murdock -
A long, long time ago, Mark Kimes made this work in Library (an old add-on component to Moodle).

He made it so that pages had their own private comment glossaries.

In order to comment, the author opened a comment window, then grabbed a word or phrase from the text as a title.

(in this case, the author might choose Mark Kimes as a title and then comment upon how he is a brilliant programmer who loves motorcycles). 

The word/phrase became highlighted on the page and a comment page opened at the bottom of the screen with the corresponding annotation #anchor-style.

Another cool thing was that pages were all versioned.  In Mark's Library every page was a wiki page but with different writing permissions.    In this way, course resource pages were commented upon/annotated by students and teachers; whereas student journals were commented upon/annotated only by teachers with read/write permissions.  The comment author could choose to "stick" the comment to the page forever (maybe a first draft grade comment), or to allow the comment to stick tight to that particular version of the page.

It was pretty cool, but the code was very different from Moodle code.

I'm pretty skeptical that this could (or should?) be considered for Moodle; however, one thing makes it tantalizing: at one point, Eloy was looking to see how filters (like glossary filters) might apply to particular activities and courses, rather than just site-wide installations.  Maybe that notion could be extended for this kind of annotation system (i.e. a comment/annotation glossary is attached to a student's blog by the teacher, or to a web-page resource for annotation by students)...

Pause -- Deep breath

I can't believe I've written such a greedy feature idea in these forums.  Bad Tom.  Bad, bad, Tom.  This is while I'm still baffled and excited about the changes happening in 1.5.  Have you guys downloaded the development stuff from CVS to play with? Have you seen the way the css stuff is just changing the way EVERYTHING looks and feels?  1.5 is not your father's conservative Moodle.  Vroom.  And the blogs in 1.6? -- really, really cool.