From cc9c0a63412efc3dac439de560eee63c8f37b09f Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 18 Jan 2005 19:56:18 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=5135 --- checkin_notes | 27 +++++- html/inc/forum.inc | 119 ++++++++++++-------------- html/inc/prefs.inc | 2 +- html/inc/profile.inc | 128 +++++++++------------------- html/inc/util.inc | 15 +--- html/user/forum_edit.php | 1 - html/user/forum_help_desk.php | 11 ++- html/user/forum_sample_index.php | 3 +- html/user/forum_thread.php | 6 +- html/user/profile_rate.php | 33 +++++++ html/user/profile_search_action.php | 4 +- html/user/view_profile.php | 4 +- html/user/white.css | 61 ++++++++----- sched/db_dump.C | 4 +- 14 files changed, 213 insertions(+), 205 deletions(-) create mode 100644 html/user/profile_rate.php diff --git a/checkin_notes b/checkin_notes index 41900a4eca..8b701e4b93 100755 --- a/checkin_notes +++ b/checkin_notes @@ -22868,4 +22868,29 @@ Janus 18 Jan 2005 email.inc +forum_moderators.inc (new) ops/ - update_db.php \ No newline at end of file + 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 diff --git a/html/inc/forum.inc b/html/inc/forum.inc index 4f2c56dee0..1b28645958 100644 --- a/html/inc/forum.inc +++ b/html/inc/forum.inc @@ -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 " - + "; } else if ($controls == HELPDESK_CONTROLS && !$separate) { echo " - - - + + + "; } @@ -620,9 +620,9 @@ function show_post($post, $thread, $logged_in_user, $n, $controls=FORUM_CONTROLS } if ($controls == FORUM_CONTROLS) { - echo "[id . "&post=" . $post->id . "#input\">Reply to this post]"; + echo "[id . "&post=" . $post->id . "#input\">Reply to this post]"; } else if ($controls == HELPDESK_CONTROLS && !$separate) { - echo "[id . "&post=" . $post->id . "&helpdesk=1#input\">Reply to this answer]"; + echo "[id . "&post=" . $post->id . "&helpdesk=1#input\">Reply to this answer]"; } echo ""; } @@ -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,"",$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)."",$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]"; - $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 " -

- - - "; +function start_forum_table($headings) { + start_table(); + echo ""; - for ($i = 0; $i < count($headings); $i++) { - $cell = ""; - echo $cell, $headings[$i], "\n"; + for ($i=0; $i$title"; } echo "\n"; } @@ -812,11 +805,11 @@ function show_post2($post, $n) { function show_forum_summary($forum) { $x = time_diff_str($forum->timestamp, time()); echo " - - + diff --git a/html/inc/prefs.inc b/html/inc/prefs.inc index 7c0af4279a..380a79fc1a 100644 --- a/html/inc/prefs.inc +++ b/html/inc/prefs.inc @@ -69,7 +69,7 @@ define("HANGUP_IF_DIALED_DESC", ); define("WORK_BUF_DESC", "Connect to network about every -
maximum 10 days +
(determines size of work cache; maximum 10 days) " ); define("MAX_CPUS_DESC", "On multiprocessors, use at most"); diff --git a/html/inc/profile.inc b/html/inc/profile.inc index 76a8936542..56f1e8e5a6 100644 --- a/html/inc/profile.inc +++ b/html/inc/profile.inc @@ -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.

"); 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 "[Edit Your Profile]"; + row1("Edit your profile"); } + - show_profile_summary($user, $profile, $can_edit, $verify_mode); - echo "

"; - echo "".show_profile_heading1()."

"; - echo $profile->response1; - echo "

"; - echo "".show_profile_heading2()."

"; - 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 "id , '.jpg' . "\">id , '_sm.jpg' . "\">\n"; - echo "
id , '.jpg' . "\">\n"; + echo " +

+ "; } - echo " -
- - Country: ", $user->country, - "
Language: ", $profile->language, "
- "; - echo "Total Credit: ", $user->total_credit, "
"; - + 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 "Team: id>$team->name
"; + row2("Team", "id>$team->name
"); } - echo " - Date Registered: ", date_str($user->create_time), " -
-
\n - "; -} + row2("Date Registered", date_str($user->create_time)); -function show_view_buttons($userid) { - echo " - - - what is recommend? -
- - what is vote to reject? - - "; -} - -function process_view_results($vote, $userid) { - if ($vote != "recommend" && $vote != "reject") { - echo "Invalid vote type.
"; - 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 like this profile" + ); + row2( + "Alert administrators to an offensive profile:", + "I don't like 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 "
Return to profile."; - page_tail(); + if ($caching) end_cache(USER_PROFILE_TTL,$cache_args); } // echo "\n"; diff --git a/html/inc/util.inc b/html/inc/util.inc index 08d4cb08b4..98e6c3f838 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -122,14 +122,7 @@ function page_head($title, $java_onload="") { } function page_tail_aux($show_return, $show_date) { - echo "

"; - if ($show_return) { - echo "Return to ".PROJECT." main page
\n"; - } - echo "

Copyright © ".date("Y ").COPYRIGHT_HOLDER."
\n"; - if ($show_date) { - echo "Generated ",time_str(time()),"\n"; - } + project_footer($show_return, $show_date); echo "\n"; } function page_tail_main($show_date=false) { @@ -251,16 +244,16 @@ function end_table() { } function row1($x, $ncols=2, $class="heading") { - echo "\n"; + echo "\n"; } function row2($x, $y) { if ($x=="") $x="
"; if ($y=="") $y="
"; - echo "\n"; + echo "\n"; } function row2_init($x, $y) { - echo " - + diff --git a/html/user/forum_sample_index.php b/html/user/forum_sample_index.php index 65b6d38d26..8a3601b1e7 100644 --- a/html/user/forum_sample_index.php +++ b/html/user/forum_sample_index.php @@ -8,7 +8,7 @@ db_init(); page_head('Message boards'); -show_forum_title(NULL, NULL, false); +//show_forum_title(NULL, NULL, false); echo "

If you have a question or problem, please use the @@ -17,6 +17,7 @@ echo "

Do a keyword search of messages. +

"; function show_category($category) { diff --git a/html/user/forum_thread.php b/html/user/forum_thread.php index 6d3e3ebb84..1cb4d22191 100644 --- a/html/user/forum_thread.php +++ b/html/user/forum_thread.php @@ -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); } } diff --git a/html/user/profile_rate.php b/html/user/profile_rate.php new file mode 100644 index 0000000000..310d095c25 --- /dev/null +++ b/html/user/profile_rate.php @@ -0,0 +1,33 @@ +"; + 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 "
Return to profile."; + +page_tail(); + +?> diff --git a/html/user/profile_search_action.php b/html/user/profile_search_action.php index 8869532fa6..eed5a2189a 100644 --- a/html/user/profile_search_action.php +++ b/html/user/profile_search_action.php @@ -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 "
". user_links($user)."\n"; } @@ -23,7 +23,7 @@ $result = mysql_query($q); echo "

- - id\">", $forum->title, - " +
+ + id>", $forum->title, + "
", $forum->description, "
", $forum->threads, "
+ id , '.jpg' . "\"> +
$x
$x
$x$y
$x$y
$x$y\n"; + echo "
$x$y\n"; } function row2_plain($x, $y) { diff --git a/html/user/forum_edit.php b/html/user/forum_edit.php index a0af340201..6ef7a77755 100644 --- a/html/user/forum_edit.php +++ b/html/user/forum_edit.php @@ -68,7 +68,6 @@ echo "
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( diff --git a/html/user/forum_help_desk.php b/html/user/forum_help_desk.php index 4a1eb551bd..3e372a8f81 100644 --- a/html/user/forum_help_desk.php +++ b/html/user/forum_help_desk.php @@ -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 "

Do a keyword search of messages. +

"; 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 " -

- id>$forum->title +
+ id>$forum->title
", $forum->description, "
", $forum->threads, "
"; $n = 0; while ($profile = mysql_fetch_object($result)) { - show_profile($profile, $n+$offset+1); + show_profile_link($profile, $n+$offset+1); $n += 1; } echo "
"; diff --git a/html/user/view_profile.php b/html/user/view_profile.php index d832632935..10a9b7220c 100644 --- a/html/user/view_profile.php +++ b/html/user/view_profile.php @@ -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); ?> diff --git a/html/user/white.css b/html/user/white.css index 1b60ee46a8..8c43160829 100644 --- a/html/user/white.css +++ b/html/user/white.css @@ -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; } diff --git a/sched/db_dump.C b/sched/db_dump.C index 91880f8cc4..aeced7e768 100644 --- a/sched/db_dump.C +++ b/sched/db_dump.C @@ -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, " %s\n", - user.name + fname.c_str() ); }