Forum OpenACS Q&A: abstract URL / ad_serve_html_page

Collapse
Posted by Ken Mayer on

I'm trying to reconcile a CVS merge. I made some fixes to ad_serve_html_page on my own, and it looks like Ben (BMA?) did something different. I have a working copy of ACS 3.2.2 and copied some of their code into openACS.

The trouble is that the openACS fix has a different API then aD's ACS. Which way should it go? I'm always concerned about drifting too far from the aD baseline. The latest version (3.3.0) of ACS uses my method (sorry about that).

[kmayer@bwdev tcl]$ cvs diff -u -rv_3_2_2 ad-html.tcl 
Index: ad-html.tcl
===================================================================
RCS file: /home/src/web/bw/tcl/ad-html.tcl,v
retrieving revision 1.1.1.2
retrieving revision 1.2
diff -u -r1.1.1.2 -r1.2
--- ad-html.tcl	2000/07/08 18:42:45	1.1.1.2
+++ ad-html.tcl	2000/07/08 18:28:47	1.2
@@ -47,16 +47,16 @@
 }
 
 
-proc_doc ad_serve_html_page {ignore {override_url {}}} {The procedure
that actually serves all the HTML pages on an ACS.  It looks first to
see if the file is in one of the naked_html directories.  If so, it
simply returns the raw bytes.  It then looks to see if the ad_dnd_tag
("do not disturb") comment pattern is present.  Again, if so, it
simply returns.  Otherwise, the procedure tries to add comments and
related links.  If the database is busy, it will simply add links to
comments and related links.} {
-
-    ## Fix to make abstract_url work (BMA)
-    if {$override_url == ""} {
-	set url_stub [ns_conn url]
-    } else {
-	set url_stub $override_url
+proc_doc ad_serve_html_page {ignore} {The procedure that actually
serves all the HTML pages on an ACS.  It looks first to see if the
file is in one of the naked_html directories.  If so, it simply
returns the raw bytes.  It then looks to see if the ad_dnd_tag ("do
not disturb") comment pattern is present.  Again, if so, it simply
returns.  Otherwise, the procedure tries to add comments and related
links.  If the database is busy, it will simply add links to comments
and related links.} {
+    set url_stub [ad_conn canonicalurl]
+    if { [empty_string_p $url_stub] } {
+        set url_stub [ns_conn url]
     }
 
-    set full_filename "[ns_info pageroot]$url_stub"
+    set full_filename [ad_conn file]
+    if { [empty_string_p $full_filename] } {
+        set full_filename [ns_url2file $url_stub]
+    }
 
     foreach naked_pattern [ad_naked_html_patterns] {
 	if [string match $naked_pattern $url_stub] {