CallBackery::GuiPlugin::Abstract - GuiPlugin base class
use Mojo::Base 'CallBackery::GuiPlugin::Abstract';
The abstract base class for callbackery gui classes.
The Plugin instance specific config section from the master config file.
The PLUGIN instance 'name' as specified in the
*** PLUGIN:... *** section.
The current user object
What should the tab holding this plugin be called
Should the plugin in the webui be instantiated immediately or only when the tab gets selected
Returns the Config::Grammar parser for the configuration of this plugin.
A very simple minded grammar to json-schema convertor with no magic. Better supply a proper schema.
the current controller
the app object
the log object
some meta information provided when instantiating the plugin. for example when buidling the response to getUserConfig, args will contain the output of getUrlConfig from the frontend in the key urlConfig, which will allow to pass information from the url to calls like checkAccess.
Returns the information for building a plugin configuration screen.
Check if the current user may access the Plugin. Override in the Child class to limit accessibility. By default plugins are not accessible unless you have numeric UID or the word
The CallBackery::Command::shell sets the userId to
__SHELL. If a plugin should be configurable interactively it must allow access to the
checkAccess can also return a promise or be an async method
may this gui plugin run for unauthenticated users ?
A list of files that contain the state of the settings configured by this plugin this is used both for backup purposes and to replicate the settings to a second installation.
a list of files to be removed when 'unConfiguring' a device
A map of callbacks that will be called according to events in the system. The following events are available:
All the methods of Mojo::Base plus:
Create a regular expression base validator function. The supplied regular expression gets anchored front and back automatically.
Walks a hash/array structure and removes all occurrences of the given key.
CODE references get turned into 'true' values and JSON true/false get passed on.
Take the data from the plug-in screen and process them.
Receive current data for plug-in screen content.
Re-generate all configuration that does not require direct user input. This function may be called from within action handlers to apply newly acquired data to to the running system.
Validate user supplied data prior to acting on it.
A very simpleminded grammar merger with no recursion. For identical keys, the later instance wins.
Returns a compiler sub reference for use in configuration variables or _text sections with perl syntax. The resulting sub will provide access to a hash called $variableName.
Allow the plugin to 'massage' the config hash ... doing this requires deep knowledge of the cfg structure ...
Render the given template and write the result into the given file. These templates support the Mojo::Template language enhanced by the command
L('Plugin::key') which looks up values from the config database. The convention is that each plugin writes data in it's own namespace.
If the destination already exists, the method compares the current content with the new one. It will only update the file if the content differs.
The method returns 0 when there was no change and 1 when a new version of the file was written.
These additional commands are available to the templates.
Read a config value from the database.
Save a config value to the database.
A version of the system function that makes sure to NOT to inherit any extra filehandles to the kids and sends the output of the call system log file. I would suggest to use this in preference to the normal system function. Especially when launching daemons since Mojo seems to fiddle with $^F and will thus inherit open sockets to child processes.
If the binary name starts with -, the output will be ignored ... this can be necessary for programs starting daemons that do not close their output. Otherwhise you will read the output of the daemon and NOT terminate. We are also using kill 0 to check if the process is still active.
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
Copyright (c) 2013 by OETIKER+PARTNER AG. All rights reserved.
Tobias Oetiker <email@example.com>
2013-12-16 to 1.0 first version