-
Notifications
You must be signed in to change notification settings - Fork 81
Contributing AdminPlugins
This section needs to be fleshed out with more information on how to create your own plugins.
Web Administrator plugins are installed into the WEB-INF folder, so for example:
- Note : code can be found in
<railo install dir>/webroot/WEB-INF/railo/context/admin/plugin/Note
- Simon : code can be found in
<railo install dir>/webroot/WEB-INF/railo/context/admin/plugin/Simon
Server Administrator plugins are installed in the Server context, which is usually found in the same folder that the railo.jar is placed, so for example in the Railo Express version it would be in:
<railo install dir>/lib/etc/railo-server/context/context/admin/plugin
(We are going to assume you are building a plugin for the Server Adminstator, the same rules could be applied for the Web Adminsitrator). When building a plugin, you need three things:
- A component called
Action.cfc
that extendsrailo-context.admin.plugin.Plugin
which will be your controller - An xml file with the plugin definition called
language.xml
which defines the strings for multiple languages - An
overview.cfm
file which is the main page of your plugin and you can add your own code to.
Create these files and place them under the plugins folder, for example: <railo install dir>/webroot/WEB-INF/railo/context/admin/plugin/MyPlugin
The Action.cfc looks something like this:
component extends="railo-context.admin.plugin.Plugin"{
/**
* @hint this function will be called to initalize the plugin
*/
function init(Struct lang, Struct app){
}
/**
* @hint this function will be called when the overview page is calle*
*/
function overview(Struct lang, Struct app, Struct req){
}
/**
* @hint this function will be called when the update button is pressed
*/
function update(Struct lang, Struct app, Struct req){
}
}
The language.xml looks something like this:
<?xml version="1.0" encoding="UTF-8"?>
<languages action="myplugin" position="6">
<language key="de">
<group>MyPlugin</group>
<title>Configuration</title>
<description>This is my plugin, and this is the German text describing it.</description>
<custom key="btnUpdate">Erneuern</custom>
</language>
<language key="en">
<group>MyPlugin</group>
<title>Configuration</title>
<description>This is my plugin, and this is the English text describing it.</description>
<custom key="btnUpdate">Update</custom>
</language>
</languages>
The overview form is a simple form, we have included the default table we use to lay stuff out (you dont have to use this of coursE!)
<cfoutput>
<cfform action="#action('update')#" method="post">
<table class="tbl" width="590">
<colgroup>
<col width="150">
<col width="400">
<col width="90">
</colgroup>
<tr>
<td class="tblHead" height="45">
Some Field:
</td>
<td class="tblContent" valign="bottom">
<input type="text" name="someValue">
</td>
</tr>
<tr>
<td class="tblHead" id="submitTD" align="center">
<input class="submit" type="submit" class="submit" name="mainAction" value="#lang.btnUpdate#">
</td>
</tr>
</table>
</cfform>
</cfoutput>
Plugins written for the Railo Server/Web Administrators until version 3.3 would all appear under the section called Plugins
There are times when you want your plugin to appear in a different menu group, for example the Log Analyzer plugins should be under either the Server or Development sections.
The definition of the location for the menu entry is defined in a file called: language.xml
In there just define the tag:
<languages action="services">
which then determines in which section the menu entry should appear. It will appear at the end of the group and at the moment the position is not changeable.
- Getting to know Railo Server
- Railo Server features & specifications
- Getting started with Railo Server
- Installation & configuration
- Railo Server Versions
- Developing with Railo Server
- Deploying Railo Server apps
- Managing Railo Server apps
- Railo Server Extensions
- Useful resources & further reading
- Developing & debugging Railo Server
- FAQs