Signature Ice - Gallery Editor  Back to main editor
<%
'categories
set rscat=objConn.execute("select * from cats order by catid")
if not rscat.eof then
category=rscat("category")
response.write " "
end if
if request.querystring("add")="cat" then
response.write "Add a new categoryThere are two boxes below, one for the name you want displayed on the gallery category page. The other is a one word filename for the new folder to keep things simple on the server. "
response.write ""
end if
'Photos
if request.querystring("edit") >"" and request.querystring("pic")="" then
set heading=objConn.execute("select * from cats where catid=" & request.querystring("edit"))
if not heading.eof then
heading=heading("category")
end if%>
Photo Uploader for <%=heading%>
<%
set cat=objConn.execute("select * from cats where catid=" & request.querystring("edit"))
set rsEdit=objConn.execute("select * from qyphotos WHERE catid=" & request.querystring("edit"))
response.write "" & cat("category") & " Photo Gallery Editor (Edit description directly in the box and/or choose a new thumbnail and click update at the bottom)"
response.write "Delete this category and all associated files "
if not rsEdit.eof then
response.write ""
response.write ""
if not rsEdit.eof then
response.write "| "
response.write " | "
end if
end if
'upload
response.write " "
end if
%>
<%
if request.form("btUpdatePhotos")>"" then
'update the photo thumbnails and description
set a_order=objConn.execute("select * from photos")
do while not a_order.eof
For Each sItem In Request.Form
if sItem="thmb" then
cID=request.form("thmb")
set getPic=objConn.execute("select * from photos where photoid=" & cID)
if not getPic.eof then
photoImage=getPic("photoImage")
end if
objConn.execute("update cats set catimage='" & photoImage & "' WHERE catid=" & request.form("cid"))
end if
if sItem="desc" & a_order("photoid") then
dID=replace(sItem,"desc","")
objConn.execute("update photos set photoDesc='" & replace(request(sItem),"'","'") & "' WHERE photoid=" & dID)
end if
Next
a_order.movenext
loop
response.redirect "gallery.asp?edit=" & request.form("cid")
end if
'delete file fso
if request.querystring("delete")>"" then
set rsd=objConn.execute("select * from qyphotos where photoid=" & request.querystring("delete"))
if not rsd.eof then
filespec=server.mappath("/" & rsd("catdir") & "/" & rsd("photoimage"))
Dim fso
Set fso = CreateObject("Scripting.FileSystemObject")
fso.DeleteFile(filespec)
objConn.execute("delete from photos where photoid=" & request.querystring("delete"))
response.redirect "gallery.asp?edit=" & request.querystring("edit")
end if
end if
'delete folder
if request.querystring("deletefolder")>"" then
set df=objConn.execute("select * from cats where catid=" & request.querystring("deletefolder"))
if not df.eof then
dim filesys2
Set filesys2 = CreateObject("Scripting.FileSystemObject")
If filesys2.FolderExists(server.mappath("\" & df("catdir"))) Then
filesys2.DeleteFolder (server.mappath("\" & df("catdir"))),true
Response.Write("Folder deleted")
End If
objConn.execute("delete from cats where catid=" & request.querystring("deletefolder"))
response.redirect "gallery.asp"
else
response.write "This folder doesn't exist "
end if
end if
'create folder
if request.form("btadd")>"" then
Dim fldr
'foldername is the name of the folder you wish to
'create passed by value into this create procedure
dim filesys, newfolder, newfolderpath
newfolderpath = server.mappath("/gallery/" & request.form("adddir"))
set filesys=CreateObject("Scripting.FileSystemObject")
If Not filesys.FolderExists(newfolderpath) Then
Set newfolder = filesys.CreateFolder(newfolderpath)
Response.Write("A new folder has been created at: " & newfolderpath)
else
response.write "this folder already exists."
End If
objConn.execute("insert into cats (catdir,category) values ('gallery/" & request.form("adddir") & "','" & request.form("addcat") & "')")
response.redirect "gallery.asp"
end if
%>
|
|