Index: openacs-4/packages/rss-support/sql/postgresql/rss-generation-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/sql/postgresql/rss-generation-create.sql,v diff -u -r1.5 -r1.6 --- openacs-4/packages/rss-support/sql/postgresql/rss-generation-create.sql 7 Nov 2001 04:42:15 -0000 1.5 +++ openacs-4/packages/rss-support/sql/postgresql/rss-generation-create.sql 19 Nov 2001 04:02:28 -0000 1.6 @@ -108,11 +108,15 @@ references acs_sc_impls(impl_id), summary_context_id varchar(100) constraint rss_gen_subscrs_ctx_nn - not null, + not null + constraint rss_gen_subscrs_ctx_fk + references acs_objects(object_id), timeout integer constraint rss_gen_subscrs_timeout_nn not null, - lastbuild timestamp + lastbuild timestamp, + constraint rss_gen_subscrs_impl_con_un + unique (impl_id,summary_context_id) ); comment on table rss_gen_subscrs is ' @@ -178,6 +182,14 @@ end;' language 'plpgsql'; +create function rss_gen_subscr__name (integer) +returns varchar as ' +declare + p_subscr_id alias for $1; +begin + return ''RSS Generation Subscription #'' || p_subscr_id; +end;' language 'plpgsql'; + create function rss_gen_subscr__delete (integer) returns integer as ' declare Index: openacs-4/packages/rss-support/sql/postgresql/rss-generation-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/sql/postgresql/rss-generation-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/rss-support/sql/postgresql/rss-generation-drop.sql 7 Nov 2001 04:42:15 -0000 1.2 +++ openacs-4/packages/rss-support/sql/postgresql/rss-generation-drop.sql 19 Nov 2001 04:02:28 -0000 1.3 @@ -1,3 +1,21 @@ +create function inline_0 () +returns integer as ' +declare + subscr record; + v_result integer; +begin + for subscr in select subscr_id from rss_gen_subscrs loop + select rss_gen_subscr__delete(subscr.subscr_id) into v_result; + end loop; + return 0; +end;' language 'plpgsql'; + +select inline_0 (); +drop function inline_0 (); + +select acs_object_type__drop_type('rss_gen_subscr','f'); + drop table rss_gen_subscrs; -drop function rss_gen_subscr__new (integer); +drop function rss_gen_subscr__new (integer,integer,varchar,integer,timestamp,varchar,timestamp,integer,varchar,integer); +drop function rss_gen_subscr__name (integer); drop function rss_gen_subscr__delete (integer); Index: openacs-4/packages/rss-support/sql/postgresql/rss-generation-sc-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/sql/postgresql/rss-generation-sc-drop.sql,v diff -u -r1.2 -r1.3 --- openacs-4/packages/rss-support/sql/postgresql/rss-generation-sc-drop.sql 7 Nov 2001 04:42:15 -0000 1.2 +++ openacs-4/packages/rss-support/sql/postgresql/rss-generation-sc-drop.sql 19 Nov 2001 04:02:28 -0000 1.3 @@ -1,11 +1,15 @@ +delete from acs_sc_bindings +where contract_id = acs_sc_contract__get_id('RssGenerationSubscriber'); + +select acs_sc_operation__delete ('RssGenerationSubscriber','Datasource'); + select acs_sc_msg_type__delete('RssGenerationSubscriber.Datasource.InputType'); select acs_sc_msg_type__delete('RssGenerationSubscriber.Datasource.OutputType'); -select acs_sc_operation__delete ('RssGenerationSubscriber','Datasource'); +select acs_sc_operation__delete ('RssGenerationSubscriber','LastUpdated'); select acs_sc_msg_type__delete('RssGenerationSubscriber.LastUpdated.InputType'); select acs_sc_msg_type__delete('RssGenerationSubscriber.LastUpdated.OutputType'); -select acs_sc_operation__delete ('RssGenerationSubscriber','LastUpdated'); select acs_sc_contract__delete('RssGenerationSubscriber'); Index: openacs-4/packages/rss-support/sql/postgresql/rss-support-drop.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/sql/postgresql/rss-support-drop.sql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rss-support/sql/postgresql/rss-support-drop.sql 5 Nov 2001 03:55:01 -0000 1.1 +++ openacs-4/packages/rss-support/sql/postgresql/rss-support-drop.sql 19 Nov 2001 04:02:28 -0000 1.2 @@ -1,2 +1,2 @@ -\i rss-generation-sc-drop.sql \i rss-generation-drop.sql +\i rss-generation-sc-drop.sql Index: openacs-4/packages/rss-support/www/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/rss-support/www/index.adp 19 Nov 2001 04:02:28 -0000 1.1 @@ -0,0 +1,15 @@ + +Rss Support Home + +

Rss Support Home

+<%= [ad_context_bar] %> +
+ + \ No newline at end of file Index: openacs-4/packages/rss-support/www/subscr-ae-2.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/subscr-ae-2.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rss-support/www/subscr-ae-2.tcl 13 Nov 2001 05:35:59 -0000 1.1 +++ openacs-4/packages/rss-support/www/subscr-ae-2.tcl 19 Nov 2001 04:02:28 -0000 1.2 @@ -1,8 +1,9 @@ ad_page_contract { Insert or update the subscription. } { - impl_id:notnull,naturalnum - summary_context_id:notnull,naturalnum + subscr_id:notnull,naturalnum + impl_id:optional,naturalnum + summary_context_id:optional,naturalnum return_url:optional timeout:notnull,naturalnum timeout_units:notnull @@ -15,25 +16,27 @@ d { set timeout [expr $timeout * 86400] } } -if [db_0or1row get_susbcr_id { - select subscr_id - from rss_gen_subscrs - where summary_context_id = :summary_context_id - and impl_id = :impl_id +if [db_0or1row subscr_exists_p { + select 1 + from acs_objects + where object_id = :subscr_id }] { # Subscription exists + ad_require_permission $subscr_id admin db_dml update_subscr { update rss_gen_subscrs set timeout = :timeout where subscr_id = :subscr_id } } else { # Create a new subscription. + ad_require_permission $summary_context_id admin + set creation_user [ad_conn user_id] set creation_ip [ns_conn peeraddr] db_exec_plsql create_subscr { select rss_gen_subscr__new ( - null, -- subscr_id + :subscr_id, -- subscr_id :impl_id, -- impl_id :summary_context_id, -- summary_context_id :timeout, -- timeout Index: openacs-4/packages/rss-support/www/subscr-ae.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/subscr-ae.adp,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rss-support/www/subscr-ae.adp 13 Nov 2001 05:35:59 -0000 1.1 +++ openacs-4/packages/rss-support/www/subscr-ae.adp 19 Nov 2001 04:02:28 -0000 1.2 @@ -1,7 +1,7 @@ Add or Edit a Subcription -

Add or Edit a Subscription

+

@action@ a Subscription

@context_bar@
@@ -10,8 +10,6 @@ Channel: @channel_title@ @channel_title@ -Summary Context Id: -@summary_context_id@ Impl Name: @impl_name@ Timeout: @@ -21,7 +19,7 @@ hours days - + @formvars@ Index: openacs-4/packages/rss-support/www/subscr-ae.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/subscr-ae.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rss-support/www/subscr-ae.tcl 13 Nov 2001 05:35:59 -0000 1.1 +++ openacs-4/packages/rss-support/www/subscr-ae.tcl 19 Nov 2001 04:02:28 -0000 1.2 @@ -2,37 +2,71 @@ Present an admin page for adding or editing subscriptions. + We should either get a subscr_id (editing) or + impl_id + summary_context_id (adding). + + Set the meta urlarg to 0 to prevent generating a report from which + we pull out channel title and link. + It would be very tempting to accept impl_name as an argument instead of impl_id. However, the "apply" call in acs_sc_call raises the ugly possibility of code-smuggling through the url, - so we will force the use of the easily validated impl_id instead. + so we will force the use of the easily validated impl_id + instead. } { - impl_id:notnull,naturalnum - summary_context_id:notnull,naturalnum + subscr_id:optional,naturalnum + impl_id:optional,naturalnum + summary_context_id:optional,naturalnum return_url:optional {meta:optional 1} +} -validate { + subscr_or_context { + if { !(([info exists subscr_id]) || ([info exists impl_id] && [info exists summary_context_id])) } { + ad_complain "We were unable to + process your request. Please contact this site's + technical team for assistance." + } + } } -set context_bar [ad_context_bar] +if { [info exists impl_id] && [info exists summary_context_id] } { + db_0or1row subscr_id_from_impl_and_context { + select subscr_id + from rss_gen_subscrs + where impl_id = :impl_id + and summary_context_id = :summary_context_id + } +} +if [info exists subscr_id] { + set action Edit + ad_require_permission $subscr_id admin + db_1row subscr_info { + select impl_id, + summary_context_id, + timeout + from rss_gen_subscrs + where subscr_id = :subscr_id + } +} else { + set action Add + ad_require_permission $summary_context_id admin + set subscr_id [db_nextval acs_object_id_seq] + set timeout 3600 +} + # Validate the impl_id and get its name if ![db_0or1row get_impl_name_and_count { select acs_sc_impl__get_name(impl_id) as impl_name from acs_sc_impls where impl_id = :impl_id }] { - ad_return_complaint 1 "No implementation found for this id." + ad_return_error "No implementation found for this id." "We were unable to +process your request. Please contact this site's technical team for +assistance." } -# Get subscription timeout, if exists. -set timeout [db_string susbcr_timeout { - select timeout - from rss_gen_subscrs - where summary_context_id = :summary_context_id - and impl_id = :impl_id -} -default 3600] - if !$meta { set channel_title "Summary Context $summary_context_id" set channel_link "" @@ -49,4 +83,11 @@ } } -set formvars [export_entire_form] \ No newline at end of file +set formvars [export_form_vars subscr_id \ + impl_id \ + summary_context_id \ + return_url \ + meta] + +set context_bar [ad_context_bar] + Index: openacs-4/packages/rss-support/www/admin/index.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/admin/index.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/rss-support/www/admin/index.adp 19 Nov 2001 04:02:28 -0000 1.1 @@ -0,0 +1,12 @@ + +Rss Support Admin Home + +

Rss Support Admin Home

+<%= [ad_context_bar] %> +
+ + + +






\ No newline at end of file Index: openacs-4/packages/rss-support/www/admin/subscrs.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/admin/subscrs.adp,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/rss-support/www/admin/subscrs.adp 19 Nov 2001 04:02:28 -0000 1.1 @@ -0,0 +1,26 @@ + +Report Generation Subscriptions + +

Report Generation Subscriptions

+@context_bar@ +
+ + + + + + + + + + + + + + + + + + + +
NameTimeoutLast BuiltLast Time To BuildCreated ByActions
Subscription #@subscrs.subscr_id@@subscrs.timeout@s@subscrs.creator@edit,run,delete
Index: openacs-4/packages/rss-support/www/admin/subscrs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/admin/subscrs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/rss-support/www/admin/subscrs.tcl 19 Nov 2001 04:02:28 -0000 1.1 @@ -0,0 +1,10 @@ +db_multirow subscrs get_subscrs { + select s.subscr_id, + s.timeout, + person__name(o.creation_user) as creator + from rss_gen_subscrs s, + acs_objects o + where o.object_id = s.subscr_id +} + +set context_bar [ad_context_bar Subscriptions] \ No newline at end of file Index: openacs-4/packages/rss-support/www/doc/design.html =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/doc/design.html,v diff -u -r1.1 -r1.2 --- openacs-4/packages/rss-support/www/doc/design.html 11 Nov 2001 05:35:21 -0000 1.1 +++ openacs-4/packages/rss-support/www/doc/design.html 19 Nov 2001 04:02:28 -0000 1.2 @@ -108,7 +108,9 @@ domain which implements the summary service contract. A summary context is not identical to a package instance. For example, a single bboard package instance might contain 3 summary contexts, one for each -of the forums in the instance. +of the forums in the instance. The summary context must, however, +be an acs_object for permissioning purposes (create a shell acs_object +if necessary). Only one subscription is allowed per summary context.