mirror of https://github.com/BOINC/boinc.git
web RPC for setting venue
svn path=/trunk/boinc/; revision=8854
This commit is contained in:
parent
f27e203507
commit
2fd5bf26d8
|
@ -13712,3 +13712,15 @@ David 13 Nov 2005
|
|||
|
||||
clientgui/
|
||||
MainDocument.cpp
|
||||
|
||||
David 14 Nov 2005
|
||||
- the show_user.php web RPC now returns
|
||||
CPIDs, host CPIDs, default venue, and host venues
|
||||
- added new rpc, am_set_host_info.php, for setting host venue
|
||||
See http://boinc.berkeley.edu/web_rpc.php
|
||||
|
||||
html/
|
||||
inc/
|
||||
xml.inc
|
||||
user/
|
||||
am_set_host_info.php (new)
|
||||
|
|
|
@ -118,11 +118,32 @@ list_item("output",
|
|||
</am_set_info_reply>")
|
||||
);
|
||||
list_item("action",
|
||||
"updates one or more items of data associated with the given account"
|
||||
"updates one or more attributes of the given account"
|
||||
);
|
||||
|
||||
list_end();
|
||||
|
||||
echo "
|
||||
<h3>Set host info</h3>
|
||||
";
|
||||
list_start();
|
||||
list_item("URL", "project_url/am_set_host_info.php");
|
||||
list_item("input",
|
||||
"account_key
|
||||
<br>hostid
|
||||
<br>venue
|
||||
"
|
||||
);
|
||||
list_item("output",
|
||||
html_text("<am_set_host_info_reply>
|
||||
[ <error>MSG</error> ]
|
||||
[ <success/> ]
|
||||
</am_set_host_info_reply>")
|
||||
);
|
||||
list_item("action",
|
||||
"Updates the host's venue"
|
||||
);
|
||||
list_end();
|
||||
echo "
|
||||
<h3>Get account/host credit information</h3>
|
||||
";
|
||||
|
@ -136,6 +157,8 @@ list_item("input",
|
|||
);
|
||||
list_item("output",
|
||||
html_text("<user>
|
||||
<id>123</id>
|
||||
<cpid>fe0b2753a355b17864ec061eb1b9e8de</cpid>
|
||||
<create_time>918948493</create_time>
|
||||
<name>Joe Smith</name>
|
||||
<country>United States</country>
|
||||
|
@ -143,14 +166,15 @@ html_text("<user>
|
|||
<expavg_credit>200</expavg_credit>
|
||||
<expavg_time>1110833427.64028</expavg_time>
|
||||
<teamid>114322</teamid>
|
||||
<url/>
|
||||
<url>example.com</url>
|
||||
<has_profile>1</has_profile>
|
||||
</user>
|
||||
|
||||
or
|
||||
|
||||
<user>
|
||||
<id>1</id>
|
||||
<id>123</id>
|
||||
<cpid>fe0b2753a355b17864ec061eb1b9e8de</cpid>
|
||||
<create_time>1101918807</create_time>
|
||||
<name>David</name>
|
||||
<country>United States</country>
|
||||
|
@ -158,9 +182,11 @@ or
|
|||
<expavg_credit>0.000883</expavg_credit>
|
||||
<expavg_time>1116963330.83107</expavg_time>
|
||||
<teamid>0</teamid>
|
||||
<url/>
|
||||
<url>example.com</url>
|
||||
<has_profile>1</has_profile>
|
||||
<host>
|
||||
<id>123</id>
|
||||
<host_cpid>fe0b2753a355b17864ec061eb1b9e8de</host_cpid>
|
||||
<total_credit>0</total_credit>
|
||||
<expavg_credit>0</expavg_credit>
|
||||
<expavg_time>0</expavg_time>
|
||||
|
@ -173,6 +199,7 @@ or
|
|||
<os_name>Microsoft Windows XP</os_name>
|
||||
<os_version>Professional Edition, Service Pack 2, (05.01.2600.00)</os_version>
|
||||
</host>
|
||||
...
|
||||
</user>
|
||||
")
|
||||
);
|
||||
|
|
|
@ -26,14 +26,17 @@ function show_host_xml($host) {
|
|||
<p_iops>$host->p_iops</p_iops>
|
||||
<os_name>$host->os_name</os_name>
|
||||
<os_version>$host->os_version</os_version>
|
||||
<venue>$host->venue</venue>
|
||||
</host>
|
||||
";
|
||||
}
|
||||
|
||||
function show_user_xml($user, $show_hosts) {
|
||||
xml_header();
|
||||
$cpid = md5($user->cross_project_id.$user->email_addr);
|
||||
echo "<user>
|
||||
<id>$user->id</id>
|
||||
<cpid>$cpid</cpid>
|
||||
<create_time>$user->create_time</create_time>
|
||||
<name>".htmlspecialchars($user->name)."</name>
|
||||
<country>$user->country</country>
|
||||
|
@ -46,6 +49,7 @@ function show_user_xml($user, $show_hosts) {
|
|||
";
|
||||
$result = mysql_query("select * from host where userid=$user->id");
|
||||
if ($show_hosts) {
|
||||
echo " <venue>$user->venue</venue>\n";
|
||||
while ($host = mysql_fetch_object($result)) {
|
||||
show_host_xml($host);
|
||||
}
|
||||
|
|
|
@ -0,0 +1,48 @@
|
|||
<?php
|
||||
|
||||
require_once("../inc/db.inc");
|
||||
require_once("../inc/xml.inc");
|
||||
|
||||
function reply($x) {
|
||||
echo "<am_set_host_info_reply>
|
||||
$x
|
||||
</am_set_host_info_reply>
|
||||
";
|
||||
exit();
|
||||
}
|
||||
|
||||
function error($x) {
|
||||
reply("<error>$x</error>");
|
||||
}
|
||||
|
||||
function success($x) {
|
||||
reply("<success/>\n$x");
|
||||
}
|
||||
|
||||
db_init();
|
||||
|
||||
xml_header();
|
||||
|
||||
$auth = process_user_text($_GET["account_key"]);
|
||||
$user = lookup_user_auth($auth);
|
||||
if (!$user) {
|
||||
error("no such user");
|
||||
}
|
||||
|
||||
$hostid = get_int("hostid");
|
||||
|
||||
$host = lookup_host($hostid);
|
||||
if (!$host || $host->userid != $user->id) {
|
||||
error("no such host");
|
||||
}
|
||||
|
||||
$venue = process_user_text($_GET["venue"]);
|
||||
|
||||
$result = mysql_query("update host set venue='$venue' where id=$hostid");
|
||||
if ($result) {
|
||||
success("");
|
||||
} else {
|
||||
error("database error");
|
||||
}
|
||||
|
||||
?>
|
Loading…
Reference in New Issue