codice:
<%
Dim CurFile, PopFileShowSub, ShowPic, PictureNo
Dim strPathInfo, strPhysicalPath
Dim intTotPics, intPicsPerRow, intPicsPerPage, intTotPages, intPage, strPicArray()
intPicsPerRow = 2
intPicsPerPage = 10
intPage = CInt(Request.QueryString("Page"))
If intPage = 0 Then
intPage = 1
End If
CurFile = "foto.asp"
PopFile = "visual.asp"
%>
<link rel="stylesheet" type="text/css" href="style.css">
<style type="text/css">
BODY {
SCROLLBAR-FACE-COLOR: #FFFFFF; SCROLLBAR-HIGHLIGHT-COLOR: #FFFFFF; SCROLLBAR-SHADOW-COLOR: #DFE7F6; SCROLLBAR-3DLIGHT-COLOR: #A0C2EC; SCROLLBAR-ARROW-COLOR: #CC0000; SCROLLBAR-TRACK-COLOR: #FFFFFF; SCROLLBAR-DARKSHADOW-COLOR: #F0F8FF;
}
</style>
<script language="JavaScript">
<!--
function jumppage(sel)
{
var i = sel.selectedIndex
self.location.href = sel.options[i].value
}
// -->
</script>
<script language="JavaScript">
<!-- hide from JavaScript-challenged browsers
function openGalleryWindow(url) {
if (document.all)
var xMax = screen.width, yMax = screen.height;
else
if (document.layers)
var xMax = window.outerWidth, yMax = window.outerHeight;
else
var xMax = 800, yMax=600;
var xOffset = (xMax - 200)/2, yOffset = (yMax - 200)/2;
var xOffset = 0, yOffset = 0;
popupWin = window.open(url,'new_page','width=700,height=535,screenX='+xOffset+',screenY='+yOffset+',top='+yOffset+',left='+xOffset+',scrollbars=auto,toolbars=no,menubar=no,resizable=yes')
}
// done hiding -->
</script>
<link href="../txt.css" rel="stylesheet" type="text/css">
<title>Foto</title>
<body leftmargin="20" topmargin="3">
<table width="550" border="1" cellpadding="0" cellspacing="0" bordercolor="#BBDAFD">
<tr>
<td valign="top">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td bgcolor="#BBDAFD" class="txt12spazio1">[img]../immagini/titoli/eventi.jpg[/img]</td>
</tr>
<tr>
<table border="0" cellpadding="0" cellspacing="0" width="550px" id="AutoNumber1">
<tr>
<td align="left">
<form action=<%=PopFile%> method="POST">
<span class="txt12">
Per visualizzare gli eventi selezionare quello desiderato dal seguente menu</span>
<select name="go" style='width:250px; background-color:#F0F8FF;' size=1 class="form" onChange="jumppage(this);">
<%
ShowSub = request("ShowSub")
ShowPic = request("ShowPic")
strPathInfo = Request.ServerVariables("PATH_INFO")
strPhysicalPath = Server.MapPath(strPathInfo)
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.GetFile(strPhysicalPath)
Set objFolder = objFile.ParentFolder
Set objFolderContents = objFolder.Files
For each Folder in objFolder.SubFolders
If Left(Folder.Name,1)<>"_" Then
Response.write "<option "
If ShowSub=Folder.Name Then
Response.Write "selected "
End if
Response.Write"value='" & CurFile & "?ShowSub="
Response.Write(Replace(Folder.Name, " ", "%20"))
response.write "'>"
Response.Write(Folder.Name & "</option>")
If ShowSub <= " " Then
ShowSub = Folder.Name
End if
End if
Next
Set objFSO = Nothing
%>
</select></h3>
</form>
</td>
</tr>
</table>
<%
If ShowPic > " " then
ShowPic = Replace(ShowPic, " ", "%20")
Response.Write "<a href='JavaScript:history.go(-1)'>[img]" & ShowPic & "[/img]
<font face=""verdana"" size=""1"">Indietro</a>"
Else
%>
<table border="0" cellpadding="0" cellspacing="4" width="550px" id="AutoNumber1">
<tr>
<%
strPhysicalPath = Server.MapPath(".\" & ShowSub)
If ShowSub > " " then
ShowSub = Replace(ShowSub, " ", "%20")
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder(strPhysicalPath)
Set objFolderContents = objFolder.Files
'Get the number of pictures in the subdirectory
intTotPics = 0
For Each objFileItem in objFolderContents
If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
intTotPics = intTotPics + 1
End if
Next
'Get the total number of pages in the subdirectory
If (intTotPics/intPicsPerPage) = (int(intTotPics/intPicsPerPage)) Then
intTotPages = int(intTotPics/intPicsPerPage)
Else
intTotPages = int(intTotPics/intPicsPerPage)+1
End If
Redim strPicArray(2,intTotPics)
'Store picture file names in an array
x = 0
For Each objFileItem in objFolderContents
If Ucase(Right(objFileItem.Name,4))=".GIF" OR Ucase(Right(objFileItem.Name,4))=".JPG" THEN
strPicArray(0,x) = objFileItem.Name
strPicArray(1,x) = Cstr(int(x/intPicsPerPage)+1)
x = x + 1
End if
Next
'Determine if there are multiple pages and if so, display page numbers.
If intTotPages > 1 Then
Response.Write "<td class='txt12' colspan='" & intPicsPerRow & "' align='left'>Pagina:"
For x = 1 to intTotPages
If x = intPage Then
Response.Write "<font color='#CC0000'>" & x & "</font>"
Else
Response.Write "" & x & ""
End If
Next
Response.Write "</td>"
Response.Write "</tr><tr><td></td></tr><tr>"
End If
For x = 0 to UBound(strPicArray,2)-1
If CInt(strPicArray(1,x)) = intPage Then
ShowPic = Replace(strPicArray(0,x), " ", "%20")
Response.write "<td align='center'><a class='txt10' href=""Javascript:openGalleryWindow('" & PopFile & "?ShowPic=" & ShowSub & "/" & ShowPic & "')"""
Response.write "
"
Response.Write("[img]" & ShowSub & "/" & strPicArray(0,x) & "[/img] ")
Response.Write("
" & Mid(strPicArray(0,x),1,Len(strPicArray(0,x))-4) & "")
Response.write "
</a></td>" & vbcrlf
PictureNo = PictureNo + 1
If PictureNo=intPicsPerRow Then
Response.write "</tr><tr>"
PictureNo = 0
End if
End If
Next
Set objFSO = Nothing
End if
%>
</tr>
</table>
</table>
</table>
<%
End if
%>
</html>