diff -r fc5a0b1ece10 -r a098b2dd9dff svghmi/gen_index_xhtml.xslt
--- a/svghmi/gen_index_xhtml.xslt Tue Dec 22 14:57:59 2020 +0100
+++ b/svghmi/gen_index_xhtml.xslt Thu Dec 24 16:56:19 2020 +0100
@@ -55,7 +55,27 @@
- ]
+ ];
+
+
+
+ var hmitree_paths = [
+
+
+ /*
+
+
+
+ */ "
+
+ "
+
+ ,
+
+
+
+
+ ];
@@ -122,6 +142,7 @@
+
@@ -148,7 +169,7 @@
-
+
@@ -164,33 +185,65 @@
+
+
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+ Widget id:
+
+ label:
+
+ has wrong syntax of path section
+
+
+
+
+
+
-
+ PAGE_LOCAL
+
+
+
+
+ HMI_LOCAL
-
-
-
- PAGE_LOCAL
-
-
-
-
- HMI_LOCAL
-
-
-
+
+
+
+
+ Widget id:
+
+ label:
+
+ path section
+
+ use min and max on non mumeric value
+
+
+
+
+
+
+
+
+
+
@@ -1223,6 +1276,8 @@
if(typeof(index) == "string"){
+ /* XXX return index as path */
+
index = page_local_index(index, this.container_id);
} else {
@@ -1233,19 +1288,27 @@
}
+ /* XXX check for hmi_paths and return path */
+
}
return index;
}
+
+
change_hmi_value(index, opstr) {
let realindex = this.get_variable_index(index);
if(realindex == undefined) return undefined;
- return change_hmi_value(realindex, opstr);
+ let old_val = cache[realindex];
+
+ let new_val = eval_operation_string(old_val, opstr);
+
+ return apply_hmi_value(realindex, new_val);
}
@@ -3995,7 +4058,7 @@
on_op_click(opstr) {
- let new_val = this.change_hmi_value(0, opstr);
+ this.change_hmi_value(0, opstr);
}
@@ -6827,71 +6890,83 @@
+ function eval_operation_string(old_val, opstr) {
+
+ let op = opstr[0];
+
+ let given_val;
+
+ if(opstr.length < 2)
+
+ return undefined;
+
+ if(opstr[1] in quotes){
+
+ if(opstr.length < 3)
+
+ return undefined;
+
+ if(opstr[opstr.length-1] == opstr[1]){
+
+ given_val = opstr.slice(2,opstr.length-1);
+
+ }
+
+ } else {
+
+ given_val = Number(opstr.slice(1));
+
+ }
+
+ let new_val;
+
+ switch(op){
+
+ case "=":
+
+ new_val = given_val;
+
+ break;
+
+ case "+":
+
+ new_val = old_val + given_val;
+
+ break;
+
+ case "-":
+
+ new_val = old_val - given_val;
+
+ break;
+
+ case "*":
+
+ new_val = old_val * given_val;
+
+ break;
+
+ case "/":
+
+ new_val = old_val / given_val;
+
+ break;
+
+ }
+
+ return new_val;
+
+ }
+
+
+
+ /*
+
function change_hmi_value(index, opstr) {
- let op = opstr[0];
-
- let given_val;
-
- if(opstr.length < 2)
-
- return undefined; // TODO raise
-
- if(opstr[1] in quotes){
-
- if(opstr.length < 3)
-
- return undefined; // TODO raise
-
- if(opstr[opstr.length-1] == opstr[1]){
-
- given_val = opstr.slice(2,opstr.length-1);
-
- }
-
- } else {
-
- given_val = Number(opstr.slice(1));
-
- }
-
let old_val = cache[index];
- let new_val;
-
- switch(op){
-
- case "=":
-
- new_val = given_val;
-
- break;
-
- case "+":
-
- new_val = old_val + given_val;
-
- break;
-
- case "-":
-
- new_val = old_val - given_val;
-
- break;
-
- case "*":
-
- new_val = old_val * given_val;
-
- break;
-
- case "/":
-
- new_val = old_val / given_val;
-
- break;
-
- }
+ let new_val = eval_operation_string(old_val, opstr);
if(new_val != undefined && old_val != new_val)
@@ -6903,6 +6978,8 @@
}
+ */
+
var current_visible_page;