changeset 37:ed215307f426

new: show all existing branches in the searching result page of search for sections
author Zoe Hong <zhong@mpiwg-berlin.mpg.de>
date Fri, 20 Nov 2015 15:18:28 +0100
parents eab47936591a
children 8b7a204fa929
files src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java src/main/webapp/pages/search.jsp
diffstat 2 files changed, 21 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java	Fri Nov 20 11:53:29 2015 +0100
+++ b/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java	Fri Nov 20 15:18:28 2015 +0100
@@ -44,6 +44,18 @@
 	
 	public List<LGBranch> getBranches(Long userId){
 		List<LGBranch> list = new ArrayList<LGBranch>();
+		for(LGBranch branch : getBranchMap().values()){	
+			list.add(branch);
+		}
+		return list;
+	}
+	
+	/*
+	 * old version: only showing the branches that the current user has contributor role. 
+	 * But we modify it to get all branches in the section, and leave the role checking to jsp at front-end.
+	 * 
+	public List<LGBranch> getBranches(Long userId){
+		List<LGBranch> list = new ArrayList<LGBranch>();
 		for(LGBranch branch : getBranchMap().values()){
 			if(branch.hasContributor(userId)){
 				list.add(branch);
@@ -51,6 +63,7 @@
 		}
 		return list;
 	}
+	*/
 	
 	public LGBranch getBranch(Long branchId){
 		return getBranchMap().getValuesByOwnKey(branchId);
--- a/src/main/webapp/pages/search.jsp	Fri Nov 20 11:53:29 2015 +0100
+++ b/src/main/webapp/pages/search.jsp	Fri Nov 20 15:18:28 2015 +0100
@@ -473,21 +473,25 @@
 								 	<img alt="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>">
 								</a>
 							</td>
-							<td>
+							<td style="max-width:300px;">
 								<% if(section.getBranches() != null && !section.getBranches().isEmpty()) { %>
-									<table>
+									<table style="width:100%">
 										<% for(LGBranch branch : section.getBranches()) { %>
 											<tr>
 												<td>
-													<table>
+													<table style="width:100%">
 													<tr><td><%=branch.getFomattedLastChange() %></td></tr>
 													<tr><td><%=branch.getLabel() %></td></tr>
 													</table>
 												</td>
-												<td>
+												<td style="max-width:150px">
+													<% if (branch.hasContributor(sessionBean.getUser().getId())) { %>
 													<a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" >
 														<img alt="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/>
 													</a>												
+													<% } else { %>
+														<label>Contributors: <%=branch.getContributorsNameList() %></label>
+													<% } %>
 												</td>
 											</tr>
 										<% } %>