2006-12-01 00:38:36 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once("docutil.php");
|
|
|
|
require_once("help_funcs.php");
|
|
|
|
require_once("help_db.php");
|
|
|
|
|
|
|
|
$volid = $_GET['volid'];
|
|
|
|
|
|
|
|
$vol = vol_lookup($volid);
|
|
|
|
|
2006-12-02 04:32:22 +00:00
|
|
|
function live_contact($vol, $rating) {
|
2006-12-01 00:38:36 +00:00
|
|
|
$skypeid = $vol->skypeid;
|
|
|
|
echo "
|
|
|
|
<h2>Contact $vol->name live using Skype</h2>
|
|
|
|
<script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
|
|
|
|
";
|
|
|
|
if ($vol->voice_ok) {
|
2006-12-02 04:32:22 +00:00
|
|
|
echo "<a href=skype:$skypeid?call onclick=\"return skypeCheck();\"><img align=top border=0 src=images/help/phone_icon_green.gif> Call $vol->name on Skype</a>
|
2006-12-01 00:38:36 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
if ($vol->text_ok) {
|
2006-12-02 04:32:22 +00:00
|
|
|
echo "<p><a href=skype:$skypeid?chat onclick=\"return skypeCheck();\"><img align=top border=0 src=images/help/skype_chat_icon.png> Chat with $vol->name on Skype</a>
|
2006-12-01 00:38:36 +00:00
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "
|
|
|
|
<hr>
|
|
|
|
After the conversation is over, please give us your
|
|
|
|
feedback:
|
|
|
|
|
|
|
|
<form action=help_vol.php>
|
|
|
|
<input type=hidden name=volid value=\"$vol->id\">
|
|
|
|
|
|
|
|
";
|
|
|
|
list_start();
|
2006-12-02 04:32:22 +00:00
|
|
|
list_item(
|
|
|
|
"Rating<br><font size=-2>Would you recommend $vol->name to people seeking help with BOINC?</font>",
|
|
|
|
star_select("rating", $rating->rating)
|
|
|
|
);
|
|
|
|
list_item("Comments", textarea("comment", $rating->comment));
|
2006-12-01 00:38:36 +00:00
|
|
|
list_item("", "<input type=submit name=rate value=OK>");
|
|
|
|
list_end();
|
|
|
|
echo "
|
|
|
|
</form>
|
|
|
|
";
|
|
|
|
}
|
|
|
|
|
|
|
|
function email_contact($vol) {
|
|
|
|
echo "
|
|
|
|
<h2>Contact $vol->name by email</h2>
|
|
|
|
<form action=help_vol.php>
|
|
|
|
<input type=hidden name=volid value=\"$vol->id\">
|
|
|
|
";
|
|
|
|
list_start();
|
|
|
|
list_item(
|
|
|
|
"Your email address<br><font size=-2>Optional, but $vol->name
|
|
|
|
won't be able to reply unless you include it</font>",
|
|
|
|
input("email_addr", "")
|
|
|
|
);
|
|
|
|
list_item("Message", textarea("message", ""));
|
|
|
|
list_item("", "<input type=submit name=send_email value=OK>");
|
|
|
|
list_end();
|
|
|
|
echo "</form>\n";
|
|
|
|
}
|
|
|
|
|
|
|
|
$send_email = $_GET['send_email'];
|
|
|
|
$rate = $_GET['rate'];
|
2006-12-02 04:32:22 +00:00
|
|
|
session_set_cookie_params(86400*365);
|
|
|
|
session_start();
|
|
|
|
$uid = session_id();
|
|
|
|
|
2006-12-01 00:38:36 +00:00
|
|
|
if ($send_email) {
|
|
|
|
$volid = $_GET['volid'];
|
|
|
|
$vol = vol_lookup($volid);
|
|
|
|
if (!$vol) {
|
|
|
|
error_page("No such volunteer $volid");
|
|
|
|
}
|
|
|
|
$msg = $_GET['message'];
|
|
|
|
$body = "The following message was sent by a BOINC Help user.\n";
|
|
|
|
$email_addr = $_GET['email_addr'];
|
|
|
|
if ($email_addr) {
|
|
|
|
$body .= "(email address: $email_addr)\n";
|
|
|
|
}
|
|
|
|
$body .= "\n\n";
|
|
|
|
$body .= $msg;
|
|
|
|
mail($vol->email_addr, "BOINC Help request", $body, "From: BOINC");
|
|
|
|
page_head("Message sent");
|
|
|
|
echo "Your message has been sent to $vol->name";
|
|
|
|
page_tail();
|
|
|
|
} else if ($rate) {
|
|
|
|
$volid = $_GET['volid'];
|
|
|
|
$vol = vol_lookup($volid);
|
|
|
|
if (!$vol) {
|
|
|
|
error_page("No such volunteer $volid");
|
|
|
|
}
|
2006-12-02 04:32:22 +00:00
|
|
|
$x = $_GET['rating'];
|
|
|
|
if (!$x) {
|
|
|
|
error_page("no rating given");
|
|
|
|
}
|
|
|
|
$rating = (int) $x;
|
2006-12-01 00:38:36 +00:00
|
|
|
if ($rating < 0 || $rating > 5) {
|
|
|
|
error_page("bad rating");
|
|
|
|
}
|
2006-12-02 04:32:22 +00:00
|
|
|
$comment = stripslashes($_GET['comment']);
|
2006-12-01 00:38:36 +00:00
|
|
|
$r = null;
|
|
|
|
$r->volunteerid = $volid;
|
|
|
|
$r->rating = $rating;
|
|
|
|
$r->timestamp = time();
|
|
|
|
$r->comment = $comment;
|
2006-12-02 04:32:22 +00:00
|
|
|
$r->auth = $uid;
|
|
|
|
if ($uid) {
|
|
|
|
$retval = rating_update($r);
|
|
|
|
if (!$retval) {
|
|
|
|
$retval = rating_insert($r);
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
$retval = rating_insert($r);
|
|
|
|
}
|
2006-12-01 00:38:36 +00:00
|
|
|
if (!$retval) {
|
2006-12-02 04:32:22 +00:00
|
|
|
echo mysql_error();
|
2006-12-01 00:38:36 +00:00
|
|
|
error_page("database error");
|
|
|
|
}
|
2006-12-02 04:32:22 +00:00
|
|
|
vol_update_rating($vol, $rating);
|
2006-12-01 00:38:36 +00:00
|
|
|
page_head("Feedback recorded");
|
2006-12-02 04:32:22 +00:00
|
|
|
echo "Your feedback has been recorded. Thanks.
|
|
|
|
<p>
|
|
|
|
<a href=help.php>Return to BOINC Help</a>.
|
|
|
|
";
|
2006-12-01 00:38:36 +00:00
|
|
|
page_tail();
|
|
|
|
} else {
|
|
|
|
page_head("Contact $vol->name");
|
|
|
|
$status = skype_status($vol->skypeid);
|
|
|
|
$image = button_image($status);
|
|
|
|
echo "
|
2006-12-02 04:32:22 +00:00
|
|
|
<script type=\"text/javascript\" src=\"http://download.skype.com/share/skypebuttons/js/skypeCheck.js\"></script>
|
2006-12-01 00:38:36 +00:00
|
|
|
<img src=images/help/$image><p>
|
|
|
|
";
|
|
|
|
if (online($status)) {
|
2006-12-02 04:32:22 +00:00
|
|
|
$rating = rating_vol_auth($vol, $uid);
|
|
|
|
if (!$rating) $rating->rating = -1;
|
|
|
|
live_contact($vol, $rating);
|
2006-12-01 00:38:36 +00:00
|
|
|
}
|
|
|
|
email_contact($vol);
|
|
|
|
page_tail();
|
|
|
|
}
|
|
|
|
?>
|