svghmi/gen_index_xhtml.ysl2
branchsvghmi
changeset 2938 1379cd5c69dd
parent 2937 9226a830fbc3
child 2939 4296ab974d4d
equal deleted inserted replaced
2937:9226a830fbc3 2938:1379cd5c69dd
    33 
    33 
    34     include widgets_common.ysl2
    34     include widgets_common.ysl2
    35 
    35 
    36     include widget_*.ysl2
    36     include widget_*.ysl2
    37 
    37 
       
    38     include scripts.ysl2
       
    39 
    38     template "*[namespace-uri()='reflect']", mode="debug_as_comment" {
    40     template "*[namespace-uri()='reflect']", mode="debug_as_comment" {
    39         comment {
    41         comment {
    40             | «local-name()» :
    42             | «local-name()» :
    41             apply ".", mode="debug";
    43             apply ".", mode="debug";
    42         }
    44         }
    59                     call "scripts";
    61                     call "scripts";
    60                 }
    62                 }
    61             }
    63             }
    62         }
    64         }
    63     }
    65     }
    64 
       
    65     function "scripts"
       
    66     {
       
    67         |
       
    68         | id = idstr => document.getElementById(idstr);
       
    69         |
       
    70         | var hmi_hash = [«$hmitree/@hash»]; 
       
    71 
       
    72         | var hmi_widgets = {
       
    73         apply "$hmi_elements", mode="hmi_elements";
       
    74         | }
       
    75         |
       
    76         | var heartbeat_index = «$indexed_hmitree/*[@hmipath = '/HEARTBEAT']/@index»;
       
    77         |
       
    78         | var hmitree_types = [
       
    79 
       
    80         foreach "$indexed_hmitree/*" {
       
    81         |     /* «@index»  «@hmipath» */ "«substring(local-name(), 5)»"`if "position()!=last()" > ,`
       
    82         }
       
    83 
       
    84         | ]
       
    85         |
       
    86 
       
    87         | var detachable_elements = {
       
    88         foreach "$detachable_elements"{
       
    89         |     "«@id»":[id("«@id»"), id("«../@id»")]`if "position()!=last()" > ,`
       
    90         }
       
    91         | }
       
    92 
       
    93         |
       
    94         | var page_desc = {
       
    95         apply "$hmi_pages", mode="page_desc";
       
    96         | }
       
    97 
       
    98         | var keypads = {
       
    99         foreach "$keypads_descs"{
       
   100             const "keypad_id","@id";
       
   101             foreach "arg"{
       
   102                 const "g", "$geometry[@Id = $keypad_id]"; 
       
   103         |     "«@value»":["«$keypad_id»", «$g/@x», «$g/@y»],
       
   104             }
       
   105         }
       
   106         | }
       
   107 
       
   108 
       
   109         |
       
   110         | var default_page = "«$default_page»";
       
   111         | var svg_root = id("«/svg:svg/@id»");
       
   112         include text svghmi.js
       
   113     }
       
   114 }
    66 }