Hi guys,
Firstly many thanks @kitz for providing these pages for the DSLStats data. I am new on the forum and have been playing for the last day or so on getting it working with my data.
I just wanted to share a change I made to the history.php page, so that the drop-down choices do not revert back to the default choices, and stay on the currently viewed folder and graph file. It makes it a little more intuitive when reviewing the graph for me.
Hope it's useful. (N.B. The array() defines my folders, just add/remove your elements as necessary):
I hope this is the correct place to share.
<div class="graphs">
<form name="form1" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Graph Type<br>
<select name="graph">
<option value="SNRM">SNR Margin</option>
<option value="ErroredSeconds">Errored Seconds</option>
<option value="CRC">CRCs</option>
</select>
<input type="submit" value="Select">
</form>
Becomes:
<div class="graphs">
<form name="form1" method="post" action="<?php echo htmlspecialchars($_SERVER["PHP_SELF"]);?>">
Graph Type<br>
<select name="graph">
<?php
$graphs = array("Bitloading","Bitswaps","ConnSpeed","CRC","ErroredSeconds","FEC","HLog","QLN","SES","SNRM","SNRMperband","SwapsPerMinute");
foreach ($graphs as $graph) {
if ($_REQUEST['graph'] == $graph || $_REQUEST['folder'] == $graph){
$selected = ' selected';
} else {
$selected = '';
}
print "<option value='".$graph."'".$selected.">".$graph."</option>\n";
}
?>
</select>
<input type="submit" value="Select">
</form>
And in fuction(ListGraphs) this:
#Output to Drop Down Select Box
if (in_array($ext, $supported_file)) {
echo "<option value=\"" . $image . "\">" . basename($image) . "</option> \""; // Strip file path from img url
Becomes:
#Output to Drop Down Select Box
if (in_array($ext, $supported_file)) {
if ($_REQUEST['fileName'] == $image) {
$imageselected = " selected";
} else {
$imageselected = "";
}
echo "<option value=\"" . $image . "\"".$imageselected.">" . basename($image) . "</option>\n";