One of the most useful parts of the modules framework in Sirportly is the ability to request that modules be enabled/disabled within your web interface. This is mostly useful in the cloud edition where many modules may be set up however only used by a small sub-section of account holders to whom they are relevant. Having said that, all users should consider using this system so that future configuration is easily configurable.
In order to tell Sirportly which configuration parameters you would like to request from account owners, you need to add a few options into your module class. These examples are taken from the Hipchat module which is present in all Sirportly installations.
class Hipchat < Module
## ... other information up here as displayed on module intro page.
config_option :room, "Room Name", "The name of the room", :required => true
config_option :api_key, "API Key", "Your Hipchat API key", :required => true
config_option :from_name, "Sender", "Name to send Hipchat messages from"
config_option :colour, "Colour", "Message Colour", :options => ['Yellow', 'Red']
icon "/images/modules/hipchat.png"
public_description "Enter a description about your module to display"
url "http://hipchat.com"
publicise
end
:required => true
- this will ensure that the field is entered by the account owner:options => ['Opt1', 'Opt2']
- this is an array of options. If entered, a select list will be displayed instead of text field.You also need to specify a number of other options within your module configuration which help generate the configuration page shown to account owners.
icon
property should be a URL to a 16x16 icon to represent your module.public_description
property should be text to outline what your module does and is displayed to account owners.url
property should be a URL for further information about this module. This is optional and leaving it blank will mean that a 'More Information' link is not displayed.The final method you need to call is publicise
. This tells Sirportly that you wish this module to be public and to be displayed on the Integration Options page in the Admin UI. If this is not selected, any module actions you configure (callbacks, macro actions, web actions etc...) will be invoked for all users.
The page incudes a a full list of all public modules and looks like the screenshot below: