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> |
1741 </xsl:text> |
1741 </xsl:text> |
1742 <xsl:text> |
1742 <xsl:text> |
1743 </xsl:text> |
1743 </xsl:text> |
1744 </xsl:template> |
1744 </xsl:template> |
1745 <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/> |
1745 <xsl:variable name="excluded_types" select="str:split('Page VarInit VarInitPersistent')"/> |
1746 <xsl:key name="TypesKey" match="widget" use="@type"/> |
1746 <xsl:key use="@type" name="TypesKey" match="widget"/> |
1747 <declarations:hmi-classes/> |
1747 <declarations:hmi-classes/> |
1748 <xsl:template match="declarations:hmi-classes"> |
1748 <xsl:template match="declarations:hmi-classes"> |
1749 <xsl:text> |
1749 <xsl:text> |
1750 </xsl:text> |
1750 </xsl:text> |
1751 <xsl:text>/* </xsl:text> |
1751 <xsl:text>/* </xsl:text> |
5461 </xsl:text> |
5461 </xsl:text> |
5462 <xsl:text> if(this.active) { |
5462 <xsl:text> if(this.active) { |
5463 </xsl:text> |
5463 </xsl:text> |
5464 <xsl:text> /* show active */ |
5464 <xsl:text> /* show active */ |
5465 </xsl:text> |
5465 </xsl:text> |
5466 <xsl:text> this.active_elt.setAttribute("style", this.active_elt_style); |
5466 <xsl:text> this.active_elt.style.display = ""; |
5467 </xsl:text> |
5467 </xsl:text> |
5468 <xsl:text> /* hide inactive */ |
5468 <xsl:text> /* hide inactive */ |
5469 </xsl:text> |
5469 </xsl:text> |
5470 <xsl:text> this.inactive_elt.setAttribute("style", "display:none"); |
5470 <xsl:text> this.inactive_elt.style.display = "none"; |
5471 </xsl:text> |
5471 </xsl:text> |
5472 <xsl:text> } else { |
5472 <xsl:text> } else { |
5473 </xsl:text> |
5473 </xsl:text> |
5474 <xsl:text> /* show inactive */ |
5474 <xsl:text> /* show inactive */ |
5475 </xsl:text> |
5475 </xsl:text> |
5476 <xsl:text> this.inactive_elt.setAttribute("style", this.inactive_elt_style); |
5476 <xsl:text> this.inactive_elt.style.display = ""; |
5477 </xsl:text> |
5477 </xsl:text> |
5478 <xsl:text> /* hide active */ |
5478 <xsl:text> /* hide active */ |
5479 </xsl:text> |
5479 </xsl:text> |
5480 <xsl:text> this.active_elt.setAttribute("style", "display:none"); |
5480 <xsl:text> this.active_elt.style.display = "none"; |
5481 </xsl:text> |
5481 </xsl:text> |
5482 <xsl:text> } |
5482 <xsl:text> } |
5483 </xsl:text> |
5483 </xsl:text> |
5484 <xsl:text> } |
5484 <xsl:text> } |
5485 </xsl:text> |
5485 </xsl:text> |
5486 <xsl:text> |
5486 <xsl:text> |
5487 </xsl:text> |
5487 </xsl:text> |
|
5488 <xsl:text> update_disability() { |
|
5489 </xsl:text> |
|
5490 <xsl:text> if(this.disabled) { |
|
5491 </xsl:text> |
|
5492 <xsl:text> /* show disabled */ |
|
5493 </xsl:text> |
|
5494 <xsl:text> this.disabled_elt.style.display = ""; |
|
5495 </xsl:text> |
|
5496 <xsl:text> /* hide inactive */ |
|
5497 </xsl:text> |
|
5498 <xsl:text> this.inactive_elt.style.display = "none"; |
|
5499 </xsl:text> |
|
5500 <xsl:text> /* hide active */ |
|
5501 </xsl:text> |
|
5502 <xsl:text> this.active_elt.style.display = "none"; |
|
5503 </xsl:text> |
|
5504 <xsl:text> } else { |
|
5505 </xsl:text> |
|
5506 <xsl:text> /* hide disabled */ |
|
5507 </xsl:text> |
|
5508 <xsl:text> this.disabled_elt.style.display = "none"; |
|
5509 </xsl:text> |
|
5510 <xsl:text> this.update_activity(); |
|
5511 </xsl:text> |
|
5512 <xsl:text> } |
|
5513 </xsl:text> |
|
5514 <xsl:text> } |
|
5515 </xsl:text> |
|
5516 <xsl:text> |
|
5517 </xsl:text> |
5488 <xsl:text> make_on_click() { |
5518 <xsl:text> make_on_click() { |
5489 </xsl:text> |
5519 </xsl:text> |
5490 <xsl:text> let that = this; |
5520 <xsl:text> let that = this; |
5491 </xsl:text> |
5521 </xsl:text> |
5492 <xsl:text> const name = this.args[0]; |
5522 <xsl:text> const name = this.args[0]; |
5493 </xsl:text> |
5523 </xsl:text> |
5494 <xsl:text> return function(evt){ |
5524 <xsl:text> return function(evt){ |
5495 </xsl:text> |
5525 </xsl:text> |
5496 <xsl:text> /* TODO: suport path pointing to local variable whom value |
5526 <xsl:text> /* TODO: in order to allow jumps to page selected through for exemple a dropdown, |
5497 </xsl:text> |
5527 </xsl:text> |
5498 <xsl:text> would be an HMI_TREE index to jump to a relative page */ |
5528 <xsl:text> support path pointing to local variable whom value |
5499 </xsl:text> |
5529 </xsl:text> |
5500 <xsl:text> const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined; |
5530 <xsl:text> would be an HMI_TREE index and then jump to a relative page not hard-coded in advance */ |
5501 </xsl:text> |
5531 </xsl:text> |
5502 <xsl:text> switch_page(name, index); |
5532 <xsl:text> |
|
5533 </xsl:text> |
|
5534 <xsl:text> if(!that.disabled) { |
|
5535 </xsl:text> |
|
5536 <xsl:text> const index = that.indexes.length > 0 ? that.indexes[0] + that.offset : undefined; |
|
5537 </xsl:text> |
|
5538 <xsl:text> switch_page(name, index); |
|
5539 </xsl:text> |
|
5540 <xsl:text> } |
5503 </xsl:text> |
5541 </xsl:text> |
5504 <xsl:text> } |
5542 <xsl:text> } |
5505 </xsl:text> |
5543 </xsl:text> |
5506 <xsl:text> } |
5544 <xsl:text> } |
5507 </xsl:text> |
5545 </xsl:text> |
5527 </xsl:text> |
5565 </xsl:text> |
5528 <xsl:text> dispatch(value) { |
5566 <xsl:text> dispatch(value) { |
5529 </xsl:text> |
5567 </xsl:text> |
5530 <xsl:text> this.disabled = !Number(value); |
5568 <xsl:text> this.disabled = !Number(value); |
5531 </xsl:text> |
5569 </xsl:text> |
5532 <xsl:text> if(this.disabled) { |
5570 <xsl:text> this.update_state(); |
5533 </xsl:text> |
|
5534 <xsl:text> /* show disabled */ |
|
5535 </xsl:text> |
|
5536 <xsl:text> this.disabled_elt.setAttribute("style", this.disabled_elt_style); |
|
5537 </xsl:text> |
|
5538 <xsl:text> /* hide inactive */ |
|
5539 </xsl:text> |
|
5540 <xsl:text> this.inactive_elt.setAttribute("style", "display:none"); |
|
5541 </xsl:text> |
|
5542 <xsl:text> /* hide active */ |
|
5543 </xsl:text> |
|
5544 <xsl:text> this.active_elt.setAttribute("style", "display:none"); |
|
5545 </xsl:text> |
|
5546 <xsl:text> } else { |
|
5547 </xsl:text> |
|
5548 <xsl:text> /* hide disabled */ |
|
5549 </xsl:text> |
|
5550 <xsl:text> this.disabled_elt.setAttribute("style", "display:none"); |
|
5551 </xsl:text> |
|
5552 <xsl:text> this.update_activity(); |
|
5553 </xsl:text> |
|
5554 <xsl:text> } |
|
5555 </xsl:text> |
5571 </xsl:text> |
5556 <xsl:text> } |
5572 <xsl:text> } |
5557 </xsl:text> |
5573 </xsl:text> |
5558 <xsl:text>} |
5574 <xsl:text>} |
5559 </xsl:text> |
5575 </xsl:text> |
5585 <xsl:text> init: function() { |
5601 <xsl:text> init: function() { |
5586 </xsl:text> |
5602 </xsl:text> |
5587 <xsl:text> this.element.onclick = this.make_on_click(); |
5603 <xsl:text> this.element.onclick = this.make_on_click(); |
5588 </xsl:text> |
5604 </xsl:text> |
5589 <xsl:if test="$have_activity"> |
5605 <xsl:if test="$have_activity"> |
5590 <xsl:text> this.active_elt_style = this.active_elt.getAttribute("style"); |
|
5591 </xsl:text> |
|
5592 <xsl:text> this.inactive_elt_style = this.inactive_elt.getAttribute("style"); |
|
5593 </xsl:text> |
|
5594 <xsl:text> this.activable = true; |
5606 <xsl:text> this.activable = true; |
5595 </xsl:text> |
5607 </xsl:text> |
5596 </xsl:if> |
5608 </xsl:if> |
|
5609 <xsl:if test="not($have_disability)"> |
|
5610 <xsl:text> this.unsubscribable = true; |
|
5611 </xsl:text> |
|
5612 </xsl:if> |
|
5613 <xsl:text> this.update_state = </xsl:text> |
5597 <xsl:choose> |
5614 <xsl:choose> |
5598 <xsl:when test="$have_disability"> |
5615 <xsl:when test="$have_disability"> |
5599 <xsl:text> this.disabled_elt_style = this.disabled_elt.getAttribute("style"); |
5616 <xsl:text>this.update_disability</xsl:text> |
5600 </xsl:text> |
5617 </xsl:when> |
|
5618 <xsl:when test="$have_activity"> |
|
5619 <xsl:text>this.update_activity</xsl:text> |
5601 </xsl:when> |
5620 </xsl:when> |
5602 <xsl:otherwise> |
5621 <xsl:otherwise> |
5603 <xsl:text> this.unsubscribable = true; |
5622 <xsl:text>null</xsl:text> |
5604 </xsl:text> |
|
5605 </xsl:otherwise> |
5623 </xsl:otherwise> |
5606 </xsl:choose> |
5624 </xsl:choose> |
|
5625 <xsl:text>; |
|
5626 </xsl:text> |
5607 <xsl:text> }, |
5627 <xsl:text> }, |
5608 </xsl:text> |
5628 </xsl:text> |
5609 </xsl:template> |
5629 </xsl:template> |
5610 <xsl:template match="widget[@type='Jump']" mode="widget_page"> |
5630 <xsl:template match="widget[@type='Jump']" mode="widget_page"> |
5611 <xsl:param name="page_desc"/> |
5631 <xsl:param name="page_desc"/> |
7424 </xsl:template> |
7444 </xsl:template> |
7425 <xsl:template match="/"> |
7445 <xsl:template match="/"> |
7426 <xsl:comment> |
7446 <xsl:comment> |
7427 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
7447 <xsl:text>Made with SVGHMI. https://beremiz.org</xsl:text> |
7428 </xsl:comment> |
7448 </xsl:comment> |
7429 <html xmlns="http://www.w3.org/1999/xhtml" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"> |
7449 <html xmlns:svg="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns="http://www.w3.org/1999/xhtml"> |
7430 <head> |
7450 <head> |
7431 <style type="text/css" media="screen"> |
7451 <style media="screen" type="text/css"> |
7432 <xsl:value-of select="ns:GetFonts()"/> |
7452 <xsl:value-of select="ns:GetFonts()"/> |
7433 </style> |
7453 </style> |
7434 </head> |
7454 </head> |
7435 <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;"> |
7455 <body style="margin:0;overflow:hidden;user-select:none;touch-action:none;"> |
7436 <xsl:copy-of select="$result_svg"/> |
7456 <xsl:copy-of select="$result_svg"/> |