|
@@ -1197,7 +1197,7 @@ function process($cmds, $rig)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
#
|
|
#
|
|
|
-function rigbutton($rig, $rigname, $when, $row)
|
|
|
|
|
|
|
+function rigname($rig, $rigname)
|
|
|
{
|
|
{
|
|
|
global $rigs;
|
|
global $rigs;
|
|
|
|
|
|
|
@@ -1208,12 +1208,21 @@ function rigbutton($rig, $rigname, $when, $row)
|
|
|
$rigname = $parts[2];
|
|
$rigname = $parts[2];
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- list($value, $class) = fmt('BUTTON', 'Rig', '', $when, $row);
|
|
|
|
|
|
|
+ return $rigname;
|
|
|
|
|
+}
|
|
|
|
|
+#
|
|
|
|
|
+function riginput($rig, $rigname)
|
|
|
|
|
+{
|
|
|
|
|
+ $rigname = rigname($rig, $rigname);
|
|
|
|
|
|
|
|
- $button = "<td align=middle$class><input type=button value='$rigname'";
|
|
|
|
|
- $button .= " onclick='pr(\"&rig=$rig\",null)'></td>";
|
|
|
|
|
|
|
+ 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);
|
|
|
|
|
|
|
|
- return $button;
|
|
|
|
|
|
|
+ return "<td align=middle$class>".riginput($rig, $rigname).'</td>';
|
|
|
}
|
|
}
|
|
|
#
|
|
#
|
|
|
function showrigs($anss, $headname, $rigname)
|
|
function showrigs($anss, $headname, $rigname)
|
|
@@ -1435,16 +1444,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').' ';
|
|
|
echo "<input type=button value='Refresh' onclick='pr(\"$refresh\",null)'> ";
|
|
echo "<input type=button value='Refresh' onclick='pr(\"$refresh\",null)'> ";
|
|
|
|
|
+ if ($next !== null)
|
|
|
|
|
+ echo riginput($next, 'Next').' ';
|
|
|
|
|
+ echo ' ';
|
|
|
if (count($rigs) > 1)
|
|
if (count($rigs) > 1)
|
|
|
echo "<input type=button value='Summary' onclick='pr(\"\",null)'> ";
|
|
echo "<input type=button value='Summary' onclick='pr(\"\",null)'> ";
|
|
|
|
|
|
|
@@ -1574,6 +1610,79 @@ function joinfields($section1, $section2, $join, $results)
|
|
|
return $newres;
|
|
return $newres;
|
|
|
}
|
|
}
|
|
|
#
|
|
#
|
|
|
|
|
+function joinlr($section1, $section2, $join, $results)
|
|
|
|
|
+{
|
|
|
|
|
+ global $sectionmap;
|
|
|
|
|
+
|
|
|
|
|
+ $name1 = $sectionmap[$section1];
|
|
|
|
|
+ $name2 = $sectionmap[$section2];
|
|
|
|
|
+ $newres = array();
|
|
|
|
|
+
|
|
|
|
|
+ // foreach rig in section1
|
|
|
|
|
+ foreach ($results[$name1] as $rig => $result)
|
|
|
|
|
+ {
|
|
|
|
|
+ $status = null;
|
|
|
|
|
+
|
|
|
|
|
+ // foreach answer section in the rig api call
|
|
|
|
|
+ foreach ($result as $name1b => $fields1b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($name1b == 'STATUS')
|
|
|
|
|
+ {
|
|
|
|
|
+ // remember the STATUS from section1
|
|
|
|
|
+ $status = $result[$name1b];
|
|
|
|
|
+ continue;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Build L string to be matched
|
|
|
|
|
+ // : means a string constant otherwise it's a field name
|
|
|
|
|
+ $Lval = '';
|
|
|
|
|
+ foreach ($join['L'] as $field)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (substr($field, 0, 1) == ':')
|
|
|
|
|
+ $Lval .= substr($field, 1);
|
|
|
|
|
+ else
|
|
|
|
|
+ $Lval .= $fields1b[$field];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // foreach answer section in the rig api call (for the other api command)
|
|
|
|
|
+ foreach ($results[$name2][$rig] as $name2b => $fields2b)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($name2b == 'STATUS')
|
|
|
|
|
+ continue;
|
|
|
|
|
+
|
|
|
|
|
+ // Build R string and compare
|
|
|
|
|
+ // : means a string constant otherwise it's a field name
|
|
|
|
|
+ $Rval = '';
|
|
|
|
|
+ foreach ($join['R'] as $field)
|
|
|
|
|
+ {
|
|
|
|
|
+ if (substr($field, 0, 1) == ':')
|
|
|
|
|
+ $Rval .= substr($field, 1);
|
|
|
|
|
+ else
|
|
|
|
|
+ $Rval .= $fields2b[$field];
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if ($Lval === $Rval)
|
|
|
|
|
+ {
|
|
|
|
|
+ if ($status != null)
|
|
|
|
|
+ {
|
|
|
|
|
+ $newres[$rig]['STATUS'] = $status;
|
|
|
|
|
+ $status = null;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ $subsection = $section1.'+'.$section2;
|
|
|
|
|
+ $subsection .= preg_replace('/[^0-9]/', '', $name1b.$name2b);
|
|
|
|
|
+
|
|
|
|
|
+ foreach ($fields1b as $nam => $val)
|
|
|
|
|
+ $newres[$rig][$subsection]["$section1.$nam"] = $val;
|
|
|
|
|
+ foreach ($fields2b as $nam => $val)
|
|
|
|
|
+ $newres[$rig][$subsection]["$section2.$nam"] = $val;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ return $newres;
|
|
|
|
|
+}
|
|
|
|
|
+#
|
|
|
function joinall($section1, $section2, $results)
|
|
function joinall($section1, $section2, $results)
|
|
|
{
|
|
{
|
|
|
global $sectionmap;
|
|
global $sectionmap;
|
|
@@ -1618,8 +1727,6 @@ function joinsections($sections, $results, $errors)
|
|
|
{
|
|
{
|
|
|
global $sectionmap;
|
|
global $sectionmap;
|
|
|
|
|
|
|
|
-#echo "results['pools']=".print_r($results['pools'],true)."<br>";
|
|
|
|
|
-
|
|
|
|
|
// GPU's don't have Name,ID fields - so create them
|
|
// GPU's don't have Name,ID fields - so create them
|
|
|
foreach ($results as $section => $res)
|
|
foreach ($results as $section => $res)
|
|
|
foreach ($res as $rig => $result)
|
|
foreach ($res as $rig => $result)
|
|
@@ -1657,14 +1764,33 @@ function joinsections($sections, $results, $errors)
|
|
|
}
|
|
}
|
|
|
break;
|
|
break;
|
|
|
case 'DEVS':
|
|
case 'DEVS':
|
|
|
- $join = array('Name', 'ID');
|
|
|
|
|
switch($both[1])
|
|
switch($both[1])
|
|
|
{
|
|
{
|
|
|
case 'NOTIFY':
|
|
case 'NOTIFY':
|
|
|
case 'DEVDETAILS':
|
|
case 'DEVDETAILS':
|
|
|
|
|
+ case 'USBSTATS':
|
|
|
|
|
+ $join = array('Name', 'ID');
|
|
|
$sectionmap[$section] = $section;
|
|
$sectionmap[$section] = $section;
|
|
|
$results[$section] = joinfields($both[0], $both[1], $join, $results);
|
|
$results[$section] = joinfields($both[0], $both[1], $join, $results);
|
|
|
break;
|
|
break;
|
|
|
|
|
+ case 'STATS':
|
|
|
|
|
+ $join = array('L' => array('Name','ID'), 'R' => array('ID'));
|
|
|
|
|
+ $sectionmap[$section] = $section;
|
|
|
|
|
+ $results[$section] = joinlr($both[0], $both[1], $join, $results);
|
|
|
|
|
+ break;
|
|
|
|
|
+ default:
|
|
|
|
|
+ $errors[] = "Error: Invalid section '$section'";
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ case 'POOL':
|
|
|
|
|
+ switch($both[1])
|
|
|
|
|
+ {
|
|
|
|
|
+ case 'STATS':
|
|
|
|
|
+ $join = array('L' => array(':POOL','POOL'), 'R' => array('ID'));
|
|
|
|
|
+ $sectionmap[$section] = $section;
|
|
|
|
|
+ $results[$section] = joinlr($both[0], $both[1], $join, $results);
|
|
|
|
|
+ break;
|
|
|
default:
|
|
default:
|
|
|
$errors[] = "Error: Invalid section '$section'";
|
|
$errors[] = "Error: Invalid section '$section'";
|
|
|
break;
|
|
break;
|