See: the
PmaWebDir object.
The viewer of this object can be opened, for example, in a panel button (in the
PmaPanel object) by the
Pm.CreateView method. This is functional for for
Web panels and for local panels. See also
Opening the viewer of the PmaWeb object and its subobjects PmaWebDir, PmaWebFolder, PmaWebLang or PmaWebInfo.
The object can offer (see the "
Data source" configurator):
-
Files that are placed in the specified folder on the disk. The client asks for a file, the object finds the file in specified folder (see the "
Folder with files" configurator) and sends it to the client. This wouldn't be always too useful because only static pages were offered by this. That's why the object has the concept that allows to
change the static file on the disk
to the actual state before its sending to the client. It is enabled
by keywords that can be written into the static HTML page and these keywords are replaced by the current values before its sending. Thus the keyword can be replaced, for example, by the number representing the temperature, it can be replaced by the background color, it can be even replaced by a piece of HTML text and thus to display various information in various time.
The replacing of keywords is performed only over files with the extension
*.htm,
*.html,
*.xml and
*.txt.
If the client requires the
default.htm file and this file can't be found on the disk, then the object automatically generates and provides the page where the list of files in the specified folder is offered with references to them.
Offered pages can have following extensions:
-
.htm, .html, .xml or .txt: pages are displayed in the Web browser in the standard way.
It is recommended to create this text files in
UTF-8 format or if it is not possible in appropriate code pages. There are some troubles with wieving files in
UTF-16 format.
- .bmp, .jpg or .gif: pages are displayed as a image.
- other extensions: pages are passed as the "application/octet-stream" device, which means that for the Web browser it will access them as the download, it means that it downloads them to the specified place.
-
dynamic texts created in the script in the
onPageModify event. This way, it is possible to create Web pages, that will be created dynamically without the need to read anything from the file on the disk. The Web files with following extensions can be offered
*.htm,
*.html,
*.xml and
*.txt.
From the Web client point of view the files offered by the
PmaWebDir object are accessible at URL:
http://ComputerName/ComponentId/file.ext
where
file.ext is the requested filename.
Example: We want to have the HTML page that will display only the temperature of the boiler. This value has to get red if the temperature is greater than 80 degrees, otherwise it is black.
- On the
"WebDir" tab set:
- the "
Data source" configurator to "
Disk files in specified folder".
- the "
Keywords use type" configurator to "
Every occurrence _(xx)_ in the file replace by xx keyword value".
- We create two keywords on the "
Keywords" tab. The first one has the name "
Temperat", it is of the
Integer type and we'll feed it in the application by the temperature value of the boiler (we can use the "
PP - Data binding to Pma object property" data binding with the link, for example, to the appropriate
PmaData object). The second keyword has the name "
Color", it is of the
String type and we'll feed it in the application by the text either
"black" or
"red" (dependent of the temperature).
Then we can create the HTML page with the following content:
<html>
<head>
<meta http-equiv="Refresh" content="2">
<title>Boiler temperature</title>
</head>
<body>
<p style="color:_(Color)_">Boiler temperature is _(Temperat)_ degrees</p>
</body>
</html>
This example is of course very unimportant and it serves only for throwing light into the principles. The
<meta> tag is set by the
Refresh parameter to the value
2 (it means that the page is automatically refreshed every 2 seconds).
The way of creating HTML pages itself for this object isn't already the thing of the PROMOTIC system because many other programs exist that are focused on creating HTML pages. It is for example the
Microsoft ExpressionWeb or the
Visual InterDev but the HTML expert can create even these pages in common text editors like the
Notepad - as we did it in the above mentioned example.
If you require HTML pages with many data, then it means to create many keywords. If there are many pages like this and each of them has its own keywords, then it is then suitable to put these pages into separate folders and to create separate
PmaWebDir objects for them. Then the access to these pages will be more optimized and synoptical.
Thus the
PmaWebDir object can provide Web pages that will automatically change and thus they will provide overview of the actual state of the visualized process. It is a very simple object with basic features. For much more universal way of offering the HTML pages,
the PmaReport object can be used. See also
Overview of the Web technology in the PROMOTIC system.