Index: openacs-4/packages/rss-support/tcl/rss-generation-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/tcl/rss-generation-procs.tcl,v diff -u -N -r1.3 -r1.4 --- openacs-4/packages/rss-support/tcl/rss-generation-procs.tcl 11 Nov 2001 02:01:39 -0000 1.3 +++ openacs-4/packages/rss-support/tcl/rss-generation-procs.tcl 11 Nov 2001 03:56:21 -0000 1.4 @@ -427,29 +427,3 @@ } return $rss } - - -ad_proc rss_package_id {} { -
-    # Returns the package_id for rss if it is rss is mounted.
-    # Returns 0 otherwise.
-    
-} { - if ![db_0or1row get_package_id {select package_id from apm_packages where package_key = 'rss-support'}] { - return 0 - } else { - return $package_id - } -} - -ad_proc rss_package_url {} { -
-    # Returns the rss package url if it is mounted.
-    # Returns the empty string otherwise.
-    
-} { - set package_id [rss_package_id] - return [db_string rss_url {select site_node__url(node_id) from site_nodes where object_id = :package_id} -default ""] - -} - Index: openacs-4/packages/rss-support/tcl/rss-utilities-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/rss-support/tcl/rss-utilities-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/rss-support/tcl/rss-utilities-procs.tcl 11 Nov 2001 03:56:21 -0000 1.1 @@ -0,0 +1,61 @@ +ad_proc -public rss_package_id {} { +
+    # Returns the package_id for rss if it is rss is mounted.
+    # Returns 0 otherwise.
+    
+} { + if ![db_0or1row get_package_id {select package_id from apm_packages where package_key = 'rss-support'}] { + return 0 + } else { + return $package_id + } +} + +ad_proc -public rss_package_url {} { +
+    # Returns the rss package url if it is mounted.
+    # Returns the empty string otherwise.
+    
+} { + set package_id [rss_package_id] + return [db_string rss_url {select site_node__url(node_id) from site_nodes where object_id = :package_id} -default ""] + +} + +ad_proc -public rss_first_url_for_package_id { + package_id +} { + Finds the first site node (ordered by node_id) + associated with package_id and returns the + relative url for that node. Returns empty string + if the package is not mounted. +} { + return [util_memoize "rss_first_url_for_package_id_helper $package_id"] +} + +ad_proc -private rss_first_url_for_package_id_helper { + package_id +} { + Does the actual work for rss_first_url_for_package_id. +} { + set url "" + + if [db_0or1row first_node_id { + select node_id from site_nodes + where object_id = :package_id + order by node_id limit 1 + }] { + db_foreach url_parts { + select s2.name + from site_nodes s1, site_nodes s2 + where s1.node_id = :node_id + and s2.tree_sortkey <= s1.tree_sortkey + and s1.tree_sortkey like (s2.tree_sortkey || '%') + order by s2.tree_sortkey; + } { + append url ${name}/ + } + } + + return $url +} \ No newline at end of file