<%@ page isThreadSafe="false" %><%@ include file="globalPaths.jsp" %><%@ include file="globalDefinitions.jsp" %><%@ include file="cacheBegin.jsp" %><% // This code prevents caching for malicious cnt parameter specified by user int artworksPerPage = 42; int count = -1; try { if (request.getParameter("cnt") != null) { count = Integer.parseInt(request.getParameter("cnt")); } } catch (Exception e) { count = -1; } int cnt = count - count % artworksPerPage; if (cnt < 0) cnt = 0; String newurl = "category.jsp"; String queryString = "?"; if (request.getParameter("type") != null) { queryString = queryString + "type=" + request.getParameter("type") + "&"; } if (request.getParameter("cat") != null) { queryString = queryString + "cat=" + request.getParameter("cat") + "&"; } newurl = newurl + queryString; if (cnt != count) { sendRedirect(newurl + "cnt=" + cnt); return; } %><% Cookie[] cookies; cookies = request.getCookies(); String cookieArtist = ""; for (int icook = 0; cookies != null && icook < cookies.length; icook++) { Cookie cookie = cookies[icook]; if ((cookie.getName()).equals("galleryArtistID")) { cookieArtist = cookie.getValue(); } } String remoteIP = "UndefinedIP"; if (request.getRemoteAddr() != null) { remoteIP = request.getRemoteAddr(); } %><% boolean isPAI = false; boolean isGRA = false; boolean isPRI = false; boolean isPHO = false; boolean isSCU = false; boolean isMIX = false; boolean isNEW = false; boolean isCER = false; boolean isGLA = false; boolean isJEW = false; boolean isTEX = false; boolean isFUR = false; boolean isBOO = false; boolean isCAL = false; boolean isILL = false; boolean isDES = false; boolean isTYP = false; boolean isWEB = false; String category = request.getParameter("cat"); if ("painting".equals(category)) isPAI = true; if ("graphics".equals(category)) isGRA = true; if ("printmaking".equals(category)) isPRI = true; if ("photography".equals(category)) isPHO = true; if ("sculpture".equals(category)) isSCU = true; if ("mixedmedia".equals(category)) isMIX = true; if ("newmedia".equals(category)) isNEW = true; if ("ceramics".equals(category)) isCER = true; if ("glass".equals(category)) isGLA = true; if ("jewelry".equals(category)) isJEW = true; if ("furniture".equals(category)) isFUR = true; if ("textile".equals(category)) isTEX = true; if ("booksart".equals(category)) isBOO = true; if ("calligraphy".equals(category)) isCAL = true; if ("illustration".equals(category)) isILL = true; if ("printdesign".equals(category)) isDES = true; if ("typography".equals(category)) isTYP = true; if ("webdesign".equals(category)) isWEB = true; if ("books".equals(category)) category="artbooks"; String artType = request.getParameter("type"); String artTypeCondition = ""; String categoryCondition = ""; String artTypeString = ""; String categoryString = ""; if (artType != null && category != null && !((artType.equals("fineart") || artType.equals("craft") || artType.equals("commercialart")) && (category.equals("painting") || category.equals("graphics") || category.equals("printmaking") || category.equals("photography") || category.equals("sculpture") || category.equals("mixedmedia") || category.equals("newmedia") || category.equals("booksart") || category.equals("ceramics") || category.equals("glass") || category.equals("jewelry") || category.equals("furniture") || category.equals("metalart") || category.equals("wood") || category.equals("textile") || category.equals("calligraphy") || category.equals("illustration") || category.equals("printdesign") || category.equals("typography") || category.equals("artbooks") || category.equals("webdesign")))) { if ("fineart".equals(artType) || "craft".equals(artType) || "commercialart".equals(artType)) { sendRedirect("category.jsp?type=" + artType); return; } else { sendRedirect("category.jsp"); return; } } else { if (artType != null) { artTypeCondition = " AND W.type = " + quoteString(artType); if (artType.equals("fineart")) artTypeString = "FINE ART"; if (artType.equals("craft")) artTypeString = "CRAFT"; if (artType.equals("commercialart")) artTypeString = "GRAPHIC DESIGN"; } else { artTypeString = "FINE ART, CRAFT, GRAPHIC DESIGN"; } if (category != null) { categoryCondition = " AND W.category = " + quoteString(category); if (category.equals("booksart")) { categoryString = "Book Art"; } else if (category.equals("printdesign")) { categoryString = "Print Design"; } else if (category.equals("newmedia")) { categoryString = "New Media"; } else if (category.equals("webdesign")) { categoryString = "Web Design"; } else if (category.equals("artbooks")) { categoryString = "Books"; } else if (category.equals("textile")) { categoryString = "Fiber Art"; } else if (category.equals("mixedmedia")) { categoryString = "Mixed Media"; } else { categoryString = toUpperCaseFirstLetter(category); } } } %><% Vector names = new Vector(); Vector shortBios = new Vector(); Vector artworkSmallshots = new Vector(); Vector packages = new Vector(); Vector categories = new Vector(); Vector websites = new Vector(); Vector portfolios = new Vector(); Vector artistIDs = new Vector(); Vector artworkIDs = new Vector(); Vector imageHeights = new Vector(); Vector imageWidths = new Vector(); Vector artworkDates = new Vector(); String artworkID = null; String name = null; String shortBio = null; String artworkSmallshot = null; String pack = null; String website = null; String artistID = null; String width = null; String height = null; String portfolio = null; boolean needCaching = true; %><% String query = ""; ResultSet resultSet = null; Connection connection = null; Statement statement = null; try { connection = openConnection(); statement = connection.createStatement(); query = "SELECT A.id, A.speciality, A.firstname, A.lastname, A.shortbiography," + " A.portfolio, A.package, A.showStudio, A.activeflag, W.id," + " W.smallshot, W.modifiedDate, W.type, W.category, W.widthImage, W.heightImage," + " W.modifiedDate, S.id FROM galleryArtist A, galleryArtwork W, " + " gallerySeries S WHERE W.artist = A.id AND S.artist = A.id" + " AND W.series = S.id " + artTypeCondition + categoryCondition + " AND A.package != '6' AND A.package!='0' AND A.speciality!='' AND A.unwelcome<=1" + " AND (W.activeflag='Y' OR W.activeflag='L') AND (A.activeflag='Y' OR A.ipLastLoggedFrom=" + quoteString(remoteIP) + " OR A.id=" + quoteString(cookieArtist) + " OR 'admin'=" + quoteString((String)session.getValue("logged")) + ") ORDER BY A.lastName, W.activeflag, S.id, W.id"; resultSet = statement.executeQuery(query); String fullName; String firstName; String lastName; String id = ""; while (resultSet.next()) { if (!id.equals(resultSet.getString("A.id"))) { if (!"Y".equals(resultSet.getString("A.activeflag"))) { needCaching = false; } id = resultSet.getString("A.id"); firstName = resultSet.getString("A.firstName"); lastName = resultSet.getString("A.lastName"); if (firstName.equals("")) fullName = lastName; else fullName = lastName + ", " + firstName; artistIDs.addElement(id); names.addElement(fullName); shortBio = resultSet.getString("A.shortBiography"); shortBio = convertHTMLSymbolsToPlainNew(shortBio); // Remove malicious code (youtube) from description shortBio = prepareForListing(shortBio); shortBios.addElement(shortBio); artworkSmallshots.addElement(resultSet.getString("W.smallshot")); imageHeights.addElement(resultSet.getString("W.heightImage")); imageWidths.addElement(resultSet.getString("W.widthImage")); categories.addElement(resultSet.getString("W.category")); packages.addElement(resultSet.getString("A.package")); websites.addElement(resultSet.getString("A.showStudio")); artworkIDs.addElement(resultSet.getString("W.id")); portfolios.addElement(resultSet.getString("A.portfolio")); artworkDates.addElement(getTimestampDigits(resultSet, "W.modifiedDate")); } } resultSet.close(); connection.close(); } catch (Exception e) { errorLog(e, query); sendRedirect(globalErrorPage + "?errorDescription=" + URLEncoder.encode(e.getMessage() + ".")); return; } finally { if (resultSet != null) resultSet.close(); if (connection != null && !connection.isClosed()) connection.close(); } %><% int numpages = (int)Math.ceil((double)artworkIDs.size() / (double)artworksPerPage); int[] pageindex = new int[numpages]; for (int i = 0; i < numpages; i ++) { pageindex[i] = i * artworksPerPage; } if (cnt > artworkIDs.size() - 1) { if (numpages>0) { cnt = pageindex[numpages - 1]; } else { cnt = 0; } } if (cnt != count) { sendRedirect(newurl + "cnt=" + cnt); return; } int fromindex = cnt; int toindex = cnt + artworksPerPage - 1; if (toindex > artworkIDs.size() - 1) toindex = artworkIDs.size() - 1; int previndex = fromindex - artworksPerPage; if (previndex < 0) previndex = 0; String title = "Categories - " + artTypeString + " " + (categoryString.length() > 0 ? " - " + categoryString : ""); %><% if (needCaching) { %><%@ include file="cacheLaunch.jsp" %><% } %> <%=title%> <%@ include file="inc/head.txt" %> <%@ include file="inc/top.txt" %>
<% for (int i = fromindex; i < toindex + 1 && numpages > 0; i += 2) { %> <% String link = "href=\"index.shtml\""; for (int j = i; j < i + 2; j ++) { if (j < artworkIDs.size()) { artworkID = (String)artworkIDs.elementAt(j); name = (String)names.elementAt(j); shortBio = substituteTokens((String)shortBios.elementAt(j), "
", " "); artworkSmallshot = (String)artworkSmallshots.elementAt(j) + "?" + artworkDates.elementAt(j); category = (String)categories.elementAt(j); pack = (String)packages.elementAt(j); website = (String)websites.elementAt(j); portfolio = (String)portfolios.elementAt(j); artistID = (String)artistIDs.elementAt(j); width = (String)imageWidths.elementAt(j); height = (String)imageHeights.elementAt(j); if (category.equals("booksart")) { category = "Book Art"; } else if (category.equals("printdesign")) { category = "Print Design"; } else if (category.equals("newmedia")) { category = "New Media"; } else if (category.equals("webdesign")) { category = "Web Design"; } else if (category.equals("artbooks")) { category = "Books"; } else if (category.equals("textile")) { category = "Fiber Art"; } else if (category.equals("mixedmedia")) { category = "Mixed Media"; } else { category = toUpperCaseFirstLetter(category); } %> <% } else { %> <% } } %> <% } %>
<% if (isPAI || isGRA || isPRI || isSCU || isPHO || isMIX || isNEW || "fineart".equals(artType)) { %>
<% if (isPAI) { %>Painting<% } else { %>Painting<% } %> | <% if (isGRA) { %>Graphics<% } else { %>Graphics<% } %> | <% if (isPRI) { %>Printmaking<% } else { %>Printmaking<% } %> | <% if (isPHO) { %>Photography<% } else { %>Photography<% } %> | <% if (isSCU) { %>Sculpture<% } else { %>Sculpture<% } %> | <% if (isMIX) { %>Mixed Media<% } else { %>Mixed Media<% } %> | <% if (isNEW) { %>New Media<% } else { %>New Media<% } %><% } if (isCER || isJEW || isGLA || isTEX || isFUR || "craft".equals(artType)) { %>
<% if (isCER) { %>Ceramics<% } else { %>Ceramics<% } %> | <% if (isGLA) { %>Glass<% } else { %>Glass<% } %> | <% if (isJEW) { %>Jewelry<% } else { %>Jewelry<% } %> | <% if (isFUR) { %>Furniture<% } else { %>Furniture<% } %> | <% if (isTEX) { %>Fiber Art<% } else { %>Fiber Art<% } %><% } if (isBOO || isCAL || isILL || isDES || isTYP || isWEB || "commercialart".equals(artType)) { %>
<% if (isBOO) { %>Book Art<% } else { %>Book Art<% } %> | <% if (isCAL) { %>Calligraphy<% } else { %>Calligraphy<% } %> | <% if (isILL) { %>Illustration<% } else { %>Illustration<% } %> | <% if (isDES) { %>Print Design<% } else { %>Print Design<% } %> | <% if (isTYP) { %>Typography<% } else { %>Typography<% } %> | <% if (isWEB) { %>Web Design<% } else { %>Web Design<% } %><% } %>

 
<% if (pack.equals("0")) { link = "href=\"artwork.jsp?artwork=" + artworkID + "\""; } else if (pack.equals("1") || pack.equals("5")) { link = "href=\"artworks.jsp?artist=" + artistID + "\""; } else if (pack.equals("3")) { link = "href=\"" + portfolio + "\" target=\"_blank\""; } else if (pack.equals("2")) { link = "href=\"" + website + "\" target=\"_blank\""; } %>><%=name%> 262) { if ((float)(Integer.valueOf(height).intValue()) / (Integer.valueOf(width).intValue()) > 1.15) { %> height=90 <% } else { if ((float)(Integer.valueOf(height).intValue()) / (Integer.valueOf(width).intValue()) < 1/1.15) { %> width=90 <% } else { %> width=82 <% } } } %>>

><%=name%>
<%=category%>
<%=shortBio%>
 

 
<% if (numpages > 1) { %> <% } else { %> <% } %>

 Results <%= fromindex + 1 %>-<%= toindex + 1 %> of <%=artworkIDs.size() %>    <% if (fromindex > 0) { %>  Previous    <% } for (int j = 0; j < numpages; j ++) { %>  <%= pageindex[j] == fromindex ? "" + (j + 1) + "" : String.valueOf(j + 1) %>  <% } if (toindex  Next  <% } %>

 
<%@ include file="inc/bottom.txt" %><% names.removeAllElements(); shortBios.removeAllElements(); artworkSmallshots.removeAllElements(); artworkDates.removeAllElements(); packages.removeAllElements(); categories.removeAllElements(); websites.removeAllElements(); portfolios.removeAllElements(); artistIDs.removeAllElements(); artworkIDs.removeAllElements(); imageHeights.removeAllElements(); imageWidths.removeAllElements(); %><% if (needCaching) { %><%@ include file="cacheEnd.jsp" %><% } %><%@ include file="globalFinally.jsp" %>