Index: openacs-4/packages/news-aggregator/news-aggregator.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/news-aggregator.info,v diff -u -r1.13.2.1 -r1.13.2.2 --- openacs-4/packages/news-aggregator/news-aggregator.info 28 Dec 2005 17:55:42 -0000 1.13.2.1 +++ openacs-4/packages/news-aggregator/news-aggregator.info 1 Jan 2006 19:44:37 -0000 1.13.2.2 @@ -8,14 +8,14 @@ f na - - Guan Yang + Michael Steigman + Guan Yang Read news sources from your website. - 2005-12-28 + 2005-12-31 The news aggregator periodically reads a set of news sources, in one of several XML-based formats, finds the new bits, and displays them in reverse-chronological order on a single page. - + @@ -24,7 +24,6 @@ - Index: openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl,v diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2 --- openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl 28 Dec 2005 17:55:43 -0000 1.1.1.1.2.1 +++ openacs-4/packages/news-aggregator/tcl/aggregator-procs.tcl 1 Jan 2006 19:44:38 -0000 1.1.1.1.2.2 @@ -4,6 +4,7 @@ @author Simon Carstensen (simon@bcuni.net) @author Guan Yang (guan@unicast.org) @creation-date 2003-06-28 + @cvs-id $Id$ } namespace eval news_aggregator {} @@ -338,6 +339,24 @@ @author Guan Yang @creation-date 2003-06-29 } { + # find app group and assign correct privileges + # (public = viewable by subsite members) + set app_group [application_group::group_id_from_package_id \ + -package_id [ad_conn subsite_id]] + if { !$public_p && [permission::inherit_p -object_id $aggregator_id] } { + permission::toggle_inherit -object_id $aggregator_id + foreach priv {read write create} { + permission::revoke -party_id $app_group \ + -object_id $aggregator_id -privilege $priv + } + } elseif { ![permission::inherit_p -object_id $aggregator_id] } { + permission::toggle_inherit -object_id $aggregator_id + foreach priv {read write create} { + permission::grant -party_id $app_group \ + -object_id $aggregator_id -privilege $priv + } + } + db_dml edit_aggregator {} if { [db_resultrows] } { @@ -351,30 +370,35 @@ ad_proc -public news_aggregator::aggregator::new { {-aggregator_name:required} {-description ""} - {-package_id ""} + {-package_id [ad_conn package_id]} {-public_p t} - {-creation_user ""} - {-creation_ip ""} + {-creation_user [ad_conn user_id]} + {-creation_ip [ad_conn peeraddr]} } { Create a new news aggregator. @author Guan Yang (guan@unicast.org) @creation-date 2003-06-29 } { - if { ![exists_and_not_null creation_user] } { - set creation_user [ad_conn user_id] - } + set aggregator_id [db_exec_plsql new_aggregator {}] - if { ![exists_and_not_null creation_ip] } { - set creation_ip [ad_conn peeraddr] + # find app group and assign correct privileges + # (public = viewable by subsite members) + set app_group [application_group::group_id_from_package_id \ + -package_id [ad_conn subsite_id] + if { !$public_p } { + permission::toggle_inherit -object_id $aggregator_id + foreach priv {read write create} { + permission::revoke -party_id $app_group \ + -object_id $aggregator_id -privilege $priv + } + } else { + foreach priv {read write create} { + permission::grant -party_id $app_group \ + -object_id $aggregator_id -privilege $priv + } } - - if { ![exists_and_not_null package_id] } { - set package_id [ad_conn package_id] - } - - return [db_exec_plsql new_aggregator {}] } ad_proc -public news_aggregator::aggregator::delete { Index: openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl,v diff -u -r1.9.2.1 -r1.9.2.2 --- openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl 29 Dec 2005 22:54:19 -0000 1.9.2.1 +++ openacs-4/packages/news-aggregator/tcl/news-aggregator-procs.tcl 1 Jan 2006 19:44:38 -0000 1.9.2.2 @@ -1,9 +1,10 @@ ad_library { - Procs used by the News Aggregator application. - - @author Simon Carstensen (simon@bcuni.net) - @author Guan Yang (guan@unicast.org) - @creation-date 2003-06-28 + Procs used by the News Aggregator application. + + @author Simon Carstensen (simon@bcuni.net) + @author Guan Yang (guan@unicast.org) + @creation-date 2003-06-28 + @cvs-id $Id$ } @@ -34,11 +35,19 @@ } elseif {$diff >= 60 && $diff < 1440} { set to_return "[expr $diff / 60] hours and " } else { - if {$diff >= 1440 && $diff <2880} { - set to_return "1 day, [expr $diff / 60] hours and " + set days [expr $diff / 1440] + if {$days eq "1"} { + set to_return "1 day, " } else { - set to_return "[expr $diff / 1440] days, [expr [expr $diff % 1440] / 60] hours and " + set to_return "$days days, " } + if { [expr $diff % 1440] < 60 } { + append to_return "and " + } elseif { [expr $diff % 1440] < 120 } { + append to_return "1 hour and " + } else { + append to_return "[expr [expr $diff % 1440] / 60] hours and " + } } set mins [expr $diff % 60] Index: openacs-4/packages/news-aggregator/tcl/source-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/source-procs.tcl,v diff -u -r1.6.2.2 -r1.6.2.3 --- openacs-4/packages/news-aggregator/tcl/source-procs.tcl 11 Dec 2005 21:57:14 -0000 1.6.2.2 +++ openacs-4/packages/news-aggregator/tcl/source-procs.tcl 1 Jan 2006 19:44:38 -0000 1.6.2.3 @@ -4,6 +4,7 @@ @author Simon Carstensen (simon@bcuni.net) @author Guan Yang (guan@unicast.org) @creation-date 2003-06-28 + @cvs-id $Id$ } namespace eval news_aggregator {} Index: openacs-4/packages/news-aggregator/tcl/weblog-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/weblog-procs.tcl,v diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- openacs-4/packages/news-aggregator/tcl/weblog-procs.tcl 20 Mar 2004 11:04:39 -0000 1.1.1.1 +++ openacs-4/packages/news-aggregator/tcl/weblog-procs.tcl 1 Jan 2006 19:44:38 -0000 1.1.1.1.2.1 @@ -133,6 +133,23 @@ return $post_url } +ad_proc -private news_aggregator::weblog::impl::larsblogger_get_post_url { + -base_url:required + -title:required + -link:required + -text:required +} { + Returns the post URL for a Weblog (Lars Blogger) weblog. + + @author Michael Steigman (michael@steigman.net) + @creation-date 2005-12-31 + @cvs-id $Id$ +} { + set title_url $link + set content $text + return [export_vars -base $base_url {title title_url content}] +} + ad_proc -public news_aggregator::weblog::get_post_url { -blog_type:required -base_url:required @@ -161,11 +178,24 @@ @author Simon Carstensen } { - return [db_list_of_lists select_weblog_options {}] + set weblogs [list] + set subsite_node [site_node::get_node_id_from_object_id -object_id [ad_conn subsite_id]] + db_foreach select_larsblogger_options {} { + if { [permission::permission_p \ + -object_id $package_id \ + -privilege read] eq "1" } { + lappend weblogs [list "[apm_instance_name_from_id $package_id]" $package_id] + } + } + set ext_weblogs [db_list_of_lists select_weblog_options {}] + if { [llength $ext_weblogs] > 0 } { + lappend weblogs $ext_weblogs + } + return $weblogs } ad_proc -public news_aggregator::weblog::blog_type_options {} { - Returns options (value label pairs) for building the blog type HTML select box. + Returns type options (value label pairs) for building the blog type HTML select box. @author Simon Carstensen } { Index: openacs-4/packages/news-aggregator/tcl/weblog-procs.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/tcl/weblog-procs.xql,v diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- openacs-4/packages/news-aggregator/tcl/weblog-procs.xql 20 Mar 2004 11:04:39 -0000 1.1.1.1 +++ openacs-4/packages/news-aggregator/tcl/weblog-procs.xql 1 Jan 2006 19:44:38 -0000 1.1.1.1.2.1 @@ -2,6 +2,16 @@ + + + select package_id + from site_nodes s, apm_packages p + where s.object_id = p.package_id + and s.parent_id = :subsite_node + and p.package_key = 'lars-blogger' + + + select weblog_name, Index: openacs-4/packages/news-aggregator/www/aggregator-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/aggregator-add.tcl,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/news-aggregator/www/aggregator-add.tcl 28 Dec 2005 17:55:43 -0000 1.1.2.1 +++ openacs-4/packages/news-aggregator/www/aggregator-add.tcl 1 Jan 2006 19:44:38 -0000 1.1.2.2 @@ -2,6 +2,7 @@ Create a new aggregator. @author Simon Carstensen + @cvs-id $Id$ } { aggregator_id:integer,notnull,optional {return_url ""} Index: openacs-4/packages/news-aggregator/www/aggregator.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/aggregator.tcl,v diff -u -r1.4.2.1 -r1.4.2.2 --- openacs-4/packages/news-aggregator/www/aggregator.tcl 28 Dec 2005 17:55:43 -0000 1.4.2.1 +++ openacs-4/packages/news-aggregator/www/aggregator.tcl 1 Jan 2006 19:44:38 -0000 1.4.2.2 @@ -2,6 +2,7 @@ Include to create a new aggregator. @author Simon Carstensen + @cvs-id $Id$ } { aggregator_id:integer,notnull,optional {return_url ""} @@ -38,7 +39,7 @@ {public_p:text(radio) {label "Public?"} {options {{"Yes" t} {"No" f}}} - {help_text "A public aggregator is intended to be used by a group of people and will not have a Purge button. Instead, the most recent 100 items will be displayed."} + {help_text "A public aggregator is intended to be used by a group of people and will not have a Purge button. Instead, the most recent 100 items will be displayed. Private aggregators will, by default, only be viewable by the creator."} } {return_url:text(hidden) {value $return_url} Index: openacs-4/packages/news-aggregator/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/index.adp,v diff -u -r1.12.2.3 -r1.12.2.4 --- openacs-4/packages/news-aggregator/www/index.adp 29 Dec 2005 22:54:19 -0000 1.12.2.3 +++ openacs-4/packages/news-aggregator/www/index.adp 1 Jan 2006 19:44:38 -0000 1.12.2.4 @@ -17,10 +17,12 @@ This page lists the most recent items from the feeds you've subscribed to.

- - You can hit the Purge button to clean out the page. Clicking the Save icon Save will prevent an item from being purged. - Click on the #news-aggregator.Post# icon Post this item to your Weblog to add the item to your weblog. + + You can hit the Purge button to clean out the page. Clicking the Save button will prevent an item from being purged. + + Click the Blog button to post the item to a weblog (you will have a choice of weblogs to post to). + @@ -56,29 +58,33 @@ @items.title@#news-aggregator.updated_x_time_ago# -

-

+
-
Posted: @items.pub_date@
- @items.content;noquote@ - +
Posted: @items.pub_date@ + # - - - - Save - - - Unsave - - Post this item to your Weblog - +
+ @items.content;noquote@ +
+ + + Save + + + Unsave + + + + Blog + +
+
Index: openacs-4/packages/news-aggregator/www/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/index.tcl,v diff -u -r1.9.2.4 -r1.9.2.5 --- openacs-4/packages/news-aggregator/www/index.tcl 29 Dec 2005 22:54:19 -0000 1.9.2.4 +++ openacs-4/packages/news-aggregator/www/index.tcl 1 Jan 2006 19:44:38 -0000 1.9.2.5 @@ -3,6 +3,7 @@ @author Simon Carstensen simon@bcuni.net @creation-date 28-06-2003 + @cvs-id $Id$ } { { aggregator_id:integer,optional "0" } { purge_p:boolean,optional } @@ -73,6 +74,8 @@ set write_p [permission::permission_p \ -object_id $aggregator_id \ -privilege write] +set blog_p [expr [llength [news_aggregator::weblog::options \ + -user_id $user_id]] > 0] db_1row aggregator_info {} @@ -199,7 +202,7 @@ # set content "$item_title. $item_author # $item_description" # } else { - set content $item_description + set content $item_description # } } Index: openacs-4/packages/news-aggregator/www/item-blog.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/item-blog.adp,v diff -u -r1.2.2.1 -r1.2.2.2 --- openacs-4/packages/news-aggregator/www/item-blog.adp 25 Dec 2005 23:43:14 -0000 1.2.2.1 +++ openacs-4/packages/news-aggregator/www/item-blog.adp 1 Jan 2006 19:44:38 -0000 1.2.2.2 @@ -3,15 +3,19 @@ @context@

- Source: @title@; @last_scanned@. +

Source: @title@

@content;noquote@

- - -

- Note: You will not usually come back to the aggregator. -

+ + +

+ Note: You will not usually come back to the aggregator. +

+
+ + No weblog options available! + \ No newline at end of file Index: openacs-4/packages/news-aggregator/www/item-blog.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/item-blog.tcl,v diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- openacs-4/packages/news-aggregator/www/item-blog.tcl 20 Mar 2004 11:04:39 -0000 1.1.1.1 +++ openacs-4/packages/news-aggregator/www/item-blog.tcl 1 Jan 2006 19:44:38 -0000 1.1.1.1.2.1 @@ -3,6 +3,7 @@ @author Simon Carstensen @creation-date 2003-07-08 + @cvs-id $Id$ } { item_id:integer } @@ -27,6 +28,7 @@ set user_id [ad_conn user_id] set weblog_options [news_aggregator::weblog::options \ -user_id $user_id] +set weblog_p [expr [llength $weblog_options] > 0] ad_form -name blog_item -form { {item_id:integer(hidden) @@ -60,7 +62,7 @@ -base_url $base_url \ -title $item_title \ -text $text \ - -link $link] + -link $item_link] ad_returnredirect $post_url ad_script_abort Index: openacs-4/packages/news-aggregator/www/item-blog.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/item-blog.xql,v diff -u -r1.1.1.1 -r1.1.1.1.2.1 --- openacs-4/packages/news-aggregator/www/item-blog.xql 20 Mar 2004 11:04:39 -0000 1.1.1.1 +++ openacs-4/packages/news-aggregator/www/item-blog.xql 1 Jan 2006 19:44:38 -0000 1.1.1.1.2.1 @@ -9,8 +9,7 @@ i.content_encoded, i.link as item_link, s.title, - s.link, - to_char(s.last_scanned, 'YYYY-MM-DD; HH24:MI:SS') as last_scanned + s.link from na_items i join na_sources s on (i.source_id = s.source_id) where item_id = :item_id @@ -19,13 +18,16 @@ - select - blog_type, - base_url - from - na_weblogs - where - weblog_id = :weblog_id + select blog_type, + base_url + from na_weblogs + where weblog_id = :weblog_id + union + select 'larsblogger'as blog_type, + site_node__url(s.node_id) || 'entry-edit' as base_url + from site_nodes s, apm_packages p + where s.object_id = p.package_id + and p.package_id = :weblog_id Index: openacs-4/packages/news-aggregator/www/manage.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/Attic/manage.adp,v diff -u -r1.1.2.1 -r1.1.2.2 --- openacs-4/packages/news-aggregator/www/manage.adp 28 Dec 2005 17:55:43 -0000 1.1.2.1 +++ openacs-4/packages/news-aggregator/www/manage.adp 1 Jan 2006 19:44:38 -0000 1.1.2.2 @@ -50,7 +50,7 @@

- Manage permissions for this aggregator. You may allow other users to view your personal feeds. + Manage detailed permissions for this aggregator. You can use this form to allow other users to view your personal feeds.

Index: openacs-4/packages/news-aggregator/www/settings.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/settings.adp,v diff -u -r1.1.1.1.2.1 -r1.1.1.1.2.2 --- openacs-4/packages/news-aggregator/www/settings.adp 28 Dec 2005 17:55:43 -0000 1.1.1.1.2.1 +++ openacs-4/packages/news-aggregator/www/settings.adp 1 Jan 2006 19:44:38 -0000 1.1.1.1.2.2 @@ -15,7 +15,8 @@

 

-The weblogs below will show up as options when you choose to blog about a news item. +The weblogs below will show up as options (in addition to any blogger instances you can post to on your subsite) +when you choose to blog about a news item.