From 9bc5a5d426c42e0cc817ec0a4466064718c76e19 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Fri, 10 Sep 2004 00:14:37 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=4177 --- checkin_notes | 13 ++++++++++ html/inc/userw.inc | 61 +++++++++++++++++++++++++++++++++++++++++++++ html/inc/wap.inc | 25 +++++++++++++++++++ html/user/opsw.php | 53 +++++++++++++++++++++++++++++++++++++++ html/user/userw.php | 21 ++++++++++++++++ 5 files changed, 173 insertions(+) create mode 100644 html/inc/userw.inc create mode 100644 html/inc/wap.inc create mode 100644 html/user/opsw.php create mode 100644 html/user/userw.php diff --git a/checkin_notes b/checkin_notes index ec7a69514b..7e766f020a 100755 --- a/checkin_notes +++ b/checkin_notes @@ -17223,3 +17223,16 @@ David 9 Sept 2004 lib/ util.C,h + + +David 9 Sept 2004 + - Added support for stats access via WAP (for cell phones) + (from Carl Christensen) + + html/ + inc/ + userw.inc + wap.inc + user/ + opsw.php + userw.php diff --git a/html/inc/userw.inc b/html/inc/userw.inc new file mode 100644 index 0000000000..4d221e0b7f --- /dev/null +++ b/html/inc/userw.inc @@ -0,0 +1,61 @@ +User TotCred: " . format_credit($user->total_credit) . "
"; + $retstr .= "User AvgCred: " . format_credit($user->expavg_credit) . "
"; + /* + if ($user->seti_nresults) { + row2("SETI@home classic workunits", number_format($user->seti_nresults)); + } + if ($user->seti_total_cpu) { + $x = number_format($user->seti_total_cpu/3600)." hours"; + row2("SETI@home classic CPU time", $x); + } + */ + return $retstr; +} + +function show_user_wap($user) +{ + + wap_begin(); + + if (!$user) { + echo "
User not found!
"; + wap_end(); + return; + } + + // keep a 'running tab' in wapstr in case exceeds 1K WAP limit + + $wapstr = PROJECT . "
Account Data
for $user->name
Time: " . wap_timestamp(); + + $wapstr .= show_credit($user); + + if ($user->teamid) { + $result = mysql_query("select name, total_credit, expavg_credit from team where id = $user->teamid"); + $team = mysql_fetch_object($result); + + $wapstr .= "
Team: $team->name
"; + $wapstr .= "Team TotCred: " . format_credit($team->total_credit) . "
"; + $wapstr .= "Team AvgCred: " . format_credit($team->expavg_credit) . "
"; + + mysql_free_result($result); + + } else { + $wapstr .= "
Team: None
"; + } + + // finally get last 5 trickles for user + //$wapstr .= show_trickles("u", $user->id, 5, 1); + + // don't want to send more than 1KB probably? + if (strlen($wapstr)>1024) + echo substr($wapstr,0,1024); + else + echo $wapstr; + + wap_end(); +} + +?> diff --git a/html/inc/wap.inc b/html/inc/wap.inc new file mode 100644 index 0000000000..14a674fe08 --- /dev/null +++ b/html/inc/wap.inc @@ -0,0 +1,25 @@ +" + . "" + . "

"; +} + +function wap_end() +{ + echo "

"; +} + +function wap_timestamp() +{ + return strftime("%d %b %Y %H:%M:%S UTC", mktime()); +} +?> diff --git a/html/user/opsw.php b/html/user/opsw.php new file mode 100644 index 0000000000..b5de180624 --- /dev/null +++ b/html/user/opsw.php @@ -0,0 +1,53 @@ +Status Info on
" . wap_timestamp() . "

"; + + $wapstr .= "#Users: " . getSingleQuery("select count(*) from user") . "
"; + $wapstr .= "#Hosts: " . getSingleQuery("select count(*) from host") . "
"; + $wapstr .= "#ModYr: " . sprintf("%ld", getSingleQuery("select sum(total_credit)/(.007*17280.0) from host")) . "
"; + $wapstr .= "#Cobbl: " . sprintf("%ld", getSingleQuery("select sum(total_credit) from host")) . "
"; + // I consider a host active if it's trickled in the last week + //$wapstr .= "#Activ: " . getSingleQuery("select count(distinct hostid) from cpdnexpt.trickle " + // . "where trickledate>=" . sprintf("%d", mktime() - (3600*24*7))) . "
"; + + // finally get last 5 trickles for everyone + //$wapstr .= show_trickles("a", 0, 5, 1); + + // limit wap output to 1KB + if (strlen($wapstr)>1024) + echo substr($wapstr,0,1024); + else + echo $wapstr; + + wap_end(); + +?> diff --git a/html/user/userw.php b/html/user/userw.php new file mode 100644 index 0000000000..c20eb76c1e --- /dev/null +++ b/html/user/userw.php @@ -0,0 +1,21 @@ +