17 marzo 2006 alle 21:34:29 A questo 3D cosa bisogna rispondere? Posso buttare li a caso qualche frase o, prendo spunto dal titolo?
--------------- A lavare la testa ai somari, ci si rimette l'acqua e il sapone!
20 marzo 2006 alle 18:46:39 hai ragione ma avevo fretta e non ho notato di non aver scritto nulla!!! il mio problema e quello di riscrivere la pagina images-inc nella pagina societa-inc.non so di questo codice cosa cambiare e non so se devo fare un nuovo db:
<% ' ************************************************************************ ' * ASPNUKE: Free web portal in ASP * ' ************************************************************************ ' * ASP-Nuke 2.0 Copyright (c) 2004 by Aspnuke.it Staff * ' * (staff@aspnuke.it) http://www.aspnuke.it * ' * * ' * Re-design by Enrico Musante (c) 2004 (emu@libero.it) * ' * Re-design by Frank Zalabard (c) 2004 (fsarzana@hotmail.com) * ' * * ' * ASP-Nuke 1.0, 1.1, 1.2 Copyright (c) 2002-2003 by Gaetan Bouveret * ' * (webmaster@asp-nuke.com) http://www.asp-nuke.com * ' * * ' * This program is free software. You can redistribute it and/or modify * ' * it under the terms of the GNU General Public License as published by * ' * the Free Software Foundation; either version 2 of the License, or * ' * (at your option) any later version. * ' * * ' ************************************************************************ %> <% ' Display the top images list (by date) ' IN : iTop (int) : number of results wanted ' OUT : - Sub DisplayTopImages(iTop) Dim oCn, oRs, rSQL, iLine, iLoop
Set oCn = DBConnexion(DB_MAIN)
If iTop = "" Then iTop = 0 end if rSQL = "SELECT iID, iTitle, iDate, iHits FROM images WHERE iValid=1 ORDER BY iDate DESC, iTitle"
Set oRs = DBRecordSet(oCn, rSQL) If Not oRs.EOF Then CreateTopTable "TopImages", GetTranslation("LANG_TOP") & " " & iTop & " - " & GetTranslation("LANG_IMAGES")
Response.Write "</table>" & vbCRLF CreateBottomTable "" Else CreateTable "ImagesEmpty", "", GetTranslation("LANG_EMPTY_SECTION"), "" End If
oRs.Close Set oRs = Nothing oCn.Close Set oCn = Nothing End Sub
' Display information for a specific images ' IN : iID (int) : image's id (table images, field iID) ' OUT : - Sub DisplayImage(iID, iPage) Dim oCn, oRs, rSQL Dim iCat, iPre, iPost
iCat = Request.QueryString("cat") If IsNumeric(iCat) and iCat <> "" Then iCat = CInt(iCat) Else iCat = 0 End If
Set oCn = DBConnexion(DB_MAIN)
If iCat <> 0 Then rSQL = "SELECT iID FROM images WHERE iValid=1 AND iCategory=" & iCat & " ORDER BY iDate" Else rSQL = "SELECT iID FROM images WHERE iValid=1 ORDER BY iDate" End If Set oRs = DBRecordSet(oCn, rSQL) iPre = -1 iPost = -1 While Not oRs.EOF If CLng(oRs(0)) = CLng(iID )Then oRs.MoveNext if Not oRs.EOF Then iPost = oRs(0) End if Else if iPost = -1 then iPre = oRs(0) End if oRs.MoveNext End If WEnd rSQL = "SELECT iHits, iTitle, iSourceNormal, iDescription FROM images WHERE iValid=1 AND iID=" & NormNumber(iID)
Set oRs = DBRecordSet(oCn, rSQL) If Not oRs.EOF Then rSQL = "UPDATE images SET iHits=" & oRs("iHits")+1 & " WHERE iID=" & NormNumber(iID) DBExecute oCn, rSQL
oRs.Close Set oRs = Nothing oCn.Close Set oCn = Nothing End Sub
' Display all images for one category ' IN : iCategory (int) : image's category (table images, field iCategory) ' : iPage (int) : current page ' OUT : - Sub DisplayImagesSearch(iCategory, iPage) Dim oCn, oRs, oRs2, rSQL, iLine, iNum, sTitleCat Dim iNbImages, iNbPages, iLoop, X, sSmall
iNum = 0
Set oCn = DBConnexion(DB_MAIN)
If iCategory <> "" and iCategory <> 0 Then rSQL = "SELECT cTitle FROM categories WHERE cID=" & iCategory Set oRs = DBRecordSet(oCn, rSQL) If Not oRs.EOF Then sTitleCat = " - " & Server.HTMLEncode(oRs(0)) End If rSQL = "SELECT Count(iID) FROM images WHERE iValid=1 AND iCategory=" & iCategory Set oRs = DBRecordSet(oCn, rSQL) iNbImages = oRs(0)
rSQL = "SELECT iID FROM images WHERE iValid=1 AND iCategory=" & iCategory & " ORDER BY iDate, iTitle" Set oRs = DBRecordSet(oCn, rSQL) iLoop = 0 While Not oRs.EOF And iLoop < ((iPage-1)*GLOBAL_IMAGES_PAGE) oRs.MoveNext iLoop = iLoop + 1 WEnd
If Not oRs.EOF Then CreateTopTable "ImagesByCategory", GetTranslation("LANG_IMAGES") & sTitleCat
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF iLine = 1 iLoop = 0 While Not oRs.EOF And iLoop < GLOBAL_IMAGES_PAGE rSQL = "SELECT iTitle, iSourceSmall, iSourceNormal, iHits FROM images WHERE iID=" & oRs(0) Set oRs2 = DBRecordSet(oCn, rSQL) If iNum Mod 3 = 0 Then Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF End If Response.Write " <td align=""center"" width=""33%"">" & vbCRLF Response.Write " <a href=""" & sURLPage & "?id=" & oRs(0) & "&cat=" & iCategory & "&page=" & iPage & """>" 'if there is no thumb, stretch the normal sSmall = "" & oRs2("iSourceSmall") if sSmall = "" Or sSmall = "http://" or bForceThumbGeneration then Response.Write getResizedImageTag("" & oRs2("iSourceNormal"), "", "" & oRs(0)) else if bHiddenImagesDir Then Response.Write "<img src=""" & GLOBAL_SITE_PATH & "hiddenthumb.asp?img=" & oRs(0) & """ border=""0"">" else Response.Write "<img src=""" & Server.HTMLEncode(sSmall) & """ border=""0"">" end if end if Response.Write "<br>" & Server.HTMLEncode(oRs2("iTitle")) & "</a>" Response.Write "<br><span class=""small"">" & oRs2("iHits") & " " & GetTranslation("LANG_HITS") & "</span>" Response.Write "</td>" & vbCRLF If iNum Mod 3 = 2 Then Response.Write " </tr>" & vbCRLF iLine = 1 + ((iLine-1) XOR 1) End If iNum = iNum + 1 iLoop = iLoop + 1
oRs2.Close Set oRs2 = Nothing
oRs.MoveNext WEnd Select Case (iNum Mod 3) Case 1 Response.Write "<td width=""33%""> </td><td width=""33%""> </td></tr>" & vbCRLF Case 2 Response.Write "<td width=""33%""> </td></tr>" & vbCRLF End Select
' pages managing iNbPages = iNbImagesGLOBAL_IMAGES_PAGE If iNbImages mod GLOBAL_IMAGES_PAGE Then iNbPages = iNbPages + 1 End If If iNbPages > 1 Then Response.Write " <tr class=""tablelinemain"">" & vbCRLF Response.Write " <td align=""center"" colspan=""3"">" & vbCRLF If iPage <> 1 Then Response.Write " <a href=""" & sURLPage & "?cat=" & iCategory & "&page=" & iPage-1 & """><<</a>" & vbCRLF End If For X = 1 To iNbPages If X <> iPage Then Response.Write " <a href=""" & sURLPage & "?cat=" & iCategory & "&page=" & X & """>" & X & "</a>" & vbCRLF Else Response.Write " " & X & "" & vbCRLF End If Next If iPage <> iNbPages Then Response.Write " <a href=""" & sURLPage & "?cat=" & iCategory & "&page=" & iPage+1 & """>>></a>" & vbCRLF End If Response.Write " </td>" & vbCRLF Response.Write " </tr>" & vbCRLF End If
oRs.Close Set oRs = Nothing oCn.Close Set oCn = Nothing End Sub
' Display all images for one folder ' IN : iCategory (int) : image's category (table images, field iCategory) ' : iPage (int) : current page ' OUT : - Sub DisplayImagesFolder(UplPath, iPage) Dim oRs, iLine, iNum, sTitleCat Dim iNbImages, iNbPages, iLoop, X, sSmall Dim lngWidth, lngHeight, lngDepth, strImageType Dim fso, fld, fil, UpPath
iNum = 0 UpPath = GLOBAL_SITE_PATH & UplPath & "/" Set fso = Server.CreateObject("Scripting.FileSystemObject") if fso.FolderExists(Server.MapPath(UpPath)) Then Set fld = fso.GetFolder(Server.MapPath(UpPath))
set oRs = Server.CreateObject("ADODB.Recordset") oRs.Fields.Append "nome", 200, 255 ' adVarChar oRs.Fields.Append "dimensione", 3, 4 ' smallint oRs.Fields.Append "misure", 200, 255 ' adVarChar oRs.Fields.Append "data", 7 ' Date oRs.Open iLoop = 0 For Each fil In fld.files strImageType = lcase(fso.GetExtensionName(fil.path)) If instr(imgExtensions, "*." & strImageType) > 0 Then If gfxSpex(fil.path, lngWidth, lngHeight, lngDepth, strImageType) Then oRs.AddNew oRs("nome") = fil.name oRs("dimensione") = fil.size oRs("misure") = lngWidth & "X" & lngHeight & " - " & lngDepth & " colors - " & fil.size & " bytes" oRs("data") = fil.DateLastModified iLoop = iLoop + 1 End If End If Next
Set fld = nothing iNbImages = iLoop oRs.Sort = "nome ASC" iLoop = 0 While Not oRs.EOF And iLoop < ((iPage-1)*GLOBAL_IMAGES_PAGE)
Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF iLine = 1 iLoop = 0 While Not oRs.EOF And iLoop < GLOBAL_IMAGES_PAGE If iNum Mod 3 = 0 Then Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF End If Response.Write " <td align=""center"" width=""33%"">" & vbCRLF Response.Write " <a href=""Java_Script:openNormalPicture('" & GLOBAL_SITE_URL & UpPath & oRs("nome") & "')"">" 'if there is no thumb, stretch the normal Response.Write getResizedImageTag(GLOBAL_SITE_URL & UpPath & oRs("nome"), "", "")
Response.Write "<br>" & Server.HTMLEncode(oRs("nome")) & "</a>" Response.Write "<br><span class=""small"">" & oRs("misure") & "</span>" Response.Write "</td>" & vbCRLF If iNum Mod 3 = 2 Then Response.Write " </tr>" & vbCRLF iLine = 1 + ((iLine-1) XOR 1) End If iNum = iNum + 1 iLoop = iLoop + 1 oRs.MoveNext WEnd oRs.close set oRs = nothing Select Case (iNum Mod 3) Case 1 Response.Write "<td width=""33%""> </td><td width=""33%""> </td></tr>" & vbCRLF Case 2 Response.Write "<td width=""33%""> </td></tr>" & vbCRLF End Select
' pages managing iNbPages = iNbImagesGLOBAL_IMAGES_PAGE If iNbImages mod GLOBAL_IMAGES_PAGE Then iNbPages = iNbPages + 1 End If If iNbPages > 1 Then Response.Write " <tr class=""tablelinemain"">" & vbCRLF Response.Write " <td align=""center"" colspan=""3"">" & vbCRLF If iPage <> 1 Then Response.Write " <a href=""" & sURLPage & "?fld=" & UplPath & "&page=" & iPage-1 & """><<</a>" & vbCRLF End If For X = 1 To iNbPages If X <> iPage Then Response.Write " <a href=""" & sURLPage & "?fld=" & UplPath & "&page=" & X & """>" & X & "</a>" & vbCRLF Else Response.Write " " & X & "" & vbCRLF End If Next If iPage <> iNbPages Then Response.Write " <a href=""" & sURLPage & "?fld=" & UplPath & "&page=" & iPage+1 & """>>></a>" & vbCRLF End If Response.Write " </td>" & vbCRLF Response.Write " </tr>" & vbCRLF End If
' Display a navigation bar for images ' IN : - ' OUT : - Sub DisplayFolderNavigation(UpPath) Dim iLine, iNum, fld, fol, fso, parent
iNum = 0 if instrrev(UpPath, "/") > 0 then CreateTopTable "ImageFolder", GetTranslation("LANG_BACK") Response.Write "<a href=""" & sURLPage & "?fld=" & left(UpPath,instrrev(UpPath, "/")-1) & """>" & GetTranslation("LANG_BACK") & "</a>" & vbCRLF CreateBottomTable "" end if
iLine = 1 iNum = 0 Set fso = Server.CreateObject("Scripting.FileSystemObject") if fso.FolderExists(Server.MapPath(UpPath)) Then Set fld = fso.GetFolder(Server.MapPath(UpPath)) For Each fol In fld.Subfolders 'skip folders beginning with "_" if left(fol.name,1) <> "_" then 'open table on first folder if iNum = 0 then CreateTopTable "SearchImagesFolders", UpPath & " - " & GetTranslation("LANG_SUB_CATEGORIES") Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF end if If iNum mod 2 = 0 Then Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF end if Response.Write " <td width=""50%""><a href=""" & sURLPage & "?fld=" & UpPath & "/" & fol.name & """>" & fol.name & "</td>" & vbCRLF If iNum mod 2 = 1 Then Response.Write " </tr>" & vbCRLF iLine = 1 + ((iLine-1) XOR 1) End If
iNum = iNum + 1 end if Next Set fol = nothing if iNum > 0 then If iNum mod 2 = 1 Then Response.Write " <td> </td>" & vbCRLF Response.Write " </tr>" & vbCRLF End If Response.Write "</table>" & vbCRLF CreateBottomTable "" end if end if End Sub
' Display a navigation bar for images ' IN : iCategoryParent (int) : image's parent category (table categories, field cParent) ' OUT : - Sub DisplayImagesNavigation(iCategoryParent) Dim oCn, oRs, oRs2, rSQL, iLine, iNum, sItems
Set oCn = DBConnexion(DB_MAIN)
If iCategoryParent = "" Then iCategoryParent = 0 end if
If iCategoryParent <> 0 Then rSQL = "SELECT cId, cParent, cTitle, cDescription, cImage FROM categories WHERE cID=" & iCategoryParent Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then CreateTopTable "ImageCategory", CodeMessage(oRs("cTitle"), True) If oRs("cImage") <> "" Then Response.Write "<img src=""" & Server.HTMLEncode(oRs("cImage") & "") & """ border=""0"" align=""left"">" End If Response.Write CodeMessage(oRs("cDescription"), False) Response.Write "<br> <br><a href=""" & sURLPage & "?cat=" & oRs("cParent") & """>" & GetTranslation("LANG_BACK") & "</a>" & vbCRLF CreateBottomTable "" End If oRs.Close Set oRs = Nothing End If
rSQL = "SELECT cId, cTitle, cImage FROM categories WHERE cType=" & CATEGORY_TYPE_IMAGES & " and cParent=" & iCategoryParent & " ORDER BY cTitle" Set oRs = DBRecordSet(oCn, rSQL)
If Not oRs.EOF Then If iCategoryParent = 0 Then CreateTopTable "SearchImagesCategories", GetTranslation("LANG_IMAGES") & " - " & GetTranslation("LANG_CATEGORIES") Else CreateTopTable "SearchImagesCategories", GetTranslation("LANG_IMAGES") & " - " & GetTranslation("LANG_SUB_CATEGORIES") End If Response.Write GLOBAL_SITE_SUBTABLE & vbCRLF iLine = 1 iNum = 0
While Not oRs.EOF If iNum mod 2 = 0 Then Response.Write " <tr class=""tableline" & iLine & """>" & vbCRLF end if rSQL = "SELECT Count(iID) FROM images WHERE iValid=1 AND iCategory=" & oRs("cID") Set oRs2 = DBRecordSet(oCn, rSQL) sItems = iif(oRs2(0)>0,"(" & oRs2(0) & ")","")
If iNum mod 2 = 1 Then Response.Write " </tr>" & vbCRLF iLine = 1 + ((iLine-1) XOR 1) End If
iNum = iNum + 1 oRs.MoveNext WEnd If iNum mod 2 = 1 Then Response.Write " <td> </td>" & vbCRLF Response.Write " </tr>" & vbCRLF End If Response.Write "</table>" & vbCRLF CreateBottomTable "" End If
oRs.Close Set oRs = Nothing oCn.Close Set oCn = Nothing End Sub
' Display a line to let users post their images ' IN : iCat : download category ' OUT : - Sub DisplayAddImages(iCat) If sPseudo <> "" Then CreateTable "AddMemberImages", "", "<a href=""" & GLOBAL_SITE_IMAGES_PAGE & "?do=new&cat=" & iCat & """>" & GetTranslation("LANG_ADD") & " - " & GetTranslation("LANG_IMAGES") & "</a>", "" End If End Sub
' Display edit member's image's form ' IN : iCat (int) : image's category (table images, field iCategory) ' OUT : - Sub EditMemberImage(iCat) Dim oCn, oRs, rSQL, oRs2
If sPseudo <> "" Then Set oCn = DBConnexion(DB_MAIN)
rSQL = "SELECT cID, cTitle FROM categories WHERE cType=" & CATEGORY_TYPE_IMAGES Set oRs = DBRecordSet(oCn, rSQL)
' Process actions ' IN : - ' OUT : - Sub DoImagesPage() If Request.Form("do") = "add" and Request.Form("iTitle") <> "" Then If AddMemberImage(Request.Form("iTitle"), Request.Form("iDate"), Request.Form("iDescription"), Request.Form("iSourceSmall"), Request.Form("iSourceNormal"), 0, Request.Form("iCategory"), Request.Form("iVersion")) Then sInfoPage = GetTranslation("LANG_IMAGES") & " - " & GetTranslation("LANG_ADD_SUCCESS") Else sInfoPage = GetTranslation("LANG_IMAGES") & " - " & GetTranslation("LANG_ADD_ERROR") End If End If End Sub
' Display page ' IN : - ' OUT : - Sub DisplayImagesPage() Dim iCat, iPage, iImage Dim sFolder
iCat = Request.QueryString("cat") If IsNumeric(iCat) and iCat <> "" Then iCat = CInt(iCat) Else iCat = 0 End If
iPage = Request.QueryString("page") If IsNumeric(iPage) and iPage <> "" Then iPage = CInt(iPage) Else iPage = 1 End If
iImage = Request.QueryString("id")
sFolder = Request.QueryString("fld") if instr(sFolder, "..") > 0 then sFolder = "" end if If sFolder <> "" Then DisplayFolderNavigation sFolder DisplayImagesFolder sFolder, iPage Else DisplayImagesNavigation(iCat)
If iImage <> "" Then DisplayImage(iImage), iPage ElseIf iCat <> 0 Then If Request.QueryString("do") = "new" Then EditMemberImage(iCat) Else DisplayAddImages(iCat) DisplayImagesSearch iCat, iPage End If Else DisplayTopImages GLOBAL_IMAGES_TOP End If End If End Sub %>
20 marzo 2006 alle 19:52:10 Dipende da cosa deve visualizzare la pagina societa-inc.asp, deve visualizzare immagini? Penso di sì, ma, perchè riscrivere un codice che c'è già? Perchè non organizzare la galleria immagini per argomento e al massimo scrivere qualche riga codice che richiami gli argomenti trattati? O forse non ho capito io cosa intendevi. Ciauzz Dj
--------------- A lavare la testa ai somari, ci si rimette l'acqua e il sapone!