Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Minor Minor
    • Resolution: Fixed
    • Affects Version/s: 1.9.7, 1.9.10, 2.0
    • Fix Version/s: None
    • Labels:
      None
    • Rank:
      21839

      Description

      Hi,

      I have created a new filter to embed an MIT SIMILE Timeline Javascript interactive widget. It can be used to visualize temporal/ historical data - see attached screen shots. The data source can be a static XML file, or a dynamic Moodle Database activity.

      The syntax to embed a timeline, using a static XML is:

      [Timeline]
      title = Important inventions
      dataUrl=

      {PATH}

      /file.php/

      {ID}

      /

      {FILE}

      .xml
      date = 1870
      intervalUnit = CENTURY
      intervalPixels= 75
      [/Timeline]

      Links:

      Notes:

      • It's a filter for the present, though I may look at turning it into a full module.
      • I've started off with the code at Bitbucket - I'm happy to import into Moodle CVS.
      • I've named it 'Timelinewidget' to differentiate it from the Timeline course format.
      • It needs some internationalization work - I'll do that shortly.
      • AFAIK, the previous attempt to integrate SIMILE Timeline in 2006, came to nothing - http://moodle.org/mod/forum/discuss.php?d=58038 .

      I hope this proves useful. Let me know if you have questions or feedback.

      Thanks for your time,

      Nick

      1. mdl19-admin-filters1.png.jpg
        154 kB
      2. mdl19-admin-filters1.png.jpg
        154 kB
      3. moodle19-timelinewidget-moddata4.png
        132 kB
      4. moodle19-timelinewidget-xml1.png
        158 kB
      5. Screencapture Firefox.jpg
        132 kB
      6. Screencapture IE.jpg
        78 kB

        Activity

        Hide
        Nick Freear added a comment -

        Hi Anthony,

        I wondered if you have time to look at this new filter please. If it's up to scratch I'm keen to get it into the Modules & Plugins database.

        Thanks for your time,

        Nick

        Show
        Nick Freear added a comment - Hi Anthony, I wondered if you have time to look at this new filter please. If it's up to scratch I'm keen to get it into the Modules & Plugins database. Thanks for your time, Nick
        Hide
        Anthony Borrow added a comment -

        Michael - Do you have a moment to test this filter and give some feedback? If not, go ahead and re-assign back to me. Peace - Anthony

        Show
        Anthony Borrow added a comment - Michael - Do you have a moment to test this filter and give some feedback? If not, go ahead and re-assign back to me. Peace - Anthony
        Hide
        Michael de Raadt added a comment -

        Hi Nick,

        Thanks for contributing this. It looks like an interesting tool for teachers.

        Sorry for not replying sooner. I'm on holidays currently so I'm only checking emails periodically.

        I attempted to install and test the filter, but I didn't get any joy. I'm running Moodle 1.9.8.

        I was able to copy and enable the filter, but when I created a resource with the text to be filtered it was not being filtered. I don't think the filter function is being called.

        I noticed that the instructions used a different folder name than the name of the folder in the zip. I changed the folder name to be the same as the instructions and enabled the filter again, but that didn't seem to have any effect.

        I'm not that familiar with how filters work. Can you think of anything that might be preventing the filter from running? Have you tried to add the filter to a fresh install?

        Michael;

        Show
        Michael de Raadt added a comment - Hi Nick, Thanks for contributing this. It looks like an interesting tool for teachers. Sorry for not replying sooner. I'm on holidays currently so I'm only checking emails periodically. I attempted to install and test the filter, but I didn't get any joy. I'm running Moodle 1.9.8. I was able to copy and enable the filter, but when I created a resource with the text to be filtered it was not being filtered. I don't think the filter function is being called. I noticed that the instructions used a different folder name than the name of the folder in the zip. I changed the folder name to be the same as the instructions and enabled the filter again, but that didn't seem to have any effect. I'm not that familiar with how filters work. Can you think of anything that might be preventing the filter from running? Have you tried to add the filter to a fresh install? Michael;
        Hide
        Nick Freear added a comment - - edited

        Hi Michael,

        Happy New Year!
        And, sorry I haven't got back to you sooner - very bad . My only excuse is the pre-Christmas rush.

        Right, I hope I've addressed the problems you've had:
        1. I renamed the repository ("moodle-" was my mistake), so that the directory in the Zip is correct. Download here, http://bitbucket.org/nfreear/timelinewidget/downloads
        2. I have improved the install and usage instructions in the Readme, viewable here, http://bitbucket.org/nfreear/timelinewidget/src#wiki
        3. I fixed a bug which may have prevented the filter working on label resources (possibly web page resources too) - http://bitbucket.org/nfreear/timelinewidget/changeset/c27074449304#chg-filter.php_oldline61
        4. I have tested on Moodle 1.9.7, with the filter settings all at their defaults (Text cache lifetime 1 min... Filter all strings No). I tested on both label and web page resources, using the static XML upload mode.
        5. (I made some other improvements, including making the filter (mostly) Moodle 2-ready.)

        Before you try again you may wish to disable the filter in the admin interface (then re-enable it afterwards of course).

        I haven't yet had a chance to test with a clean 1.9 install. Anyway, I hope this moves us forward. I look forward to any feedback you have.

        Many thanks,

        Nick

        Show
        Nick Freear added a comment - - edited Hi Michael, Happy New Year! And, sorry I haven't got back to you sooner - very bad . My only excuse is the pre-Christmas rush. Right, I hope I've addressed the problems you've had: 1. I renamed the repository ("moodle-" was my mistake), so that the directory in the Zip is correct. Download here, http://bitbucket.org/nfreear/timelinewidget/downloads 2. I have improved the install and usage instructions in the Readme, viewable here, http://bitbucket.org/nfreear/timelinewidget/src#wiki 3. I fixed a bug which may have prevented the filter working on label resources (possibly web page resources too) - http://bitbucket.org/nfreear/timelinewidget/changeset/c27074449304#chg-filter.php_oldline61 4. I have tested on Moodle 1.9.7, with the filter settings all at their defaults (Text cache lifetime 1 min... Filter all strings No). I tested on both label and web page resources, using the static XML upload mode. 5. (I made some other improvements, including making the filter (mostly) Moodle 2-ready.) Before you try again you may wish to disable the filter in the admin interface (then re-enable it afterwards of course). I haven't yet had a chance to test with a clean 1.9 install. Anyway, I hope this moves us forward. I look forward to any feedback you have. Many thanks, Nick
        Hide
        Nick Freear added a comment -

        Screenshot of the filter admin page on Moodle 1.9.

        Show
        Nick Freear added a comment - Screenshot of the filter admin page on Moodle 1.9.
        Hide
        Nick Freear added a comment -

        Screenshot of the filter admin page on Moodle 1.9.

        Show
        Nick Freear added a comment - Screenshot of the filter admin page on Moodle 1.9.
        Hide
        Michael de Raadt added a comment -

        Hi Nick,

        It sounds like you've made some good progress.

        I went to download the new version for testing, but there didn't seem to be any files there.

        Could you check that? I'm keen to have another look.

        Michael;

        Show
        Michael de Raadt added a comment - Hi Nick, It sounds like you've made some good progress. I went to download the new version for testing, but there didn't seem to be any files there. Could you check that? I'm keen to have another look. Michael;
        Hide
        Nick Freear added a comment -

        Greetings Michael,

        There are 'zip' and 'gz' links for 'tip', under the Tags & snapshots heading here,
        http://bitbucket.org/nfreear/timelinewidget/downloads

        Also, a direct download link is here,
        http://bitbucket.org/nfreear/timelinewidget/get/tip.zip

        I hope this answers your query. Best wishes,

        Nick

        Show
        Nick Freear added a comment - Greetings Michael, There are 'zip' and 'gz' links for 'tip', under the Tags & snapshots heading here, http://bitbucket.org/nfreear/timelinewidget/downloads Also, a direct download link is here, http://bitbucket.org/nfreear/timelinewidget/get/tip.zip I hope this answers your query. Best wishes, Nick
        Hide
        Michael de Raadt added a comment -

        Hi Nick,

        Good stuff. I've found the files now. I'm currently having another look and will report back.

        Michael;

        Show
        Michael de Raadt added a comment - Hi Nick, Good stuff. I've found the files now. I'm currently having another look and will report back. Michael;
        Hide
        Michael de Raadt added a comment -

        Hi Nick,

        Thanks for contributing this.

        I installed your filter on a fresh Moodle install and was able to enable it without problems.

        I copied the example XML file to the files area of a test course. I went to insert an example of a timeline to a Web page resource. I copied the XML example filter syntax provided, removing leading space, into the WYSIWYG editor, and replaced the course id. When I saved the page and displayed it, it reported an error...

        Error, missing 'date' parameter.

        The date parameter was in the filter entry. I wondered if perhaps there was too much whitespace around the name and value and the = symbol. I removed the space for the date parameter and tried to view the page again. This time the error did not appear but other errors did, including...

        Notice: Undefined property: stdClass::$intervalUnit in D:\xampplite\htdocs\moodle\filter\timelinewidget\filter.php on line 172

        ...so I removed all whitespace around the = symbols for parameters and saved again. Is there some specific requirement or limit for space? This time, the timeline appeared, but there was an error trace displayed...

        line 119 of filter\timelinewidget\filter.php: call to debugging()
        line ? of unknownfile: call to _timeline_filter_callback()
        line 71 of filter\timelinewidget\filter.php: call to preg_replace_callback()
        line 1838 of lib\weblib.php: call to timelinewidget_filter()
        line 1588 of lib\weblib.php: call to filter_text()
        line 120 of mod\resource\type\html\resource.class.php: call to format_text()
        line 40 of mod\resource\view.php: call to resource_html->display()

        Interestingly, when I refreshed, these errors seemed to go away, but the returned when I refreshed a second time. When I clicked on an event in the timeline, a bubble appeared showing information about the event. When the bubbles first appeared they had vertical and horizontal scrollbars that squashed the content a bit. When I viewed the content a second time, these scrollbars were not present and the event appeared nicely. I'll include a screen capture showing the error trace and scrollbars.

        I tried viewing the page using IE (I had been using Firefox). At first it said that JavaScript needed to be enabled and the same trace of errors appeared. I was pretty sure JS was enabled. I refreshed the page and the timeline appeared, but was empty; the error trace disappeared. Refreshing again just caused the error trace to return. I'll include a capture of this.

        I would like to make some recommendations for the filter syntax. Can I suggest that most of the parameters be made optional. For example, the title could be left out, the inital viewing date could be based on the dates in the timeline, the interval could be a default or calculated, the intervalPixels could be a default or calculated. The only necessary parameters seem to be related to the source of the timeline information. In my experience, while it's nice to have control (and this could remain if the user does provide these parameters), most teachers need plugin configuration to be as simple as possible.

        I also wanted to ask where you want to go with this contribution, once you have a version of the filter you are happy with. You have a repository for your code presently. You can serve it from there, but most contributed plugins are accessed by downloading a zip created from the Moodle CVS repository. This has many advantages and I recommend it. Either way you can have an entry for bugs in the Tracker and an entry in the Modules and Plugins database.

        Let me know how you want to progress from here. What you're contributing will be valuable to many people, so I'm happy to continue testing and supporting this to go further.

        Michael;

        Show
        Michael de Raadt added a comment - Hi Nick, Thanks for contributing this. I installed your filter on a fresh Moodle install and was able to enable it without problems. I copied the example XML file to the files area of a test course. I went to insert an example of a timeline to a Web page resource. I copied the XML example filter syntax provided, removing leading space, into the WYSIWYG editor, and replaced the course id. When I saved the page and displayed it, it reported an error... Error, missing 'date' parameter. The date parameter was in the filter entry. I wondered if perhaps there was too much whitespace around the name and value and the = symbol. I removed the space for the date parameter and tried to view the page again. This time the error did not appear but other errors did, including... Notice: Undefined property: stdClass::$intervalUnit in D:\xampplite\htdocs\moodle\filter\timelinewidget\filter.php on line 172 ...so I removed all whitespace around the = symbols for parameters and saved again. Is there some specific requirement or limit for space? This time, the timeline appeared, but there was an error trace displayed... line 119 of filter\timelinewidget\filter.php: call to debugging() line ? of unknownfile: call to _timeline_filter_callback() line 71 of filter\timelinewidget\filter.php: call to preg_replace_callback() line 1838 of lib\weblib.php: call to timelinewidget_filter() line 1588 of lib\weblib.php: call to filter_text() line 120 of mod\resource\type\html\resource.class.php: call to format_text() line 40 of mod\resource\view.php: call to resource_html->display() Interestingly, when I refreshed, these errors seemed to go away, but the returned when I refreshed a second time. When I clicked on an event in the timeline, a bubble appeared showing information about the event. When the bubbles first appeared they had vertical and horizontal scrollbars that squashed the content a bit. When I viewed the content a second time, these scrollbars were not present and the event appeared nicely. I'll include a screen capture showing the error trace and scrollbars. I tried viewing the page using IE (I had been using Firefox). At first it said that JavaScript needed to be enabled and the same trace of errors appeared. I was pretty sure JS was enabled. I refreshed the page and the timeline appeared, but was empty; the error trace disappeared. Refreshing again just caused the error trace to return. I'll include a capture of this. I would like to make some recommendations for the filter syntax. Can I suggest that most of the parameters be made optional. For example, the title could be left out, the inital viewing date could be based on the dates in the timeline, the interval could be a default or calculated, the intervalPixels could be a default or calculated. The only necessary parameters seem to be related to the source of the timeline information. In my experience, while it's nice to have control (and this could remain if the user does provide these parameters), most teachers need plugin configuration to be as simple as possible. I also wanted to ask where you want to go with this contribution, once you have a version of the filter you are happy with. You have a repository for your code presently. You can serve it from there, but most contributed plugins are accessed by downloading a zip created from the Moodle CVS repository. This has many advantages and I recommend it. Either way you can have an entry for bugs in the Tracker and an entry in the Modules and Plugins database. Let me know how you want to progress from here. What you're contributing will be valuable to many people, so I'm happy to continue testing and supporting this to go further. Michael;
        Hide
        Michael de Raadt added a comment -

        Screen captures created during testing.

        Show
        Michael de Raadt added a comment - Screen captures created during testing.
        Hide
        Nick Freear added a comment - - edited

        Hi Michael,

        Right, great feedback. To deal with the easiest first:

        1. No imeline error in MSIE - a stray comma in my Javascript. Embarassing! Thank you JSLint!
        2. The error trace you report - this is just a call to the 'debugging' function, not an error. Anyway, I've made this only appear for developers.
        3. Scroll-bars in the bubbles. I've seen this occasionally. It seems to be an issue with the 3rd-party SIMILE Javascript library. Not a blocker I think.
        4. Filter syntax issues. Whitespace shouldn't be an problem, stray markup may be. Next time you have a problem, please can you 'View source' and post here.
        5. Filter syntax recommendations. Good point! I'm not sure I want to get into XML parsing + tricky calculations, so I've added more defaults. The teachers will often have to tweak these values:

        $defaults = array(
        'id'=>'tlw0',
        'title'=>'My timeline',
        'date' =>2000,
        'intervalUnit'=>'CENTURY',
        'intervalPixels'=>75); }}

        Minimal syntax:

        [Timeline]
        ; dataUrl or dataSrc + dataId
        dataUrl=

        {COURSE_ID}

        /simile-invent.xml
        [/Timeline] }}

        I have done some further work on the Javascript, separate to the comma bug-fix. I've JSLint'ed and will test on MSIE on Monday.

        We're getting there! Thank you again,

        Nick

        Show
        Nick Freear added a comment - - edited Hi Michael, Right, great feedback. To deal with the easiest first: 1. No imeline error in MSIE - a stray comma in my Javascript. Embarassing! Thank you JSLint! 2. The error trace you report - this is just a call to the 'debugging' function, not an error. Anyway, I've made this only appear for developers. 3. Scroll-bars in the bubbles. I've seen this occasionally. It seems to be an issue with the 3rd-party SIMILE Javascript library. Not a blocker I think. 4. Filter syntax issues. Whitespace shouldn't be an problem, stray markup may be. Next time you have a problem, please can you 'View source' and post here. 5. Filter syntax recommendations. Good point! I'm not sure I want to get into XML parsing + tricky calculations, so I've added more defaults. The teachers will often have to tweak these values: $defaults = array( 'id'=>'tlw0', 'title'=>'My timeline', 'date' =>2000, 'intervalUnit'=>'CENTURY', 'intervalPixels'=>75); }} Minimal syntax: [Timeline] ; dataUrl or dataSrc + dataId dataUrl= {COURSE_ID} /simile-invent.xml [/Timeline] }} I have done some further work on the Javascript, separate to the comma bug-fix. I've JSLint'ed and will test on MSIE on Monday. We're getting there! Thank you again, Nick
        Hide
        Michael de Raadt added a comment -

        Great progress Nick.

        Let me know when you have a new version to test.

        Michael;

        Show
        Michael de Raadt added a comment - Great progress Nick. Let me know when you have a new version to test. Michael;
        Hide
        Nick Freear added a comment -

        Hi Michael and Anthony,

        Right, I've had real problems with the Javascript for this, as SIMILE seems to need the <script> tags to be in the page head, which a Moodle filter can't achieve AFAIK (especially in Moodle 1.9.x).

        So, I've switched to an <iframe> solution. Their is a demo here - which works in MSIE (tested in MSIE 7; Moodle 2),

        The code is now here,

        And, their is a plugins entry here,

        Any feedback is welcome! Thanks,

        Nick

        Show
        Nick Freear added a comment - Hi Michael and Anthony, Right, I've had real problems with the Javascript for this, as SIMILE seems to need the <script> tags to be in the page head, which a Moodle filter can't achieve AFAIK (especially in Moodle 1.9.x). So, I've switched to an <iframe> solution. Their is a demo here - which works in MSIE (tested in MSIE 7; Moodle 2), http://freear.org.uk/moodle/mod/page/view.php?id=9 The code is now here, https://github.com/nfreear/moodle-filter_timelinewidget https://github.com/nfreear/moodle-filter_timelinewidget/zipball/master And, their is a plugins entry here, http://moodle.org/mod/data/view.php?rid=4802 Any feedback is welcome! Thanks, Nick
        Hide
        Michael de Raadt added a comment -

        Hi, Nick.

        Good to see a new version.

        I ran some testing on the new version. Here are some notes.

        • In the readme file, the first example has dateUrl instead of dataUrl.
        • When I corrected this, and pasted in the simple example, I was presented with an error saying that it needed a dataUrl or something else. Perhaps this error is a bit too harsh for a filter. Perhaps it could simply print an error in place of the filter text. I found that the error was caused because when I copied and pasted the example from my text editor into the HTML editor, the HTML editor introduced divs instead of just <br> tags. I had to edit the HTML to put in <br> tags. Perhaps you can replace <div> tags with newlines in your filter code.
        • After that, it all worked nicely.

        I went to approve your entry in the M&P, but there was a note there not to approve it, so I didn't. Let me know when you want either Anthony or I to do that.

        Michael;

        Show
        Michael de Raadt added a comment - Hi, Nick. Good to see a new version. I ran some testing on the new version. Here are some notes. In the readme file, the first example has dateUrl instead of dataUrl. When I corrected this, and pasted in the simple example, I was presented with an error saying that it needed a dataUrl or something else. Perhaps this error is a bit too harsh for a filter. Perhaps it could simply print an error in place of the filter text. I found that the error was caused because when I copied and pasted the example from my text editor into the HTML editor, the HTML editor introduced divs instead of just <br> tags. I had to edit the HTML to put in <br> tags. Perhaps you can replace <div> tags with newlines in your filter code. After that, it all worked nicely. I went to approve your entry in the M&P, but there was a note there not to approve it, so I didn't. Let me know when you want either Anthony or I to do that. Michael;
        Hide
        Nick Freear added a comment -

        Hi Michael,

        Thanks for taking another look and reporting back.

        I've fixed the bug in the Readme, and where it occurs in the plugin database entry, and I'll add the other points to my todo list.

        The entry had already been approved, in spite of my note saying not to. I've removed the note, added a link for a forum thread - Anthony has re-activated.

        Many thanks. Best wishes,

        Nick


        BTW, have you taken up a new position at Moodle HQ? I gather you were/are based in Toowoomba.

        Show
        Nick Freear added a comment - Hi Michael, Thanks for taking another look and reporting back. I've fixed the bug in the Readme, and where it occurs in the plugin database entry, and I'll add the other points to my todo list. The entry had already been approved, in spite of my note saying not to. I've removed the note, added a link for a forum thread - Anthony has re-activated. Many thanks. Best wishes, Nick – BTW, have you taken up a new position at Moodle HQ? I gather you were/are based in Toowoomba.
        Hide
        Michael de Raadt added a comment -

        Hi, Nick.

        Congratulations. I just checked the entry and it is all good now.

        Yes, I'm in Perth now, working at Moodle HQ. I shifted here about a month ago.

        All the best.

        Michael;

        Show
        Michael de Raadt added a comment - Hi, Nick. Congratulations. I just checked the entry and it is all good now. Yes, I'm in Perth now, working at Moodle HQ. I shifted here about a month ago. All the best. Michael;
        Hide
        Michael de Raadt added a comment -

        Shifting this issue to the new component and assigning to Nick.

        Complete.

        Show
        Michael de Raadt added a comment - Shifting this issue to the new component and assigning to Nick. Complete.

          People

          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development