Uploaded image for project: 'Moodle'
  1. Moodle
  2. MDL-84262

Create a reusable component for displaying trees of files

XMLWordPrintable

    • MOODLE_405_STABLE

      Background

      While trying to customise the display of submitted files in mod_assign, we noticed that there are a several places in moodle that use similar code to create file trees (see renderer->htmllize_tree() in mod_assign, mod_folder, mod_wiki, block_private_files) or file lists (e.g. files_read_only in question/type/essay/renderer.php). This code is a pain to override in a renderer if you want to customise the way the files display and most of it relies on old YUI javascript.

      Proposal

      The code in block_private_files was already updated to use the core/tree AMD module in MDL-72668, so the proposal is to pull that file tree code out, refactor it to use templates, and make it into a reusable component that can also be used everywhere else we want to display a file tree.

      The plan is to create a file_tree class that extends renderable and templatable and has options like displayroot and expandallfolders (based on the different ways the existing code displays the file trees). This would take a file tree (the output from file_storage->get_area_tree()) and turn it into the correct format for the core/tree javascript. We'll also create a file_display component with options for the common bits that are included in a displayed file (like addportfoliobuttons and addplagiarismbuttons) so you can control how the files are displayed within the tree.

            Unassigned Unassigned
            kransom Katie Ransom
            Votes:
            1 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:

                Error rendering 'clockify-timesheets-time-tracking-reports:timer-sidebar'. Please contact your Jira administrators.