<html>
<head>

<link rel="shortcut icon" href="pics/KATRINlogo.ico" />
<link href="stylesheet.css" rel="stylesheet">

<link rel="preload" href="CorporateESC-Bold.woff" as="font" type="font/woff" crossorigin>

<link rel="preload" href="CorporateESC-Bold.woff2" as="font" type="font/woff2" crossorigin>

<title>KATRIN Spectrometer and Detector Section Status Overview</title>

<style>
/*
http://meyerweb.com/eric/tools/css/reset/
v2.0 | 20110126
License: none (public domain)
*/
/* sub excluded */

html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
font-size: 100%;
font: inherit;
vertical-align: baseline;
}

/* HTML5 display-role reset for older browsers */

article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section {display: block;}
body {line-height: 1;}

/*
ol, ul {list-style: none;}
blockquote, q {quotes: none;}
blockquote:before, blockquote:after,q:before, q:after {content: '';content: none;}
table {border-collapse: collapse;border-spacing: 0;}
*/

h1 {
position: relative;
background: #B3D8CC;
font-size: 36px;
color: #fff;
padding: 0px 10px;
margin: -10 0px 0px 0px;
}

h2 {
position: relative;
background: #B3D8CC;
font-size: 14px;
color: #000;
padding: 2px 10px;
margin: 0 0px 0px 0px;
}

h3 {
position: relative;
background: #B3D8CC;
font-size: 16px;
color: #000;
padding: 10px 10px;
margin: 0 0px 0px 0px;
}

h4 {
position: relative;
background: #fff;
font-size: 16px;
color: #000;
padding: 2px 10px;
margin: 0 0px 0px 0px;
}


.letters {font-size: 25px; margin-bottom: 20px;}
.s10:before {content: '10px';}
.s11:before {content: '11px';}
.s12:before {content: '12px';}
.s14:before {content: '14px';}
.s18:before {content: '18px';}
.s24:before {content: '24px';}
.s30:before {content: '30px';}
.s36:before {content: '36px';}
.s48:before {content: '48px';}
.s60:before {content: '60px';}
.s72:before {content: '72px';}
.s10:before, .s11:before, .s12:before, .s14:before, .s18:before, .s24:before, .s30:before, .s36:before, .s48:before, .s60:before, .s72:before {
font-family: Arial, sans-serif; font-size: 10px; font-weight: normal; font-style: normal; color: #999; padding-right: 6px;}
pre {display: block;padding: 9px;
margin: 0 0 12px;font-family: Monaco, Menlo, Consolas, "Courier New", monospace;font-size: 13px;line-height: 1.428571429;color: #333;font-weight: normal;font-style: normal;background-color: #f5f5f5;border: 1px solid #ccc;overflow-x: auto;border-radius: 4px;}
/* responsive */
@media (max-width: 959px) {.page {width: auto;margin: 0;}}
</style>

<style type="text/css">
	body      { font-family:Calibri,Arial; }
	a:link    { text-decoration:none; }
	a:visited { text-decoration:none; }
	a:hover   { text-decoration:none; }
	a:active  { text-decoration:none; }
	a:focus   { text-decoration:none; }
</style>

<head>
  <link rel="artwork" href="pics/beamline_noMoS.png" />
  <link rel="artwork" href="pics/spectrometer2019.png" />
  <link rel="artwork" href="pics/katrin_logo_round.png" />
  <link rel="artwork" href="pics/newEmail.png" />

<!--
  <style>
  body {
    background-image: url("pics/bg.png");
    background-repeat: no-repeat;
  }
  </style>
-->
</head>

<?php

//echo "test: ". $_GET["time"].PHP_EOL;


// get client ip adress to check whether computer is on-site or not

  if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
      $ip = $_SERVER['HTTP_CLIENT_IP'];
      } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
          $ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
          } else { $ip = $_SERVER['REMOTE_ADDR']; }

$onsite = false;
$slowrefresh = false;

if ((substr($ip, 0, 6) == "141.52") or (substr($ip, 0, 6) == "172.30"))
     { if (substr($ip, 0, 9) == "141.52.16")
         { echo '<meta http-equiv="refresh" content="10">'; $onsite = true; }
       else echo '<meta http-equiv="refresh" content="30">'; $onsite = true; }
else { echo '<meta http-equiv="refresh" content="120">'; $slowrefresh= true; }

?>

</head>
<body style="background-color:white;">

<?php
      // set time zone to local German time
      date_default_timezone_set('Europe/Berlin');

      // include helper functions
      include "SDS_status_functions.php";

      // include channel list
      include "SDS_status_channels.php";

      // include aircoil settings
      include "aircoils_settings.php";

      // include mac-e filter settings
      include "mace_settings.php";

      // include HV data
      if ((include "ADEI_HV_readings.php") == 0)
      { usleep(400000); include "ADEI_HV_readings.php"; };

      // read cached ADEI data
      $valuesincluded = 0;
      $loop = 0;
      $includeflag = 0;
      do {
        $includeflag = include 'ADEIvalues.php';
        $loop++;
        if ($valuesincluded == 0) usleep(100000);
        }
      while (($loop < 21) && ($includeflag+$valuesincluded < 2));
      if ($valuesincluded == 0) $extraction_time = "Request timed out!".PHP_EOL;
      //echo $loop."  ".$includeflag."  ".$valuesincluded.PHP_EOL;


	// ########## TIME STAMP ##########
//	echo '<font size="6" color="#FF0000"><b>Deprecated KATRIN Spectrometer and Detector Section Status Overview</b></font><br>';
        echo '<h3 style="font-family: CorporateESC; font-weight: bold; font-style: normal;">KATRIN - Karlsruhe Tritium Neutrino Experiment</h3>';
        echo '<h1 style="font-family: CorporateESC; font-weight: bold; font-style: normal;">Spectrometer and Detector Section Status Overview</h1>';
        echo '<h2 style="font-family: inherit; font-weight: plain; font-style: normal;">Page refreshed:&emsp;' . date(DATE_RFC850) . '</h2>';
        echo '<h2 style="font-family: inherit; font-weight: plain; font-style: normal;">Data extracted:&ensp;&thinsp;&thinsp;&thinsp;&thinsp;' . $extraction_time . '</h2>';
        echo '<font size="3" color="#FFFFFF">&emsp; &emsp; &emsp; Client IP:' . $ip . ' </font><br>';
        echo '<font size="3" color="#FFFFFF">&emsp; &emsp; &emsp; Uptime:' . @file_get_contents( "/proc/uptime") . ' </font><br>';

//('.  date("s", time() - $extraction_timestamp).'&thinsp;s old data)<br>';

       if ($errorcount >0) echo "<br> <br> <br> <br> <br> <br> <br> <br>".$errormessage;
?>

<!--
<div style="position:absolute; top:0px; left:0px">
<img src="pics/bg.png">
-->

<div style="position:absolute; top:150px; left:2px">
<img src="pics/beamline_noMoS.png" >

<div style="position:absolute; top:15px; left:314px">
<img src="pics/spectrometer2019.png" width="1132" height="601">
</div>

<div style="position:absolute; top:-148px; left:1625px">
<img src="pics/katrin_logo_round.png" width="93" height="93">
</div>

<!--
<div style="position: absolute; top: 60px; left:1680px">
<iframe src="https://uhr.ptb.de" scrolling="no" style="height: 230px; border: 0px none; width: 230px; margin-bottom: 0px; margin-left: 0px;">
</iframe>
</div>
-->

<a href="mailto:thuemmler@kit.edu">
<div title="send email to Thomas Thuemmler" style="position:absolute; top:-50px; left:8px">
<img src="pics/newEmail.png" width="23" height="23">
</div>
</a>

<?php
    // include SDS status main page
    //if (($valuesincluded == 1) & ($onsite)) include "SDS_status_main.php";
    if ($valuesincluded == 1) include "SDS_status_main.php";
?>

  <br><br><br>

<!--  
  <iframe width="1700" height="400" src="https://dataview.raspberryshake.org/#/embed/AM/R985B/00/EHZ"></iframe>
-->

</body>
</html>
