Created
August 30, 2010 23:46
-
-
Save mhayes/558245 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
component output="no" { | |
public function fileAnchorTag( | |
required relativePath, | |
displayName, | |
fileType) { | |
// determine file details | |
var fileInfo = GetFileInfo(ExpandPath(relativePath)); | |
// set default params | |
param name="arguments.fileType", default=""; | |
param name="arguments.displayName", default="#fileInfo.name#"; | |
// fetch file size | |
var fileSizeInKb = Round(fileInfo.size * 0.0009765625); | |
// generate link | |
var linkTag = "<a href='#arguments.relativePath#'>#displayName#</a>"; | |
var infoText = "#fileSizeInKb# kb"; | |
if(arguments.fileType neq "") { | |
infoText = "#arguments.fileType# #infoText#"; | |
} | |
return "#linkTag# <em>(#infoText#)</em>"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment