Skip to content

How to make a LORIS module

Alex edited this page Aug 5, 2016 · 13 revisions

Note: If you are looking for information about how to adapt or override a module, please see Code Customization


📝 Overview

A Loris module consists of a group of pages that perform a specific function or assist with a specific task. In Loris, all active modules are shown as submenu items in the main menu on top of the page. Examples of modules include Document Repository, Candidate List (Access Profiles), Imaging Browser ...

Note to contributors: In order to contribute a new module to Loris, you must first fork our repository and checkout a new branch based on the current development branch (currently 17.0-dev).

After creating your module, push the branch to your fork of Loris and create a pull request to the current development branch under aces/Loris


The following tutorial outlines a set of steps to follow in order to create a new Loris module.

1) Create directory structure

  1. Create a new folder corresponding to your module name under $LORIS$/modules/
  • Important: the name you choose for the module will be used as a descriptive URL to access the module, so it is important to have a short and descriptive name (i.e media)
  • Note: module name must use only lowercase alphanumeric characters and underscores (no spaces)
    • i.e document_repository
  1. Create remaining folders inside the module according to the following tree structure:
├── ajax/       // PHP files used to make AJAX requests to retrieve information bypassing Loris page router

├── css/        // CSS files used by the module

├── js/         // Compiled React files (vanilla javascript) that are served to the browser

├── jsx/        // Original React files (JSX) - must be compiled

├── php/        // PHP classes used to retrieve data from database and display forms
  
├── templates/  // Smarty files (.tpl) that define page markup (HTML)

├── test/       // Test Plan and Integration Tests for the current module

├── README.md   // Brief description of what the module is and what it does 

2) Add required files

The most basic version of a module will require a single php file to retrieve information from database and a single .tpl file to render the page.

Option 1: Page with a selection filter

  1. NDB_Menu_Filter_$ModuleName$.class.inc - usually a main page on a module
  2. menu_$ModuleName$.tpl - a template associated with NDB_Menu_Filter_$ModuleName$

Option 2: Page with a regular form (or a placeholder page)

  1. NDB_Form_$ModuleName$.class.inc - renders a extends NDB_Form
  2. form_$ModuleName$ - a template associated with NDB_Form_$ModuleName$

For an example of this implementation module, see Media

3) Access module in Loris

Once you created the modules as described above, go to $LORIS$/$ModuleName$ to see your newly created page

For more info see: How Loris URLs work


We welcome your pull requests for new modules, please contribute! 💯

Clone this wiki locally