Lurch web app user interface

Class

MyCourseFileSystem

A subclass of FileSystem that represents the set of files that the instructor who has configured this instance of the Lurch app specified in the application configuration. To see how to specify the application configuration in general, view the documentation for the createApp() function. To see how to format the "myCourse" field of that options object to specify the contents of this file system, read on here.

We want to make it easy for an instructor to provide their students with a (hierarchical) list of files for their course. The instructor can put any number of files into the same website or folder from which they are hosting the Lurch application, but rather than expect the students to search out the correct folder using the WebFileSystem, this class makes it easy for the instructor to specify which files matter to the students and the course, and make them easy to find. It also lets the instructor give each one a title, rather than referring to it only by its (possibly opaque) URL.

An instructor specifies the files in the "myCourse" field of the app's options object in the following format.

"myCourse" : [
    // an array of files or folders
    // a folder has this format:
    {                     
        "name" : "Week 1: Introduction",
        "contents" : [
            // an array of files or folder
            // a file has this format:
            {
                "name" : "Basic arithmetic",
                "path" : "../math/week1/basic-arithmetic.lurch"
                // paths are relative to the app/index.html file
            },
            // you could put more files or folders here
        ]
    },
    // you could put more files or folders here
]

Constructor

new MyCourseFileSystem()

Source

Methods

has(fileObject) → {Promise}

See the documentation of the has() method in the parent class for the definition of how this method must behave. It implements the requirements specified there for the hierarchical list of files defined in the myCourse field of the app options object, as documented at the top of this class.

Parameters

  • fileObject Object

    as documented in the FileSystem class

Returns

Source

list(fileObject) → {Promise}

See the documentation of the list() method in the parent class for the definition of how this method must behave. It implements the requirements specified there for the hierarchical list of files defined in the myCourse field of the app options object, as documented at the top of this class.

Parameters

  • fileObject Object

    as documented in the FileSystem class

Returns

Source

read()

Reads files using the read() method of the parent class, with one convention of note. This class gives a file object a filename that is separate from its UID. The filename holds the title of the file, and the UID holds the URL to the file. Thus this method, when it is called with a file object, will copy the UID over top of the filename, because the parent class assumes the URL will be in the filename field.

Source