1 <?xml version="1.0"?> |
1 <?xml 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"> |
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"> |
3 <xsl:output cdata-section-elements="xhtml:script" method="xml"/> |
3 <xsl:output method="xml" cdata-section-elements="xhtml:script"/> |
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> |
256 </xsl:template> |
256 </xsl:template> |
257 <xsl:template mode="genlabel" match="path"> |
257 <xsl:template mode="genlabel" match="path"> |
258 <xsl:text>@</xsl:text> |
258 <xsl:text>@</xsl:text> |
259 <xsl:value-of select="@value"/> |
259 <xsl:value-of select="@value"/> |
260 <xsl:if test="string-length(@min)>0 or string-length(@max)>0"> |
260 <xsl:if test="string-length(@min)>0 or string-length(@max)>0"> |
261 <xsl:text>:</xsl:text> |
261 <xsl:text>,</xsl:text> |
262 <xsl:value-of select="@min"/> |
262 <xsl:value-of select="@min"/> |
263 <xsl:text>:</xsl:text> |
263 <xsl:text>,</xsl:text> |
264 <xsl:value-of select="@max"/> |
264 <xsl:value-of select="@max"/> |
265 </xsl:if> |
265 </xsl:if> |
266 </xsl:template> |
266 </xsl:template> |
267 <xsl:template mode="genlabel" match="widget"> |
267 <xsl:template mode="genlabel" match="widget"> |
268 <xsl:text>HMI:</xsl:text> |
268 <xsl:text>HMI:</xsl:text> |
1733 </xsl:text> |
1733 </xsl:text> |
1734 <xsl:text> |
1734 <xsl:text> |
1735 </xsl:text> |
1735 </xsl:text> |
1736 </xsl:template> |
1736 </xsl:template> |
1737 <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/> |
1737 <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/> |
1738 <xsl:key name="TypesKey" match="widget" use="@type"/> |
1738 <xsl:key use="@type" name="TypesKey" match="widget"/> |
1739 <declarations:hmi-classes/> |
1739 <declarations:hmi-classes/> |
1740 <xsl:template match="declarations:hmi-classes"> |
1740 <xsl:template match="declarations:hmi-classes"> |
1741 <xsl:text> |
1741 <xsl:text> |
1742 </xsl:text> |
1742 </xsl:text> |
1743 <xsl:text>/* </xsl:text> |
1743 <xsl:text>/* </xsl:text> |
5083 </xsl:text> |
5083 </xsl:text> |
5084 <xsl:text> if(this.active) { |
5084 <xsl:text> if(this.active) { |
5085 </xsl:text> |
5085 </xsl:text> |
5086 <xsl:text> /* show active */ |
5086 <xsl:text> /* show active */ |
5087 </xsl:text> |
5087 </xsl:text> |
5088 <xsl:text> this.active_elt.setAttribute("style", this.active_elt_style); |
5088 <xsl:text> this.active_elt.style.display = ""; |
5089 </xsl:text> |
5089 </xsl:text> |
5090 <xsl:text> /* hide inactive */ |
5090 <xsl:text> /* hide inactive */ |
5091 </xsl:text> |
5091 </xsl:text> |
5092 <xsl:text> this.inactive_elt.setAttribute("style", "display:none"); |
5092 <xsl:text> this.inactive_elt.style.display = "none"; |
5093 </xsl:text> |
5093 </xsl:text> |
5094 <xsl:text> } else { |
5094 <xsl:text> } else { |
5095 </xsl:text> |
5095 </xsl:text> |
5096 <xsl:text> /* show inactive */ |
5096 <xsl:text> /* show inactive */ |
5097 </xsl:text> |
5097 </xsl:text> |
5098 <xsl:text> this.inactive_elt.setAttribute("style", this.inactive_elt_style); |
5098 <xsl:text> this.inactive_elt.style.display = ""; |
5099 </xsl:text> |
5099 </xsl:text> |
5100 <xsl:text> /* hide active */ |
5100 <xsl:text> /* hide active */ |
5101 </xsl:text> |
5101 </xsl:text> |
5102 <xsl:text> this.active_elt.setAttribute("style", "display:none"); |
5102 <xsl:text> this.active_elt.style.display = "none"; |
5103 </xsl:text> |
5103 </xsl:text> |
5104 <xsl:text> } |
5104 <xsl:text> } |
5105 </xsl:text> |
5105 </xsl:text> |
5106 <xsl:text> } |
5106 <xsl:text> } |
5107 </xsl:text> |
5107 </xsl:text> |
5108 <xsl:text> |
5108 <xsl:text> |
5109 </xsl:text> |
5109 </xsl:text> |
|
5110 <xsl:text> update_disability() { |
|
5111 </xsl:text> |
|
5112 <xsl:text> if(this.disabled) { |
|
5113 </xsl:text> |
|
5114 <xsl:text> /* show disabled */ |
|
5115 </xsl:text> |
|
5116 <xsl:text> this.disabled_elt.style.display = ""; |
|
5117 </xsl:text> |
|
5118 <xsl:text> /* hide inactive */ |
|
5119 </xsl:text> |
|
5120 <xsl:text> this.inactive_elt.style.display = "none"; |
|
5121 </xsl:text> |
|
5122 <xsl:text> /* hide active */ |
|
5123 </xsl:text> |
|
5124 <xsl:text> this.active_elt.style.display = "none"; |
|
5125 </xsl:text> |
|
5126 <xsl:text> } else { |
|
5127 </xsl:text> |
|
5128 <xsl:text> /* hide disabled */ |
|
5129 </xsl:text> |
|
5130 <xsl:text> this.disabled_elt.style.display = "none"; |
|
5131 </xsl:text> |
|
5132 <xsl:text> this.update_activity(); |
|
5133 </xsl:text> |
|
5134 <xsl:text> } |
|
5135 </xsl:text> |
|
5136 <xsl:text> } |
|
5137 </xsl:text> |
|
5138 <xsl:text> |
|
5139 </xsl:text> |
5110 <xsl:text> make_on_click() { |
5140 <xsl:text> make_on_click() { |
5111 </xsl:text> |
5141 </xsl:text> |
5112 <xsl:text> let that = this; |
5142 <xsl:text> let that = this; |
5113 </xsl:text> |
5143 </xsl:text> |
5114 <xsl:text> const name = this.args[0]; |
5144 <xsl:text> const name = this.args[0]; |
5115 </xsl:text> |
5145 </xsl:text> |
5116 <xsl:text> return function(evt){ |
5146 <xsl:text> return function(evt){ |
5117 </xsl:text> |
5147 </xsl:text> |
5118 <xsl:text> /* TODO: suport path pointing to local variable whom value |
5148 <xsl:text> /* TODO: in order to allow jumps to page selected through for exemple a dropdown, |
5119 </xsl:text> |
5149 </xsl:text> |
5120 <xsl:text> would be an HMI_TREE index to jump to a relative page */ |
5150 <xsl:text> support path pointing to local variable whom value |
5121 </xsl:text> |
5151 </xsl:text> |
5122 <xsl:text> const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined; |
5152 <xsl:text> would be an HMI_TREE index and then jump to a relative page not hard-coded in advance */ |
5123 </xsl:text> |
5153 </xsl:text> |
5124 <xsl:text> switch_page(name, index); |
5154 <xsl:text> |
|
5155 </xsl:text> |
|
5156 <xsl:text> if(!that.disabled) { |
|
5157 </xsl:text> |
|
5158 <xsl:text> const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined; |
|
5159 </xsl:text> |
|
5160 <xsl:text> switch_page(name, index); |
|
5161 </xsl:text> |
|
5162 <xsl:text> } |
5125 </xsl:text> |
5163 </xsl:text> |
5126 <xsl:text> } |
5164 <xsl:text> } |
5127 </xsl:text> |
5165 </xsl:text> |
5128 <xsl:text> } |
5166 <xsl:text> } |
5129 </xsl:text> |
5167 </xsl:text> |
5149 </xsl:text> |
5187 </xsl:text> |
5150 <xsl:text> dispatch(value) { |
5188 <xsl:text> dispatch(value) { |
5151 </xsl:text> |
5189 </xsl:text> |
5152 <xsl:text> this.disabled = !Number(value); |
5190 <xsl:text> this.disabled = !Number(value); |
5153 </xsl:text> |
5191 </xsl:text> |
5154 <xsl:text> if(this.disabled) { |
5192 <xsl:text> this.update_state(); |
5155 </xsl:text> |
|
5156 <xsl:text> /* show disabled */ |
|
5157 </xsl:text> |
|
5158 <xsl:text> this.disabled_elt.setAttribute("style", this.disabled_elt_style); |
|
5159 </xsl:text> |
|
5160 <xsl:text> /* hide inactive */ |
|
5161 </xsl:text> |
|
5162 <xsl:text> this.inactive_elt.setAttribute("style", "display:none"); |
|
5163 </xsl:text> |
|
5164 <xsl:text> /* hide active */ |
|
5165 </xsl:text> |
|
5166 <xsl:text> this.active_elt.setAttribute("style", "display:none"); |
|
5167 </xsl:text> |
|
5168 <xsl:text> } else { |
|
5169 </xsl:text> |
|
5170 <xsl:text> /* hide disabled */ |
|
5171 </xsl:text> |
|
5172 <xsl:text> this.disabled_elt.setAttribute("style", "display:none"); |
|
5173 </xsl:text> |
|
5174 <xsl:text> this.update_activity(); |
|
5175 </xsl:text> |
|
5176 <xsl:text> } |
|
5177 </xsl:text> |
5193 </xsl:text> |
5178 <xsl:text> } |
5194 <xsl:text> } |
5179 </xsl:text> |
5195 </xsl:text> |
5180 <xsl:text> } |
5196 <xsl:text> } |
5181 </xsl:text> |
5197 </xsl:text> |
5207 <xsl:text> init: function() { |
5223 <xsl:text> init: function() { |
5208 </xsl:text> |
5224 </xsl:text> |
5209 <xsl:text> this.element.onclick = this.make_on_click(); |
5225 <xsl:text> this.element.onclick = this.make_on_click(); |
5210 </xsl:text> |
5226 </xsl:text> |
5211 <xsl:if test="$have_activity"> |
5227 <xsl:if test="$have_activity"> |
5212 <xsl:text> this.active_elt_style = this.active_elt.getAttribute("style"); |
|
5213 </xsl:text> |
|
5214 <xsl:text> this.inactive_elt_style = this.inactive_elt.getAttribute("style"); |
|
5215 </xsl:text> |
|
5216 <xsl:text> this.activable = true; |
5228 <xsl:text> this.activable = true; |
5217 </xsl:text> |
5229 </xsl:text> |
5218 </xsl:if> |
5230 </xsl:if> |
|
5231 <xsl:if test="not($have_disability)"> |
|
5232 <xsl:text> this.unsubscribable = true; |
|
5233 </xsl:text> |
|
5234 </xsl:if> |
|
5235 <xsl:text> this.update_state = </xsl:text> |
5219 <xsl:choose> |
5236 <xsl:choose> |
5220 <xsl:when test="$have_disability"> |
5237 <xsl:when test="$have_disability"> |
5221 <xsl:text> this.disabled_elt_style = this.disabled_elt.getAttribute("style"); |
5238 <xsl:text>this.update_disability</xsl:text> |
5222 </xsl:text> |
5239 </xsl:when> |
|
5240 <xsl:when test="$have_activity"> |
|
5241 <xsl:text>this.update_activity</xsl:text> |
5223 </xsl:when> |
5242 </xsl:when> |
5224 <xsl:otherwise> |
5243 <xsl:otherwise> |
5225 <xsl:text> this.unsubscribable = true; |
5244 <xsl:text>null</xsl:text> |
5226 </xsl:text> |
|
5227 </xsl:otherwise> |
5245 </xsl:otherwise> |
5228 </xsl:choose> |
5246 </xsl:choose> |
|
5247 <xsl:text>; |
|
5248 </xsl:text> |
5229 <xsl:text> }, |
5249 <xsl:text> }, |
5230 </xsl:text> |
5250 </xsl:text> |
5231 </xsl:template> |
5251 </xsl:template> |
5232 <xsl:template mode="per_page_widget_template" match="widget[@type='Jump']"> |
5252 <xsl:template mode="per_page_widget_template" match="widget[@type='Jump']"> |
5233 <xsl:param name="page_desc"/> |
5253 <xsl:param name="page_desc"/> |
6858 </xsl:template> |
6878 </xsl:template> |
6859 <xsl:template match="/"> |
6879 <xsl:template match="/"> |
6860 <xsl:comment> |
6880 <xsl:comment> |
6861 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
6881 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
6862 </xsl:comment> |
6882 </xsl:comment> |
6863 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
6883 <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml"> |
6864 <head> |
6884 <head> |
6865 <style type="text/css" media="screen"> |
6885 <style media="screen" type="text/css"> |
6866 <xsl:value-of select="ns:GetFonts()"/> |
6886 <xsl:value-of select="ns:GetFonts()"/> |
6867 </style> |
6887 </style> |
6868 </head> |
6888 </head> |
6869 <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;"> |
6889 <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;"> |
6870 <xsl:copy-of select="$result_svg"/> |
6890 <xsl:copy-of select="$result_svg"/> |