Moodle
  1. Moodle
  2. MDL-32130

Repositories should be able to return embed code for maximum niceness

    Details

    • Affected Branches:
      MOODLE_22_STABLE
    • Rank:
      38852

      Description

      For example, a Fedora repo plugin should be able to return a link to a document as:

      Snape, S. (2011) "How I defeated the dark lord using invisibility potions" in Alchemist Letters vol. 553 no. 4, pp. 1102-1107.

      Rather than just

      How I defeated the dark lord using invisibility potions

      Or a video repository could return embed code, etc.

      Obviously this is a bit complex and needs to be specced properly.

        Activity

        Hide
        Michael de Raadt added a comment -

        Yes, maximum niceness.

        Show
        Michael de Raadt added a comment - Yes, maximum niceness.
        Hide
        Jonathan Harker added a comment -

        A mish-mash of initial thoughts before rashly writing any code:

        I suppose the "snippet" idea overlaps with the Mahara concept of an artefact, or a Google widget, or similar. At the end of that road lies a new module (something akin to mod/url but that displays more like mod/label) and some tweakage and testing of TinyMCE to correctly handle in-line display of a snippet (or at least, a place-holder box while editing?) in general Moodle content.

        I'm thinking that at least as a first step, a function that returns a <div> with whatever is appropriate for the specific repository, separate from the get_url() and get_file() so that existing functionality is unaffected. I'm struggling to find an appropriate name for the function, but something like get_link_snippet() or get_embedded_link().

        After some discussion here, perhaps this is more than one use case:

        1. For a Koha library book, a document link from Fez or Alfresco, an image from Flickr: we want just a small thumbnail of the object, and the author/title information or even a properly formatted bibliographic citation, which links to the repository object or page.

        2. For Youtube, Flickr or Picasa, we want the image itself, or the embedded video, directly in-line in the Moodle content.

        Use case 2 overlaps with the mediaplugin filter. However perhaps it is better to deal with AV and embedded players at the repository level, rather than in separate parts of the codebase as it is now. It seems easy to argue this - updates to the way Youtube links get handled in HTML should be in the Youtube repository plugin, and not in a separate filter that also processes other links. Additionally, using a regex in the filter to detect Youtube links in arbitrary content is less robust than having the repository API handle it; especially considering we could put an instance ID and repository plugin type in the div class/ID attributes and control output accordingly with CSS.

        Comments and thoughts?

        Show
        Jonathan Harker added a comment - A mish-mash of initial thoughts before rashly writing any code: I suppose the "snippet" idea overlaps with the Mahara concept of an artefact, or a Google widget, or similar. At the end of that road lies a new module (something akin to mod/url but that displays more like mod/label) and some tweakage and testing of TinyMCE to correctly handle in-line display of a snippet (or at least, a place-holder box while editing?) in general Moodle content. I'm thinking that at least as a first step, a function that returns a <div> with whatever is appropriate for the specific repository, separate from the get_url() and get_file() so that existing functionality is unaffected. I'm struggling to find an appropriate name for the function, but something like get_link_snippet() or get_embedded_link(). After some discussion here, perhaps this is more than one use case: 1. For a Koha library book, a document link from Fez or Alfresco, an image from Flickr: we want just a small thumbnail of the object, and the author/title information or even a properly formatted bibliographic citation, which links to the repository object or page. 2. For Youtube, Flickr or Picasa, we want the image itself, or the embedded video, directly in-line in the Moodle content. Use case 2 overlaps with the mediaplugin filter. However perhaps it is better to deal with AV and embedded players at the repository level, rather than in separate parts of the codebase as it is now. It seems easy to argue this - updates to the way Youtube links get handled in HTML should be in the Youtube repository plugin, and not in a separate filter that also processes other links. Additionally, using a regex in the filter to detect Youtube links in arbitrary content is less robust than having the repository API handle it; especially considering we could put an instance ID and repository plugin type in the div class/ID attributes and control output accordingly with CSS. Comments and thoughts?
        Hide
        Jonathan Harker added a comment -

        /me listens to the crickets

        Show
        Jonathan Harker added a comment - /me listens to the crickets
        Hide
        Jonathan Harker added a comment -

        Having a go with some code now - I'm going with get_link_html() and get_link_html_span() for now - for those repositories where a simple inline <a> link is appropriate.

        Show
        Jonathan Harker added a comment - Having a go with some code now - I'm going with get_link_html() and get_link_html_span() for now - for those repositories where a simple inline <a> link is appropriate.
        Hide
        Jonathan Harker added a comment -

        I've been having a bit of trouble with the editor code, but I've got some basic functionality going with Fez (digital repository) and Koha (ILS) records, so you can see what I mean - although at the moment I'm cheating and using a filter. See attached screeny.

        Show
        Jonathan Harker added a comment - I've been having a bit of trouble with the editor code, but I've got some basic functionality going with Fez (digital repository) and Koha (ILS) records, so you can see what I mean - although at the moment I'm cheating and using a filter. See attached screeny.
        Hide
        Jonathan Harker added a comment -

        /me eyeballs MDL-28666

        Show
        Jonathan Harker added a comment - /me eyeballs MDL-28666
        Hide
        Dan Marsden added a comment -

        crackle...pop...

        JH - are you still interested in working on this - is it still relevant? - let me know and I'll take a look at your comments/dig out some feedback from HQ...

        Show
        Dan Marsden added a comment - crackle...pop... JH - are you still interested in working on this - is it still relevant? - let me know and I'll take a look at your comments/dig out some feedback from HQ...
        Hide
        Jonathan Harker added a comment -

        I haven't really had any time to look at it, and I got precisely zero feedback. The things I think need to happen, like repository plugins returning a proper div or span snippet with metadata, thumbnail, embedded document/player etc., don't fit well with the repository API as currently implemented. It's 2013 now and folks expect documents and media to just display nicely inline without having to click through to it. I imagine something similar to what happens in G+ when you paste a URL - you get an embedded Youtube video or Flickr thumbnail straight away, with a sensible caption constructed from the metadata found at the destination. The Moodle Repository should behave the same way.

        If we can find a client who wants this, I'd be more than happy to do it myself, but these days I have many commitments and very little spare time to devote to hacking (on anything - not just Moodle

        Show
        Jonathan Harker added a comment - I haven't really had any time to look at it, and I got precisely zero feedback. The things I think need to happen, like repository plugins returning a proper div or span snippet with metadata, thumbnail, embedded document/player etc., don't fit well with the repository API as currently implemented. It's 2013 now and folks expect documents and media to just display nicely inline without having to click through to it. I imagine something similar to what happens in G+ when you paste a URL - you get an embedded Youtube video or Flickr thumbnail straight away, with a sensible caption constructed from the metadata found at the destination. The Moodle Repository should behave the same way. If we can find a client who wants this, I'd be more than happy to do it myself, but these days I have many commitments and very little spare time to devote to hacking (on anything - not just Moodle
        Hide
        Dan Marsden added a comment -

        re-assigning this in the hope that another developer might be inclined to pick it up - it's still possible Jonathan might pick this up again at some point though.

        Show
        Dan Marsden added a comment - re-assigning this in the hope that another developer might be inclined to pick it up - it's still possible Jonathan might pick this up again at some point though.
        Hide
        Aaron Wells added a comment -

        It'd also be handy for the hypothetical Mahara repository plugin.

        Show
        Aaron Wells added a comment - It'd also be handy for the hypothetical Mahara repository plugin.
        Hide
        Marina Glancy added a comment -

        Hello, just saw this issue.
        Did you consider creating a filter similar to the one that converts youtube links into embedded videos? Disadvantage though that it can't be edited and will always transform links this way.

        I'm sorry but I really doubt that we will make such improvements to repositories (unless we finally rewrite them)

        Show
        Marina Glancy added a comment - Hello, just saw this issue. Did you consider creating a filter similar to the one that converts youtube links into embedded videos? Disadvantage though that it can't be edited and will always transform links this way. I'm sorry but I really doubt that we will make such improvements to repositories (unless we finally rewrite them)
        Hide
        Frédéric Massart added a comment -

        Repositories should actually be able to return multiple formats. When I was developing the Evernote plugin, I thought the user should be able to chose between:

        • Getting the URL to a note
        • Downloading single note text
        • Downloading single note file
        • Downloading note as zip/HTML
        • Downloading note as PDF

        Which could eventually be done by creating fake files, but that means that each resource is a folder and that's not practical at all.

        Show
        Frédéric Massart added a comment - Repositories should actually be able to return multiple formats. When I was developing the Evernote plugin, I thought the user should be able to chose between: Getting the URL to a note Downloading single note text Downloading single note file Downloading note as zip/HTML Downloading note as PDF Which could eventually be done by creating fake files , but that means that each resource is a folder and that's not practical at all.
        Hide
        Jonathan Harker added a comment -

        Sure, but sometimes you don't want to download them, you want to embed them in your content, without copying it into Moodle, or if so, providing something more than just a URL to a file. See attached pic (which uses a filter for the Fez document, which is cheating)

        Show
        Jonathan Harker added a comment - Sure, but sometimes you don't want to download them, you want to embed them in your content, without copying it into Moodle, or if so, providing something more than just a URL to a file. See attached pic (which uses a filter for the Fez document, which is cheating)
        Hide
        Nadav Kavalerchik added a comment -

        On behalf of all the Teachers in the Middle East... "we LOVE to see this feature in Moodle"

        btw, just yesterday I had to hack a solution to have a teacher get a similar functionality when she was trying to embed a list of movies from a Media repository we run.

        Show
        Nadav Kavalerchik added a comment - On behalf of all the Teachers in the Middle East... "we LOVE to see this feature in Moodle" btw, just yesterday I had to hack a solution to have a teacher get a similar functionality when she was trying to embed a list of movies from a Media repository we run.
        Hide
        Nuno Henrique added a comment -

        this would be a very cool feature. I managed to make a plugin, similar to youtube..but I had to hack a lot of code! And I had to develop a filter so it can "read" the content from the editor and generate an iframe, pretty much like media filter but customized.

        One thing that I didn't manage to solve is the preview...I would like, at least, to show an image related with the embed code or even load the iframe..but that's another issue.

        Show
        Nuno Henrique added a comment - this would be a very cool feature. I managed to make a plugin, similar to youtube..but I had to hack a lot of code! And I had to develop a filter so it can "read" the content from the editor and generate an iframe, pretty much like media filter but customized. One thing that I didn't manage to solve is the preview...I would like, at least, to show an image related with the embed code or even load the iframe..but that's another issue.

          People

          • Votes:
            7 Vote for this issue
            Watchers:
            10 Start watching this issue

            Dates

            • Created:
              Updated: