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.4 -r1.5 --- openacs-4/packages/acs-subsite/www/site-map/index-postgresql.xql 7 Aug 2017 23:47:59 -0000 1.4 +++ openacs-4/packages/acs-subsite/www/site-map/index-postgresql.xql 22 Oct 2018 07:41:37 -0000 1.5 @@ -3,21 +3,6 @@ postgresql7.1 - - - select s2.node_id, - s2.name, - s2.directory_p, - tree_level(s2.tree_sortkey) as level, - acs_object__name(s2.object_id) as obj_name, - acs_permission__permission_p(s2.object_id, :user_id, 'admin') as admin_p - from (select tree_ancestor_keys(site_node_get_tree_sortkey(:root_id)) as tree_sortkey) parents, - site_nodes s2 - where s2.tree_sortkey = parents.tree_sortkey - order by level - - - postgresql8.4 @@ -31,28 +16,28 @@ 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 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.node_id = (select site_node__node_id('/', null)) then 1 else 0 end as root_p, - (tree_level(n.tree_sortkey) - (select tree_level(n2.tree_sortkey) from site_nodes n2 where n2.node_id = (select coalesce(:root_id, site_node__node_id('/', null))))) as mylevel, + + (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 n2,site_nodes_selection sn - where (n.object_id is null - or acs_permission__permission_p(n.object_id, :user_id, 'read')) - and sn.node_id = n.node_id - and n2.node_id = (select coalesce(:root_id, site_node__node_id('/', null))) - and n.tree_sortkey between n2.tree_sortkey and tree_right(n2.tree_sortkey) - and (n.parent_id is null or n.parent_id in ([join $expand ", "]))) site_map + 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 order by url - + postgresql8.4 Index: openacs-4/packages/acs-subsite/www/site-map/index.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/site-map/index.tcl,v diff -u -r1.13 -r1.14 --- openacs-4/packages/acs-subsite/www/site-map/index.tcl 21 Oct 2018 17:50:09 -0000 1.13 +++ openacs-4/packages/acs-subsite/www/site-map/index.tcl 22 Oct 2018 07:41:37 -0000 1.14 @@ -21,7 +21,6 @@ # Check if the user has site-wide-admin privileges set site_wide_admin_p [acs_user::site_wide_admin_p] - array set node [site_node::get -node_id $root_id] set parent_id $node(parent_id) set object_id $node(object_id) @@ -42,6 +41,7 @@ set user_id [ad_conn user_id] if {[llength $expand] == 0} { + #lappend expand 0 lappend expand $root_id if { $parent_id ne "" } { lappend expand $parent_id @@ -88,19 +88,19 @@
- (@nodes.action_form_part;noquote@) + @nodes.action_form_part;noquote@
- (@nodes.action_form_part;noquote@) + @nodes.action_form_part;noquote@
- (@nodes.instance_url;noquote@) + @nodes.instance_url;noquote@ } } @@ -112,7 +112,7 @@ rename_url delete_url parameters_url permissions_url extra_form_part view_p set open_nodes [list] -# dbqd.acs-subsite.www.admin.site-map.site-map.nodes_select + db_foreach nodes_select {} { set add_folder_url "" set new_app_url "" @@ -160,7 +160,11 @@ set delete_url [export_vars -base delete {expand:multiple root_id node_id}] } - # use the indent variable to hold current indent level we'll use it later to indent stuff at the end by the amount of the last node + # + # Use the indent variable to hold current indent level we'll use + # it later to indent stuff at the end by the amount of the last + # node. + # set indent "" if { $mylevel != 1 } { if { $mylevel == 2 } { @@ -172,10 +176,6 @@ } } - #for {set i 0} {$i < 3*$mylevel} {incr i} { - #append indent " " - #} - set expand_mode 0 if {!$root_p && $n_children > 0} { set expand_mode 1 @@ -229,8 +229,10 @@ set action_form_part [export_vars -form {expand:multiple parent_id node_type root_id}] } - multirow append nodes $node_id $expand_mode $expand_url $indent $name $name_url $object_name $url $package_pretty_name $action_type $action_form_part $add_folder_url $new_app_url $unmount_url $mount_url $rename_url $delete_url $parameters_url $permissions_url "" $view_p - + multirow append nodes $node_id $expand_mode $expand_url $indent $name $name_url $object_name \ + $url $package_pretty_name $action_type $action_form_part $add_folder_url \ + $new_app_url $unmount_url $mount_url $rename_url $delete_url $parameters_url \ + $permissions_url "" $view_p } #set new_app_form_part_1 "

[export_vars -form {expand:multiple}]

"