Mercurial > hg > LGServices
changeset 24:07f7594ba56e
add filters to lastEditor and editTime in books page
author | Zoe Hong <zhong@mpiwg-berlin.mpg.de> |
---|---|
date | Thu, 25 Jun 2015 10:53:52 +0200 |
parents | dcc160f7db38 |
children | 86694755415d |
files | src/main/java/de/mpiwg/web/jsp/BooksPage.java src/main/java/de/mpiwg/web/jsp/JSPProxy.java src/main/resources/config.properties src/main/webapp/WEB-INF/web.xml src/main/webapp/pages/books.jsp |
diffstat | 5 files changed, 77 insertions(+), 21 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main/java/de/mpiwg/web/jsp/BooksPage.java Tue Jun 23 16:21:59 2015 +0200 +++ b/src/main/java/de/mpiwg/web/jsp/BooksPage.java Thu Jun 25 10:53:52 2015 +0200 @@ -55,7 +55,12 @@ private String level2Filter = new String(); private String periodFilter = new String(); private String editionFilter = new String(); + private String lastEditorFilter = new String(); + private String editTimeFilter = new String(); + + + private String filteringMessage; @@ -71,6 +76,8 @@ this.level2Filter = getParameter("level2Filter"); this.periodFilter = getParameter("periodFilter"); this.editionFilter = getParameter("editionFilter"); + this.lastEditorFilter = getParameter("lastEditorFilter"); + this.editTimeFilter = getParameter("editTimeFilter"); } @@ -83,14 +90,29 @@ if(!this.filteredBookList.contains(book)){ if( (StringUtils.isEmpty(dynastyFilter) || StringUtils.startsWith(book.getDynasty(), dynastyFilter)) && - (StringUtils.isEmpty(level1Filter) || StringUtils.startsWith(book.getLevel1(), level1Filter)) && - (StringUtils.isEmpty(level2Filter) || StringUtils.startsWith(book.getLevel2(), level2Filter)) && - (StringUtils.isEmpty(periodFilter) || StringUtils.startsWith(book.getPeriod(), periodFilter)) && - (StringUtils.isEmpty(editionFilter) || StringUtils.startsWith(book.getEdition(), editionFilter)) && - (StringUtils.isEmpty(bookNameFilter) || StringUtils.startsWith(book.getName(), bookNameFilter)) && - (StringUtils.isEmpty(adminTypeFilter) || StringUtils.startsWith(book.getAdmin_type(), adminTypeFilter)) - ){ - this.filteredBookList.add(book); + (StringUtils.isEmpty(level1Filter) || StringUtils.startsWith(book.getLevel1(), level1Filter)) && + (StringUtils.isEmpty(level2Filter) || StringUtils.startsWith(book.getLevel2(), level2Filter)) && + (StringUtils.isEmpty(periodFilter) || StringUtils.startsWith(book.getPeriod(), periodFilter)) && + (StringUtils.isEmpty(editionFilter) || StringUtils.startsWith(book.getEdition(), editionFilter)) && + (StringUtils.isEmpty(bookNameFilter) || StringUtils.startsWith(book.getName(), bookNameFilter)) && + (StringUtils.isEmpty(adminTypeFilter) || StringUtils.startsWith(book.getAdmin_type(), adminTypeFilter)) + ){ + String lastEditor = new String(); + String editTime = new String(); + if ( book.getCurrentSectionVersion() != null) { + lastEditor = book.getCurrentSectionVersion().getEditor(); + editTime = book.getCurrentSectionVersion().getDate(); + } + + if( (StringUtils.isEmpty(lastEditorFilter) || StringUtils.startsWith(lastEditor, lastEditorFilter)) && + (StringUtils.isEmpty(editTimeFilter) || StringUtils.startsWith(editTime, editTimeFilter)) + + ){ + this.filteredBookList.add(book); + + } + + //this.filteredBookList.add(book); } } @@ -288,6 +310,7 @@ try { DBService.getInstance().updateComment(currentBookId, bookComment); + //DBService.getInstance().getBook(currentBookId).setComments(bookComment); } catch (Exception e) { addMsg("There is an internal error: " + e.getLocalizedMessage()); @@ -528,7 +551,18 @@ this.filteringMessage = filteringMessage; } + public String getLastEditorFilter() { + return lastEditorFilter; + } - + public void setLastEditorFilter(String lastEditorFilter) { + this.lastEditorFilter = lastEditorFilter; + } + public String getEditTimeFilter() { + return editTimeFilter; + } + public void setEditTimeFilter(String editTimeFilter) { + this.editTimeFilter = editTimeFilter; + } }
--- a/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Tue Jun 23 16:21:59 2015 +0200 +++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Thu Jun 25 10:53:52 2015 +0200 @@ -244,13 +244,16 @@ }catch(Exception e){ e.printStackTrace(); addMsg("There is an internal error: " + e.getLocalizedMessage()); - return HomePage.page; + + return BooksPage.page; + //return HomePage.page; } //Default Page - return "pages/search.jsp"; + return BooksPage.page; + //return "pages/search.jsp"; }
--- a/src/main/resources/config.properties Tue Jun 23 16:21:59 2015 +0200 +++ b/src/main/resources/config.properties Thu Jun 25 10:53:52 2015 +0200 @@ -4,19 +4,19 @@ files_root=/gazetteer-server/data #Local -#dvn_server=http://localhost/dvn +dvn_server=http://localhost/dvn #dvn_server=http://localhost:8082 -#root_server=http://localhost:8080/LGServices -#toc_interface=http://localhost:1080/localgazetteers-dev/LGToc -#extraction_interface=http://localhost:1080/localgazetteers-dev/extraction-interface +root_server=http://localhost:8080/LGServices +toc_interface=http://localhost:1080/localgazetteers-dev/LGToc +extraction_interface=http://localhost:1080/localgazetteers-dev/extraction-interface # Production one: #localgazetteers-dev -> localgazetteers -dvn_server=http://localgazetteers.mpiwg-berlin.mpg.de/dvn -root_server=http://localgazetteers.mpiwg-berlin.mpg.de/LGServices -toc_interface=http://localgazetteers.mpiwg-berlin.mpg.de/LGToc -extraction_interface=http://localgazetteers.mpiwg-berlin.mpg.de/extraction-interface +#dvn_server=http://localgazetteers.mpiwg-berlin.mpg.de/dvn +#root_server=http://localgazetteers.mpiwg-berlin.mpg.de/LGServices +#toc_interface=http://localgazetteers.mpiwg-berlin.mpg.de/LGToc +#extraction_interface=http://localgazetteers.mpiwg-berlin.mpg.de/extraction-interface # Development one: #localgazetteers -> localgazetteers-test
--- a/src/main/webapp/WEB-INF/web.xml Tue Jun 23 16:21:59 2015 +0200 +++ b/src/main/webapp/WEB-INF/web.xml Thu Jun 25 10:53:52 2015 +0200 @@ -7,7 +7,7 @@ <display-name>LGServices</display-name> <welcome-file-list> - <welcome-file>pages/home.jsp</welcome-file> + <welcome-file>pages/books.jsp</welcome-file> </welcome-file-list> <jsp-config>
--- a/src/main/webapp/pages/books.jsp Tue Jun 23 16:21:59 2015 +0200 +++ b/src/main/webapp/pages/books.jsp Thu Jun 25 10:53:52 2015 +0200 @@ -368,7 +368,16 @@ </table> </td> </tr> - + <tr> + <td> + <input type="text" name="lastEditorFilter" value="<%= sessionBean.getBooksPage().getLastEditorFilter()%>" size="7"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'booksForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> </table> </td> <td> @@ -390,6 +399,16 @@ </table> </td> </tr> + <tr> + <td> + <input type="text" name="editTimeFilter" value="<%= sessionBean.getBooksPage().getEditTimeFilter()%>" size="7"/> + </td> + <td> + <input type="image" + onclick="setAction('filter', 'booksForm');" + src="<%=sessionBean.getApplicationBean().getFilterImage()%>"/> + </td> + </tr> </table> </td> <td>