Ignore:
Timestamp:
Nov 4, 2018, 11:18:18 AM (6 years ago)
Author:
g7moreau
Message:
  • Clean code
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/nagios-velvice/velvice.cgi

    r373 r374  
    1717use strict;
    1818use warnings;
    19 use version; our $VERSION = version->declare('0.10.2');
     19use version; our $VERSION = version->declare('0.10.3');
    2020
    2121use CGI;
     
    166166$mon++;
    167167my $date_sec = nosbreak(sprintf '%04i-%02i-%02i %02i:%02i:%02i', $year, $mon, $mday, $hour, $min, $sec);
    168 my $date = nosbreak(sprintf '%04i-%02i-%02i %02i:%02i', $year, $mon, $mday, $hour, $min);
     168my $date_min = nosbreak(sprintf '%04i-%02i-%02i %02i:%02i',      $year, $mon, $mday, $hour, $min);
    169169
    170170my $htmlpage;
     
    192192 <link rel="shortcut icon" type="image/ico" href="$config->{'nagios-server'}{'image'}/favicon.ico">
    193193 <script type="text/javascript">
    194    // var first_loop  = 0;
    195194   var refresh_sec = 900; // 15 min = 900 s
    196195   var refresh_interval;
    197196   function refresh() {
    198       // if (first_loop == 0) {
    199       //    first_loop++;
    200       //    console.log("Jump First Loop");
    201       //    return;
    202       //    }
    203197      var req = new XMLHttpRequest();
    204198      console.log("Grabbing Value");
    205       // req.onreadystatechange = function () {
    206       //    if (req.readyState == 4 && req.status == 200) {
    207       //       document.getElementById('master-body').innerText = req.responseXML.getElementById('master-body').innerText;
    208       //       }
    209       //    }
    210       // req.overrideMimeType('text/xml');
    211199      req.open("GET", '$cgi_script_name?only=body', true); // Grabs whatever you've written in this file
    212200      req.onload = function () {
    213201         if (req.status == 200) {
    214202            document.getElementById('master-body').innerHTML = req.responseXML.getElementById('master-body').innerHTML;
    215             // document.getElementById('master-body').outerHTML = req.responseXML.getElementById('master-body').outerHTML;
    216203            console.log("Update Page: ", $date_sec);
    217             // console.log("Update Page ", req.responseXML.getElementById('master-body').outerHTML);
    218204
    219205            refresh_next = req.responseXML.getElementById('master-body').getAttribute("refresh");
     
    234220
    235221   function init() { // This is the function the browser first runs when it's loaded.
    236       // refresh() // Then runs the refresh function for the first time.
    237222      refresh_sec = document.getElementById('master-body').getAttribute("refresh");
    238223      if (refresh_sec < 60 && refresh_sec != 0) {
     
    252237  <ul>
    253238    <li>Nagios Velvice Alert Panel : <a href="$config->{'nagios-server'}{'portal-url'}">Core Server</a></li>
    254     <li><small><a id="refresh" href="$cgi_script_name">$date</a></small></li>
     239    <li><small><a id="refresh" href="$cgi_script_name">$date_min</a></small></li>
    255240  </ul>
    256241 </h1>
Note: See TracChangeset for help on using the changeset viewer.