pCOWeb
+030220966 – rel. 1.1 – 12.12.2017
79
STRUCTURE OF A
pCOWeb
PLUGIN
APPENDIX I
For the description and the installation of the Plugins, see 9.7 on page 47.
A Plugin is made up of six elements (
Figure I.a
):
•
Configuration files (“conf_users” directory)
•
HTML configuration page (“plugins” directory)
•
Executable files (“bin_users” directory)
•
Start-up scripts (directory “rc_users” directory)
•
Plugin name (contained in the “pluginname” file)
•
Installation directory (“install-plug-xxx”)
IMPORTANT: The position of the files in the Plugin is essential for the correct
installation and uninstallation of the Plugin.
Figure I.a - Elements making up a Plugin
In the following descriptions the examples refer to the NTP Plugin (Network Time Protocol) for the automatic synchronisation of the
pCOWeb
clock with a time
server, using the NTP protocol; the Plugin is available at
http://ksa.carel.com
.
NOTE: the following example is shown as reference but there is no more need to add a dedicate NTP plugin as NTP synchronization can be achieved
directly as described in Section
5.3
.
CONFIGURATION FILES
These are ALL the files in the “conf_users” directory of the Plugin being installed.
They contain all the settings defined by the user to customize the functions of the Plugin.
During installation these files are copied to the “/usr/local/root/flash/conf_users/” directory, which corresponds to the $CONF_USERS system variable.
To create or edit a configuration file, use the Plugin web pages or edit it manually using a text editor, accessing the user memory via FTP or SCP.
The NTP Plugin only contains the file called “ntp_client.conf”, which includes the following line:
1: NTP_URL=10.0.0.131
that defines the IP address of the NTP server used for communication.
HTML CONFIGURATION PAGES
These are ALL the files in the “plugins” directory of the Plugin being installed. They are the HTML pages used to create the configuration files required for the
correct use of the Plugin, and they must be installed in the “/usr/local/root/flash/http/plugins/” directory.
NOTE
: The presence of .html or .htm files inside the Plugins directory will ensure that the “Configuration / Plugins” section (see
Figure 9.m
on page 47)
contains the link to the configuration page (“Network time Protocol”), and the text “No plugins installed” is no longer displayed; for this reason, when
developing a Plugin, at least one HTML page for configuration should be provided, containing at least the name of the Plugin.
Structure of the ntp_client.html page for configuring the NTP Plugin
Below are the contents of the ‘ntp_client.html’ file; the sections of interest are highlighted in bold and commented on individually; the rest is the HTML code
required to correctly generate the page.
1
<!--pluginname=Network time Protocol-->
2
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
3 <html>
4
<!--tagparser="/pcotagfilt"-->
5 <head>
6
<meta content="text/html; charset=ISO-8859-15" http-equiv="content-type">
7
<title>pCOWeb Ntp client configuration</title>
8 </head>
9
10 <script
type="text/javascript">
11 function
modify(obj)
12 {
13 if
(document.getElementById(obj).style.visibility=="visible")
14
document.getElementById(obj).style.visibility="hidden";
15 else
16
document.getElementById(obj).style.visibility="visible";
17 }
18 </script>
19
20
<h1>pCOWeb ftp client System Configuration</h1>
21
<div style="color: #999999; font-size: 14px">pCOWeb Ntp client configuration</div>
22
23
<form method="POST" action="">
24
<h4>Ntp client configuration parameters:</h4>
25 <table>
26 <tr>
27
<td><B>Ntp server Address:
</B></td>
28 </tr>
29 <tr>
30
<td><%getdb('conf_users/ntp_client.conf','NTP_URL')%></td>
31
<td><a href=javascript:modify("ntp_url")> Modify </a></td>
32
<td><input id=ntp_url style="visibility: hidden" type="text"
name="?script:setdb('conf_users/ntp_client.conf','NTP_URL')"
value="<%getdb('conf_users/ftp_client.conf','NTP_URL')%>"></td>
33 </tr>
34 </table>
35 <p>
36
<input type="submit" value="Submit">
37 </form>
38 <br>
39
<a href="/config/scanplugins.cgi">Back to plugins page</a>
40 </html>