Wiki source for Plugins


Show raw source

For the discussion of building of Plugins for integration with webERP.

Plugins should have a Gui, so the user can select which ones they want to run. With options specific to that plugin then available

This Gui interacts with the www_users table in order to set what plugins load for the user's session.

To be added to the www_users table:
`plugins` tinytext,
`pluginoptions` tinytext,

The plugins need to reside in subfolders of a plugins directory. PHP's scandir can parse the plugins directory for plugin names and populate a Plugins table.

The plugins table could look something like this:
CREATE TABLE IF NOT EXISTS `plugins` (
`pluginid` int(4) NOT NULL auto_increment,
`pluginname` varchar(255) NOT NULL,
`pluginlocation` varchar(255) NOT NULL,
`pluginsecurity` int(5) NOT NULL,
`plugindescription` text,
PRIMARY KEY (`pluginid`)
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1 ;


Some of these fields need to be parsed by the script that populates the plugins table. Therefore there needs to be a standard method of providing that information to the script, eg XML file. Then the plugin developer can create the plugin, and the administrator simply needs to copy the standard plugin's code into the /plugins directory to install it - couldn't be easier.

For example, Plugin XYZ comes with the files:
header.inc - The includes that the xyz engine needs to make stuff happen/display from the header - extra PHPs or Javascripts
footer.inc - The includes that the xyz engine needs to make stuff happen/display in the footer
xyz.php - The xyz engine, most likely containing a class. This class has methods of the pluginoptions
xyz.xml - Provides information to the script to load pluginname, pluginsecurity, plugindescription, pluginoptions and their settings
xyz.css - The css file that plugin xyz uses

So the includes/header.inc and footer.inc checks to see whether the current session plugin variable is true, if so, it loads a plugins.php.

The plugins.php checks what plugins are assigned to the user from the www_users.plugins field, and includes the plugins, actioning the plugins according to specific options that are in www_users.pluginoptions. eg the plugin "browncow" is enabled, and the only options for this are "milking time" or "mooing" or "eat grass", but there may be further sub variables to pass. So the pluginoptions field may contain the value: browncow.mooing.loud,




Valid XHTML :: Valid CSS: :: Powered by WikkaWiki