Skip to content

Commit

Permalink
changes in layout and single items view page
Browse files Browse the repository at this point in the history
  • Loading branch information
snirye committed Apr 18, 2020
1 parent 544ed5f commit 3bfd364
Show file tree
Hide file tree
Showing 5 changed files with 66 additions and 55 deletions.
43 changes: 22 additions & 21 deletions WebContent/content/Explore.jsp
Original file line number Diff line number Diff line change
@@ -1,35 +1,36 @@
<%@page import="java.util.List"%>

<a href="ProfileServlet"> users only!</a>
<a href="ExploreServlet"> Explore Page </a>
<!-- Items -->
<h3 class="w3-margin">New Items!</h3>
<div class='w3-row'>
<%
model.Model mod = (model.Model)getServletContext().getAttribute("model");
List<model.Items> items=mod.getAllItemsList();
request.setAttribute("items", items);
%>
<jsp:include page="ShowItems.jsp">
<jsp:param value="${items}" name="items"/>
</jsp:include>
<%/*
String url=request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath()+"/images/";
String pictureUrl;
for (int i = 0; i < 4; i++) {
out.print("<div class='w3-col s12 m4 l3 w3-center w3-card-4' style=''>");
out.print("<a href=ItemDetails?id="+i+"><img src='photos/ladder.jpg' class='w3-round w3-padding-16' height='150' width='150'>");
pictureUrl=url+"default";
out.print("<div class='w3-col s12 m4 l3 w3-center' style=''>");
out.print("<div class='w3-card-4 w3-margin'>");
out.print("<div style='height: 80%; width: 100%; object-fit: contain'>");
out.print("<a href=ItemDetailsServlet?id="+i+"><img src='"+pictureUrl+"' class='w3-round w3-padding-16' style='height: 100%; width: 80%; object-fit: contain'>");
out.print("</div>");
out.print("<div style='height: 20%; width: 100%; object-fit: contain'>");
out.print("<h5>item " + i + "</h5>");
out.print("</div>");
out.print("</div>");
out.print("</div>");
}
*/
%>

</div>
<!--
<div class="w3-row">
<div class="w3-col m1 w3-center w3-grey">1</div>
<div class="w3-col m1 w3-center">2</div>
<div class="w3-col m1 w3-center w3-grey">3</div>
<div class="w3-col m1 w3-center">4</div>
<div class="w3-col m1 w3-center w3-grey">5</div>
<div class="w3-col m1 w3-center">6</div>
<div class="w3-col m1 w3-center w3-grey">7</div>
<div class="w3-col m1 w3-center">8</div>
<div class="w3-col m1 w3-center w3-grey">9</div>
<div class="w3-col m1 w3-center">10</div>
<div class="w3-col m1 w3-center w3-grey">11</div>
<div class="w3-col m1 w3-center">12</div>
</div>
-->


23 changes: 5 additions & 18 deletions WebContent/content/MyItems.jsp
Original file line number Diff line number Diff line change
@@ -1,19 +1,6 @@
this is list of ${name} items
<div class="w3-row">
<%
model.Items[] items=(model.Items[])request.getAttribute("items");
String url=request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath()+"/images/";
String pictureUrl;
for(int i=0;i<items.length;i++){
if(items[i].getPicture().equals("1")) {
pictureUrl=url+items[i].getItemID();
} else{
pictureUrl=url+"default";
}
out.print("<div class='w3-col s12 m4 l3 w3-center w3-card-4' style=''>");
out.print("<img src='" + pictureUrl + "' class='w3-round w3-padding-16' height='42' width='42'>");
out.print("<h5>item " + i + "</h5></div>");
}
%>

</div>
<%@page import="java.util.List"%>
<%@page import="model.Items"%>
<jsp:include page="ShowItems.jsp">
<jsp:param value="${items}" name="items"/>
</jsp:include>
22 changes: 8 additions & 14 deletions WebContent/content/Results.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,14 @@
<%@page import="model.Items"%>
<%@page import="java.util.*"%>
<jsp:include page="Search.jsp" />
<%
out.print("you was looking for " + request.getAttribute("search"));
out.print("<div class='w3-row'>");
List<Items> results=(List<Items>)request.getAttribute("results");
for(int i=0;i<results.size();i++){
out.print("<div class='w3-col s12 m4 l3 w3-center w3-card-4' style=''>");
out.print("<a href=ItemDetailsServlet?id="+results.get(i).getItemID()+"><img src='photos/ladder.jpg' class='w3-round w3-padding-16' height='150' width='150'>");
out.print("<h5>item " +results.get(i).getName()+ "</h5>");
out.print("</div>");
}
out.print("</div>");
<div class='w3-row'>
<%
request.setAttribute("items",request.getAttribute("results"));
out.print("you was looking for " + request.getAttribute("search"));
%>

<jsp:include page="ShowItems.jsp">
<jsp:param value="${results}" name="items"/>
</jsp:include>
</div>

29 changes: 29 additions & 0 deletions WebContent/content/ShowItems.jsp
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<%@page import="java.util.*"%>
<%@page import="model.Items"%>
<div class='w3-row'>
<%
List<Items> results=(List<Items>)request.getAttribute("items");
String url=request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath()+"/images/";
String pictureUrl;
Items item;
for(int i=0;i<results.size();i++){
item=results.get(i);
if(results.get(i).getPicture().equals("1")){
pictureUrl=url+item.getItemID();
}else {
pictureUrl=url+"default";
}
out.print("<div class='w3-col s12 m4 l3 w3-center' style=''>");
out.print("<div class='w3-card-4 w3-margin'>");
out.print("<div style='height: 80%; width: 100%; object-fit: contain'>");
out.print("<a href=ItemDetailsServlet?id="+item.getItemID()+"><img src='"+pictureUrl+"' class='w3-round w3-padding-16 ' height='150' width='150' >");
out.print("</div>");
out.print("<div style='height: 20%; width: 100%; object-fit: contain'>");
out.print("<h5>" + item.getName() + "</h5>");
out.print("</div>");
out.print("</div>");
out.print("</div>");
//style='height: 100%; width: 80%; object-fit: contain'
}
%>
</div>
4 changes: 2 additions & 2 deletions WebContent/jsp/bodyHeader.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
href="HelpServlet" class="w3-bar-item w3-button w3-mobile">Help</a>
<a href='ProfileServlet' class='w3-bar-item w3-button w3-mobile w3-right'>
<%
if (session.getAttribute("name") != null)
if (session.getAttribute("user") != null)
out.print(session.getAttribute("name") + "'s Profile");
else
out.print("Login ");
Expand Down Expand Up @@ -51,7 +51,7 @@
<a href="OffersServlet" class="w3-bar-item w3-button">Offers</a>
<%
if (session.getAttribute("privilege") != null) {
//TODO:make this text different color
//TODO OPTION:make this text different color
out.print("<a href=\"SearchHistoryServlet\" class=\"w3-bar-item w3-button\">Serach History</a>");
out.print("<a href=\"UsersListServlet\" class=\"w3-bar-item w3-button\">Users List</a>");
out.print("<a href=\"AllItemsServlet\" class=\"w3-bar-item w3-button\">All Items List</a>");
Expand Down

0 comments on commit 3bfd364

Please sign in to comment.