apm_package_list_url_resolution (public)

 apm_package_list_url_resolution package_list

Defined in packages/acs-tcl/tcl/apm-procs.tcl

Use a left-right, breadth-first traverse of the inheritance DAG to build a structure to be used by the request processor to resolve URLs based on a package's "extends" and "embeds" dependencies.

Parameters:
package_list

Partial Call Graph (max 5 caller/called nodes):
%3 apm_build_one_package_relationships apm_build_one_package_relationships (public) apm_package_list_url_resolution apm_package_list_url_resolution apm_build_one_package_relationships->apm_package_list_url_resolution db_1row db_1row (public) apm_package_list_url_resolution->db_1row db_list_of_lists db_list_of_lists (public) apm_package_list_url_resolution->db_list_of_lists

Testcases:
No testcase defined.
Source code:

    foreach package $package_list {
        lassign $package package_key dependency_type
        if { [info exists ::apm_visited_package_keys($package_key)] } {
            continue
        }
        switch -- $dependency_type {
            extends -
            "" { lappend ::apm_package_url_resolution $::acs::rootdir/packages/$package_key/www }
            embeds {

                # Reference to an embedded package is through URLs relative to the embedding
                # package's mount point, taking one  of the forms package-key,
                # admin/package-key and sitewide-admin/package-key.  These map to package-key/embed,
                # package-key/embed/admin, and package-key/embed/sitewide-admin respectively.

                # We break references like package-key/admin because such references are unsafe,
                # as the request processor will not perform the expected permission check.

                lappend ::apm_package_url_resolution  [list $::acs::rootdir/packages/$package_key/embed/admin admin/$package_key]
                lappend ::apm_package_url_resolution  [list "" $package_key/admin]

                lappend ::apm_package_url_resolution  [list $::acs::rootdir/packages/$package_key/embed/sitewide-admin  sitewide-admin/$package_key]
                lappend ::apm_package_url_resolution  [list "" $package_key/sitewide-admin]

                lappend ::apm_package_url_resolution  [list $::acs::rootdir/packages/$package_key/embed $package_key]
            }
            default {
                error "apm_package_list_url_resolution: dependency type is $dependency_type"
            }
        }
        set ::apm_visited_package_keys($package_key) 1
    }

    # Make sure old versions work ...
    foreach package $package_list {
        lassign $package package_key dependency_type
        set inherit_templates_p t
        #fix!
        catch { db_1row get_inherit_templates_p {} }
        apm_package_list_url_resolution [db_list_of_lists get_dependencies {}]
    }
Generic XQL file:
<fullquery name="apm_package_list_url_resolution.get_inherit_templates_p">
    <querytext>
      select inherit_templates_p
      from apm_package_types
      where package_key = :package_key
    </querytext>
</fullquery>

<fullquery name="apm_package_list_url_resolution.get_dependencies">
    <querytext>
      select apd.service_uri, apd.dependency_type
      from apm_package_versions apv, apm_package_dependencies apd
      where apv.package_key = :package_key
        and apv.installed_p = 't'
        and apd.version_id = apv.version_id
        and (apd.dependency_type = 'embeds'
             or apd.dependency_type =  'extends' and :inherit_templates_p = 't')
      order by apd.dependency_id
    </querytext>
</fullquery>
packages/acs-tcl/tcl/apm-procs.xql

PostgreSQL XQL file:
packages/acs-tcl/tcl/apm-procs-postgresql.xql

Oracle XQL file:
packages/acs-tcl/tcl/apm-procs-oracle.xql

[ hide source ] | [ make this the default ]
Show another procedure: