<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%> <% Option Explicit %> <% '----------------------------------------------------------------------------------------------- 'VARIABLES '----------------------------------------------------------------------------------------------- dim THUMBNAILS_PER_PAGE, SLIDESHOW_DELAY THUMBNAILS_PER_PAGE = 4 ' Maximum 16, minumum 4 SLIDESHOW_DELAY = 5 ' Seconds per slide; MUST BE A NUMBER dim page_num, page ' Set up page nav page_num = rq("pn") if page_num = "" then page_num = 1 elseif not isnumeric(page_num) then page_num = 1 elseif page_num < 1 then page_num = 1 end if ' Make sure values are okay if not isnumeric(THUMBNAILS_PER_PAGE) then THUMBNAILS_PER_PAGE = 16 end if if not isnumeric(SLIDESHOW_DELAY) then SLIDESHOW_DELAY = 5 end if ' Determine current section dim section section = rq("sec") dim rs set rs = getRecordSet(section) ' If invalid section then back to beginning if rs.eof then if page_num > 1 then response.redirect(request.ServerVariables("SCRIPT_NAME") & "?sec=" & section) else response.Redirect("index.asp") end if end if dim start_image, start_descrip, start_photographer, images, thumbs, num_images, photographers '----------------------------------------------------------------------------------------------- 'BEGIN ASP '----------------------------------------------------------------------------------------------- set page = new wrapper page.title = "Photos: " & getSectionTitle(section) & " | " & page.title page.lefttext = "Interiors" page.pageid = "" page.executePrintExtraHead = true page.printHeader() start_image = rs("image") start_descrip = rs("descrip") start_photographer = rs("photographer") if start_photographer <> "" then start_photographer = "Photography by " & start_photographer end if images = """gallery/images/" & start_image & ".jpg""" photographers = start_photographer thumbs = images 'So we can always add ", newthumb.jpg" num_images = 0 %>
<% page.printInteriorsLinks(section) %>
<% printNavBar section, page_num, getThumbnailCount(section) %>
<%=getSectionTitle(section)%> Image
Design by Karin Verzariu © <%= html(start_photographer) %>

<%= html(start_descrip) %>

<% page.printFooter() '----------------------------------------------------------------------------------------------- 'PROCEDURES '----------------------------------------------------------------------------------------------- function getRecordSet(section) db_conn() dim query query = getThumbnailQuery(section) set getRecordSet = db_query(query) end function ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = function getThumbnailCount(section) dim query, rs query = replace(getThumbnailQuery(section), "SELECT * FROM ", "SELECT COUNT(*) AS cnt FROM ") query = replace(query, " WHERE ", " WHERE grid>0 AND ") set rs = db_query(query) if not rs.eof then getThumbnailCount = cint(rs("cnt")) else getThumbnailCount = -1 end if end function ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = function getThumbnailQuery(section) getThumbnailQuery = "SELECT * FROM key_int_temp20090115 WHERE section_code='" & db_escape_string(section) & "'" _ & " ORDER BY grid IS NOT NULL, grid+0 " 'LIMIT " & ((page_num - 1) * THUMBNAILS_PER_PAGE) & ", " _ '& (THUMBNAILS_PER_PAGE + 1) end function ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = function getSectionTitle(sec) getSectionTitle = replace(sec, " ", "") if instr(1,"living", getSectionTitle, 1) then getSectionTitle = "Living" elseif instr(1,"dining", getSectionTitle, 1) then getSectionTitle = "Dining" elseif instr(1,"bedrooms", getSectionTitle, 1) then getSectionTitle = "Bedrooms" elseif instr(1,"kitchens", getSectionTitle, 1) then getSectionTitle = "Kitchens" elseif instr(1,"bathrooms", getSectionTitle, 1) then getSectionTitle = "Bathrooms" elseif instr(1,"studies", getSectionTitle, 1) then getSectionTitle = "Studies" elseif instr(1,"halls", getSectionTitle, 1) then getSectionTitle = "Halls" elseif instr(1,"furniture", getSectionTitle, 1) then getSectionTitle = "Furniture" elseif instr(1,"publicspaces", getSectionTitle, 1) then getSectionTitle = "Public Spaces" elseif instr(1,"windowswindowtreatments", getSectionTitle, 1) then getSectionTitle = "Window Treatments" elseif instr(1,"artdeco", getSectionTitle, 1) then getSectionTitle = "Art Deco" else getSectionTitle = "" end if end function ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = function getJSEscaped(txt) getJSEscaped = txt if getJSEscaped <> "" then getJSEscaped = replace(replace(getJSEscaped, "'", "\'"), vbcrlf, "
", 1, 200, 1) end if if instr(getJSEscaped, vbcrlf) > 0 then response.write "ERROR" end if end function ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = sub printPageNav(section, page_num, extras) %> <% end sub ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 'Copied from ourclients.asp sub printNavBar(section, pn, max) %> <% end sub ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = 'prints the ThumbSlide
  • tags from rs sub printThumbSlides(ByRef rs) dim thumb_html, curr_row_html, num_rows, max_runs, slide_number max_runs = 20 slide_number = 0 do while not rs.eof and max_runs > 0 slide_number = slide_number + 1 max_runs = max_runs - 1 %>
  • <% thumb_html = "" curr_row_html = "" num_rows = 1 num_images = 0 do while not rs.eof and num_images < THUMBNAILS_PER_PAGE num_images = num_images + 1 if (num_images - 1) mod 4 = 0 and num_images > 1 then thumb_html = "
    " _ & vbcrlf _ & "
    " _ & curr_row_html _ & thumb_html curr_row_html = "" num_rows = num_rows + 1 end if images = images & ", ""gallery/images/" & rs("image") & ".jpg""" thumbs = thumbs & ", ""gallery/thumbnails/" & rs("image") & ".jpg""" curr_row_html = curr_row_html _ & "
    " _ & vbcrlf rs.movenext loop if curr_row_html <> "" then thumb_html = vbcrlf & curr_row_html _ & thumb_html num_rows = num_rows + 1 end if do while num_rows <= 4 thumb_html = " 
    " _ & vbcrlf _ & "
    " _ & thumb_html num_rows = num_rows + 1 loop response.write thumb_html %>
  • <% loop end sub ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = sub printExtraHead() %> <% end sub %>