Actions

Proposals/Done/Text box block attachments and inline images: Difference between revisions

From Mahara Wiki

< Proposals‎ | Done
 
(No difference)

Latest revision as of 17:43, 11 July 2020

Preamble

We currently have functionality to add attachments and inline images to blog posts, but nowhere else in Mahara. This proposal is to add the functionality to do this wherever it makes sense to attach file artefacts to other artefacts. This involves converting the textblock into an artefact in its own right.

Textblocks as artefacts (completed in version 1.5)

Rationale

Something that has been discussed within the Mahara development team for awhile is to start making some content types more reusable. At the moment there are blocks in Mahara that can be added to Views, but not reused. These include the Textbox, as well as Youtube videos, RSS feeds, and indeed all external content. The requirement to add attachments and inline images to the textbox block forces us to convert it into an artefact to fit in with Mahara's attachment infrastucture.

Implementation

This involves creating a new Artefact plugin called "notes" and writing a migration script to move all instances of the textbox block to notes, and then update their block config to point to the appropriate artefact.

User interface

There will be a new second level tab under "My Portfolio", called "My notes", where users can add, edit and delete notes. The existing textbox block will be updated to either allow you to select an existing note or create a new one. When selecting a new one, you can edit it inline, and have the option to save it, overwriting the existing one, or writing a new one (save vs save as)

Attaching files to notes and embedding images

This is currently implemented in the blog post code. However, we are overwriting the image button in tinymce to only be able to put in a Mahara image artefact, which isn't ideal. We propose creating a new tinymce plugin instead, that allows to possibly do all three of: a) embed an existing Mahara image artefact, b) upload a new image and create a Mahara artefact, and c) embed an internal image.

The calling code will be responsible for providing a javascript callback to return a list of images that can be selected, and a callback for saving images.  If the listing callback is not present, the plugin will only display the options to upload a new image, or embed an external image. If the list callback is present, but doesn't return anything, the current message about having no attachments will be displayed, as well as the options to upload a new image, or embed an external image. If the callback is present and returns a list, the user is able to select between uploading a new image, embedding an existing Mahara image artefact, or embedding an external image.  In all three cases, if no callback is provided for adding a new image, this option will not be present.

Files

  • Browseforfiles.png
  • Browseforfilesonlynotartefacts.png