Browse Source

php - use thead/tbody/tfoot for tables

master
kanoi 9 years ago
parent
commit
20a53c7a7f
  1. 4
      pool/inc.php
  2. 8
      pool/page_addrmgt.php
  3. 16
      pool/page_blocks.php
  4. 6
      pool/page_ckp.php
  5. 30
      pool/page_mpayouts.php
  6. 20
      pool/page_payments.php
  7. 18
      pool/page_percent.php
  8. 29
      pool/page_shifts.php
  9. 10
      pool/page_stats.php
  10. 14
      pool/page_userinfo.php
  11. 18
      pool/page_workers.php

4
pool/inc.php

@ -145,8 +145,8 @@ h1 {margin-top:20px;float:middle;font-size:20px;}
#
function SortJS()
{
$s = "function sot(t,s,o){if(t && s>=0){var rs=t.rows;if(rs && rs.length>2){var all=[], rn, ok=true;for(rn=1;rn<rs.length-1;rn++){if(rs[rn]){var c=rs[rn].cells[s];if(c){var key=c.getAttribute('data-srt');if(key){all.push([rs[rn],key])}else{all.push([rs[rn],c.innerHTML])}}else{ok=false}}else{ok=false}}if(ok){if(o=='s'){all.sort(function(a,b){return a[1].localeCompare(b[1])})}if(o=='n'){all.sort(function(a,b){return a[1]-b[1]})}if(o=='r'){all.sort(function(a,b){return b[1]-a[1]})}for(rn=0;rn<all.length;rn++){t.removeChild(all[rn][0])}var b4=t.lastChild;for(rn=0;rn<all.length;rn++){t.insertBefore(all[rn][0], b4);if(rn%2){all[rn][0].className='odd'}else{all[rn][0].className='even'}}}}}}
function sott(cn,t){if(t){var sf=t.getAttribute('data-sf');var o=sf.substring(0,1);var s=Number(sf.substring(1));var id=t.id;scnv(cn,id);t.checked=true;sot(t.parentNode.parentNode.parentNode.parentNode,s,o)}}
$s = "function sot(t,s,o){if(t && s>=0){var tb=t.getElementsByTagName('tbody')[0];if(tb){var rs=tb.rows;if(rs && rs.length>0){var all=[], rn, ok=true;for(rn=0;rn<rs.length;rn++){if(rs[rn]){var c=rs[rn].cells[s];if(c){var key=c.getAttribute('data-srt');if(key){all.push([rs[rn],key])}else{all.push([rs[rn],c.innerHTML])}}else{ok=false}}else{ok=false}}if(ok){if(o=='s'){all.sort(function(a,b){return a[1].localeCompare(b[1])})}if(o=='n'){all.sort(function(a,b){return a[1]-b[1]})}if(o=='r'){all.sort(function(a,b){return b[1]-a[1]})}var ch=tb.firstChild;while (ch){tb.removeChild(ch);ch=tb.firstChild}for(rn=0;rn<all.length;rn++){if(rn%2){all[rn][0].className='odd'}else{all[rn][0].className='even'}tb.appendChild(all[rn][0])}}}}}}
function sott(cn,t){if(t){var sf=t.getAttribute('data-sf');var o=sf.substring(0,1);var s=Number(sf.substring(1));var id=t.id;scnv(cn,id);t.checked=true;sot(t.parentNode.parentNode.parentNode.parentNode.parentNode,s,o)}}
function sotn(cn,n){var e=document.getElementById(n);if(e){sott(cn,e)}}
function sotc(cn,d){var ws=gcn(cn);if(ws==''){ws=d}sotn(cn,ws)}
";

8
pool/page_addrmgt.php

@ -9,13 +9,13 @@ function addrmgtuser($data, $user, $err)
$pg .= makeForm('addrmgt');
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= '<tr class=title>';
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dc>#</td>';
$pg .= '<td class=dl>Address</td>';
$pg .= '<td class=dl>ID</td>';
$pg .= '<td class=dr>Ratio</td>';
$pg .= '<td class=dr>%</td>';
$pg .= '</tr>';
$pg .= '</tr></thead>';
# new row template for '+'
$pg .= '<tr class=hid id=bs>';
@ -40,6 +40,7 @@ function addrmgtuser($data, $user, $err)
$count = 0;
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
if (isset($ans['limit']))
$limit = $ans['limit'];
else
@ -84,6 +85,7 @@ function addrmgtuser($data, $user, $err)
$pg .= "</td><td colspan=4 class=dl><font size=-1>limit $limit</font></td></tr>";
}
$pg .= '</tbody><tfoot>';
if ((($offset++) % 2) == 0)
$row = 'even';
else
@ -108,7 +110,7 @@ function addrmgtuser($data, $user, $err)
$pg .= '<tr><td colspan=5 class=dc><font size=-1>';
$pg .= "<span class=st1>*</span>Leave blank if you haven't enabled it<br>";
$pg .= 'You must enter your password to save changes<br>';
$pg .= 'A ratio of 0, will remove the address from the payouts</td></tr>';
$pg .= 'A ratio of 0, will remove the address from the payouts</td></tr></tfoot>';
}
$pg .= "</table><input type=hidden name=rows value=$count id=rows></form>\n";

16
pool/page_blocks.php

@ -91,7 +91,7 @@ function doblocks($data, $user)
{
$pg .= '<h1>Block Statistics</h1>';
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>";
$pg .= "<thead><tr class=title>";
$pg .= "<td class=dl>Description</td>";
$pg .= "<td class=dr>Time</td>";
$pg .= "<td class=dr>MeanTx%</td>";
@ -99,7 +99,7 @@ function doblocks($data, $user)
$pg .= "<td class=dr>Mean%</td>";
$pg .= "<td class=dr>CDF[Erl]</td>";
$pg .= "<td class=dr>Luck%</td>";
$pg .= "</tr>\n";
$pg .= "</tr></thead><tbody>\n";
$since = $data['info']['lastblock'];
@ -134,7 +134,7 @@ function doblocks($data, $user)
$pg .= "<td class=dr>$luck%</td>";
$pg .= "</tr>\n";
}
$pg .= "</table>\n";
$pg .= "</tbody></table>\n";
}
if ($ans['STATUS'] == 'ok')
@ -170,7 +170,7 @@ function doblocks($data, $user)
$pg .= 'is bad luck. Higher Diff% and brighter red is worse luck.<br><br>';
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>";
$pg .= "<thead><tr class=title>";
$pg .= "<td class=dr>#</td>";
$pg .= "<td class=dl>Height</td>";
if ($user !== null)
@ -182,7 +182,7 @@ function doblocks($data, $user)
$pg .= "<td class=dr>Diff%</td>";
$pg .= "<td class=dr>CDF</td>";
$pg .= "<td class=dr>B</td>";
$pg .= "</tr>\n";
$pg .= "</tr></thead>\n";
}
$blktot = 0;
$nettot = 0;
@ -192,6 +192,7 @@ function doblocks($data, $user)
$csv = "Sequence,Height,Status,Timestamp,DiffAcc,NetDiff,Hash\n";
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
{
@ -319,6 +320,7 @@ function doblocks($data, $user)
$csv .= $ans['blockhash:'.$i]."\n";
}
}
$pg .= '</tbody>';
}
if ($wantcsv === true)
{
@ -327,14 +329,14 @@ function doblocks($data, $user)
}
if ($orph === true)
{
$pg .= '<tr><td colspan=';
$pg .= '<tfoot><tr><td colspan=';
if ($user === null)
$pg .= '7';
else
$pg .= '8';
$pg .= ' class=dc><font size=-1><span class=st1>*</span>';
$pg .= 'Orphans/Rejects count as shares but not as a block in calculations';
$pg .= '</font></td></tr>';
$pg .= '</font></td></tr></tfoot>';
}
$pg .= "</table>\n";

6
pool/page_ckp.php

@ -27,7 +27,7 @@ function dockp($data, $user)
$pg .= 'TotalRAM: '.stnum($ans['totalram']).'<br>';
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= '<tr class=title>';
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dl>Name</td>';
$pg .= '<td class=dr>Initial</td>';
$pg .= '<td class=dr>Allocated</td>';
@ -35,9 +35,10 @@ function dockp($data, $user)
$pg .= '<td class=dr>RAM</td>';
$pg .= '<td class=dr>RAM2</td>';
$pg .= '<td class=dr>Cull</td>';
$pg .= "</tr>\n";
$pg .= "</tr></thead>\n";
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
{
@ -56,6 +57,7 @@ function dockp($data, $user)
$pg .= '<td class=dr>'.stnum($ans['cull:'.$i]).'</td>';
$pg .= "</tr>\n";
}
$pg .= '</tbody>';
}
$pg .= "</table>\n";

30
pool/page_mpayouts.php

@ -12,20 +12,21 @@ function dompayouts($data, $user)
$pg .= "Payments</a> page for the payments you've been sent.<br><br>";
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>";
$pg .= "<td class=dr>Block</td>";
$pg .= "<td class=dr>Block UTC</td>";
$pg .= "<td class=dr>Miner Reward</td>";
$pg .= "<td class=dr>N Diff</td>";
$pg .= "<td class=dr>N Range</td>";
$pg .= "<td class=dr>Pool N Avg</td>";
$pg .= "<td class=dr>Your %</td>";
$pg .= "<td class=dr>Your N Diff</td>";
$pg .= "<td class=dr>Your N Avg</td>";
$pg .= "<td class=dr>Your BTC</td>";
$pg .= "</tr>\n";
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dr>Block</td>';
$pg .= '<td class=dr>Block UTC</td>';
$pg .= '<td class=dr>Miner Reward</td>';
$pg .= '<td class=dr>N Diff</td>';
$pg .= '<td class=dr>N Range</td>';
$pg .= '<td class=dr>Pool N Avg</td>';
$pg .= '<td class=dr>Your %</td>';
$pg .= '<td class=dr>Your N Diff</td>';
$pg .= '<td class=dr>Your N Avg</td>';
$pg .= '<td class=dr>Your BTC</td>';
$pg .= "</tr></thead>\n";
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
$totamt = 0;
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
@ -56,6 +57,7 @@ function dompayouts($data, $user)
$pg .= '<td class=dr>'.btcfmt($amount).'</td>';
$pg .= "</tr>\n";
}
$pg .= '</tbody>';
if ($count > 1)
{
if (($i % 2) == 0)
@ -63,11 +65,11 @@ function dompayouts($data, $user)
else
$row = 'odd';
$pg .= "<tr class=$row>";
$pg .= "<tfoot><tr class=$row>";
$pg .= '<td class=dr>Total:</td>';
$pg .= '<td class=dl colspan=8></td>';
$pg .= '<td class=dr>'.btcfmt($totamt).'</td>';
$pg .= "</tr>\n";
$pg .= "</tr></tfoot>\n";
}
}
$pg .= "</table>\n";

20
pool/page_payments.php

@ -26,15 +26,16 @@ function dopayments($data, $user)
$ans = getPayments($user);
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>";
$pg .= "<td class=dl>Block</td>";
$pg .= "<td class=dl>Address</td>";
$pg .= "<td class=dl>Status</td>";
$pg .= "<td class=dr>BTC</td>";
$pg .= "<td class=dl></td>";
$pg .= "</tr>\n";
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dl>Block</td>';
$pg .= '<td class=dl>Address</td>';
$pg .= '<td class=dl>Status</td>';
$pg .= '<td class=dr>BTC</td>';
$pg .= '<td class=dl></td>';
$pg .= "</tr></thead>\n";
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
$all = array();
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
@ -70,12 +71,13 @@ function dopayments($data, $user)
$pg .= "<td class=dl>$dust</td>";
$pg .= "</tr>\n";
}
$pg .= '</tbody>';
if ($hasdust === true)
{
$pg .= '<tr><td colspan=5 class=dc>';
$pg .= '<tfoot><tr><td colspan=5 class=dc>';
$pg .= '<font size=-1><span class=st1>*</span> ';
$pg .= 'Dust payments are not automatically sent out';
$pg .= '</font></td></tr>';
$pg .= '</font></td></tr></tfoot>';
}
}
$pg .= "</table>\n";

18
pool/page_percent.php

@ -2,7 +2,7 @@
#
function pertitle($data, $user)
{
$pg = '<tr class=title>';
$pg = '<thead><tr class=title>';
$pg .= '<td class=dl>Address</td>';
$pg .= '<td class=dl>ID</td>';
$pg .= '<td class=dr>Shares</td>';
@ -12,7 +12,7 @@ function pertitle($data, $user)
$pg .= '<td class=dr>Hash Rate</td>';
$pg .= '<td class=dr>Ratio</td>';
$pg .= '<td class=dr>Addr %</td>';
$pg .= "</tr>\n";
$pg .= "</tr></thead>\n";
return $pg;
}
#
@ -30,6 +30,7 @@ function peruser($data, $user, &$offset, &$totshare, &$totdiff,
$pg = '';
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
if (isset($ans['blockacc']))
$blockacc = $ans['blockacc'];
if (isset($ans['blockreward']))
@ -103,6 +104,7 @@ function peruser($data, $user, &$offset, &$totshare, &$totdiff,
$offset++;
}
$pg .= '</tbody>';
}
return $pg;
}
@ -115,7 +117,7 @@ function pertotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $blockacc
$row = 'even';
else
$row = 'odd';
$pg .= "<tr class=$row><td class=dl>Total:</td>";
$pg .= "<tfoot><tr class=$row><td class=dl>Total:</td>";
$pg .= "<td class=dl>&nbsp;</td>";
$shareacc = number_format($totshare, 0);
$pg .= "<td class=dr>$shareacc</td>";
@ -133,7 +135,7 @@ function pertotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $blockacc
$blkpct = number_format(100.0 * $totdiff / $blockacc, 3) . '%';
$pg .= "<td class=dr>$blkpct</td>";
$pg .= "<td class=dr>$totrate</td>";
$pg .= "</td><td colspan=2 class=dl></td></tr>\n";
$pg .= "</td><td colspan=2 class=dl></td></tr></tfoot>\n";
return $pg;
}
#
@ -157,14 +159,6 @@ function dopercent($data, $user)
$pg .= pertotal($offset, $totshare, $totdiff, $totinvalid, $totrate,
$blockacc, $blockreward);
if ($blockacc > 0 && $blockreward > 0)
{
$btc = btcfmt($totdiff / $blockacc * $blockreward);
$pg .= '<tr><td colspan=9 class=dc>';
$pg .= "<br>Payout est if block found at 100%: ~$btc BTC";
$pg .= '</td></tr>';
}
$pg .= "</table>\n";
return $pg;

29
pool/page_shifts.php

@ -6,19 +6,19 @@ function doshifts($data, $user)
$pg = "Click <a href='#payoutmark'>here</a> to jump to the start of the last payout<br><br>";
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>";
$pg .= "<td class=dl>Shift</td>";
$pg .= "<td class=dl>Start UTC</td>";
$pg .= "<td class=dr>Length</td>";
$pg .= "<td class=dr>Your Diff</td>";
$pg .= "<td class=dr>Inv Diff</td>";
$pg .= "<td class=dr>Avg Hs</td>";
$pg .= "<td class=dr>Shares</td>";
$pg .= "<td class=dr>Avg Share</td>";
$pg .= "<td class=dr>Rewards</td>";
$pg .= "<td class=dr>Rewarded<span class=st1>*</span></td>";
$pg .= "<td class=dr>PPS%</td>";
$pg .= "</tr>\n";
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dl>Shift</td>';
$pg .= '<td class=dl>Start UTC</td>';
$pg .= '<td class=dr>Length</td>';
$pg .= '<td class=dr>Your Diff</td>';
$pg .= '<td class=dr>Inv Diff</td>';
$pg .= '<td class=dr>Avg Hs</td>';
$pg .= '<td class=dr>Shares</td>';
$pg .= '<td class=dr>Avg Share</td>';
$pg .= '<td class=dr>Rewards</td>';
$pg .= '<td class=dr>Rewarded<span class=st1>*</span></td>';
$pg .= '<td class=dr>PPS%</td>';
$pg .= "</tr></thead>\n";
if (($ans['STATUS'] != 'ok') || !isset($ans['prefix_all']))
$pg = '<h1>Shifts</h1>'.$pg;
@ -27,7 +27,7 @@ function doshifts($data, $user)
$pre = $ans['prefix_all'];
$count = $ans['rows'];
$pg = '<h1>Last '.($count+1).' Shifts</h1>'.$pg;
$pg = '<h1>Last '.($count+1).' Shifts</h1>'.$pg.'<tbody>';
for ($i = 0; $i < $count; $i++)
{
$u = '';
@ -93,6 +93,7 @@ function doshifts($data, $user)
$pg .= "<td class=dr>$pgot</td>";
$pg .= "</tr>\n";
}
$pg .= '</tbody>';
}
$pg .= "</table>\n";
$pg .= "<span class=st1>*</span> The Rewarded value unit is satoshis per 1diff share<br>";

10
pool/page_stats.php

@ -66,12 +66,13 @@ function dostats($data, $user)
$ans = getAllUsers($user);
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>";
$pg .= "<td class=dl>Username</td>";
$pg .= "<td class=dr>Hash Rate 5m</td>";
$pg .= "</tr>\n";
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dl>Username</td>';
$pg .= '<td class=dr>Hash Rate 5m</td>';
$pg .= "</tr></thead>\n";
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
$all = array();
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
@ -100,6 +101,7 @@ function dostats($data, $user)
$pg .= "<td class=dr>$dsp</td>";
$pg .= "</tr>\n";
}
$pg .= '</tbody>';
}
$pg .= "</table>\n";

14
pool/page_userinfo.php

@ -21,18 +21,19 @@ function douserinfo($data, $user)
$pg = '<h1>Block Acclaim</h1>';
$pg .= "<table callpadding=0 cellspacing=0 border=0>\n";
$pg .= "<tr class=title>";
$pg .= "<td class=dl>User</td>";
$pg .= "<td class=dr>Blocks</td>";
$pg .= '<thead><tr class=title>';
$pg .= '<td class=dl>User</td>';
$pg .= '<td class=dr>Blocks</td>';
if ($sall)
{
$pg .= "<td class=dr>Diff</td>";
$pg .= "<td class=dr>Avg</td>";
$pg .= '<td class=dr>Diff</td>';
$pg .= '<td class=dr>Avg</td>';
}
$pg .= "</tr>\n";
$pg .= "</thead></tr>\n";
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
$all = array();
$count = $ans['rows'];
for ($i = 0; $i < $count; $i++)
@ -73,6 +74,7 @@ function douserinfo($data, $user)
}
$pg .= "</tr>\n";
}
$pg .= '</tbody>';
}
$pg .= "</table>\n";

18
pool/page_workers.php

@ -15,7 +15,7 @@ function worktitle($data, $user)
{
addSort();
$r = "input type=radio name=srt onclick=\"sott('worksrt',this);\"";
$pg = '<tr class=title>';
$pg = '<thead><tr class=title>';
$pg .= "<td class=dl>Worker <span class=nb>Name:<$r id=srtwrk data-sf=s0></span></td>";
$pg .= '<td class=dr>Work Diff</td>';
$pg .= "<td class=dr><span class=nb><$r id=srtlst data-sf=n2>:Last</span> Share</td>";
@ -30,7 +30,7 @@ function worktitle($data, $user)
$pg .= "<td class=hid data-hid=dr><span class=nb><$r id=srtreject data-sf=r11>:Rej</span></td>";
$pg .= '<td class=dr>Block&nbsp;%</td>';
$pg .= "<td class=dr><span class=nb><$r id=srtrate data-sf=r13>:Hash</span> Rate</td>";
$pg .= "</tr>\n";
$pg .= "</tr></thead>\n";
return $pg;
}
#
@ -49,6 +49,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
$pg = '';
if ($ans['STATUS'] == 'ok')
{
$pg .= '<tbody>';
if (isset($ans['blockacc']))
$blockacc = $ans['blockacc'];
if (isset($ans['blockreward']))
@ -202,6 +203,7 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff,
$offset++;
}
$pg .= '</tbody>';
}
return $pg;
}
@ -221,7 +223,7 @@ function worktotal($offset, $totshare, $totdiff, $totshrate, $totinvalid,
$row = 'even';
else
$row = 'odd';
$pg .= "<tr class=$row><td class=dl colspan=3>Total: $offset$dspinst</td>";
$pg .= "<tfoot><tr class=$row><td class=dl colspan=3>Total: $offset$dspinst</td>";
$shareacc = number_format($totshare, 0);
$pg .= "<td class=dr>$shareacc</td>";
$diffacc = number_format($totdiff, 0);
@ -239,7 +241,7 @@ function worktotal($offset, $totshare, $totdiff, $totshrate, $totinvalid,
$blkpct = number_format(100.0 * $totdiff / $blockacc, 3) . '%';
$pg .= "<td class=hid colspan=4 data-hid=dr>&nbsp;</td>";
$pg .= "<td class=dr>$blkpct</td>";
$pg .= "<td class=dr>$totrate</td></tr>\n";
$pg .= "<td class=dr>$totrate</td></tr></tfoot>\n";
return $pg;
}
#
@ -266,14 +268,6 @@ function doworker($data, $user)
$pg .= worktotal($offset, $totshare, $totdiff, $totshrate, $totinvalid,
$totrate, $blockacc, $blockreward, $instances);
if (false && $blockacc > 0 && $blockreward > 0)
{
$btc = btcfmt($totdiff / $blockacc * $blockreward);
$pg .= '<tr><td colspan=8 class=dc>';
$pg .= "<br>Payout est if block found at 100%: ~$btc BTC";
$pg .= '</td></tr>';
}
$pg .= "</table>\n";
$pg .= "<script type='text/javascript'>\n";
$pg .= "sotc('worksrt','srtrate');</script>\n";

Loading…
Cancel
Save