# HG changeset patch # User Zoe Hong # Date 1450883012 -3600 # Node ID 9dbbbfd474f4e35e89a7aa99f4f49201fb2d2f01 # Parent 815cd86bb9ec2c21ada31a8e617c13365fb1424d new: 1.existing topic in search result. 2.difference-set of book for topic diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java --- a/src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/bo/LGTopic.java Wed Dec 23 16:03:32 2015 +0100 @@ -46,6 +46,9 @@ @Column(name="description") private String description; + @Column(name="keywords") + private String keywords; + @Transient private List contributorsList; @@ -204,6 +207,18 @@ + public String getKeywords() { + return keywords; + } + + + public void setKeywords(String keywords) { + this.keywords = keywords; + } + + + + public void setContributorsList(List contributorsList) { this.contributorsList = contributorsList; } @@ -216,7 +231,10 @@ public DuplexKey getKey(){ return new DuplexKey(this.userId, this.id); } - + + public String info() { + return nameEn + "(" + nameCh + ", " + namePinyin + ")"; + } @Override public String toString(){ @@ -224,4 +242,6 @@ } + + } diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/gazetteer/bo/LGTopicSectionRelation.java --- a/src/main/java/de/mpiwg/gazetteer/bo/LGTopicSectionRelation.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/bo/LGTopicSectionRelation.java Wed Dec 23 16:03:32 2015 +0100 @@ -34,13 +34,25 @@ @Column(name="sectionId") private Long sectionId; - @Column(name="bookId") private String bookId; + + @Transient private boolean transientDataLoaded = false; + + @Transient + private LGTopic topic; + + public void loadTransientData(){ + + this.topic = DataProvider.getInstance().getTopic(topicId); + + this.transientDataLoaded = true; + + } @@ -92,6 +104,18 @@ } + public LGTopic getTopic() { + return topic; + } + + + + public void setTopic(LGTopic topic) { + this.topic = topic; + } + + + public DuplexKey getKey(){ return new DuplexKey(this.topicId, this.sectionId); } @@ -101,5 +125,8 @@ return "LGTopicSectionRelation[topicId=" + topicId.toString() + ", sectionId=" + sectionId.toString() + "]"; } + + + } diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/gazetteer/db/DBBook.java --- a/src/main/java/de/mpiwg/gazetteer/db/DBBook.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/db/DBBook.java Wed Dec 23 16:03:32 2015 +0100 @@ -31,6 +31,10 @@ private DBSectionVersion currentSectionVersion; + public DBBook() { + + } + public DBBook(ResultSet rs) throws SQLException{ this.name = rs.getString("name"); this.id = rs.getString("id"); diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/gazetteer/db/DBSection.java --- a/src/main/java/de/mpiwg/gazetteer/db/DBSection.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/db/DBSection.java Wed Dec 23 16:03:32 2015 +0100 @@ -5,6 +5,8 @@ import java.util.List; import de.mpiwg.gazetteer.bo.LGBranch; +import de.mpiwg.gazetteer.bo.LGTopic; +import de.mpiwg.gazetteer.bo.LGTopicSectionRelation; public class DBSection implements Comparable{ @@ -19,6 +21,7 @@ private Integer end_page; private List branches; + private List topicSectionRelation; /* public DBSection(Long id){ @@ -94,6 +97,16 @@ this.branches = branches; } + + public List getTopicSectionRelation() { + return topicSectionRelation; + } + + public void setTopicSectionRelation( + List topicSectionRelation) { + this.topicSectionRelation = topicSectionRelation; + } + public Integer getStart_page() { return start_page; } diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/gazetteer/utils/DBService.java --- a/src/main/java/de/mpiwg/gazetteer/utils/DBService.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/utils/DBService.java Wed Dec 23 16:03:32 2015 +0100 @@ -145,7 +145,7 @@ return getBookMap().get(id); } - private Map getBookMap(){ + public Map getBookMap(){ if(bookMap == null){ try { this.loadBookMap(); @@ -543,6 +543,7 @@ return list; } + public static DBSection getSectionWithContent(Long sectionId) throws SQLException { Connection conn = null; diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java --- a/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/gazetteer/utils/DataProvider.java Wed Dec 23 16:03:32 2015 +0100 @@ -22,7 +22,7 @@ public class DataProvider extends AbstractDataProvider{ - private static Logger logger = Logger.getLogger(DBService.class); + private static Logger logger = Logger.getLogger(DataProvider.class); private static DataProvider instance; public static DataProvider getInstance(){ @@ -54,6 +54,14 @@ return list; } + public List getAllExistingTopicSectionRelation() { + List list = new ArrayList(); + for (LGTopicSectionRelation relation : getTopicSectionRelationMap().values()) { + list.add(relation); + } + return list; + } + public List getAllExistingBranches(){ List list = new ArrayList(); for(LGBranch branch : getBranchMap().values()){ @@ -392,7 +400,7 @@ // get sections from topicSecionRelation list List list = new ArrayList(); for (LGTopicSectionRelation aRelation : topicSectionRelationList) { - logger.debug(aRelation.getInfo() ); + //logger.debug(aRelation.getInfo() ); DBSection section = DBService.getSectionWithContent(aRelation.getSectionId()); list.add(section); diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/web/jsp/ApplicationBean.java --- a/src/main/java/de/mpiwg/web/jsp/ApplicationBean.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/ApplicationBean.java Wed Dec 23 16:03:32 2015 +0100 @@ -68,6 +68,10 @@ return value; } + public String getOkImage(){ + return getRootServer() + "/resources/images/ok.png"; + } + public String getPlusImage() { return getRootServer() + "/resources/images/plus.png"; } diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/web/jsp/JSPProxy.java --- a/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/JSPProxy.java Wed Dec 23 16:03:32 2015 +0100 @@ -28,6 +28,28 @@ try{ + + if(StringUtils.equals(bean, "loginBean")){ + getSessionBean().loadParameters(request, response); + + if(StringUtils.equals(action, "login")){ + getSessionBean().login(); + }else if(StringUtils.equals(action, "logout")){ + getSessionBean().logout(); + } + return TopicListPage.page; // the new home page + //return "pages/home.jsp"; + + } else if (getSessionBean() == null || getSessionBean().getUser() == null) { + // return to home page where will ask user to login. + + // alert session timeout + getSessionBean().addMsg("Timeout or Logout at another page! Please login again."); + + return TopicListPage.page; // the new home page + } + + if(StringUtils.equals(bean, BranchPage.bean)){ getSessionBean().getBranchPage().loadParameters(request, response); @@ -133,18 +155,7 @@ return HomePage.page; - }else if(StringUtils.equals(bean, "loginBean")){ - getSessionBean().loadParameters(request, response); - - if(StringUtils.equals(action, "login")){ - getSessionBean().login(); - }else if(StringUtils.equals(action, "logout")){ - getSessionBean().logout(); - } - - return TopicListPage.page; - //return "pages/home.jsp"; - + }else if(StringUtils.equals(bean, SearchPage.bean)){ getSessionBean().getSearchPage().loadParameters(request, response); @@ -334,6 +345,11 @@ getSessionBean().getTopicPage().updateDescription(); getSessionBean().getTopicListPage().forceLoadTopics(); + } else if( StringUtils.equals(action ,"updateKeywords")) { + getSessionBean().getTopicPage().updateKeywords(); + getSessionBean().getTopicListPage().forceLoadTopics(); + + /* ====== */ @@ -341,13 +357,20 @@ getSessionBean().getTopicPage().deleteSection(getLongParameter("sectionId")); - } else if(StringUtils.equals(action, "addSectionToTopic")) { + } else if(StringUtils.equals(action, "addSection")) { Long selectedSectionId = getLongParameter("selectedSectionId"); Long selectedTopicId = getLongParameter("selectedTopicId"); + getSessionBean().getTopicPage().addSectionToTopic(selectedSectionId, selectedTopicId); + getSessionBean().getSearchPage().updateTopicSectionRelation(); - getSessionBean().getTopicPage().addSectionToTopic(selectedSectionId, selectedTopicId); return SearchPage.page; + + } else if(StringUtils.equals(action, "addAllSections")) { + Long selectedTopicId = getLongParameter("selectedTopicId"); + getSessionBean().getTopicPage().addAllSectionsToTopic(getSessionBean().getSearchPage().getFilteredSectionList(), selectedTopicId); + getSessionBean().getSearchPage().updateTopicSectionRelation(); + return SearchPage.page; //SORTING diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/web/jsp/SearchPage.java --- a/src/main/java/de/mpiwg/web/jsp/SearchPage.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/SearchPage.java Wed Dec 23 16:03:32 2015 +0100 @@ -13,6 +13,8 @@ import org.apache.log4j.Logger; import de.mpiwg.gazetteer.bo.LGBranch; +import de.mpiwg.gazetteer.bo.LGTopic; +import de.mpiwg.gazetteer.bo.LGTopicSectionRelation; import de.mpiwg.gazetteer.db.DBSection; import de.mpiwg.gazetteer.utils.DBService; import de.mpiwg.gazetteer.utils.DataProvider; @@ -58,6 +60,8 @@ private String filteringMessage; + private Map> topicSectionRelationMap; + @Override public void init(){ @@ -77,6 +81,13 @@ } + public void updateTopicSectionRelation() { + logger.debug("updateTopicSectionRelation"); + this.loadTopicSectionRelation(); + this.filter(); + + } + public void search(){ logger.debug("Searching: " + this.searchTerm); @@ -86,6 +97,12 @@ if(StringUtils.isNotEmpty(this.searchTerm)){ this.loadBranches(); + + this.loadTopicSectionRelation(); + + // TODO load all books for the difference set?? + + try { List terms = splitTerms(); @@ -166,6 +183,7 @@ for(DBSection section : this.displaySectionList){ section.setBranches(this.branchesMap.get(section.getId())); + section.setTopicSectionRelation(this.topicSectionRelationMap.get(section.getId())); } } @@ -183,8 +201,18 @@ } } - - + private void loadTopicSectionRelation(){ + this.topicSectionRelationMap = new HashMap>(); + List list = DataProvider.getInstance().getAllExistingTopicSectionRelation(); + + for(LGTopicSectionRelation relation : list){ + relation.loadTransientData(); + if(this.topicSectionRelationMap.get(relation.getSectionId()) == null){ + this.topicSectionRelationMap.put(relation.getSectionId(), new ArrayList()); + } + this.topicSectionRelationMap.get(relation.getSectionId()).add(relation); + } + } private List splitTerms(){ @@ -253,6 +281,15 @@ } + public Map> getTopicSectionRelationMap() { + return topicSectionRelationMap; + } + + public void setTopicSectionRelationMap( + Map> topicSectionRelationMap) { + this.topicSectionRelationMap = topicSectionRelationMap; + } + public Map> getBranchesMap() { return branchesMap; } diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/web/jsp/SessionBean.java --- a/src/main/java/de/mpiwg/web/jsp/SessionBean.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/SessionBean.java Wed Dec 23 16:03:32 2015 +0100 @@ -11,6 +11,7 @@ import de.mpiwg.gazetteer.dataverse.DataverseUtils; import de.mpiwg.gazetteer.dataverse.bo.VDCUser; +import de.mpiwg.gazetteer.utils.DataProvider; public class SessionBean extends AbstractJSPPage { @@ -56,8 +57,14 @@ this.homePage = new HomePage(); this.createFilePage = new CreateFilePage(); this.branchPage = new BranchPage(); + + this.booksPage = new BooksPage(); + this.topicListPage = new TopicListPage(); + this.topicPage = new TopicPage(); + this.userName = new String(); this.password = new String(); + } public List getMsgList() { @@ -89,10 +96,13 @@ // check if user has role in the "Chinese Local Gazetteers" Dataverse, rather than the following hardcoded checking // use dvn/getRoleAssignments?user=&password=&datasetId= if ( StringUtils.equals(userName, "dataverseAdmin") || DataverseUtils.isUserInLG(userName, password) || DataverseUtils.isUserInGroups(this.user.getUserName(), theUserGroups)){ + this.user.setPassword(this.password); this.homePage.loadParameters(request, response); this.homePage.reloadBranches(); + + } else { this.user = null; diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/web/jsp/TopicListPage.java --- a/src/main/java/de/mpiwg/web/jsp/TopicListPage.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/TopicListPage.java Wed Dec 23 16:03:32 2015 +0100 @@ -54,25 +54,27 @@ public void forceLoadTopics(){ logger.debug("forceLoadTopics"); + DataProvider.getInstance().setTopicMap(null); DataProvider.getInstance().setTopicSectionRelationMap(null); + this.completeTopicList = new ArrayList(); if(getSessionBean().getUser() != null){ for(LGTopic topic : DataProvider.getInstance().getTopics(getSessionBean().getUser().getId())){ - + if (topic.isEmpty()) { logger.debug("topic doesn't exist anymore."); } else { this.completeTopicList.add(topic); } } - } - this.setTopicNumber(this.completeTopicList.size()); + + this.setTopicNumber(this.completeTopicList.size()); - sortByLastModifiedDown(); // default sorting by from lasted modified to oldest - + sortByLastModifiedDown(); // default sorting by from lasted modified to oldest + } } @@ -85,13 +87,14 @@ String namePinyin = getParameter("namePinyin"); String description = getParameter("description"); - logger.debug("nameEn: " + nameEn); - logger.debug("nameCh: " + nameCh); - logger.debug("namePinyin: " + namePinyin); - logger.debug("description: " + description); + logger.debug("nameEn: " + nameEn + "nameCh: " + nameCh + "namePinyin: " + namePinyin + "description: " + description); if (StringUtils.isEmpty(nameEn)) { - addMsg("Create Fails. Name(eng) cannot be empty."); + addMsg("Creating topic Failed. Name(Eng) cannot be empty."); + } else if (StringUtils.isEmpty(nameCh)) { + addMsg("Creating topic Failed. Name(中文) cannot be empty."); + }else if (StringUtils.isEmpty(namePinyin)) { + addMsg("Creating topic Failed. Name(Pinyin) cannot be empty."); } else { DataProvider.getInstance().createTopic(nameEn, nameCh, namePinyin, description, userId); @@ -144,7 +147,7 @@ } if(completeTopicList.size() > 0){ - this.filteringMessage = this.filteredTopicList.size() + " topics listed after filtering"; + //this.filteringMessage = this.filteredTopicList.size() + " topics listed after filtering"; this.paginator.setCurrentPage(0); this.paginator.resetNumberOfPages(filteredTopicList.size()); diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/java/de/mpiwg/web/jsp/TopicPage.java --- a/src/main/java/de/mpiwg/web/jsp/TopicPage.java Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/java/de/mpiwg/web/jsp/TopicPage.java Wed Dec 23 16:03:32 2015 +0100 @@ -1,8 +1,10 @@ package de.mpiwg.web.jsp; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.HashMap; +import java.util.Iterator; import java.util.List; import java.util.Map; @@ -18,6 +20,7 @@ import de.mpiwg.gazetteer.bo.LGTopicSectionRelation; import de.mpiwg.gazetteer.dataverse.DataverseUtils; import de.mpiwg.gazetteer.dataverse.bo.VDCUser; +import de.mpiwg.gazetteer.db.DBBook; import de.mpiwg.gazetteer.db.DBSection; import de.mpiwg.gazetteer.utils.DBService; import de.mpiwg.gazetteer.utils.DataProvider; @@ -67,6 +70,11 @@ private Map> branchesMap; + private Map booksMap; + + private List pendingBookList; + + public void loadParameters(HttpServletRequest request, HttpServletResponse response){ this.request = request; @@ -160,6 +168,8 @@ if(topic != null && topic.isPersistent()){ this.loadBranches(); + this.loadBooks(); + try { this.topic = (LGTopic)topic.clone(); @@ -184,6 +194,21 @@ logger.info("completeSectionList.size=" + completeSectionList.size()); } this.filter(); + + + // pendingBookList + for(DBSection section :this.completeSectionList) { + String bookId = section.getBookId(); + + if (this.booksMap.get(bookId) != null) { + // remove the book with bookId from pendingBookList + this.booksMap.remove(bookId); + } + } + + this.pendingBookList = new ArrayList(); + this.pendingBookList.addAll(this.booksMap.values()); + } @@ -295,10 +320,12 @@ } */ - for(DBSection section : this.displaySectionList){ - section.setBranches(this.branchesMap.get(section.getId())); + //for(DBSection section : this.displaySectionList){ + for(DBSection section : this.completeSectionList){ // we don't paginate now + section.setBranches(this.branchesMap.get(section.getId())); } + } @@ -312,7 +339,6 @@ String status = DataProvider.getInstance().updateTopicSectionRelation(_sectionId, _topicId); if (StringUtils.equals(status, "added") ) { - // TODO responding with names to user addMsg("Added section [id=" + _sectionId + "] to the topic [id=" + _topicId + "]"); } else if (StringUtils.equals(status, "updated") ) { addMsg("The section already in the topic"); @@ -335,9 +361,58 @@ this.branchesMap.put(branch.getSectionId(), new ArrayList()); } this.branchesMap.get(branch.getSectionId()).add(branch); + } } + + private void loadBooks(){ + + List bookList = DBService.getInstance().getBooks(); + + this.booksMap = new HashMap(); + + for (DBBook book : bookList) { + + this.booksMap.put(book.getId(), book); + + } + + } + + + + public void addAllSectionsToTopic(List list, Long selectedTopicId) throws Exception { + + if (list == null) { + return; + } + logger.debug("selectedTopicId: " + selectedTopicId + ", total " + list.size() + " sections."); + + Integer added = 0; + Integer existing = 0; + + for (DBSection section : list) { + // create a new record in TopicSectionRelation table + String status = DataProvider.getInstance().updateTopicSectionRelation(section.getId(), selectedTopicId); + + if (StringUtils.equals(status, "added") ) { + added++; + } else if (StringUtils.equals(status, "updated") ) { + existing++; + } + + } + + addMsg("Added " + added.toString() + " sections. " + existing.toString() + " sections already in the topic."); + + this.reset(); + } + + + + + public List getContributors() { return contributors; } @@ -538,21 +613,36 @@ } + + + + public List getPendingBookList() { + return pendingBookList; + } + + + + public void setPendingBookList(List pendingBookList) { + this.pendingBookList = pendingBookList; + } + + public List getCompleteSectionList() { return completeSectionList; } - - public void setCompleteSectionList(List completeSectionList) { this.completeSectionList = completeSectionList; } + + + + /////// Sorting - public void sortByBookNameUp(){ Collections.sort(this.completeSectionList, new SortSectionByBookName()); @@ -669,6 +759,18 @@ filter(); } + + public void updateKeywords() { + String keywords = getParameter("keywords"); + this.getTopic().setKeywords(keywords); + + this.saveTopic0(); + + } + + + + diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/webapp/methods/addSectionToTopic.jsp --- a/src/main/webapp/methods/addSectionToTopic.jsp Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/webapp/methods/addSectionToTopic.jsp Wed Dec 23 16:03:32 2015 +0100 @@ -3,53 +3,69 @@ <%@page import="de.mpiwg.gazetteer.utils.DBService"%> <%@page import="de.mpiwg.gazetteer.utils.DataProvider"%> + <% - if(request.getParameter("sectionId") != null){ - Long sectionId = Long.parseLong(request.getParameter("sectionId")); - - if(sectionId != 0){ + if (sessionBean == null || sessionBean.getUser() == null) { %> +
+ - if (sessionBean.getTopicListPage().getCompleteTopicList() == null) { - sessionBean.getTopicListPage().loadParameters(request, response); - sessionBean.getTopicListPage().reloadTopics(); - } - +

Timeout or Logout at another page! Please Login again.

+ + +
+<% } else if (sessionBean.getTopicListPage().getCompleteTopicList() == null) { + sessionBean.getTopicListPage().loadParameters(request, response); + sessionBean.getTopicListPage().reloadTopics(); + } +%> + +
+ + + + + + + + + + <% for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) {%> + + + + + <% } %> +
<%=topic.getId() %> + <%=topic.getNameEn() %>(<%=topic.getNameCh() %>) + + <% if(request.getParameter("sectionId") != null) { + Long sectionId = Long.parseLong(request.getParameter("sectionId")); + %> + + " /> + + + + <% } else if (request.getParameter("addAllSections") != null) { %> + + + <% } %> + +
-%> - - - +
- - " /> - - - - - - - - <% for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) {%> - - - - - <% } %> -
<%=topic.getId() %> - <%=topic.getNameEn() %>(<%=topic.getNameCh() %>) - - -
- - - -<% - } - } -%> \ No newline at end of file + + \ No newline at end of file diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/webapp/methods/getDataverseForm.jsp --- a/src/main/webapp/methods/getDataverseForm.jsp Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/webapp/methods/getDataverseForm.jsp Wed Dec 23 16:03:32 2015 +0100 @@ -2,77 +2,94 @@ <%@page import="de.mpiwg.gazetteer.dataverse.bo.Study"%> <%@page import="de.mpiwg.gazetteer.dataverse.bo.Datasets"%> <%@page import="java.util.List"%> - -<% - - //List studies = DataverseUtils.getStudies(sessionBean.getUser().getUserName(), sessionBean.getUser().getPassword()); - // List studies = DataverseUtils.getDatasets(sessionBean.getUser().getUserName(), sessionBean.getUser().getPassword()); - List studies = DataverseUtils.getDatasetsInAllDataverse(sessionBean.getUser().getUserName(), sessionBean.getUser().getPassword()); - - System.out.println("%%%%% Studies: " + studies.size()); - - if(studies.isEmpty()){ -%> - - -<% - } else { -%> + + + <% if (sessionBean == null || sessionBean.getUser() == null) { %> +
+ + +

Timeout or Logout at another page! Please Login again.

+ + +
+ + <% } else { -
- - " /> + //List studies = DataverseUtils.getStudies(sessionBean.getUser().getUserName(), sessionBean.getUser().getPassword()); + // List studies = DataverseUtils.getDatasets(sessionBean.getUser().getUserName(), sessionBean.getUser().getPassword()); + List studies = DataverseUtils.getDatasetsInAllDataverse(sessionBean.getUser().getUserName(), sessionBean.getUser().getPassword()); + + System.out.println("%%%%% Studies: " + studies.size()); + + if(studies.isEmpty()){ + %> + + + <% + } else { + %> - - - - - - - - - - - - - - <% - for(Datasets study : studies){ - %> + + + " /> + - - - - - - - - - - - - - - <% - } - %> -
<%= study.getDvIdInDataverse() %><%= study.getTitle() %><%= study.getCreateTime() %><%= study.getVersionState().toLowerCase() %><%= study.getVersion() %> - -
- + + + + + + + + + + + + + + <% + for(Datasets study : studies){ + %> + + + + + + + + + + + + + + + <% + } + %> +
<%= study.getDvIdInDataverse() %><%= study.getTitle() %><%= study.getCreateTime() %><%= study.getVersionState().toLowerCase() %><%= study.getVersion() %> + +
+ + <% + } } %> \ No newline at end of file diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/webapp/pages/branchPage.jsp --- a/src/main/webapp/pages/branchPage.jsp Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/webapp/pages/branchPage.jsp Wed Dec 23 16:03:32 2015 +0100 @@ -62,7 +62,7 @@
-
XXXX
+
diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/webapp/pages/search.jsp --- a/src/main/webapp/pages/search.jsp Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/webapp/pages/search.jsp Wed Dec 23 16:03:32 2015 +0100 @@ -1,4 +1,5 @@ <%@page import="de.mpiwg.gazetteer.bo.LGBranch"%> +<%@page import="de.mpiwg.gazetteer.bo.LGTopicSectionRelation"%> <%@page import="org.apache.commons.lang.StringUtils"%> <%@page import="de.mpiwg.gazetteer.db.DBSection"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> @@ -16,15 +17,33 @@ $(function() { + $("#addAllSectionsToTopic").click(function() { + + var r = confirm("Add "+ '<%= sessionBean.getSearchPage().getFilteredSectionList().size() %>' + " sections to a topic?"); + if (r == true) { + console.log("addAllSectionsToTopic"); + + var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/addSectionToTopic.jsp?addAllSections=1"; + + $.ajax( url0 ) + .done(function(data) { + $( "#dialogAddSectionToTopicTable" ).replaceWith(data); + dialogAddSectionToTopic.dialog( "open" ); + }) + .fail(function() { + console.error("Error calling: " + query); + }); + + } + + }); + $( ".addSectionToTopic" ).click(function() { var sectionId = $( this ).data('section-id'); - - - console.log("addSectionToTopic. sectionId = " + sectionId); + //console.log("addSectionToTopic. sectionId = " + sectionId); var url0 = "<%=sessionBean.getApplicationBean().getRootServer()%>/methods/addSectionToTopic.jsp?sectionId=" + sectionId; - - + $.ajax( url0 ) .done(function(data) { $( "#dialogAddSectionToTopicTable" ).replaceWith(data); @@ -191,7 +210,7 @@
-
+
@@ -411,29 +430,6 @@ - @@ -478,13 +474,20 @@ - + + - <% - for (DBSection section : sessionBean.getSearchPage().getDisplaySectionList()) { + <% + for (DBSection section : sessionBean.getSearchPage().getDisplaySectionList()) { %> - diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/webapp/pages/topicList.jsp --- a/src/main/webapp/pages/topicList.jsp Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/webapp/pages/topicList.jsp Wed Dec 23 16:03:32 2015 +0100 @@ -52,7 +52,7 @@
+ + + Add all sections to Topic + + +
@@ -514,10 +517,33 @@ + + + <% if(section.getTopicSectionRelation() != null && !section.getTopicSectionRelation().isEmpty()) { %> + Already in topic: + + <% for(LGTopicSectionRelation relation : section.getTopicSectionRelation()) { %> + + + + + <% } %> +
+ + +
<%=relation.getTopic().info() %>
+
+ + + Manage Topic + + +
+ <% } %> Add the section to Topic - + +
-
- Name (Eng) + name(Eng)* @@ -60,7 +60,7 @@
- name (中文) + name(中文)* @@ -68,7 +68,7 @@
- name (Pinyin) + name(Pinyin)* @@ -96,7 +96,7 @@ action="<%=sessionBean.getApplicationBean().getRootServer()%>/proxy.jsp" > -
Topic +
Topic List @@ -109,10 +109,7 @@ - - - - +
@@ -139,7 +136,6 @@
@@ -257,7 +253,7 @@ - <% for (LGTopic topic : sessionBean.getTopicListPage().getDisplayTopicList() ) { + <% for (LGTopic topic : sessionBean.getTopicListPage().getCompleteTopicList() ) { %> @@ -296,10 +292,6 @@ - - - - <% } %> <% } %> diff -r 815cd86bb9ec -r 9dbbbfd474f4 src/main/webapp/pages/topicPage.jsp --- a/src/main/webapp/pages/topicPage.jsp Fri Dec 18 11:50:24 2015 +0100 +++ b/src/main/webapp/pages/topicPage.jsp Wed Dec 23 16:03:32 2015 +0100 @@ -3,6 +3,7 @@ <%@page import="de.mpiwg.gazetteer.bo.LGBranch"%> <%@page import="org.apache.commons.lang.StringUtils"%> <%@page import="de.mpiwg.gazetteer.db.DBSection"%> +<%@page import="de.mpiwg.gazetteer.db.DBBook"%> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> @@ -12,9 +13,19 @@
<%=topic.getId() %>