cookieconsent::resource_info (public)

 cookieconsent::resource_info [ -version version ]

Defined in packages/cookie-consent/tcl/cookie-consent-procs.tcl

Get information about available version(s) of the cookieconsent packages, either from the local filesystem, or from CDN.

Switches:
-version (optional)
Returns:
dict containing resourceDir, resourceName, cdn, cdnHost, prefix, cssFiles, jsFiles and extraFiles.

Partial Call Graph (max 5 caller/called nodes):
%3 test_cookie_consent__setup cookie_consent__setup (test cookie-consent) cookieconsent::resource_info cookieconsent::resource_info test_cookie_consent__setup->cookieconsent::resource_info acs_package_root_dir acs_package_root_dir (public) cookieconsent::resource_info->acs_package_root_dir parameter::get_global_value parameter::get_global_value (public) cookieconsent::resource_info->parameter::get_global_value cookieconsent::add_to_page cookieconsent::add_to_page (public) cookieconsent::add_to_page->cookieconsent::resource_info packages/cookie-consent/www/sitewide-admin/download.tcl packages/cookie-consent/ www/sitewide-admin/download.tcl packages/cookie-consent/www/sitewide-admin/download.tcl->cookieconsent::resource_info packages/cookie-consent/www/sitewide-admin/index.tcl packages/cookie-consent/ www/sitewide-admin/index.tcl packages/cookie-consent/www/sitewide-admin/index.tcl->cookieconsent::resource_info

Testcases:
cookie_consent__setup
Source code:
        variable parameter_info
        #
        # If no version of the cookie consent library was specified,
        # use the name-spaced variable as default.
        #
        if {$version eq ""} {
            dict with parameter_info {
                set version [::parameter::get_global_value  -package_key $package_key  -parameter $parameter_name  -default $default_value]
            }
        }

        #
        # Provide paths for loading either via resources or CDN
        #
        #   "resourceDir" is the absolute path in the filesystem
        #   "versionSegment" is the version-specific element both in the
        #                URL and in the filesystem.

        set resourceDir [acs_package_root_dir cookie-consent/www/resources]
        set cdn         //cdnjs.cloudflare.com/ajax/libs/cookieconsent2

        #
        # If the resources are not available locally, these will be
        # loaded via CDN and the CDN host is set (necessary for CSP).
        # The returned "prefix" indicates the place, from where the
        # resource will be loaded.
        #
        if {[file exists $resourceDir/$version]} {
            set prefix /resources/cookie-consent/$version/
            set cdnHost ""
        } else {
            set prefix $cdn/$version/
            set cdnHost cdnjs.cloudflare.com
        }
        lappend result  resourceName "Cookie Consent Widget"  resourceDir $resourceDir  cdn $cdn  cdnHost $cdnHost  prefix $prefix  cssFiles {cookieconsent.min.css}  jsFiles  {cookieconsent.min.js}  extraFiles {}  versionCheckAPI {cdn cdnjs library cookieconsent2 count 5}  vulnerabilityCheck {service snyk library cookieconsent2}  parameterInfo $parameter_info  configuredVersion $version

        return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: