Parameters
Parameters
Parameters may be set in the Config.xml plugin configuration file (see : )
The Config.xml is read by the Wedia system that auto-generates the UI for setting parameters.
Parameters section of the config.xml
The parameters are described in the config.xml section named "Parameters".
Wedia support the following parameter types :
int
string
text
boolean
mail
password
The following extract offer a sample configuration using all available types
<parameters>
<parameter name="the name of the parameter : this will be a variable, so only ASCII and no spaces" type="text,string,integer or boolean" mandatory="false or true" default="default value" description="A legible description for the parameter"/>
<parameter name="mynumber" type="int" mandatory="0" default="1" description="A value"></parameter>
<parameter name="mystring" type="string" mandatory="0" default="" description="a string"></parameter>
<parameter name="mytext" type="text" mandatory="0" default="" description="A big chuk of lorem ipsum"></parameter>
<parameter name="mybool" type="boolean" mandatory="0" default="true" description="lorem ipsum"></parameter>
<parameter name="email" type="mail" mandatory="1" default="" description="hello@test.com"></parameter>
<parameter name="pass" type="password" mandatory="1" default="" description="Your password"></parameter>
</parameters>
Localizing the parameter description
If you need to localize in multiple languages the parameter description, you can create new keys in a "plugin_(locale).properties" file in the /config directory of your plugin.
Keys for a specific parameter name should follow this pattern : parameter_<name>_description
For example : for an english (en) translation of mystring parameter :
create the <plugin>/config/plugin_en.properties
populate it with parameter_mystring_description = "This is my parameter description"
Using parameters in your code : the IPlugin interface
Once you are in a JSP that belongs to a Plugin, an object set in the request attributes implementing the com.noheto.plugins.IPlugin interface is available.
With this object, you can retrieve plugin informations such as name, version…​ (have a look at the API documentation) but also parameters values: ${plugin.parameters[parameter_name].value}
For example : the following config.xml describes a plugin with a single parameter :
<?xml version="1.0" encoding="UTF-8"?>
<root>
<info>
<version>1.0.0</version>
<authors></authors>
<site></site>
<tags></tags>
<shortdescription></shortdescription>
<description></description>
<example></example>
<faq></faq>
<installation></installation>
<requires></requires>
</info>
<parameters>
<parameter name="hello_to" description="Who should the plugin say hello to" type="string" mandatory="false" default="John Doe" value=""/>
</parameters>
</root>
This is will create the following Parameter tab :
Â
If you need to use it in our code, you can use the plugin.parameters.hello_to.value
<%@page pageEncoding="ISO-8859-15" %><%@taglib prefix="noheto" uri="/WEB-INF/noheto.tld" %><%@taglib prefix="c" uri="/WEB-INF/c.tld" %>
<noheto:skipPage test="${not pageContext.request.included}" />
<h1>Hello <c:out value="${plugin.parameters.hello_to.value}"/></h1>