From 54ad139d6a4b52c4ad83ac6f08600ed2ffdd570e Mon Sep 17 00:00:00 2001 From: kanoi Date: Thu, 18 Jun 2015 09:56:23 +1000 Subject: [PATCH 1/4] php - fix missing variable log message --- pool/page_userinfo.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pool/page_userinfo.php b/pool/page_userinfo.php index 358edbb6..95e12ca4 100644 --- a/pool/page_userinfo.php +++ b/pool/page_userinfo.php @@ -19,7 +19,7 @@ function douserinfo($data, $user) $ans = getUserInfo($user); - $pg = '

Block Acclaim

'.$pg; + $pg = '

Block Acclaim

'; $pg .= "\n"; $pg .= ""; $pg .= ""; From 0e2f020705c3ac851f1f1a8c26f885d8938f22fb Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 6 Jul 2015 20:15:07 +1000 Subject: [PATCH 2/4] php - add sort radios to the workers page --- pool/inc.php | 165 +++++++++++++++++++----------------------- pool/page.php | 6 ++ pool/page_workers.php | 23 ++++-- 3 files changed, 96 insertions(+), 98 deletions(-) diff --git a/pool/inc.php b/pool/inc.php index a6126a68..a426580f 100644 --- a/pool/inc.php +++ b/pool/inc.php @@ -2,15 +2,15 @@ # function GBaseJS() { - $g = "function hasCan(){var c0=document.getElementById('can0');c=document.getElementById('can');return !!(c0&&c&&c.getContext&&c.getContext('2d'));} -function sep(d){ans={};var ar=d.split('\\t');var l=ar.length;for(var i=0;i0){ans=c[0].substr(e+1)}}}return ans} +function scnv(n,v){var d=new Date();d.setTime(d.getTime()+(864*Math.pow(10,8)));document.cookie=n+'='+v+';expires='+d.toUTCString()+';path=/'} function ni(e,o){if(e){if(o==0){e.defd=e.style.display;e.style.display='none'}else{e.style.display=e.defd}}} -function domin(o){var e=document.getElementById('minicb');if(e){if(o==0){e.checked=true}else{e.checked=false}};for(var i=0;i<10;i++){e=document.getElementById('mini'+i);ni(e,o)}} +function domin(o){var e=document.getElementById('minicb');if(e){if(o==0){e.checked=true}else{e.checked=false}}for(var i=0;i<10;i++){e=document.getElementById('mini'+i);ni(e,o)}} function mini(){var hm=gcn('mini');if(hm==''){domin(1)}else{domin(0)}} function md(e){var c='';if(e.checked){c='y'}scnv('mini',c);mini()} function tim(){var e=document.getElementById('ftr');if(e){var now=new Date(),t=document.createTextNode(now.toLocaleString());e.appendChild(t)}} -function jst(){var e=document.getElementById('jst');if(e){e.style.visibility='hidden'}}"; +function jst(){var e=document.getElementById('jst');if(e){e.style.visibility='hidden'}} +"; return $h; } # function HeadCSS($iCrap = false) { - $h = "input[type=checkbox] {vertical-align: -2px;} -form {display: inline-block;} -html, body {height: 100%; font-family:Arial, Verdana, sans-serif; font-size:12pt; background-color:#eeffff; text-align: center; background-repeat: no-repeat; background-position: center;} -.page {min-height: 100%; height: auto !important; height: 100%; margin: 0 auto -50px; position: relative;} -div.jst {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;} -div.accwarn {color:red; font-weight: bold; font-size: 8; text-align: center; vertical-align: top;} -div.topd {background-color:#cff; border-color: #cff; border-style: solid; border-width: 9px;} -.topdes {color:blue; text-align: right;} -.topdesl {color:blue; text-align: left;} -.topwho {color:black; font-weight: bold; margin-right: 8px;} -.topdat {margin-left: 8px; margin-right: 24px; color:green; font-weight: bold;} -span.nb {white-space: pre;} -span.login {float: right; margin-left: 8px; margin-right: 24px;} + $h = "input[type=checkbox] {vertical-align:-2px;} +form {display:inline-block;} +html, body {height:100%;font-family:Arial, Verdana, sans-serif;font-size:12pt;background-color:#eeffff;text-align:center;background-repeat:no-repeat;background-position:center;} +.page {min-height:100%;height:auto !important;height:100%;margin:0 auto -50px;position:relative;} +div.jst {color:red;font-weight:bold;font-size:8;text-align:center;vertical-align:top;} +div.accwarn {color:red;font-weight:bold;font-size:8;text-align:center;vertical-align:top;} +div.topd {background-color:#cff;border-color:#cff;border-style:solid;border-width:9px;} +.topdes {color:blue;text-align:right;} +.topdesl {color:blue;text-align:left;} +.topwho {color:black;font-weight:bold;margin-right:8px;} +.topdat {margin-left:8px;margin-right:24px;color:green;font-weight:bold;} +span.nb {white-space:pre;} +span.login {float:right;margin-left:8px;margin-right:24px;} span.hil {color:blue;} span.user {color:green;} span.addr {color:brown;} -span.warn {color:orange; font-weight:bold;} -span.urg {color:red; font-weight:bold;} -span.err {color:red; font-weight:bold; font-size:120%;} -span.alert {color:red; font-weight:bold; font-size:250%;} -input.tiny {width: 0px; height: 0px; margin: 0px; padding: 0px; outline: none; border: 0px;} -#n42 {margin:0; position: relative; color:#ffffff; background:#0077ee;} -#n42 a {color:#fff; text-decoration:none; padding: 6px; display:block;} -#n42 td {min-width: 100px; float: left; vertical-align: top; padding: 0px 2px;} -#n42 td.navboxr {float: right;} -#n42 td.nav {position: relative;} -#n42 td.ts {border-width: 1px; border-color: #0022ee; border-style: solid none none none;}"; +span.warn {color:orange;font-weight:bold;} +span.urg {color:red;font-weight:bold;} +span.err {color:red;font-weight:bold;font-size:120%;} +span.alert {color:red;font-weight:bold;font-size:250%;} +input.tiny {width:0px;height:0px;margin:0px;padding:0px;outline:none;border:0px;} +#n42 {margin:0;position:relative;color:#ffffff;background:#0077ee;} +#n42 a {color:#fff;text-decoration:none;padding:6px;display:block;} +#n42 td {min-width:100px;float:left;vertical-align:top;padding:0px 2px;} +#n42 td.navboxr {float:right;} +#n42 td.nav {position:relative;} +#n42 td.ts {border-width:1px;border-color:#0022ee;border-style:solid none none none;} +"; if (!$iCrap) { - $h .= " -#n42 div.sub {left: 0px; z-index: 42; position: absolute; visibility: hidden;} + $h .= "#n42 div.sub {left:0px;z-index:42;position:absolute;visibility:hidden;} #n42 td.nav:hover {background:#0099ee;} -#n42 td.nav:hover div.sub {background:#0077ee; visibility: visible;}"; +#n42 td.nav:hover div.sub {background:#0077ee;visibility:visible;} +"; } - $h .= " -h1 {margin-top: 20px; float:middle; font-size: 20px;} -.foot, .push {height: 50px;} -.title {background-color: #909090;} -.even {background-color: #cccccc;} -.odd {background-color: #a8a8a8;} -.hid {display: none;} -.dl {text-align: left; padding: 2px 8px;} -.dr {text-align: right; padding: 2px 8px;} -.dc {text-align: center; padding: 2px 8px;} -.dls {text-align: left; padding: 2px 8px; text-decoration:line-through; font-weight:lighter;} -.drs {text-align: right; padding: 2px 8px; text-decoration:line-through; font-weight:lighter;} -.dcs {text-align: center; padding: 2px 8px; text-decoration:line-through; font-weight:lighter;} + $h .= "h1 {margin-top:20px;float:middle;font-size:20px;} +.foot, .push {height:50px;} +.title {background-color:#909090;} +.even {background-color:#cccccc;} +.odd {background-color:#a8a8a8;} +.hid {display:none;} +.dl {text-align:left;padding:2px 8px;} +.dr {text-align:right;padding:2px 8px;} +.dc {text-align:center;padding:2px 8px;} +.dls {text-align:left;padding:2px 8px;text-decoration:line-through;font-weight:lighter;} +.drs {text-align:right;padding:2px 8px;text-decoration:line-through;font-weight:lighter;} +.dcs {text-align:center;padding:2px 8px;text-decoration:line-through;font-weight:lighter;} .st0 {font-weight:bold;} -.st1 {color:red; font-weight:bold;} -.st2 {color:green; font-weight:bold;} -.st3 {color:blue; font-weight:bold;} -.fthi {color:red; font-size:7px;} -.ftlo {color:green; font-size:7px;} -.ft {color:blue; font-size:7px;} -.ftl {text-align: left; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap;} -.ftm {text-align: middle; font-size:10pt; display:inline-block; width:60%; white-space: nowrap;} -.ftr {text-align: rigth; color:blue; font-size:7px; display:inline-block; width:20%; white-space: nowrap;}"; +.st1 {color:red;font-weight:bold;} +.st2 {color:green;font-weight:bold;} +.st3 {color:blue;font-weight:bold;} +.fthi {color:red;font-size:7px;} +.ftlo {color:green;font-size:7px;} +.ft {color:blue;font-size:7px;} +.ftl {text-align:left;color:blue;font-size:7px;display:inline-block;width:20%;white-space:nowrap;} +.ftm {text-align:middle;font-size:10pt;display:inline-block;width:60%;white-space:nowrap;} +.ftr {text-align:rigth;color:blue;font-size:7px;display:inline-block;width:20%;white-space:nowrap;} +"; return $h; } # +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 diff --git a/pool/page.php b/pool/page.php index 20e42f78..6a64d2eb 100644 --- a/pool/page.php +++ b/pool/page.php @@ -66,6 +66,11 @@ function addTips() addCSS($tcss); } # +function addSort() +{ + $s = SortJS(); + addScript($s); +} # function makeURL($page) { @@ -75,6 +80,7 @@ function makeURL($page) $page = '?k='.$page; return "/index.php$page"; } +# function makeLink($page, $rest = '') { $href = ""; $pg .= ''; - $pg .= ''; + $pg .= ""; $pg .= ''; - $pg .= ''; + $pg .= ""; $pg .= ''; $pg .= ''; - $pg .= ''; + $pg .= ""; $pg .= "\n"; + addSort(); return $pg; } # @@ -86,14 +88,15 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff, $ld = ' '; $pg .= ""; - $pg .= ''; + $pg .= "'; $shareacc = number_format($all[$i]['w_shareacc'], 0); $totshare += $all[$i]['w_shareacc']; $diffacc = number_format($all[$i]['w_diffacc'], 0); + $ds = round($all[$i]['w_diffacc']); $totdiff += $all[$i]['w_diffacc']; $pg .= ""; - $pg .= ""; + $pg .= ""; $dtot = $all[$i]['w_diffacc'] + $all[$i]['w_diffinv']; if ($dtot > 0) @@ -113,13 +116,17 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff, $uhr = $all[$i]['w_uhr']; if ($uhr == '?') + { $uhr = '?GHs'; + $su = 0; + } else { $totrate += $uhr; $uhr = dsprate($uhr); + $su = round($uhr); } - $pg .= ""; + $pg .= ""; $pg .= "\n"; @@ -137,7 +144,7 @@ function worktotal($offset, $totshare, $totdiff, $totinvalid, $totrate, $blockac $row = 'even'; else $row = 'odd'; - $pg .= ""; + $pg .= ""; $shareacc = number_format($totshare, 0); $pg .= ""; $diffacc = number_format($totdiff, 0); From a86b3f7aaa629e7da2dbb56bd4406671df68faa2 Mon Sep 17 00:00:00 2001 From: kanoi Date: Mon, 6 Jul 2015 23:50:13 +1000 Subject: [PATCH 3/4] php - store worker sort choice in a cookie --- pool/inc.php | 4 +++- pool/page_workers.php | 14 ++++++++------ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/pool/inc.php b/pool/inc.php index a426580f..9710fe8b 100644 --- a/pool/inc.php +++ b/pool/inc.php @@ -139,7 +139,9 @@ input.tiny {width:0px;height:0px;margin:0px;padding:0px;outline:none;border:0px; 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"; + $pg .= ""; $pg .= ''; - $pg .= ""; + $pg .= ""; $pg .= ''; - $pg .= ""; + $pg .= ""; $pg .= ''; $pg .= ''; - $pg .= ""; + $pg .= ""; $pg .= "\n"; - addSort(); return $pg; } # @@ -194,6 +194,8 @@ function doworker($data, $user) } $pg .= "
UserWork DiffLast Share$r,2,'n');\">:Last ShareSharesDiff$r,4,'r');\">:DiffInvalidBlock %Hash Rate$r,7,'r');\" checked>:Hash Rate
$ld'.howlongago($lst).'".howlongago($lst).'$shareacc$diffacc$diffacc$uhr$uhr
Total:
Total: $offset$shareaccWorker Name:<$r id=srtwrk data-sf=s0>Work Diff$r,2,'n');\">:Last Share<$r id=srtlst data-sf=n2>:Last ShareShares$r,4,'r');\">:Diff<$r id=srtdiff data-sf=r4>:DiffInvalidBlock %$r,7,'r');\" checked>:Hash Rate<$r id=srtrate data-sf=r7>:Hash Rate
\n"; + $pg .= "\n"; return "

Workers$title

".$pg; } From 8c9164e9503c1ce712cbe2758f6dc48a4e3b0ac2 Mon Sep 17 00:00:00 2001 From: kanoi Date: Wed, 8 Jul 2015 18:03:07 +1000 Subject: [PATCH 4/4] php - hard rate sort was prefix based - fix to be absolute --- pool/page_workers.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pool/page_workers.php b/pool/page_workers.php index 052fe133..d87ea691 100644 --- a/pool/page_workers.php +++ b/pool/page_workers.php @@ -122,9 +122,9 @@ function workuser($data, $user, &$offset, &$totshare, &$totdiff, } else { + $su = round($uhr); $totrate += $uhr; $uhr = dsprate($uhr); - $su = round($uhr); } $pg .= "$uhr";