author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Sun, 19 Apr 2020 10:48:34 +0200 | |
branch | svghmi |
changeset 2940 | 034b6ce4f885 |
parent 2938 | 1379cd5c69dd |
permissions | -rw-r--r-- |
2938
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
1 |
function "scripts" |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
2 |
{ |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
3 |
| |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
4 |
| id = idstr => document.getElementById(idstr); |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
5 |
| |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
6 |
| var hmi_hash = [«$hmitree/@hash»]; |
2779
75c6a31caca6
SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents:
2763
diff
changeset
|
7 |
|
2938
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
8 |
| var hmi_widgets = { |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
9 |
apply "$hmi_elements", mode="hmi_elements"; |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
10 |
| } |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
11 |
| |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
12 |
| var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»; |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
13 |
| |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
14 |
| var hmitree_types = [ |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
15 |
|
2938
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
16 |
foreach "$indexed_hmitree/*" { |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
17 |
| /* «@index» «@hmipath» */ "«substring(local-name(), 5)»"`if "position()!=last()" > ,` |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
18 |
} |
2753
9a7e12e96399
SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff
changeset
|
19 |
|
2938
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
20 |
| ] |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
21 |
| |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
22 |
|
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
23 |
| var detachable_elements = { |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
24 |
foreach "$detachable_elements"{ |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
25 |
| "«@id»":[id("«@id»"), id("«../@id»")]`if "position()!=last()" > ,` |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
26 |
} |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
27 |
| } |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
28 |
|
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
29 |
| |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
30 |
| var page_desc = { |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
31 |
apply "$hmi_pages", mode="page_desc"; |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
32 |
| } |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
33 |
|
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
34 |
| var keypads = { |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
35 |
foreach "$keypads_descs"{ |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
36 |
const "keypad_id","@id"; |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
37 |
foreach "arg"{ |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
38 |
const "g", "$geometry[@Id = $keypad_id]"; |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
39 |
| "«@value»":["«$keypad_id»", «$g/@x», «$g/@y»], |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
40 |
} |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
41 |
} |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
42 |
| } |
2792
0c0d3895b036
SVGHMI: moved/fixed some templates, avoided namespace problems, added parsing of HMI:* inkscape labels
Edouard Tisserant
parents:
2791
diff
changeset
|
43 |
|
2790
8fab1886ebec
SVGHI: compute hmitree variables ordered index in xslt
Edouard Tisserant
parents:
2789
diff
changeset
|
44 |
|
2938
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
45 |
| |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
46 |
| var default_page = "«$default_page»"; |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
47 |
| var svg_root = id("«/svg:svg/@id»"); |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
48 |
include text svghmi.js |
1379cd5c69dd
SVGHMI: Added scripts.ysl2
Edouard Tisserant <edouard.tisserant@gmail.com>
parents:
2937
diff
changeset
|
49 |
} |
2879 | 50 |