comparison 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
comparison
equal deleted inserted replaced
50:8f6c47775fe8 51:cf747a960516
13 <head> 13 <head>
14 14
15 <jsp:include page="../componentes/headContent.jsp"/> 15 <jsp:include page="../componentes/headContent.jsp"/>
16 16
17 <script> 17 <script>
18
19
18 $(function() { 20 $(function() {
19 $( "#dialogMoreInfo" ).dialog({ 21 $( "#dialogMoreInfo" ).dialog({
20 autoOpen: false, 22 autoOpen: false,
21 modal: true, 23 modal: true,
22 position: { my: "center", at: "top", of: window }, 24 position: { my: "center", at: "top", of: window },
23 25
24 }); 26 });
25 27
26 var dialogSave = $("#dialogSave").dialog( 28 var dialogSave = $("#dialogSave").dialog(
27 {autoOpen: false} 29 {
30 autoOpen: false,
31 position: { my: "left+100px", at: "top", of: $("#saveResult") },
32 }
28 ); 33 );
29 $("#saveResult").button().on( "click", function() { 34 $("#saveResult").button().on( "click", function() {
30 // append searchTerm into the form 35 // append searchTerm into the form
31 $('<input>').attr({ 36 $('<input>').attr({
32 type: 'hidden', 37 type: 'hidden',
37 42
38 dialogSave.dialog( "open" ); 43 dialogSave.dialog( "open" );
39 }); 44 });
40 45
41 var dialogViewSavedResult = $("#dialogViewSavedResult").dialog( 46 var dialogViewSavedResult = $("#dialogViewSavedResult").dialog(
42 {autoOpen: false} 47 {
43 ); 48 autoOpen: false,
49 position: { my: "left+100px", at: "top", of: $("#viewSavedResult") },
50 }
51 );
44 $("#viewSavedResult").button().on( "click", function() { 52 $("#viewSavedResult").button().on( "click", function() {
45 dialogViewSavedResult.dialog( "open" ); 53 dialogViewSavedResult.dialog( "open" );
46 }); 54 });
47 55
48 56
64 72
65 }); 73 });
66 } 74 }
67 }); 75 });
68 76
77 function setMousePos(){
78 var x = event.clientX;
79 var y = event.clientY;
80 $("#mouseX").val(x);
81 $("#mouseY").val(y);
82 }
83
69 $(document).ready(function(){ 84 $(document).ready(function(){
70 highlightKeywords(); 85 highlightKeywords();
86 scrollPage();
71 }) 87 })
72 88
89 function scrollPage() {
90 var id = $("#focusedId").val();
91 if (id == undefined || $("#content_"+id).offset() == undefined) return;
92
93 //$('html,body').animate({scrollTop: $("#content_"+id).offset().top}, 'fast');
94
95 var x = $("#mouseX").val();
96 var y = $("#mouseY").val();
97 var offsetInElement = $("#content_"+id).height() / 2;
98
99 //console.log("y: " + y + ", top: " + $("#content_"+id).offset().top + ", offsetInElement: " + offsetInElement);
100 if (y == undefined) return;
101
102 $('html,body').animate({scrollTop: $("#content_"+id).offset().top - y + offsetInElement}, 'fast');
103 }
104
73 function highlightKeywords() // highlight keywords in content column, with class="content" 105 function highlightKeywords() // highlight keywords in content column, with class="content"
74 { 106 {
75 if ($("#searchTerm")[0] == undefined ){ 107 if ($("#searchTerm")[0] == undefined ){
76 return; 108 return;
77 } 109 }
115 } 147 }
116 148
117 %> 149 %>
118 150
119 <div id="dialogSave" title="Save Table:"> 151 <div id="dialogSave" title="Save Table:">
152
120 <form name="saveTableForm" id="saveTableForm" 153 <form name="saveTableForm" id="saveTableForm"
121 action="<%= sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" 154 action="<%= sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
122 method="post"> 155 method="post">
123 <input name="bean" type="hidden" value="fullTextSearchBean" /> 156 <input name="bean" type="hidden" value="fullTextSearchBean" />
124 <table> 157 <table>
125 <tr> 158 <tr>
126 <td> 159 <td>Save the selected <%=sessionBean.getFullTextSearchPage().getSelectedNumOfContent() %> section(s) to table:
127 <input id="fileName" name="fileName" type="text" placeholder="table name"/> 160 <input id="fileName" name="fileName" type="text" placeholder="table name"/>
128 </td> 161 </td>
129 <td> 162 <td>
130 <button onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save</button> 163 <button onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save</button>
131 164
142 <tr> 175 <tr>
143 <td class="tableTitle">Table name</td> 176 <td class="tableTitle">Table name</td>
144 <td class="tableTitle">View html</td> 177 <td class="tableTitle">View html</td>
145 <td class="tableTitle"></td> 178 <td class="tableTitle"></td>
146 <td class="tableTitle">View on LGMap</td> 179 <td class="tableTitle">View on LGMap</td>
180 <!--
181 <td class="tableTitle">Delete(TODO?)</td>
182 -->
147 </tr> 183 </tr>
148 184
149 <% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%> 185 <% for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getFileList() ){%>
150 <tr> 186 <tr>
151 <td><%= aFile.getFileName() %></td> 187 <td><%= aFile.getFileName() %></td>
165 <a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>" 201 <a href="<%=sessionBean.getApplicationBean().getLGMapUrl() %>&file=<%=aFile.getUserId().toString()%>_<%=aFile.getFileName()%>.csv&name=<%=aFile.getSearchTerms() %>"
166 target="_blank"> 202 target="_blank">
167 <img alt="View on LGMap" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/> 203 <img alt="View on LGMap" src="<%=sessionBean.getApplicationBean().getShowImage()%>"/>
168 </a> 204 </a>
169 </td> 205 </td>
206 <!--
207 <td>
208 <input type="image"
209 onclick="<%=sessionBean.getApplicationBean().getJSConfirmationDelete() %> setAction0('deleteFile', 'fullTextSearchForm', 'fileId','<%=aFile.getId() %>'); document.getElementById('fullTextSearchForm').submit();"
210 src="<%=sessionBean.getApplicationBean().getDeleteImage()%>"/>
211
212 </td>
213 -->
170 </tr> 214 </tr>
171 <% } %> 215 <% } %>
172 216
173 </table> 217 </table>
174 218
175 219
176 </div> 220 </div>
177 <label class="subTitel">Full Text Search</label> 221 <label class="subTitel">Full Text Search</label>
178 222
223
179 <form name="fullTextSearchForm" id="fullTextSearchForm" 224 <form name="fullTextSearchForm" id="fullTextSearchForm"
180 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" 225 action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp"
181 method="post" 226 method="post"
182 class="contentForm"> 227 class="contentForm">
183 <input name="bean" type="hidden" value="fullTextSearchBean" /> 228 <input name="bean" type="hidden" value="fullTextSearchBean" />
184 229 <input id="focusedId" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getFocusedContentId() %>"/>
230
231 <input id="mouseX" name="mouseX" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getMouseX() %>"/>
232 <input id="mouseY" name="mouseY" type="hidden" value="<%=sessionBean.getFullTextSearchPage().getMouseY() %>"/>
233
234
185 <table style="width: 300px; margin-left: auto;margin-right: auto;"> 235 <table style="width: 300px; margin-left: auto;margin-right: auto;">
186 <tr> 236 <tr>
187 <td> 237 <td>
188 <input 238 <input
189 id="searchTerm" 239 id="searchTerm"
225 </tr> 275 </tr>
226 <% } %> 276 <% } %>
227 277
228 <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getSearchMessage())) ? sessionBean.getFullTextSearchPage().getSearchMessage() : ""%></label></td></tr> 278 <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getSearchMessage())) ? sessionBean.getFullTextSearchPage().getSearchMessage() : ""%></label></td></tr>
229 <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getFilteringMessage())) ? sessionBean.getFullTextSearchPage().getFilteringMessage() : ""%></label></td></tr> 279 <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getFilteringMessage())) ? sessionBean.getFullTextSearchPage().getFilteringMessage() : ""%></label></td></tr>
280 <tr><td><label class="label"><%= (StringUtils.isNotEmpty(sessionBean.getFullTextSearchPage().getSelectedContentMessage())) ? sessionBean.getFullTextSearchPage().getSelectedContentMessage() : ""%></label></td></tr>
281
230 <tr><td> 282 <tr><td>
231 <button id="saveResult" type="button" class="lgButton">Save Table</button> 283 <button id="saveResult" type="button" class="lgButton">Save Table</button>
232 <button id="viewSavedResult" type="button" class="lgButton">View/Load Saved Table(s)</button> 284 <button id="viewSavedResult" type="button" class="lgButton">View/Load Saved Table(s)</button>
233 </td></tr> 285 </td></tr>
234 286
609 <td><%=content.getSection().getBook().getAdmin_type() %></td> 661 <td><%=content.getSection().getBook().getAdmin_type() %></td>
610 <td><%=content.getSection().getName() %></td> 662 <td><%=content.getSection().getName() %></td>
611 <td><%=content.getSection().getPages()%></td> 663 <td><%=content.getSection().getPages()%></td>
612 <td><%=content.getPage() %></td> 664 <td><%=content.getPage() %></td>
613 <td class="content"><%=content.getContent()%></td> 665 <td class="content"><%=content.getContent()%></td>
614 <td> 666 <td id="content_<%=content.getId() %>">
615 <% if ( content.isRemoved() ) { %> 667 <% if ( content.isRemoved() ) { %>
616 668
617 <input type="image" onclick="setAction0('recoverFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');" 669 <input type="image" onclick="setMousePos(); setAction0('recoverFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');"
618 src="<%=sessionBean.getApplicationBean().getCheckboxUncheckedImage()%>" width="20" height="20"/> 670 src="<%=sessionBean.getApplicationBean().getCheckboxUncheckedImage()%>" width="20" height="20"/>
619 671
620 <% } else { %> 672 <% } else { %>
621 673
622 <input type="image" onclick="setAction0('removeFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');" 674 <input type="image" onclick="setMousePos(); setAction0('removeFocusedContent', 'fullTextSearchForm', 'focusedContentId', '<%=content.getId() %>');"
623 src="<%=sessionBean.getApplicationBean().getCheckboxCheckedImage()%>" width="20" height="20"/> 675 src="<%=sessionBean.getApplicationBean().getCheckboxCheckedImage()%>" width="20" height="20"/>
624 676
625 <% } %> 677 <% } %>
626 678
627 679