%@ CodePage=65001 Language="VBScript"%>
<% Option Explicit %>
<% sBBSLangPage = "albums"
BBS.SetupBBS
BBS.SetScheme(0)
dictEnvironment.item("V-LOCATIONLINKS") = dictEnvironment.item("V-LOCATIONLINKS") & " -> " & dictLanguage("GLOBAL-LOCATION9") & " -> " & dictLanguage("GLOBAL-LOCATION11")
dim iAlbumID, vAlbumInfo, SQL, sOutput, iNumberOfComments
dim iNumberOfRows, iNumberOfColumns, iCounterRows, iCounterColumns, iNumberOfPhotos, iRequestPage, iPages, iTemp
dim sNavigation, iPageSize, bCanEdit, sSortDirection
iNumberOfRows=3
iNumberOfColumns=4
iPageSize = iNumberOfRows * iNumberOfColumns
' Check for permission
if not(BBS.HasPermission(PERM_ViewBBS, -1)) then response.redirect sBBSForumRoot & "/logon.asp?error=needregistration"
if not(BBS.HasPermission(PERM_AlbumView, -1)) then response.redirect sBBSForumRoot & "/restricted-page.asp"
if dictConfiguration("bENABLEPHOTOALBUMS") = 0 then response.redirect "../category-view.asp"
iAlbumID = request.querystring("albumid")
vAlbumInfo = Albums.GetAlbumInfo(iAlbumID)
if vAlbumInfo(AI_AlbumID) < 0 then response.redirect "photo-main.asp"
bCanEdit = BBS.ValidateBoolean(ucase(vAlbumInfo(AI_Username)) = ucase(sBBSUsername) or BBS.GetUserlevel(MODULE_Albums, -1) >= USERLEVEL_ModuleAdministrator)
sSortDirection = lcase(request.querystring("sortdir"))
if sSortDirection <> "asc" and sSortDirection <> "desc" then sSortDirection = "desc"
' Generate the table of photos
SQL = "select photoid, description, username from photos where albumid=" & BBS.ValidateNumeric(vAlbumInfo(AI_AlbumID)) & " order by photoid " & sSortDirection
rsMaster.open SQL, dbConnection, adOpenForwardOnly, adLockReadOnly
BBS.AddQuery(SQL)
iRequestPage = BBS.Maximum(BBS.ValidateNumeric(request.Querystring("page")), 1)
' Get in the appropriate position
iNumberOfPhotos= Albums.GetNumberOfPhotos(vAlbumInfo(AI_AlbumID))
iPages = int((iNumberOfPhotos-1) / iPageSize)+1
if not(rsMaster.EOF) then rsMaster.Move((iRequestPage-1) * iPageSize)
sNavigation = "
| "
if sSortDirection = "desc" then
sNavigation = sNavigation & "" & dictLanguage("ALBUMS-SHOWNEWESTFIRST") & " | "
sNavigation = sNavigation & "" & dictLanguage("ALBUMS-SHOWOLDESTFIRST") & ""
else
sNavigation = sNavigation & "" & dictLanguage("ALBUMS-SHOWNEWESTFIRST") & " | "
sNavigation = sNavigation & "" & dictLanguage("ALBUMS-SHOWOLDESTFIRST") & ""
end if
sNavigation = sNavigation & " | "
sNavigation = sNavigation & "" & iNumberOfPhotos & " " & dictLanguage("ALBUMS-PHOTOS") & " - " & dictLanguage("ALBUMS-PAGE")
for iTemp = 1 to iPages
sNavigation = sNavigation & " "
if iTemp = iRequestPage then
sNavigation = sNavigation & "[" & iTemp & "]"
else
sNavigation = sNavigation & "[" & iTemp & "]"
end if
sNavigation = sNavigation & " "
next
sNavigation = sNavigation & " |
|
"
sOutput = ""
if iNumberOfPhotos > 0 then sOutput = sOutput & sNavigation
if not rsMaster.EOF then
for iCounterRows = 1 to iNumberOfRows
if ((iNumberOfPhotos-((iRequestPage-1)*iPageSize)) > (iNumberOfColumns*(iCounterRows-1))) then
sOutput = sOutput & ""
for iCounterColumns = 1 to iNumberOfColumns
sOutput = sOutput & ""
if not rsMaster.EOF then
sOutput = sOutput & ""
if dictConfiguration("bASPNETRESIZE") = 0 then
sOutput = sOutput & ".value & ")
"
else
sOutput = sOutput & " & "&photoid=" & rsMaster.fields("photoid").value & ")
"
end if
iNumberOfComments = Albums.GetNumberOfComments(rsmaster.fields("photoid").value)
if vAlbumInfo(AI_AllowUserComments) = 1 and iNumberOfComments > 0 then
sOutput = sOutput & "(" & iNumberOfComments & " " & dictLanguage("ALBUMS-COMMENTS") & ") "
end if
if bCanEdit then sOutput = sOutput & "" & dictLanguage("ALBUMS-EDITCAPTION") & " "
sOutput = sOutput & BBS.ValidateField(rsMaster.fields("description").value)
rsMaster.MoveNext
else
sOutput = sOutput & " "
end if
sOutput = sOutput & " | "
next
sOutput = sOutput & "
"
end if
next
else
sOutput = sOutput & "
" & dictLanguage("ALBUMS-NOPHOTOS") & "
|
"
end if
if iNumberOfPhotos > 0 then sOutput = sOutput & sNavigation
sOutput = sOutput & "
"
dictEnvironment("V-PHOTOLIST") = sOutput
sOutput = ""
rsMaster.Close
dictEnvironment("V-ALBUMINFO") = vAlbumInfo
dictEnvironment.add "V-TITLE", dictLanguage.item("ALBUMS-TITLE")
dictEnvironment.add "C-SHOWRANDOMQUOTES", dictConfiguration("bDISPLAYBBSQUOTES")
dictEnvironment("C-CANEDIT") = bCanEdit
dictEnvironment("C-CANUPLOAD") = bCanEdit
dictEnvironment("U-EDITLINK") = "photo-controlpanel.asp?action=edit&albumid=" & dictEnvironment("V-ALBUMINFO")(AI_AlbumID)
dictEnvironment("U-UPLOADLINK") = "upload-photos.asp?albumid=" & dictEnvironment("V-ALBUMINFO")(AI_AlbumID)
if iBBSUserLevel >= USERLEVEL_SupportAdministrator then dictEnvironment.add "C-SHOWADMINLINK", 1
if request.querystring("msg") = "update" then
dictEnvironment("V-MESSAGE") = dictLanguage("ALBUMS-UPDATECOMPLETE")
end if
%>
<% Filesystem.ExecuteBBSTemplate("/photos/photo-thumbnails.asp") %>