Mercurial > hg > LGServices
diff src/main/webapp/pages/fullTextSearch.jsp @ 51:cf747a960516
new: auto scroll to the last position when de/selecting rows, and add number of selected rows info, in full text search page
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Fri, 29 Jan 2016 11:54:32 +0100 |
parents | 8f6c47775fe8 |
children | fc4ee9cc587b |
line wrap: on
line diff
--- a/src/main/webapp/pages/fullTextSearch.jsp Tue Jan 26 13:41:47 2016 +0100 +++ b/src/main/webapp/pages/fullTextSearch.jsp Fri Jan 29 11:54:32 2016 +0100 @@ -15,6 +15,8 @@ <jsp:include page="../componentes/headContent.jsp"/> <script> + + $(function() { $( "#dialogMoreInfo" ).dialog({ autoOpen: false, @@ -24,7 +26,10 @@ }); var dialogSave = $("#dialogSave").dialog( - {autoOpen: false} + { + autoOpen: false, + position: { my: "left+100px", at: "top", of: $("#saveResult") }, + } ); $("#saveResult").button().on( "click", function() { // append searchTerm into the form @@ -39,8 +44,11 @@ }); var dialogViewSavedResult = $("#dialogViewSavedResult").dialog( - {autoOpen: false} - ); + { + autoOpen: false, + position: { my: "left+100px", at: "top", of: $("#viewSavedResult") }, + } + ); $("#viewSavedResult").button().on( "click", function() { dialogViewSavedResult.dialog( "open" ); }); @@ -66,10 +74,34 @@ } }); + function setMousePos(){ + var x = event.clientX; + var y = event.clientY; + $("#mouseX").val(x); + $("#mouseY").val(y); + } + $(document).ready(function(){ highlightKeywords(); + scrollPage(); }) + function scrollPage() { + var id = $("#focusedId").val(); + if (id == undefined || $("#content_"+id).offset() == undefined) return; + + //$('html,body').animate({scrollTop: $("#content_"+id).offset().top}, 'fast'); + + var x = $("#mouseX").val(); + var y = $("#mouseY").val(); + var offsetInElement = $("#content_"+id).height() / 2; + + //console.log("y: " + y + ", top: " + $("#content_"+id).offset().top + ", offsetInElement: " + offsetInElement); + if (y == undefined) return; + + $('html,body').animate({scrollTop: $("#content_"+id).offset().top - y + offsetInElement}, 'fast'); + } + function highlightKeywords() // highlight keywords in content column, with class="content" { if ($("#searchTerm")[0] == undefined ){ @@ -117,13 +149,14 @@ %> <div id="dialogSave" title="Save Table:"> + <form name="saveTableForm" id="saveTableForm" action="<%= sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" method="post"> <input name="bean" type="hidden" value="fullTextSearchBean" /> <table> <tr> - <td> + <td>Save the selected <%=sessionBean.getFullTextSearchPage().getSelectedNumOfContent() %> section(s) to table: <input id="fileName" name="fileName" type="text" placeholder="table name"/> </td> <td> @@ -144,6 +177,9 @@ <td class="tableTitle">View html</td> <td class="tableTitle"></td> <td class="tableTitle">View on LGMap</td> + <!-- + <td class="tableTitle">Delete(TODO?)</td> + --> </tr> <% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%> @@ -167,6 +203,14 @@ <img alt="View on LGMap" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/> </a> </td> + <!-- + <td> + <input type="image" + onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();" + src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/> + + </td> + --> </tr> <% } %> @@ -176,12 +220,18 @@ </div> <label class="subTitel">Full Text Search</label> + <form name="fullTextSearchForm" id="fullTextSearchForm" action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" method="post" class="contentForm"> <input name="bean" type="hidden" value="fullTextSearchBean" /> - + <input id="focusedId" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getFocusedContentId() %>"/> + + <input id="mouseX" name="mouseX" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getMouseX() %>"/> + <input id="mouseY" name="mouseY" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getMouseY() %>"/> + + <table style="width: 300px; margin-left: auto;margin-right: auto;"> <tr> <td> @@ -227,6 +277,8 @@ <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getSearchMessage())) ? sessionBean.getFullTextSearchPage().getSearchMessage() : ""%></label></td></tr> <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getFilteringMessage())) ? sessionBean.getFullTextSearchPage().getFilteringMessage() : ""%></label></td></tr> + <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getSelectedContentMessage())) ? sessionBean.getFullTextSearchPage().getSelectedContentMessage() : ""%></label></td></tr> + <tr><td> <button id="saveResult" type="button" class="lgButton">Save Table</button> <button id="viewSavedResult" type="button" class="lgButton">View/Load Saved Table(s)</button> @@ -611,15 +663,15 @@ <td><%=content.getSection().getPages()%></td> <td><%=content.getPage() %></td> <td class="content"><%=content.getContent()%></td> - <td> + <td id="content_<%=content.getId() %>"> <% if ( content.isRemoved() ) { %> - <input type="image" onclick="setAction0('recoverFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');" + <input type="image" onclick="setMousePos(); setAction0('recoverFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');" src="<%=sessionBean.getApplicationBean().getCheckboxUncheckedImage()%>" width="20" height="20"/> <% } else { %> - <input type="image" onclick="setAction0('removeFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');" + <input type="image" onclick="setMousePos(); setAction0('removeFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');" src="<%=sessionBean.getApplicationBean().getCheckboxCheckedImage()%>" width="20" height="20"/> <% } %>