Come posso fare per ordinare i file in base alla data di aggiornamento!!!
...qui sotto troverete il codice che sto usando...dove i file sono ordinati in base all alfabeto:
..dimenticavo...come verete sempre nel codice ...c'è la funzione...datecreated...che mi restituisce nella pagina la data (giorno ed ora )di inserimento del file...bene come faccio ad avere solo la data???
..vi ringrazio anticipatamente....!!!
<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<!--#Include File="imginc.asp"-->
<!--#Include File="config.asp"-->
<%
'## Declaring variables
dim aDir, strDir, strPath, strCmd, strFolder, strName, strFile, strPage, pagenum
dim fso, MyFolder, FileObject, MyFiles, hidden, strStyle, sTemp, strImage
dim intFiles, intTotal, intTotalFiles, intTable, intImages, intOS, iCount
dim a, b, i, k, x, y, z
strDir=cStr(request.QueryString("dir"))
strPath=Server.MapPath("images\" & strDir)
strCmd = request.QueryString("cmd")
strFolder = request.QueryString("folder")
intTable=int(request.QueryString("size"))
strPage=request.QueryString("page")
'## Select the default view (details / thumbs)
if strPage="" then strPage="thumbs"
strFile=cStr(request.QueryString("file"))
strDir=cStr(request.QueryString("dir"))
strPath=Server.MapPath("images\" & strDir)
i=strPath & "\" & strFile
strName=request.QueryString("name")
'## Check OS in order to disable unavailable features in Linux
if left(Request.ServerVariables("ASP_OS"), 5)="Linux" then intOS=1
'## Set the table width to 700 as default (5 images)
if intTable="" or intTable=0 or isNull(intTable)=true then intTable=500
intImages=round(intTable/106-2)
'## Total files per page
intTotalFiles=int(intImages*intRows)
'## Remove ../ and \ from the folder string
if left(strDir, 3)="../" OR left(strDir, 3)="..\" then strDir=""
if right(strDir, 1)="\" then strDir = mid(strDir,1, len(strDir)-1)
'## Paging
PageNum = request.querystring("pagenum")
If PageNum="" or int(PageNum)=1 Then PageNum=1
iCount = (PageNum -1) * intTotalFiles
Set fso=Server.CreateObject("Scripting.FileSystemObject")
%>
<head>
<title>Image Archive</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script language="JavaScript" src="java.js" type="text/javascript"></script>
<!--#Include File="style2.asp"-->
<%if strPage<>"slide" then%>
<style type="text/css">
<!--
.Stile2 {font-size: 10}
.Stile3 {font-size: 10px}
-->
</style>
</head>
<body>
<form name="form" id="form" method="post" action="default.asp?page=<%=strPage%>&dir=<%=strDir%>">
<%end if
if strPage="details" OR strPage="thumbs" then
Set MyFolder = fso.GetFolder(strPath)
Set MyFiles = MyFolder.Files
%>
<table class="table" width="500" border="0" cellpadding="0">
<tr class="title">
<td width="346" class="Stile3"><span class="Stile2"> Path: <strong onmouseover="a('Change directory');return true" onmouseout="b()">
<%response.write "<a href='?page="&strPage&"&size=" & intTable &"'>images:</a> \ "
'## Create an array in order to split the dir string for the menu
a=split(strDir, "\", -1)
for i=0 to uBound(a)
if i=0 then
aDir=cStr(a(0))
else
aDir=aDir & "\" & a(i)
end if
b=a(i)
response.write "<a href='?page="&strPage&"&dir=" & aDir & "&size=" & intTable &"'>" & a(i) & "</a>"
if not uBound(a)=i then response.write " \ "
next
%>
</strong></span></td>
<td width="62" class="Stile3"> </td>
<td width="79" class="Stile3"> </td>
<td width="122" class="Stile3"> </td>
<td width="79" align="center"><span class="Stile2"><a onmouseover="a('List Details');return true" onmouseout="b()" onclick="" href="?page=details&dir=<%=strDir%>"><img src="icons/fileinfo.gif" alt="List Details" width="20" height="20" border="0" align="middle" /></a> <a onmouseover="a('List Thumbnails');return true" onmouseout="b()" href="?page=thumbs&dir=<%=strDir%>"><img src="icons/find.gif" alt="List Thumbnails" width="20" height="20" border="0" align="middle" /></a> <a onmouseover="a('Slideshow');return true" onmouseout="b()" onclick="slideshow('<%=replace(strDir, "\", "/")%>')" href="#"><img src="icons/slideshow.gif" alt="Slideshow" width="20" height="20" border="0" align="middle" /></a></span></td>
</tr>
<tr class="title">
<td width="346" class="Stile3"><span class="Stile2"> Filename</span></td>
<td width="62" class="Stile3"><span class="Stile2"> Size</span></td>
<td colspan="2" class="Stile3"><span class="Stile2"> Date Created</span></td>
<td width="79" align="center"><span class="Stile2">
<%if blnSecurity=true then response.write "Actions"%>
</span></td>
</tr>
<%if strDir<>"" then %>
<tr>
<td colspan="5"><span class="Stile2"> <a onmouseover="a('Parent directory');return true" onmouseout="b()" href="?page=<%=strPage%>&dir=<%=replace(strDir, myfolder.name, "")%>&size=<%=intTable%>"><img src="icons/_UP1LEVEL.GIF" width="16" height="16" border="0" align="middle" alt="" />
..</a></span></td>
</tr>
<%strStyle=2
end if
'## If the folder is hidden then hide the content
Set hidden = fso.GetFolder(strPath)
if hidden.attributes=18 AND blnLogin=false then%>
<tr>
<td colspan="5"><span class="Stile2"> <span class="Stile3">The content of this folder is hidden. Please login
in order to view it.</span></span></td>
</tr>
<tr>
<td colspan="5"> </td>
</tr>
<%
'## Display the folder content
else
y=0
For Each i in MyFolder.subfolders
if i.attributes<>18 OR (blnLogin=true AND i.attributes=18) then
y=y+1
strStyle = strStyle + 1
If strStyle > 1 Then strStyle = 0%>
<tr class="Stile3" <%if strstyle=0 then response.write ("class=""list""")%>> <% if strDir<>"" then
sTemp=strDir & "\" & i.name
else
sTemp=i.name
end if%>
<td width="346"><span class="Stile2">
</span> <%
'## Show different folder icon if the folder is hidden
if i.attributes=18 then%> <img src="icons/icon_folder_locked.GIF" width="16" height="16" border="0" align="middle" alt="" /> <%else%> <img src="icons/_FOLDER.GIF" width="16" height="16" border="0" align="middle" alt="" /> <%end if%> <a onmouseover="a('Change directory');return true" onmouseout="b()" href="?page=<%=strPage%>&dir=<%=sTemp%>&size=<%=intTable%>" target="_self">
<%=i.name%></a></td>
<td align="right" width="62"> <%=formatnumber(i.Size/1024, 2)%> KB<span class="Stile2"> </span></td>
<td colspan="2"><span class="Stile3"><%=i.DateCreated%></span></td>
<td width="79"><span class="Stile2">
<%if blnSecurity=true then%>
<img src="icons/copy.gif" alt="Copy folder" width="19" height="19" align="middle" style="cursor:pointer" onclick="PromptCopy('','<%=strDir%>', '<%=i.name%>')" onmouseover="a('Copy folder'); return true" onmouseout="b()" />
<img src="icons/ren.gif" alt="Rename folder" width="20" height="20" align="middle" style="cursor:pointer" onclick="PromptRename('','<%=strDir%>', '<%=i.name%>')" onmouseover="a('Rename folder'); return true" onmouseout="b()" />
<img src="icons/del.gif" alt="Delete folder" width="20" height="20" align="middle" style="cursor:pointer" onclick="PromptDelete('','<%=strDir%>', '<%=i.name%>')" onmouseover="a('Delete folder'); return true" onmouseout="b()" />
<%end if%>
</span></td>
</tr>
<%
end if
next
if strPage="thumbs" then
else
y=0
'## Loop through all the files in the current folder
For Each i in MyFolder.files
if FileType(i.name)=true then
'## Used to count files in folder
y=y+1
'## change background color on 0
strStyle = strStyle + 1
If strStyle > 1 Then strStyle = 0%>
<tr <%if strstyle=0 then response.write ("class=""list""")%>>
<td width="346"><span class="Stile2"> <a onmouseover="a('Show image');return true" onmouseout="b()" href="javascript:Preview('<%=i.name%>', '<%=replace(strDir, "\", "/")%>');" target="_self">
<%if intOS<>1 then%>
<img src="icons/<%=left(i.type,3)%>.GIF" width="16" height="16" border="0" align="middle" alt="" />
<%end if%>
<%=i.name%></a></span></td>
<td align="right" width="62"><span class="Stile2"><%=formatnumber(i.Size/1024, 2)%> KB </span></td>
<td colspan="2"><span class="Stile2"><%=i.DateCreated%></span></td>
<td width="79"><span class="Stile2">
<%if blnSecurity=true then%>
<img src="icons/copy.gif" alt="Copy image" width="19" height="19" align="middle" style="cursor:pointer" onclick="PromptCopy('<%=i.name%>','<%=strDir%>','')" onmouseover="a('Copy file'); return true" onmouseout="b()" />
<img src="icons/ren.gif" alt="Rename image" width="20" height="20" align="middle" style="cursor:pointer" onclick="PromptRename('<%=i.name%>','<%=strDir%>','')" onmouseover="a('Rename file'); return true" onmouseout="b()" />
<img src="icons/del.gif" alt="Delete image" width="20" height="20" align="middle" style="cursor:pointer" onclick="PromptDelete('<%=i.name%>','<%=strDir%>','')" onmouseover="a('Delete file'); return true" onmouseout="b()" />
<%end if%>
</span></td>
</tr>
<%
end if
next
end if%>
</table>
</form><%end if
if strPage="thumbs" AND (hidden.attributes<>18 OR blnLogin=true) then
Set hidden = Nothing %>
<table class="table" border="0" cellspacing="0" cellpadding="5">
<tr><%
Set MyFolder = fso.GetFolder(strPath)
For Each i in MyFolder.files
x=x+1
if FileType(i.name)<>true then
x=x-1
z=z+1 'Images to exclude
k=k+i.size
end if
if iCount < x AND FileType(i.name)=true then
strImage = "images/"
if strDir="" then
strImage = strImage & i.name
else
strImage = strImage & strDir & "/" & i.name
end if%>
<td align="center" valign="bottom"><a onmouseover="a('Show image');return true" onmouseout="b()" href="javascript:Preview('<%=i.name%>', '<%=replace(strDir, "\", "/")%>')" target="_self"><% if blnComponent=false then
response.write "<img src="""&strImage&""" border=""0"" "& ImageResize(Server.MapPath(strImage) , 120, 120)&" alt="""" />"
else
response.write "<img src=""img.asp?dir="&strDir&"&file="&i.name&""" border=""0"" alt="""" />"
end if%><br /><%if blnFileName=true then response.write left(i.name, len(i.name)-4)%></a><%
if blnSecurity=true then%><br />
<img src="icons/copy.gif" alt="Copy image" width="19" height="19" align="middle" style="cursor:pointer" onclick="PromptCopy('<%=i.name%>','<%=strDir%>','')" onmouseover="a('Copy file'); return true" onmouseout="b()" />
<img src="icons/ren.gif" alt="Rename image" width="20" height="20" align="middle" style="cursor:pointer" onclick="PromptRename('<%=i.name%>','<%=strDir%>','')" onmouseover="a('Rename file'); return true" onmouseout="b()" />
<img src="icons/del.gif" alt="Delete image" width="20" height="20" align="middle" style="cursor:pointer" onclick="PromptDelete('<%=i.name%>','<%=strDir%>','')" onmouseover="a('Delete file'); return true" onmouseout="b()" />
<%end if%></td>
<%
end if '---
If x Mod intImages = 0 Then Response.Write "</tr><tr>"
If x >= iCount + intTotalFiles then
Exit For
End if
next%>
<td></td></tr>
</table>
<br /><%
intFiles=int(MyFolder.Files.Count-z)
if intTotalFiles<intFiles then%>
<table border="0" cellpadding="0" class="table">
<tr align="right">
<td colspan="4"> <%
'######### LEFT ########
If Clng(pagenum) > 1 Then
Response.Write "[<a href='?page="&strPage&"&dir=" & replace(aDir, " ", "%20") & "&size=" & intTable & "&pagenum=1'><<</a>]"
Else
Response.Write "[<<]"
End If
response.write " "
If Clng(pagenum) > 1 Then
Response.Write "[<a href='?page="&strPage&"&dir=" & replace(aDir, " ", "%20") & "&size=" & intTable & "&pagenum=" & pagenum - 1 & "'><</a>]"
Else
Response.Write "[<]"
End If
'######### NUM ########
intTotal = MyFolder.Files.Count
y = round(intTotal/intTotalFiles+0.4)
For x = 1 to y
if x=int(PageNum) then
Response.Write " <strong><a href='?page="&strPage&"&dir=" & replace(aDir, " ", "%20") & "&size=" & intTable & "&pagenum=" & x & "'>" & x & "</a></strong> "
if x<>y then response.write "|"
else
Response.Write " <a href='?page="&strPage&"&dir=" & replace(aDir, " ", "%20") & "&size=" & intTable & "&pagenum=" & x & "'>" & x & "</a> "
if x<>y then response.write "|"
end if
Next
'######### RIGHT ########
If Clng(pagenum) < Clng(y) Then
Response.Write "[<a href='?page="&strPage&"&dir=" & replace(aDir, " ", "%20") & "&size=" & intTable & "&pagenum=" & pagenum + 1 & "'>></a>] "
Else
Response.Write "[>]"
End If
If Clng(pagenum) < Clng(y) Then
Response.Write "[<a href='?page="&strPage&"&dir=" & replace(aDir, " ", "%20") & "&size=" & intTable & "&pagenum=" & round(intTotal/intTotalFiles+0.4) & "'>>></a>] "
Else
Response.Write " [>>]"
End If
response.write "<br /><br />"
end if
%> </td>
</tr>
</table><%end if
if blnStatusBar=true then%>
<table border="0" cellpadding="0" class="title table">
<tr>
<td width="150"> <%=intFiles%> object(s) </td>
<td width="198" align="right"> <%=formatnumber(int(MyFolder.Size-k)/1024, 2) & " KB"%> </td>
<td> </td>
</tr>
</table>
<%end if%>
<br />
<%elseif strPage="slide" then%>
<script>
document.title='Press F11 for fullscreen'
var Pic = new Array()
<%
x=-1
Set MyFolder = fso.GetFolder(strPath)
For Each i in MyFolder.files
x=x+1
response.write ("Pic[" & x & "] = 'images/" & strDir & "/" & i.name & "';") & vbCrLf
next
%>
var t
var j = -1
var p = Pic.length
a = new Image()
function runSlideShow(){
j = j+1
if (j > (p-1)) j=0
document.images.SlideShow.src = Pic[j]
t = setTimeout('runSlideShow()', <%=intTimer%>)
}
</script><body onLoad="runSlideShow()" leftmargin="0px" rightmargin="0px" topmargin="0px" bottummargin="0px" marginheight="0px" marginwidth="0px">
<img alt="Click to close" name='SlideShow' width="100%" border="0" align="absmiddle" id="SlideShow" onclick="window.close()" />
<%end if%>
</body>
</html><%
if strCmd="delete" then '------------------------------------------------ DELETE FILE
if strFile<>"" OR strFolder<>"" AND blnSecurity=true then
if strFile<>"" then
Set fileObject = fso.GetFile(strPath & "\" & strFile)
elseif strFolder<>"" then
Set fileObject = fso.GetFolder(strPath & "\" & strFolder & "\")
end if
fileObject.Delete
Set fileObject = Nothing
Set fso = Nothing
end if
response.redirect ("default.asp?page="&strPage&"&dir=" & strDir)
elseif strCmd="copy" then '------------------------------------------------ COPY FILE
if strFile<>"" OR strFolder<>"" AND blnSecurity=true then
Set fso = CreateObject("Scripting.FileSystemObject")
if strFolder="" then
if fso.FileExists (strPath & "\" & "copy of " & strFile)=false then
Set fileObject = fso.GetFile(strPath & "\" & strFile)
fileObject.Copy (strPath & "\" & "copy of " & strFile),false
end if
elseif strFolder<>"" then
if fso.FolderExists (strPath & "\" & "copy of " & strFolder)=false then
Set fileObject = fso.GetFolder(strPath & "\" & strFolder & "\")
fileObject.Copy (strPath & "\" & "copy of " & strFolder),false
end if
end if
Set fileObject = Nothing
Set fso = Nothing
end if
response.redirect ("default.asp?page="&strPage&"&dir=" & strDir)
elseif strCmd="rename" then '--------------------------------------------- RENAME FILE
if strFile<>"" OR strFolder<>"" AND blnSecurity=true then
Set fso = CreateObject("Scripting.FileSystemObject")
if strFolder="" then
if fso.FileExists (strPath & "\" & strName)=false then
fso.MoveFile strPath & "\" & strFile, strPath & "\" & strName
end if
elseif strFolder<>"" then
if fso.FolderExists (strPath & "\" & strName)=false then
fso.MoveFolder strPath & "\" & strFolder, strPath & "\" & strName
end if
end if
Set fileObject = Nothing
Set fso = Nothing
end if
response.redirect ("default.asp?page="&strPage&"&dir=" & strDir)
end if
'## What files will be displayed
function FileType(strFile)
strFile = lcase(right(strFile, 3))
select case strFile
case "jpg" strFile=true
case "gif" strFile=true
case "png" strFile=true
case "bmp" strFile=true
case "peg" strFile=true 'jpeg
case "jpe" strFile=true 'jpeg
end select
FileType=strFile
end function
Set MyFolder = Nothing
Set fso = Nothing
%>
<!-- Copyright 2005 Nivcin Development -->