' Parameters: Directory name (relative path), object, page number, several pages per page
Public Function showfilelist (folderurl,tag,page_num,page_size,listtype)
Dim F,f1,fc,i,temp,page_count,disabledtf,tagexp
On Error Resume Next
temp = Server.MapPath (FolderUrl)
If ofso.folderexists (temp) Then
Set f = ofso.getfolder (temp)
Set FC = F.files
If listtype = "List" Then
DISABLEDTF = "Disabled"
Else
DISABLEDTF = ""
End If
Showfilelist = "<table width=" "100%" "border=" "0" "cellspacing=" "1" "cellpadding=" "1" ">" & Chr (13)
i = 0
Page_count = Int (FC. Count/page_size)
If FC. Count/page_size > Page_count Then page_count = page_count + 1
For each F1 in FC
Tagexp = ""
If tag <> "" Then
Tagexp = "onclick=" javascript Tutorial: Window.opener.document.getElementById (' & Tag & '). Value = ' "& FolderUrl & "/" & F1.name & "'; Window.close () "" "" "
Else
Tagexp = "onclick=" "Javascript:window.open" ("& FolderUrl &"/"& F1.name &"); "" "
End If
If i >= CInt (page_num-1) * page_size) and I <= CInt (page_num * page_size-1) Then
Showfilelist = showfilelist & "<tr" & Lib.defaulttrstyle (i, "defaulttr", "Defaultmod", "Defaulttdover") & ">" & Chr (13)
Showfilelist = showfilelist & "<td width=" "3%" "><input name=" "Path" "id=" "Path" "Type=" "checkbox" "Value=" "& FolderUrl &"/"& F1.name &" "onclick=" "javascript:checkdisabled (' button ', getvaluelist (' input ')" ;"" "& DISABLEDTF &"/></td> "& Chr (13)
Showfilelist = showfilelist & "<td><span style=" "Cursor:pointer" "onmouseover=" "Javascript:xmlhttppost" ( '.. /inc/xmlhttp.asp ', ' action=preview&showtype=file&filepath= ' + Escape (' "& FolderUrl &"/"& F1.name & "'), 0,0, ' preview ')" "" & Tagexp & ">" & Getfilepic (Getfileextname (F1.name) (1)) & "" & F1.name & "</span></td>" & Chr (13)
Showfilelist = showfilelist & "<td width=" "20%" "align=" "Right" ">" & GetFileInfo (FolderUrl & "/" & F1.name) (0) & "</td>" & Chr (13)
Showfilelist = showfilelist & "</tr>" & Chr (13)
ElseIf i >= CInt (page_num * page_size) Then
Exit for
End If
i = i + 1
Next
Showfilelist = showfilelist & "</table>" & Chr (13)
If FC. Count > 0 Then showfilelist = showfilelist & "<div class=" "MarginTop" ">" & Irs.pagelistbar (Page_num,page _COUNT,FC. Count,page_size, "Folderurl=" & FolderUrl & "&tag=" & Tag & "&listtype=" & ListType & " & "1) &" </div> "& Chr (13)
Else
Showfilelist = "-"
End If
If Err <> 0 Then Err.Clear
Set F = Nothing
Set FC = Nothing
end Function