Custom Builders
Custom builders intercept the creation of new Apps, Pages, databases and tables to apply developer customizations.
They can be coded in the following languages:
- Lianja (.prg)
- Python (.py)
- JavaScript (.js)
- PHP (.php)
- TypeScript (.ts)
- Lianja Server Pages (.rsp)
They should be located in the builders sub-directory of the Library and are named for the target element along with the default programming language extension.
Windows
Target | Filename |
---|---|
App | C:\lianja\library\builders\app.ext |
Page | C:\lianja\library\builders\page.ext |
Database | C:\lianja\library\builders\database.ext |
Table | C:\lianja\library\builders\table.ext |
Linux
Target | Filename |
---|---|
App | /opt/lianja/library/builders/app.ext |
Page | /opt/lianja/library/builders/page.ext |
Database | /opt/lianja/library/builders/database.ext |
Table | /opt/lianja/library/builders/table.ext |
Custom builders can also be created for a specific project. In this case, prefix the custom builder script with the name of the project. So the Lianja script custom builder for Apps in the myproject project would be:
myproject_app.prg
For example this could be used after the App Wizard completes to set some App attributes for each of the Apps created in a project.
// myproject_app.prg Lianja.writeOutput("Creating new App using the App wizard") // Show the wizard which is modal Lianja.showAppWizard() // after the wizard completes the new App is open if len(Lianja.Application) > 0 Lianja.writeOutput(format("App {0} was created place any post create code here", Lianja.Application)) // set attributes for all the apps created in myproject Lianja.setAttr("pwa", true) Lianja.saveApp() endif
Note the use of desktop Lianja system object methods (introduced in v5.5):
Lianja.saveApp() Lianja.setAttr(name, value) Lianja.showAppWizard()
The corresponding method to get an attribute is also now supported.
Lianja.getAttr(name)
App attribute names can be found here: App Settings.