openacs_bootstrap5_theme::resource_info (private)

 openacs_bootstrap5_theme::resource_info [ -version version ]

Defined in packages/openacs-bootstrap5-theme/tcl/resource-procs.tcl

Get information about available version(s) of the bootstrap packages. The goal is to deliver resources 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 packages/openacs-bootstrap5-theme/www/sitewide-admin/download.tcl packages/openacs-bootstrap5-theme/ www/sitewide-admin/download.tcl openacs_bootstrap5_theme::resource_info openacs_bootstrap5_theme::resource_info packages/openacs-bootstrap5-theme/www/sitewide-admin/download.tcl->openacs_bootstrap5_theme::resource_info packages/openacs-bootstrap5-theme/www/sitewide-admin/index.tcl packages/openacs-bootstrap5-theme/ www/sitewide-admin/index.tcl packages/openacs-bootstrap5-theme/www/sitewide-admin/index.tcl->openacs_bootstrap5_theme::resource_info acs_package_root_dir acs_package_root_dir (public) openacs_bootstrap5_theme::resource_info->acs_package_root_dir parameter::get_global_value parameter::get_global_value (public) openacs_bootstrap5_theme::resource_info->parameter::get_global_value

Testcases:
No testcase defined.
Source code:
        variable parameter_info

        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 openacs-bootstrap5-theme/www/resources/bootstrap]
        set versionSegment $version
        set cdn            //cdnjs.cloudflare.com/ajax/libs/bootstrap

        if {[file exists $resourceDir/$versionSegment]} {
            set prefix  /resources/openacs-bootstrap5-theme/bootstrap/$version
            set cdnHost ""
            set cspMap ""
        } else {
            #
            # Use CDN
            #
            set prefix $cdn/$version
            set cdnHost cdnjs.cloudflare.com
            dict set cspMap urn:ad:css:bootstrap5 style-src $cdnHost
            dict set cspMap urn:ad:css:bootstrap5 font-src $cdnHost
            dict set cspMap urn:ad:js:bootstrap5 script-src $cdnHost
        }

        lappend result  resourceName "Bootstrap 5"  resourceDir $resourceDir  versionSegment $versionSegment  cdn $cdn  cdnHost $cdnHost  prefix $prefix  cssFiles {css/bootstrap.min.css css/bootstrap.min.css.map}  jsFiles  {js/bootstrap.bundle.min.js js/bootstrap.bundle.min.js.map}  extraFiles {}  urnMap {
                urn:ad:css:bootstrap5 css/bootstrap.min.css
                urn:ad:js:bootstrap5  js/bootstrap.bundle.min.js
            }  cspMap $cspMap  versionCheckAPI {cdn cdnjs library bootstrap count 1}  vulnerabilityCheck {service snyk library bootstrap}  parameterInfo $parameter_info  configuredVersion $version

        #urn:ad:js:popper2     dist/umd/popper.min.js
        return $result
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: