@@ -16,15 +16,20 @@ var clickContext = null;
1616// Dict (objID -> "ARRAY von Actions")
1717var clickObject = { } ;
1818
19+ // Variablen, welche aus der Visu-XML gefüllt werden
1920var visuName = "" ;
2021var visuSizeX = 0 ;
2122var visuSizeY = 0 ;
23+
24+ var currentVisuLoaded = "" ;
25+
2226var visuCompressed = 0 ;
2327var visuUseDynamicText = false ;
2428var visuDynTextDefaultLanguage = 'english' ;
2529
2630// globale variablen
2731var updateInterval = 500 ;
32+ var updateIntervalId ;
2833var plcDir = "../PLC" ;
2934var startVisu = "plc_visu" ;
3035
@@ -38,7 +43,7 @@ var canvObjects = [];
3843#endif
3944*/
4045
41- // performance-Z�hler
46+ // performance-Zaehler
4247var perfWriteout = 0 ;
4348var perfCount = 0 ;
4449var perfLoadStart = 0 ;
@@ -58,9 +63,40 @@ var logOverlayText = "LogOverlay:\n";
5863// use touch instead of mouse-down and -up
5964var useTouchEvents = ( 'ontouchstart' in window ) ;
6065
66+ var errorCountdown = 0 ;
67+
68+ function errorCountdownUpdate ( )
69+ {
70+ var errorcountdown = document . getElementById ( "errorcountdown" ) ;
71+ errorcountdown . innerHTML = errorCountdown ;
72+
73+ if ( errorCountdown < 1 ) {
74+ switchToVisu ( currentVisuLoaded ) ;
75+ updateIntervalId = setInterval ( update , updateInterval ) ;
76+ } else {
77+ errorCountdown -- ;
78+ setTimeout ( errorCountdownUpdate , 1000 ) ;
79+ }
80+ }
81+
82+ function errorStateEnable ( )
83+ {
84+ // ERROR-Overlay anzeigen
85+ var errorcontainer = document . getElementById ( "errorcontainer" ) ;
86+ errorcontainer . style . display = "block" ;
87+
88+ // zyklischen Update stoppen
89+ // dürfte wegen der Zeitüberschreitung aber ohnehin schon vom Browser
90+ // gestoppt sein.
91+ clearInterval ( updateIntervalId ) ;
92+
93+ // wir versuchen automatisch alle 10 Sekunden wieder neu zu starten
94+ errorCountdown = 10 ;
95+ errorCountdownUpdate ( ) ;
96+ }
6197
6298function switchToVisu ( visu ) {
63- // alle Arrays und Variablenzuordnungen l�schen
99+ // alle Arrays und Variablenzuordnungen löschen
64100 visuVariables = { } ;
65101 drawObjects = [ ] ;
66102 clickObject = { } ;
@@ -84,11 +120,12 @@ function switchToVisu(visu) {
84120#endif
85121*/
86122
87-
88123 visuName = "" ;
89124 visuSizeX = 0 ;
90125 visuSizeY = 0 ;
91126
127+ currentVisuLoaded = visu ;
128+
92129 // INIs neu laden
93130 load_ini ( plcDir + "/visu_ini.xml" ) ;
94131
@@ -527,16 +564,16 @@ function registerClickObj_Tap(objId, variable, newval) {
527564// ClickZoom
528565
529566// constructor
530- function clickObj_Zoom ( visu ) {
567+ function clickObj_Zoom ( exprZoom ) {
531568 this . isA = 'Zoom' ;
532- this . visu = visu ;
569+ this . exprZoom = exprZoom ;
533570}
534571
535- function registerClickObj_Zoom ( objId , visu ) {
572+ function registerClickObj_Zoom ( objId , exprZoom ) {
536573 if ( ! ( objId in clickObject ) ) {
537574 clickObject [ objId ] = [ ] ; // Array von Klick-Info
538575 }
539- clickObject [ objId ] . push ( new clickObj_Zoom ( visu ) ) ;
576+ clickObject [ objId ] . push ( new clickObj_Zoom ( exprZoom ) ) ;
540577}
541578
542579// ****************************************************************************
@@ -787,6 +824,12 @@ function evalExpression(expr) {
787824 }
788825 }
789826 }
827+ } else if ( expr [ i ] . operation == 'placeholder' ) {
828+ //Log("evalExpression: placeholder: " + expr[i].value)
829+ // TODO: eigentlich sind "placeholder" Strings mit Dollar-Syntax:
830+ // <placeholder>$FUB$.farbwechsel</placeholder>
831+ // entsprechend müssten wir hier noch eine Textersetzung durchführen.
832+ result . push ( expr [ i ] . value ) ;
790833 } else {
791834 Log ( "error: expression operation < " + expr [ i ] . operation + " > unknown" ) ;
792835 }
0 commit comments