Index: openacs-4/packages/acs-subsite/www/site-map/index-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/site-map/index-postgresql.xql,v diff -u -r1.5 -r1.5.2.1 --- openacs-4/packages/acs-subsite/www/site-map/index-postgresql.xql 22 Oct 2018 07:41:37 -0000 1.5 +++ openacs-4/packages/acs-subsite/www/site-map/index-postgresql.xql 18 Mar 2019 14:09:28 -0000 1.5.2.1 @@ -6,34 +6,33 @@ postgresql8.4 - select package_id, - package_key, - pretty_name as package_pretty_name, - apm_package_type__num_parameters(package_key) as parameter_count, - node_id, url, parent_url, name, root_p, mylevel, object_id, - directory_p, parent_id, n_children, - p.instance_name as object_name, - acs_permission__permission_p(object_id, :user_id, 'admin') as object_admin_p, - (select view_p from site_nodes_selection where node_id=site_map.node_id) as view_p - from apm_packages p join apm_package_types using (package_key) right outer join - - (select sm0.*, (char_length(url)-char_length(replace(url, '/', ''))-1) as mylevel - from (select distinct n.node_id, - site_node__url(n.node_id) as url, - site_node__url(n.parent_id) as parent_url, - n.name, - case when exists (select 1 from site_nodes where parent_id = n.node_id) then 1 else 0 end as n_children, - case when n.parent_id is NULL then 1 else 0 end as root_p, - n.object_id, - n.directory_p, - n.parent_id - from site_nodes n, site_nodes_selection s - where (n.object_id is null or acs_permission__permission_p(n.object_id, :user_id,'read')) - and s.node_id = n.node_id - and (n.parent_id is null or n.parent_id in ([join $expand ", "]))) sm0) as site_map - - - on site_map.object_id = p.package_id + select p.package_id, + p.package_key, + (select pretty_name from apm_package_types + where package_key = p.package_key) as package_pretty_name, + case when exists (select 1 from apm_parameters + where package_key = p.package_key) then 1 else 0 end as parameter_count, + n.node_id, + n.parent_id, + case when exists (select 1 from site_nodes + where parent_id = n.node_id) then 1 else 0 end as n_children, + n.parent_id is null as root_p, + n.name, + site_node__url(n.node_id) as url, + length(site_node__url(n.node_id)) - + length(replace(site_node__url(n.node_id), '/', '')) - + 1 as mylevel, + n.object_id, + n.directory_p, + p.instance_name as object_name, + acs_permission.permission_p(object_id, :user_id, 'admin') as object_admin_p, + s.view_p + from site_nodes n + left outer join apm_packages p on n.object_id = p.package_id, + site_nodes_selection s + where n.node_id = s.node_id + and (n.object_id is null or acs_permission.permission_p(n.object_id, :user_id,'read')) + and (n.parent_id is null or n.parent_id in ([join $expand ", "])) order by url