Skip to content

Commit e578e3d

Browse files
committed
documentation update
1 parent 2b7449e commit e578e3d

File tree

1 file changed

+64
-64
lines changed

1 file changed

+64
-64
lines changed

README.md

Lines changed: 64 additions & 64 deletions
Original file line numberDiff line numberDiff line change
@@ -114,15 +114,15 @@ Changing the compile-time variables of PEB requires editing its project file - `
114114
To make a bundle-less binary, which is the default setting:
115115

116116
```QMake
117-
BUNDLE = 0
118-
CONFIG -= app_bundle
117+
BUNDLE = 0
118+
CONFIG -= app_bundle
119119
```
120120

121121
To make a bundled binary (peb.app):
122122

123123
```QMake
124-
BUNDLE = 1
125-
CONFIG += app_bundle
124+
BUNDLE = 1
125+
CONFIG += app_bundle
126126
```
127127

128128
<a name="security-compile-time-variables"></a>
@@ -149,10 +149,10 @@ The following two compile-time variables can tighten further the security of PEB
149149

150150
## Supported Perl Script Types
151151
PEB recognizes four main types of local Perl scripts:
152-
* [**noninteractive scripts**](#noninteractive-perl-scripts),
153-
* [**interactive scripts**](#interactive-perl-scripts),
154-
* [**AJAX scripts**](#ajax-perl-scripts) and
155-
* [**Linux superuser scripts**](#linux-superuser-perl-scripts).
152+
* [**noninteractive scripts**](#noninteractive-perl-scripts)
153+
* [**interactive scripts**](#interactive-perl-scripts)
154+
* [**AJAX scripts**](#ajax-perl-scripts)
155+
* [**Linux superuser scripts**](#linux-superuser-perl-scripts)
156156
PEB does not impose execution timeout on any Perl scripts.
157157

158158
## Noninteractive Perl Scripts
@@ -176,21 +176,21 @@ They can not receive any user input once they are started and they are divided i
176176
There is no special naming convention for noninteractive scripts. They can be called from hyperlinks or HTML forms using a full HTTP URL with the PEB pseudo-domain or a relative path. If a relative path is used, the PEB pseudo-domain will be added automatically. The following code is an example of a POST request to a local Perl script from an HTML form with no use of JavaScript:
177177

178178
```html
179-
<form action="http://local-pseudodomain/perl/test.pl" method="post">
180-
<input type="text" id="value1" name="value1" placeholder="Value 1" title="Value 1">
181-
<input type="text" id="value2" name="value2" placeholder="Value 2" title="Value 2">
182-
<input type="submit" value="Submit">
183-
</form>
179+
<form action="http://local-pseudodomain/perl/test.pl" method="post">
180+
<input type="text" id="value1" name="value1" placeholder="Value 1" title="Value 1">
181+
<input type="text" id="value2" name="value2" placeholder="Value 2" title="Value 2">
182+
<input type="submit" value="Submit">
183+
</form>
184184
```
185185

186186
## Interactive Perl Scripts
187187
PEB interactive Perl scripts have their own event loops waiting constantly for new data on STDIN and that allows them to have bidirectional connection with PEB. There can be many interactive scripts per browser window, but each of them must have an unique file name. Interactive scripts must be started with the special pseudo-user ``interactive`` and with the query string items ``target``, ``close_command`` and ``close_confirmation``.
188188

189-
The pseudo-user ``interactive`` is the token used by PEB to distinguish between interactive and all other scripts.
189+
The pseudo-user ``interactive`` is the token used by PEB to detect interactive scripts.
190190

191191
The ``target`` query string item should point to a valid HTML DOM element or to a valid JavaScript function. Every piece of script output is inserted immediately into the target DOM element of the calling page or passed to the specified JavaScript function as its first and only function argument. The calling page must not be reloaded during the script execution or no script output will be inserted.
192192

193-
The ``close_command`` query string item should contain the command used to initiate the shutdown sequence of the interactive script when the containing PEB window is going to be closed. Upon receiving it, the interactive script must start its shutdown procedure. Immediately before exiting the interactive script must print on STDOUT its ``close_confirmation`` to signal PEB that it completed normally its shutdown. If PEB receives no ``close_confirmation`` in 5 seconds, it will kill the process of the interactive script.
193+
The ``close_command`` query string item designates the command used to shut down an interactive script when the containing PEB window is going to be closed. Upon receiving it, the interactive script must start its shutdown procedure. Immediately before exiting the interactive script must print on STDOUT its ``close_confirmation`` to signal PEB that it completed normally its shutdown. If PEB receives no ``close_confirmation`` from all interactive scripts in the window that is going to be closed in 5 seconds, it will kill the processes of all unresponsive interactive scripts.
194194

195195
The following JavaScript code demonstartes how to start an interactive Perl script immediately after its calling HTML page is loaded:
196196

@@ -251,10 +251,10 @@ PEB is designed to run from any directory without setting anything beforehand an
251251
Data directory is not hard-coded in C++ code, but a separation of data files from code is generally a good practice. Data directory should contain any SQLite or flat file database or other data files, that a PEB-based application is going to use or produce. The recommended path for data directory is inside the ``{PEB_binary_directory}/resources`` directory. ``data`` is a good directory name, although not mandatory. Perl scripts can access this folder using the following code:
252252

253253
```perl
254-
use Cwd;
254+
use Cwd;
255255

256-
my $current_working_directory = cwd();
257-
my $data_directory = "$current_working_directory/resources/data";
256+
my $current_working_directory = cwd();
257+
my $data_directory = "$current_working_directory/resources/data";
258258
```
259259

260260
* **Perl interpreter:**
@@ -280,40 +280,40 @@ They have two functions:
280280
Using the following code any local HTML page can have custom labels on the default right-click context menu (if the ``contextmenu`` event is not already intercepted):
281281

282282
```javascript
283-
function pebContextMenu() {
284-
var contextMenuObject = new Object();
283+
function pebContextMenu() {
284+
var contextMenuObject = new Object();
285285

286-
contextMenuObject.printPreview = "Custom Print Preview Label";
287-
contextMenuObject.print = "Custom Print Label";
286+
contextMenuObject.printPreview = "Custom Print Preview Label";
287+
contextMenuObject.print = "Custom Print Label";
288288

289-
contextMenuObject.cut = "Custom Cut Label";
290-
contextMenuObject.copy = "Custom Copy Label";
291-
contextMenuObject.paste = "Custom Paste Label";
292-
contextMenuObject.selectAll = "Custom Select All Label";
289+
contextMenuObject.cut = "Custom Cut Label";
290+
contextMenuObject.copy = "Custom Copy Label";
291+
contextMenuObject.paste = "Custom Paste Label";
292+
contextMenuObject.selectAll = "Custom Select All Label";
293293

294-
return JSON.stringify(contextMenuObject);
295-
}
294+
return JSON.stringify(contextMenuObject);
295+
}
296296
```
297297

298298
* **Custom or translated labels for JavaScript dialog boxes:**
299299
<a name="custom-or-translated-labels-for-javascript-dialog-boxes"></a>
300300
Using the following code any local HTML page can have custom labels on the default JavaScript *Alert*, *Confirm* and *Prompt* dialog boxes:
301301

302302
```javascript
303-
function pebMessageBoxElements() {
304-
var messageBoxElementsObject = new Object();
303+
function pebMessageBoxElements() {
304+
var messageBoxElementsObject = new Object();
305305

306-
messageBoxElementsObject.alertTitle = "Custom Alert Label";
307-
messageBoxElementsObject.confirmTitle = "Custom Confirmation Label";
308-
messageBoxElementsObject.promptTitle = "Custom Prompt Label";
306+
messageBoxElementsObject.alertTitle = "Custom Alert Label";
307+
messageBoxElementsObject.confirmTitle = "Custom Confirmation Label";
308+
messageBoxElementsObject.promptTitle = "Custom Prompt Label";
309309

310-
messageBoxElementsObject.okLabel = "Custom Ok Label";
311-
messageBoxElementsObject.cancelLabel = "Custom Cancel Label";
312-
messageBoxElementsObject.yesLabel = "Custom Yes Label";
313-
messageBoxElementsObject.noLabel = "Custom No Label";
310+
messageBoxElementsObject.okLabel = "Custom Ok Label";
311+
messageBoxElementsObject.cancelLabel = "Custom Cancel Label";
312+
messageBoxElementsObject.yesLabel = "Custom Yes Label";
313+
messageBoxElementsObject.noLabel = "Custom No Label";
314314

315-
return JSON.stringify(messageBoxElementsObject);
316-
}
315+
return JSON.stringify(messageBoxElementsObject);
316+
}
317317
```
318318

319319
* **Warning for unsaved user input before closing a window:**
@@ -333,20 +333,20 @@ They have two functions:
333333
The following code is an example of both synchronous and asynchronous warning functions. It is expected that one of them will be present in a PEB-based application where user data is to be protected against accidental loss. If both functions are present, the asynchronous one will take precedence. The asynchronous function in the example code is implemented using [Alertify.js](http://alertifyjs.com/).
334334

335335
```javascript
336-
function pebCloseConfirmationSync() {
337-
var confirmation = confirm("Are you sure you want to close the window?");
338-
return confirmation;
339-
}
340-
341-
function pebCloseConfirmationAsync() {
342-
alertify.set({labels: {ok : "Ok", cancel : "Cancel"}});
343-
alertify.set({buttonFocus: "cancel"});
344-
alertify.confirm("Are you sure you want to close the window?", function (confirmation) {
345-
if (confirmation) {
346-
window.location.href = "http://local-pseudodomain/close-window.function";
347-
}
348-
});
349-
}
336+
function pebCloseConfirmationSync() {
337+
var confirmation = confirm("Are you sure you want to close the window?");
338+
return confirmation;
339+
}
340+
341+
function pebCloseConfirmationAsync() {
342+
alertify.set({labels: {ok : "Ok", cancel : "Cancel"}});
343+
alertify.set({buttonFocus: "cancel"});
344+
alertify.confirm("Are you sure you want to close the window?", function (confirmation) {
345+
if (confirmation) {
346+
window.location.href = "http://local-pseudodomain/close-window.function";
347+
}
348+
});
349+
}
350350
```
351351

352352
## Security
@@ -394,17 +394,17 @@ They have two functions:
394394
The following code is an example of how to select a local file and transmit its full path to a local Perl script using [jQuery](https://jquery.com/):
395395

396396
```javascript
397-
function fileSelection(file) {
398-
$.ajax({
399-
url: 'http://local-pseudodomain/perl/open-file.pl',
400-
data: {filename: file},
401-
method: 'POST',
402-
dataType: 'text',
403-
success: function(data) {
404-
document.write(data);
405-
}
406-
});
407-
}
397+
function fileSelection(file) {
398+
$.ajax({
399+
url: 'http://local-pseudodomain/perl/open-file.pl',
400+
data: {filename: file},
401+
method: 'POST',
402+
dataType: 'text',
403+
success: function(data) {
404+
document.write(data);
405+
}
406+
});
407+
}
408408
```
409409

410410
* **Select multiple files:** ``http://local-pseudodomain/open-files.function?target=DOM_element``

0 commit comments

Comments
 (0)