• Publicity: Public Only All

acs-core-docs-procs.tcl

core documentation procs.

Location:
packages/acs-core-docs/tcl/acs-core-docs-procs.tcl
Created:
2002-09-10
Author:
Jeff Davis <davis@xarg.net>
CVS Identification:
$Id: acs-core-docs-procs.tcl,v 1.11.2.6 2021/09/02 16:40:50 gustafn Exp $

Procedures in this file

Detailed information

core_docs_uninstalled_packages (public, deprecated)

 core_docs_uninstalled_packages
Deprecated. Invoking this procedure generates a warning.

Returns a list (in array set format) of package.key package-name (used for display on the index.adp page). Cached version of ad_core_docs_uninstalled_packages_internal DEPRECATED: this proc does not comply with naming convention enforced by acs-tcl.naming__proc_naming automated test

Author:
Jeff Davis davis@xarg.net
See Also:

Partial Call Graph (max 5 caller/called nodes):
%3 ad_core_docs_uninstalled_packages ad_core_docs_uninstalled_packages (private) ad_log_deprecated ad_log_deprecated (public) core_docs_uninstalled_packages core_docs_uninstalled_packages core_docs_uninstalled_packages->ad_core_docs_uninstalled_packages core_docs_uninstalled_packages->ad_log_deprecated

Testcases:
No testcase defined.
[ hide source ] | [ make this the default ]

Content File Source

ad_library {
    core documentation procs.

    @author Jeff Davis (davis@xarg.net)
    @creation-date 2002-09-10
    @cvs-id $Id: acs-core-docs-procs.tcl,v 1.11.2.6 2021/09/02 16:40:50 gustafn Exp $
}

ad_proc -private ad_core_docs_uninstalled_packages_internal {} {
    Returns a list (in array set format) of package.key package-name
    (used for display on the index.adp page).

    @author Jeff Davis (davis@xarg.net)
} {
    set uninstalled [list]
    # Determine which spec files are not installed
    foreach spec_file [apm_scan_packages "$::acs::rootdir/packages"] {
        if { ! [catch {array set version [apm_read_package_info_file $spec_file]} errMsg] } {
            if { ! [apm_package_registered_p $version(package.key)] } {
                if {$version(package-name) eq ""} {
                    set version(package-name) $version(package.key)
                }
                lappend uninstalled [list $version(package.key) $version(package-name)]
            }
        }
    }

    # sort the list and return in array set form
    set out [list]
    foreach pkg [lsort -dictionary -index 1 $uninstalled] {
        lappend out {*}$pkg
    }
    return  $out
}

ad_proc -deprecated core_docs_uninstalled_packages {} {
    Returns a list (in array set format) of package.key package-name
    (used for display on the index.adp page).

    Cached version of ad_core_docs_uninstalled_packages_internal

    DEPRECATED: this proc does not comply with naming convention
    enforced by acs-tcl.naming__proc_naming automated test

    @see ad_core_docs_uninstalled_packages
    @author Jeff Davis davis@xarg.net
} {
    return [ad_core_docs_uninstalled_packages]
}

ad_proc -private ad_core_docs_uninstalled_packages {} {
    Returns a list (in array set format) of package.key package-name
    (used for display on the index.adp page).

    Cached version of ad_core_docs_uninstalled_packages_internal

    @author Jeff Davis davis@xarg.net
} {
    return [util_memoize ad_core_docs_uninstalled_packages_internal]
}

ad_proc -private ad_core_docs_html_redirector {args} {

    Performs internal redirect requests for .html-pages to .adp
    pages if these exist.

    @author Gustaf Neumann
} {
    #
    # There is no [ad_conn file] processed yet. Therefore, we have to
    # compute the path (consider just the path after the package_url
    # for filename construction).
    #
    set url [ad_conn url]
    #
    # For now, ignore all version info
    #
    regsub {^/doc/(current|openacs-[0-9-]+|HEAD)/} $url /doc/ url

    set path    [string range $url [string length [ad_conn package_url]] end]
    set html_fn [acs_package_root_dir [ad_conn package_key]]/www/$path
    # ns_log notice "redirector FN <$html_fn>"
    if {[file exists $html_fn]} {
        #
        # true acs-core-docs
        #
    } elseif {[regexp {^([a-z0-9_-]+)/(.+)$} $path _ pkg path]} {
        #
        # package acs-core-docs
        #
        set html_fn [acs_package_root_dir $pkg]/www/doc/$path
        #ns_log notice "... pkg doc <$html_fn>"
    }
    set adp_fn  [file rootname $html_fn].adp

    if {[file readable $adp_fn]} {
        #
        # Perform an internal redirect to the .adp file and stop the filter chain
        #
        #ns_log notice "===== core_docs_html_redirector <$args> url <[ad_conn url]> <[ad_conn file]> ADP exists -> break"
        rp_internal_redirect -absolute_path $adp_fn
        #
        # do NOT run any more post-authorization filters and do NOT
        # run the function registered, but run the trace to get the
        # entry logged in access.log
        #
        return filter_return

    } else {
        #
        # Continue with business as usual
        #
        return filter_ok
    }
}


# Local variables:
#    mode: tcl
#    tcl-indent-level: 4
#    indent-tabs-mode: nil
# End: