<%@ LANGUAGE="VBScript" CODEPAGE="1255"%> <% option explicit %> <% ' ************************************************************************************************************ ' ********* VARIABLES FOR DB RETRIEVAL & PAGING ************ Dim iCatId Dim strOrderBy Dim strCategoryName Dim strHeaderFile Dim strTopComments Dim strBottomComments Dim iPageSize 'How big our pages are Dim iPageCurrent 'The page we want to show Dim iPageCount 'The number of pages we get back ' ******************************************************************************** ' ********* VARIABLES FROM REQUEST OBJECT ************ if Trim(Request.QueryString("cat")) = "" then iCatId = 1 else iCatId = Cint(Trim(Request.QueryString("cat"))) end if if Trim(Request.QueryString("orderby")) = "" then strOrderBy = "original" else strOrderBy = Trim(Request.QueryString("orderby")) end if if Trim(Request.QueryString("pagesize")) = "" then iPageSize = 40 else iPageSize = Cint(Trim(Request.QueryString("pagesize"))) end if If Request.QueryString("page") = "" Then iPageCurrent = 1 Else iPageCurrent = Cint(Request.QueryString("page")) End If ' ************************************************************************* ' ******** DATABASE RETRIEVAL **************** Function WriteOrderBy(strFromQuerystring) select case strFromQuerystring case "id": WriteOrderBy = "Gallery_Imgs.ImgId" case "original": WriteOrderBy = "Gallery_Imgs_Cats.Sequence, Gallery_Imgs.ImgId" case "name": WriteOrderBy = "Gallery_Imgs." & strLang & "Name" case "type": WriteOrderBy = "Gallery_Imgs.TypeId" case "date": WriteOrderBy = "Gallery_Imgs.DateTaken DESC" case "buildingstyle": if iCatId = 9 then WriteOrderBy = "Building_Styles.StyleId DESC" else WriteOrderBy = "Gallery_Imgs_Cats.Sequence, Gallery_Imgs.ImgId" end if end select End Function Dim conn, rs, cmd Dim strSql if iCatId > 0 then strSql = "SELECT Gallery_Imgs.ImgId, Gallery_Imgs.TypeId," strSql = strSql & " Gallery_Imgs.LargeFile, Gallery_Imgs.SmallFile," strSql = strSql & " Gallery_Imgs.CustomWidth, Gallery_Imgs.CustomHeight," strSql = strSql & " Gallery_Imgs.HebName, Gallery_Imgs.EngName, Gallery_Imgs.HebInfo, Gallery_Imgs.EngInfo," strSql = strSql & " Gallery_Imgs.HebZalam, Gallery_Imgs.EngZalam, Gallery_Imgs.DateTaken," strSql = strSql & " Gallery_Cats.CatId, Gallery_Cats.HebName, Gallery_Cats.EngName," strSql = strSql & " Gallery_Cats.Sequence, Gallery_Cats.HebHeaderfile," strSql = strSql & " Gallery_Imgs_Cats.ImgId, Gallery_Imgs_Cats.CatId, Gallery_Imgs_Cats.Sequence," strSql = strSql & " (SELECT Count(Gallery_Imgs_Cats.ImgId) FROM Gallery_Imgs_Cats WHERE Gallery_Imgs_Cats.ImgId = Gallery_Imgs.ImgId) AS Appearances," strSql = strSql & " Gallery_Imgs.ExternalLink, Gallery_Types.HebName, Gallery_Types.EngName," strSql = strSql & " Building_Styles.HebName, Building_Styles.EngName, Gallery_Cats.EngHeaderfile," strSql = strSql & " Gallery_Cats.HebTopComments, Gallery_Cats.HebBottomComments," strSql = strSql & " Gallery_Cats.EngTopComments, Gallery_Cats.EngBottomComments" strSql = strSql & " FROM Gallery_Types INNER JOIN (Gallery_Cats INNER JOIN (Gallery_Imgs_Cats INNER JOIN (Building_Styles RIGHT JOIN (Gallery_Imgs_Building_Styles RIGHT JOIN Gallery_Imgs ON Gallery_Imgs.ImgId=Gallery_Imgs_Building_Styles.ImgId) ON Building_Styles.StyleId=Gallery_Imgs_Building_Styles.StyleId) ON Gallery_Imgs.ImgId=Gallery_Imgs_Cats.ImgId) ON Gallery_Cats.CatId=Gallery_Imgs_Cats.CatId) ON Gallery_Types.TypeId=Gallery_Imgs.TypeId" strSql = strSql & " WHERE Gallery_Cats.CatId=" & iCatId 'strSql = strSql & " AND Appearances>1" strSql = strSql & " ORDER BY " & WriteOrderBy(strOrderBy) else ' FOR UNASSIGNED PICTURES. strSql = "SELECT Gallery_Imgs.ImgId, Gallery_Imgs.TypeId," strSql = strSql & " Gallery_Imgs.LargeFile, Gallery_Imgs.SmallFile," strSql = strSql & " Gallery_Imgs.CustomWidth, Gallery_Imgs.CustomHeight," strSql = strSql & " Gallery_Imgs.HebName, Gallery_Imgs.EngName, Gallery_Imgs.HebInfo, Gallery_Imgs.EngInfo," strSql = strSql & " Gallery_Imgs.HebZalam, Gallery_Imgs.EngZalam, Gallery_Imgs.DateTaken," strSql = strSql & " (SELECT Count(Gallery_Imgs_Cats.ImgId) FROM Gallery_Imgs_Cats WHERE Gallery_Imgs_Cats.ImgId = Gallery_Imgs.ImgId) AS Appearances" strSql = strSql & " FROM Gallery_Imgs" strSql = strSql & " WHERE (SELECT Count(Gallery_Imgs_Cats.ImgId) FROM Gallery_Imgs_Cats WHERE Gallery_Imgs_Cats.ImgId = Gallery_Imgs.ImgId) = 0" strSql = strSql & " AND (SELECT Count(Info_Items_Gallery_Imgs.ImgId) FROM Info_Items_Gallery_Imgs WHERE Info_Items_Gallery_Imgs.ImgId = Gallery_Imgs.ImgId) = 0" strSql = strSql & " ORDER BY " & WriteOrderBy("id") end if DB_SetAll conn,rs conn.Open strConn set cmd = server.CreateObject("adodb.command") set cmd.ActiveConnection = conn With cmd .CommandType = adCmdText .CommandText = strSQL End With ' Set cursor location and pagesize rs.CursorLocation = adUseClient ' Open Recordset object and rs.Open cmd 'Disconnect from database cmd.ActiveConnection = nothing ' ********* Retrieving catergory information ************ If Not rs.EOF and iCatId>0 Then strCategoryName = rs.Fields("Gallery_Cats." & strLang & "Name") strHeaderFile = rs.Fields(strLang + "HeaderFile") strTopComments = rs.Fields(strLang + "TopComments") strBottomComments = rs.Fields(strLang + "BottomComments") End If ' ******************************************************************* ' ****************************************************************************************************** ' **************** Retrieving gallery data using the GetString method ******************** ' ****************************************************************************************************** Dim columnDelimiter Dim rowDelimiter Dim str If Not rs.EOF Then columnDelimiter=""",""" rowDelimiter="""]," & vbCrlf & "[""" ' using false delimiters in order to use the rQuote function. str = rs.GetString(2, ,"*COLUMN_DELIMITER*","*ROW_DELIMITER*") str = rQuote(str) str = rNewLine(str) ' replacing them with the real delimiters in order to create a proper array. str = Replace(str, "*COLUMN_DELIMITER*", columnDelimiter) str = Replace(str, "*ROW_DELIMITER*", rowDelimiter) ' creating a declaration of the array. str = "var recArray=[[""" & Left(str, Len(str)-5) & "];" Else str = "var recArray=[];" End If %> <% ' ****************************************************************************************************** ' ****************************************************************************************************** ' ****************************************************************************************************** 'rs.close 'strSql = " " 'rs.open strSql, conn DB_CloseAll conn,rs %> <% WriteHTMLTag() %> <%=strCategoryName%> - <%=SiteName()%> <% ' *** WRITING THE HEADER FOR THIS CATEGORY *** if strHeaderFile <> "" then Response.Write "
" elseif strCategoryName <> "" then Response.Write "

" & strCategoryName & "

" end if %> <%= strTopComments%> <%= HebOrEng("לחץ על תמונה על מנת לפתוח את חלון-התמונה ולצפות בה בגודל מלא","Click on the thumbnail in order to open the photo-window and watch it in full size")%>.
<% ' ********************************************************************* Function SelIfTrue(bStatement) if bStatement then Response.Write " SELECTED" end if End Function %>
<%=HebOrEng("סדר לפי:","Order By:")%>
<%=HebOrEng("סדר לפי:","Order By:")%>

<%= strBottomComments%>

"> " width="155" height="41" border="0">