Mercurial > hg > LGServices
diff src/main/webapp/pages/search.jsp @ 58:b8ad346e39a0
new: modify based on doc 'Improving LGServices interface.docx': user workflow improvement, functions like adding task into a topic and search suggestions.
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Mon, 02 May 2016 12:03:30 +0200 |
parents | 5cbe567a9c52 |
children | 824b808a7481 |
line wrap: on
line diff
--- a/src/main/webapp/pages/search.jsp Wed Feb 17 14:58:19 2016 +0100 +++ b/src/main/webapp/pages/search.jsp Mon May 02 12:03:30 2016 +0200 @@ -43,7 +43,7 @@ var sectionId = $( this ).data('section-id'); //console.log("addSectionToTopic. sectionId = " + sectionId); - var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/addSectionToTopic.jsp?sectionId=" + sectionId; + var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/addSectionToTopic.jsp?sectionId=" + sectionId + "&sourceBean=search"; $.ajax( url0 ) .done(function(data) { @@ -120,6 +120,32 @@ minLength : 0 }); + $("#bookNameFilter").autocomplete({ + source : function(request, response) { + $.ajax({ + url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/bookNameAutocomplete.jsp", + type : "POST", + dataType : "json", + data : { + term : request.term + }, + success : function(data) { + + response($.map(data, function(item) { + return { + label : item.name, + value : item.value, + } + })); + }, + error : function(error) { + alert('error: ' + error); + } + }); + }, + minLength : 0 + }); + $("#dynastyFilter").autocomplete({ source : function(request, response) { $.ajax({ @@ -145,6 +171,7 @@ }, minLength : 0 }); + $("#level1Filter").autocomplete({ source : function(request, response) { @@ -170,8 +197,63 @@ }); }, minLength : 0 + }); + + + $("#level2Filter").autocomplete({ + source : function(request, response) { + $.ajax({ + url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/level2Autocomplete.jsp", + type : "POST", + dataType : "json", + data : { + term : request.term + }, + success : function(data) { + + response($.map(data, function(item) { + return { + label : item.name, + value : item.value, + } + })); + }, + error : function(error) { + alert('error: ' + error); + } + }); + }, + minLength : 0 }); + + $("#periodFilter").autocomplete({ + source : function(request, response) { + $.ajax({ + url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/periodAutocomplete.jsp", + type : "POST", + dataType : "json", + data : { + term : request.term + }, + success : function(data) { + + response($.map(data, function(item) { + return { + label : item.name, + value : item.value, + } + })); + }, + error : function(error) { + alert('error: ' + error); + } + }); + }, + minLength : 0 + }); + + $("#adminTypeFilter").autocomplete({ source : function(request, response) { $.ajax({ @@ -197,9 +279,56 @@ }, minLength : 0 }); + + $("#sectionNameFilter").autocomplete({ + source : function(request, response) { + $.ajax({ + url : "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/sectionNameAutocomplete.jsp", + type : "POST", + dataType : "json", + data : { + term : request.term + }, + success : function(data) { + + response($.map(data, function(item) { + return { + label : item.name, + value : item.value, + } + })); + }, + error : function(error) { + alert('error: ' + error); + } + }); + }, + minLength : 0 + }); + + // enter pressed event, we don't want to always go to "search". + $(document).keypress( + function(event){ + if (event.which == '13') { // enter pressed + // if any of the filter fields is filled in, filter first; otherwize, go to search + $(".filterInput" ).each(function( i ) { + //console.log( this.value ); + if (this.value != "") { + //console.log('filtering' + i); + setAction('filter', 'searchForm'); + $("#searchForm").submit(); + return false; + } + + }); + } + }); + + + }); - + </script> </head> @@ -314,6 +443,16 @@ </table> </td> </tr> + <tr> + <td> + <input type="text" class="filterInput" name="bookNameFilter" id="bookNameFilter" value="<%= sessionBean.getSearchPage().getBookNameFilter()%>"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> </table> </th> <th> @@ -347,7 +486,39 @@ </tr> </table> </th> - <th><label class="tableTitle">Level 2</label></th> + <th> + + <table class="sortTable"> + <tr> + <td><label class="tableTitle">Level 2</label></td> + <td> + <table> + <tr><td> + <input type="image" + onclick="setAction('sortByLevel2Up', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getUpImage()%>"/> + </td></tr> + <tr><td> + <input type="image" + onclick="setAction('sortByLevel2Down', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getDownImage()%>"/> + </td></tr> + </table> + </td> + </tr> + <tr> + <td> + <input type="text" class="filterInput" name="level2Filter" id="level2Filter" value="<%= sessionBean.getSearchPage().getLevel2Filter()%>"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> + </table> + + </th> <th> <table class="sortTable"> <tr> @@ -398,6 +569,16 @@ </table> </td> </tr> + <tr> + <td> + <input type="text" class="filterInput" name="periodFilter" id="periodFilter" value="<%= sessionBean.getSearchPage().getPeriodFilter()%>"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> </table> </th> <th> @@ -450,6 +631,16 @@ </table> </td> </tr> + <tr> + <td> + <input type="text" class="filterInput" name="sectionNameFilter" id="sectionNameFilter" value="<%= sessionBean.getSearchPage().getSectionNameFilter()%>"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'searchForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> </table> </th> <th> @@ -474,7 +665,7 @@ </table> </th> - <th><label class="tableTitle">View Text</label></th> + <th><label class="tableTitle">Load Text</label></th> <th> <label class="tableTitle">Add to Topic</label>