From 7134a969cbf4aa5a32af3e9ea8268a387ac0ede5 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Mon, 31 May 2004 17:37:22 +0000 Subject: [PATCH] *** empty log message *** svn path=/trunk/boinc/; revision=3482 --- checkin_notes | 20 ++++++++++++ db/constraints.sql | 1 + html/inc/cache.inc | 4 +-- html/inc/news.inc | 26 +++++++++++++++ html/inc/util.inc | 8 ----- html/user/old_news.php | 13 ++++++++ html/user/rss_main.php | 65 ++++++++++++++++++++++++++++++++++++++ html/user/sample_index.php | 7 +++- 8 files changed, 133 insertions(+), 11 deletions(-) create mode 100644 html/inc/news.inc create mode 100644 html/user/old_news.php create mode 100644 html/user/rss_main.php diff --git a/checkin_notes b/checkin_notes index 084874eed8..c5e2fc98ba 100755 --- a/checkin_notes +++ b/checkin_notes @@ -12855,3 +12855,23 @@ David May 30 2004 top_hosts.php top_teams.php top_users.php + +David May 31 2004 + - Web: changed project news mechanism to use RSS + (Really Simple Syndication), described here: + http://blogs.law.harvard.edu/tech/rss + All projects now offer news feed at rss_main.php + - SETI@home public site: made front page cached + - added index on profile.uotd_time + + db/ + constraints.sql + html/ + inc/ + cache.inc + util.inc + news.inc (new) + user/ + rss_main.php + sample_index.php + old_news.php (new) diff --git a/db/constraints.sql b/db/constraints.sql index 2e27174275..efeda5bf51 100644 --- a/db/constraints.sql +++ b/db/constraints.sql @@ -95,6 +95,7 @@ alter table host alter table profile add fulltext index profile_reponse(response1, response2), + add index pro_uotd (uotd_time desc); add unique profile_userid(userid); alter table subscriptions diff --git a/html/inc/cache.inc b/html/inc/cache.inc index 94a8cb4c49..de0d4259ba 100644 --- a/html/inc/cache.inc +++ b/html/inc/cache.inc @@ -2,7 +2,7 @@ // mechanism for caching commonly-accessed pages -function start_cache($max_age, $unique_parameter_string){ +function start_cache($max_age, $unique_parameter_string=""){ $cache_dir="../cache"; $path = $cache_dir.$_SERVER["PHP_SELF"]."_".urlencode($unique_parameter_string); @@ -22,7 +22,7 @@ function start_cache($max_age, $unique_parameter_string){ // write output buffer both to client and to cache // -function end_cache($unique_parameter_string){ +function end_cache($unique_parameter_string=""){ $cache_dir="../cache"; $path = $cache_dir.$_SERVER["PHP_SELF"]."_".urlencode($unique_parameter_string); diff --git a/html/inc/news.inc b/html/inc/news.inc new file mode 100644 index 0000000000..686282df1d --- /dev/null +++ b/html/inc/news.inc @@ -0,0 +1,26 @@ +$date +
+ $text +

+ "; +} + +function show_news($items, $n) { + if ($n > count($items)) { + $n = count($items); + } + for ($i=0; $i<$n; $i++) { + news_item($items[$i][0], $items[$i][1]); + } +} + +function show_old_news($items, $n) { + for ($i=$n; $i diff --git a/html/inc/util.inc b/html/inc/util.inc index 5578a86f4d..5c01a87da0 100644 --- a/html/inc/util.inc +++ b/html/inc/util.inc @@ -449,12 +449,4 @@ function host_link($hostid) { } } -function news_item($date, $text) { - echo "$date -
- $text -

- "; -} - ?> diff --git a/html/user/old_news.php b/html/user/old_news.php new file mode 100644 index 0000000000..011b68452a --- /dev/null +++ b/html/user/old_news.php @@ -0,0 +1,13 @@ + diff --git a/html/user/rss_main.php b/html/user/rss_main.php new file mode 100644 index 0000000000..84b96090a9 --- /dev/null +++ b/html/user/rss_main.php @@ -0,0 +1,65 @@ + "9") { + $news = "9"; + } +} + +// inclue project constants and news file +// +require_once("../project/project.inc"); +require_once("../project/project_news.inc"); + +// Create channel header and open XML content +// +$description = "BOINC project ".PROJECT.": Main page News"; +$channel_image = MASTER_URL . "rss_image.jpg"; +$create_date = gmdate('D, d M Y H:i:s') . ' GMT'; +$language = "en-us"; +echo "\n" + ."\n\n " + .PROJECT."\n " + .MASTER_URL."\n " + .$description."\n " + .COPYRIGHT_HOLDER."\n " + .$create_date."\n " + .$language."\n \n " + .$channel_image."\n " + .PROJECT."\n " + .MASTER_URL."\n \n"; + +// - Create news items +// +$news = min( count($project_news), $news); +for( $item=0; $item < $news; $item++ ) { +if( count($project_news[$item]) == 2) { + echo " \n Project News " + .strip_tags($project_news[$item][0])."\n " + .MASTER_URL."\n " + .strip_tags($project_news[$item][1])."\n "; + } +} + +// Close XML content +// +echo "\n"; + +?> diff --git a/html/user/sample_index.php b/html/user/sample_index.php index b92998db5d..8e2496466e 100644 --- a/html/user/sample_index.php +++ b/html/user/sample_index.php @@ -1,7 +1,9 @@ News "; -project_news(); +show_news($project_news, 5); +if (count($project_news > 5)) { + echo "...more\n"; +} echo "