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.1 by pjm2, Thu Mar 8 21:22:05 2001 UTC vs.
Revision 1.12 by pjm2, Sun Mar 11 21:38:57 2001 UTC

# Line 37 | Line 37 | function getdirArray($dir='./',$sort='asort') {
37      }
38   }
39  
40 + function printLine($title) {
41 +    echo "<hr color=\"#9999ff\">";
42 +    echo "<b>$title</b>";
43 + }
44  
45 +
46   function showStat($title, $value, $input) {
47 <    preg_match("/$value=([^\,]*)\,/", $input, $matches);
47 >    preg_match("/$value=([^\,]*)[\,\}]/", $input, $matches);
48      $value = $matches[1];
49      if (empty($value)) {
50 <        $value = "<i>unknown</i>";
50 >        $value = "<i><font color=\"#999999\">not sent</font></i>";
51      }
52      ?>
53          <table border="0" width="100%">
54            <tr>
55 <            <td width="50%" align="right"><b><?=$title?></b></td>
56 <            <td width="50%" align="left"><?=$value?></td>
55 >            <td width="50%" align="right" valign="top"><b><?=$title?></b></td>
56 >            <td width="50%" align="left" valign="top"><?=$value?></td>
57            </tr>
58          </table>
59      <?
# Line 73 | Line 78 | function showBar($title, $value, $max, $input) {
78      $width = intval($max_width * $value / $max);
79  
80      ?>
81 <        <table border="0" cellpadding="0" cellspacing="0">
81 >        <table border="0" cellpadding="0" cellspacing="0" align="center">
82            <tr>
83              <td colspan="2"><b><?=$title?></b></td>
84            </tr>
# Line 96 | Line 101 | function showBar($title, $value, $max, $input) {
101  
102   <? include($titleHTML); ?>
103  
104 < <hr weight="1" color="<? echo $lineColor ?>">
104 > <? printLine("Display the latest information received from a host"); ?>
105  
101 <b>Display the latest information received from a host</b>
106   <form method="<? echo $formMethod ?>" action="<? echo $thisPage ?>">
107   <?
108  
109 <    $file_array = getdirArray($latestDirectory,'rsort');
109 >    $file_array = getdirArray($latestDirectory,'asort');
110      print "<select size=\"1\" name=\"machine\">";
111      if ($machine) { ?>
112          <option selected value="<? echo $machine ?>"><? echo $machine ?></option>
113          <option value="">----------------</option>
114      <? }
115      foreach($file_array as $file_name) {
116 <        if (is_dir($file_name)) {
113 <            $i++;
116 >        #if (is_dir($file_name)) {
117              print "<option value=\"$file_name\">$file_name</option>";
118 <        }
118 >        #}
119      }
120      print "</select>";
121  
# Line 124 | Line 127 | function showBar($title, $value, $max, $input) {
127  
128   <? if ($machine) {
129  
130 +       $last_modified = filemtime("$latestDirectory/$machine/$latestData");
131 +       clearstatcache();
132 +       $data_age = time() - $last_modified;
133 +
134 +       $last_modified = strftime("%a %d %b %Y at %T", $last_modified);
135 +
136 +       if ($data_age > $warning_age) {
137 +           $warning = <<<EOT
138 +               <br>
139 +               <font color="red"><b>
140 +                   Warning:
141 +               </b></font>
142 +                   This realtime report is too old to be considered recent
143 + EOT;
144 +       }
145 +
146 + echo <<<EOT
147 +       <table border="0" bgcolor="#000066" cellpadding="3" cellspacing="1" align="center">
148 +         <tr>
149 +           <td bgcolor="#000066">
150 +             &nbsp;
151 +           </td>
152 +           <td bgcolor="#ffffcc">
153 +             <font face="arial,sans-serif" size="2">
154 +               <b>Recipt date:</b> $last_modified
155 +               $warning
156 +             </font>
157 +           </td>
158 +         </tr>
159 +       </table>
160 + EOT;
161 +
162         # Read the file.
163         #$input = "packet.attributes.machine_name=raptor.ukc.ac.uk,packet.memory.free=10,packet.memory.total=100,";
164 <       $input = file("$latestDirectory/$machine/latest_data");
164 >       $input = file("$latestDirectory/$machine/$latestData");
165         # All we need is the first line if there is more than one line.
166         $input = $input[0];
167  
# Line 137 | Line 172 | function showBar($title, $value, $max, $input) {
172             # Display the data specified in the display include.
173             include("latest_display.inc.php");
174         }
175 +      
176 +       printLine("");
177     }
178  
179   ?>

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines