Rev 318 | Rev 325 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 318 | Rev 324 | ||
---|---|---|---|
Line 96... | Line 96... | ||
96 | 96 | ||
97 | 97 | ||
98 | function startTask() { |
98 | function startTask() { |
99 | 99 | ||
100 | var r = document.getElementById('results'); |
100 | var r = document.getElementById('results'); |
101 |
|
101 | //if ( r.style.display == 'none' ) switchTask(); |
102 | r.innerHTML = ''; |
102 | r.innerHTML = ''; |
103 | var btnstart = document.getElementById('btnstart'); |
103 | var btnstart = document.getElementById('btnstart'); |
104 | btnstart.value= "Stop Analysis"; |
104 | btnstart.value= "Stop Analysis"; |
105 | 105 | ||
106 | 106 | ||
Line 129... | Line 129... | ||
129 | stopTask(); |
129 | stopTask(); |
130 | } else { |
130 | } else { |
131 | startTask(); |
131 | startTask(); |
132 | } |
132 | } |
133 | } |
133 | } |
- | 134 | ||
- | 135 | function toProcess() { |
|
- | 136 | window.location.hash='#btnstart'; |
|
- | 137 | //window.location.hash='#blocklyDiv'; |
|
- | 138 | } |
|
- | 139 | ||
- | 140 | function showDebug() { |
|
- | 141 | var btnstart = document.getElementById('btndebug'); |
|
- | 142 | var div = document.getElementById('results'); |
|
- | 143 | ||
- | 144 | if (btnstart.value=== "Show Text"){ |
|
- | 145 | btnstart.value = "Hide Text"; |
|
- | 146 | div.style.display = 'block'; |
|
- | 147 | } else { |
|
- | 148 | btnstart.value = "Show Text"; |
|
- | 149 | div.style.display = 'none'; |
|
- | 150 | } |
|
- | 151 | } |
|
- | 152 | ||
- | 153 | function showLicense() { |
|
- | 154 | window.location.href="license.html"; |
|
- | 155 | } |
|
- | 156 | ||
- | 157 | ||
134 | function EventListener(e) { |
158 | function EventListener(e) { |
135 | //addLog(JSON.stringify(e) ); |
159 | //addLog(JSON.stringify(e) ); |
136 | 160 | ||
137 | var result = JSON.parse( e.data ); |
161 | var result = JSON.parse( e.data ); |
138 | 162 | ||
139 | if(e.lastEventId == 'CLOSE') { |
163 | if(e.lastEventId == 'CLOSE') { |
140 | addLog |
164 | //addLog('Received CLOSE closing'); |
141 | stopTask(); |
165 | stopTask(); |
142 | // es.close(); |
166 | // es.close(); |
143 | 167 | ||
144 | var pBar = document.getElementById('progressor'); |
168 | var pBar = document.getElementById('progressor'); |
145 | pBar.value = pBar.max; //max out the progress bar |
169 | pBar.value = pBar.max; //max out the progress bar |
Line 155... | Line 179... | ||
155 | } else { |
179 | } else { |
156 | var jsonobj = JSROOT.parse(result.message); |
180 | var jsonobj = JSROOT.parse(result.message); |
157 | var sframe = jsonobj.fName; |
181 | var sframe = jsonobj.fName; |
158 | 182 | ||
159 | 183 | ||
160 | addLog |
184 | //addLog('Histogram :'+ sframe ); |
161 |
|
185 | //var r = document.getElementById('results'); |
162 |
|
186 | var r = document.getElementById('drawing'); |
163 | if (document.getElementById(sframe) == null ){ |
187 | if (document.getElementById(sframe) == null ){ |
164 | r.insertAdjacentHTML('beforeend', '<div id="' + sframe +'" style="width:1000px; height:600px"></div><br/>'); |
188 | r.insertAdjacentHTML('beforeend', '<div id="' + sframe +'" style="width:1000px; height:600px"></div><br/>'); |
165 | r.insertAdjacentHTML('beforeend', '<div id="fit' + sframe +'" style="display: none"></div><br/>'); |
189 | r.insertAdjacentHTML('beforeend', '<div id="fit' + sframe +'" style="display: none"></div><br/>'); |
166 | var fit = document.getElementById('fit'+ sframe); |
190 | var fit = document.getElementById('fit'+ sframe); |
167 | mform ='<form method="post" action="th1fit.php" onsubmit="return fitpanel(this);">'; |
191 | mform ='<form method="post" action="th1fit.php" onsubmit="return fitpanel(this);">'; |
Line 173... | Line 197... | ||
173 | mform += ' <input type="hidden" value="'+ sframe +'" name="name" />'; |
197 | mform += ' <input type="hidden" value="'+ sframe +'" name="name" />'; |
174 | mform += ' <input class="mybutton" type="submit" value=" Fit "/>'; |
198 | mform += ' <input class="mybutton" type="submit" value=" Fit "/>'; |
175 | mform += '</form>'; |
199 | mform += '</form>'; |
176 | fit.insertAdjacentHTML('beforeend', '<div id="param' + sframe +'"></div><br/>'); |
200 | fit.insertAdjacentHTML('beforeend', '<div id="param' + sframe +'"></div><br/>'); |
177 | fit.insertAdjacentHTML('beforeend', mform); |
201 | fit.insertAdjacentHTML('beforeend', mform); |
178 | r.insertAdjacentHTML('beforeend','<input type="button" onclick="togglevisibility(\'fit'+sframe+'\');" class="mybutton" value="Show/Hide Fit Panel" |
202 | r.insertAdjacentHTML('beforeend','<input type="button" onclick="togglevisibility(\'fit'+sframe+'\');" class="mybutton" value="Show/Hide Fit Panel" />' ); |
- | 203 | r.insertAdjacentHTML('beforeend',' <input type="button" onclick="toProcess();" class="mybutton" value="To Process" /><hr/>' ); |
|
179 | document.getElementById('data'+ sframe).value=result.message; |
204 | document.getElementById('data'+ sframe).value=result.message; |
180 | //r.insertAdjacentHTML('beforeend', JSON.stringify(result.message)); |
205 | //r.insertAdjacentHTML('beforeend', JSON.stringify(result.message)); |
181 | } |
206 | } |
182 | var frame = document.getElementById(sframe); |
207 | var frame = document.getElementById(sframe); |
183 | 208 | ||
Line 197... | Line 222... | ||
197 | 222 | ||
198 | 223 | ||
199 | 224 | ||
200 | function stopTask() { |
225 | function stopTask() { |
201 | es.close(); |
226 | es.close(); |
202 | addLog |
227 | //addLog('Task end'); |
203 | var btnstart = document.getElementById('btnstart'); |
228 | var btnstart = document.getElementById('btnstart'); |
204 | 229 | ||
205 | btnstart.value= "Run Analysis"; |
230 | btnstart.value= "Run Analysis"; |
206 | 231 | ||
207 | } |
232 | } |
Line 330... | Line 355... | ||
330 | <body> |
355 | <body> |
331 | <h1>Belle II Masterclass: Describe process →Run analysis →Fit results →Save/load process locally</h1> |
356 | <h1>Belle II Masterclass: Describe process →Run analysis →Fit results →Save/load process locally</h1> |
332 | <!-- <input type="button" onclick="showCode();" class="mybutton" value="Show JavaScript" /> --> |
357 | <!-- <input type="button" onclick="showCode();" class="mybutton" value="Show JavaScript" /> --> |
333 | <input type="button" id="btnstart" onclick="startAction();" class="mybutton" value="Run Analysis" /> |
358 | <input type="button" id="btnstart" onclick="startAction();" class="mybutton" value="Run Analysis" /> |
334 | 359 | ||
335 | <!-- <input type="button" onclick="switchTask();" class="mybutton" value="Switch between Diagram and Results" /> --> |
- | |
336 | <input type="button" onclick="saveBlockly();" class="mybutton" value="Save Diagram" /> |
360 | <input type="button" onclick="saveBlockly();" class="mybutton" value="Save Diagram" /> |
337 | <form style="display:inline;"><label for="file-input" class="mybutton" style="">Load Diagram</label> |
361 | <form style="display:inline;"><label for="file-input" class="mybutton" style="">Load Diagram</label> |
- | 362 | <input type="button" id="btndebug" onclick="showDebug();" class="mybutton" value="Hide Text" /> |
|
- | 363 | <input type="button" id="btnhelp" onclick="window.location.href='BelleIILabManual.pdf';" class="mybutton" value="Help" /> |
|
- | 364 | <input type="button" id="btnabout" onclick="showLicense();" class="mybutton" value="About" /> |
|
338 | <input type="file" style="visibility:hidden;" id="file-input" onClick="this.form.reset()" data-buttonText="Load Diagram"/></form> |
365 | <input type="file" style="visibility:hidden;" id="file-input" onClick="this.form.reset()" data-buttonText="Load Diagram"/></form> |
339 | <br/> |
366 | <br/> |
340 | <progress id='progressor' value="0" max='100' style="width:95%"></progress> |
367 | <progress id='progressor' value="0" max='100' style="width:95%"></progress> |
341 | <span id="percentage" style="text-align:right; display:block; margin-top:5px;">0</span> |
368 | <span id="percentage" style="text-align:right; display:block; margin-top:5px;">0</span> |
342 | <p id="sbar" ></div> |
369 | <p id="sbar" ></div> |
343 | 370 | ||
344 | <br /> |
371 | <br /> |
345 | 372 | ||
346 | <div id="blocklyDiv" style="height:500px; width:95%"></div><br /> |
- | |
347 | <div id="results" style="border:1px solid #000; padding:10px; width:95%; height:80% ; overflow:auto; background:#eee;"></div> |
373 | <div id="results" style="border:1px solid #000; padding:10px; width:95%; height:80% ; overflow:auto; background:#eee;"></div> |
348 | <br /> |
374 | <br /> |
- | 375 | <div id="blocklyDiv" style="height:900px; width:95%"></div><br /> |
|
349 | 376 | ||
350 | <script> |
377 | <script> |
351 | 378 | ||
352 | document.getElementById('file-input').addEventListener('change', readSingleFile, false); |
379 | document.getElementById('file-input').addEventListener('change', readSingleFile, false); |
353 | 380 |