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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/rss-support/www/subscr-ae-2.tcl 13 Nov 2001 05:35:59 -0000 1.1
@@ -0,0 +1,53 @@
+ad_page_contract {
+ Insert or update the subscription.
+} {
+ impl_id:notnull,naturalnum
+ summary_context_id:notnull,naturalnum
+ return_url:optional
+ timeout:notnull,naturalnum
+ timeout_units:notnull
+ {meta:optional 1}
+}
+
+switch $timeout_units {
+ m { set timeout [expr $timeout * 60] }
+ h { set timeout [expr $timeout * 3600] }
+ 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
+}] {
+ # Subscription exists
+ db_dml update_subscr {
+ update rss_gen_subscrs
+ set timeout = :timeout
+ where subscr_id = :subscr_id
+ }
+} else {
+ # Create a new subscription.
+ 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
+ :impl_id, -- impl_id
+ :summary_context_id, -- summary_context_id
+ :timeout, -- timeout
+ null, -- lastbuild
+ 'rss_gen_subscr', -- object_type
+ now(), -- creation_date
+ :creation_user, -- creation_user
+ :creation_ip, -- creation_ip
+ :summary_context_id -- context_id
+ )
+ }
+}
+
+
+set context_bar [ad_context_bar]
+
+set review_url subscr-ae?[export_url_vars impl_id summary_context_id return_url meta]
\ No newline at end of file
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/rss-support/www/subscr-ae.adp 13 Nov 2001 05:35:59 -0000 1.1
@@ -0,0 +1,28 @@
+
+Add or Edit a Subcription
+
+
Add or Edit a Subscription
+@context_bar@
+
+
+
+
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
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ openacs-4/packages/rss-support/www/subscr-ae.tcl 13 Nov 2001 05:35:59 -0000 1.1
@@ -0,0 +1,52 @@
+ad_page_contract {
+
+ Present an admin page for adding or editing subscriptions.
+
+ 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.
+
+} {
+ impl_id:notnull,naturalnum
+ summary_context_id:notnull,naturalnum
+ return_url:optional
+ {meta:optional 1}
+}
+
+set context_bar [ad_context_bar]
+
+# 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."
+}
+
+# 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 ""
+} else {
+ # Pull out channel data by generating a summary.
+ # This is a convenient way to use a contracted operation
+ # but is not terribly efficient since we only need the channel title
+ # and link, and not the whole summary.
+ foreach {name val} [acs_sc_call RssGenerationSubscriber datasource \
+ $summary_context_id $impl_name] {
+ if { [lsearch {channel_title channel_link} $name] >= 0 } {
+ set $name $val
+ }
+ }
+}
+
+set formvars [export_entire_form]
\ No newline at end of file
Index: openacs-4/packages/rss-support/www/doc/index.html
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/www/doc/index.html,v
diff -u -r1.6 -r1.7
--- openacs-4/packages/rss-support/www/doc/index.html 13 Nov 2001 03:18:20 -0000 1.6
+++ openacs-4/packages/rss-support/www/doc/index.html 13 Nov 2001 05:35:59 -0000 1.7
@@ -15,7 +15,7 @@
To-do's
-
Admin screens for subscription management
+
Admin screens for subscription management (** add/edit functional **)