diff src/main/webapp/pages/home.jsp @ 32:74fe1518bc5c

new: sorting and filters in homepage for branch list
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Fri, 25 Sep 2015 14:30:46 +0200
parents 3b3e2963c8f7
children 2e1662afc81c
line wrap: on
line diff
--- a/src/main/webapp/pages/home.jsp	Thu Sep 24 13:35:39 2015 +0200
+++ b/src/main/webapp/pages/home.jsp	Fri Sep 25 14:30:46 2015 +0200
@@ -20,39 +20,251 @@
 		<% if(sessionBean.getUser() == null) { %>
 			<label>You must login!</label>
 		<% } else { 
+			
+			if (sessionBean.getHomePage().getCompleteBranchList() == null){ 
+				sessionBean.getHomePage().loadParameters(request, response);
+				sessionBean.getHomePage().reloadBranches();
+			}
+			/*
 			sessionBean.getHomePage().loadParameters(request, response);
 			sessionBean.getHomePage().reloadBranches();
+			*/
 		%>
-		<label class="subTitel">User's Branches</label>
+		
 		
-		<% if(sessionBean.getHomePage().getBranches().isEmpty()) { %>
-			<label>You do not have branches!</label>
+		
+		
+		<% if(sessionBean.getHomePage().getCompleteBranchList().isEmpty()) { %>
+			<label class="subTitel">You have no branch!</label>
 		<% } else { %>
 				
-			<form
-				name="homeForm"
-				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
-				method="post">
+			<form name="homeForm" method="post"
+				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" >
+				<input name="bean" type="hidden" value="homeBean" /> 
 				
-				<input name="bean" type="hidden" value="homeBean" /> 
+				<div class="subTitel">User's Branches
+					<input type="image"
+						onclick="setAction('forceReloadBranches', 'homeForm');"
+						src="<%=sessionBean.getApplicationBean().getRefreshImage()%>" width="20" height="20"/>
+			
+					<p class="label">You have <%= sessionBean.getHomePage().getBranchNumber() %> branches.</p>
+					<p class="label"><%= (StringUtils.isNotEmpty(sessionBean.getHomePage().getFilteringMessage())) ? sessionBean.getHomePage().getFilteringMessage() : ""%> </p>
+				</div>
+				<jsp:include page="../componentes/paginator.jsp">
+					<jsp:param name="formName" value="homeForm"/>
+				</jsp:include> 
+				
 				
 				<table style="width: 90%; margin-left: auto;margin-right: auto;"  class="pageTable">
 					<tr>
-						<td><label class="tableTitle">Branch ID</label></td>
-						<td><label class="tableTitle">Book ID</label></td>
-						<td><label class="tableTitle">Book Name</label></td>
-						<td><label class="tableTitle">Period</label></td>
-						<td><label class="tableTitle">Section Name</label></td>
-						<td><label class="tableTitle">Label</label></td>
+						<td>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Branch ID</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByBranchIdUp', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBranchIdDown', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+							</table>
+						</td>
+						
+						<td>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Book ID</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByBookIdUp', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookIdDown', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="bookIdFilter" value="<%= sessionBean.getHomePage().getBookIdFilter()%>" size="10"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'homeForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>
+							</table>
+						</td>
+						<td>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Book Name</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByBookNameUp', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByBookNameDown', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="bookNameFilter" value="<%= sessionBean.getHomePage().getBookNameFilter()%>" size="10"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'homeForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>
+							</table>
+						</td>
+						<td>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Period</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByPeriodUp', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByPeriodDown', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="periodFilter" value="<%= sessionBean.getHomePage().getPeriodFilter()%>" size="10"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'homeForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>
+							</table>
+						</td>
+						<td>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Section Name</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortBySectionNameUp', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortBySectionNameDown', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="sectionNameFilter" value="<%= sessionBean.getHomePage().getSectionNameFilter()%>" size="10"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'homeForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>
+							</table>
+						</td>
+						<td>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Label</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByLabelUp', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByLabelDown', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								<tr>
+									<td>
+										<input type="text" name="labelFilter" value="<%= sessionBean.getHomePage().getLabelFilter()%>" size="10"/>
+									</td>									
+									<td>
+										<input type="image"
+											onclick="setAction('filter', 'homeForm');"
+											src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/>
+									</td>							
+								</tr>
+							</table>
+						</td>
 						<td><label class="tableTitle">Contributors</label></td>
-						<td><label class="tableTitle">Last Modified</label></td>
+						<td>
+							<table class="sortTable">
+								<tr>
+									<td><label class="tableTitle">Last Modified</label></td>
+									<td>
+										<table>
+											<tr><td>
+												<input type="image" 
+													onclick="setAction('sortByLastModifiedUp', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getUpImage()%>"/>										
+											</td></tr>
+											<tr><td>
+												<input type="image"
+													onclick="setAction('sortByLastModifiedDown', 'homeForm');"
+													src="<%=sessionBean.getApplicationBean().getDownImage()%>"/>																				
+											</td></tr>
+										</table>
+									</td>
+								</tr>
+								
+							</table>
+						</td>
 						<td><label class="tableTitle">Extraction Interface</label></td>
 						<td><label class="tableTitle">Published in Dataverse</label></td>
 						<td><label class="tableTitle">Manage</label></td>
 						<td><label class="tableTitle">Delete</label></td>
 					</tr>	
 					
-					<% for(LGBranch branch : sessionBean.getHomePage().getBranches()) { %>
+					<% for (LGBranch branch : sessionBean.getHomePage().getDisplayBranchList() ) {
+					%>
 					<tr>
 						<td><%=branch.getId() %></td>
 						<td><%=branch.getBook().getId() %></td>
@@ -105,6 +317,10 @@
 					</tr>
 				</table>
 				 -->
+				 <jsp:include page="../componentes/paginator.jsp">
+					<jsp:param name="formName" value="homeForm"/>
+				</jsp:include> 
+				
 			</form>
 		<% } %>
 		<% } %>