ViewVC Help
View File | Revision Log | Show Annotations | Revision Graph | Root Listing
root/i-scream/projects/cms/source/reports/php/latest/latest.php
(Generate patch)

Comparing projects/cms/source/reports/php/latest/latest.php (file contents):
Revision 1.6 by pjm2, Thu Mar 8 22:13:16 2001 UTC vs.
Revision 1.19 by pjm2, Tue Mar 13 19:57:51 2001 UTC

# Line 10 | Line 10 | include("latest_config.inc.php");
10   #
11   # END CONFIGURATION
12  
13 + include("iutils.inc.php");
14  
15 < # return an array of subdirectories from a directory.
16 < function getdirArray($dir='./',$sort='asort') {
17 <    global $dir_file_count;
17 <    if ( is_dir($dir) ) {
18 <        $fd = @opendir($dir);
19 <        while ( ($part = @readdir($fd)) == TRUE ) {
20 <            clearstatcache();
21 <            if ($part != "." && $part != "..") {
22 <                $dir_array[] = $part;
23 <            }
24 <        }
25 <        if($fd == TRUE) {
26 <            closedir($fd);
27 <        }
28 <        if (is_array($dir_array)) {
29 <            $sort($dir_array);
30 <            $dir_file_count = count($dir_array);
31 <            Return $dir_array;
32 <        } else {
33 <            Return FALSE;
34 <        }
35 <    } else {
36 <        Return FALSE;
37 <    }
15 > function printLine($title) {
16 >    echo "<hr style=\"color:#9999ff;\">";
17 >    echo "<b>$title</b>";
18   }
19  
40 function printLine() {
41    echo "<hr color=\"#9999ff\">";
42 }
20  
44
21   function showStat($title, $value, $input) {
22 <    preg_match("/$value=([^\,]*)[\,|\}]/", $input, $matches);
22 >    preg_match("/$value=([^\,]*)[\,\}]/", $input, $matches);
23      $value = $matches[1];
24      if (empty($value)) {
25 <        $value = "<i>unknown</i>";
25 >        $value = "<i><font color=\"#999999\">not sent</font></i>";
26      }
27      ?>
28          <table border="0" width="100%">
29            <tr>
30 <            <td width="50%" align="right"><b><?=$title?></b></td>
31 <            <td width="50%" align="left"><?=$value?></td>
30 >            <td width="50%" align="right" valign="top"><b><?=$title?></b></td>
31 >            <td width="50%" align="left" valign="top"><?=$value?></td>
32            </tr>
33          </table>
34      <?
# Line 60 | Line 36 | function showStat($title, $value, $input) {
36  
37  
38   # show a bar-represented value.
39 < function showBar($title, $value, $max, $input) {
39 > function showBar($title, $value, $max, $units, $input) {
40  
41      include("latest_config.inc.php");
42  
# Line 77 | Line 53 | function showBar($title, $value, $max, $input) {
53      $width = intval($max_width * $value / $max);
54  
55      ?>
56 <        <table border="0" cellpadding="0" cellspacing="0">
56 >        <table border="0" cellpadding="0" cellspacing="0" align="center">
57            <tr>
58 <            <td colspan="2"><b><?=$title?></b></td>
58 >            <td colspan="2"><b><?=$title?></b> <font size="2">(<?=$value?><?=$units?>)</font></td>
59            </tr>
60            <tr>
61              <td colspan="2" bgcolor="#eeeeff"><img src="<?=$barImage?>" border="0" height="20" width="<?=$width?>"></td>
# Line 88 | Line 64 | function showBar($title, $value, $max, $input) {
64              <td colspan="2"><img src="<?=$scaleImage?>" border="0" height="11" width="<?=$max_width?>"></td>
65            </tr>
66            <tr>
67 <            <td align="left">0</td>
68 <            <td align="right"><?=$max?></td>
67 >            <td align="left">0<?=$units?></td>
68 >            <td align="right"><?=$max?><?=$units?></td>
69            </tr>
70 +          <tr>
71 +            <td colspan="2">&nbsp;</td>
72 +          </tr>
73          </table>
74      <?
75   }
# Line 100 | Line 79 | function showBar($title, $value, $max, $input) {
79  
80   <? include($titleHTML); ?>
81  
82 < <hr weight="1" color="<? echo $lineColor ?>">
82 > <? printLine("Display the latest information received from a host"); ?>
83  
105 <b>Display the latest information received from a host</b>
84   <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>">
85   <?
86  
# Line 123 | Line 101 | function showBar($title, $value, $max, $input) {
101   <input type="submit" name="submit" value="Display">
102   </form>
103  
126 <hr weight="1" color="<? echo $lineColor ?>">
127
104   <? if ($machine) {
105  
106 +       $last_modified = filemtime("$latestDirectory/$machine/$latestData");
107 +       clearstatcache();
108 +       $data_age = time() - $last_modified;
109 +
110 +       $last_modified = date("l jS F - g:ia", $last_modified);
111 +
112 +       if ($data_age > $warning_age) {
113 +           $warning = <<<EOT
114 +               <br>
115 +               <font color="red"><b>
116 +                   Warning:
117 +               </b></font>
118 +                   This realtime report is too old to be considered recent
119 + EOT;
120 +       }
121 +
122 + echo <<<EOT
123 +       <table border="0" bgcolor="#000066" cellpadding="3" cellspacing="1">
124 +         <tr>
125 +           <td bgcolor="#000066">
126 +             &nbsp;
127 +           </td>
128 +           <td bgcolor="#ffffcc">
129 +             <font face="arial,sans-serif" size="2">
130 +               <b>Recipt date:</b> $last_modified
131 +               $warning
132 +             </font>
133 +           </td>
134 +         </tr>
135 +       </table>
136 + EOT;
137 +
138         # Read the file.
139         #$input = "packet.attributes.machine_name=raptor.ukc.ac.uk,packet.memory.free=10,packet.memory.total=100,";
140         $input = file("$latestDirectory/$machine/$latestData");
# Line 144 | Line 152 | function showBar($title, $value, $max, $input) {
152  
153   ?>
154  
155 + <? printLine(""); ?>
156  
157   <? include($bottomHTML); ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines