Working with the Dashboards tool enables the user to extend its functionality by connecting external modules (plugins).
Plugins are connected in the desktop application of Foresight Analytics Platform.
To connect a plugin to the desktop and web application:
Create a visualizer form. This form contains components that form plugin appearance, and a code that describes logic of component work in the plugin. The visualizer form must be inherited from the AdhocUserViewForm class. Features of visualizer form code:
If the plugin is required to support working with a data source, create an implementation of the AdhocUserViewForm.SaveSettings and AdhocUserViewForm.LoadSettings methods.
If the plugin is required to support working with certain data sources, create an implementation of the AdhocUserViewForm.SupportedSource property specifying in it ClassId of the required sources.
Create a master form. This form contains components that form side panel tabs that are used to set up the plugin, and a code that describes logic of applying settings to the plugin. The master form must be inherited from the AdhocUserMasterForm class.
Create a plugin js-script that will be used in the web application. The script must be described according to the JavaScript development specification. Features of plugin js-script are given in the JS Script Structure of Plugin section.
Place the created script to the directory with the installed web application.
Form the URL of the plugin js-script used in the web application.
Example of URL:
http://test/fp_App_v9.2/app/plugin.js
Where:
test. The name of the workstation that hosts the web application.
fp_App_v9.2. Name of the virtual directory that stores the web application.
app. Name of the physical directory, in which the web application plugin is located.
plugin.js. Plugin js-script.
Run the mule that contains the following procedure:
Sub AddPlugin;
Var
mb: IMetabase;
plugins: ISharedPlugins;
cont: ISharedPluginsContainer;
adhoc_plugs: ISharedAdhocPlugins;
plugin: ISharedAdhocPlugin;
Begin
// Get an object to work with the current repository
mb := MetabaseClass.Active;
// Get an object to work with plugin container
cont := mb.SpecialObject(MetabaseSpecialObject.SharedParams).Edit As ISharedPluginsContainer;
// Get an object to work with plugins
plugins := cont.Plugins;
// Get collection of plugins of the Dashboards tool
adhoc_plugs := plugins.AdhocPlugins;
// Create a new plugin
plugin := plugins.AdhocPlugins.Add;
// Set plugin name and identifier
plugin.Id := "ID"; // Instead of ID, determine a unique identifier of plugin in uppercase mathicng the identifier in the js script structure of plugin
plugin.Name := "name"; // Specify the plugin name that will be displayed in the dashboard instead of "name"
// Set visualizer form and master form
plugin.ViewForm := mb.ItemById("ViewForm_Id"); // Specify visualizer form identifier instead of "ViewForm_Id"
plugin.MasterForm := mb.ItemById("MasterForm_Id"); // Specify master form identifier instead of "MasterForm_Id"
// Set URL with js-script to be used in the web application
plugin.WebUrl := "url"; // Instead of url determine a relative path of plugin from the root directory of web application
// Save created plugin
(cont As IMetabaseObject).Save;
End Sub AddPlugin;
Activate plugin.
To connect a plugin to the desktop application only, follow the steps:
Create a visualizer form.
Create a master form.
Create a module that contains a procedure. Delete the string from the procedure code:
plugin.WebUrl := "url";
Execute the module.
A more detailed description of the steps is given above.
To connect a plugin to the web application only, follow the steps:
Create a plugin js-script.
Create a module that contains a procedure. Delete the strings from the procedure code:
plugin.ViewForm := mb.ItemById("ViewForm_Id");
plugin.MasterForm := mb.ItemById("MasterForm_Id");
Execute the module.
Activate plugin.
A more detailed description of the steps is given above.
See also: