# HG changeset patch # User Zoe Hong # Date 1470826819 -7200 # Node ID dd2fcc5f5deba199bd6f9bd9a464aaebcd7ba2f2 # Parent 7e161f2e66605133415267efed251c6da7bac136 new: saved table in full text search page: new layout and sorting by time diff -r 7e161f2e6660 -r dd2fcc5f5deb src/main/java/de/mpiwg/web/fullTextSearch/SortFullTextSearchFileByLastChanged.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/main/java/de/mpiwg/web/fullTextSearch/SortFullTextSearchFileByLastChanged.java Wed Aug 10 13:00:19 2016 +0200 @@ -0,0 +1,17 @@ +package de.mpiwg.web.fullTextSearch; + +import java.util.Comparator; + +import de.mpiwg.gazetteer.bo.LGFullTextSearchFile; + + +public class SortFullTextSearchFileByLastChanged implements Comparator{ + + public int compare(LGFullTextSearchFile o1, LGFullTextSearchFile o2) { + + if(o1.getLastChangeDate() == null || o2.getLastChangeDate() == null){ + return o1.getId().compareTo(o2.getId()); + } + return o1.getLastChangeDate().compareTo(o2.getLastChangeDate()); + } +} diff -r 7e161f2e6660 -r dd2fcc5f5deb src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java --- a/src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java Fri Aug 05 13:36:37 2016 +0200 +++ b/src/main/java/de/mpiwg/web/jsp/FullTextSearchPage.java Wed Aug 10 13:00:19 2016 +0200 @@ -34,6 +34,7 @@ import de.mpiwg.web.fullTextSearch.SortContentByLevel2; import de.mpiwg.web.fullTextSearch.SortContentByPeriod; import de.mpiwg.web.fullTextSearch.SortContentByStartPage; +import de.mpiwg.web.fullTextSearch.SortFullTextSearchFileByLastChanged; @@ -226,7 +227,7 @@ this.olderFileList = new ArrayList(); - // TODO + for (LGFullTextSearchFile aFile: this.getFileList()) { Date todayDate = new Date(); @@ -236,12 +237,19 @@ if ( aFile.getLastChangeDate().after(oneWeekAgo)) { this.weekFileList.add(aFile); + // sorting by last changed + this.sortByLastChangedDown(this.getWeekFileList()); + } else if (aFile.getLastChangeDate().after(oneMonthAgo)) { this.monthFileList.add(aFile); + // sorting by last changed + this.sortByLastChangedDown(this.getMonthFileList()); } else { this.olderFileList.add(aFile); + // sorting by last changed + this.sortByLastChangedDown(this.getOlderFileList()); } } @@ -510,7 +518,8 @@ if( (StringUtils.isEmpty(dynastyFilter) || StringUtils.startsWith(content.getSection().getBook().getDynasty(), dynastyFilter)) && (StringUtils.isEmpty(level1Filter) || StringUtils.startsWith(content.getSection().getBook().getLevel1(), level1Filter)) && (StringUtils.isEmpty(level2Filter) || StringUtils.startsWith(content.getSection().getBook().getLevel2(), level2Filter)) && - (StringUtils.isEmpty(adminTypeFilter) || StringUtils.startsWith(content.getSection().getBook().getAdmin_type(), adminTypeFilter)) && + (StringUtils.isEmpty(adminTypeFilter) || StringUtils.startsWith(content.getSection().getBook().getAdmin_type(), adminTypeFilter)) && + (StringUtils.isEmpty(periodFilter) || StringUtils.startsWith(content.getSection().getBook().getPeriod(), periodFilter)) && (StringUtils.isEmpty(bookIdFilter) || StringUtils.startsWith(content.getBookId(), bookIdFilter)) && (StringUtils.isEmpty(bookNameFilter) || StringUtils.startsWith(content.getSection().getBook().getName(), bookNameFilter)) && (StringUtils.isEmpty(sectionNameFilter) || StringUtils.startsWith(content.getSection().getName(), sectionNameFilter)) && @@ -1017,6 +1026,10 @@ /////// Sorting + public void sortByLastChangedDown(List _list) { + Collections.sort(_list, new SortFullTextSearchFileByLastChanged()); + Collections.reverse(_list); + } public void sortByBookNameUp(){ Collections.sort(this.completeList, new SortContentByBookName()); diff -r 7e161f2e6660 -r dd2fcc5f5deb src/main/webapp/pages/fullTextSearch.jsp --- a/src/main/webapp/pages/fullTextSearch.jsp Fri Aug 05 13:36:37 2016 +0200 +++ b/src/main/webapp/pages/fullTextSearch.jsp Wed Aug 10 13:00:19 2016 +0200 @@ -60,13 +60,28 @@ //position: { my: "left+100px", at: "top", of: $("#viewSavedResult") }, position: { my: "center", at: "top+200px", of: $("#viewSavedResult") }, // TODO width: "850px", - } ); + var dialogViewSavedResult2 = $("#dialogViewSavedResult2").dialog( + { + autoOpen: false, + //position: { my: "left+100px", at: "top", of: $("#viewSavedResult") }, + position: { my: "center", at: "top+200px", of: $("#viewSavedResult2") }, + width: 600, height: 1000 + + } + ); + $("#viewSavedResult").button().on( "click", function() { dialogViewSavedResult.dialog( "open" ); }); + $("#viewSavedResult2").button().on( "click", function() { + dialogViewSavedResult2.dialog( "open" ); + }); + + + $("#bookIdFilter").autocomplete({ source : function(request, response) { $.ajax({ @@ -376,10 +391,12 @@ - + onclick="setAction('save', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save + All + + onclick="setAction('saveFiltered', 'saveTableForm'); document.getElementById('saveTableForm').submit();">Save + Filtered @@ -388,8 +405,9 @@ +
- +
This week:
@@ -412,8 +430,11 @@ target="_blank"> - <% - for (LGFullTextSearchFile aFile : sessionBean - .getFullTextSearchPage().getMonthFileList()) { + for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getMonthFileList()) { + %> + + + <% } %> + +
+
<%=aFile.getFileName()%>
+ + + + + + + + +
+ +
Older...
+ + + <% + for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getOlderFileList()) { %> + <% } %> + + +
<%=aFile.getFileName()%>
@@ -443,6 +499,98 @@ + + + + +
+ + +
+ +
+ + + +
This week:
+ + <% + for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getWeekFileList()) { + %> + + + + + + <% } %> +
+
<%=aFile.getFileName()%>
+
+ + + + + + + + + + + + + +
+ +
This month:
+ + <% + for (LGFullTextSearchFile aFile : sessionBean + .getFullTextSearchPage().getMonthFileList()) { + %> + + + + <% } %>
+
<%=aFile.getFileName()%>
+
+ + + + @@ -452,7 +600,7 @@ src="<%=sessionBean.getApplicationBean() .getDownloadImage()%>" /> - <% - } - %> +
Older...
- +
+ <% + for (LGFullTextSearchFile aFile : sessionBean.getFullTextSearchPage().getOlderFileList()) { + %> + - <% - for (LGFullTextSearchFile aFile : sessionBean - .getFullTextSearchPage().getOlderFileList()) { - %> + + <% } %>
<%=aFile.getFileName()%>
+
@@ -491,7 +640,7 @@ src="<%=sessionBean.getApplicationBean() .getDownloadImage()%>" /> - <% - } - %>
+ + + +
+ value="<%=sessionBean.getFullTextSearchPage() + .getFocusedContentId()%>" /> - - - - + + + + + + + *Test: + + <% - if (sessionBean.getFullTextSearchPage().getFile() != null) { + if (sessionBean.getFullTextSearchPage().getFile() != null) { LGFullTextSearchFile theFile = sessionBean .getFullTextSearchPage().getFile(); - %> + %> View on LGMap - <% } else if (sessionBean.getFullTextSearchPage().getCompleteList() != null) { %> - - - + <% + } else if (sessionBean.getFullTextSearchPage().getCompleteList() != null) { + %> + + <% } %> - + diff -r 7e161f2e6660 -r dd2fcc5f5deb src/main/webapp/resources/css/style.css --- a/src/main/webapp/resources/css/style.css Fri Aug 05 13:36:37 2016 +0200 +++ b/src/main/webapp/resources/css/style.css Wed Aug 10 13:00:19 2016 +0200 @@ -161,6 +161,22 @@ width:60px; } +.savedResultTable2 tr { + background:#EBEBEB; + border-style: solid; +} + + +.savedResultTable2 td { + border-color: inherit; + /*border-style: solid; */ + border-width: 1px; + text-align: center; + border-collapse: collapse; + font-size: 12px; + min-width: 150px; + /*width:60px;*/ +} .pageTable{