LoxBerry::Web::loglevel_select_html

$html = LoxBerry::Web::loglevel_select_html( %params );

 

Returns ready HTML code for the plugin loglevel dropdown list. The loglevel setting of the html is saved in the LoxBerry plugin database, therefore this is the same selection as in the plugin management.

LoxBerry Compatibility

This function is available starting with LoxBerry V1.2.5. If you use that function, set this minimum version in your plugin.cfg.

The function returns a string with HTML code to show a user dropdown to select the loglevel for this plugin. With parameters, you can control the visuals. The current loglevel is automatically preselected from the plugin database.

To give parameters to the function, use named parameters.

Your plugin needs to enable CUSTOM_LOGLEVELS=true in the plugin.cfg, otherwise the function returns an empty string and warns in STDERR.

Parameter

Case sensitivity

All parameter names are case-sensitive and written in capital letters.

ParameterOptionalUsage
LABEL x By default, LoxBerry uses the language specific default label "Loglevel" as label for the dropdown.

* To use a userdefined preceding label, use the LABEL parameter with your (language specific) string.
* To disable the label tag in the html, use LABEL => "".
FORMID x This is the name and id of the form element. This name is used on submitting a form, or reading the value with JavaScript.

Default is "select_loglevel".
DATA_MINIx By default, the function uses the jQuery Mobile tag data-mini="true". To have the full-sized button, send DATA_MINI ⇒ "0".
PLUGIN x The function automatically detects your plugin.

If the detection fails, it will raise a warning to STDERR. In this case, send your lbpplugindir Variable to PLUGIN.

Return value

Returns a string that is the HTML and JavaScript code for the loglevel selection. Simply print the result of the function to your webpage, or send it to your HTML::Template.

Usage

use LoxBerry::Web;
# For default settings, no parameters are needed
my $loglevelhtml = LoxBerry::Web::loglevel_select_html();
 
 
# Use the form id 'loglevel', and don't use DATA_MINI
my $loglevelhtml = LoxBerry::Web::loglevel_select_html( FORM => 'loglevel', DATA_MINI => 0 );
 
# If a HTML::Template object is used, send the html to the template
$maintemplate->param('LOGLEVEL', $loglevelhtml);