Mercurial > hg > LGServices
view src/main/webapp/pages/topicPage.jsp @ 60:90d5e86c157d
new: auto refresh page when there's new version saved from Ext-Interface
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Wed, 25 May 2016 11:11:32 +0200 |
parents | b8ad346e39a0 |
children | 824b808a7481 |
line wrap: on
line source
<%@page import="de.mpiwg.gazetteer.dataverse.bo.VDCUser"%> <%@page import="de.mpiwg.gazetteer.bo.LGFile"%> <%@page import="de.mpiwg.gazetteer.bo.LGBranch"%> <%@page import="org.apache.commons.lang.StringUtils"%> <%@page import="de.mpiwg.gazetteer.db.DBSection"%> <%@page import="de.mpiwg.gazetteer.db.DBBook"%> <%@ 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"/> <script> $(function() { $("#showPendingButton").click(function() { if($('#pendingBooks').css('display') == 'none'){ $('#pendingBooks').show(); $("#showPendingButton").text('Hide Missing Books'); } else { $('#pendingBooks').hide(); $("#showPendingButton").text('Show Missing Books'); } }); $( "#dialogDataverse" ).dialog({ autoOpen: false, modal: true, width: 600, position: { my: "center", at: "top", of: window }, hide: { effect: "explode", duration: 1000 } }); $( ".get-studies" ).click(function() { var fileId = $( this ).data('file-id'); var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/getDataverseForm.jsp?fileId=" + fileId; $.ajax( url0 ) .done(function(data) { $( "#dialogDataverseTable" ).replaceWith(data); $( "#dialogDataverse" ).dialog( "open" ); }) .fail(function() { console.error("Error calling: " + query); }) }); var dialog = $( "#dialogAddContributors" ).dialog( {autoOpen: false} ); $( "#addContributors" ).button().on( "click", function() { dialog.dialog( "open" ); }); }); </script> </head> <body> <jsp:include page="../componentes/template.jsp"/> <div id="page"> <% if(sessionBean.getUser() == null) { %> <label class="subTitel">You must login!</label> <% } else { %> <% if(sessionBean.getTopicPage().getCompleteSectionList() == null || request.getParameter("topicId") != null) { sessionBean.getTopicPage().loadParameters(request, response); sessionBean.getTopicPage().loadTopic(request.getParameter("topicId")); } %> <div id="dialogAddContributors" title="Select a new Contributors:"> <form name="contributorsForm" id="contributorsForm" action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" method="post"> <input name="bean" type="hidden" value="topicBean" /> <input name="topicId" type="hidden" value="<%=sessionBean.getTopicPage().getTopicId()%>" /> <table> <% for(VDCUser user : sessionBean.getTopicPage().getSuggestionUserList()) { %> <tr> <td><a href="#" onclick="setAction0('addContributor', 'contributorsForm', 'userId', <%=user.getId() %>);document.getElementById('contributorsForm').submit();"><%=user.getUserName()%></a></td> </tr> <% } %> </table> </form> </div> <!-- Topic Detail --> <div> <label class="subTitel">Topic "<%=sessionBean.getTopicPage().getTopic().getNameEn() %> (<%=sessionBean.getTopicPage().getTopic().getNameCh()%>)"</label> <form name="topicForm" action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" method="post"> <input name="bean" type="hidden" value="topicBean" /> <input name="topicId" type="hidden" value="<%=sessionBean.getTopicPage().getTopicId()%>" /> <table class="tableComponent"> <tr> <td><label>Topic Id</label></td> <td><label><%=sessionBean.getTopicPage().getTopic().getId() %></label></td> </tr> <tr> <td><label>Topic Name(eng)</label></td> <td><label><%=sessionBean.getTopicPage().getTopic().getNameEn() %></label></td> </tr> <tr> <td><label>Topic Name(chi)</label></td> <td><label><%=sessionBean.getTopicPage().getTopic().getNameCh() %></label></td> </tr> <tr> <td><label>Topic Name(pinyin)</label></td> <td><label><%=sessionBean.getTopicPage().getTopic().getNamePinyin() %></label></td> </tr> <tr> <td><label>Description</label></td> <td> <input type="text" name="description" size="60" maxlength="250" value="<%=sessionBean.getTopicPage().getTopic().getDescription() %>" /> <input type="image" title="edit description" onclick="setAction('updateDescription', 'topicForm');" src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="15" height="15"/> </td> </tr> <tr> <td><label>Searching Keywords(separated by ",")</label></td> <td> <input type="text" name="keywords" size="60" maxlength="250" value="<%=sessionBean.getTopicPage().getTopic().getKeywords() %>" /> <input type="image" title="edit keywords" onclick="setAction('updateKeywords', 'topicForm');" src="<%=sessionBean.getApplicationBean().getSaveImage()%>" width="15" height="15"/> </td> </tr> <tr> <td><label>Created</label></td> <td><label><%=sessionBean.getTopicPage().getTopic().getFomattedCreation() %></label></td> </tr> <tr> <td><label>Last Modified</label></td> <td><label><%=sessionBean.getTopicPage().getTopic().getFomattedLastChange() %></label></td> </tr> <tr> <td><label>Creator</label></td> <td><label><%=sessionBean.getTopicPage().getTopic().getUsername() %></label></td> </tr> <tr> <td><label>Contributors</label></td> <td> <table> <tr> <td> <table style="width: 300px;" class="pageTable"> <% for(VDCUser contr : sessionBean.getTopicPage().getContributors()) { %> <tr> <td><label><%=contr.getUserName() %></label></td> <td> <input type="image" onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('removeContributor', 'topicForm', 'userId', <%=contr.getId() %>);" src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/> </td> </tr> <% } %> </table> </td> <td> <button id="addContributors" type="button" class="lgButton">Add Contributors</button> </td> </tr> </table> </td> </tr> </table> </form> </div> <div> <button id="showPendingButton" type="button" class="lgButton" >Show Missing Books</button> <form name="topicSectionRelationForm" action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" method="post"> <input name="bean" type="hidden" value="topicBean" /> <input name="topicId" type="hidden" value="<%=sessionBean.getTopicPage().getTopicId()%>" /> <div id="pendingBooks" style="display:none"> <label class="subTitel"><%=sessionBean.getTopicPage().getPendingBookList().size()%> book(s) not in the topic.</label> <div class="tableDiv double-scroll" > <table class="pageTable"> <tr> <th><label class="tableTitle">Book Id</label></th> <th><label class="tableTitle">Book Name</label></th> <th><label class="tableTitle">Level 1</label></th> <th><label class="tableTitle">Level 2</label></th> <th><label class="tableTitle">Dynasty</label></th> <th><label class="tableTitle">Period</label></th> <th><label class="tableTitle">Admin Type</label></th> <th><label class="tableTitle">Section Name</label></th> <th><label class="tableTitle">Section Pages</label></th> <th><label class="tableTitle">Load Text (Plain)</label></th> <th><label class="tableTitle">Load tagged text in Extraction Interface</label></th> <th><label class="tableTitle">Remove</label></th> </tr> <!-- pending book list --> <% for(DBBook book : sessionBean.getTopicPage().getPendingBookList() ) { %> <tr> <td> <a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=book.getId() %>&count=100&sessionId=<%= session.getId()%>" target="blank"> <%=book.getId() %> </a> </td> <td><label><%= book.getName() %></label></td> <td class="removedContent"><label><%= book.getLevel1() %></label></td> <td class="removedContent"><label><%= book.getLevel2() %></label></td> <td class="removedContent"><label><%= book.getDynasty() %></label></td> <td class="removedContent"><label><%= book.getPeriod() %></label></td> <td class="removedContent"><label><%= book.getAdmin_type() %></label></td> <td class="removedContent"><label>-</label></td> <td class="removedContent"><label>-</label></td> <td class="removedContent"><label>-</label></td> <td class="removedContent"><label>-</label></td> <td class="removedContent"><label>-</label></td> </tr> <% } %> </table> </div> </div> <label class="subTitel"> <%=sessionBean.getTopicPage().getCompleteSectionList().size() %> section(s) in the topic <input type="image" onclick="setAction('forceLoadTopicSectionRelation', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getRefreshImage()%>" width="20" height="20"/> </label> <label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getTopicPage().getFilteringMessage())) ? sessionBean.getTopicPage().getFilteringMessage() : ""%></label> <!-- Sections in Topic --> <% if(sessionBean.getTopicPage().getCompleteSectionList().isEmpty()) { %> <label>(No section in the topic...)</label> <% } else { %> <div class="tableDiv double-scroll"> <table class="pageTable"> <tr> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Book Id</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByBookIdUp', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByBookIdDown', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="bookIdFilter" id="bookIdFilter" value="<%= sessionBean.getTopicPage().getBookIdFilter() %>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Book Name</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByBookNameUp', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByBookNameDown', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="bookNameFilter" id="bookNameFilter" value="<%= sessionBean.getTopicPage().getBookNameFilter() %>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Level 1</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByLevel1Up', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByLevel1Down', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="level1Filter" id="level1Filter" value="<%= sessionBean.getTopicPage().getLevel1Filter()%>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Level 2</label></td> <td> <table> <tr> <td> <input type="image" onclick="setAction('sortByLevel2Up', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td> </tr> <tr> <td> <input type="image" onclick="setAction('sortByLevel2Down', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td> </tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="level2Filter" id="level2Filter" value="<%= sessionBean.getTopicPage().getLevel2Filter()%>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Dynasty</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByDynastyUp', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByDynastyDown', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getTopicPage().getDynastyFilter() %>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Period</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByPeriodUp', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByPeriodDown', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="periodFilter" id="periodFilter" value="<%= sessionBean.getTopicPage().getPeriodFilter()%>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Admin Type</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByAdminTypeUp', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByAdminTypeDown', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getTopicPage().getAdminTypeFilter()%>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Section Name</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortBySectionNameUp', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortBySectionNameDown', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> <tr> <td> <input type="text" class="filterInput" name="sectionNameFilter" id="sectionNameFilter" value="<%= sessionBean.getTopicPage().getSectionNameFilter()%>"/> </td> <td> <input type="image" onclick="setAction('filter', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> </td> </tr> </table> </th> <th> <table class="sortTable"> <tr> <td><label class="tableTitle">Section Pages</label></td> <td> <table> <tr><td> <input type="image" onclick="setAction('sortByStartPageUp', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> </td></tr> <tr><td> <input type="image" onclick="setAction('sortByStartPageDown', 'topicSectionRelationForm');" src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> </td></tr> </table> </td> </tr> </table> </th> <th><label class="tableTitle">Load Text (Plain)</label></th> <th><label class="tableTitle">Load tagged text in Extraction Interface</label></th> <th><label class="tableTitle">Remove</label></th> </tr> <% for(DBSection section : sessionBean.getTopicPage().getDisplaySectionList() ) { %> <tr> <td> <a href="<%=sessionBean.getApplicationBean().getTocInterfaceUrl()%>/check_sections_details.php?book_id=<%=section.getBook().getId() %>&count=100&sessionId=<%= session.getId()%>" target="blank"> <%=section.getBookId()%> </a> </td> <td><label><%= section.getBook().getName() %></label></td> <td><label><%= section.getBook().getLevel1() %></label></td> <td><label><%= section.getBook().getLevel2() %></label></td> <td><label><%= section.getBook().getDynasty() %></label></td> <td><label><%= section.getBook().getPeriod() %></label></td> <td><label><%= section.getBook().getAdmin_type() %></label></td> <td><label><%= section.getName() %></label></td> <td><label><%= section.getPages() %></label></td> <!-- view text in Ext-Interface --> <td> <!-- pass topicId to extraction interface --> <a href="#" title="Show Section in Extraction Interface" onclick="sectionInExtractionInterface('<%=section.getId() %>', '<%=section.getName() %>', '<%=section.getBookId() %>', '<%=section.getBook().getName() %>', '<%=sessionBean.getTopicPage().getTopicId() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');"> <img title="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>"> </a> </td> <!-- existing branches (tasks) --> <td style="max-width:300px;"> <% if(section.getBranches() != null && !section.getBranches().isEmpty()) { %> <table style="width:100%"> <% for(LGBranch branch : section.getBranches()) { %> <tr> <td> <table style="width:100%"> <tr><td><%=branch.getFomattedLastChange() %></td></tr> <tr><td><%=branch.getLabel() %></td></tr> </table> </td> <td style="max-width:150px"> <% if (branch.hasContributor(sessionBean.getUser().getId())) { %> <table style="width:100%"> <tr><td> <a href="<%=sessionBean.getApplicationBean().getRootServer() %>/pages/branchPage.jsp?branchId=<%=branch.getId() %>" > <img title="Manage Branch" src="<%=sessionBean.getApplicationBean().getEditBranchImage()%>"/> </a> </td></tr> <tr><td> <!-- view text for the latest version --> <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 title="Show Task in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/> </a> </td></tr> </table> <% } else { %> <label>Contributors: <%=branch.getContributorsNameList() %></label> <% } %> </td> </tr> <% } %> </table> <% } %> </td> <td> <input type="image" onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteSection', 'topicSectionRelationForm', 'sectionId', <%=section.getId() %>);" src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/> </td> </tr> <% } %> </table> </div> <% } %> </form> </div> <% } %> </div> </body>