Browse Source

ckdb/php - add mult-worker select to usperf and ? tips

master
kanoi 10 years ago
parent
commit
3fcb7779c8
  1. 8
      pool/db.php
  2. 76
      pool/page.php
  3. 68
      pool/page_usperf.php
  4. 2
      src/ckdb.h
  5. 4
      src/ckdb_cmd.c

8
pool/db.php

@ -309,11 +309,13 @@ function getMPayouts($user)
return repDecode($rep); return repDecode($rep);
} }
# #
function getShifts($user) function getShifts($user, $workers = null)
{ {
if ($user == false) if ($user == false)
showIndex(); showIndex();
$flds = array('username' => $user); $flds = array('username' => $user);
if ($workers !== null)
$flds['select'] = $workers;
$msg = msgEncode('shifts', 'shift', $flds, $user); $msg = msgEncode('shifts', 'shift', $flds, $user);
$rep = sendsockreply('getShifts', $msg); $rep = sendsockreply('getShifts', $msg);
if (!$rep) if (!$rep)
@ -321,11 +323,13 @@ function getShifts($user)
return repDecode($rep); return repDecode($rep);
} }
# #
function getShiftData($user) function getShiftData($user, $workers = null)
{ {
if ($user == false) if ($user == false)
showIndex(); showIndex();
$flds = array('username' => $user); $flds = array('username' => $user);
if ($workers !== null)
$flds['select'] = $workers;
$msg = msgEncode('shifts', 'shift', $flds, $user); $msg = msgEncode('shifts', 'shift', $flds, $user);
$rep = sendsockreply('getShifts', $msg); $rep = sendsockreply('getShifts', $msg);
if (!$rep) if (!$rep)

76
pool/page.php

@ -3,10 +3,12 @@
global $site_title; global $site_title;
global $page_title; global $page_title;
global $page_scripts; global $page_scripts;
global $page_css;
# #
$site_title = 'CKPool'; $site_title = 'CKPool';
$page_title = $site_title; $page_title = $site_title;
$page_scripts = ''; $page_scripts = '';
$page_css = '';
# #
global $dont_trm; global $dont_trm;
$dont_trm = false; $dont_trm = false;
@ -40,13 +42,20 @@ function addScript($script)
} }
} }
# #
function addCSS($css)
{
global $page_css;
$page_css .= $css;
}
#
function addGBase() function addGBase()
{ {
$g = "function hasCan(){var c0=document.getElementById('can0');c=document.getElementById('can');return !!(c0&&c&&c.getContext&&c.getContext('2d'));} $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;i<l;i++){var e=ar[i].indexOf('=');ans[ar[i].substr(0,e)]=ar[i].substr(e+1)};return ans} function sep(d){ans={};var ar=d.split('\\t');var l=ar.length;for(var i=0;i<l;i++){var e=ar[i].indexOf('=');ans[ar[i].substr(0,e)]=ar[i].substr(e+1)};return ans}
function dfmt(c,e){var d=new Date(e*1000);var DD,HH,MM;if(c['utc']){DD=d.getUTCDate();HH=d.getUTCHours();MM=d.getUTCMinutes()}else{DD=d.getDate();HH=d.getHours();MM=d.getMinutes()}var ans=''+DD+'/';if(HH<10){ans+='0'}ans+=''+HH+':';if(MM<10){ans+='0'}ans+=''+MM;return ans} function dfmt(c,e){var d=new Date(e*1000);var DD,HH,MM;if(c['utc']){DD=d.getUTCDate();HH=d.getUTCHours();MM=d.getUTCMinutes()}else{DD=d.getDate();HH=d.getHours();MM=d.getMinutes()}var ans=''+DD+'/';if(HH<10){ans+='0'}ans+=''+HH+':';if(MM<10){ans+='0'}ans+=''+MM;return ans}
function gcn(n){var ans='',d=document.cookie;if(d){var c0=d.indexOf(n+'='),cs=d.indexOf(' '+n+'=');if(c0==0||cs>0){if(cs>0){c0=cs+1}var c=d.substr(c0).split(';',1);var e=c[0].indexOf('=');if(e>0){ans=c[0].substr(e+1)}}}return ans} function gcn(n){var ans='',d=document.cookie;if(d){var c0=d.indexOf(n+'='),cs=d.indexOf(' '+n+'=');if(c0==0||cs>0){if(cs>0){c0=cs+1}var c=d.substr(c0).split(';',1);var e=c[0].indexOf('=');if(e>0){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 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 ccb(c,n){var e=document.getElementById(n);c[n]=(e&&e.checked)} function ccb(c,n){var e=document.getElementById(n);c[n]=(e&&e.checked)}
function gch(z,zm){if(z<0.5){return 0.5}if(z>(zm-0.5)){return(zm-0.5)}return z} function gch(z,zm){if(z<0.5){return 0.5}if(z>(zm-0.5)){return(zm-0.5)}return z}
function gchx(c,x){return gch(x*c['xm']+c['xo'],c['ctx'].canvas.width)} function gchx(c,x){return gch(x*c['xm']+c['xo'],c['ctx'].canvas.width)}
@ -69,7 +78,7 @@ function gfl(c){c['ctx'].fill()}
function gst(c){c['ctx'].stroke()} function gst(c){c['ctx'].stroke()}
function gfi(c){gle(c);gst(c)} function gfi(c){gle(c);gst(c)}
function gbd(c){gbe(c,0,0);gln(c,1,0);gln(c,1,1);gln(c,0,1);gle(c);gfl(c);gst(c)} function gbd(c){gbe(c,0,0);gln(c,1,0);gln(c,1,1);gln(c,0,1);gle(c);gfl(c);gst(c)}
function ggr(c,xs,ys,yt,xn,x0,x1,y0,y1,ar,nx,vx,vy,av){ function ggr(c,xs,ys,yt,xn,x0,x1,y0,y1,ar,nx,vx,vy,av,w,cols){
gtso(c,xs,ys); gtso(c,xs,ys);
gss(c,'black');glw(c,1.5); gss(c,'black');glw(c,1.5);
gbe(c,0,1);gln(c,0,0);gln(c,1,0);gst(c); gbe(c,0,1);gln(c,0,0);gln(c,1,0);gst(c);
@ -78,7 +87,6 @@ var hi=c['ctx'].measureText('M').width, wi=c['ctx'].measureText('1').width;
for(var i=0;i<11;i++){var y=i/10.0;gbe(c,-0.01,y);gln(c,1,y);gst(c);var t=''+(((y1-y0)*i/10+y0).toFixed(2));gfz(c,0,y,-wi,0,t,'black','end')} for(var i=0;i<11;i++){var y=i/10.0;gbe(c,-0.01,y);gln(c,1,y);gst(c);var t=''+(((y1-y0)*i/10+y0).toFixed(2));gfz(c,0,y,-wi,0,t,'black','end')}
gfz(c,gx0(c),0.55,wi,0,yt,'#0080ff','left'); gfz(c,gx0(c),0.55,wi,0,yt,'#0080ff','left');
var m=Math.round(0.5+xn/20.0); var m=Math.round(0.5+xn/20.0);
var f=1;
for(var i=0;i<xn;i++){var n=ar[nx+i];var x=ar[vx+i];var xo=(x-x0)/(x1-x0);if(c['skey']&&(i<(xn-1))&&(i%m)==0){gbe(c,xo,0);gln(c,xo,-0.01);gst(c);gfz(c,xo,0,0,-hi*1.5,n,'#00a050','center')}if(c['slines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}} for(var i=0;i<xn;i++){var n=ar[nx+i];var x=ar[vx+i];var xo=(x-x0)/(x1-x0);if(c['skey']&&(i<(xn-1))&&(i%m)==0){gbe(c,xo,0);gln(c,xo,-0.01);gst(c);gfz(c,xo,0,0,-hi*1.5,n,'#00a050','center')}if(c['slines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}}
var xhr=3600+x1-(x1%3600); var xhr=3600+x1-(x1%3600);
gss(c,'brown'); gss(c,'brown');
@ -86,15 +94,15 @@ if(c['tkey']||c['tlines']){var hlv=c['hln'][c['hl']];hrs=c['hrs'][c['hr']]*3600/
var l=0;tpos=2.7;if(c['over']){tpos=1.5} var l=0;tpos=2.7;if(c['over']){tpos=1.5}
for(var i=xhr;i>=x0;i-=hrs){var n=dfmt(c,i);var xo=(i-x0)/(x1-x0);if(xo<=1&&c['tkey']&&((l%hlv)==0)){gbe(c,xo,0);gln(c,xo,-0.02);gst(c);gfz(c,xo,0,0,-hi*tpos,n,'brown','center')}if(xo<=1&&c['tlines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}l++}} for(var i=xhr;i>=x0;i-=hrs){var n=dfmt(c,i);var xo=(i-x0)/(x1-x0);if(xo<=1&&c['tkey']&&((l%hlv)==0)){gbe(c,xo,0);gln(c,xo,-0.02);gst(c);gfz(c,xo,0,0,-hi*tpos,n,'brown','center')}if(xo<=1&&c['tlines']){gbe(c,xo,0);gln(c,xo,1);gst(c)}l++}}
glw(c,1); glw(c,1);
gss(c,'#0000c0'); if(c['smooth']){for(var j=1;j<w.length;j++){var f=1;gss(c,cols[j-1]);
if(c['smooth']){var xa=0,ya=0,xb=0,yb=0; var xa=0,ya=0,xb=0,yb=0;
for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0;xb=xo;yb=yo}else{gct(c,(xa+xb)/2,(ya+yb)/2,xb,yb,(xb+xo)/2,(yb+yo)/2)}xa=xb;ya=yb;xb=xo;yb=yo}gct(c,(xa+xb)/2,(ya+yb)/2,xo,yo,xo,yo);gst(c);} for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[w[j]+vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0;xb=xo;yb=yo}else{gct(c,(xa+xb)/2,(ya+yb)/2,xb,yb,(xb+xo)/2,(yb+yo)/2)}xa=xb;ya=yb;xb=xo;yb=yo}gct(c,(xa+xb)/2,(ya+yb)/2,xo,yo,xo,yo);gst(c);}}
else{for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0}else{gln(c,xo,yo)}}gst(c);} else{for(var j=1;j<w.length;j++){var f=1;gss(c,cols[j-1]);
for(var i=0;i<xn;i++){var x=ar[vx+i];var y=ar[w[j]+vy+i];var xo=(x-x0)/(x1-x0);var yo=(y-y0)/(y1-y0);if(f==1){gbe(c,xo,yo);f=0}else{gln(c,xo,yo)}}gst(c);}}
glw(c,1); glw(c,1);
gss(c,'red'); if(av>0){gss(c,'red');var y=(av-y0)/(y1-y0);
var y=(av-y0)/(y1-y0);
gbe(c,0,y);gln(c,1,y);gst(c); gbe(c,0,y);gln(c,1,y);gst(c);
var t=''+av.toFixed(2)+'av';gfz(c,1,y,1,0,t,'red','left') var t=''+av.toFixed(2)+'av';gfz(c,1,y,1,0,t,'red','left')}
if(c['tkey']){var col,hrl=c['hrs'].length;for(var i=0;i<hrl;i++){if(c['hr']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+1)*2,''+c['hrs'][i],col,'end')}for(var i=0;i<c['hln'].length;i++){if(c['hl']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+2+hrl)*2,''+c['hrs'][i],col,'end')}} if(c['tkey']){var col,hrl=c['hrs'].length;for(var i=0;i<hrl;i++){if(c['hr']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+1)*2,''+c['hrs'][i],col,'end')}for(var i=0;i<c['hln'].length;i++){if(c['hl']==i){col='red'}else{col='black'}gfz(c,1,0,c['xo']-c['pxe'],hi*(i+2+hrl)*2,''+c['hrs'][i],col,'end')}}
} }
function sn(i,shi){if(shi.indexOf(' Shift ')<0){return ''+(i%10)}else{return shi.replace(/.* ([a-z])[a-z]*$/,'$1')}} function sn(i,shi){if(shi.indexOf(' Shift ')<0){return ''+(i%10)}else{return shi.replace(/.* ([a-z])[a-z]*$/,'$1')}}
@ -108,11 +116,35 @@ function doinit(cbx,xon){for(var i=0;i<cbx.length;i++){var e=document.getElement
addScript($g); addScript($g);
} }
# #
function makeLink($page, $rest = '') function addTips()
{
$t = "function untip(e){if(e){if(typeof e.tmo!='undefined'){clearTimeout(e.tmo);delete e.tmo}e.style.opacity=0;e.style.visibility='hidden'}}
function tip(i,n){var e=document.getElementById(i);if(e){if(e.style.visibility=='visible'){untip(e)}else{e.style.visibility='visible';e.style.opacity=0.95;e.tmo=setTimeout(function(){untip(e)},n)}}}
";
addScript($t);
$tcss = "span.tip0 {position:absolute;z-index:42;pointer-events:none;font-size:smaller;text-align:left;}
span.notip {position:relative;color:#0077ee;background:#bbffff;border-style:solid;border-color:black;border-width:1px;left:-10px;width:200px;padding:2px;float:left;transition:visibility 0.5s,opacity 0.5s;visibility:hidden;opacity:0}
span.tip {visibility: visibile;}
span.q {position: relative; width: 16px; height: 16px; display: inline-block; background-color: #0077ee; line-height: 16px; color: White; font-size: 13px; font-weight: bold; border-radius: 8px; text-align: center; cursor: pointer; }
ul.tip {margin-top:0;margin-bottom:0;list-style:disc inside none;margin-left:0;padding-left:0.5em;display:block}
li {padding-left:0.5em;}
";
addCSS($tcss);
}
#
#
function makeURL($page)
{ {
if ($page != '') if ($page == null)
$page = '';
else if ($page != '')
$page = '?k='.$page; $page = '?k='.$page;
$href = "<a href='index.php$page'"; return "/index.php$page";
}
function makeLink($page, $rest = '')
{
$href = "<a href='".makeURL($page)."'";
if ($rest != '') if ($rest != '')
$href .= " $rest"; $href .= " $rest";
$href .= '>'; $href .= '>';
@ -148,7 +180,7 @@ function trm_force($html)
return dotrm($html, false); return dotrm($html, false);
} }
# #
function pghead($script_marker, $name) function pghead($css_marker, $script_marker, $name)
{ {
global $page_title; global $page_title;
@ -187,18 +219,18 @@ span.urg {color:red; font-weight:bold;}
span.err {color:red; font-weight:bold; font-size:120%;} span.err {color:red; font-weight:bold; font-size:120%;}
span.alert {color:red; font-weight:bold; font-size:250%;} span.alert {color:red; font-weight:bold; font-size:250%;}
input.tiny {width: 0px; height: 0px; margin: 0px; padding: 0px; outline: none; border: 0px;} input.tiny {width: 0px; height: 0px; margin: 0px; padding: 0px; outline: none; border: 0px;}
#n42 {margin:0; position: relative; color:#fff; background:#07e;} #n42 {margin:0; position: relative; color:#ffffff; background:#0077ee;}
#n42 a {color:#fff; text-decoration:none; padding: 6px; display:block;} #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 {min-width: 100px; float: left; vertical-align: top; padding: 0px 2px;}
#n42 td.navboxr {float: right;} #n42 td.navboxr {float: right;}
#n42 td.nav {position: relative;} #n42 td.nav {position: relative;}
#n42 td.ts {border-width: 1px; border-color: #02e; border-style: solid none none none;}"; #n42 td.ts {border-width: 1px; border-color: #0022ee; border-style: solid none none none;}";
if (!$iCrap) if (!$iCrap)
{ {
$head .= " $head .= "
#n42 div.sub {left: 0px; z-index: 42; position: absolute; visibility: hidden;} #n42 div.sub {left: 0px; z-index: 42; position: absolute; visibility: hidden;}
#n42 td.nav:hover {background:#09e;} #n42 td.nav:hover {background:#0099ee;}
#n42 td.nav:hover div.sub {background:#07e; visibility: visible;}"; #n42 td.nav:hover div.sub {background:#0077ee; visibility: visible;}";
} }
$head .= " $head .= "
h1 {margin-top: 20px; float:middle; font-size: 20px;} h1 {margin-top: 20px; float:middle; font-size: 20px;}
@ -220,6 +252,7 @@ h1 {margin-top: 20px; float:middle; font-size: 20px;}
.fthi {color:red; font-size:7px; } .fthi {color:red; font-size:7px; }
.ftlo {color:green; font-size:7px; } .ftlo {color:green; font-size:7px; }
.ft {color:blue; font-size:7px; } .ft {color:blue; font-size:7px; }
$css_marker
</style>\n"; </style>\n";
$head .= '<meta name="robots" content="noindex">'; $head .= '<meta name="robots" content="noindex">';
@ -592,9 +625,10 @@ function pgfoot($info)
function gopage($info, $data, $pagefun, $page, $menu, $name, $user, $ispage = true, $dotop = true, $douser = true) function gopage($info, $data, $pagefun, $page, $menu, $name, $user, $ispage = true, $dotop = true, $douser = true)
{ {
global $dbg, $stt; global $dbg, $stt;
global $page_scripts; global $page_css, $page_scripts;
$dbg_marker = '[@dbg@]'; $dbg_marker = '[@dbg@]';
$css_marker = '[@css@]';
$script_marker = '[@scripts@]'; $script_marker = '[@scripts@]';
if ($dbg === true) if ($dbg === true)
@ -616,13 +650,15 @@ function gopage($info, $data, $pagefun, $page, $menu, $name, $user, $ispage = tr
// if (isset($_SESSION['logkey'])) // if (isset($_SESSION['logkey']))
// unset($_SESSION['logkey']); // unset($_SESSION['logkey']);
$head = pghead($script_marker, $name); $head = pghead($css_marker, $script_marker, $name);
$body = pgbody($info, $page, $menu, $dotop, $user, $douser); $body = pgbody($info, $page, $menu, $dotop, $user, $douser);
$foot = pgfoot($info); $foot = pgfoot($info);
if ($dbg === true) if ($dbg === true)
$pg = str_replace($dbg_marker, cvtdbg(), $pg); $pg = str_replace($dbg_marker, cvtdbg(), $pg);
$head = str_replace($css_marker, $page_css, $head);
if ($page_scripts != '') if ($page_scripts != '')
$page_scripts .= "</script>"; $page_scripts .= "</script>";

68
pool/page_usperf.php

@ -1,25 +1,52 @@
<?php <?php
# #
function uspg() function uspg($nc)
{ {
$g = "function gdrw(c,d,cbx){gc(c);ghrs(c);gopt(c,cbx); $g = "function gdrw(c,d,cbx){gc(c);ghrs(c);gopt(c,cbx);
gfs(c,'white');gss(c,'#0000c0');glw(c,2);gbd(c); gfs(c,'white');gss(c,'#0000c0');glw(c,2);gbd(c);
var rows=d['rows'],ymin=-1,ymax=0,xmin=-1,xmax=0,tda=0,pre=d['prefix_all']; var rows=d['rows'],ymin=-1,ymax=0,xmin=-1,xmax=0,tda=0,all=d['prefix_all'];
for(var i=0;i<rows;i++){var s=parseFloat(d['start:'+i]);var e=parseFloat(d['end:'+i]);var da=parseFloat(d[pre+'diffacc:'+i]);tda+=da;var ths=(da/(e-s))*Math.pow(2,32)/Math.pow(10,12);d['ths:'+i]=ths;if(ymin==-1||ymin>ths){ymin=ths}if(ths>ymax)ymax=ths;d['nx:'+i]=sn(i,d['shift:'+i]);if(xmin==-1||xmin>s){xmin=s}if(xmax<e){xmax=e}d['vx:'+i]=(s+e)/2.0}; var w=d['arp'].split(',');var cols=d['cols'].split(',');
for(var i=0;i<rows;i++){var s=parseFloat(d['start:'+i]);var e=parseFloat(d['end:'+i]);d['nx:'+i]=sn(i,d['shift:'+i]);if(xmin==-1||xmin>s){xmin=s}if(xmax<e){xmax=e}d['vx:'+i]=(s+e)/2.0;
for(var j=1;j<w.length;j++){var pre=w[j];var ths=0,nam=pre+'diffacc:'+i;if(d[nam]){var da=parseFloat(d[nam]);var ths=(da/(e-s))*Math.pow(2,32)/Math.pow(10,12);if(pre==all){tda+=da}}d[pre+'ths:'+i]=ths;if(ymin==-1||ymin>ths){ymin=ths}if(ths>ymax)ymax=ths;document.getElementById('worker'+j).value=d[pre+'worker']}
}
var tav=(tda/(xmax-xmin))*Math.pow(2,32)/Math.pow(10,12); var tav=(tda/(xmax-xmin))*Math.pow(2,32)/Math.pow(10,12);
var p5=(ymax-ymin)*0.05;ymax+=p5;ymin-=p5;if(ymin<0){ymin=0} var p5=(ymax-ymin)*0.05;ymax+=p5;ymin-=p5;if(ymin<0){ymin=0}
if(c['zerob']){ymin=0} if(c['zerob']){ymin=0}
ghg(c,xmax-xmin); ghg(c,xmax-xmin);
ggr(c,0.9,0.9,'TH/s',rows,xmin,xmax,ymin,ymax,d,'nx:','vx:','ths:',tav)} ggr(c,0.9,0.9,'TH/s',rows,xmin,xmax,ymin,ymax,d,'nx:','vx:','ths:',tav,w,cols)}
c={}; c={};
function dodrw(data,cbx){if(hasCan()){gdrw(c,sep(data),cbx)}} function dodrw(data,cbx){if(hasCan()){gdrw(c,sep(data),cbx)}}
function gact(t){if(t.checked){scnv(t.id,1)}else{scnv(t.id,0)}godrw(0)}"; function gact(t){if(t.checked){scnv(t.id,1)}else{scnv(t.id,0)}godrw(0)}
function wch(){var w='';for(var i=1;i<=$nc;i++){var e=document.getElementById('worker'+i);if(e&&e.value&&e.value.trim()){if(i>1){w+=','}w+=e.value.trim()}}if(w){scnv('workers',w)}}";
return $g; return $g;
} }
# #
function dousperf($data, $user) function dousperf($data, $user)
{ {
$ans = getShiftData($user); global $fld_sep, $val_sep;
// This also defines how many worker fields there are
$cols = array('#0000c0', '#00dd00', '#e06020', '#b020e0');
$nc = count($cols);
$workers = 'all';
if (isset($_COOKIE['workers']))
{
$w = substr(trim($_COOKIE['workers']), 0, 1024);
if ($w !== false)
{
$wa = explode(',', $w, $nc+1);
if (count($wa) > $nc)
{
$w = '';
for ($i = 0; $i < $nc; $i++)
$w .= (($i == 0) ? '' : ',').$wa[$i];
}
$workers = $w;
}
}
$ans = getShiftData($user, $workers);
$iCrap = strpos($_SERVER['HTTP_USER_AGENT'],'iP'); $iCrap = strpos($_SERVER['HTTP_USER_AGENT'],'iP');
if ($iCrap) if ($iCrap)
@ -28,9 +55,11 @@ function dousperf($data, $user)
$vlines = true; $vlines = true;
$pg = '<h1>User Shift Reward Performance</h1><br>'; $pg = '<h1>User Shift Reward Performance</h1><br>';
if ($ans['STATUS'] == 'ok' and $ans['DATA'] != '') if ($ans['STATUS'] == 'ok' and $ans['DATA'] != '')
{ {
addGBase(); addGBase();
addTips();
$cbx = array('skey' => 'shift key', 'slines' => 'shift lines', $cbx = array('skey' => 'shift key', 'slines' => 'shift lines',
'tkey' => 'time key', 'tlines' => 'time lines', 'tkey' => 'time key', 'tlines' => 'time lines',
'over' => 'key overlap', 'smooth' => 'smooth', 'over' => 'key overlap', 'smooth' => 'smooth',
@ -39,7 +68,29 @@ function dousperf($data, $user)
if ($vlines === true) if ($vlines === true)
$xon['slines'] = 1; $xon['slines'] = 1;
$pg .= '<div>'; $pg .= '<form>';
$tt = "<ul class=tip><li>all = all workers</li><li>noname = worker with no workername</li>";
$tt .= "<li>or full workername without the username i.e. .worker or _worker</li></ul>";
$pg .= "<span class=q onclick='tip(\"wtip\",6000)'>?</span>";
$pg .= "<span class=tip0><span class=notip id=wtip>$tt</span></span>";
$i = 0;
$datacols = '';
$onch = " onchange='wch()'";
foreach ($cols as $col)
{
$i++;
$pg .= " <span class=nb><font color=$col>Worker$i:</font>";
$pg .= "<input type=text size=10 id=worker$i$onch> </span>";
if ($i > 1)
$datacols .= ',';
$datacols .= $col;
}
$oncl = "wch();location.href=\"".makeURL('usperf')."\"";
$pg .= "<button type=button onclick='$oncl'>Update</button></form><div>";
foreach ($cbx as $nam => $txt) foreach ($cbx as $nam => $txt)
{ {
$pg .= ' <span class=nb>'; $pg .= ' <span class=nb>';
@ -52,8 +103,9 @@ function dousperf($data, $user)
$pg .= 'A graph will show here if your browser supports html5/canvas'; $pg .= 'A graph will show here if your browser supports html5/canvas';
$pg .= "</canvas></div>\n"; $pg .= "</canvas></div>\n";
$data = str_replace(array("\\","'"), array("\\\\","\\'"), $ans['DATA']); $data = str_replace(array("\\","'"), array("\\\\","\\'"), $ans['DATA']);
$data .= $fld_sep . 'cols' . $val_sep . $datacols;
$pg .= "<script type='text/javascript'>\n"; $pg .= "<script type='text/javascript'>\n";
$pg .= uspg(); $pg .= uspg($nc);
$pg .= "\nfunction godrw(f){var cbx=["; $pg .= "\nfunction godrw(f){var cbx=[";
$comma = ''; $comma = '';
foreach ($cbx as $nam => $txt) foreach ($cbx as $nam => $txt)

2
src/ckdb.h

@ -55,7 +55,7 @@
#define DB_VLOCK "1" #define DB_VLOCK "1"
#define DB_VERSION "1.0.0" #define DB_VERSION "1.0.0"
#define CKDB_VERSION DB_VERSION"-1.047" #define CKDB_VERSION DB_VERSION"-1.048"
#define WHERE_FFL " - from %s %s() line %d" #define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__ #define WHERE_FFL_HERE __FILE__, __func__, __LINE__

4
src/ckdb_cmd.c

@ -4827,6 +4827,7 @@ static char *cmd_shifts(__maybe_unused PGconn *conn, char *cmd, char *id,
selects[1] = NULL; selects[1] = NULL;
} }
bzero(used, sizeof(used));
if (where_all >= 0) if (where_all >= 0)
used[where_all] = true; used[where_all] = true;
@ -4993,9 +4994,8 @@ static char *cmd_shifts(__maybe_unused PGconn *conn, char *cmd, char *id,
where_all, rows, where_all, rows,
reply, FLDSEP); reply, FLDSEP);
APPEND_REALLOC(buf, off, len, tmp); APPEND_REALLOC(buf, off, len, tmp);
rows++;
} }
rows++;
// Setup for next shift // Setup for next shift
copy_tv(&marker_end, &(wi->createdate)); copy_tv(&marker_end, &(wi->createdate));

Loading…
Cancel
Save