Index: openacs-4/packages/acs-subsite/www/admin/site-map/unmounted.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-subsite/www/admin/site-map/unmounted.tcl,v diff -u -r1.7.2.1 -r1.7.2.2 --- openacs-4/packages/acs-subsite/www/admin/site-map/unmounted.tcl 18 Mar 2019 15:42:48 -0000 1.7.2.1 +++ openacs-4/packages/acs-subsite/www/admin/site-map/unmounted.tcl 3 Aug 2020 16:13:19 -0000 1.7.2.2 @@ -14,38 +14,52 @@ set the_public [acs_magic_object the_public] -db_multirow -extend {instance_delete_url delete_id} packages_normal packages_normal_select { - select package_id, instance_name as name, package_key - from apm_packages p - where (acs_permission.permission_p(package_id, :user_id, 'read') or - acs_permission.permission_p(package_id, :the_public, 'read')) - and not (select singleton_p from apm_package_types - where package_key = p.package_key) - and not exists (select 1 - from site_nodes - where object_id = package_id) - order by name + +db_multirow -extend {instance_delete_url delete_id} all_packages_unmounted all_packages_unmounted_select { + select + p.package_id, p.instance_name as name, p.package_key, apt.singleton_p + from + ( + select orig_object_id as package_id + from + acs_permission.permission_p_recursive_array(array( + select package_id + from apm_packages ap + + EXCEPT + + select object_id + from site_nodes), :user_id, 'read') as u + UNION + select orig_object_id as package_id + from + acs_permission.permission_p_recursive_array(array( + select package_id + from apm_packages ap + + EXCEPT + + select object_id + from site_nodes), :the_public, 'read') as p + ) as p_ids, apm_packages p, apm_package_types apt + where p.package_key = apt.package_key + and p_ids.package_id = p.package_id } { set instance_delete_url [export_vars -base instance-delete package_id] set delete_id action-delete-$package_id template::add_confirm_handler -id $delete_id -message "Are you sure you want to delete package $name" } -db_multirow -extend {instance_delete_url delete_id} packages_singleton packages_singleton_select { - select package_id, instance_name as name, package_key - from apm_packages p - where (acs_permission.permission_p(package_id, :user_id, 'read') or - acs_permission.permission_p(package_id, :the_public, 'read')) - and (select singleton_p from apm_package_types - where package_key = p.package_key) - and not exists (select 1 - from site_nodes - where object_id = package_id) - order by name -} { - set instance_delete_url [export_vars -base instance-delete package_id] - set delete_id action-delete-$package_id - template::add_confirm_handler -id $delete_id -message "Are you sure you want to delete package $name" +template::multirow create packages_normal package_id name package_key instance_delete_url delete_id +template::multirow create packages_singleton package_id name package_key instance_delete_url delete_id + + +template::multirow foreach all_packages_unmounted { + if {$singleton_p} { + template::multirow append packages_singleton $package_id $name $package_key $instance_delete_url $delete_id + } else { + template::multirow append packages_normal $package_id $name $package_key $instance_delete_url $delete_id + } } # Local variables: