Changeset 13479
- Timestamp:
- 04/30/12 22:47:00 (13 years ago)
- Location:
- trunk/FACT++
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/Makefile.am
r13004 r13479 40 40 mcp feedback ratescan ratecontrol \ 41 41 magicweather \ 42 smartfact \ 42 43 fitsdump fitscheck 43 44 … … 81 82 drivectrl.man \ 82 83 datalogger.man \ 84 smartfact.man \ 83 85 fitsdump.man \ 84 86 fitscheck.man … … 251 253 libConfiguration.la 252 254 255 smartfact_SOURCES = src/smartfact.cc src/LocalControl.h src/PixelMap.cc 256 smartfact_LDADD = libDim++.la libDim.la libDimExtension.la \ 257 libStateMachine.la libTools.la libTime.la \ 258 libConfiguration.la 259 253 260 magicweather_SOURCES = src/magicweather.cc src/LocalControl.h 254 261 magicweather_LDADD = libDim++.la libDim.la libDimExtension.la \ -
trunk/FACT++/Makefile.in
r13009 r13479 50 50 drivectrl$(EXEEXT) mcp$(EXEEXT) feedback$(EXEEXT) \ 51 51 ratescan$(EXEEXT) ratecontrol$(EXEEXT) magicweather$(EXEEXT) \ 52 fitsdump$(EXEEXT) fitscheck$(EXEEXT) $(am__EXEEXT_1) \ 53 $(am__EXEEXT_2) $(am__EXEEXT_3) $(am__EXEEXT_4) 52 smartfact$(EXEEXT) fitsdump$(EXEEXT) fitscheck$(EXEEXT) \ 53 $(am__EXEEXT_1) $(am__EXEEXT_2) $(am__EXEEXT_3) \ 54 $(am__EXEEXT_4) 54 55 @HAS_GUI_TRUE@am__append_1 = fact 55 56 @HAS_VIEWER_TRUE@am__append_2 = viewer … … 348 349 scheduler_DEPENDENCIES = libStateMachine.la libTools.la libTime.la \ 349 350 libDim++.la libDim.la libDimExtension.la libConfiguration.la 351 am_smartfact_OBJECTS = src/smartfact.$(OBJEXT) src/PixelMap.$(OBJEXT) 352 smartfact_OBJECTS = $(am_smartfact_OBJECTS) 353 smartfact_DEPENDENCIES = libDim++.la libDim.la libDimExtension.la \ 354 libStateMachine.la libTools.la libTime.la libConfiguration.la 350 355 am_test_OBJECTS = src/test.$(OBJEXT) 351 356 test_OBJECTS = $(am_test_OBJECTS) … … 441 446 $(magicweather_SOURCES) $(mcp_SOURCES) $(ratecontrol_SOURCES) \ 442 447 $(ratescan_SOURCES) $(readfits_SOURCES) sched.c \ 443 $(scheduler_SOURCES) $( test_SOURCES) $(time_SOURCES) \444 $(t riggerschedule_SOURCES) $(viewer_SOURCES)448 $(scheduler_SOURCES) $(smartfact_SOURCES) $(test_SOURCES) \ 449 $(time_SOURCES) $(triggerschedule_SOURCES) $(viewer_SOURCES) 445 450 DIST_SOURCES = $(libConfiguration_la_SOURCES) $(libDim___la_SOURCES) \ 446 451 $(libDim_la_SOURCES) $(libDimExtension_la_SOURCES) \ … … 458 463 $(logtime_SOURCES) $(magicweather_SOURCES) $(mcp_SOURCES) \ 459 464 $(ratecontrol_SOURCES) $(ratescan_SOURCES) $(readfits_SOURCES) \ 460 sched.c $(scheduler_SOURCES) $(test_SOURCES) $(time_SOURCES) \ 461 $(triggerschedule_SOURCES) $(am__viewer_SOURCES_DIST) 465 sched.c $(scheduler_SOURCES) $(smartfact_SOURCES) \ 466 $(test_SOURCES) $(time_SOURCES) $(triggerschedule_SOURCES) \ 467 $(am__viewer_SOURCES_DIST) 462 468 man1dir = $(mandir)/man1 463 469 NROFF = nroff … … 715 721 @HAS_HELP2MAN_TRUE@ drivectrl.man \ 716 722 @HAS_HELP2MAN_TRUE@ datalogger.man \ 723 @HAS_HELP2MAN_TRUE@ smartfact.man \ 717 724 @HAS_HELP2MAN_TRUE@ fitsdump.man \ 718 725 @HAS_HELP2MAN_TRUE@ fitscheck.man … … 858 865 drivectrl_SOURCES = src/drivectrl.cc src/LocalControl.h src/HeadersFTM.cc 859 866 drivectrl_LDADD = libDim++.la libDim.la libDimExtension.la \ 867 libStateMachine.la libTools.la libTime.la \ 868 libConfiguration.la 869 870 smartfact_SOURCES = src/smartfact.cc src/LocalControl.h src/PixelMap.cc 871 smartfact_LDADD = libDim++.la libDim.la libDimExtension.la \ 860 872 libStateMachine.la libTools.la libTime.la \ 861 873 libConfiguration.la … … 1446 1458 @rm -f scheduler$(EXEEXT) 1447 1459 $(AM_V_CXXLD)$(CXXLINK) $(scheduler_OBJECTS) $(scheduler_LDADD) $(LIBS) 1460 src/smartfact.$(OBJEXT): src/$(am__dirstamp) \ 1461 src/$(DEPDIR)/$(am__dirstamp) 1462 smartfact$(EXEEXT): $(smartfact_OBJECTS) $(smartfact_DEPENDENCIES) 1463 @rm -f smartfact$(EXEEXT) 1464 $(AM_V_CXXLD)$(CXXLINK) $(smartfact_OBJECTS) $(smartfact_LDADD) $(LIBS) 1448 1465 src/test.$(OBJEXT): src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) 1449 1466 test$(EXEEXT): $(test_OBJECTS) $(test_DEPENDENCIES) … … 1648 1665 -rm -f src/readfits.$(OBJEXT) 1649 1666 -rm -f src/scheduler.$(OBJEXT) 1667 -rm -f src/smartfact.$(OBJEXT) 1650 1668 -rm -f src/test.$(OBJEXT) 1651 1669 -rm -f src/time.$(OBJEXT) … … 1772 1790 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/readfits.Po@am__quote@ 1773 1791 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/scheduler.Po@am__quote@ 1792 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/smartfact.Po@am__quote@ 1774 1793 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/test.Po@am__quote@ 1775 1794 @AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/time.Po@am__quote@ -
trunk/FACT++/src/feedback.cc
r13456 r13479 776 776 const float *ptr = reinterpret_cast<float*>(fBiasNom.getData()); 777 777 fVoltGapd.assign(ptr, ptr+416); 778 Info("Nominal bias voltages received."); 778 779 return; 779 780 } … … 1210 1211 fBiasA("BIAS_CONTROL/CURRENT", (void*)NULL, 0, this), 1211 1212 fBiasData("FAD_CONTROL/FEEDBACK_DATA", (void*)NULL, 0, this), 1213 fBiasNom("BIAS_CONTROL/NOMINAL", (void*)NULL, 0, this), 1212 1214 fCameraTemp("FSC_CONTROL/TEMPERATURE", (void*)NULL, 0, this), 1213 1215 fDimReference("FEEDBACK/REFERENCE", "F:416", -
trunk/FACT++/src/smartfact.cc
r13462 r13479 143 143 144 144 for (int i=0; i<7; i++) 145 out << fMagicWeatherData[i] << '\n';145 out << "#ffffff\t" << fMagicWeatherData[i] << '\n'; 146 146 147 147 ofstream fout("www/magicweather.txt"); … … 216 216 out << fDriveControlSourceName << '\n'; 217 217 out << setprecision(5); 218 out << ra << '\n';219 out << dec << '\n';218 out << "#ffffff\t" << ra << '\n'; 219 out << "#ffffff\t" << dec << '\n'; 220 220 out << setprecision(3); 221 out << woff << '\n';222 out << wang << '\n';223 224 ofstream fout("www/drive -source.txt");221 out << "#ffffff\t" << woff << '\n'; 222 out << "#ffffff\t" << wang << '\n'; 223 224 ofstream fout("www/drive.txt"); 225 225 fout << out.str(); 226 226 } … … 392 392 return kStateRunning; 393 393 394 fLastUpdate=now; 395 394 396 ostringstream out; 395 397 out << uint64_t(nearbyint(now.UnixTime()*1000)) << '\n'; 396 398 out << setprecision(3); 397 399 400 // -------------- System status -------------- 401 out << "n/a\n"; 402 403 // ------------------ Drive ----------------- 404 if (fStatusDriveControl.second>=5) // Armed, Moving, Tracking 405 { 406 const State rc = fNetwork.GetState("DRIVE_CONTROL", fStatusDriveControl.second); 407 out << "#ffffff\t"; 408 out << rc.name << '\t'; 409 out << fDriveControlPointingZd << '\t'; 410 out << fDriveControlPointingAz << '\t'; 411 out << fDriveControlTrackingDev << '\t'; 412 out << fDriveControlSourceName << '\n'; 413 } 414 else 415 out << "#ffffff\t\t\t\t\t\n"; 416 398 417 // --------------- MagicWeather ------------- 399 418 if (fStatusMagicWeather.second==3) 400 419 { 401 out << fMagicWeatherData[kTemp] << '\n'; 420 const float diff = fMagicWeatherData[kTemp]-fMagicWeatherData[kDew]; 421 string col1 = "#fff8f0"; 422 if (diff>0.3) 423 col1="#fffff0"; 424 if (diff>0.7) 425 col1="#f0fff0"; 426 427 const float wind = fMagicWeatherData[kGusts]; 428 string col2 = "#f0fff0"; 429 if (wind>35) 430 col2="#fffff0"; 431 if (wind>50) 432 col2="#fff8f0"; 433 434 out << col1 << "\t"; 435 out << fMagicWeatherData[kTemp] << '\t'; 402 436 out << fMagicWeatherData[kDew] << '\n'; 437 out << col2 << "\t"; 403 438 out << fMagicWeatherData[kGusts] << '\n'; 404 439 } 405 440 else 406 out << " \n\n\n";441 out << "#ffffff\t\t\n\n"; 407 442 408 443 // --------------- BiasControl ------------- … … 411 446 fStatusBiasControl.second==9) // Off 412 447 { 448 string col = fBiasControlVoltageMed>3?"#fff8f0":"#ffffff"; 449 if (fBiasControlCurrentMax>280) 450 col = "#fffff0"; 451 if (fBiasControlCurrentMax>350) 452 col = "#fff8f0"; 453 454 out << col << "\t"; 455 out << fBiasControlCurrentMed << '\t'; 456 out << fBiasControlCurrentMax << '\t'; 413 457 out << fBiasControlVoltageMed << '\n'; 414 out << fBiasControlCurrentMed << '\n';415 out << fBiasControlCurrentMax << '\n';416 458 } 417 459 else 418 out << "\n\n\n"; 419 420 // ------------------ Drive ----------------- 421 if (fStatusDriveControl.second>=5) // Armed, Moving, Tracking 422 { 423 const State rc = fNetwork.GetState("DRIVE_CONTROL", fStatusDriveControl.second); 424 out << rc.name << '\n'; 425 out << fDriveControlPointingZd << '\n'; 426 out << fDriveControlPointingAz << '\n'; 427 out << fDriveControlTrackingDev << '\n'; 428 out << fDriveControlSourceName << '\n'; 429 } 430 else 431 out << "\n\n\n\n\n"; 460 out << "#ffffff\t\t\t\n"; 461 432 462 433 463 // ------------------------------------------ 434 ofstream fout("www/ status.txt");464 ofstream fout("www/fact.txt"); 435 465 fout << out.str(); 436 466 -
trunk/FACT++/www/index.css
r13464 r13479 7 7 border-width: 1px 1px 2px 1px; 8 8 text-shadow: 0 1px 0 #37b2eb; 9 -moz-border-radius: 5px 5px 0 0;10 -webkit-border-top-left-radius: 5px;11 -webkit-border-top-right-radius: 5px;9 /*-moz-border-radius: 5px 5px 0 0;*/ 10 /*-webkit-border-top-left-radius: 5px;*/ 11 /*-webkit-border-top-right-radius: 5px;*/ 12 12 font-size: 13px; 13 13 } … … 30 30 31 31 .tcol1 { 32 border-left: 1px solid #ccc;33 32 border-bottom: 1px solid #ccc; 34 33 } … … 37 36 border-right: 1px solid #ccc; 38 37 border-bottom: 1px solid #ccc; 39 text-align:center; 38 text-align:right; 39 margin-left:5px; 40 margin-right:5px; 41 } 42 43 .tcol0 { 44 border-left: 1px solid #ccc; 45 border-bottom: 1px solid #ccc; 46 text-align:left; 40 47 margin-left:5px; 41 48 margin-right:5px; … … 84 91 vertical-align: middle; 85 92 padding: 6px; 86 -moz-border-radius: 0 0 5px 5px;87 -webkit-border-bottom-left-radius: 5px;88 -webkit-border-bottom-right-radius: 5px;93 /*-moz-border-radius: 0 0 5px 5px;*/ 94 /*-webkit-border-bottom-left-radius: 5px;*/ 95 /*-webkit-border-bottom-right-radius: 5px;*/ 89 96 text-shadow: 0 -1px 0 #333; 90 97 font-size: 12px; -
trunk/FACT++/www/index.html
r13464 r13479 1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional" 2 "http://www.w3.org/TR/html4/loose.dtd"> 1 <!--<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional" 2 "http://www.w3.org/TR/html4/loose.dtd">--> 3 <!DOCTYPE HTML> 3 4 <html> 4 5 … … 7 8 <script type="text/javascript" src="index.js"></script> 8 9 <link rel="stylesheet" type="text/css" href="index.css" /> 10 <meta name="viewport" content="width=device-width, height=device-height, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0" /> 9 11 </head> 10 12 11 <body id="body" onload="onload(true)" onresize="onresize(false)"> 12 <!--<font size="+2">--> 13 <table id="table" border="0" cellspacing="0" cellpadding="6" class="tborder" width="100%"> 13 <body id="body" onload="onload();" onresize="onresize();" data-visible='0'> 14 14 15 <!--------------------------------------------------> 16 <!------------------ Header -------------------> 17 <!--------------------------------------------------> 18 <thead> 19 <tr> 20 <td class="thead" colspan="2" width="100%"> 21 <table width="100%"><tr> 22 <td class="tcell1"><font size="+2">» <a href="forumdisplay.php?fid=1">FACT</a> «</font></td> 23 <td class="tcell2"><font size="-2"><div id="time">Wed, 25 Apr 2012 10:45:23 GMT</div></font></td> 24 </tr></table> 25 </td> 26 </tr> 27 </thead> 15 <table id="table0" border="0" cellspacing="0" cellpadding="6" class="tborder" width="100%" style="overflow:hidden;position:fixed;top:0;left:0;display:none;" > 16 <thead> 17 <tr> 18 <td class="thead" colspan="3" width="100%"> 19 <table width="100%"><tr> 20 <td class="tcell1"><font size="+2">» <a href="forumdisplay.php?fid=1" id="title0">FACT</a> «</font></td> 21 <td class="tcell2"><font size="-2" id="reporttime0">Wed, 25 Apr 2012 10:45:23 GMT</font></td> 22 </tr></table> 23 </td> 24 </tr> 25 </thead> 26 <tbody></tbody> 27 <tfoot> 28 <tr> 29 <td class="tfoot" width="100%" colspan="3"> 30 <table width="100%"><tr> 31 <td class="tcell1"><font size="+2"><A HREF="/logbook">logbook</A></font></td> 32 <td class="tcell2"><font size="-2" id="localtime0">booting...</font></td> 33 </tr></table> 34 </td> 35 </tr> 36 </tfoot> 37 </table> 28 38 29 <!--------------------------------------------------> 30 <!------------------ Body -------------------> 31 <!--------------------------------------------------> 32 <tbody> 33 34 <!------------------- System status ----------------------> 35 <tr class="row" id="system_row"> 36 <td class="tcol1" width="100%" onclick="location.href='forumdisplay.php?fid=2';"> 39 <table id="table1" border="0" cellspacing="0" cellpadding="6" class="tborder" width="100%" style="overflow:hidden;position:fixed;top:0;left:0;display:none;" > 40 <thead> 41 <tr> 42 <td class="thead" colspan="3" width="100%"> 37 43 <table width="100%"><tr> 38 <td class="tcell1" id="system_title">System status</td> 39 <td class="tcell2" id="system">---</td> 40 </tr></table> 41 </td> 42 <td class="tcol2">></td> 43 </tr> 44 45 <!-------------------- Drive ----------------------------> 46 <tr class="row" id="drive_row"> 47 <td class="tcol1" width="100%" onclick="location.href='forumdisplay.php?fid=2';"> 48 <table width="100%"><tr> 49 <td class="tcell1" id="drive_title">Drive</td> 50 <td class="tcell2" id="drive">---</td> 51 </tr></table> 52 </td> 53 <td class="tcol2">></td> 54 </tr> 55 56 <!-------------------- Temperature --------------------> 57 <tr class="row" id="temp_row"> 58 <td class="tcol1" width="100%" onclick="location.href='forumdisplay.php?fid=2';"> 59 <table width="100%"><tr> 60 <td class="tcell1" id="temp_title">Temp [dew]</td> 61 <td class="tcell2" id="temp">---</td> 62 </tr></table> 63 </td> 64 <td class="tcol2">></td> 65 </tr> 66 67 <!----------------------- Wind --------------------------> 68 <tr class="row" id="aux_row"> 69 <td class="tcol1" width="100%" onclick="location.href='forumdisplay.php?fid=2';"> 70 <table width="100%"><tr> 71 <td class="tcell1" id="aux_title">Wind</td> 72 <td class="tcell2" id="aux">---</td> 73 </tr></table> 74 </td> 75 <td class="tcol2">></td> 76 </tr> 77 78 <!-------------------- Bias ------------------------> 79 <tr class="row" id="bias_row"> 80 <td class="tcol1" width="100%" onclick="location.href='forumdisplay.php?fid=2';"> 81 <table width="100%"><tr> 82 <td class="tcell1" id="bias_title">Bias</td> 83 <td class="tcell2" id="bias">---</td> 84 </tr></table> 85 </td> 86 <td class="tcol2">></td> 87 </tr> 88 89 <!-------------------- Picture ------------------------> 90 <tr class="row" style="margin:0;padding:0;"> 91 <td class="container" id="container" onclick="save()" colspan="2"> 92 <canvas id="canvas" width="1" height="1"/> 93 </td> 94 </tr> 95 </tbody> 96 97 <!--------------------------------------------------> 98 <!------------------ Footer -------------------> 99 <!--------------------------------------------------> 100 <tfoot> 101 <tr> 102 <td class="tfoot" width="100%" colspan="2"> 103 <table width="100%"><tr> 104 <td class="tcell1"><font size="+2"><A HREF="/logbook">logbook</A></font></td> 105 <td class="tcell2"><font size="-2"><div id="localtime">booting...</div></font></td> 106 </tr></table> 107 </td> 108 </tr> 109 </tfoot> 110 44 <td class="tcell1"><font size="+2">» <a href="forumdisplay.php?fid=1" id="title1">FACT</a> «</font></td> 45 <td class="tcell2"><font size="-2" id="reporttime1">Wed, 25 Apr 2012 10:45:23 GMT</font></td> 46 </tr></table> 47 </td> 48 </tr> 49 </thead> 50 <tbody></tbody> 51 <tfoot> 52 <tr> 53 <td class="tfoot" width="100%" colspan="3"> 54 <table width="100%"><tr> 55 <td class="tcell1"><font size="+2"><A HREF="/logbook">logbook</A></font></td> 56 <td class="tcell2"><font size="-2" id="localtime1">booting...</font></td> 57 </tr></table> 58 </td> 59 </tr> 60 </tfoot> 111 61 </table> 112 <!--</font>-->113 114 <!-------------------- Debug ------------------------>115 <div id="debug"/>116 117 <!--118 <strong><a href="forumdisplay.php?fid=2" class="forum_on">Logbook</a></strong>119 <div class="lastbytext">1,210 Posts. Last post: 17.04.2012</div>120 -->121 62 122 63 </body> -
trunk/FACT++/www/index.js
r13470 r13479 22 22 function onload() 23 23 { 24 loadPage("fact"); 25 26 refresh_text(); 27 refresh_graphics(); 24 loadPage("fact", 0); 28 25 } 29 26 … … 54 51 } 55 52 53 buildPage(name, xmlHttp.responseText, (z+1)%2); 54 changePage(z); 55 56 56 //changePage(name, xmlHttp.resposeText); 57 58 57 //slideOut(name, xmlHttp.responseText); 59 60 displayPage(name, xmlHttp.responseText, 1); 61 onresize(true); 58 //displayPage(name, xmlHttp.responseText); 59 //onresize(true); 62 60 } 63 61 }; … … 67 65 68 66 69 function displayPage(name, text, z) 70 { 71 var table = $("tbody"+z); 72 67 function buildPage(name, text, z) 68 { 69 var table = $("table"+z); 73 70 table.setAttribute("data-file", ""); 74 71 75 while (table.hasChildNodes()) 76 table.removeChild(table.lastChild); 72 var p = table.tBodies.length==3 ? 1 : 0; 73 74 var tbody = $("table"+z).tBodies[p]; 75 76 while (tbody.hasChildNodes()) 77 tbody.removeChild(tbody.lastChild); 77 78 78 79 var lines = text.split('\n'); … … 80 81 if (lines.length>0) 81 82 { 83 /* 82 84 var newe = document.createElement("span"); 83 85 newe.innerHTML = lines[0]; 84 $("title").replaceChild(newe, $("title").lastChild); 86 var title = $("table"+z).tHead.rows[0].cells[0].childNodes[0].childNodes[1]; 87 title.replaceChild(newe, title.lastChild); 88 */ 89 90 //var x = title.lastChild; 91 //title.removeChild(title.lastChild); 92 //title.appendChild(newe); 93 94 var newe = document.createElement("span"); 95 newe.innerHTML = lines[0]; 96 var title = $("title"+z);//.innerHtml = lines[0]; 97 title.replaceChild(newe, title.lastChild); 85 98 } 86 99 … … 96 109 if (cols.length != 3 && cols.length !=4) 97 110 { 98 alert("Size mismatch #"+i+": "+lines[i]);111 alert("Size mismatch #"+i+": '"+lines[i]+"' N(cols)="+cols.length); 99 112 continue; 100 113 } … … 114 127 115 128 var canv = document.createElement("canvas"); 116 canv.setAttribute("id", "canvas" );129 canv.setAttribute("id", "canvas"+z); 117 130 canv.setAttribute("width", "1"); 118 131 canv.setAttribute("height", "1"); 119 132 canv.setAttribute("data-file", cols[1].substring(7)); 133 canv.setAttribute("style", "display:none;"); 120 134 td.appendChild(canv); 121 135 122 table.appendChild(tr); 136 var img = document.createElement("img"); 137 img.setAttribute("id", "image"+z); 138 img.setAttribute("width", "1"); 139 img.setAttribute("height", "1"); 140 td.appendChild(img); 141 142 tbody.appendChild(tr); 123 143 continue; 124 144 } … … 126 146 var tr = document.createElement("tr"); 127 147 tr.setAttribute("class", "row"); 148 if (valid(cols[0])) 149 tr.setAttribute("onclick", "this.style.background='#ccb'; loadPage('"+cols[0]+"',"+z+");"); 150 if (valid(cols[3])) 151 tr.setAttribute("onclick", "this.style.background='#ccb'; loadPage('"+cols[3]+"',"+z+");"); 128 152 //tr.setAttribute("id", cols[0]+"_row"); 129 153 … … 137 161 td1.setAttribute("class", "tcol1"); 138 162 td1.setAttribute("width", "100%"); 139 if (valid(cols[0]))140 td1.setAttribute("onclick", "loadPage('"+cols[0]+"');");141 if (valid(cols[3]))142 td1.setAttribute("onclick", "loadPage('"+cols[3]+"');");143 163 tr.appendChild(td1); 144 164 … … 170 190 innertr.appendChild(cell2); 171 191 172 t able.appendChild(tr);192 tbody.appendChild(tr); 173 193 174 194 counter++; … … 201 221 tr.appendChild(td); 202 222 203 t able.appendChild(tr);223 tbody.appendChild(tr); 204 224 205 225 table.setAttribute("data-file", name); 206 226 } 207 227 208 function onresize(load) 209 { 228 function onresize() 229 { 230 var z = $("body").getAttribute("data-visible"); 231 232 var img = $("image"+z); 233 var canv = $("canvas"+z); 234 if (img == undefined || canv == undefined) 235 return; 236 210 237 var W = window.innerWidth; 211 238 var H = window.innerHeight; 212 239 213 var canv = $("canvas"); 214 215 if (canv != undefined) 216 { 217 canv.width = 1; 218 canv.height = 1; 219 } 220 221 var tw = $('table').offsetWidth; 222 var th = $('table').offsetHeight; 223 224 var tx = $('table').offsetLeft; 225 var ty = $('table').offsetTop; 226 227 //var margin = (W-tw)*2; 228 229 var cw = tw - 2*tx; 230 var ch = H - th - 2*ty; 231 232 if (canv != undefined) 233 { 234 canv.width = cw; 235 canv.height = ch-ty; 236 } 240 img.width = 1; 241 img.height = 1; 242 243 img.width = W; 244 img.height += H - $("table"+z).offsetHeight; 245 246 canv.width = img.width; 247 canv.height = img.height; 237 248 238 249 // ------ debug ----- 239 250 $('debug').innerHTML = ""; 240 $('debug').innerHTML += "|x="+tx+"/"+ty;241 251 $('debug').innerHTML += "|W="+W +"/"+H; 242 $('debug').innerHTML += "|T="+tw+"/"+th; 243 $('debug').innerHTML += "|C="+cw+"/"+ch; 244 } 245 246 var intervalSlideOut = null; 247 248 function changePage(newpage) 249 { 250 var z = $("body").dataset.visible; 251 $('table').style.position="fixed"; 252 intervalSlideOut = setInterval("doSlideOut('"+newpage+"')", 100); 253 } 254 255 function doSlideOut(newpage) 256 { 252 } 253 254 var intervalSlide = null; 255 256 function changePage(z) 257 { 258 // No page displayed yet 259 if ($("table0").style.display=="none" && $("table1").style.display=="none") 260 { 261 $("table1").style.display=""; 262 $("body").setAttribute("data-visible", "1"); 263 264 onresize(); 265 266 refresh_text(); 267 refresh_graphics(); 268 return; 269 } 270 271 intervalSlide = setInterval("doSlideOut("+z+")", 25); 272 } 273 274 function doSlideOut(z) 275 { 276 var table = $("table"+z); 277 257 278 var W = window.innerWidth; 258 var x = $('table').offsetLeft;279 var x = table.offsetLeft; 259 280 260 281 var ix = parseInt(x); 261 282 if (ix>W) 262 283 { 263 clearInterval(intervalSlideOut); 264 slideIn(); 284 clearInterval(intervalSlide); 285 286 table.style.display="none"; 287 288 z = (z+1)%2; 289 table = $("table"+z); 290 291 table.style.display=""; 292 table.style.left = window.innerWidth+"px"; 293 294 $("body").setAttribute("data-visible", z); 295 onresize(); 296 297 intervalSlide = setInterval("doSlideIn("+z+")", 25); 265 298 return; 266 299 } 267 300 268 301 ix += W/10; 269 270 $('table').style.left=ix+"px"; 271 272 // timeoutSlideOut = setTimeout("slideOut()", 100); 273 } 274 275 function slideIn() 276 { 302 table.style.left=ix+"px"; 303 } 304 305 function doSlideIn(z) 306 { 307 var table = $("table"+z); 308 277 309 var W = window.innerWidth; 278 var x = $('table').offsetLeft;310 var x = table.offsetLeft; 279 311 280 312 var ix = parseInt(x); 281 313 if (ix==0) 282 314 { 283 $('table').style.position=""; 284 // restart refersh! 315 clearInterval(intervalSlide); 285 316 return; 286 317 } … … 290 321 ix = 0; 291 322 292 $('table').style.left=ix+"px"; 293 294 setTimeout("slideIn()", 100); 323 table.style.left=ix+"px"; 295 324 } 296 325 297 326 function refresh_text() 298 327 { 299 // Is sliding? 300 if ($('table').style.position=="fixed") 301 return; 302 303 var z=$("body").dataset.visible; 304 305 var fname = $("tbody"+z).dataset.file; 306 if (!valid(fname)) 328 var z=$("body").getAttribute("data-visible"); 329 var table = $("table"+z); 330 331 // Is sliding or no file defined? 332 var fname = table.getAttribute("data-file"); 333 if (table.offsetLeft>0 || !valid(fname)) 307 334 { 308 335 setTimeout("refresh_text()", 1000); … … 330 357 alert("ERROR[1] - HTTP request '"+fname+".txt': "+this.statusText+" ["+this.status+"]"); 331 358 setTimeout("refresh_text()", 10000); 332 /****** invalidate ******/333 359 return; 334 360 } 335 361 336 //alert("ok"); 337 process_status(fname, this.responseText); 362 update_text(fname, this.responseText); 338 363 setTimeout("refresh_text()", 3000); 339 364 } … … 343 368 } 344 369 345 function strike(id, status) 346 { 347 var e = $(id); 370 function strike(e, status) 371 { 348 372 if (!e) 349 373 return; … … 376 400 var date0 = null; 377 401 378 function process_status(fname, result) 379 { 380 var z=$("body").dataset.visible; 381 if ($("tbody"+z).dataset.file != fname) 402 function update_text(fname, result) 403 { 404 var z=$("body").getAttribute("data-visible"); 405 var table = $("table"+z); 406 407 if (table.getAttribute("data-file") != fname) 382 408 return; 383 409 … … 385 411 386 412 // ---------------------------------------------------- 413 414 var time = $("reporttime"+z); 415 var ltime = $("localtime"+z); 416 387 417 var date1 = new Date(); 388 418 … … 390 420 { 391 421 if (date0 != null) 392 strike("time", date0.getTime()+60000>date1.getTime());422 strike(time, date0.getTime()+60000>date1.getTime()); 393 423 // FIXME: Reset display to "---" values -- no connection 394 424 return; … … 398 428 date2.setTime(tokens[0]); 399 429 400 strike( "time", date2.getTime()+60000>date1.getTime());430 strike(time, date2.getTime()+60000>date1.getTime()); 401 431 402 432 date0 = date2; 403 433 434 time.innerHTML = 435 "· "+date0.toUTCString()+" ·";//getUTCFullYear()+"/"+date0.getUTCMonth()+"/"+date0.getUTCDate()+" "+date0.getUTCHours()+":"+date0.getUTCMinutes()+":"+date0.getUTCSeconds()+"."+date0.getUTCMilliseconds(); 436 ltime.innerHTML = 437 "· "+date1.toLocaleString()+" ·";//ISOlocalDateStr();//ltoString(); 438 404 439 // ---------------------------------------------------- 405 440 441 var p = table.tBodies.length==3 ? 1 : 0; 442 var tbody = table.tBodies[p]; 443 406 444 for (var line=1; line<tokens.length; line++) 407 445 { 408 var e = $("data"+line); 446 var c = tbody.rows[line-1].cells[1]; 447 if (c == undefined) 448 continue; 449 450 var e = c.childNodes[0].rows[0].cells[1]; 409 451 if (e == undefined) 410 452 continue; 411 453 412 var form = e. dataset.form;454 var form = e.getAttribute("data-form"); 413 455 if (form==undefined) 414 456 continue; … … 424 466 e.parentNode.parentNode.parentNode.parentNode.style.background=cols[0]; 425 467 } 426 427 $("time").innerHTML =428 "· "+date0.toUTCString()+" ·";//getUTCFullYear()+"/"+date0.getUTCMonth()+"/"+date0.getUTCDate()+" "+date0.getUTCHours()+":"+date0.getUTCMinutes()+":"+date0.getUTCSeconds()+"."+date0.getUTCMilliseconds();429 430 $("localtime").innerHTML =431 "· "+date1.toLocaleString()+" ·";//ISOlocalDateStr();//ltoString();432 468 } 433 469 … … 438 474 function refresh_graphics() 439 475 { 440 // Is sliding? 441 if ($('table').style.position=="fixed") 442 return; 443 444 var canvas = $("canvas"); 445 446 var fname = canvas==null ? "" : $("canvas").dataset.file; 447 if (!valid(fname)) 476 var z = $("body").getAttribute("data-visible"); 477 478 var canvas = $("canvas"+z); 479 480 // Is sliding or no data file defined? 481 var fname = canvas==null ? "" : canvas.getAttribute("data-file"); 482 if ($("table"+z).offsetLeft>0|| !valid(fname)) 448 483 { 449 484 setTimeout("refresh_graphics()", 1000); … … 456 491 catch(e) 457 492 { 458 try { xmlHttp = new ActiveXObject("Microsoft.XMLHTTP"); } 459 catch(e) 460 { 461 try { xmlHttp = new ActiveXObject("Msxml2.XMLHTTP"); } 462 catch(e) 463 { 464 alert("Your browser doesn't support dynamic reload."); 465 return; 466 } 467 } 493 alert("Your browser doesn't support dynamic reload."); 494 return; 468 495 } 469 496 … … 548 575 function drawPix(x, y, col) 549 576 { 550 var canv = $("canvas"); 577 var z = $("body").getAttribute("data-visible"); 578 var canv = $("canvas"+z); 551 579 552 580 var cw = canv.width; … … 570 598 return; 571 599 572 var canv = $("canvas"); 600 var z = $("body").getAttribute("data-visible"); 601 var canv = $("canvas"+z); 573 602 if (canv == undefined) 574 603 return; … … 675 704 ctx.strokeText("2.0V", cw-5, 5); 676 705 677 } 678 706 var img = $("image"+z); 707 img.src = canv.toDataURL("image/png"); 708 709 } 710 /* 679 711 function save() 680 712 { … … 686 718 document.location.href = img; 687 719 } 720 */
Note:
See TracChangeset
for help on using the changeset viewer.