--- a/LPCSVGHMI/analyse_widget.xslt Mon Jul 21 16:13:12 2025 +0200
+++ b/LPCSVGHMI/analyse_widget.xslt Wed Jul 23 13:43:06 2025 +0200
@@ -1110,6 +1110,22 @@
<func:result select="$res"/>
+ <xsl:template match="widget[@type='CloudImage']" mode="widget_desc"> + <xsl:value-of select="@type"/> + <xsl:text>If CloudImage widget is a svg:image element, then href content is replaced by + <xsl:text>link to the file whose name is the value of given variable, being served from + <xsl:text>/media/data/cloud folder. + <xsl:text>Image display</xsl:text> <xsl:template match="widget[@type='Swipe']" mode="widget_desc">
<xsl:value-of select="@type"/>
--- a/LPCSVGHMI/gen_index_xhtml.xslt Mon Jul 21 16:13:12 2025 +0200
+++ b/LPCSVGHMI/gen_index_xhtml.xslt Wed Jul 23 13:43:06 2025 +0200
@@ -697,7 +697,7 @@
<func:function name="func:sumarized_elements">
<xsl:param name="elements"/>
<xsl:variable name="short_list" select="$elements[not(ancestor::*/@id = $elements/@id)]"/>
- <xsl:variable name="filled_groups" select="$short_list/parent::*[ not(child::*[ not(@id = $discardable_elements/@id) and not(@id = $short_list/@id) ])]"/>
+ <xsl:variable name="filled_groups" select="$short_list/parent::svg:g[ not(child::*[ not(@id = $discardable_elements/@id) and not(@id = $short_list/@id) ])]"/> <xsl:variable name="groups_to_add" select="$filled_groups[not(ancestor::*/@id = $filled_groups/@id)]"/>
<func:result select="$groups_to_add | $short_list[not(ancestor::*/@id = $filled_groups/@id)]"/>
@@ -9380,6 +9380,75 @@
+ <xsl:template match="widget[@type='CloudImage']" mode="widget_desc"> + <xsl:value-of select="@type"/> + <xsl:text>If CloudImage widget is a svg:image element, then href content is replaced by + <xsl:text>link to the file whose name is the value of given variable, being served from + <xsl:text>/media/data/cloud folder. + <xsl:text>Image display</xsl:text> + <xsl:template match="widget[@type='CloudImage']" mode="widget_class"> + <xsl:text>class </xsl:text> + <xsl:text>CloudImageWidget</xsl:text> + <xsl:text> extends Widget{ + <xsl:text> frequency = 5; + <xsl:text> dispatch(value, oldval, index) { + <xsl:text> if (index == 0) { + <xsl:text> this.given_url = "cloudfolder?image=" + value; + <xsl:text> this.ready = true; + <xsl:text> this.request_animate(); + <xsl:template match="widget[@type='CloudImage']" mode="widget_defs"> + <xsl:param name="hmi_element"/> + <xsl:variable name="disability"> + <xsl:call-template name="defs_by_labels"> + <xsl:with-param name="hmi_element" select="$hmi_element"/> + <xsl:with-param name="labels"> + <xsl:text>/disabled</xsl:text> + <xsl:with-param name="mandatory" select="'no'"/> + <xsl:value-of select="$disability"/> + <xsl:variable name="has_disability" select="string-length($disability)>0"/> + <xsl:text> given_url: "", + <xsl:text> ready: false, + <xsl:text> animate: function(){ + <xsl:text> this.element.setAttribute('href', this.given_url); + <xsl:template xmlns="http://www.w3.org/2000/svg" mode="inline_svg" match="svg:image[starts-with(@inkscape:label, 'HMI:CloudImage')]"> + <xsl:apply-templates mode="inline_svg" select="@*[not(contains(name(), 'href'))] | node()"/> <xsl:template match="widget[@type='Swipe']" mode="widget_desc">
<xsl:value-of select="@type"/>
@@ -10759,8 +10828,6 @@
<xsl:text> let widget = hmi_widgets[id];
- <xsl:text> if(widget.curr_value != undefined) return;
<xsl:text> widget.do_init();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/LPCSVGHMI/widget_cloudimage.ysl2 Wed Jul 23 13:43:06 2025 +0200
@@ -0,0 +1,44 @@
+// widget_cloudimage.ysl2 +widget_desc("CloudImage") { + If CloudImage widget is a svg:image element, then href content is replaced by + link to the file whose name is the value of given variable, being served from + /media/data/cloud folder. + shortdesc > Image display +widget_class("CloudImage") + dispatch(value, oldval, index) { + this.given_url = "cloudfolder?image=" + value; + this.request_animate(); +widget_defs("CloudImage") { + | this.element.setAttribute('href', this.given_url); +gen_index_xhtml { // following content is only available when generating xhtml file +// strip inkscape embedded bitmap when it is meant to be replaced by HMI:CloudImage widget +svgtmpl "svg:image[starts-with(@inkscape:label, 'HMI:CloudImage')]", mode="inline_svg" { + apply "@*[not(contains(name(), 'href'))] | node()", mode="inline_svg";