rp_html_directory_listing (private)

 rp_html_directory_listing dir

Defined in packages/acs-tcl/tcl/request-processor-procs.tcl

Generates an HTML-formatted listing of a directory. This is mostly stolen from _ns_dirlist in an AOLserver module (fastpath.tcl).

Parameters:
dir (required)

Partial Call Graph (max 5 caller/called nodes):
%3 rp_handle_request rp_handle_request (private) rp_html_directory_listing rp_html_directory_listing rp_handle_request->rp_html_directory_listing ad_file ad_file (public) rp_html_directory_listing->ad_file

Testcases:
No testcase defined.
Source code:
    # Create the table header.
    set list "
<table>
<tr align='left'><th>File</th><th>Size</th><th>Date</th></tr>
<tr align='left'><td colspan='3'><a href='../'>..</a></td></tr>
"

    # Loop through the files, adding a row to the table for each.
    foreach file [lsort [glob -nocomplain $dir/*]] {
        set tailHtml [ns_quotehtml [ad_file tail $file]]
        set link "<a href=\"$tailHtml\">$tailHtml</a>"

        # Build the stat array containing information about the file.
        file stat $file stat
        set size [expr {$stat(size) / 1000 + 1}]K
        set mtime $stat(mtime)
        set time [clock format $mtime -format "%d-%h-%Y %H:%M"]

        # Write out the row.
        append list "<tr align='left'><td>$link</td><td>$size</td><td>$time</td></tr>\n"
    }
    append list "</table>"
    return $list
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: