/usr/share/arc/ldap-monitor/includes/lmtable.inc is in nordugrid-arc-ldap-monitor 5.0.5-1ubuntu1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 | <?php
// Author: oxana.smirnova@hep.lu.se
/*
* Describes the following classes for the NorduGrid Load Monitor tables:
* LmTable - constructs all other tables characterized by:
* header row color
* body color
* title font
* main text font
* array of column headers
* array of column sizes
* LmTableSp - extends LmTable by adding horizontal grid
* LmTableFree - extends LmTableSp by using arbitrary number of columns
*
* -- LmTable methods:
* LmTable($type) - initializes $type table headers
* addrow($array,$bgcolor) - adds a contents row
* addspacer($bgcolor) - adds a spacer line (horizontal grid)
* adderror($text,$bgcolor) - adds an error message across the table
* rowspan($nrows,$text,$bgcolor) - adds a cell spanning $nrows rows
* close() - closes the table
*
* Author: O.Smirnova (July 2002)
*/
/*
* CLASS LmTable
*/
class LmTable {
var $color_header;
var $color_bg;
var $font_title;
var $font_main;
var $columns;
var $contents;
var $ncols;
var $errtxt;
var $nrows;
/**
* @return LmTable
* @param wintyp string
* @param locset array
* @desc Starts an HTML table
*/
function LmTable( $wintyp, $locset, $schema = "NG") {
/*
* Initialisation of a table:
* definition of colors
*
* Input:
* string $wintyp - table style
* array $locset - set of localized headers etc
*/
ob_implicit_flush(TRUE);
# ob_start();
ob_end_flush();
require ('settings.inc');
$inpnam = implode("_",array("def",$wintyp));
// $xeader = implode("_",array("header",$wintyp));
$this->color_header = (${$inpnam}["thcolor"]) ? ${$inpnam}["thcolor"] : "#999999";
$this->color_bg = (${$inpnam}["tbcolor"]) ? ${$inpnam}["tbcolor"] : "#f0f0f0";
$this->font_title = (${$inpnam}["thfont"]) ? ${$inpnam}["thfont"] : "color=\"#ffffff\"";
$this->font_main = (${$inpnam}["tbfont"]) ? ${$inpnam}["tbfont"] : "color=\"#000000\"";
$this->columns = $locset;
$this->ncols = 0;
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgcolor=\"".$this->color_bg."\">\n";
echo "<tr bgcolor=\"".$this->color_header."\">\n";
$colnr = 0;
if ( $wintyp == "clusdes" && $schema != "GLUE2" ) {
$position = 3;
$keys = array_keys($locset);
unset($locset[$keys[$position]]);
}
foreach ( $locset as $colnam => $colwid) {
if ( $colnam == "0" || $colnam == "help" ) continue;
$this->ncols ++;
$colnr++;
$value = $colnam;
if ( $schema == "GLUE2" && $value == "Queue") {
$value = "Share Name";
}
// Specific sorting links for the front module
if ( $wintyp == "loadmon" ) {
// Keep old arguments, if any, except of order
$allargs = "";
foreach ( $_GET as $argm => $argval ) {
if ( $argm == "order" ) continue;
$allargs .= $argm."=".$argval."&";
}
$str1 = "<a href=\"".$_SERVER['PHP_SELF']."?".$allargs."order=";
$str2 = "\"><font ".$this->font_title.">".$value."</font></a>";
if ( $colnr == 1 ) $value = $str1."country".$str2;
elseif ( $colnr == 3 ) $value = $str1."cpu".$str2;
elseif ( $colnr == 4 ) $value = $str1."grun".$str2;
}
$width = ($colwid)?$colwid:"1%";
echo "<td align=\"left\" width=\"$width\"><nobr><font ".$this->font_title."> $value </font></nobr></td>\n";
}
echo "</tr>\n";
}
/**
* @return void
* @param contents array
* @desc Draws a table row
*/
function addrow( $contents, $bgcol="" ) {
if ( count($contents) != $this->ncols ) {
$this->adderror("Incompatible data");
return 1;
}
$this->contents = $contents;
if ($bgcol) {
echo "<tr bgcolor=\"$bgcol\">\n";
} else {
echo "<tr>\n";
}
foreach ($contents as $colent) {
$value = $colent;
echo "<td align=\"left\" valign=\"middle\"><nobr><font ".$this->font_main."> $value </font></nobr></td>\n";
}
echo "</tr>\n";
}
/**
* @return void
* @param color string
* @desc Draws a spanning row containing a spacer
*/
function addspacer( $color="#000000" ) {
echo "<tr>\n";
echo "<td colspan=\"".$this->ncols."\" bgcolor=\"$color\" height=\"0\"><img src=\"./mon-icons/icon_spacer.php\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
echo "</tr>\n";
}
/**
* @return void
* @param errtxt string
* @desc Draws a spanning row containing error message
*/
function adderror( $errtxt="Error", $bgcol="" ) {
$this->errtxt = $errtxt;
echo "<tr>\n";
echo "<td nowrap align=\"left\" colspan=\"".$this->ncols."\"";
if ($bgcol) echo " bgcolor=\"$bgcol\"";
echo "><font ".$this->font_main."><font color=\"#000000\"> $errtxt</font></font></td>";
echo "</tr>\n";
}
/**
* @return void
* @param errtxt string
* @param nrows integer
* @param color string
* @desc Adds a cell spanning $nrows rows
*/
function rowspan( $nrows, $errtxt=" ", $color="#ffffcc" ) {
$this->errtxt = $errtxt;
$ncols = $this->ncols - 1;
$nrows = $nrows + 1;
echo "<tr>\n";
echo "<td nowrap align=\"left\" valign=\"middle\" rowspan=\"$nrows\" bgcolor=\"$color\"> $errtxt</td>";
echo "<td nowrap colspan=\"$ncols\" bgcolor=\"$color\" height=\"0\"><img src=\"./mon-icons/icon_spacer.php\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
echo "</tr>\n";
}
/**
* @return void
* @desc Closes a table
*/
function close() {
echo "</table>\n";
# ob_end_flush();
ob_implicit_flush(FALSE);
}
}
class LmTableSp extends LmTable {
var $spcolor;
/**
* @return void
* @param contents array
* @param color string
* @desc Draws a table row with a spacer above
*/
function addrow( $contents, $bgcol="", $color="#ffffff" ) {
$ncols = count($contents);
$this->contents = $contents;
if ($bgcol) {
echo "<tr nowrap bgcolor=\"$bgcol\">\n";
} else {
echo "<tr nowrap>\n";
}
foreach ($contents as $colent) {
$value = $colent;
echo "<td align=\"left\" valign=\"middle\"><nobr><font ".$this->font_main."> $value </font></nobr></td>\n";
}
echo "</tr>\n";
echo "<tr>\n";
echo "<td colspan=\"$ncols\" bgcolor=\"$color\" height=\"1\"><img src=\"./mon-icons/icon_spacer.php\" width=\"1\" height=\"1\" alt=\"\"></td>";
echo "</tr>\n";
}
/**
* @return void
* @param errtxt string
* @param color string
* @desc Draws a spanning row containing error message
*/
function adderror( $errtxt="Error", $color="#ffffff", $bgcol="" ) {
$this->errtxt = $errtxt;
$ncols = $this->ncols;
$tospan = $this->rowspan;
if ( $tospan ) $ncols = $ncols - 1;
echo "<tr>\n";
echo "<td nowrap colspan=\"$ncols\" bgcolor=\"$color\" height=\"0\"><img src=\"./mon-icons/icon_spacer.php\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
echo "</tr>\n";
echo "<tr>\n";
echo "<td nowrap align=\"left\" colspan=\"".$this->ncols."\"";
if ($bgcol) echo " bgcolor=\"$bgcol\"";
echo "><font ".$this->font_main."><font color=\"#990000\"> $errtxt</font></font></td>";
echo "</tr>\n";
}
/**
* @return void
* @param errtxt string
* @param nrows integer
* @param color string
* @desc Adds a cell spanning $nrows rows
*/
function rowspan( $nrows, $errtxt=" ", $color="#ffffcc" ) {
$this->errtxt = $errtxt;
$ncols = $this->ncols - 1;
$nrows = (2 * $nrows) + 1;
echo "<tr>\n";
echo "<td nowrap align=\"left\" valign=\"middle\" rowspan=\"$nrows\" bgcolor=\"$color\"> $errtxt</td>";
echo "<td nowrap colspan=\"$ncols\" bgcolor=\"$color\" height=\"0\"><img src=\"./mon-icons/icon_spacer.php\" width=\"1\" height=\"1\" border=\"0\" alt=\"\"></td>";
echo "</tr>\n";
}
}
class LmTableFree extends LmTableSp {
/**
* @return LmTableFree
* @param headers array
* @desc Starts an HTML table
*/
function LmTableFree( $headers ) {
ob_implicit_flush(0);
ob_start();
$this->color_header = "#666666";
$this->color_bg = "#f0f0f0";
$this->font_title = "color=\"#ffffff\"";
$this->font_main = "color=\"#000000\"";
$this->columns = count($headers);
$this->ncols = 0;
echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"100%\" bgcolor=\"".$this->color_bg."\">\n";
echo "<tr bgcolor=\"".$this->color_header."\">\n";
foreach ( $headers as $colnam ) {
$this->ncols ++;
$value = $colnam;
$width = "1%";
echo "<td align=\"left\" width=\"$width\"><nobr><font ".$this->font_title."> $value </font></nobr></td>\n";
}
echo "</tr>\n";
}
}
?>
|