fs_row_for_one_file

one of the documented procedures in this installation of the ACS
Usage:
fs_row_for_one_file { -n_pixels_in 0 -file_id {} -folder_p f -client_file_name {} -n_kbytes {} -n_bytes {} -file_title {} -file_type {} -url {} -creation_date {} -version_id {} -links 1 -author_p 0 -owner_id 0 -owner_name {} -user_url {/shared/community-member} -export_url_vars {} -folder_url {one-folder} -file_url {one-file} }
What it does:
Returns one row of a HTML table displaying all the information about a file. Set links to 0 if you want this file to be output without links to manage it (to display the folder you're currently in).

A little explanation is in place here. The first bunch of arguments are all standard stuff we want to know about the file. The n_pixels_in is whatever amount of pixels you want this line indented.

Then there's the 'links' argument. It's used for one-folder, which likes to show the current folder first, without the hyperlinks. So if you don't want links from an entry (only works for folders) set this to 0.

Then there's author. If you want the author shown, set author_p and provide us with owner_id and owner_name, and you'll get the link. If you want the link to go somewhere different than /shared/community-member, you'll want to set user_url to the page you want to link to (user_id will be appended).

Set export_url_vars to the vars you want exported when a file or folder link is clicked. It should be a query string fragment. If you're unhappy with the default urls 'one-folder' or 'one-file' (say, you're implementing admin pages where they're named differently), change them here. The export_url_vars will be appended.

Defined in: /web/philip/tcl/file-storage-defs.tcl

Source code:

arg_parser_for_fs_row_for_one_file $args

    set font "<nobr><font face=arial,helvetica size=-1>"
    set header_color [ad_parameter HeaderColor fs]

     if { $n_pixels_in == 0 } {
	set spacer_gif ""
     } else {
	set spacer_gif "<img src=\"/graphics/file-storage/spacer.gif\" width=$n_pixels_in height=1>"
    }

    if {$folder_p=="t"} {

        append file_html "<tr><td valign=top>&nbsp; $spacer_gif $font"
        if $links { append file_html "<a href=\"$folder_url?$export_url_vars\">" }

        append file_html "<img border=0 src=/graphics/file-storage/ftv2folderopen.gif align=top>"
        if $links { append file_html "</a> <a href=\"$folder_url?$export_url_vars\">" }

        append file_html $file_title
        if $links { append file_html "</a>" }

        append file_html "</td>
	<td align=left>&nbsp;</td>"
	
	if { $author_p } {
	    append file_html "<td align=left>&nbsp;</td>"
	}

	append file_html "
	<td align=right>&nbsp;</td>
	<td>$font &nbsp; File Folder &nbsp;</td>
	<td>&nbsp;</td>
	</tr>\n"

    } elseif {[empty_string_p $n_kbytes]} {

        append file_html "
	<tr>
	<td valign=top>&nbsp; $spacer_gif $font
	<a href=\"$file_url?$export_url_vars\">
	<img border=0 src=/graphics/file-storage/ftv2doc.gif align=top></a>
	<a href=\"$file_url?$export_url_vars\">$file_title</a>&nbsp;</td>
	<td align=left>(<a href=\"$url\">go</a>)</td>"

	if { $author_p } {
	    append file_html "<td align=left>&nbsp;</td>"
	}

	append file_html "
	<td align=right>&nbsp;</td>
	<td>$font &nbsp; URL &nbsp;</td>
	<td>$font &nbsp; $creation_date &nbsp;</td>
	</tr>\n"

    } else {

        regexp {.*\\([^\\]+)} $client_file_name match client_file_name
	regsub -all {[^-_.0-9a-zA-Z]+} $client_file_name "_" pretty_file_name

        append file_html "
	<tr>
	<td valign=top>&nbsp; $spacer_gif $font
	<a href=\"$file_url?$export_url_vars\">
	<img border=0 src=/graphics/file-storage/ftv2doc.gif align=top></a>
	<a href=\"$file_url?$export_url_vars\">$file_title</a>&nbsp;</td>
	<td align=left>$font (<a href=\"download/$version_id/$pretty_file_name\">download</a>)</td>"
	if { $author_p } {
	    append file_html "
	    <td><a href=\"$user_url?user_id=$owner_id\">$owner_name</a>&nbsp;</td>"
	}

	if { $n_kbytes == 0 } {
	    set size_string "$n_bytes bytes"
	} else {
	    set size_string "$n_kbytes KB"
	}

	append file_html "
	<td align=right>$font &nbsp; $size_string &nbsp;</td>
	<td>$font &nbsp; [fs_pretty_file_type $file_type] &nbsp;</td>
	<td>$font &nbsp; $creation_date &nbsp;</td>
	</tr>\n"

    }
    
    return $file_html


philg@mit.edu