Promotic
WikipediaLinkedInYoutubeTwitterFacebook

PmWebDir - Deatiled object description

See: Object PmWebDir
 
No other PROMOTIC objects can be created in this object. The PmWebDir object can be created in the PmWeb object. There can be even more PmWebDir objects in the PmWeb object.

The client requiring data from this WEB component is type of "PmDataClient" from the license point of view.

 
The viewer of this object can be opened, for example, by a panel button (in the PmPanel object) using the OpenView method. This is functional for both WEB and local panels. See also Object viewer open.
 
The object can offer (see the configurator "Data source"):
- The 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 configurator "Folder with files") 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 enables 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 actual 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 the key words 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 browser in the standard way. We recommend 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 picture.
- other extensions: pages are passed as the "application/octet-stream" device, which means for the Internet Explorer that it will access them as the download, which means that it downloads them to the specified place.
- dynamic texts created in script in the onPageModify event. This way, it is possible to create WEB pages, that will be created dynamicaly withou the need to read anything from a file on the disc. 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 PmWebDir object are accessible on the URL address:
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 page:
- set the Data source configurator to "Disk files in specified folder".
- set the Keywords use type configurator to "Every occurrence _(xx)_ in the file replace by xx keyword value".
- We create two keywords on the Keywords page. 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 data binding PP with the link, for example, to the appropriate PmData 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 of 2, which 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, it means to create many keywords. If there are many pages like this and each of them has its own keywords, it is then suitable to put these pages into separate folders and to create separate PmWebDir objects for them. Then the access to these pages will be more optimized and synoptical.
 
Thus the PmWebDir 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 PmReport object can be used. See also Overview of the WEB technology in the PROMOTIC system.
© MICROSYS, spol. s r. o.Tavičská 845/21 703 00 Ostrava-Vítkovice