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.7 -r1.8
--- openacs-4/packages/news-aggregator/news-aggregator.info 20 Mar 2004 13:21:00 -0000 1.7
+++ openacs-4/packages/news-aggregator/news-aggregator.info 17 May 2004 13:27:49 -0000 1.8
@@ -8,19 +8,20 @@
f
na
-
+
Simon Carstensen
Guan Yang
Read news sources from your website.
2004-03-20
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.
-
+
+
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.1 -r1.2
--- openacs-4/packages/news-aggregator/www/aggregator.tcl 20 Mar 2004 11:04:39 -0000 1.1
+++ openacs-4/packages/news-aggregator/www/aggregator.tcl 17 May 2004 13:27:50 -0000 1.2
@@ -7,6 +7,15 @@
{return_url ""}
}
+set package_id [ad_conn package_id]
+
+if { ![parameter::get -package_id -$package_id -parameter PerUserAggregatorsP -default 0] } {
+ # May this user create her own aggregator?
+ permission::require_permission \
+ -object_id $package_id \
+ -privilege write
+}
+
set page_title "Create aggregator"
set context [list $page_title]
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.4 -r1.5
--- openacs-4/packages/news-aggregator/www/index.tcl 20 Mar 2004 14:51:53 -0000 1.4
+++ openacs-4/packages/news-aggregator/www/index.tcl 17 May 2004 13:27:50 -0000 1.5
@@ -11,17 +11,21 @@
set user_id [ad_conn user_id]
set package_id [ad_conn package_id]
set package_url [ad_conn package_url]
+set per_user_aggregators_p [parameter::get -package_id -$package_id -parameter PerUserAggregatorsP -default 0]
if { ![info exists aggregator_id] } {
# Check whether the user has an aggregator
if { !$user_id } {
+ if { !$per_user_aggregators_p } {
+ ad_returnredirect "public-aggregators"
+ }
ad_redirect_for_registration
ad_script_abort
}
set aggregator_id [news_aggregator::aggregator::user_default -user_id $user_id]
- if { !$aggregator_id } {
+ if { !$aggregator_id && $per_user_aggregators_p } {
set user_name [db_string select_user_name {}]
set aggregator_name "${user_name}'s News Aggregator"
@@ -42,6 +46,17 @@
ad_returnredirect "$aggregator_id"
}
+if { $aggregator_id == 0 } {
+ # May this user create her own aggregator?
+ set write_p [permission::permission_p \
+ -object_id $package_id \
+ -privilege write]
+ if { $write_p } {
+ ad_returnredirect "settings"
+ }
+ ad_returnredirect "public-aggregators"
+}
+
set write_p [permission::permission_p \
-object_id $aggregator_id \
-privilege write]
Index: openacs-4/packages/news-aggregator/www/public-aggregators.adp
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/public-aggregators.adp,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/news-aggregator/www/public-aggregators.adp 17 May 2004 13:27:50 -0000 1.1
@@ -0,0 +1,7 @@
+
+ @page_title@
+ @context@
+
+
+
+
Index: openacs-4/packages/news-aggregator/www/public-aggregators.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/public-aggregators.tcl,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/news-aggregator/www/public-aggregators.tcl 17 May 2004 13:27:50 -0000 1.1
@@ -0,0 +1,40 @@
+ad_page_contract {
+ Public Aggregators.
+
+ @author Ola Hansson
+ @creation-date 2004-05-16
+} {
+}
+
+set page_title "Public News Feed Aggregators"
+set context [list $page_title]
+
+set package_id [ad_conn package_id]
+set package_url [ad_conn package_url]
+
+#set return_url [ad_conn url]
+#set aggregator_link [export_vars -base "${package_url}aggregator" {return_url}]
+
+template::list::create \
+ -name "aggregators" \
+ -multirow "aggregators" \
+ -key aggregator_id \
+ -row_pretty_plural "aggregators" \
+ -elements {
+ aggregator_name {
+ label "Name"
+ display_template {
+ @aggregators.aggregator_name@
+ }
+ link_url_eval {}
+ link_html { title "" }
+ }
+ }
+
+db_multirow -extend {
+ url
+} aggregators select_aggregators {} {
+
+ set url $package_url
+}
Index: openacs-4/packages/news-aggregator/www/public-aggregators.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/news-aggregator/www/public-aggregators.xql,v
diff -u
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/news-aggregator/www/public-aggregators.xql 17 May 2004 13:27:50 -0000 1.1
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+ select aggregator_id,
+ aggregator_name
+ from na_aggregators
+ where package_id = :package_id
+ and public_p = true
+ order by aggregator_name
+
+
+
+