1 <?xml version="1.0"?> |
1 <?xml version="1.0"?> |
2 <xsl:stylesheet xmlns:ns="beremiz" xmlns:definitions="definitions" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:func="http://exslt.org/functions" xmlns:epilogue="epilogue" xmlns:preamble="preamble" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:svg="http://www.w3.org/2000/svg" xmlns:cc="http://creativecommons.org/ns#" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:str="http://exslt.org/strings" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:exsl="http://exslt.org/common" xmlns:declarations="declarations" xmlns:debug="debug" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions" extension-element-prefixes="ns func exsl regexp str dyn" version="1.0"> |
2 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:exsl="http://exslt.org/common" xmlns:regexp="http://exslt.org/regular-expressions" xmlns:str="http://exslt.org/strings" xmlns:func="http://exslt.org/functions" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:cc="http://creativecommons.org/ns#" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:debug="debug" xmlns:preamble="preamble" xmlns:declarations="declarations" xmlns:definitions="definitions" xmlns:epilogue="epilogue" xmlns:ns="beremiz" version="1.0" extension-element-prefixes="ns func exsl regexp str dyn" exclude-result-prefixes="ns func exsl regexp str dyn debug preamble epilogue declarations definitions"> |
3 <xsl:output method="xml" cdata-section-elements="xhtml:script"/> |
3 <xsl:output cdata-section-elements="xhtml:script" method="xml"/> |
4 <xsl:variable name="svg" select="/svg:svg"/> |
4 <xsl:variable name="svg" select="/svg:svg"/> |
5 <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
5 <xsl:variable name="hmi_elements" select="//svg:*[starts-with(@inkscape:label, 'HMI:')]"/> |
6 <xsl:variable name="hmitree" select="ns:GetHMITree()"/> |
6 <xsl:variable name="hmitree" select="ns:GetHMITree()"/> |
7 <xsl:variable name="_categories"> |
7 <xsl:variable name="_categories"> |
8 <noindex> |
8 <noindex> |
2144 <xsl:text> apply_hmi_value(idx, new_val); |
2144 <xsl:text> apply_hmi_value(idx, new_val); |
2145 </xsl:text> |
2145 </xsl:text> |
2146 <xsl:text> }, |
2146 <xsl:text> }, |
2147 </xsl:text> |
2147 </xsl:text> |
2148 </xsl:template> |
2148 </xsl:template> |
|
2149 <xsl:template mode="widget_class" match="widget[@type='JsonTable']"> |
|
2150 <xsl:text>class JsonTableWidget extends Widget{ |
|
2151 </xsl:text> |
|
2152 <xsl:text> on_click(evt) { |
|
2153 </xsl:text> |
|
2154 <xsl:text> const query = { |
|
2155 </xsl:text> |
|
2156 <xsl:text> offset: '42', |
|
2157 </xsl:text> |
|
2158 <xsl:text> filter: '*powerloss*', |
|
2159 </xsl:text> |
|
2160 <xsl:text> args: this.args |
|
2161 </xsl:text> |
|
2162 <xsl:text> }; |
|
2163 </xsl:text> |
|
2164 <xsl:text> |
|
2165 </xsl:text> |
|
2166 <xsl:text> const options = { |
|
2167 </xsl:text> |
|
2168 <xsl:text> method: 'POST', |
|
2169 </xsl:text> |
|
2170 <xsl:text> body: JSON.stringify(query), |
|
2171 </xsl:text> |
|
2172 <xsl:text> headers: {'Content-Type': 'application/json'} |
|
2173 </xsl:text> |
|
2174 <xsl:text> } |
|
2175 </xsl:text> |
|
2176 <xsl:text> |
|
2177 </xsl:text> |
|
2178 <xsl:text> fetch(this.args[0], options) |
|
2179 </xsl:text> |
|
2180 <xsl:text> .then(res => res.json()) |
|
2181 </xsl:text> |
|
2182 <xsl:text> .then(res => console.log(res)); |
|
2183 </xsl:text> |
|
2184 <xsl:text> |
|
2185 </xsl:text> |
|
2186 <xsl:text> } |
|
2187 </xsl:text> |
|
2188 <xsl:text> init() { |
|
2189 </xsl:text> |
|
2190 <xsl:text> this.element.setAttribute("onclick", "hmi_widgets['"+this.element_id+"'].on_click(evt)"); |
|
2191 </xsl:text> |
|
2192 <xsl:text> } |
|
2193 </xsl:text> |
|
2194 <xsl:text>} |
|
2195 </xsl:text> |
|
2196 </xsl:template> |
2149 <xsl:template name="jump_widget_activity"> |
2197 <xsl:template name="jump_widget_activity"> |
2150 <xsl:param name="hmi_element"/> |
2198 <xsl:param name="hmi_element"/> |
2151 <xsl:call-template name="defs_by_labels"> |
2199 <xsl:call-template name="defs_by_labels"> |
2152 <xsl:with-param name="hmi_element" select="$hmi_element"/> |
2200 <xsl:with-param name="hmi_element" select="$hmi_element"/> |
2153 <xsl:with-param name="labels"> |
2201 <xsl:with-param name="labels"> |
2791 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
2839 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
2792 </xsl:comment> |
2840 </xsl:comment> |
2793 <xsl:comment> |
2841 <xsl:comment> |
2794 <xsl:apply-templates select="document('')/*/debug:*"/> |
2842 <xsl:apply-templates select="document('')/*/debug:*"/> |
2795 </xsl:comment> |
2843 </xsl:comment> |
2796 <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml"> |
2844 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
2797 <head/> |
2845 <head/> |
2798 <body style="margin:0;overflow:hidden;"> |
2846 <body style="margin:0;overflow:hidden;"> |
2799 <xsl:copy-of select="$result_svg"/> |
2847 <xsl:copy-of select="$result_svg"/> |
2800 <script> |
2848 <script> |
2801 <xsl:text> |
2849 <xsl:text> |