Project

General

Profile

« Previous | Next » 

Revision c7a1d428

Added by N0YB over 11 years ago

XHTML Compliance - RRD Graphs

View differences:

usr/local/www/status_rrd_graph.php
234 234
$ui_databases = array_merge($dbheader, $databases);
235 235
$custom_databases = array_merge($dbheader_custom, $databases);
236 236

  
237
$graphs = array("8hour", "day", "week", "month", "quarter", "year", "4year");
237
$graphs = array("eight_hour", "day", "week", "month", "quarter", "year", "four_year");
238 238
$periods = array("absolute" => gettext("Absolute Timespans"), "current" => gettext("Current Period"), "previous" => gettext("Previous Period"));
239 239
$graph_length = array(
240
	"8hour" => 28800,
240
	"eight_hour" => 28800,
241 241
	"day" => 86400,
242 242
	"week" => 604800,
243 243
	"month" => 2678400,
244 244
	"quarter" => 7948800,
245 245
	"year" => 31622400,
246
	"4year" => 126230400);
246
	"four_year" => 126230400);
247 247

  
248 248
$pgtitle = array(gettext("Status"),gettext("RRD Graphs"));
249 249

  
......
291 291
			$("#endDateTime").datetimepicker(options);
292 292
		});
293 293
	</script>
294
	</head>
295
<?php } ?>
294
<?php }
295
if (isset($closehead))
296
	echo "</head>";
297
?>
296 298

  
297 299
<?php
298 300

  
......
319 321
				$offset = 0;
320 322
		}
321 323
		switch($graph) {
322
			case "8hour":
324
			case "eight_hour":
323 325
				if($curhour < 24)
324 326
					$starthour = 16;
325 327
				if($curhour < 16)
......
373 375
				if($offset != 0)
374 376
					$end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
375 377
				break;
376
			case "4year":
378
			case "four_year":
377 379
				$start = mktime(0, 0, 0, 1, 0, (($curyear - 3) + $offset));
378 380
				if($offset != 0)
379 381
					$end = mktime(0, 0, 0, 1, 0, (($curyear + $offset) +1));
......
391 393
<body link="#0000CC" vlink="#0000CC" alink="#0000CC">
392 394
<?php include("fbegin.inc"); ?>
393 395
<?php if ($input_errors && count($input_errors)) { print_input_errors($input_errors); } ?>
394
<table width="100%" border="0" cellpadding="0" cellspacing="0">
396
<form name="form1" action="status_rrd_graph.php" method="get">
397
	<table width="100%" border="0" cellpadding="0" cellspacing="0">
395 398
        <tr>
396
                <td>
397
			<form name="form1" action="status_rrd_graph.php" method="get">
398
			<input type="hidden" name="cat" value="<?php echo "$curcat"; ?>">
399
			<td>
400
				<input type="hidden" name="cat" value="<?php echo "$curcat"; ?>"/>
399 401
			<?php
400 402
			        $tab_array = array();
401 403
				if($curcat == "system") { $tabactive = True; } else { $tabactive = False; }
......
467 469
							echo "<option value=\"{$database}\"";
468 470
							$prettyprint = ucwords(str_replace($search, $replace, $database));
469 471
							if($curoption == $database) {
470
								echo " selected";
472
								echo " selected=\"selected\"";
471 473
							}
472 474
							echo ">" . htmlspecialchars($prettyprint) . "</option>\n";
473 475
						}
......
507 509
								$prettyprint = ucwords(str_replace($search, $replace, $friendly));
508 510
						}
509 511
						if($curoption == $optionc) {
510
							echo " selected";
512
							echo " selected=\"selected\"";
511 513
						}
512 514
						echo ">" . htmlspecialchars($prettyprint) . "</option>\n";
513 515
					}
......
520 522
					<?php
521 523
					foreach ($styles as $style => $styled) {
522 524
						echo "<option value=\"$style\"";
523
						if ($style == $curstyle) echo " selected";
525
						if ($style == $curstyle) echo " selected=\"selected\"";
524 526
						echo ">" . htmlspecialchars($styled) . "</option>\n";
525 527
					}
526 528
					?>
......
534 536
						<?php
535 537
						foreach ($periods as $period => $value) {
536 538
							echo "<option value=\"$period\"";
537
							if ($period == $curperiod) echo " selected";
539
							if ($period == $curperiod) echo " selected=\"selected\"";
538 540
							echo ">" . htmlspecialchars($value) . "</option>\n";
539 541
						}
542
						?>
543
						</select>
544
					<?php
540 545
					}
541 546
					?>
542
					</select>
543
					<?php
544 547

  
548
					<?php
545 549
					if($curcat == "custom") {
546 550
						$tz = date_default_timezone_get();
547 551
						$tz_msg = gettext("Enter date and/or time. Current timezone:") . " $tz";
......
549 553
						$end_fmt   = strftime("%m/%d/%Y %H:%M:%S", $end);
550 554
						?>
551 555
						<?=gettext("Start:");?>
552
						<input id="startDateTime" title="<?= htmlentities($tz_msg); ?>." type="text" name="start" class="formfldunknown" size="24" length="32" value="<?= htmlentities($start_fmt); ?>">
556
						<input id="startDateTime" title="<?= htmlentities($tz_msg); ?>." type="text" name="start" class="formfldunknown" size="24" maxlength="32" value="<?= htmlentities($start_fmt); ?>"/>
553 557
						<?=gettext("End:");?>
554
						<input id="endDateTime" title="<?= htmlentities($tz_msg); ?>." type="text" name="end" class="formfldunknown" size="24" length="32" value="<?= htmlentities($end_fmt); ?>">
555
						<input type="submit" name="Submit" value="<?=gettext("Go"); ?>">
558
						<input id="endDateTime" title="<?= htmlentities($tz_msg); ?>." type="text" name="end" class="formfldunknown" size="24" maxlength="32" value="<?= htmlentities($end_fmt); ?>"/>
559
						<input type="submit" name="Submit" value="<?=gettext("Go"); ?>"/>
556 560
						<?php
557 561
						$curdatabase = $curoption;
558 562
						$graph = "custom-$curdatabase";
......
560 564
							$id = "{$graph}-{$curoption}-{$curdatabase}";
561 565
							$id = preg_replace('/\./', '_', $id);
562 566

  
563
							echo "<tr><td colspan=2 class=\"list\">\n";
564
							echo "<IMG BORDER='0' name='{$id}' ";
565
							echo "id='{$id}' ALT=\"$prettydb Graph\" ";
566
							echo "SRC=\"status_rrd_graph_img.php?start={$start}&amp;end={$end}&amp;database={$curdatabase}&amp;style={$curstyle}&amp;graph={$graph}\" />\n";
567
							echo "<br /><hr><br />\n";								
568
							echo "</td></tr>\n";
567
							echo "<table><tr><td colspan=\"2\" class=\"list\">\n";
568
							echo "<img border='0' name='{$id}' ";
569
							echo "id='{$id}' alt=\"$prettydb Graph\" ";
570
							echo "src=\"status_rrd_graph_img.php?start={$start}&amp;end={$end}&amp;database={$curdatabase}&amp;style={$curstyle}&amp;graph={$graph}\" />\n";
571
							echo "<br /><hr /><br />\n";								
572
							echo "</td></tr></table>\n";
569 573
						}
570 574
					} else {
571 575
						foreach($graphs as $graph) {
......
629 633
									$dates = get_dates($curperiod, $graph);
630 634
									$start = $dates['start'];
631 635
									$end = $dates['end'];
632
									echo "<tr><td colspan=2 class=\"list\">\n";
633
									echo "<IMG BORDER='0' name='{$id}' ";
634
									echo "id='{$id}' ALT=\"$prettydb Graph\" ";
635
									echo "SRC=\"status_rrd_graph_img.php?start={$start}&amp;end={$end}&amp;database={$curdatabase}&amp;style={$curstyle}&amp;graph={$graph}\" />\n";
636
									echo "<br /><hr><br />\n";								
637
									echo "</td></tr>\n";
636
									echo "<table><tr><td colspan=\"2\" class=\"list\">\n";
637
									echo "<img border='0' name='{$id}' ";
638
									echo "id='{$id}' alt=\"$prettydb Graph\" ";
639
									echo "src=\"status_rrd_graph_img.php?start={$start}&amp;end={$end}&amp;database={$curdatabase}&amp;style={$curstyle}&amp;graph={$graph}\" />\n";
640
									echo "<br /><hr /><br />\n";								
641
									echo "</td></tr></table>\n";
638 642
								}
639 643
							}
640 644
						}
......
643 647
					</td>
644 648
				</tr>
645 649
				<tr>
646
					<td colspan=2 class="list">
647
					<script language="javascript">
650
					<td colspan="2" class="list">
651
					<script type="text/javascript">
648 652
						function update_graph_images() {
649 653
							//alert('updating');
654
							var amp = decodeURIComponent("%26");
650 655
							var randomid = Math.floor(Math.random()*11);
651 656
							<?php
652 657
							foreach($graphs as $graph) {
......
709 714
									$id = preg_replace('/\./', '_', $id);
710 715

  
711 716
									echo "\n";
712
									echo "\t\tjQuery('#{$id}').attr('src','status_rrd_graph_img.php?start={$start}&graph={$graph}&database={$curdatabase}&style={$curstyle}&tmp=' + randomid);\n";
717
									echo "\t\tjQuery('#{$id}').attr('src','status_rrd_graph_img.php?start={$start}' + amp + 'graph={$graph}' + amp + 'database={$curdatabase}' + amp + 'style={$curstyle}' + amp + 'tmp=' + randomid);\n";
713 718
									}
714 719
								}
715 720
							?>
......
717 722
						}
718 723
						window.setTimeout('update_graph_images()', 355000);
719 724
					</script>
720
					</form>
721 725
					</td>
722 726
				</tr>
723 727
			</table>
......
725 729
		</td>
726 730
	</tr>
727 731
</table>
732
</form>
728 733

  
729 734
<?php include("fend.inc"); ?>
730 735
</body>

Also available in: Unified diff