<%@ page import="java.util.*,java.io.*,clothes.*,util.*" %> <%@ page import="javax.mail.*,javax.mail.internet.*,javax.activation.*" %> <% Collection categories = (Collection) session.getAttribute("categories"); if (categories == null) { categories = clothesBean.getCategories(); session.setAttribute("categories", categories); } // Build a map with category names as keys and categories as values Map catNameCategoryMap = new HashMap(); Category tmpCategory; Iterator catIter = categories.iterator(); while (catIter.hasNext()) { tmpCategory = (Category) catIter.next(); catNameCategoryMap.put(tmpCategory.getName().toLowerCase(), tmpCategory); // If the category has an old name - store it in the map with that name too if (tmpCategory.getOldName() != null) catNameCategoryMap.put(tmpCategory.getOldName().toLowerCase(), tmpCategory); } // String currEntry = (String) request.getParameter("entry"); String currCategoryName = null; String entryFileName = request.getRequestURI(); String entryFileNameAscii = ""; int slashIx = entryFileName.lastIndexOf("/"); int dotIx = entryFileName.lastIndexOf("."); Set aaoEntryNames = new HashSet(); aaoEntryNames.add("Paapi"); aaoEntryNames.add("ikaaan"); aaoEntryNames.add("Chloe"); aaoEntryNames.add("Ivanhoe"); aaoEntryNames.add("Shoe"); if (slashIx >= 0 && dotIx > slashIx && dotIx < entryFileName.length()) { String entryPath = entryFileName.substring(0, slashIx); entryFileName = entryFileName.substring(slashIx + 1, dotIx); entryFileNameAscii = entryFileName; if (!aaoEntryNames.contains(entryFileName)) entryFileName = ClothesParameters.convertFromAscii(entryFileName); slashIx = entryPath.lastIndexOf("/"); currCategoryName = (slashIx >= 0 && slashIx < entryPath.length()) ? entryPath.substring(slashIx + 1) : entryPath; } Logger.log(Level.FINE, "entryFileName: " + entryFileName + " slashIx: " + slashIx + " dotIx: " + dotIx + " currCategoryName: " + currCategoryName); Entry currEntry = clothesBean.getEntry(-1, entryFileName, request.getRequestedSessionId(), request.getRemoteAddr(), request.getRemoteHost()); List entryProducts = null; String currProductId = (String) request.getParameter("product"); //String nextProductId = (String) request.getParameter("nextProduct"); Product currProduct = null; Product nextProduct = null; int currProductOffset = 1; try { String tmpStr = (String) request.getParameter("offset"); if (tmpStr != null) currProductOffset = Integer.parseInt(tmpStr); } catch (NumberFormatException ex) {} if (currEntry == null) { currEntry = new Entry(); currEntry.setName(entryFileName); } else { String brandName = null; if (currEntry.isBrand()) { brandName = (currEntry.getDisplayName() != null) ? currEntry.getDisplayName() : currEntry.getName(); } // Logger.log(Level.FINE, "*** brandName: " + brandName + " isBrand: " + currEntry.isBrand()); entryProducts = (List) clothesBean.getProductsForEntry(currEntry.getId(), 20, currCategoryName, brandName); // 0 = ger max antal produkter } String currCategoryParam = (String) request.getParameter("category"); if (currCategoryParam != null) currCategoryName = currCategoryParam.toLowerCase(); Category currCategory = null; boolean add2ToCatName = false; if (currCategoryName.endsWith("2")) { currCategoryName = currCategoryName.substring(0, currCategoryName.length() - 1); add2ToCatName = true; } // If no category was given or the given category was invalid - choose a default start page if (currCategoryName == null || currCategoryName.equals("index") || !catNameCategoryMap.containsKey(currCategoryName)) { currCategoryName = "index"; } currCategory = (Category) catNameCategoryMap.get(currCategoryName); if (currCategory == null) { currCategory = new Category(); currCategory.setName(currCategoryName); currCategory.setType(1); } String currEntryName = currEntry.getDisplayName() != null ? currEntry.getDisplayName() : currEntry.getName(); String currCatDisplayName = currCategory.getDisplayName() != null ? currCategory.getDisplayName() : currCategoryName; // Removing the prefix date from the news entries if (currEntryName.matches("20..-..-..*")) { currEntryName = currEntryName.substring(11); } %> <%= currEntryName + " " + currCatDisplayName + " kläder nu." %>
Hem
Sök på Kläder.nu Kläder.nu:s blogg Kläder.nu:s trendsida Kläder.nu testar nätbutiker
href='../'>Hem
href='<%= "../soek.html" %>' onClick="this.href=getSearchKeywordURL()">Sök 
href='../nyheter.html'>Nyheter om kläder <% Iterator cIter = categories.iterator(); long newCategoryLimitMs = ClothesParameters.getLongProperty("newEntryLimitMs"); Date newCategoryDate = (newCategoryLimitMs > 0) ? new Date(newCategoryLimitMs) : new Date(); Category category = null; String displayName; while (cIter.hasNext()) { category = (Category) cIter.next(); if (!category.isHidden() && category.getId() != 18) { // News category moved to top (see above) displayName = (category.getDisplayName() != null) ? category.getDisplayName() : category.getName(); if (displayName.endsWith("Profilkläder/Arbetskläder")) // TODO fix displayName = "Profilkläder"; String catIsSelected = currCategoryName.equalsIgnoreCase(category.getName()) ? "class='activeLink'" : ""; out.println(""); out.println("" + displayName + " "); if (category.getCreateTime() != null && category.getCreateTime().after(newCategoryDate)) out.println(""); out.println(""); } } %> href='../skoetsel.html'>Skötsel href='../portaler.html'>Portaler/Länkar href='../kontakt.html'>Info/kontakta oss
target='_blank'>

<%= currEntryName %> <%= (currEntry.getCountry() != null) ? "" : "" %>

<% if (currEntry.getLogo() != null) { %> <%= currEntryName %> <%= currCatDisplayName %> <% } %>
"> <%= currEntry.getInfo() %>
<%= (currEntry.getLongInfo() != null && !currEntry.getLongInfo().trim().startsWith("
")) ? "
" : "" %> <%= currEntry.getLongInfo() %> <%= (currEntry.getBrands() != null && !currEntry.getBrands().equals("NULL")) ? "

Våra klädmärken är: " + currEntry.getBrands() + "" : "" %>
<% if (entryProducts != null && entryProducts.size() > 0) { out.println("
Sök bland alla produkter från " + currEntryName + "
"); out.println("
"); for (int i = 0; i < entryProducts.size() ; i++) { Product tmpProd = (Product) entryProducts.get(i); String altStr = tmpProd.getName() + " " + tmpProd.getPriceStr(); if (tmpProd.getProgramName() != null) altStr = tmpProd.getProgramName() + " - " + altStr; // Include the old price if it exists if (tmpProd.getOldPrice() != null && tmpProd.getOldPrice().trim().length() > 0 && !tmpProd.getOldPrice().startsWith("0")) { altStr += " (" + tmpProd.getOldPrice().trim() + ")"; } String urlStr = tmpProd.getUrl(); // Direktlänk till butiken out.println("" + "" + altStr + ""); } } %>
<% if (entryProducts == null || entryProducts.size() < 5) { // TODO fixx Fill out with spaces below page contents to make chrome render the page better %>
<% } %>

Kläder.nu kategori: <%= currCatDisplayName %>.