Mercurial > hg > LGServices
diff src/main/webapp/pages/search.jsp @ 41:ba9515f22897
new: topic management and adding sections from searching result into topic
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 17 Dec 2015 13:44:08 +0100 |
parents | 37840afb7b80 |
children | 9dbbbfd474f4 |
line wrap: on
line diff
--- a/src/main/webapp/pages/search.jsp Mon Dec 07 17:06:57 2015 +0100 +++ b/src/main/webapp/pages/search.jsp Thu Dec 17 13:44:08 2015 +0100 @@ -12,10 +12,37 @@ <jsp:include page="../componentes/headContent.jsp"/> + <script> + + $(function() { + + $( ".addSectionToTopic" ).click(function() { + var sectionId = $( this ).data('section-id'); + - <script> - $(function() { + console.log("addSectionToTopic. sectionId = " + sectionId); + + var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/addSectionToTopic.jsp?sectionId=" + sectionId; + + + $.ajax( url0 ) + .done(function(data) { + $( "#dialogAddSectionToTopicTable" ).replaceWith(data); + dialogAddSectionToTopic.dialog( "open" ); + }) + .fail(function() { + console.error("Error calling: " + query); + }) + + }); + + var dialogAddSectionToTopic = $("#dialogAddSectionToTopic").dialog({ + position: { my: "center", at: "top+400", of: window }, // TODO show dialog at cursor position? + autoOpen: false + }); + + $( "#dialogMoreInfo" ).dialog({ autoOpen: false, modal: true, @@ -161,366 +188,382 @@ <jsp:include page="../componentes/template.jsp"/> <div id="dialogMoreInfo" title="Section Details"> - <div id="dialogMoreInfoTable">XXXX</div> + <div id="dialogMoreInfoTable"></div> </div> - + + <div id="dialogAddSectionToTopic" title="Add Section into Topic:"> + <div id="dialogAddSectionToTopicTable"></div> + </div> <div id="page"> - <% if(sessionBean.getUser() == null) { %> - <label>You must login!</label> - <% } else { %> - - <label class="subTitel">Search for Sections</label> - - <form name="searchForm" id="searchForm" - action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" - method="post" - class="contentForm"> - <input name="bean" type="hidden" value="searchBean" /> - + <% if (sessionBean.getUser() == null) { %> + <label class="subTitel">You must login!</label> + <%} else if (sessionBean.getSearchPage().getSearchIn() == null) { %> + <label class="subTitel">The searchPage().getSearchIn() is null.</label> - <table style="width: 300px; margin-left: auto;margin-right: auto;"> - <tr> - <td> - <input - id="searchTerm" - name="searchTerm" - type="text" - class="searchInput" - value="<%=sessionBean.getSearchPage().getSearchTerm()%>" /> - </td> - <td> - <input - type="image" - onclick="setAction('search', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/> - </td> - </tr> - <tr> - <td> - <label>Search in:</label> - <input type="radio" name="searchIn" value="0" <%= (sessionBean.getSearchPage().getSearchIn() == 0) ? "checked" : "" %>><label>Section Name</label> - <input type="radio" name="searchIn" value="1" <%= (sessionBean.getSearchPage().getSearchIn() == 1) ? "checked" : "" %>/><label>Book Name</label> - </td> - </tr> - <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getSearchMessage())) ? sessionBean.getSearchPage().getSearchMessage() : ""%></label></td></tr> - <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getFilteringMessage())) ? sessionBean.getSearchPage().getFilteringMessage() : ""%></label></td></tr> - </table> - - - <% - if (sessionBean.getSearchPage().getCompleteSectionList() != null) { - %> - - - <jsp:include page="../componentes/paginator.jsp"> - <jsp:param name="formName" value="searchForm"/> - </jsp:include> + <% } else { %> + + <label class="subTitel">Search for Sections</label> + + <form name="searchForm" id="searchForm" + action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" + method="post" + class="contentForm"> + <input name="bean" type="hidden" value="searchBean" /> + - <div class="tableDiv double-scroll"> - <table class="pageTable"> - <tbody> - <tr> - <th> - <table class="sortTable"> - <tr> - <td><label class="tableTitle">Book Id</label></td> - <td> - <table> - <tr><td> - <input type="image" - onclick="setAction('sortByBookIdUp', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortByBookIdDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </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', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortByBookNameDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </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', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortByLevel1Down', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </td> - </tr> - <tr> - <td> - <input type="text" class="filterInput" name="level1Filter" id="level1Filter" value="<%= sessionBean.getSearchPage().getLevel1Filter()%>"/> - </td> - <td> - <input type="image" - onclick="setAction('filter', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> - </td> - </tr> - </table> - </th> - <th><label class="tableTitle">Level 2</label></th> - <th> - <table class="sortTable"> - <tr> - <td><label class="tableTitle">Dynasty</label></td> - <td> - <table> - <tr><td> - <input type="image" - onclick="setAction('sortByDynastyUp', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> + <table style="width: 300px; margin-left: auto;margin-right: auto;"> + <tr> + <td> + <input + id="searchTerm" + name="searchTerm" + type="text" + class="searchInput" + value="<%=sessionBean.getSearchPage().getSearchTerm()%>" /> + </td> + <td> + <input + type="image" + onclick="setAction('search', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getSearchImage()%>"/> + </td> + </tr> + <tr> + <td> + <label>Search in:</label> + <input type="radio" name="searchIn" value="0" <%= (sessionBean.getSearchPage().getSearchIn() == 0) ? "checked" : "" %>/><label>Section Name</label> + <input type="radio" name="searchIn" value="1" <%= (sessionBean.getSearchPage().getSearchIn() == 1) ? "checked" : "" %>/><label>Book Name</label> + + </td> + </tr> + <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getSearchMessage())) ? sessionBean.getSearchPage().getSearchMessage() : ""%></label></td></tr> + <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getSearchPage().getFilteringMessage())) ? sessionBean.getSearchPage().getFilteringMessage() : ""%></label></td></tr> + </table> + + + <% if (sessionBean.getSearchPage().getCompleteSectionList() != null) { %> + + + <jsp:include page="../componentes/paginator.jsp"> + <jsp:param name="formName" value="searchForm"/> + </jsp:include> + + <div class="tableDiv double-scroll"> + <table class="pageTable"> + <tbody> + <tr> + <th> + <table class="sortTable"> + <tr> + <td><label class="tableTitle">Book Id</label></td> + <td> + <table> + <tr><td> + <input type="image" + onclick="setAction('sortByBookIdUp', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByBookIdDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </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', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByBookNameDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </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', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByLevel1Down', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </td> + </tr> + <tr> + <td> + <input type="text" class="filterInput" name="level1Filter" id="level1Filter" value="<%= sessionBean.getSearchPage().getLevel1Filter()%>"/> + </td> + <td> <input type="image" - onclick="setAction('sortByDynastyDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </td> - </tr> - <tr> - <td> - <input type="text" class="filterInput" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getSearchPage().getDynastyFilter()%>"/> - </td> - <td> - <input type="image" - onclick="setAction('filter', 'searchForm');" - 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', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortByPeriodDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </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', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortByAdminTypeDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </td> - </tr> - <tr> - <td> - <input type="text" class="filterInput" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getSearchPage().getAdminTypeFilter()%>"/> - </td> - <td> - <input type="image" - onclick="setAction('filter', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> - </td> - </tr> - </table> - </th> - <!-- - <th> - <table class="sortTable"> - <tr> - <td><label class="tableTitle">Volume</label></td> - <td> - <table> - <tr><td> - <input type="image" - onclick="setAction('sortByVolumeUp', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortByVolumeDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </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', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortBySectionNameDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </td> - </tr> - </table> - </th> - <th> - <table class="sortTable"> - <tr> - <td><label class="tableTitle">Pages</label></td> - <td> - <table> - <tr><td> - <input type="image" - onclick="setAction('sortByStartPageUp', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> - </td></tr> - <tr><td> - <input type="image" - onclick="setAction('sortByStartPageDown', 'searchForm');" - src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> - </td></tr> - </table> - </td> - </tr> - </table> - - </th> - <th><label class="tableTitle">View Page Text</label></th> - <th><label class="tableTitle">Existing Branches</label></th> - </tr> - - - <% - for (DBSection section : sessionBean.getSearchPage().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.getBook().getId()%> - </a> - <img alt="More Information" src="<%=sessionBean.getApplicationBean().getMoreInfoImage()%>" data-section-id="<%=section.getId()%>" class="moreInfo"/> - </td> - <td><%=section.getBook().getName()%></td> - <td><%=section.getBook().getLevel1()%></td> - <td><%=section.getBook().getLevel2()%></td> - <td><%=section.getBook().getDynasty()%></td> - <td><%=section.getBook().getPeriod()%></td> - <td><%=section.getBook().getAdmin_type() %></td> - <td><%=section.getName()%></td> - <td><%=section.getPages()%></td> - <td> - <a href="#" - title="Show Section in Extraction Interface" - onclick="sectionInExtractionInterface('<%=section.getId() %>', '<%=section.getName() %>', '<%=section.getBook().getId() %>', '<%=section.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');"> - <img alt="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>"> - </a> - </td> - <td style="max-width:300px;"> - <% if(section.getBranches() != null && !section.getBranches().isEmpty()) { %> - <table style="width:100%"> - <% for(LGBranch branch : section.getBranches()) { %> + onclick="setAction('filter', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> + </table> + </th> + <th><label class="tableTitle">Level 2</label></th> + <th> + <table class="sortTable"> + <tr> + <td><label class="tableTitle">Dynasty</label></td> + <td> + <table> + <tr><td> + <input type="image" + onclick="setAction('sortByDynastyUp', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByDynastyDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </td> + </tr> <tr> <td> - <table style="width:100%"> - <tr><td><%=branch.getFomattedLastChange() %></td></tr> - <tr><td><%=branch.getLabel() %></td></tr> + <input type="text" class="filterInput" name="dynastyFilter" id="dynastyFilter" value="<%= sessionBean.getSearchPage().getDynastyFilter()%>"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'searchForm');" + 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', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByPeriodDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </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', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByAdminTypeDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> </table> </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> - <% } %> + </tr> + <tr> + <td> + <input type="text" class="filterInput" name="adminTypeFilter" id="adminTypeFilter" value="<%= sessionBean.getSearchPage().getAdminTypeFilter()%>"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> + </table> + </th> + <!-- + <th> + <table class="sortTable"> + <tr> + <td><label class="tableTitle">Volume</label></td> + <td> + <table> + <tr><td> + <input type="image" + onclick="setAction('sortByVolumeUp', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByVolumeDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </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', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortBySectionNameDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> </td> </tr> - <% } %> - </table> - <% } %> - </td> - - </tr> - <% - } - %> - </tbody> - </table> - + </table> + </th> + <th> + <table class="sortTable"> + <tr> + <td><label class="tableTitle">Pages</label></td> + <td> + <table> + <tr><td> + <input type="image" + onclick="setAction('sortByStartPageUp', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByStartPageDown', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </td> + </tr> + </table> + + </th> + <th><label class="tableTitle">View Text</label></th> + <th><label class="tableTitle">Add to Topic</label></th> + <th><label class="tableTitle">Existing Tasks</label></th> + </tr> + - <% - } - %> - - </div> - - <jsp:include page="../componentes/paginator.jsp"> - <jsp:param name="formName" value="searchForm"/> - </jsp:include> - - </form> - + <% + for (DBSection section : sessionBean.getSearchPage().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.getBook().getId()%> + </a> + <img alt="More Information" src="<%=sessionBean.getApplicationBean().getMoreInfoImage()%>" data-section-id="<%=section.getId()%>" class="moreInfo"/> + </td> + <td><%=section.getBook().getName()%></td> + <td><%=section.getBook().getLevel1()%></td> + <td><%=section.getBook().getLevel2()%></td> + <td><%=section.getBook().getDynasty()%></td> + <td><%=section.getBook().getPeriod()%></td> + <td><%=section.getBook().getAdmin_type() %></td> + <td><%=section.getName()%></td> + <td><%=section.getPages()%></td> + + + <!-- View text in Ext-Interface --> + <td> + <a href="#" + title="Show Section in Extraction Interface" + onclick="sectionInExtractionInterface('<%=section.getId() %>', '<%=section.getName() %>', '<%=section.getBook().getId() %>', '<%=section.getBook().getName() %>', '<%=sessionBean.getUser().getId() %>', '<%=sessionBean.getApplicationBean().getExtractionInterfaceUrl()%>');"> + <img alt="Show Section in Extraction Interface" src="<%=sessionBean.getApplicationBean().getShowImage()%>"> + </a> + + </td> + + <!-- Add to Topic --> + <td> + + <img width="10" height="10" alt="Add the section to Topic" src="<%=sessionBean.getApplicationBean().getPlusImage()%>" data-section-id="<%=section.getId()%>" class="addSectionToTopic"> + + </td> + + + <!-- Existing 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())) { %> + <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> + <% } %> + </table> + <% } %> + </td> + + </tr> + <% } %> + </tbody> + </table> + + + <% } %> + + </div> + + <jsp:include page="../componentes/paginator.jsp"> + <jsp:param name="formName" value="searchForm"/> + </jsp:include> + + </form> + <% } %> </div>