svghmi/widget_back.ysl2
author Edouard Tisserant
Thu, 26 Mar 2020 14:21:52 +0100
branchsvghmi
changeset 2902 1fcb50af0335
parent 2901 svghmi/widget_jump.ysl2@3f5194bba67d
child 2912 d320367eb2ad
permissions -rw-r--r--
SVGHMI: added Back widget.
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
     1
// widget_back.ysl2
2779
75c6a31caca6 SVGHMI: Work In Progress : fixed pointer types in ctypes interface, cleaned up server startup and cleanup code, changed document type to XHTML, cleaner JS script : encapsulated in a function and in CDATA.
Edouard Tisserant
parents: 2763
diff changeset
     2
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
     3
template "widget[@type='Back']", mode="widget_defs" {
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
     4
    param "hmi_element";
2900
3ef217f525ff SVGHMI: Check that explicit relative page jump path is consistant with destination page reference path.
Edouard Tisserant
parents: 2898
diff changeset
     5
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
     6
    |     on_click: function(evt) {
2902
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
     7
    |         console.log("Back !");
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
     8
    |         if(jump_history.length > 1){
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
     9
    |            jump_history.pop();
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
    10
    |            let [page_name, index] = jump_history.pop();
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
    11
    |            switch_page(page_name, index);
1fcb50af0335 SVGHMI: added Back widget.
Edouard Tisserant
parents: 2901
diff changeset
    12
    |         }
2883
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    13
    |     },
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    14
    |     init: function() {
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    15
    |         this.element.setAttribute("onclick", "hmi_widgets['«$hmi_element/@id»'].on_click(evt)");
8e3d130399b0 SVGHMI: created widget_*.ysl2. Renamed widget_common in widgets_common, so that it doesn't match globing.
Edouard Tisserant <edouard.tisserant@gmail.com>
parents: 2882
diff changeset
    16
    |     },
2753
9a7e12e96399 SVGHMI: Added XSLT transformation, Makefile to get XSLT from ysl2 (copy of plcopen/Makefile) and a minimal stylesheet to start with.
Edouard Tisserant
parents:
diff changeset
    17
}
2901
3f5194bba67d SVGHMI: Jump widget now make errors if path given for relative jump doesn't match target page reference path class.
Edouard Tisserant
parents: 2900
diff changeset
    18