Index: openacs-4/packages/static-pages/static-pages.info
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/static-pages.info,v
diff -u -r1.12.2.1 -r1.12.2.2
--- openacs-4/packages/static-pages/static-pages.info	9 Dec 2002 14:35:11 -0000	1.12.2.1
+++ openacs-4/packages/static-pages/static-pages.info	12 Dec 2002 22:01:09 -0000	1.12.2.2
@@ -5,18 +5,18 @@
     <package-name>Static Pages</package-name>
     <pretty-plural>Static Pages</pretty-plural>
     <initial-install-p>f</initial-install-p>
-    <singleton-p>t</singleton-p>
+    <singleton-p>f</singleton-p>
 
-    <version name="4.2a" url="http://www.arsdigita.com/acs-repository/download/apm/static-pages-4.2a.apm">
+    <version name="4.3" url="http://openacs.org/">
     <database-support>
         <database>oracle</database>
         <database>postgresql</database>
     </database-support>
-        <owner url="mailto:bcalef@arsdigita.com">Brandoch Calef</owner>
-        <owner url="mailto:bcalef@arsdigita.com">Brandoch Calef</owner>
+        <owner url="mailto:dave@thedesignexperience.org">Dave Bauer</owner>
+        <owner url="http://www.piskorski.com">Andrew Piskorski</owner>
         <summary>Static Pages makes it possible to search and comment on static pages.</summary>
-        <release-date>2001-03-09</release-date>
-        <vendor url="http://www.arsdigita.com/">ArsDigita Corporation</vendor>
+        <release-date>2002-12-11</release-date>
+        <vendor url="http://openacs.org/">OpenACS</vendor>
         <description format="text/plain">Static Pages loads the static pages of a site into the database so that their contents are available to other packages, such as site-wide-search.  It also allows users to make comments on static pages.</description>
 
         <provides url="static-pages" version="4.2a"/>
@@ -72,13 +72,14 @@
             <file type="documentation" path="www/doc/xml/requirements.xml"/>
             <file type="content_page" path="www/index.tcl"/>
             <file type="content_page" path="www/page-visit.tcl"/>
-            <file type="content_page" path="www/templates/static.adp"/>
             <file type="query_file" path="www/page-visit.xql"/>
+            <file type="content_page" path="www/templates/static.adp"/>
         </files>
         <parameters>
             <parameter datatype="string"  min_n_values="1"  max_n_values="1"  name="AllowedExtensions"  default="html htm" description="Enter the file extensions you want to have working with &quot;static-pages&quot;. Separate them with a single whitespace. (Case insensitive)."/>
             <parameter datatype="number"  min_n_values="1"  max_n_values="1"  name="TemplatingEnabledP"  default="0" description="Set this to 1 if you want the pages that are scanned by static-pages to be templated. Otherwise set it to 0."/>
             <parameter datatype="string"  min_n_values="1"  max_n_values="1"  name="TemplatePath"  default="/packages/static-pages/www/templates/static" description="If you want to activate templating of static pages, you must tell the system where to find the adp template. Leave out the initial / and don't forget the filename. (the path is relative to [acs_root_dir] and .adp is implied).]"/>
+            <parameter datatype="string"  min_n_values="1"  max_n_values="1"  name="fs_root"  default="/www" description="Root folder of Static Pages tree, relative to acs_root_dir server root."/>
         </parameters>
 
     </version>
Index: openacs-4/packages/static-pages/sql/oracle/static-pages-create.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/sql/oracle/static-pages-create.sql,v
diff -u -r1.1.1.1.4.1 -r1.1.1.1.4.2
--- openacs-4/packages/static-pages/sql/oracle/static-pages-create.sql	12 Dec 2002 18:39:40 -0000	1.1.1.1.4.1
+++ openacs-4/packages/static-pages/sql/oracle/static-pages-create.sql	12 Dec 2002 22:01:27 -0000	1.1.1.1.4.2
@@ -77,16 +77,18 @@
 			constraint static_pgs_show_cmnts_chk
 			check (show_comments_p in ('t','f'))
 );
+
 comment on table static_pages is '
 	Extends the cr_items table to hold information on static pages.
 '; 
 comment on column static_pages.filename is '
 	The full path of the file (e.g. /web/my_site/www/books/index.html).
+  --
+  No, not anymore.  As of c. 2001/10/30 changes by daveb, it is a
+  RELATIVE path, relative to the page root (server/www/).  As of now,
+  it is relative to the server root (server/).  --atp@piskorski.com,
+  2002/12/12 16:56 EST
 ';
--- TODO: Why are we storing the absolute path to the static file?
--- That seems problematic to me. --atp@piskorski.com, 2001/08/22
--- 22:48 EDT
---
 comment on column static_pages.folder_id is '
 	ID of folder containing page.
 ';
Index: openacs-4/packages/static-pages/sql/oracle/upgrade/upgrade-4.2a-4.3.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/sql/oracle/upgrade/upgrade-4.2a-4.3.sql,v
diff -u -r1.1.2.1 -r1.1.2.2
--- openacs-4/packages/static-pages/sql/oracle/upgrade/upgrade-4.2a-4.3.sql	12 Dec 2002 20:02:49 -0000	1.1.2.1
+++ openacs-4/packages/static-pages/sql/oracle/upgrade/upgrade-4.2a-4.3.sql	12 Dec 2002 22:01:41 -0000	1.1.2.2
@@ -13,3 +13,12 @@
 -- all that matters.  --atp@piskorski.com, 2002/12/12 13:59 EST
 
 @static-page-pb.sql
+
+update apm_package_types  set singleton_p = 'f'
+where package_key = 'static-pages' ;
+commit;
+
+-- TODO: Must convert any old static_pages.filename values in the db
+-- to be relative to the server rather than page root.  See also
+-- comment in tcl/static-pages-init.tcl re. CR_LOCATIONS STATIC_PAGES.
+-- --atp@piskorski.com, 2002/12/12 16:17 EST
Index: openacs-4/packages/static-pages/sql/postgresql/upgrade/upgrade-4.2a-4.3.sql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/sql/postgresql/upgrade/upgrade-4.2a-4.3.sql,v
diff -u -r1.1.2.1 -r1.1.2.2
--- openacs-4/packages/static-pages/sql/postgresql/upgrade/upgrade-4.2a-4.3.sql	12 Dec 2002 20:03:08 -0000	1.1.2.1
+++ openacs-4/packages/static-pages/sql/postgresql/upgrade/upgrade-4.2a-4.3.sql	12 Dec 2002 22:01:51 -0000	1.1.2.2
@@ -13,3 +13,7 @@
 -- all that matters.  --atp@piskorski.com, 2002/12/12 13:59 EST
 
 \i static-page-pb.sql
+
+update apm_package_types  set singleton_p = ''f''
+where package_key = ''static-pages'' ;
+commit;
Index: openacs-4/packages/static-pages/tcl/static-pages-init.tcl
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/tcl/static-pages-init.tcl,v
diff -u -r1.2.4.1 -r1.2.4.2
--- openacs-4/packages/static-pages/tcl/static-pages-init.tcl	12 Dec 2002 01:32:48 -0000	1.2.4.1
+++ openacs-4/packages/static-pages/tcl/static-pages-init.tcl	12 Dec 2002 22:02:01 -0000	1.2.4.2
@@ -1,12 +1,13 @@
 # setup the STATIC_PAGES location for CR_LOCATIONS so that all paths
 # stored in the db are relative to the OpenACS installation dir
 
-if ![nsv_exists CR_LOCATIONS STATIC_PAGES] {
-    nsv_set CR_LOCATIONS STATIC_PAGES "[file dirname [string trimright [ns_info tcllib] "/"]]/www"
-}
+if { ![nsv_exists CR_LOCATIONS STATIC_PAGES] } {
+    # Since we allow the fs_root of static-pages package instances to
+    # be beneath the packages/ directory, this must now be relative to
+    # the server root (e.g., "/web/mysite/"), not the web root (e.g.,
+    # "/web/mysite/www/"):  --atp@piskorski.com, 2002/12/12 16:17 EST
 
-if ![nsv_exists static_pages package_id] {
-    nsv_set static_pages package_id [apm_package_id_from_key static-pages]
+    nsv_set CR_LOCATIONS STATIC_PAGES "[file dirname [string trimright [ns_info tcllib] "/"]]"
 }
 
 
@@ -21,5 +22,8 @@
 ns_share -init { set sp_sync_cr_with_filesystem_mutex [ns_mutex create] } sp_sync_cr_with_filesystem_mutex
 
 
+# Register the handler for each static page file extension.
+sp_register_extension
 
+
 ns_log notice "static-pages-init.tcl loaded"
Index: openacs-4/packages/static-pages/tcl/static-pages-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/tcl/static-pages-procs-oracle.xql,v
diff -u -r1.9.2.1 -r1.9.2.2
--- openacs-4/packages/static-pages/tcl/static-pages-procs-oracle.xql	12 Dec 2002 01:32:48 -0000	1.9.2.1
+++ openacs-4/packages/static-pages/tcl/static-pages-procs-oracle.xql	12 Dec 2002 22:02:01 -0000	1.9.2.2
@@ -167,4 +167,27 @@
 </querytext>
 </fullquery>
 
+
+<fullquery name="sp_get_page_id.page_and_package_ids">
+<querytext>
+select sp.static_page_id, f.package_id
+from static_pages sp, sp_folders f
+where sp.filename = :filename
+and sp.folder_id = f.folder_id
+-- Only want pages from the Static Pages package.
+and f.package_id in (
+  select package_id  from apm_packages
+  where package_key = :package_key )
+-- If the same page is in more than one instance of
+-- Static Pages for some reason, we only want one of
+-- them, and we don't care which.
+-- Oracle
+and rownum <= 1
+-- PostgreSQL
+--limit 1
+</querytext>
+</fullquery>
+
+
+
 </queryset>
Index: openacs-4/packages/static-pages/tcl/static-pages-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/static-pages/tcl/static-pages-procs-postgresql.xql,v
diff -u -r1.17.2.1 -r1.17.2.2
--- openacs-4/packages/static-pages/tcl/static-pages-procs-postgresql.xql	12 Dec 2002 01:32:48 -0000	1.17.2.1
+++ openacs-4/packages/static-pages/tcl/static-pages-procs-postgresql.xql	12 Dec 2002 22:02:01 -0000	1.17.2.2
@@ -159,4 +159,25 @@
 </fullquery>
 
 
+<fullquery name="sp_get_page_id.page_and_package_ids">
+<querytext>
+select sp.static_page_id, f.package_id
+from static_pages sp, sp_folders f
+where sp.filename = :filename
+and sp.folder_id = f.folder_id
+-- Only want pages from the Static Pages package.
+and f.package_id in (
+  select package_id  from apm_packages
+  where package_key = :package_key )
+-- If the same page is in more than one instance of
+-- Static Pages for some reason, we only want one of
+-- them, and we don't care which.
+-- Oracle
+--and rownum <= 1
+-- PostgreSQL
+limit 1
+</querytext>
+</fullquery>
+
+
 </queryset>