*** empty log message ***

svn path=/trunk/boinc/; revision=5135
This commit is contained in:
David Anderson 2005-01-18 19:56:18 +00:00
parent b7582f1095
commit cc9c0a6341
14 changed files with 213 additions and 205 deletions

View File

@ -22868,4 +22868,29 @@ Janus 18 Jan 2005
email.inc
+forum_moderators.inc (new)
ops/
update_db.php
update_db.php
David 18 Jan 2005
- user web: general code cleanup,
and increased use of stylesheets for formatting
rather than hard-wired HTML
- use tables for profiles
- change way profiles are rated
html/
inc/
forum.inc
prefs.inc
profile.inc
util.inc
user/
forum_edit.php
forum_help_desk.php
forum_sample_index.php
forum_thread.php
profile_rate.php (new)
profile_search_action.php
view_profile.php
white.css
sched/
db_dump.C

View File

@ -105,33 +105,33 @@ function getThreads($forumID, $min=-1, $nRec=-1, $sort_style='modified-new', $sh
$sql .= ' AND hidden = 0';
}
switch($sort_style) {
case 'modified-new':
$sql .= ' ORDER BY timestamp DESC';
break;
case 'modified-old':
$sql .= ' ORDER BY timestamp ASC';
break;
case 'views-most':
$sql .= ' ORDER BY views DESC';
break;
case 'replies-most':
$sql .= ' ORDER BY replies DESC';
break;
case 'create_time':
$sql .= ' ORDER by create_time desc';
break;
case 'timestamp':
$sql .= ' ORDER by timestamp desc';
break;
case 'sufferers':
$sql .= ' ORDER by sufferers desc';
break;
case 'activity':
$sql .= ' ORDER by activity desc';
break;
case 'score':
$sql .= ' ORDER by score desc';
break;
case 'modified-new':
$sql .= ' ORDER BY timestamp DESC';
break;
case 'modified-old':
$sql .= ' ORDER BY timestamp ASC';
break;
case 'views-most':
$sql .= ' ORDER BY views DESC';
break;
case 'replies-most':
$sql .= ' ORDER BY replies DESC';
break;
case 'create_time':
$sql .= ' ORDER by create_time desc';
break;
case 'timestamp':
$sql .= ' ORDER by timestamp desc';
break;
case 'sufferers':
$sql .= ' ORDER by sufferers desc';
break;
case 'activity':
$sql .= ' ORDER by activity desc';
break;
case 'score':
$sql .= ' ORDER by score desc';
break;
}
if ($min > -1) {
$sql .= ' LIMIT '.$min;
@ -351,7 +351,7 @@ function cleanup_forum_log(){
}
}
/* Forum modifying functions. */
// Forum modifying functions.
function createThread($forumID, $ownerID, $title, $content, $add_signature=false) {
@ -428,7 +428,7 @@ function updateThread($threadID, $title) {
return true;
}
/* display functions */
// display functions
function show_posts($thread, $sort_style, $filter, $show_controls=true, $do_coloring=true, $is_helpdesk=false) {
global $logged_in_user;
@ -575,15 +575,15 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS
//no special controls in forum
} else if ($controls == HELPDESK_CONTROLS && $separate) {
echo "
<td align=\"right\" style=\"border:0px\">
<td align=right style=\"border:0px\">
<input type=submit name=submit value=\"", SUFFERER, "\">
</td>
";
} else if ($controls == HELPDESK_CONTROLS && !$separate) {
echo "
<td align=\"right\" style=\"border:0px\">
<input type=\"submit\" name=\"submit\" value=\"", SOLUTION, "\">
<input type=\"submit\" name=\"submit\" value=\"", OFF_TOPIC, "\">
<td align=right style=\"border:0px\">
<input type=submit name=submit value=\"", SOLUTION, "\">
<input type=submit name=submit value=\"", OFF_TOPIC, "\">
</td>
";
}
@ -620,9 +620,9 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS
}
if ($controls == FORUM_CONTROLS) {
echo "<td align=\"right\" style=\"border:0px\">[<a href=\"forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "#input\">Reply to this post</a>]</td>";
echo "<td align=right style=\"border:0px\">[<a href=\"forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "#input\">Reply to this post</a>]</td>";
} else if ($controls == HELPDESK_CONTROLS && !$separate) {
echo "<td align=\"right\" style=\"border:0px\">[<a href=\"forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "&helpdesk=1#input\">Reply to this answer</a>]</td>";
echo "<td align=right style=\"border:0px\">[<a href=\"forum_reply.php?thread=" . $thread->id . "&amp;post=" . $post->id . "&helpdesk=1#input\">Reply to this answer</a>]</td>";
}
echo "</tr></table>";
}
@ -639,7 +639,7 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS
}
}
/* utility functions */
// utility functions
function externalize_links($text){
$i=0;$linkpos=true;
@ -656,38 +656,31 @@ function externalize_links($text){
function image_as_link($text){
/* This function depends on sanitized HTML - always use KSES or equivalent before using this */
$i=0;
while (true){ //Find an image
while (true){ //Find an image
$imgpos=strpos($text,"<img ",$i);
if ($imgpos===false) break;
$out.= substr($text,$i,$imgpos-$i)."<a href="; //Replace with link start
$temp1=strpos($text,"src=",$imgpos)+5; //Find the image source
$temp2=strpos($text,">",$imgpos)+1; //Or the end of the tag
if ($temp1<$temp2){ //If source was found within tag
$temp3=strpos($text,"\"",$temp1); //Find the end of source
$out.=substr($text,$temp1,$temp3-$temp1); //output the source
$out.= substr($text,$i,$imgpos-$i)."<a href="; //Replace with link start
$temp1=strpos($text,"src=",$imgpos)+5; //Find the image source
$temp2=strpos($text,">",$imgpos)+1; //Or the end of the tag
if ($temp1<$temp2){ //If source was found within tag
$temp3=strpos($text,"\"",$temp1); //Find the end of source
$out.=substr($text,$temp1,$temp3-$temp1); //output the source
}
$out.=">[Image link]</a>";
$i=$temp2; //Now move to end of tag to continue
$i=$temp2; //Now move to end of tag to continue
}
$out.=substr($text,$i); //Output the rest
$out.=substr($text,$i); //Output the rest
return $out;
}
function start_forum_table($headings, $span=NULL) {
echo "
<p style=\"text-align:center\">
<table border=0 cellpadding=5 cellspacing=0 width=\"100%\">
<tr>
";
function start_forum_table($headings) {
start_table();
echo "<tr>";
for ($i = 0; $i < count($headings); $i++) {
$cell = "<th";
if ($span) {
$cell = $cell . " colspan=$span";
}
$cell = $cell . ">";
echo $cell, $headings[$i], "</th>\n";
for ($i=0; $i<count($headings); $i++) {
$title = $headings[$i];
echo "<th class=heading>$title</th>";
}
echo "</tr>\n";
}
@ -812,11 +805,11 @@ function show_post2($post, $n) {
function show_forum_summary($forum) {
$x = time_diff_str($forum->timestamp, time());
echo "
<tr class=row1 style=\"text-align:right\">
<td class=indent style=\"text-align:left\">
<span style=\"font-weight:bold\">
<a href=\"forum_forum.php?id=$forum->id\">", $forum->title,
"</a></span>
<tr class=row1>
<td>
<b>
<a href=forum_forum.php?id=$forum->id>", $forum->title,
"</a></b>
<br><font size=-2>", $forum->description, "
</td>
<td>", $forum->threads, "</td>

View File

@ -69,7 +69,7 @@ define("HANGUP_IF_DIALED_DESC",
);
define("WORK_BUF_DESC",
"Connect to network about every
<br><font size=-2>maximum 10 days</font>
<br><font size=-2>(determines size of work cache; maximum 10 days)</font>
"
);
define("MAX_CPUS_DESC", "On multiprocessors, use at most");

View File

@ -404,126 +404,74 @@ function get_profile_summary($profile) {
// Displays a user's profile (if they have one);
function show_profile($userid, $verify_mode=false) {
function show_profile($userid) {
$user = get_user_from_id($userid);
if (!$user) {
profile_error_page("No user exists for that ID, or there was a database error.<p>");
exit();
}
if (!$verify_mode) {
$logged_in_user = get_logged_in_user(false); // (false) since anyone can look at profiles.;
if (!$logged_in_user || ($user->id != $logged_in_user->id)) {
$caching = true;
$cache_args = "userid=$userid";
start_cache(USER_PROFILE_TTL,$cache_args);
}
}
$profile = get_profile($userid);
if (!$profile) {
echo "No user profile exists for that user ID.";
exit();
}
if (!$verify_mode) {
$logged_in_user = get_logged_in_user(false); // (false) since anyone can look at profiles.;
$logged_in_user = get_logged_in_user(false);
if (!$logged_in_user || ($user->id != $logged_in_user->id)) {
$caching = true;
$cache_args = "userid=$userid";
start_cache(USER_PROFILE_TTL,$cache_args);
}
$can_edit = $logged_in_user && $user->id == $logged_in_user->id;
if (!$verify_mode) {
page_head("Profile: ".$user->name);
}
page_head("Profile: ".$user->name);
start_table();
if ($can_edit) {
echo "<a href=create_profile.php>[Edit Your Profile]</a>";
row1("<a href=create_profile.php>Edit your profile</a>");
}
show_profile_summary($user, $profile, $can_edit, $verify_mode);
echo "<br><br>";
echo "<b>".show_profile_heading1()."</b><p>";
echo $profile->response1;
echo "<br><br>";
echo "<b>".show_profile_heading2()."</b><p>";
echo $profile->response2;
if (!$verify_mode) {
page_tail();
}
if ($caching) end_cache(USER_PROFILE_TTL,$cache_args);
}
function show_profile_summary($user, $profile, $can_edit, $verify_mode) {
if (!$can_edit && !$verify_mode) {
show_view_buttons($user->id);
}
// Only display an image if the user has uploaded one;
if ($profile->has_picture) {
//echo "<a href=\"" , URL_BASE, IMAGE_URL , $user->id , '.jpg' . "\"><img align=left vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_URL , $user->id , '_sm.jpg' . "\"></a>\n";
echo "<br><img vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_URL , $user->id , '.jpg' . "\">\n";
echo "
<tr><td colspan=2 align=center>
<img vspace=6 hspace=9 src=\"" , URL_BASE, IMAGE_URL , $user->id , '.jpg' . "\">
</td></tr>
";
}
echo "
<br>
<font size=-1>
<b>Country:</b> ", $user->country,
"<br><b>Language:</b> ", $profile->language, "<br>
";
echo "<b>Total Credit:</b> ", $user->total_credit, "<br>";
row2("Country", $user->country);
row2("Language", $profile->language);
row2("Total Credit", $user->total_credit);
if ($user->teamid) {
$result = mysql_query("select * from team where id = $user->teamid");
$team = mysql_fetch_object($result);
echo "<b>Team:</b> <a href=team_display.php?teamid=$team->id>$team->name</a><br>";
row2("Team", "<a href=team_display.php?teamid=$team->id>$team->name</a><br>");
}
echo "
<b>Date Registered:</b> ", date_str($user->create_time), "
</font>
<br>\n
";
}
row2("Date Registered", date_str($user->create_time));
function show_view_buttons($userid) {
echo "
<form action=view_profile.php?userid=$userid method=\"POST\">
<input type=submit name=recommend value=Recommend>
<font size=-1><a href=\"javascript:;\" onClick=\"window.open ('explanation.php?val=recommend','_blank','width=350,height=200,left=50,top=150,menubar=0,directories=0,scrollbars=0,resizable=0,status=0')\">what is recommend?</a></font>
<br>
<input type=submit name=reject value=\"Vote to reject\">
<font size=-1><a href=\"javascript:;\" onClick=\"window.open ('explanation.php?val=reject','_blank','width=350,height=200,left=50,top=150,menubar=0,directories=0,scrollbars=0,resizable=0,status=0')\">what is vote to reject?</a></font>
</form>
";
}
function process_view_results($vote, $userid) {
if ($vote != "recommend" && $vote != "reject") {
echo "Invalid vote type.<br>";
exit();
row1(show_profile_heading1());
row1($profile->response1, 2, "foobar");
row1(show_profile_heading2());
row1($profile->response2, 2, "foobar");
if (true) {
row1("Your feedback on this profile");
row2(
"Recommend this profile for User of the Day:",
"I <a href=profile_rate.php?userid=$userid&vote=recommend>like</a> this profile"
);
row2(
"Alert administrators to an offensive profile:",
"I <a href=profile_rate.php?userid=$userid&vote=reject>don't like</a> this profile"
);
}
$result = mysql_query("SELECT * FROM profile WHERE userid = $userid");
$profile = mysql_fetch_array($result);
$newValue = $profile[$vote] + 1;
$newresult = mysql_query("UPDATE profile SET $vote = $newValue WHERE userid = $userid");
page_head("Vote Recorded");
start_table_noborder();
row1("Thank you");
if ($vote == "recommend") {
rowify("Your recommendation has been recorded.");
} else {
rowify("Your vote to reject has been recorded.");
}
end_table();
echo "<br><a href=\"view_profile.php?userid=", $userid ,"\">Return to profile.</a>";
page_tail();
if ($caching) end_cache(USER_PROFILE_TTL,$cache_args);
}
// echo "<!--\$Id$ -->\n";

View File

@ -122,14 +122,7 @@ function page_head($title, $java_onload="") {
}
function page_tail_aux($show_return, $show_date) {
echo "<br><hr noshade size=1><center>";
if ($show_return) {
echo "<a href=".URL_BASE.">Return to ".PROJECT." main page</a><br>\n";
}
echo "<br><br>Copyright &copy; ".date("Y ").COPYRIGHT_HOLDER."</center>\n";
if ($show_date) {
echo "<font size=-2 color=bbbbbb>Generated ",time_str(time()),"</font>\n";
}
project_footer($show_return, $show_date);
echo "</body>\n</html>";
}
function page_tail_main($show_date=false) {
@ -251,16 +244,16 @@ function end_table() {
}
function row1($x, $ncols=2, $class="heading") {
echo "<tr><td class=$class colspan=$ncols><b>$x</b></td></tr>\n";
echo "<tr><td class=$class colspan=$ncols>$x</td></tr>\n";
}
function row2($x, $y) {
if ($x=="") $x="<br>";
if ($y=="") $y="<br>";
echo "<tr><td class=fieldname bgcolor=eeeeee align=right valign=top>$x</td><td valign=top><b>$y</b></td></tr>\n";
echo "<tr><td width=40% class=fieldname>$x</td><td class=fieldvalue>$y</td></tr>\n";
}
function row2_init($x, $y) {
echo "<tr><td class=fieldname bgcolor=eeeeee width=40% align=right valign=top>$x</td><td valign=top><b>$y\n";
echo "<tr><td class=fieldname width=40%>$x</td><td valign=top><b>$y\n";
}
function row2_plain($x, $y) {

View File

@ -68,7 +68,6 @@ echo "<form action=forum_edit.php?id=$post->id method=POST>\n";
start_table();
row1("Edit your post");
//start_forum_table(array("Edit your post"), array(NULL), 2);
if ($post->parent_post==0 and $thread->owner==$logged_in_user->id) {
//If this is the first post enable the user to change title
row2(

View File

@ -6,13 +6,12 @@ require_once('../inc/time.inc');
db_init();
page_head(PROJECT.': Questions and problems');
show_forum_title(NULL, NULL, true);
page_head("Questions and problems");
echo "
<p>
Do a <a href=forum_text_search_form.php>keyword search</a> of messages.
<p>
";
start_forum_table(array("Topic", "# Questions", "Last post"));
@ -28,9 +27,9 @@ while ($category = mysql_fetch_object($categories)) {
$forums = getForums($category->id);
while ($forum = mysql_fetch_object($forums)) {
echo "
<tr class=\"row1\" style=\"font-size:8pt; text-align:right\">
<td class=indent style=\"text-align:left\">
<span style=\"font-size:10pt; font-weight:bold\"><a href=forum_forum.php?id=$forum->id>$forum->title</a></span>
<tr class=row1>
<td>
<b><a href=forum_forum.php?id=$forum->id>$forum->title</a></b>
<br>", $forum->description, "
</td>
<td>", $forum->threads, "</td>

View File

@ -8,7 +8,7 @@ db_init();
page_head('Message boards');
show_forum_title(NULL, NULL, false);
//show_forum_title(NULL, NULL, false);
echo "<p>
If you have a question or problem, please use the
@ -17,6 +17,7 @@ echo "<p>
<p>
Do a <a href=forum_text_search_form.php>keyword search</a>
of messages.
<p>
";
function show_category($category) {

View File

@ -38,7 +38,7 @@ if ($category->is_helpdesk) {
} else {
setSortStyle($logged_in_user,"answer", $sort_style);
}
page_head(PROJECT.': Questions and problems : '.$title);
page_head($title);
} else {
if (!$sort_style) {
$sort_style = getSortStyle($logged_in_user,"thread");
@ -46,9 +46,9 @@ if ($category->is_helpdesk) {
setSortStyle($logged_in_user,"thread", $sort_style);
}
if ($logged_in_user->jump_to_unread){
page_head(PROJECT.': Message boards : '.$title, 'jumpToUnread();');
page_head($title, 'jumpToUnread();');
} else {
page_head(PROJECT.': Message boards : '.$title);
page_head($title);
}
}

View File

@ -0,0 +1,33 @@
<?php
require_once("../inc/profile.inc");
db_init();
$userid = $_GET['userid'];
$vote = $_GET['vote'];
if ($vote != "recommend" && $vote != "reject") {
echo "Invalid vote type.<br>";
exit();
}
mysql_query("UPDATE profile SET $vote=$vote+1 WHERE userid = $userid");
page_head("Vote Recorded");
start_table_noborder();
row1("Thank you");
if ($vote == "recommend") {
rowify("Your recommendation has been recorded.");
} else {
rowify("Your vote to reject has been recorded.");
}
end_table();
echo "<br><a href=\"view_profile.php?userid=", $userid ,"\">Return to profile.</a>";
page_tail();
?>

View File

@ -3,7 +3,7 @@
require_once("../inc/db.inc");
require_once("../inc/util.inc");
function show_profile($profile, $n) {
function show_profile_link($profile, $n) {
$user = lookup_user_id($profile->userid);
echo "<br>". user_links($user)."\n";
}
@ -23,7 +23,7 @@ $result = mysql_query($q);
echo "<table>";
$n = 0;
while ($profile = mysql_fetch_object($result)) {
show_profile($profile, $n+$offset+1);
show_profile_link($profile, $n+$offset+1);
$n += 1;
}
echo "</table>";

View File

@ -6,7 +6,7 @@ db_init();
$userid = $_GET['userid'];
// Check for recommendation or rejection votes.;
// Check for recommendation or rejection votes
if ($_POST['recommend']) {
process_view_results("recommend", $userid);
@ -16,5 +16,5 @@ if ($_POST['recommend']) {
exit();
}
show_profile($userid, array_key_exists('verify', $_GET));
show_profile($userid);
?>

View File

@ -12,7 +12,7 @@ a:active {
body , table , input , select {
font-family: Verdana, Arial, Sans Serif;
font-size: small;
font-size: 12px;
}
body {
@ -20,16 +20,8 @@ body {
color: black;
}
#table {
# border: 0px;
#}
#table.bordered {
# border: 1px solid black;
#}
th {
background-color: #ffffcc;
th{
background-color: #c8c8c8;
font-weight: bold;
}
@ -38,42 +30,65 @@ td {
}
td.bordered {
border: 1px solid grey;
border: 1px solid grey;
}
td.indent {
border-left: 4px solid white;
border-left: 4px solid white;
}
td.heading {
background-color: rgb(217,217,217);
font-weight: bold;
background-color: #c8c8c8;
font-weight: bold;
}
td.heading2 {
background-color:#c0c0ff;
font-weight: bold;
background-color:#c0c0ff;
font-weight: bold;
}
td.fieldname {
background-color: rgb(237,237,237);
background-color: #eeeeee;
text-align: right;
vertical-align: top;
}
td.fieldvalue {
vertical-align: top;
font-weight: bold;
}
td.category {
border: 1px solid black;
background-color: #dddddd;
}
td.navbar {
border: 0px;
text-align: center;
}
a.navbar:link {
color: #ff9711;
text-decoration: none;
}
a.navbar:visited {
color: #ff9711;
text-decoration: none;
}
a.navbar:hover {
color: #ffc060;
text-decoration: underline;
}
tr.row0 {
background-color: rgb(217,217,217);
background-color: rgb(217,217,217);
}
tr.row1 {
background-color: rgb(237,237,237);
background-color: rgb(237,237,237);
}
tr.subtitle {
background-color: white;
color: black;
background-color: #eeeeee;
font-weight: bold;
}

View File

@ -467,9 +467,11 @@ void write_team(TEAM& team, FILE* f, bool detail) {
//
retval = user.lookup_id(team.userid);
if (!retval) {
string fname;
xml_escape(user.name, fname);
fprintf(f,
" <founder_name>%s</founder_name>\n",
user.name
fname.c_str()
);
}