view src/main/webapp/pages/home.jsp @ 15:d81a5401b9af

new: sorting in books page
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Mon, 01 Jun 2015 14:35:35 +0200
parents 3e62083dbcbf
children 3b3e2963c8f7
line wrap: on
line source

<%@page import="de.mpiwg.gazetteer.bo.LGBranch"%>
<%@page import="org.apache.commons.lang.StringUtils"%>
<%@page import="de.mpiwg.gazetteer.db.DBSection"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

<jsp:useBean id="sessionBean" class="de.mpiwg.web.jsp.SessionBean" scope="session" />

<html>

<head>
	<jsp:include page="../componentes/headContent.jsp"/>	
</head>

<body>

	<jsp:include page="../componentes/template.jsp"/>

	<div id="page">
		
		<% if(sessionBean.getUser() == null) { %>
			<label>You must login!</label>
		<% } else { 
			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>
		<% } else { %>
				
			<form
				name="homeForm"
				action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
				method="post">
				
				<input name="bean" type="hidden" value="homeBean" /> 
				
				<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">Section Name</label></td>
						<td><label class="tableTitle">Label</label></td>
						<td><label class="tableTitle">Contributors</label></td>
						<td><label class="tableTitle">Last Modified</label></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()) { %>
					
					<tr>
						<td><%=branch.getId() %></td>
						<td><%=branch.getBook().getId() %></td>
						<td><%=branch.getBook().getName() %></td>
						<td><%=branch.getSection().getName() %></td>
						<td><%=branch.getLabel() %></td>
						<td>
							<table style="width:120px;">
							<% for(String contributor : branch.getContributorsNameList()) { %>
								<tr><td><label><%= contributor %></label></td></tr>
							<% } %>
							</table>
						</td>
						<td><%=branch.getFomattedLastChange() %></td>
						<td>
							<a onclick="branchInExtractionInterface('<%=branch.getId() %>', '<%=branch.getCurrentLastFileId() %>', '<%=branch.getSectionId() %>', '<%=branch.getSection().getName() %>', '<%=branch.getBook().getId() %>', '<%=branch.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');">
								<img alt="Show Branch in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
							</a>
						</td>
						<!-- Dataverse -->
						<td>
							<%=branch.isPublished() %>
						</td>
						<td>
							<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" >
								<img alt="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/>
							</a>
						</td>
						<td>
							<input type="image" 
								onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> deleteBranch('deleteBranch', 'homeForm', '<%=branch.getId() %>');" 
								src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
						</td>
						
					</tr>
					
					<% } %>
				</table>
				<!-- 
				<table>
					<tr>
						<td><input type="submit" value="Reload" onclick="setAction('reloadBranches', 'homeForm');"/> </td>
					</tr>
				</table>
				 -->
			</form>
		<% } %>
		<% } %>
	</div>
	
</body>