From 2f355e31305e377282dbf9329f004bed8f67c76e Mon Sep 17 00:00:00 2001 From: Eddy Date: Wed, 19 Mar 2014 00:48:48 +0400 Subject: [PATCH] copy --- BTApanels/BTA.html | 143 +++++++++++++++++ BTApanels/BTA.html.ru | 134 ++++++++++++++++ BTApanels/index.html | 14 ++ BTApanels/panels.css | 90 +++++++++++ BTApanels/panels.js | 328 ++++++++++++++++++++++++++++++++++++++ BTApanels/weather.html | 63 ++++++++ BTApanels/weather.html.ru | 64 ++++++++ bta_print.cgi | 7 + 8 files changed, 843 insertions(+) create mode 100644 BTApanels/BTA.html create mode 100644 BTApanels/BTA.html.ru create mode 100644 BTApanels/index.html create mode 100644 BTApanels/panels.css create mode 100644 BTApanels/panels.js create mode 100644 BTApanels/weather.html create mode 100644 BTApanels/weather.html.ru create mode 100755 bta_print.cgi diff --git a/BTApanels/BTA.html b/BTApanels/BTA.html new file mode 100644 index 0000000..640f301 --- /dev/null +++ b/BTApanels/BTA.html @@ -0,0 +1,143 @@ + + + +BTA control information + + + + + + + + + + + + + + +

BTA control information


+
+
+ + + + + + +

Date:

Moscow time:

Sidereal time:

+
+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
AzimuthZenith
Target
Current
Difference
Speed
Correction
Apparent placeR.A.Dec
Target
Current
Input
Correction
Telescope
+
+ + + + + + + + + + +
P2
P2 State
+ +
+ + + + + + + + + + + + + + + + +
SystemFocus
StateFocus value
+ + +
+ + \ No newline at end of file diff --git a/BTApanels/BTA.html.ru b/BTApanels/BTA.html.ru new file mode 100644 index 0000000..bbb0adf --- /dev/null +++ b/BTApanels/BTA.html.ru @@ -0,0 +1,134 @@ + + + +Информация БТА + + + + + + + + + + + + + + + + +

Информация о БТА


+
+
+ + + + + + +
Дата: Московское время: Звездное время:
+
+ + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
АзимутЗенитное расстояние
Цель
Положение
Разность
Скорость
Коррекция
Прямое восхождениеСклонение
Текущие
Исходные
Введенные
Коррекция
Положение
+
+ + + + + + + + + + + + + +
Система
Состояние
Фокус
+
Значение фокуса
+
+
P2
+ +
Цель:
+
Положение:
+
Состояние
+
+
+
+ + \ No newline at end of file diff --git a/BTApanels/index.html b/BTApanels/index.html new file mode 100644 index 0000000..7a15868 --- /dev/null +++ b/BTApanels/index.html @@ -0,0 +1,14 @@ + + + +Информационные панели БТА + + + + +
+

Информационные панели БТА

+Погода
+Состояние телескопа +
+ diff --git a/BTApanels/panels.css b/BTApanels/panels.css new file mode 100644 index 0000000..9a09d5d --- /dev/null +++ b/BTApanels/panels.css @@ -0,0 +1,90 @@ +body{ + margin: 2px; + background: #DDD; + font-style: normal; + font-weight: normal; + font-size: 24px; + } + +h1, h2{ + text-align: center; font-weight: bold; + margin: -10px; padding: 0px; font-size: 250%; + } + +h2{ font-size: 140%; color: #FF0;} + +h3{ + text-align: left; font-weight: bold; font-style: italic; + margin: 0px; padding: 0px; font-size: 110%; + } + +div{ + text-align: center; padding: 2px; margin: 2px; + } +.inline{margin: -5px;} + +.header{ + width: 100%; height: 100px; text-align: center; border: 2px solid; + } + +.bold {font-weight: bold;} + +td,th {padding-bottom: 4px; padding-top: 4px; text-align: center; vertical-align: top;} +th {background: #000; color: #FFF;} + +.border { + border: 2px solid; padding-left: 5px; padding-right: 5px; vertical-align: middle; + } + +.top {vertical-align: top;} +.mid {text-align: center; vertical-align: middle;} +.right{text-align: right;} +.topright, .topleft { + position: absolute; top: 20px; + font-weight: normal; font-size: 70%; + } +.topright {right: 20px;} +.topleft {left: 20px;} + +.label{margin-top: 20px;} + +.hand {color: #0F0; cursor: pointer; font-weight: bold;} + +.Green {background: #0F0;} +.Blue {background: #00F;} +.Cyan {background: #0FF;} +.Red {background: #F00;} +.Yellow{background: #FF0;} +.White {background: #FFF;} +.Black {background: #000; color: #FFF;} + +.C {text-align: center;} + +.Cb {text-align: center; padding: 5px; + border: solid 1px black;} +.b {border: solid 1px black;} + +.La {float: left;} + +.s {width: 70px;} + +.small{width: 25px; height: 20px;} + +.Light {background: #DDE;} + +.chooser{ + display: none; border-radius: 5px; position: absolute; + left: 20px; top: 20px; border: solid 1px black; background-color: #DDD; +} + +.helper {position: fixed; left: 3px; top: 3px; color: green; cursor: pointer;} +#helptip{ + position: fixed; background-color: #BFE; border-radius: 5px; + color: black; max-width: 400px; max-height: 500px; padding: 5px; +} +.redtxt {color: red; margin-top: 20px;} + +.full{width: 100%;} + +.pre{white-space:pre; text-indent: 0px;} + diff --git a/BTApanels/panels.js b/BTApanels/panels.js new file mode 100644 index 0000000..3df18f2 --- /dev/null +++ b/BTApanels/panels.js @@ -0,0 +1,328 @@ +var Stimeout, Itimeout; // таймеры для обновления времени и изображения +var Rtimeout, Etimeout; // таймер запросов, таймаут сообщ. об ошибке +const Stimeout_rate = 500, Itimeout_rate = 30000, Rtimeout_rate = 5000; +var ImageSrc = new Array(2); // адрес изображения +var Isrc = 0; // номер адреса изображения +var oldDate = 0; // дата/время на момент последнего обновления (в мс) +var MskTime, SidTime; // московское и звездное время +var PanelType; + +const paramsURL = [ "http://tb.sao.ru/cgi-bin/eddy/bta_print.cgi", + "http://ishtar.sao.ru/cgi-bin/bta_print.cgi"]; +const MeteoURL = [ "http://tb.sao.ru/cgi-bin/eddy/tempmon", + "http://ishtar.sao.ru/cgi-bin/tempmon"]; +var URLcntr = 0; +const windURL = "http://ztcs.sao.ru/meteo/wind.png"; +const BTAURL = "http://tb.sao.ru/tcs/ctrl/bta_img.cgi?size=150&mode="; +const GuideURL = "http://n2.sao.ru/webcam/webcam_n2_0.jpeg"; +const USNOURL = "http://n2.sao.ru/ua2/gd15_ua2_jpeg.cgi?size=384&coord=cur"; +const myURL = "http://ishtar.sao.ru/BTApanels/"; + +function $(Id){ + return document.getElementById(Id); +} + +function _(Name){ + return document.getElementsByTagName(Name); +} + +function chBigImg(){ + Isrc = (Isrc == 0) ? 1:0; + $('BigIMG').src = ImageSrc[Isrc] + "?" + Math.random(); +} + +function init(panelName){ + $('reqmsgs').innerHTML = "Loading..."; + MskTime = new Date(); + SidTime = new Date(); + make_menu(panelName); + PanelType = panelName; + if(panelName == "BTA") + ImageSrc[0] = ImageSrc[1] = "http://tb.sao.ru/webcam/webcam_sky_1_maxi.jpeg"; + else if(panelName == "meteo"){ + ImageSrc[1] = "http://zserv.sao.ru/webcam/webcam_zserv_2_maxi.jpeg"; + ImageSrc[0] = "http://zserv.sao.ru/webcam/webcam_zserv_3_maxi.jpeg"; + //ImageSrc[1] = "http://zsky.sao.ru/mjpg/4/video.mjpg"; + } + $('BigIMG').onclick = chBigImg; + $('BigIMGlabel').onclick = chBigImg; + startTimers(); +} + +function make_menu(panelName){ + var chooserTimeout; + var names = [ "BTA", "meteo" ]; + var URLS = [ "BTA.html", "weather.html" ]; + var itemstext = [ "Bta info", "meteo info" ]; + var l = names.length, i; + var menu = $('menu'); + menu.innerHTML = "Choose panel's info"; + var chooser = document.createElement("div"); + chooser.className = "chooser"; + chooser.id = "chooser"; + chooser.onmouseout = function(){ + chooserTimeout=setTimeout("$('chooser').style.display='none';",2000);}; + chooser.onmouseover = function(){ clearTimeout(chooserTimeout); }; + menu.appendChild(chooser); + menu.onclick = function(){ showhide('chooser'); }; + for(i = 0; i < l; i++){ + if(names[i] == panelName) continue; + var item = document.createElement("div"); + item.innerHTML = ""+itemstext[i]+""; + chooser.appendChild(item); + } +} + +function showhide(id){ + style = $(id).style.display; + if(style == "block") $(id).style.display = "none"; + else $(id).style.display = "block"; +} + +function refreshTimer(){ + var d = new Date(); + var diff = d.getTime() - oldDate; + //oldDate = d.getTime(); + clearTimeout(Stimeout); + $('Date').innerHTML = formatDate(MskTime); + if(typeof(M_time) != "undefined"){ + //MskTime.setTime(MskTime.getTime() + diff); + //$('Mtime').innerHTML = formatTime(MskTime); + d.setTime(MskTime.getTime() + diff); + $('Mtime').innerHTML = formatTime(d); + } + if(typeof(S_time) != "undefined"){ + //SidTime.setTime(SidTime.getTime() + diff); + //$('Stime').innerHTML = formatTime(SidTime); + d.setTime(SidTime.getTime() + diff); + $('Stime').innerHTML = formatTime(d); + } + Stimeout = setTimeout(refreshTimer, Stimeout_rate); + delete(d); +} + +function sendR(){ + var request; + sendRequest(request, paramsURL[URLcntr], "", parceReqStr); +} + +function refreshImage(){ + var yesterday = oldDate/1000 - 86400; + var imH = (window.innerHeight-$('header').offsetHeight-40)/4-20; + if(imH < 100) imH = 100; + function refreshIMG(id, URL){ + /*var oldIMG = $(id); + var newIMG = document.createElement("img"); + var parent = oldIMG.parentNode; + newIMG.src = URL; + parent.insertBefore(newIMG, oldIMG); + oldIMG.src = null; + parent.removeChild(oldIMG); + delete(oldIMG); + newIMG.id = id;*/ + $(id).src = URL; + } + var params = MeteoURL[URLcntr] + "?Tstart=" + yesterday + "&Stat=31&height="+imH + "&Gtype=0&Graph="; + clearTimeout(Itimeout); + var rnd = Math.random(); + refreshIMG('BigIMG', ImageSrc[Isrc] + "?" + rnd); + if(PanelType == "meteo"){ + // временно вместо облаков и качества изображения пишем давление и влажность + refreshIMG('clouds', params + "16"); + refreshIMG('temp', params + "7"); + refreshIMG('wind', params + "8"); + refreshIMG('seeing', params + "32"); + refreshIMG('winddir',windURL+ "?" + rnd); + refreshIMG('GuideIMG', GuideURL + "?" + rnd); + refreshIMG('CatIMG', USNOURL + "&" + rnd); + } + else if(PanelType == "BTA"){ + refreshIMG('A', BTAURL + "1&" + rnd); + refreshIMG('Z', BTAURL + "2&" + rnd); + refreshIMG('P2', BTAURL + "3&" + rnd); + } + Itimeout = setTimeout(refreshImage, Itimeout_rate); +} + +function handleError(msg) { + clearTimeout(Etimeout); + $('reqmsgs').innerHTML = "Ошибка xmlhttprequest:" + msg; + Etimeout = setTimeout(function(){$('reqmsgs').innerHTML = "";}, 5000); + URLcntr++; if(URLcntr > 1) URLcntr = 0; + sendR(); + refreshImage(); + refreshTimer(); +} + +function sendRequest(request, CGI_PATH, req_STR, fn_OK){ + var timeout_id, str; + if(window.XMLHttpRequest){ + request = new XMLHttpRequest(); + if(request.overrideMimeType) + request.overrideMimeType("text/plain;"); + }else{ + if(window.ActiveXObject){ + var sign_a = ['MSXML2.XMLHTTP.6.0', + 'MSXML2.XMLHTTP.5.0', + 'MSXML2.XMLHTTP.4.0', + 'MSXML2.XMLHTTP.3.0', + 'MSXML2.XMLHTTP', + 'Microsoft.XMLHTTP']; + for(var i=0, l=sign_a.length; i 1) return A; + else return ("00" + A).slice(-2); +} + +function formatDate(date){ + if(date.toLocaleFormat) return date.toLocaleFormat("%d.%m.%Y"); + else + return _2(date.getDate())+"."+_2(1+date.getMonth())+"."+date.getFullYear(); +} + +function formatTime(date){ + if(date.toLocaleFormat) return date.toLocaleFormat("%H:%M:%S"); + else + return _2(date.getHours())+":"+_2(date.getMinutes())+":"+_2(date.getSeconds()); +} + +function parceReqStr(request){ + var i, l, lines, pair, parms, el; + clearTimeout(Stimeout); + clearTimeout(Rtimeout); + lines = request.responseText.split('\n'); + for(i=0, l=lines.length; i= bad) classname = "Red"; + else if(absval < good) classname = "Green"; + else classname = "Yellow"; + $(elId).className = classname + " border"; + } + if(PanelType == "meteo"){ + showVal("tempdiff", ValTout - ValTmir, 10, 5); + showVal("windspeed", ValWind, 15, 10); + if(Blast15 == " " && Blast10 == " ") $('Gust').innerHTML = "no"; + else showGustTime(); + } + else if(PanelType == "BTA"){ + $('ACS_BTA').className = "border "+((ACS_BTA!="On")?"Yellow":"Green"); + $('P2_Mode').className = "border "+((P2_Mode=="Stop")?"Yellow":"Green"); + var colr = "Yellow"; + switch(Tel_Mode){ + case "Pointing" : colr = "Blue"; break; + case "Tracking": colr = "Green"; break; + case "Seeking" : + case "Correction" : colr = "Cyan"; break; + case "Off" : colr = "Red"; break; + case "Waiting" : colr = "White"; break; + case "Testing" : colr = "Black"; break; + } + $('Tel_Mode').className = "border "+colr; + } +} + +function showGustTime(){ + var Gust = $('Gust'); + var Gtime = Number(Blast15); + var pref = ">=15 m/s"; + if (Gtime > 1440){ + var G10 = Number(Blast10); + if(G10 < 1440){ + pref = ">=10 m/s"; + Gtime = G10; + }else{ + Gust.innerHTML = "More than a day ago"; + return; + } + } + var now = new Date(); + var h = Math.floor(Gtime/60); + now.setTime(MskTime.getTime() - Gtime * 60000); + var str = (Gtime < 1) ? _2(Gtime)+"s" : ((Gtime < 60)? _2(Gtime)+"m" : + _2(h)+"h "+_2(Gtime%h)+"m"); + Gust.innerHTML = pref+"
"+_2(now.getHours())+":"+_2(now.getMinutes())+"
("+str+" ago)"; + if(Gtime >= 60) Gust.className = "border"; + else Gust.className = "Yellow border"; + delete(now); +} + +function stopTimers(){ + clearTimeout(Stimeout); + clearTimeout(Itimeout); + clearTimeout(Rtimeout); + $('stop').innerHTML="Start refreshing"; + $('stop').onclick=startTimers; +} + +function startTimers(){ + sendR(); + $('stop').innerHTML="Stop refreshing"; + $('stop').onclick=stopTimers; + var d = new Date(); + oldDate = d.getTime(); + delete(d); + refreshImage(); + clearTimeout(Etimeout); + Etimeout = setTimeout(function(){$('reqmsgs').innerHTML = "";}, 1000); +} diff --git a/BTApanels/weather.html b/BTApanels/weather.html new file mode 100644 index 0000000..6f43ffe --- /dev/null +++ b/BTApanels/weather.html @@ -0,0 +1,63 @@ + + + +Meteo data + + + + + + + + + + + + + + + + + +

Meteo data


+
+
+ + + + + + +

Date:

Moscow time:

Sidereal time:

+
+
Click on image to change videoserver
+
+ + +
+ +
Temperature: external oC, + in-dome oC, + mirror oC +
+ + + +
+
Sky
+
unknown
+
Temp. difference
+
+
Wind speed
+
+
Last gust time
+
+
Wind direction
+ +
Seeing
+
unknown
+
+ + diff --git a/BTApanels/weather.html.ru b/BTApanels/weather.html.ru new file mode 100644 index 0000000..6003dee --- /dev/null +++ b/BTApanels/weather.html.ru @@ -0,0 +1,64 @@ + + + +Метеорологические данные + + + + + + + + + + + + + + + + + +

Метеорологические данные


+
+
+ + + + + + +
Дата: Московское время: Звездное время:
+
+
+ + +
+ +
Температура: внешняя oC, + внутренняя oC, + зеркала oC +
+ + + +
+
Облачность
+
--
+
Разность температур
+
+
Время перепада температуры >10oC
+
+
Скорость ветра
+
+
Время последнего порыва >15м/с
+
+
Направление ветра
+ +
Качество изображения
+
--
+
+ + diff --git a/bta_print.cgi b/bta_print.cgi new file mode 100755 index 0000000..5f7261a --- /dev/null +++ b/bta_print.cgi @@ -0,0 +1,7 @@ +#!/bin/bash +echo "Access-Control-Allow-Origin: http://ishtar.sao.ru" +echo "Access-Control-Allow-Headers: Content-Type, X-Requested-With" +#echo "Access-Control-Expose-Headers: Location" +echo "Access-Control-Allow-Methods: POST, GET" +echo -e "Content-Type: multipart/form-data\n\n" +/usr/local/bin/bta_print 2>/dev/null