Bläddra i källkod

Added ups history page

Avetisyan Karen 7 år sedan
förälder
incheckning
ac2eaceb64

BIN
modules/HTTP_Server/fs/history.html


BIN
modules/HTTP_Server/fs/main.css


BIN
modules/HTTP_Server/fs/main.js


BIN
modules/HTTP_Server/fs/role.js


Filskillnaden har hållts tillbaka eftersom den är för stor
+ 735 - 710
modules/HTTP_Server/fsdata.c


+ 1 - 1
web_interface/src/wui/getJson.cgi

@@ -32,7 +32,7 @@ JSON = {
   "batsym": "Норма",
   "mode": "Профилактика сульфатации",
   "u_alarm": "5",
-  "m_alarm": "13",
+  "m_alarm": "0",
   "utc": "3.0",
   "netsettings_changed": "false"
 }

+ 9 - 111
web_interface/src/wui/history.cgi

@@ -5,7 +5,6 @@ import cgi
 import time
 pagenum = cgi.FieldStorage()
 print("Content-Type: text/json;")
-print("")
 JSON1 = ({
 "page":[
   "Входное напряжение (~220 В);Нормализация состояния входного напряжения;220;12:53 05.11.2015",
@@ -22,114 +21,6 @@ JSON1 = ({
   "Входное напряжение (~220 В);Нормализация состояния входного напряжения;220;12:53 05.11.2015",
   "Входное напряжение (~220 В);Нормализация состояния входного напряжения;220;12:53 05.11.2015",
   "Напряжение на выходе;Нормализация напряжения на выходе ИИП;wsdf1001;12:53 05.11.2015"
-  # {
-  #   "h_param": "Входное напряжение (~220 В)",
-  #   "h_event": "Нормализация состояния входного напряжения",
-  #   "h_value": "220",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Входное напряжение (~220 В)",
-  #   "h_event": "Нормализация состояния входного напряжения",
-  #   "h_value": "220",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Напряжение на выходе",
-  #   "h_event": "Нормализация напряжения на выходе ИИП",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Напряжение на выходе",
-  #   "h_event": "Отсутствие напряжения на выходе ИИП",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Напряжение на выходе",
-  #   "h_event": "Нормализация тока на выходе ИИП",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Напряжение на выходе",
-  #   "h_event": "Превышение тока на выходе ИИП",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Напряжение на выходе",
-  #   "h_event": "Изменение состояния ИИП",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Потребляемый ток",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Потребляемый ток",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Напряжение на нагрузке",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 05.11.2015"
-  # },
-  # {
-  #   "h_param": "Напряжение на нагрузке",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 04.11.2015"
-  # },
-  # {
-  #   "h_param": "Ток на нагрузке",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 04.11.2015"
-  # },
-  # {
-  #   "h_param": "Ток на нагрузке",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 04.11.2015"
-  # },
-  # {
-  #   "h_param": "Температура в шкафу",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 04.11.2015"
-  # },
-  # {
-  #   "h_param": "Температура в шкафу",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 04.11.2015"
-  # },
-  # {
-  #   "h_param": "Режим работы",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 04.11.2015"
-  # },
-  # {
-  #   "h_param": "Дверь",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "",
-  #   "h_datetime": "12:53 04.11.2015"
-  # },
-  # {
-  #   "h_param": "Температура АКБ",
-  #   "h_event": "wsdf1001",
-  #   "h_value": "wsdf1001",
-  #   "h_datetime": "12:53 04.11.2015"
-  # }
 ],
 "pages": 3,
 "utc": "3.0",
@@ -9861,11 +9752,18 @@ JSONALL = ({
 })
 
 if pagenum["page"].value == "1":
+  print("")
   print (json.dumps(JSON1))
 if pagenum["page"].value == "2":
+  print("")
   print (json.dumps(JSON2))
 if pagenum["page"].value == "3":
+  print("")
   print (json.dumps(JSON3))
 if pagenum["page"].value == "all":
-  time.sleep(10)
-  print (json.dumps(JSONALL))
+  print("Content-Length: " + str(len(json.dumps(JSONALL))) )
+  print("")
+  x = 0
+  for i in range(x, len(json.dumps(JSONALL))):
+      print(json.dumps(JSONALL)[x:x + 1024])
+      x = x + 1024

+ 13 - 6
web_interface/src/wui/history.html

@@ -4,7 +4,7 @@
 <meta charset="utf-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
-<title>Журнал событий</title>
+<title>Журнал событий контроллера</title>
 <link href="main.css" rel="stylesheet">
 <script type="text/javascript" src="role.js"></script>
 </head>
@@ -21,9 +21,14 @@
     <li><a href="history.html" class="active">Журнал</a></li>
   </ul>
 </div>
+  <!-- subnav here -->
+<div class="container" id="subnavf">
+  <script>createSubNavigation();</script>
+</div>
+  <!-- //subnav -->
   <div class="wrapper" id="content">
 <!--START-->
-<h1>Журнал событий</h1>
+<h1>Журнал событий контроллера</h1>
 <div class="table-responsive">
 <table id="table" class="table wrapper-default">
   <thead>
@@ -46,8 +51,10 @@
     <button class="btn btn-default" onclick="nextPage();"><span aria-hidden="true">&rarr;</span></button>
     <button class="btn btn-default" onclick="getPage(parseInt($('pagelimit').textContent));"><span aria-hidden="true">&raquo;|</span></button>
   </div>
-    <button class="btn btn-primary-inverted" id="dload_history" onclick="blobLoad('history.cgi?page=all', 'history.csv', this.id);">Сохранить в CSV</button>
-    <!-- <button class="btn btn-primary" onclick="downloadCSV('history.cgi?page=all');">Сохранить в CSV</button> -->
+  <button class="btn btn-primary-inverted" id="dload_history" onclick="blobLoad('history.cgi?page=all', 'history.csv', this.id);">
+    <span id="bl_text">Сохранить в CSV</span>
+    <div id="bl_fill"></div>
+  </button>
 </div>
 <!--END-->
 </div>
@@ -62,6 +69,6 @@ $('currentpage').onkeypress = function(e){
     getPage(parseInt($('currentpage').value));
     return false;
   }
-}
+};
 </script>
-</html>
+</html>

+ 126 - 1
web_interface/src/wui/main.css

@@ -266,6 +266,12 @@ table th[class*="col-"] {
   letter-spacing:0.02em;
   text-transform: uppercase;
 }
+.table > thead > tr > th.ph2{
+  font-weight: normal;
+  text-align: left;
+  color: #ACB3C0;
+  background-color: #f8f8f8;
+}
 .table-responsive {
   min-height: .01%;
   overflow-x: auto;
@@ -653,7 +659,26 @@ and (-webkit-min-device-pixel-ratio: 1)  {
   // -webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
   // box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
 }
-#dload_history {float: right;}
+#dload_history {
+  position: relative;
+  width: 206px;
+  height: 35px;
+  float: right;
+}
+#bl_text {
+ position: relative;
+ z-index: 2;
+ // color: #676767;
+}
+#bl_fill {
+  width: 0;
+  height: 5px;
+  background-color: #fff;
+  position: absolute;
+  top: 28px;
+  left: 0;
+  z-index: 1;
+ }
 .btn {
   display: inline-block;
   padding: 6px 12px;
@@ -1743,6 +1768,56 @@ fieldset[disabled] .checkbox label {
 #changePassword, #uploadSettings{
   border: 5px solid #337ab7;
 }
+
+.subnav {
+  /*margin-bottom: 20px;*/
+  width: 100%;
+  height: 40px;
+  background-color: #fff;
+  /*border: 1px solid #fff;*/
+}
+
+.subnav .nav {
+  margin-bottom: 0;
+}
+
+.subnav .nav > li > a {
+  margin: 0;
+  color: #337ab7;
+  line-height: 20px;
+  padding-top:    10px;
+  padding-bottom: 10px;
+  text-decoration: none;
+  border-left: 1px solid #f5f5f5;
+  border-right: 1px solid #e5e5e5;
+}
+
+.subnav .nav > .active > a,
+.subnav .nav > .active > a:hover {
+  padding-left: 11px;
+  color: #777;
+  background-color: #F1F1F1;
+  border-right-color: #ddd;
+  border-left: 0;
+  -webkit-box-shadow: inset 0 3px 5px rgba(0,0,0,.05);
+  -moz-box-shadow: inset 0 3px 5px rgba(0,0,0,.05);
+  box-shadow: inset 0 3px 5px rgba(0,0,0,.05);
+}
+
+.subnav .nav > .active > a .caret,
+.subnav .nav > .active > a:hover .caret {
+  border-top-color: #777;
+}
+
+.subnav .nav > li:first-child > a,
+.subnav .nav > li:first-child > a:hover {
+  /*border-left: 0;*/
+}
+
+.subnav .nav > li:last-child > a {
+  border-right: 0;
+}
+
 .login-form{
   margin: 0 auto;
   padding:30px 30px;
@@ -1752,6 +1827,7 @@ fieldset[disabled] .checkbox label {
 .login-form input[type='password']{
   width: auto !important;
 }
+
 @media only screen and (max-width : 768px) {
   .login-form label{
     width: 100%;
@@ -1774,6 +1850,55 @@ fieldset[disabled] .checkbox label {
   div > .logo{
     margin-bottom: 0;
   }
+  .subnav {
+    position: static;
+    top: auto;
+    z-index: auto;
+    width: 100%;
+    height: auto;
+    background: #fff;
+    -webkit-box-shadow: none;
+    -moz-box-shadow: none;
+    box-shadow: none;
+    font-size: 1em;
+  }
+  .subnav .navbar-nav{
+    float: none;
+  }
+  .subnav > ul {
+    padding: 0;
+  }
+  .subnav .nav > li {
+/*    float: left;
+    padding-right: 5px;*/
+    height: auto;
+  }
+
+  .subnav .nav > li > a {
+    border: 0;
+    padding-top:    10px;
+    padding-bottom: 10px;
+  }
+/*  .subnav .nav > li + li > a {
+    border-top: 1px solid #e5e5e5;
+  }*/
+  .subnav .navbar > li,
+  .subnav .navbar-nav > li {
+    /*float: left;*/
+    /*width: auto;*/
+  }
+  .subnav .nav > li:first-child > a,
+  .subnav .nav > li:first-child > a:hover {
+    border-radius: 0;
+    padding-left: 0;
+  }
+  .subnav .nav > .active > a,
+  .subnav .nav > .active > a:hover {
+    padding-left: 0px;
+    color: #777;
+    background-color: #F1F1F1;
+    border-right-color: #ddd;
+  }
   label {
     font-size: .8em;
     line-height: 0.99;

+ 197 - 35
web_interface/src/wui/main.js

@@ -575,12 +575,128 @@ function prevPage(){
     getPage(prev);
   }
 }
-function downloadCSV(url){
-  loadXMLDoc(url, 'GET', function(){
-    var data = JSON.parse(this.responseText);
-    JSONToCSVConvertor(data.page, true);
+//########## UPS History ############
+var INPUT_V  = 0,
+  INPUT_FV   = 1,
+  OUTPUT_V   = 2,
+  OUTPUT_C   = 3,
+  INPUT_F    = 4,
+  BAT_V      = 5,
+  TEMP       = 6,
+  STATUS     = 7,
+  TIME       = 8;
+function getUPSPage(pn){
+  getJSON('ups_history.cgi?page=' + pn, function(data){
+    $('history_data').textContent = '';
+    var n = data.page;
+    $('currentpage').value = pn;
+    $('pagelimit').innerHTML = data.pages;
+    // var inputs = [
+    //   {id: 'h_inputv_', val: INPUT_V}
+    // ];
+    for (var i in n){
+      var tr = document.createElement('tr');
+      var td = [
+        document.createElement('td'),
+        document.createElement('td'),
+        document.createElement('td'),
+        document.createElement('td'),
+        document.createElement('td'),
+        document.createElement('td'),
+        document.createElement('td'),
+        document.createElement('td'),
+        document.createElement('td')
+      ];
+      td[0].innerHTML = parseFloat(n[i].split(';')[INPUT_V]) + ' В';
+      td[0].id = 'h_inputv_'+ i;
+      tr.appendChild(td[0]);
+      td[1].id = 'h_inputfv_'+ i;
+      td[1].innerHTML = parseFloat(n[i].split(';')[INPUT_FV]) + ' В';
+      tr.appendChild(td[1]);
+      td[2].id = 'h_outputv_'+ i;
+      td[2].innerHTML = parseFloat(n[i].split(';')[OUTPUT_V]) + ' В';
+      tr.appendChild(td[2]);
+      td[3].id = 'h_outputc_'+ i;
+      td[3].innerHTML = parseFloat(n[i].split(';')[OUTPUT_C]) + '%';
+      tr.appendChild(td[3]);
+      td[4].id = 'h_inputf_'+ i;
+      td[4].innerHTML = parseFloat(n[i].split(';')[INPUT_F]) + ' Гц';
+      tr.appendChild(td[4]);
+      td[5].id = 'h_batv_'+ i;
+      td[5].innerHTML = parseFloat(n[i].split(';')[BAT_V]) + ' В';
+      tr.appendChild(td[5]);
+      td[6].id = 'h_temp_'+ i;
+      td[6].innerHTML = parseFloat(n[i].split(';')[TEMP]) + ' °C';
+      tr.appendChild(td[6]);
+      td[7].id = 'h_status_'+ i;
+      td[7].innerHTML = n[i].split(';')[STATUS];
+      tr.appendChild(td[7]);
+      td[8].id = 'h_time_'+ i;
+      td[8].innerHTML = n[i].split(';')[TIME];
+      tr.appendChild(td[8]);
+      $('history_data').appendChild(tr);
+    }
+    // utcParam = data.utc;
+    window.setCookie('netsettings_changed', data.netsettings_changed);
+    checkNotify();
+    clearTimeout(mint);
+    mint = setTimeout(ups_history_dataref, 5000);
+  }, function(){
+    $('table').display = 'none';
+    $('content').innerHTML =
+      '<h1>Журнал событий</h1>'+
+      '<div class="panel panel-default">'+
+        '<div class="panel-heading">Ошибка</div>'+
+        '<p style="text-align: center;">Данные отсутствуют.</p>'+
+      '</div>';
+  });
+}
+function ups_history_dataref() {
+  var pn = parseInt($('currentpage').value);
+  getJSON('ups_history.cgi?page=' + pn, function(data) {
+    var p = data.page;
+    for (var j in p) {
+      var inputv_col  = $('h_inputv_' + j);
+      var inputfv_col = $('h_inputfv_' + j);
+      var outputv_col = $('h_outputv_' + j);
+      var outputc_col = $('h_outputc_' + j);
+      var inputf_col  = $('h_inputf_' + j);
+      var batv_col    = $('h_batv_' + j);
+      var trmp_col    = $('h_temp_' + j);
+      var status_col  = $('h_status_' + j);
+      var time_col    = $('h_time_' + j);
+
+      inputv_col.innerHTML  =  parseFloat(p[j].split(';')[INPUT_V]) + ' В';
+      inputfv_col.innerHTML =  parseFloat(p[j].split(';')[INPUT_FV]) + ' В';
+      outputv_col.innerHTML =  parseFloat(p[j].split(';')[OUTPUT_V]) + ' В';
+      outputc_col.innerHTML =  parseFloat(p[j].split(';')[OUTPUT_C]) + '%';
+      inputf_col.innerHTML  =  parseFloat(p[j].split(';')[INPUT_F]) + ' Гц';
+      batv_col.innerHTML    =  parseFloat(p[j].split(';')[BAT_V]) + ' В';
+      trmp_col.innerHTML    =  parseFloat(p[j].split(';')[TEMP]) + ' °C';
+      status_col.innerHTML  =  p[j].split(';')[STATUS];
+      time_col.innerHTML    =  p[j].split(';')[TIME];
+
+      $('pagelimit').innerHTML = data.pages;
+    }
+    clearTimeout(mint);
+    mint = setTimeout(ups_history_dataref, 5000);
   });
 }
+function nextUPSPage(){
+  var next = parseInt($('currentpage').value);
+  if (next < parseInt($('pagelimit').textContent)) {
+    next = next + 1;
+    getUPSPage(next);
+  }
+}
+function prevUPSPage(){
+  var prev = parseInt($('currentpage').value);
+  if (prev != 1) {
+    prev = prev - 1;
+    getUPSPage(prev);
+  }
+}
+
 function utf8_decode (s) {
   var bb = '', c = 0;
   for (var i = 0; i < s.length; i++) {
@@ -600,37 +716,7 @@ function utf8_decode (s) {
   }
   return bb;
 }
-function JSONToCSVConvertor(JSONData,ShowLabel) {
-  var row = '';
-  var header = 'Событие;Сстояние;Значение;Время\r\n';
-  var r = JSONData;
-  for (var j in r){ row += r[j]+'\r\n'; }
-  var CSV = '';
-  console.log(row);
-  CSV += header + row;
-  if (CSV === '') {
-    alert('Данные отсутствуют');
-    return;
-  }
-  var d = new Date();
-  var fileName = d.getDate()+'_'+d.getMonth()+'_'+d.getHours()+d.getMinutes();
-  if(msieversion()){
-    var IEwindow = window.open();
-    IEwindow.document.write( 'sep=;\r\n' + utf8_decode(CSV) );
-    IEwindow.document.close();
-    IEwindow.document.execCommand('SaveAs', true, fileName + '.csv');
-    IEwindow.close();
-  } else {
-    var uri = 'data:application/csv;charset=utf-8,' + escape( utf8_decode(CSV) );
-    var link = document.createElement('a');
-    link.href = uri;
-    link.style = 'visibility:hidden';
-    link.download = fileName + '.csv';
-    document.body.appendChild(link);
-    link.click();
-    document.body.removeChild(link);
-  }
-}
+
 function msieversion() {
   var ua = window.navigator.userAgent;
   var msie = ua.indexOf('MSIE ');
@@ -639,6 +725,82 @@ function msieversion() {
   return false;
 }
 
+function blobLoad(requestUrl, fileName, buttonID){
+  if(isMobile.iOS()){
+    alert('На данном устройстве сохранение не доступно.');
+  }
+
+  var old = $(buttonID).children[0].textContent;
+
+  var pgFlag = 'Обработка';
+  var pgFlagLen = pgFlag.length;
+  var d = new Date();
+  var fName;
+  if (fileName === 'settings.dat') {
+    fName = fileName;
+  } else {
+    fName = d.getDate()+'_'+d.getMonth()+'_'+d.getHours()+d.getMinutes() + '_' + fileName;
+  }
+  var xhr = new XMLHttpRequest();
+  var fURL = requestUrl.split('.').pop() == 'cgi' ? requestUrl+'?' : requestUrl+'&';
+  xhr.open('GET', fURL+'_='+ new Date().getTime());
+  xhr.responseType = 'blob';
+  $(buttonID).setAttribute('disabled', 'disabled');
+  xhr.addEventListener('load', function(){
+    $(buttonID).children[1].style.width = 0;
+    $(buttonID).children[0].textContent = old;
+    $(buttonID).removeAttribute('disabled');
+  });
+  xhr.onload = function(){
+    if (this.status === 200) {
+      var blob = this.response;
+      if(msieversion()){
+        if (window.navigator.msSaveOrOpenBlob) {
+          window.navigator.msSaveOrOpenBlob(blob, fName);
+        } else {
+          var IEwindow = window.open(requestUrl);
+        }
+      } else {
+        var objectUrl = URL.createObjectURL(blob);
+        var uri = objectUrl;
+        var link = document.createElement('a');
+        link.href = uri;
+        link.style = 'visibility:hidden';
+        link.download = fName;
+        document.body.appendChild(link);
+        link.click();
+        document.body.removeChild(link);
+      }
+    }
+  };
+  xhr.onprogress = function(event) {
+    $(buttonID).children[0].textContent = parseInt((event.loaded / event.total) * 100) + '%';
+    $(buttonID).children[1].style.width = parseInt((event.loaded / event.total) * 100) + '%';
+  };
+  xhr.send();
+}
+
+var isMobile = {
+  Android: function() {
+    return navigator.userAgent.match(/Android/i);
+  },
+  BlackBerry: function() {
+    return navigator.userAgent.match(/BlackBerry/i);
+  },
+  iOS: function() {
+    return navigator.userAgent.match(/iPhone|iPad|iPod/i);
+  },
+  Opera: function() {
+    return navigator.userAgent.match(/Opera Mini/i);
+  },
+  Windows: function() {
+    return navigator.userAgent.match(/IEMobile/i);
+  },
+  any: function() {
+    return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
+  }
+};
+
 function checkOther(ele) {
   if (ele.selectedIndex == 3) {
     var newInput = document.createElement('input');

+ 19 - 0
web_interface/src/wui/role.js

@@ -14,6 +14,25 @@ if(!Array.prototype.indexOf) {
   };
 }
 
+function createSubNavigation(){
+  var subnav = document.createElement('div');
+  subnav.className = 'subnav';
+  var ul = document.createElement('ul');
+  ul.className = 'nav navbar-nav';
+  subnav.appendChild(ul);
+  var li = [document.createElement('li'), document.createElement('li')];
+  li[0].innerHTML = '<a href="history.html">События Контроллера</a>';
+  li[1].innerHTML = '<a href="ups_history.html">Состояние ИБП</a>';
+  if(window.location.pathname == '/history.html') {
+    li[0].className = 'active';
+  } else if (window.location.pathname == '/ups_history.html') {
+    li[1].className = 'active';
+  }
+  ul.appendChild(li[0]);
+  ul.appendChild(li[1]);
+  $('subnavf').appendChild(subnav);
+}
+
 function $(id) {return document.getElementById(id);}
 
 var timeout;

+ 105 - 0
web_interface/src/wui/ups_history.cgi

@@ -0,0 +1,105 @@
+#!C:\Python36\python.exe
+# -*- coding: utf-8 -*-
+import json
+import cgi
+import time
+pagenum = cgi.FieldStorage()
+print("Content-Type: text/json;")
+JSON1 = ({
+  "page":[
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015"
+  ],
+  "pages": 3,
+  "utc": "3.0",
+  "utm": time.time(),
+  "netsettings_changed": "false"
+})
+JSON2 = ({
+  "page":[
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015"
+  ], "pages": 3, "utc": "3.0", "netsettings_changed": "false"
+})
+JSON3 = ({
+  "page":[
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015"
+  ], "pages": 3, "utc": "3.0", "netsettings_changed": "false"
+})
+
+JSONALL = ({
+  "page":[
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015",
+    "208.4;140.0;208.4;034;59.9;2.05;35.0;00110000;12:53 05.11.2015"
+  ], "pages": 3, "utc": "3.0", "netsettings_changed": "false"
+})
+
+if pagenum["page"].value == "1":
+  print("")
+  print (json.dumps(JSON1))
+if pagenum["page"].value == "2":
+  print("")
+  print (json.dumps(JSON2))
+if pagenum["page"].value == "3":
+  print("")
+  print (json.dumps(JSON3))
+if pagenum["page"].value == "all":
+  print("Content-Length: " + str(len(json.dumps(JSONALL))) )
+  print("")
+  x = 0
+  for i in range(x, len(json.dumps(JSONALL))):
+      print(json.dumps(JSONALL)[x:x + 1024])
+      x = x + 1024

+ 79 - 0
web_interface/src/wui/ups_history.html

@@ -0,0 +1,79 @@
+<!DOCTYPE html>
+<html lang="">
+<head>
+<meta charset="utf-8">
+<meta http-equiv="X-UA-Compatible" content="IE=edge">
+<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
+<title>Журнал состояния ИБП</title>
+<link href="main.css" rel="stylesheet">
+<script type="text/javascript" src="role.js"></script>
+</head>
+<body>
+<div class="navbar navbar-default navbar-fixed-top">
+  <div class="navbar-header">
+    <div><a href="index.html" class="logo"></a></div>
+  </div>
+  <a href="#" id="menu-icon"></a>
+  <ul class="nav navbar-nav" id="nav">
+    <li><a href="index.html">Параметры</a></li>
+    <li><a href="settings.html">Настройки</a></li>
+    <li><a href="info.html">Информация</a></li>
+    <li><a href="ups_history.html" class="active">Журнал</a></li>
+  </ul>
+</div>
+  <!-- subnav here -->
+<div class="container" id="subnavf">
+  <script>createSubNavigation();</script>
+</div>
+  <!-- //subnav -->
+  <div class="wrapper" id="content">
+<!--START-->
+<h1>Журнал состояния ИБП</h1>
+<div class="table-responsive">
+<table id="table" class="table wrapper-default">
+  <thead>
+    <tr>
+      <th class="ph2">Вх. напр.</th>
+      <th class="ph2">Напр. на вх.</th>
+      <th class="ph2">Вых. напр.</th>
+      <th class="ph2">Нагрузка</th>
+      <th class="ph2">Вх. частота</th>
+      <th class="ph2">Напр. на АКБ</th>
+      <th class="ph2">Температура</th>
+      <th class="ph2">Статус</th>
+      <th class="ph2">Время</th>
+    </tr>
+  </thead>
+  <tbody id="history_data">
+  </tbody>
+</table>
+</div>
+<div id="controls">
+  <div id="navigation" class="btn-group">
+    <button class="btn btn-default" onclick="getUPSPage(1);"><span aria-hidden="true">|&laquo;</span></button>
+    <button class="btn btn-default" onclick="prevUPSPage();"><span aria-hidden="true">&larr;</span></button>
+    <div class="pagination"><input type="text" id="currentpage" size="1">&nbsp;/&nbsp;<span id="pagelimit">0</span></div>
+    <button class="btn btn-default" onclick="nextUPSPage();"><span aria-hidden="true">&rarr;</span></button>
+    <button class="btn btn-default" onclick="getUPSPage(parseInt($('pagelimit').textContent));"><span aria-hidden="true">&raquo;|</span></button>
+  </div>
+  <button class="btn btn-primary-inverted" id="dload_history" onclick="blobLoad('ups_history.cgi?page=all', 'ups_history.csv', this.id);">
+    <span id="bl_text">Сохранить в CSV</span>
+    <div id="bl_fill"></div>
+  </button>
+</div>
+<!--END-->
+</div>
+</body>
+<script type="text/javascript" src="main.js"></script>
+<script type="text/javascript">
+getUPSPage(1);
+$('currentpage').onkeypress = function(e){
+  if (!e) e = window.event;
+  var keyCode = e.keyCode || e.which;
+  if (keyCode == '13'){
+    getUPSPage(parseInt($('currentpage').value));
+    return false;
+  }
+};
+</script>
+</html>

Vissa filer visades inte eftersom för många filer har ändrats