Difference between revisions of "Custom Builders"
Yvonne.milne (Talk | contribs) (Created page with "''Under Construction'' Category:Wizards Category:Lianja v5.5") |
Yvonne.milne (Talk | contribs) |
||
Line 1: | Line 1: | ||
− | '' | + | 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''' | ||
+ | |||
+ | {| class="wikitable" width="100%" | ||
+ | !width="20%"|Target||width="80%"|Filename | ||
+ | |- | ||
+ | |valign="top"|App||C:\lianja\library\builders\app.''ext'' | ||
+ | |- | ||
+ | |valign="top"|Page||C:\lianja\library\builders\page.''ext'' | ||
+ | |- | ||
+ | |valign="top"|Database||C:\lianja\library\builders\database.''ext'' | ||
+ | |- | ||
+ | |valign="top"|Table||C:\lianja\library\builders\table.''ext'' | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | '''Linux''' | ||
+ | |||
+ | {| class="wikitable" width="100%" | ||
+ | !width="20%"|Target||width="80%"|Filename | ||
+ | |- | ||
+ | |valign="top"|App||/opt/lianja/library/builders/app.''ext'' | ||
+ | |- | ||
+ | |valign="top"|Page||/opt/lianja/library/builders/page.''ext'' | ||
+ | |- | ||
+ | |valign="top"|Database||/opt/lianja/library/builders/database.''ext'' | ||
+ | |- | ||
+ | |valign="top"|Table||/opt/lianja/library/builders/table.''ext'' | ||
+ | |- | ||
+ | |} | ||
+ | |||
+ | Custom builders can also be created for a specific [[Lianja Projects|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: | ||
+ | |||
+ | <pre>myproject_app.prg</pre> | ||
+ | |||
+ | 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. | ||
+ | |||
+ | <code lang="recital"> | ||
+ | // 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 | ||
+ | </code> | ||
+ | |||
+ | Note the use of [[Lianja|desktop Lianja system object]] methods (introduced in v5.5): | ||
+ | |||
+ | <pre>Lianja.saveApp() | ||
+ | Lianja.setAttr(name, value) | ||
+ | Lianja.showAppWizard()</pre> | ||
+ | |||
+ | The corresponding method to get an attribute is also now supported. | ||
+ | |||
+ | <pre>Lianja.getAttr(name)</pre> | ||
+ | |||
+ | App attribute names can be found here: [[App Settings]]. | ||
[[Category:Wizards]] | [[Category:Wizards]] | ||
[[Category:Lianja v5.5]] | [[Category:Lianja v5.5]] |
Revision as of 11:20, 11 November 2020
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.