Mercurial > hg > LGServices
diff src/main/webapp/methods/addSectionToTopic.jsp @ 62:824b808a7481
improvements and bug fixed
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 18 Jul 2016 17:35:32 +0200 |
parents | b8ad346e39a0 |
children |
line wrap: on
line diff
--- a/src/main/webapp/methods/addSectionToTopic.jsp Wed May 25 11:20:27 2016 +0200 +++ b/src/main/webapp/methods/addSectionToTopic.jsp Mon Jul 18 17:35:32 2016 +0200 @@ -38,32 +38,43 @@ <td><label style="font-weight: bold;">Name</label></td> </tr> - <% for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) {%> - <tr> - <td><%=topic.getId() %></td> - <td> - <%=topic.getNameEn() %>(<%=topic.getNameCh() %>) - - <% if(request.getParameter("sectionId") != null) { - Long sectionId = Long.parseLong(request.getParameter("sectionId")); - %> - <!-- add section to selected topic --> - <input name="selectedSectionId" type="hidden" value="<%=request.getParameter("sectionId") %>" /> - - <input type="image" - onclick="setAction0('addSection', 'addSectionToTopicForm', 'selectedTopicId', '<%=topic.getId() %>');" - src="<%=sessionBean.getApplicationBean().getPlusImage() %>" width="20" height="20"/> - - <% } else if (request.getParameter("addAllSections") != null) { %> - <input type="image" - onclick="setAction0('addAllSections', 'addSectionToTopicForm', 'selectedTopicId', '<%=topic.getId() %>');" - src="<%=sessionBean.getApplicationBean().getPlusImage() %>" width="20" height="20"/> + + <% + Long userId = sessionBean.getUser().getId(); + + for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) { + // should show only the topic that current user has access to (is the creator or in contributorList) + if (Long.compare(topic.getUserId(), userId) == 0 || topic.getContributorsList().contains(userId) ) { + + %> + <tr> + <td><%=topic.getId() %></td> + <td> + <%=topic.getNameEn() %>(<%=topic.getNameCh() %>) - <% } %> - - </td> - </tr> - <% } %> + <% if(request.getParameter("sectionId") != null) { + Long sectionId = Long.parseLong(request.getParameter("sectionId")); + %> + <!-- add section to selected topic --> + <input name="selectedSectionId" type="hidden" value="<%=request.getParameter("sectionId") %>" /> + + <input type="image" + onclick="setAction0('addSection', 'addSectionToTopicForm', 'selectedTopicId', '<%=topic.getId() %>');" + src="<%=sessionBean.getApplicationBean().getPlusImage() %>" width="20" height="20"/> + + <% } else if (request.getParameter("addAllSections") != null) { %> + <input type="image" + onclick="setAction0('addAllSections', 'addSectionToTopicForm', 'selectedTopicId', '<%=topic.getId() %>');" + src="<%=sessionBean.getApplicationBean().getPlusImage() %>" width="20" height="20"/> + + <% } %> + + </td> + </tr> + <% + } + } + %> </table> </form>