# HG changeset patch # User Zoe Hong # Date 1435062036 -7200 # Node ID 5b1856cd6b4fe78a7f15e5d6d2eb6d9146e27aea # Parent 996f8f1b69db040deffdb194a59b1b9ff97d4372 bug fixed: 1.TOC Done display issue 2.issue in firefox diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/java/de/mpiwg/gazetteer/db/DBBook.java --- a/src/main/java/de/mpiwg/gazetteer/db/DBBook.java Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/java/de/mpiwg/gazetteer/db/DBBook.java Tue Jun 23 14:20:36 2015 +0200 @@ -24,7 +24,7 @@ private Integer start_year; private Integer end_year; private String comments; - private Integer toc_correction; + private String toc_correction; @@ -49,7 +49,8 @@ this.start_year = rs.getInt("start_year"); this.end_year = rs.getInt("end_year"); this.comments = rs.getString("comments"); - this.toc_correction = rs.getInt("toc_correction"); + //this.toc_correction = Integer.parseInt(rs.getString("toc_correction")); + this.toc_correction = rs.getString("toc_correction"); } @@ -58,12 +59,12 @@ return this.getName().compareTo(o.getName()); } - public Integer getToc_correction() { + public String getTocCorrection() { return toc_correction; } - public void setToc_correction(Integer toc_correction) { + public void setTocCorrection(String toc_correction) { this.toc_correction = toc_correction; } @@ -223,6 +224,7 @@ public void setCurrentSectionVersion(DBSectionVersion currentSectionVersion) { this.currentSectionVersion = currentSectionVersion; } + } diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/java/de/mpiwg/gazetteer/utils/DBService.java --- a/src/main/java/de/mpiwg/gazetteer/utils/DBService.java Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/java/de/mpiwg/gazetteer/utils/DBService.java Tue Jun 23 14:20:36 2015 +0200 @@ -684,9 +684,10 @@ return section_version; } - public void updateTocCorrection(String bookId, Integer finishedStatus) throws SQLException { + public void updateTocCorrection(String bookId, String finishedStatus) throws SQLException { Connection conn = null; Statement stmt = null; + try { String query = "UPDATE books SET toc_correction='"+ finishedStatus + "' WHERE id='" + bookId + "'"; conn = getNewConnection(); @@ -700,7 +701,7 @@ } DBBook book = this.bookMap.get(bookId); - book.setToc_correction(finishedStatus); + book.setTocCorrection(finishedStatus); } diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/java/de/mpiwg/web/books/SortBooksByTocCorrection.java --- a/src/main/java/de/mpiwg/web/books/SortBooksByTocCorrection.java Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/java/de/mpiwg/web/books/SortBooksByTocCorrection.java Tue Jun 23 14:20:36 2015 +0200 @@ -12,7 +12,7 @@ return o1.getName().compareTo(o2.getName()); } - return o1.getToc_correction().compareTo(o2.getToc_correction()); + return o1.getTocCorrection().compareTo(o2.getTocCorrection()); } } \ No newline at end of file diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/java/de/mpiwg/web/jsp/ApplicationBean.java --- a/src/main/java/de/mpiwg/web/jsp/ApplicationBean.java Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/java/de/mpiwg/web/jsp/ApplicationBean.java Tue Jun 23 14:20:36 2015 +0200 @@ -142,6 +142,10 @@ public String getCheckboxCheckedImage(){ return getRootServer() + "/resources/images/checkbox_checked.png"; } + public String getSaveImage(){ + return getRootServer() + "/resources/images/save.png"; + } + ; public String getCheckboxUncheckedImage(){ return getRootServer() + "/resources/images/checkbox_unchecked.png"; diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/java/de/mpiwg/web/jsp/BooksPage.java --- a/src/main/java/de/mpiwg/web/jsp/BooksPage.java Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/java/de/mpiwg/web/jsp/BooksPage.java Tue Jun 23 14:20:36 2015 +0200 @@ -66,7 +66,6 @@ this.response = response; this.tocBookId = getParameter("tocBookId"); - this.bookNameFilter = getParameter("bookNameFilter"); this.dynastyFilter = getParameter("dynastyFilter"); this.adminTypeFilter = getParameter("adminTypeFilter"); @@ -105,7 +104,6 @@ this.paginator.resetNumberOfPages(filteredBookList.size()); this.updateCurrentBooks(); }else{ - //this.searchMessage = "No sections found for the term(s): " + this.searchTerm; this.filteredBookList = null; } @@ -113,8 +111,7 @@ private void updateCurrentBooks() { - //this.displayBookList = this.filteredBookList; - // TODO: update displayBookList using paginator + // update displayBookList using paginator this.paginator.initCount(); int startRecord = this.paginator.getCurrentPage() @@ -202,15 +199,12 @@ public void loadBooks(){ if(this.completeBookList == null){ this.forceLoadBooks(); - sortByBookIdUp();//bookId ascend as default sorting this.filteringMessage = null; - } - } public void forceLoadBooks(){ - logger.debug("loadBooks"); + logger.debug("force loadBooks"); this.loadSectionsVersion(); @@ -230,6 +224,12 @@ } + sortByBookIdUp(); //bookId ascend as default sorting + // Note that every sortXYZ() function has filter() in it, so it will also force reload filteredList and displayList + + + + } private void loadSectionsVersion(){ @@ -251,13 +251,18 @@ String tocBookId = this.getTocBookId(); logger.debug("tocFinishedBookId=" + tocBookId); try { - DBService.getInstance().updateTocCorrection(tocBookId, 1); + // update toc correction status to DB + DBService.getInstance().updateTocCorrection(tocBookId, "1"); + + // update toc correction status + DBService.getInstance().getBook(tocBookId).setTocCorrection("1"); + }catch (Exception e) { addMsg("There is an internal error: " + e.getLocalizedMessage()); e.printStackTrace(); } - //logger.debug("toc_correction:"+DBService.getInstance().getBook(tocBookId).getToc_correction()); + logger.debug("toc_correction:"+DBService.getInstance().getBook(tocBookId).getTocCorrection()); } @@ -266,15 +271,23 @@ String tocBookId = this.getTocBookId(); logger.debug("tocFinishedBookId=" + tocBookId); try { - DBService.getInstance().updateTocCorrection(tocBookId, 0); + DBService.getInstance().updateTocCorrection(tocBookId, "0"); + DBService.getInstance().getBook(tocBookId).setTocCorrection("0"); + }catch (Exception e) { addMsg("There is an internal error: " + e.getLocalizedMessage()); e.printStackTrace(); - } + } - + } + + public void saveComment() { + // TODO Auto-generated method stub + logger.debug("saveComment"); } + + public void sortByBookIdUp() { Collections.sort(this.completeBookList, new SortBooksByBookId()); filter(); @@ -506,4 +519,6 @@ } + + } diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/java/de/mpiwg/web/jsp/JSPProxy.java --- a/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Tue Jun 23 14:20:36 2015 +0200 @@ -1,12 +1,8 @@ package de.mpiwg.web.jsp; -import java.util.Map; - import org.apache.commons.lang.StringUtils; import org.apache.log4j.Logger; -import de.mpiwg.gazetteer.utils.DBService; - public class JSPProxy extends AbstractJSPPage { private static Logger logger = Logger.getLogger(JSPProxy.class); @@ -156,12 +152,16 @@ getSessionBean().getBooksPage().setTocCorrection(); } else if (StringUtils.equals(action, "unSetTocCorrection")){ getSessionBean().getBooksPage().unSetTocCorrection(); + + } else if(StringUtils.equals(action, "saveComment")){ + getSessionBean().getBooksPage().saveComment(); } else if (StringUtils.equals(action, "forceReloadBooks")) { - getSessionBean().getBooksPage().forceLoadBooks(); + getSessionBean().getBooksPage().forceLoadBooks(); } else if(StringUtils.equals(action, "filter")){ getSessionBean().getBooksPage().filter(); + //PAGINATOR } else if(StringUtils.equals(action, "firstPage")){ getSessionBean().getBooksPage().firstPage(); diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/resources/config.properties --- a/src/main/resources/config.properties Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/resources/config.properties Tue Jun 23 14:20:36 2015 +0200 @@ -13,14 +13,14 @@ # 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 -#dvn_server=http://localgazetteers-test.mpiwg-berlin.mpg.de/dvn -#root_server=http://localgazetteers-test.mpiwg-berlin.mpg.de/LGServices -#toc_interface=http://localgazetteers-test.mpiwg-berlin.mpg.de/LGToc -#extraction_interface=http://localgazetteers-test.mpiwg-berlin.mpg.de/extraction-interface \ No newline at end of file +dvn_server=http://localgazetteers-test.mpiwg-berlin.mpg.de/dvn +root_server=http://localgazetteers-test.mpiwg-berlin.mpg.de/LGServices +toc_interface=http://localgazetteers-test.mpiwg-berlin.mpg.de/LGToc +extraction_interface=http://localgazetteers-test.mpiwg-berlin.mpg.de/extraction-interface \ No newline at end of file diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/resources/hibernate.cfg.xml --- a/src/main/resources/hibernate.cfg.xml Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/resources/hibernate.cfg.xml Tue Jun 23 14:20:36 2015 +0200 @@ -5,7 +5,7 @@ 5 20 - 1800 + 7200 50 org.hibernate.connection.C3P0ConnectionProvider diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/webapp/WEB-INF/web.xml --- a/src/main/webapp/WEB-INF/web.xml Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/webapp/WEB-INF/web.xml Tue Jun 23 14:20:36 2015 +0200 @@ -42,7 +42,7 @@ - 30 + 120 diff -r 996f8f1b69db -r 5b1856cd6b4f src/main/webapp/pages/books.jsp --- a/src/main/webapp/pages/books.jsp Fri Jun 19 16:23:16 2015 +0200 +++ b/src/main/webapp/pages/books.jsp Tue Jun 23 14:20:36 2015 +0200 @@ -12,19 +12,43 @@ - + - - - - - -
- +
+ + <% if(sessionBean.getUser() == null) { %> <% } else { @@ -36,23 +60,22 @@ %>
List of Books + +

<%= sessionBean.getBooksPage().getBookNumber() %> books in Chinese localgazetteers

-

<%= (StringUtils.isNotEmpty(sessionBean.getBooksPage().getFilteringMessage())) ? sessionBean.getBooksPage().getFilteringMessage() : ""%>

+

<%= (StringUtils.isNotEmpty(sessionBean.getBooksPage().getFilteringMessage())) ? sessionBean.getBooksPage().getFilteringMessage() : ""%>

- - - + -
- +
+ + + - - <% //for(DBBook book : sessionBean.getBooksPage().getCompleteBookList() ) { - for (DBBook book : sessionBean.getBooksPage().getDisplayBookList() ) {%> + + + <% for (DBBook book : sessionBean.getBooksPage().getDisplayBookList() ) {%> @@ -399,25 +429,39 @@ - + + + <% } %> @@ -427,8 +471,11 @@ - + + + <% } %> +
@@ -317,9 +340,7 @@
@@ -382,11 +403,20 @@
+ + + + + +
+
<%=book.getDynasty() %> <%=book.getAdmin_type() %> <%=book.getStart_year() %> + Edit TOC - <% if (book.getToc_correction() == 1) { %> - - <% } else { %> - + + + <% } else { %> + - + <% } %> + <%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getEditor() %> <%= (book.getCurrentSectionVersion() == null) ? "" : book.getCurrentSectionVersion().getDate() %> + +