Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql,v diff -u -r1.11 -r1.11.2.1 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql 14 Sep 2002 20:20:47 -0000 1.11 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs-oracle.xql 2 Feb 2003 21:19:26 -0000 1.11.2.1 @@ -14,6 +14,7 @@ select site_node.url(site_nodes.node_id) as url, site_nodes.node_id, site_nodes.parent_id, + site_nodes.name, site_nodes.directory_p, site_nodes.pattern_p, site_nodes.object_id, @@ -34,6 +35,7 @@ select site_node.url(site_nodes.node_id) as url, site_nodes.node_id, site_nodes.parent_id, + site_nodes.name, site_nodes.directory_p, site_nodes.pattern_p, site_nodes.object_id, Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql,v diff -u -r1.15 -r1.15.2.1 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql 14 Sep 2002 20:20:47 -0000 1.15 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs-postgresql.xql 2 Feb 2003 21:19:26 -0000 1.15.2.1 @@ -14,6 +14,7 @@ select site_node__url(site_nodes.node_id) as url, site_nodes.node_id, site_nodes.parent_id, + site_nodes.name, site_nodes.directory_p, site_nodes.pattern_p, site_nodes.object_id, @@ -32,6 +33,7 @@ select site_node__url(site_nodes.node_id) as url, site_nodes.node_id, site_nodes.parent_id, + site_nodes.name, site_nodes.directory_p, site_nodes.pattern_p, site_nodes.object_id, Index: openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl,v diff -u -r1.17.2.3 -r1.17.2.4 --- openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 16 Dec 2002 12:03:40 -0000 1.17.2.3 +++ openacs-4/packages/acs-tcl/tcl/site-nodes-procs.tcl 2 Feb 2003 21:19:26 -0000 1.17.2.4 @@ -142,9 +142,15 @@ ad_proc -public get_from_url { {-url:required} + {-exact:boolean} } { - returns an array representing the site node that matches the given url + Returns an array representing the site node that matches the given url.
+ A trailing '/' will be appended to $url if required and not present.
+ + If the '-exact' switch is not present and $url is not found, returns the + first match found by successively removing the trailing $url path component.
+ @see site_node::get } { # attempt an exact match @@ -162,18 +168,20 @@ } # chomp off part of the url and re-attempt - while {![empty_string_p $url]} { - set url [string trimright $url /] - set url [string range $url 0 [string last / $url]] + if {!$exact_p} { + while {![empty_string_p $url]} { + set url [string trimright $url /] + set url [string range $url 0 [string last / $url]] - if {[nsv_exists site_nodes $url]} { - array set node [nsv_get site_nodes $url] + if {[nsv_exists site_nodes $url]} { + array set node [nsv_get site_nodes $url] - if {[string equal $node(pattern_p) t] && ![empty_string_p $node(object_id)]} { - return [array get node] - } - } - } + if {[string equal $node(pattern_p) t] && ![empty_string_p $node(object_id)]} { + return [array get node] + } + } + } + } error "site node not found at url $url" }