miner.php allow renaming table headers
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
diff --git a/miner.php b/miner.php
index c1d0a6e..b9caa36 100644
--- a/miner.php
+++ b/miner.php
@@ -68,6 +68,7 @@ $allowcustompages = true;
#
# OK this is a bit more complex item: Custom Summary Pages
# A custom summary page in an array of 'section' => array('FieldA','FieldB'...)
+# Field can be 'name=new name' to display 'name' with a different heading 'new name'
# This makes up what is displayed with each 'section' separately as a table
# - empty tables are not shown
# - empty columns (an unknown field) are not shown
@@ -79,9 +80,9 @@ $allowcustompages = true;
$mobilepage = array(
'DATE' => null,
'RIGS' => null,
- 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'),
- 'DEVS' => array('ID', 'Name', 'GPU', 'Status', 'MHS av', 'Accepted', 'Rejected', 'Utility'),
- 'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected', 'Last Share Time'));
+ 'SUMMARY' => array('Elapsed', 'MHS av', 'Found Blocks=Blks', 'Accepted', 'Rejected=Rej', 'Utility'),
+ 'DEVS' => array('ID', 'Name', 'GPU', 'Status', 'MHS av', 'Accepted', 'Rejected=Rej', 'Utility'),
+ 'POOL' => array('POOL', 'Status', 'Accepted', 'Rejected=Rej', 'Last Share Time'));
$mobilesum = array(
'SUMMARY' => array('MHS av', 'Found Blocks', 'Accepted', 'Rejected', 'Utility'),
'DEVS' => array('MHS av', 'Accepted', 'Rejected', 'Utility'),
@@ -1308,7 +1309,7 @@ function customset($showfields, $sum, $section, $rig, $result, $total)
return $total;
}
#
-function processcustompage($pagename, $sections, $sum)
+function processcustompage($pagename, $sections, $sum, $namemap)
{
global $sectionmap;
global $miner, $port;
@@ -1391,13 +1392,21 @@ function processcustompage($pagename, $sections, $sum)
{
$rigresults = $results[$sectionmap[$section]];
$showfields = array();
+ $showhead = array();
foreach ($fields as $field)
foreach ($rigresults as $result)
foreach ($result as $sec => $row)
{
$secname = preg_replace('/\d/', '', $sec);
if (secmatch($section, $secname) && isset($row[$field]))
+ {
$showfields[$field] = 1;
+ $map = $section.'.'.$field;
+ if (isset($namemap[$map]))
+ $showhead[$namemap[$map]] = 1;
+ else
+ $showhead[$field] = 1;
+ }
}
if (count($showfields) > 0)
@@ -1406,7 +1415,7 @@ function processcustompage($pagename, $sections, $sum)
otherrow('<td> </td>');
newtable();
- showhead('', array('Rig'=>1)+$showfields, true);
+ showhead('', array('Rig'=>1)+$showhead, true);
$total = array();
$add = array('total' => array());
@@ -1461,10 +1470,24 @@ function showcustompage($pagename)
}
$page = $customsummarypages[$pagename][0];
-
+ $namemap = array();
foreach ($page as $name => $fields)
+ {
if ($fields === null)
$page[$name] = array();
+ else
+ foreach ($fields as $num => $field)
+ {
+ $pos = strpos($field, '=');
+ if ($pos !== false)
+ {
+ $names = explode('=', $field, 2);
+ if (strlen($names[1]) > 0)
+ $namemap[$name.'.'.$names[0]] = $names[1];
+ $page[$name][$num] = $names[0];
+ }
+ }
+ }
$sum = $customsummarypages[$pagename][1];
if ($sum === null)
@@ -1485,7 +1508,7 @@ function showcustompage($pagename)
return;
}
- processcustompage($pagename, $page, $sum);
+ processcustompage($pagename, $page, $sum, $namemap);
if ($placebuttons == 'bot' || $placebuttons == 'both')
pagebuttons(null, $pagename);