-
Notifications
You must be signed in to change notification settings - Fork 183
How to make a LORIS module
Note: If you are looking for information about how to adapt or override a module, please see Code Customization❗
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.
- 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
- i.e
- 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
│
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
-
NDB_Menu_Filter_$ModuleName$.class.inc
- usually a main page on a module -
menu_$ModuleName$.tpl
- a template associated withNDB_Menu_Filter_$ModuleName$
Option 2: Page with a regular form (or a placeholder page)
-
NDB_Form_$ModuleName$.class.inc
- renders a extendsNDB_Form
-
form_$ModuleName$
- a template associated withNDB_Form_$ModuleName$
For an example of this implementation module, see Media
Once you created the modules as described above, go to $LORIS$/$ModuleName$
to see your newly created page
For more information, see How Loris URLs work
To test your module, you need to write unit and integration tests, include a Test Plan and provide sample test data.
For more information, see LORIS Module Testing
We welcome your pull requests for new modules, please contribute! 💯