1
0
mirror of https://github.com/GOSTSec/sgminer synced 2025-01-09 14:28:12 +00:00

miner.php when displaying a single rig, add prev/next rig buttons if they exist, next to refresh

This commit is contained in:
Kano 2012-12-14 14:04:24 +11:00
parent 38f912f812
commit a54a72c3f4

View File

@ -1207,7 +1207,7 @@ function process($cmds, $rig)
} }
} }
# #
function rigbutton($rig, $rigname, $when, $row) function rigname($rig, $rigname)
{ {
global $rigs; global $rigs;
@ -1218,12 +1218,21 @@ function rigbutton($rig, $rigname, $when, $row)
$rigname = $parts[2]; $rigname = $parts[2];
} }
return $rigname;
}
#
function riginput($rig, $rigname)
{
$rigname = rigname($rig, $rigname);
return "<input type=button value='$rigname' onclick='pr(\"&rig=$rig\",null)'>";
}
#
function rigbutton($rig, $rigname, $when, $row)
{
list($value, $class) = fmt('BUTTON', 'Rig', '', $when, $row); list($value, $class) = fmt('BUTTON', 'Rig', '', $when, $row);
$button = "<td align=middle$class><input type=button value='$rigname'"; return "<td align=middle$class>".riginput($rig, $rigname).'</td>';
$button .= " onclick='pr(\"&rig=$rig\",null)'></td>";
return $button;
} }
# #
function showrigs($anss, $headname, $rigname) function showrigs($anss, $headname, $rigname)
@ -1445,16 +1454,43 @@ function pagebuttons($rig, $pg)
if ($rig === null) if ($rig === null)
{ {
$prev = null;
$next = null;
if ($pg === null) if ($pg === null)
$refresh = ''; $refresh = '';
else else
$refresh = "&pg=$pg"; $refresh = "&pg=$pg";
} }
else else
{
switch (count($rigs))
{
case 0:
case 1:
$prev = null;
$next = null;
break;
case 2:
$prev = null;
$next = ($rig + 1) % count($rigs);
break;
default:
$prev = ($rig - 1) % count($rigs);
$next = ($rig + 1) % count($rigs);
break;
}
$refresh = "&rig=$rig"; $refresh = "&rig=$rig";
}
echo '<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td nowrap>'; echo '<tr><td><table cellpadding=0 cellspacing=0 border=0><tr><td nowrap>';
if ($prev !== null)
echo riginput($prev, 'Prev').'&nbsp;';
echo "<input type=button value='Refresh' onclick='pr(\"$refresh\",null)'>&nbsp;"; echo "<input type=button value='Refresh' onclick='pr(\"$refresh\",null)'>&nbsp;";
if ($next !== null)
echo riginput($next, 'Next').'&nbsp;';
echo '&nbsp;';
if (count($rigs) > 1) if (count($rigs) > 1)
echo "<input type=button value='Summary' onclick='pr(\"\",null)'>&nbsp;"; echo "<input type=button value='Summary' onclick='pr(\"\",null)'>&nbsp;";