From 30d30df997dbb9bcdbbf02bda7a96d20371fd3bc Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Mon, 29 Jun 2020 16:15:29 +0200
Subject: [PATCH 01/29] first prototype of new project browsing

---
 build.gradle                                  |   2 +-
 .../BrowseProjectController.java              | 164 ++++++++++++++++++
 .../rep/markdown/MarkdownRenderService.java   |   9 +-
 .../webapp/WEB-INF/jsp/base/navigation.jsp    |   5 +-
 src/main/webapp/WEB-INF/jsp/browse.jsp        | 143 +++++++--------
 .../webapp/WEB-INF/jsp/browseprojects.jsp     |  81 +++++++++
 .../jsp/components/singleGalleryProject.jsp   |  41 +++++
 .../jsp/components/singleListProject.jsp      |  31 ++++
 8 files changed, 402 insertions(+), 74 deletions(-)
 create mode 100644 src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
 create mode 100644 src/main/webapp/WEB-INF/jsp/browseprojects.jsp
 create mode 100644 src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp
 create mode 100644 src/main/webapp/WEB-INF/jsp/components/singleListProject.jsp

diff --git a/build.gradle b/build.gradle
index b6db22e..031212b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -35,7 +35,7 @@ dependencies {
     implementation 'com.atlassian.commonmark:commonmark-ext-heading-anchor:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-yaml-front-matter:0.14.0'
-    implementation 'info.textgrid.middleware.clients:textgrid-clients:3.4.3'
+    implementation 'info.textgrid.middleware.clients:textgrid-clients:3.4.3.1-ES6-SNAPSHOT'
     developmentOnly("org.springframework.boot:spring-boot-devtools")
     testImplementation('org.springframework.boot:spring-boot-starter-test') {
         exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
new file mode 100644
index 0000000..e14df9d
--- /dev/null
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -0,0 +1,164 @@
+package info.textgrid.rep.browseproject;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Locale;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.MediaType;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.RequestParam;
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
+import info.textgrid.namespaces.middleware.tgsearch.Response;
+import info.textgrid.namespaces.middleware.tgsearch.portal.Project;
+import info.textgrid.namespaces.middleware.tgsearch.portal.ProjectsResponse;
+import info.textgrid.rep.i18n.I18N;
+import info.textgrid.rep.i18n.I18NProvider;
+import info.textgrid.rep.markdown.MarkdownRenderService;
+import info.textgrid.rep.service.TgcrudClientService;
+import info.textgrid.rep.service.TgrepConfigurationService;
+import info.textgrid.rep.service.TgsearchClientService;
+import info.textgrid.rep.shared.ToolLink;
+
+@Controller
+public class BrowseProjectController {
+
+  private TgsearchClientService tgsearchClient;
+  private MarkdownRenderService mds;
+  private TgcrudClientService tgcrudClient;
+  private TgrepConfigurationService tgrepConfig;
+  private Client client;
+  private I18NProvider i18nProvider;
+
+  private static final Log log = LogFactory.getLog(BrowseProjectController.class);
+
+  @Autowired
+  public BrowseProjectController(
+      TgsearchClientService tgsearchClient,
+      TgcrudClientService tgcrudClient,
+      MarkdownRenderService mds,
+      TgrepConfigurationService tgrepConfig,
+      I18NProvider i18nProvider) {
+    this.tgsearchClient = tgsearchClient;
+    this.tgcrudClient = tgcrudClient;
+    this.mds = mds;
+    this.tgrepConfig = tgrepConfig;
+    this.client = ClientBuilder.newClient();
+    this.i18nProvider = i18nProvider;
+  }
+
+  @GetMapping("/projects")
+  public String projects2(
+      Locale locale,
+      Model model,
+      @RequestParam(value = "mode", defaultValue = "list") String mode,
+      @RequestParam(value="limit", required=false, defaultValue="0") int limit,
+      @RequestParam(value="order", required=false, defaultValue="count.desc") String order) throws IOException {
+
+    // boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
+    boolean sandbox = false;
+
+    I18N i18n = i18nProvider.getI18N(locale);
+
+    // common variables for browse-root aggregations and browse single items
+    model.addAttribute("mode", mode);
+
+    ProjectsResponse pr = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/projects")
+      .register(JacksonJsonProvider.class)
+      .request(MediaType.APPLICATION_JSON)
+      .get()
+      .readEntity(ProjectsResponse.class);
+
+    List<ToolLink> viewmodes = new ArrayList<ToolLink>();
+    viewmodes
+        .add(new ToolLink(i18n.get("list"), "/projects/?mode=list", mode.equals("list")));
+    viewmodes.add(new ToolLink(i18n.get("gallery"), "/projects/?mode=gallery",
+        mode.equals("gallery")));
+    model.addAttribute("viewmodes", viewmodes);
+
+    model.addAttribute("projects", pr.getProjects());
+    return "browseprojects";
+  }
+
+  @GetMapping("/project/{id}")
+  public String projectByName(
+      Locale locale,
+      Model model,
+      @RequestParam(value = "mode", defaultValue = "list") String mode,
+      @PathVariable("id") String id,
+      @RequestParam(name="start", required=false, defaultValue="0") int start,
+      @RequestParam(name="limit", required=false, defaultValue="10") int limit,
+      @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
+
+    I18N i18n = i18nProvider.getI18N(locale);
+
+    // common variables for browse-root aggregations and browse single items
+    model.addAttribute("mode", mode);
+
+    System.out.println("calling: " + this.tgrepConfig.getTgsearchUrl()+"/portal/toplevel/"+id);
+
+    Response res = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/toplevel/"+id+"?limit=20")
+      .request(MediaType.TEXT_XML)
+      .get(Response.class);
+
+    Project project = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/project/"+id)
+        .register(JacksonJsonProvider.class)
+        .request(MediaType.APPLICATION_JSON)
+        .get()
+        .readEntity(Project.class);
+
+    /*
+    ObjectMapper mapper = new ObjectMapper();
+    try {
+      System.out.println(mapper.writerWithDefaultPrettyPrinter().writeValueAsString(project));
+    } catch (JsonProcessingException e1) {
+      // TODO Auto-generated catch block
+      e1.printStackTrace();
+    }
+    */
+
+    /*
+    Pager pager = new Pager()
+        .setHits(Integer.parseInt(res.getHits()))
+        .setLimit(limit)
+        .setStart(start);
+
+    pager.calculatePages();
+
+    model.addAttribute("pager", pager);
+*/
+    model.addAttribute("results", res.getResult());
+    model.addAttribute("isProject", true);
+    model.addAttribute("project", project);
+
+    if(project.getReadme() != null) {
+      try {
+        String readme = mds.renderHtml(project.getReadme());
+        model.addAttribute("readme", readme);
+      } catch (IOException e) {
+         log.error("error renderning markdown from string", e);
+      }
+    }
+
+    List<ToolLink> viewmodes = new ArrayList<ToolLink>();
+    viewmodes
+        .add(new ToolLink(i18n.get("list"), "/project/"+id+"?mode=list", mode.equals("list")));
+    viewmodes.add(new ToolLink(i18n.get("gallery"), "/project/"+id+"?mode=gallery",
+        mode.equals("gallery")));
+    model.addAttribute("viewmodes", viewmodes);
+
+    return "browse";
+  }
+
+
+
+
+
+}
diff --git a/src/main/java/info/textgrid/rep/markdown/MarkdownRenderService.java b/src/main/java/info/textgrid/rep/markdown/MarkdownRenderService.java
index b218b9d..448ed4d 100644
--- a/src/main/java/info/textgrid/rep/markdown/MarkdownRenderService.java
+++ b/src/main/java/info/textgrid/rep/markdown/MarkdownRenderService.java
@@ -40,14 +40,19 @@ public class MarkdownRenderService {
     renderer = HtmlRenderer.builder()
         .extensions(extensions).build();
 
-    yamlVisitor = new YamlFrontMatterVisitor();
+    //yamlVisitor = new YamlFrontMatterVisitor();
 
   }
 
   public String renderHtml(InputStream in) throws IOException {
     InputStreamReader reader = new InputStreamReader(in);
     Node document = parser.parseReader(reader);
-    document.accept(yamlVisitor);
+    return renderer.render(document);
+  }
+
+  public String renderHtml(String markdown) throws IOException {
+    StringReader reader = new StringReader(markdown);
+    Node document = parser.parseReader(reader);
     return renderer.render(document);
   }
 
diff --git a/src/main/webapp/WEB-INF/jsp/base/navigation.jsp b/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
index 670faa4..69fc23b 100644
--- a/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
+++ b/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
@@ -34,6 +34,9 @@
           <li class="" id="layout_18" role="presentation">
             <a aria-labelledby="layout_18" href="/browse/root" role="menuitem" tabindex="">Repository</a>
           </li>
+          <li class="" id="layout_18" role="presentation">
+            <a aria-labelledby="layout_18" href="/projects" role="menuitem" tabindex="">Projekte</a>
+          </li>
           <li class="" id="layout_18" role="presentation">
             <a aria-labelledby="layout_18" href="/facet/edition.agent.value?order=term:asc" role="menuitem" tabindex="">...nach Autor</a>
           </li>
@@ -45,7 +48,7 @@
           </li>
           <li class="" id="layout_18" role="presentation">
             <a aria-labelledby="layout_18" href="/facet/project.value" role="menuitem" tabindex="">...nach Projekt</a>
-          </li>    
+          </li>
         </ul>
       </li>
       
diff --git a/src/main/webapp/WEB-INF/jsp/browse.jsp b/src/main/webapp/WEB-INF/jsp/browse.jsp
index 56a3379..c116026 100644
--- a/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -38,28 +38,30 @@
 
     <aside class="tgrep sidebar">
 
-      <section class="tgrep sidebar_panel">
-        <h3 class="tgrep sidebar_subheading">${i18n['metadata']}</h3>
-        <!-- TODO: each for agent, pid, etc -->
-        <dl>
-          <dt>${i18n['format']}</dt><dd>${metadata.object.generic.provided.format}</dd>
-
-          <!-- show author when available, first agent otherwise -->
-          <%@ include file="components/authorAndAgents.jsp" %>
-
-          <c:if test="${not empty metadata.object.edition.source[0].bibliographicCitation.dateOfPublication.date}">
-            <dt>${i18n['date-of-publication']}</dt><dd>${metadata.object.edition.source[0].bibliographicCitation.dateOfPublication.date}</dd>
-          </c:if>
-          <c:if test="${not empty metadata.object.edition.source[0].bibliographicCitation.placeOfPublication[0].value}">
-            <dt>${i18n['place-of-publication']}</dt><dd>${metadata.object.edition.source[0].bibliographicCitation.placeOfPublication[0].value}</dd>
-          </c:if>
-          <c:if test="${not empty metadata.object.generic.generated.pid[0].value}">
-            <dt>${i18n['pid']}</dt>
-                        <dd><a href="${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}">${metadata.object.generic.generated.pid[0].value}</a><br/>
-                        <a href="#citation">${i18n['citation']}</a></dd>
-          </c:if>
-        </dl>
-      </section>
+      <c:if test="${not isProject}">
+        <section class="tgrep sidebar_panel">
+          <h3 class="tgrep sidebar_subheading">${i18n['metadata']}</h3>
+          <!-- TODO: each for agent, pid, etc -->
+          <dl>
+            <dt>${i18n['format']}</dt><dd>${metadata.object.generic.provided.format}</dd>
+
+            <!-- show author when available, first agent otherwise -->
+            <%@ include file="components/authorAndAgents.jsp" %>
+
+            <c:if test="${not empty metadata.object.edition.source[0].bibliographicCitation.dateOfPublication.date}">
+              <dt>${i18n['date-of-publication']}</dt><dd>${metadata.object.edition.source[0].bibliographicCitation.dateOfPublication.date}</dd>
+            </c:if>
+            <c:if test="${not empty metadata.object.edition.source[0].bibliographicCitation.placeOfPublication[0].value}">
+              <dt>${i18n['place-of-publication']}</dt><dd>${metadata.object.edition.source[0].bibliographicCitation.placeOfPublication[0].value}</dd>
+            </c:if>
+            <c:if test="${not empty metadata.object.generic.generated.pid[0].value}">
+              <dt>${i18n['pid']}</dt>
+                          <dd><a href="${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}">${metadata.object.generic.generated.pid[0].value}</a><br/>
+                          <a href="#citation">${i18n['citation']}</a></dd>
+            </c:if>
+          </dl>
+        </section>
+      </c:if>
 
       <c:if test="${revisions.size() > 1}">
         <section class="tgrep sidebar_panel">
@@ -74,53 +76,55 @@
         </section>
       </c:if>
 
-      <section class="tgrep sidebar_panel">
-        <h3 class="tgrep sidebar_subheading">${i18n['download']}</h3>
-        <ul class="tgrep sidebar_list">
-          <li>
-            <a href="${config.textgridHost}/1.0/tgcrud-public/rest/${metadata.object.generic.generated.textgridUri.value}/data">
-              ${i18n['object']} <c:if test="${isTEI}">(TEI)</c:if>
-            </a>
-          </li>
-                    <li>
-            <a href="${config.textgridHost}/1.0/tgcrud-public/rest/${metadata.object.generic.generated.textgridUri.value}/metadata">
-              ${i18n['metadata']} (XML)
-            </a>
-          </li>
-                    <li>
-            <a href="${config.textgridHost}/1.0/tgcrud-public/rest/${metadata.object.generic.generated.textgridUri.value}/tech">
-              ${i18n['techmd']} (XML)
-            </a>
-          </li>
-          <c:if test="${isTEI}">
+      <c:if test="${not isProject}">
+        <section class="tgrep sidebar_panel">
+          <h3 class="tgrep sidebar_subheading">${i18n['download']}</h3>
+          <ul class="tgrep sidebar_list">
             <li>
-              <a href="${config.textgridHost}/1.0/aggregator/text/${metadata.object.generic.generated.textgridUri.value}">
-                Plain Text (txt)
+              <a href="${config.textgridHost}/1.0/tgcrud-public/rest/${metadata.object.generic.generated.textgridUri.value}/data">
+                ${i18n['object']} <c:if test="${isTEI}">(TEI)</c:if>
               </a>
             </li>
-            <li>
-              <a href="${config.textgridHost}/1.0/aggregator/epub/${metadata.object.generic.generated.textgridUri.value}">
-                E-Book (epub)
+                      <li>
+              <a href="${config.textgridHost}/1.0/tgcrud-public/rest/${metadata.object.generic.generated.textgridUri.value}/metadata">
+                ${i18n['metadata']} (XML)
               </a>
             </li>
-            <li>
-              <a href="${config.textgridHost}/1.0/aggregator/html/${metadata.object.generic.generated.textgridUri.value}">
-                HTML
+                      <li>
+              <a href="${config.textgridHost}/1.0/tgcrud-public/rest/${metadata.object.generic.generated.textgridUri.value}/tech">
+                ${i18n['techmd']} (XML)
               </a>
             </li>
-            <li>
-              <a href="${config.textgridHost}/1.0/aggregator/zip/${metadata.object.generic.generated.textgridUri.value}">
-                ZIP
+            <c:if test="${isTEI}">
+              <li>
+                <a href="${config.textgridHost}/1.0/aggregator/text/${metadata.object.generic.generated.textgridUri.value}">
+                  Plain Text (txt)
+                </a>
+              </li>
+              <li>
+                <a href="${config.textgridHost}/1.0/aggregator/epub/${metadata.object.generic.generated.textgridUri.value}">
+                  E-Book (epub)
+                </a>
+              </li>
+              <li>
+                <a href="${config.textgridHost}/1.0/aggregator/html/${metadata.object.generic.generated.textgridUri.value}">
+                  HTML
+                </a>
+              </li>
+              <li>
+                <a href="${config.textgridHost}/1.0/aggregator/zip/${metadata.object.generic.generated.textgridUri.value}">
+                  ZIP
+                </a>
+              </li>
+            </c:if>
+            <c:if test="${fn:contains(metadata.object.generic.provided.format, 'aggregation')}">
+              <a href="${config.textgridHost}/1.0/aggregator/teicorpus/${metadata.object.generic.generated.textgridUri.value}">
+                TEI-Corpus (XML)
               </a>
-            </li>
-          </c:if>
-          <c:if test="${fn:contains(metadata.object.generic.provided.format, 'aggregation')}">
-            <a href="${config.textgridHost}/1.0/aggregator/teicorpus/${metadata.object.generic.generated.textgridUri.value}">
-              TEI-Corpus (XML)
-            </a>
-          </c:if>
-        </ul>
-      </section>
+            </c:if>
+          </ul>
+        </section>
+      </c:if>
 
       <c:if test="${viewmodes != null}">
         <section class="tgrep sidebar_panel">
@@ -181,8 +185,8 @@
     <%@ include file="components/path.jsp" %>
     
     <c:if test="${isProject}">
-        <h1>${project.title}</h1>
-        <p>${project.description} <a href="#README">[more...]</a></p>
+        <h1>${project.name}</h1>
+        <p>${project.portalconfig.description} <c:if test="${readme != null}"><a href="#README">[more...]</a></c:if></p>
     </c:if>
 
     <c:choose>
@@ -290,14 +294,13 @@
       ${readme}
     </c:if>
 
-
-    <!-- Citation examples -->
-    <div id="citation" class="clearboth">
-    <hr/>
-    <%@ include file="components/citation.jsp" %>
-
+    <c:if test="${not isProject}">
+      <!-- Citation examples -->
+      <div id="citation" class="clearboth">
+      <hr/>
+      <%@ include file="components/citation.jsp" %>
+    </c:if>
   </main>
-
 </div>
 
 <%@ include file="base/foot.jsp" %>
diff --git a/src/main/webapp/WEB-INF/jsp/browseprojects.jsp b/src/main/webapp/WEB-INF/jsp/browseprojects.jsp
new file mode 100644
index 0000000..6686362
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/browseprojects.jsp
@@ -0,0 +1,81 @@
+<%@ page contentType="text/html" pageEncoding="UTF-8" %>
+
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib uri="http://textgrid.info/rep/utils" prefix="utils" %>
+
+<%@ include file="base/head.jsp" %>
+
+<div class="tgrep wrap">
+
+  <aside class="tgrep sidebar">
+    <c:if test="${viewmodes != null}">
+      <section class="tgrep sidebar_panel">
+        <h3 class="tgrep sidebar_subheading">${i18n['views']}</h3>
+        <ul class="tgrep sidebar_list">
+          <c:forEach items="${viewmodes}" var="viewmode">
+            <li class="tgrep sidebar_item ${viewmode.active? '-current' : ''}">
+              <a href="${viewmode.url}" rel="noindex nofollow" class="tgrep sidebar_link">${viewmode.label}</a>
+            </li>
+          </c:forEach>
+        </ul>
+        <c:if test="${viewmodes.size() > 6}">
+          <button class="tgrep sidebar_expand">${i18n['expand']}</button>
+        </c:if>
+      </section>
+    </c:if>
+  </aside>
+
+<!-- 
+  <main class="tgrep main -full-width">
+-->
+
+  <main class="tgrep main">
+  
+    <h1>Projects</h1>
+    <p>Find here a list of projects which published data to the TextGrid Repository</p>
+  
+    <div class="tgrep browse">
+    
+        <div class="tgrep results">
+          <c:choose>
+            <c:when test="${mode eq 'gallery'}">
+              <ol class="tgrep results_gallery">
+                <c:forEach items="${projects}" var="project">
+                  <%@ include file="components/singleGalleryProject.jsp" %>
+                </c:forEach>
+              </ol>
+            </c:when>
+
+            <c:otherwise>
+              <ol class="tgrep results_list">
+                <c:forEach items="${projects}" var="project">
+                  <%@ include file="components/singleListProject.jsp" %>
+                </c:forEach>
+              </ol>
+            </c:otherwise>
+          </c:choose>
+        </div>
+  
+        <!--   
+        <ul class="tgrep browse_list">
+          <c:forEach items="${projects}" var="project">
+            <li class="tgrep browse_item">
+              <c:url context="/" value="/project/${project.id}" var="encodedUrl">
+              </c:url>
+              <a class="tgrep browse_link" href="${encodedUrl}">
+                ${project.name}
+              </a>
+              (${project.count} items)
+              <p>${project.portalconfig.description}</p>
+            </li>
+          </c:forEach>
+        </ul>
+        -->
+      </div>
+
+  </main>
+
+</div>
+
+
+<%@ include file="base/foot.jsp" %>
diff --git a/src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp b/src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp
new file mode 100644
index 0000000..2804eef
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp
@@ -0,0 +1,41 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="http://textgrid.info/rep/utils" prefix="utils"%>
+
+<c:url context="/" value="/project/${project.id}" var="encodedUrl"></c:url>
+
+<c:choose>
+  <c:when test="${project.portalconfig.avatar != null}">
+    <c:url value="${config.textgridHost}/1.0/digilib/rest/IIIF/${project.portalconfig.avatar}/full/,250/0/native.jpg" var="imgUrl"></c:url>
+  </c:when>
+  <c:otherwise>
+    <c:url context="/" value="/static/images/no_image.svg" var="imgUrl"></c:url>
+  </c:otherwise>
+</c:choose>
+
+<c:choose>
+  <c:when test="${project.portalconfig.description != null}">
+    <c:set var="description" value="${project.portalconfig.description}"></c:set>
+  </c:when>
+  <c:otherwise>
+     <c:set var="description" value="${project.name}"></c:set>
+  </c:otherwise>
+</c:choose>
+
+<c:set var="description" value="${description} / ${project.count} objects"></c:set>
+
+<li class="tgrep gallery-item">
+  <div>
+    <div class="tgrep gallery-item_image"">
+        <a href="${encodedUrl}?mode=gallery">
+           <img src="${imgUrl}" alt="${project.name}" title="${description}" />
+        </a>
+    </div>
+    <div class="tgrep gallery-item_title">
+      <a class="tgrep browse_link" href="${encodedUrl}?mode=gallery">
+        ${project.name}
+      </a>
+    </div>
+  </div>
+
+</li>
diff --git a/src/main/webapp/WEB-INF/jsp/components/singleListProject.jsp b/src/main/webapp/WEB-INF/jsp/components/singleListProject.jsp
new file mode 100644
index 0000000..1e8964e
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/components/singleListProject.jsp
@@ -0,0 +1,31 @@
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
+<%@ taglib uri="http://textgrid.info/rep/utils" prefix="utils" %>
+
+<li class="tgrep result">
+  <div class="tgrep result_main">
+    <div class="tgrep result_title">
+      <c:url context="/" value="/project/${project.id}" var="encodedUrl">
+      </c:url>
+      <a class="tgrep browse_link" href="${encodedUrl}">
+        ${project.name}
+      </a>
+    </div>
+
+    <ol class="tgrep metadata_list">
+      <c:if test="${project.portalconfig.description != null}">
+        <li>${project.portalconfig.description}</li>
+      </c:if>
+      <li>${project.count} Objects</li>
+    </ol>
+  </div>
+
+  <c:if test="${project.portalconfig.avatar != null}">
+    <div class="tgrep result_image">
+        <a class="tgrep browse_link" href="${encodedUrl}">
+           <img src="${config.textgridHost}/1.0/digilib/rest/IIIF/${project.portalconfig.avatar}/full/,250/0/native.jpg" alt="${project.name}" title="${project.name}" />
+        </a>
+    </div>
+  </c:if>
+
+</li>
-- 
GitLab


From 8d09a11318f82042375d99863a93565e962bd97c Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Tue, 30 Jun 2020 23:51:28 +0200
Subject: [PATCH 02/29] sandbox visibility setable

---
 .../textgrid/rep/browse/BrowseController.java |  4 ++++
 .../browsefacet/BrowseFacetController.java    |  7 +++++-
 .../BrowseProjectController.java              | 22 +++++++++++++------
 .../textgrid/rep/search/SearchController.java |  7 +++++-
 src/main/webapp/WEB-INF/jsp/base/topbox.jsp   | 11 ++++++++++
 5 files changed, 42 insertions(+), 9 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browse/BrowseController.java b/src/main/java/info/textgrid/rep/browse/BrowseController.java
index 2aed14b..2a01d70 100644
--- a/src/main/java/info/textgrid/rep/browse/BrowseController.java
+++ b/src/main/java/info/textgrid/rep/browse/BrowseController.java
@@ -17,8 +17,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.SessionAttributes;
 import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 import info.textgrid.clients.tgcrud.CrudClientException;
 import info.textgrid.namespaces.middleware.tgsearch.ResultType;
@@ -31,9 +33,11 @@ import info.textgrid.rep.service.TgcrudClientService;
 import info.textgrid.rep.service.TgrepConfigurationService;
 import info.textgrid.rep.service.TgsearchClientService;
 import info.textgrid.rep.shared.Utils;
+import info.textgrid.rep.usersettings.UserSettings;
 import info.textgrid.rep.shared.ToolLink;
 
 @Controller
+@SessionAttributes("userSettings")
 public class BrowseController {
 
   private TgrepConfigurationService tgrepConfig;
diff --git a/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java b/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
index 7199282..1a27bd7 100644
--- a/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
+++ b/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
@@ -9,12 +9,16 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.SessionAttributes;
 import info.textgrid.namespaces.middleware.tgsearch.FacetType;
 import info.textgrid.rep.service.TgsearchClientService;
+import info.textgrid.rep.usersettings.UserSettings;
 
 @Controller
+@SessionAttributes("userSettings")
 public class BrowseFacetController {
 
   private TgsearchClientService tgsearchClientService;
@@ -30,12 +34,13 @@ public class BrowseFacetController {
   public String render(
       Locale locale,
       Model model,
+      @ModelAttribute UserSettings userSettings,
       @PathVariable("facet") String facet,
       @RequestParam(value="limit", required=false, defaultValue="0") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
 
     // boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
-    boolean sandbox = false;
+    boolean sandbox = userSettings.getSandboxEnabled();
 
     // list facets configured for this portlet
     List<String> facetList = new ArrayList<String>();
diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index e14df9d..c06e128 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -13,8 +13,10 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.SessionAttributes;
 import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 import info.textgrid.namespaces.middleware.tgsearch.Response;
 import info.textgrid.namespaces.middleware.tgsearch.portal.Project;
@@ -26,6 +28,7 @@ import info.textgrid.rep.service.TgcrudClientService;
 import info.textgrid.rep.service.TgrepConfigurationService;
 import info.textgrid.rep.service.TgsearchClientService;
 import info.textgrid.rep.shared.ToolLink;
+import info.textgrid.rep.usersettings.UserSettings;
 
 @Controller
 public class BrowseProjectController {
@@ -55,15 +58,16 @@ public class BrowseProjectController {
   }
 
   @GetMapping("/projects")
-  public String projects2(
+  public String projects(
       Locale locale,
       Model model,
+      @ModelAttribute UserSettings userSettings,
       @RequestParam(value = "mode", defaultValue = "list") String mode,
       @RequestParam(value="limit", required=false, defaultValue="0") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) throws IOException {
 
     // boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
-    boolean sandbox = false;
+    boolean sandbox = userSettings.getSandboxEnabled();
 
     I18N i18n = i18nProvider.getI18N(locale);
 
@@ -71,6 +75,7 @@ public class BrowseProjectController {
     model.addAttribute("mode", mode);
 
     ProjectsResponse pr = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/projects")
+      .queryParam("sandbox", sandbox)
       .register(JacksonJsonProvider.class)
       .request(MediaType.APPLICATION_JSON)
       .get()
@@ -88,27 +93,30 @@ public class BrowseProjectController {
   }
 
   @GetMapping("/project/{id}")
-  public String projectByName(
+  public String projectById(
       Locale locale,
       Model model,
+      @ModelAttribute UserSettings userSettings,
       @RequestParam(value = "mode", defaultValue = "list") String mode,
       @PathVariable("id") String id,
       @RequestParam(name="start", required=false, defaultValue="0") int start,
-      @RequestParam(name="limit", required=false, defaultValue="10") int limit,
+      @RequestParam(name="limit", required=false, defaultValue="20") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
 
     I18N i18n = i18nProvider.getI18N(locale);
+    boolean sandbox =  userSettings.getSandboxEnabled();
 
     // common variables for browse-root aggregations and browse single items
     model.addAttribute("mode", mode);
 
-    System.out.println("calling: " + this.tgrepConfig.getTgsearchUrl()+"/portal/toplevel/"+id);
-
-    Response res = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/toplevel/"+id+"?limit=20")
+    Response res = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/toplevel/"+id)
+      .queryParam("limit", limit)
+      .queryParam("sandbox", sandbox)
       .request(MediaType.TEXT_XML)
       .get(Response.class);
 
     Project project = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/project/"+id)
+        .queryParam("sandbox", sandbox)
         .register(JacksonJsonProvider.class)
         .request(MediaType.APPLICATION_JSON)
         .get()
diff --git a/src/main/java/info/textgrid/rep/search/SearchController.java b/src/main/java/info/textgrid/rep/search/SearchController.java
index ed7bc16..8b28abf 100644
--- a/src/main/java/info/textgrid/rep/search/SearchController.java
+++ b/src/main/java/info/textgrid/rep/search/SearchController.java
@@ -12,7 +12,9 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.WebDataBinder;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.InitBinder;
+import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.SessionAttributes;
 import org.springframework.web.util.HtmlUtils;
 import info.textgrid.namespaces.middleware.tgsearch.Response;
 import info.textgrid.rep.i18n.I18N;
@@ -20,9 +22,11 @@ import info.textgrid.rep.i18n.I18NProvider;
 import info.textgrid.rep.service.TgsearchClientService;
 import info.textgrid.rep.shared.Pager;
 import info.textgrid.rep.shared.Utils;
+import info.textgrid.rep.usersettings.UserSettings;
 import info.textgrid.rep.shared.ToolLink;
 
 @Controller
+@SessionAttributes("userSettings")
 public class SearchController {
 
   private TgsearchClientService tgsearchClient;
@@ -55,6 +59,7 @@ public class SearchController {
       @RequestParam(name="limit", required=false, defaultValue="10") int limit,
       @RequestParam(name="filter", required=false) List<String> filter,
       @RequestParam(value="mode", defaultValue="list") String mode,
+      @ModelAttribute UserSettings userSettings,
       Locale locale,
       Model model) {
 
@@ -62,7 +67,7 @@ public class SearchController {
 
 //    boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
 
-    boolean sandbox = true;
+    boolean sandbox = userSettings.getSandboxEnabled();
     String aggregatorSandboxParam = sandbox ? "&sandbox=true" : "";
 
     String realQueryString = query;
diff --git a/src/main/webapp/WEB-INF/jsp/base/topbox.jsp b/src/main/webapp/WEB-INF/jsp/base/topbox.jsp
index 539b00e..a5fbbab 100644
--- a/src/main/webapp/WEB-INF/jsp/base/topbox.jsp
+++ b/src/main/webapp/WEB-INF/jsp/base/topbox.jsp
@@ -34,6 +34,17 @@
 
       </li>
 -->
+    <li>
+        <a href="#search" class="tg dropdown_toggle topbox_user"></a>
+        <ul class="tg dropdown_menu">
+          <li>
+            <a class="tg topbox_link -settings" href="/settings">
+              ${i18n['settings']}
+            </a>
+          </li>
+        </ul>
+    </li>
+
     <li class="tg topbox_language">
       <c:choose>
         <c:when test="${language == 'de'}">
-- 
GitLab


From aa6d687ad3778db2fb34fc8b9dc619b04d9a58f7 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Tue, 30 Jun 2020 23:52:46 +0200
Subject: [PATCH 03/29] add missing files to last commit

---
 .../rep/usersettings/UserSettings.java        | 19 +++++++++
 .../usersettings/UserSettingsController.java  | 40 +++++++++++++++++++
 src/main/webapp/WEB-INF/jsp/usersettings.jsp  | 28 +++++++++++++
 3 files changed, 87 insertions(+)
 create mode 100644 src/main/java/info/textgrid/rep/usersettings/UserSettings.java
 create mode 100644 src/main/java/info/textgrid/rep/usersettings/UserSettingsController.java
 create mode 100644 src/main/webapp/WEB-INF/jsp/usersettings.jsp

diff --git a/src/main/java/info/textgrid/rep/usersettings/UserSettings.java b/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
new file mode 100644
index 0000000..4956e43
--- /dev/null
+++ b/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
@@ -0,0 +1,19 @@
+package info.textgrid.rep.usersettings;
+
+import java.io.Serializable;
+
+public class UserSettings implements Serializable{
+
+	private static final long serialVersionUID = 1786520003840881119L;
+
+	private Boolean sandboxEnabled;
+
+	public Boolean getSandboxEnabled() {
+		return sandboxEnabled;
+	}
+
+	public void setSandboxEnabled(Boolean sandboxEnabled) {
+		this.sandboxEnabled = sandboxEnabled;
+	}
+
+}
diff --git a/src/main/java/info/textgrid/rep/usersettings/UserSettingsController.java b/src/main/java/info/textgrid/rep/usersettings/UserSettingsController.java
new file mode 100644
index 0000000..158e9a3
--- /dev/null
+++ b/src/main/java/info/textgrid/rep/usersettings/UserSettingsController.java
@@ -0,0 +1,40 @@
+package info.textgrid.rep.usersettings;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.SessionAttributes;
+
+
+@Controller
+@SessionAttributes("userSettings")
+public class UserSettingsController {
+
+  private static final Log log = LogFactory.getLog(UserSettingsController.class);
+
+  @ModelAttribute("userSettings")
+  public UserSettings getUserSettings() {
+      return new UserSettings();
+  }
+
+  @GetMapping("/settings")
+  public String render(
+      Model model,
+      @ModelAttribute UserSettings userSettings) {
+
+    return "usersettings";
+  }
+
+  @PostMapping("/settings")
+  public String changeUserSettings(
+      @ModelAttribute("userSettings") UserSettings userSettings) {
+
+    return "usersettings";
+  }
+
+
+}
diff --git a/src/main/webapp/WEB-INF/jsp/usersettings.jsp b/src/main/webapp/WEB-INF/jsp/usersettings.jsp
new file mode 100644
index 0000000..0e4323d
--- /dev/null
+++ b/src/main/webapp/WEB-INF/jsp/usersettings.jsp
@@ -0,0 +1,28 @@
+<%@ page contentType="text/html" pageEncoding="UTF-8" %>
+
+<%@taglib uri="http://www.springframework.org/tags/form" prefix="form"%>
+
+<%@ include file="base/head.jsp" %>
+
+<div class="tgrep wrap">
+
+	<main class="tgrep main">
+
+		<form:form name="userSettings" method="post" modelAttribute="userSettings" action="/settings">
+
+			<fieldset>
+				<legend>${i18n['usersettings']}</legend>
+				<div>
+					${i18n['show-results-from-sandbox']}: &nbsp;&nbsp;<form:checkbox style="visibility:visible" name="sandboxEnabled" path="sandboxEnabled" value="sandboxEnabled" />
+				</div>
+				<button type="submit">${i18n['save']}</button>
+
+			</fieldset>
+
+		</form:form>
+
+	</main>
+
+</div>
+
+<%@ include file="base/foot.jsp" %>
\ No newline at end of file
-- 
GitLab


From cad66f1a4869f832cb14775d00f5a9bf8cbfda66 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 00:50:36 +0200
Subject: [PATCH 04/29] fix settings session

---
 .../textgrid/rep/browse/BrowseController.java  |  1 -
 .../rep/browsefacet/BrowseFacetController.java | 12 ++++++------
 .../browseproject/BrowseProjectController.java | 18 ++++++++++++------
 .../textgrid/rep/search/SearchController.java  | 15 +++++++--------
 .../rep/usersettings/UserSettings.java         |  2 +-
 5 files changed, 26 insertions(+), 22 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browse/BrowseController.java b/src/main/java/info/textgrid/rep/browse/BrowseController.java
index 2a01d70..7e95550 100644
--- a/src/main/java/info/textgrid/rep/browse/BrowseController.java
+++ b/src/main/java/info/textgrid/rep/browse/BrowseController.java
@@ -37,7 +37,6 @@ import info.textgrid.rep.usersettings.UserSettings;
 import info.textgrid.rep.shared.ToolLink;
 
 @Controller
-@SessionAttributes("userSettings")
 public class BrowseController {
 
   private TgrepConfigurationService tgrepConfig;
diff --git a/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java b/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
index 1a27bd7..80a2587 100644
--- a/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
+++ b/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
@@ -9,16 +9,14 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.SessionAttributes;
+import org.springframework.web.bind.annotation.SessionAttribute;
 import info.textgrid.namespaces.middleware.tgsearch.FacetType;
 import info.textgrid.rep.service.TgsearchClientService;
 import info.textgrid.rep.usersettings.UserSettings;
 
 @Controller
-@SessionAttributes("userSettings")
 public class BrowseFacetController {
 
   private TgsearchClientService tgsearchClientService;
@@ -34,13 +32,15 @@ public class BrowseFacetController {
   public String render(
       Locale locale,
       Model model,
-      @ModelAttribute UserSettings userSettings,
+      @SessionAttribute(required=false, name="userSettings") UserSettings userSettings,
       @PathVariable("facet") String facet,
       @RequestParam(value="limit", required=false, defaultValue="0") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
 
-    // boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
-    boolean sandbox = userSettings.getSandboxEnabled();
+    boolean sandbox = false;
+    if(userSettings != null) {
+      sandbox = userSettings.getSandboxEnabled();
+    }
 
     // list facets configured for this portlet
     List<String> facetList = new ArrayList<String>();
diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index c06e128..7d26026 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -16,7 +16,7 @@ import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.SessionAttributes;
+import org.springframework.web.bind.annotation.SessionAttribute;
 import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 import info.textgrid.namespaces.middleware.tgsearch.Response;
 import info.textgrid.namespaces.middleware.tgsearch.portal.Project;
@@ -61,13 +61,15 @@ public class BrowseProjectController {
   public String projects(
       Locale locale,
       Model model,
-      @ModelAttribute UserSettings userSettings,
+      @SessionAttribute(required=false, name="userSettings") UserSettings userSettings,
       @RequestParam(value = "mode", defaultValue = "list") String mode,
       @RequestParam(value="limit", required=false, defaultValue="0") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) throws IOException {
 
-    // boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
-    boolean sandbox = userSettings.getSandboxEnabled();
+    boolean sandbox = false;
+    if(userSettings != null) {
+      sandbox = userSettings.getSandboxEnabled();
+    }
 
     I18N i18n = i18nProvider.getI18N(locale);
 
@@ -96,7 +98,7 @@ public class BrowseProjectController {
   public String projectById(
       Locale locale,
       Model model,
-      @ModelAttribute UserSettings userSettings,
+      @SessionAttribute(required=false, name="userSettings") UserSettings userSettings,
       @RequestParam(value = "mode", defaultValue = "list") String mode,
       @PathVariable("id") String id,
       @RequestParam(name="start", required=false, defaultValue="0") int start,
@@ -104,7 +106,11 @@ public class BrowseProjectController {
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
 
     I18N i18n = i18nProvider.getI18N(locale);
-    boolean sandbox =  userSettings.getSandboxEnabled();
+
+    boolean sandbox = false;
+    if(userSettings != null) {
+      sandbox = userSettings.getSandboxEnabled();
+    }
 
     // common variables for browse-root aggregations and browse single items
     model.addAttribute("mode", mode);
diff --git a/src/main/java/info/textgrid/rep/search/SearchController.java b/src/main/java/info/textgrid/rep/search/SearchController.java
index 8b28abf..7955b84 100644
--- a/src/main/java/info/textgrid/rep/search/SearchController.java
+++ b/src/main/java/info/textgrid/rep/search/SearchController.java
@@ -12,21 +12,19 @@ import org.springframework.ui.Model;
 import org.springframework.web.bind.WebDataBinder;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.InitBinder;
-import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestParam;
-import org.springframework.web.bind.annotation.SessionAttributes;
+import org.springframework.web.bind.annotation.SessionAttribute;
 import org.springframework.web.util.HtmlUtils;
 import info.textgrid.namespaces.middleware.tgsearch.Response;
 import info.textgrid.rep.i18n.I18N;
 import info.textgrid.rep.i18n.I18NProvider;
 import info.textgrid.rep.service.TgsearchClientService;
 import info.textgrid.rep.shared.Pager;
+import info.textgrid.rep.shared.ToolLink;
 import info.textgrid.rep.shared.Utils;
 import info.textgrid.rep.usersettings.UserSettings;
-import info.textgrid.rep.shared.ToolLink;
 
 @Controller
-@SessionAttributes("userSettings")
 public class SearchController {
 
   private TgsearchClientService tgsearchClient;
@@ -59,7 +57,7 @@ public class SearchController {
       @RequestParam(name="limit", required=false, defaultValue="10") int limit,
       @RequestParam(name="filter", required=false) List<String> filter,
       @RequestParam(value="mode", defaultValue="list") String mode,
-      @ModelAttribute UserSettings userSettings,
+      @SessionAttribute(required=false, name="userSettings") UserSettings userSettings,
       Locale locale,
       Model model) {
 
@@ -67,7 +65,10 @@ public class SearchController {
 
 //    boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
 
-    boolean sandbox = userSettings.getSandboxEnabled();
+    boolean sandbox = false;
+    if(userSettings != null) {
+      sandbox = userSettings.getSandboxEnabled();
+    }
     String aggregatorSandboxParam = sandbox ? "&sandbox=true" : "";
 
     String realQueryString = query;
@@ -107,6 +108,4 @@ public class SearchController {
     return "search";
 
   }
-
-
 }
diff --git a/src/main/java/info/textgrid/rep/usersettings/UserSettings.java b/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
index 4956e43..9336177 100644
--- a/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
+++ b/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
@@ -6,7 +6,7 @@ public class UserSettings implements Serializable{
 
 	private static final long serialVersionUID = 1786520003840881119L;
 
-	private Boolean sandboxEnabled;
+	private Boolean sandboxEnabled = false;
 
 	public Boolean getSandboxEnabled() {
 		return sandboxEnabled;
-- 
GitLab


From aa8705136feabd6af39d233a82b0831c55c4e2d9 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 01:09:32 +0200
Subject: [PATCH 05/29] a pager for project browse

---
 .../BrowseProjectController.java              |  7 ++--
 .../textgrid/rep/search/SearchController.java |  2 --
 src/main/webapp/WEB-INF/jsp/browse.jsp        | 35 +++++++++++++++++++
 3 files changed, 39 insertions(+), 5 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index 7d26026..0c55799 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -27,6 +27,7 @@ import info.textgrid.rep.markdown.MarkdownRenderService;
 import info.textgrid.rep.service.TgcrudClientService;
 import info.textgrid.rep.service.TgrepConfigurationService;
 import info.textgrid.rep.service.TgsearchClientService;
+import info.textgrid.rep.shared.Pager;
 import info.textgrid.rep.shared.ToolLink;
 import info.textgrid.rep.usersettings.UserSettings;
 
@@ -102,7 +103,7 @@ public class BrowseProjectController {
       @RequestParam(value = "mode", defaultValue = "list") String mode,
       @PathVariable("id") String id,
       @RequestParam(name="start", required=false, defaultValue="0") int start,
-      @RequestParam(name="limit", required=false, defaultValue="20") int limit,
+      @RequestParam(name="limit", required=false, defaultValue="10") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
 
     I18N i18n = i18nProvider.getI18N(locale);
@@ -116,6 +117,7 @@ public class BrowseProjectController {
     model.addAttribute("mode", mode);
 
     Response res = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/toplevel/"+id)
+      .queryParam("start", start)
       .queryParam("limit", limit)
       .queryParam("sandbox", sandbox)
       .request(MediaType.TEXT_XML)
@@ -138,7 +140,6 @@ public class BrowseProjectController {
     }
     */
 
-    /*
     Pager pager = new Pager()
         .setHits(Integer.parseInt(res.getHits()))
         .setLimit(limit)
@@ -147,7 +148,7 @@ public class BrowseProjectController {
     pager.calculatePages();
 
     model.addAttribute("pager", pager);
-*/
+
     model.addAttribute("results", res.getResult());
     model.addAttribute("isProject", true);
     model.addAttribute("project", project);
diff --git a/src/main/java/info/textgrid/rep/search/SearchController.java b/src/main/java/info/textgrid/rep/search/SearchController.java
index 7955b84..533c1b1 100644
--- a/src/main/java/info/textgrid/rep/search/SearchController.java
+++ b/src/main/java/info/textgrid/rep/search/SearchController.java
@@ -63,8 +63,6 @@ public class SearchController {
 
     I18N i18n = i18nProvider.getI18N(locale);
 
-//    boolean sandbox = Utils.userWantsSandbox(PortalUtil.getUserId(renderRequest));
-
     boolean sandbox = false;
     if(userSettings != null) {
       sandbox = userSettings.getSandboxEnabled();
diff --git a/src/main/webapp/WEB-INF/jsp/browse.jsp b/src/main/webapp/WEB-INF/jsp/browse.jsp
index 2067924..fc1e0c8 100644
--- a/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -191,6 +191,34 @@
 
     <c:choose>
       <c:when test="${results != null}">
+
+        <c:if test="${isProject}">
+          <div class="tgrep header_info">
+            Aggregation <span class="tgrep header_count -current">${pager.start + 1}&#8211;${pager.end}</span> ${i18n['of']}
+            <span class="tgrep header_count -total">${pager.hits}</span>
+
+            <div class="tg dropdown" role="group">
+              <a class="tg dropdown_toggle -settings">${i18n['change-result-display']}</a>
+              <ul class="tg dropdown_menu">
+                <li class="tg dropdown_item">
+                  <span class="tg dropdown_heading">${i18n['results-per-page']}</span>
+                  <ul class="tg dropdown_submenu">
+                    <li class="tg dropdown_item  ${limit eq '10' ? '-current' : ''}">
+                      <a href="?query=${query}${filterQueryString}&order=${order}&start=${start}&mode=${mode}&limit=10">10</a>
+                    </li>
+                    <li class="tg dropdown_item ${limit eq '20' ? '-current' : ''}">
+                      <a href="?query=${query}${filterQueryString}&order=${order}&start=${start}&mode=${mode}&limit=20">20</a>
+                    </li>
+                    <li class="tg dropdown_item ${limit eq '50' ? '-current' : ''}">
+                      <a href="?query=${query}${filterQueryString}&order=${order}&start=${start}&mode=${mode}&limit=50">50</a>
+                    </li>
+                  </ul>
+                </li>
+              </ul>
+            </div>
+          </div>
+        </c:if>
+
         <c:if test="${format == 'text/tg.work+xml'}">
           <h1 class="tgrep main_heading">${i18n['editions-for-this-work']}</h1>
         </c:if>
@@ -214,6 +242,13 @@
               </ol>
             </c:otherwise>
           </c:choose>
+
+          <c:if test="${isProject}">
+            <footer class="tgrep footer">
+              <%@ include file="components/pager.jsp" %>
+            </footer>
+          </c:if>
+
         </div>
       </c:when>
 
-- 
GitLab


From 96117d9ef111ce914f7ced472d4b6ff0e1436575 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 10:48:33 +0200
Subject: [PATCH 06/29] only one project listing in menu. avatar in project
 presentation

---
 src/main/sass/_base.sass                        | 3 +++
 src/main/webapp/WEB-INF/jsp/base/navigation.jsp | 2 ++
 src/main/webapp/WEB-INF/jsp/browse.jsp          | 2 ++
 src/main/webapp/WEB-INF/jsp/browseprojects.jsp  | 4 +++-
 4 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/main/sass/_base.sass b/src/main/sass/_base.sass
index 3be8296..f181b97 100644
--- a/src/main/sass/_base.sass
+++ b/src/main/sass/_base.sass
@@ -303,3 +303,6 @@ iframe
 .drunkenowl
 	float: right
 	width: 30%
+
+img.avatar
+	float: right
diff --git a/src/main/webapp/WEB-INF/jsp/base/navigation.jsp b/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
index 69fc23b..d062f47 100644
--- a/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
+++ b/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
@@ -46,9 +46,11 @@
           <li class="" id="layout_18" role="presentation">
             <a aria-labelledby="layout_18" href="/facet/format" role="menuitem" tabindex="">...nach Dateityp</a>
           </li>
+          <!--
           <li class="" id="layout_18" role="presentation">
             <a aria-labelledby="layout_18" href="/facet/project.value" role="menuitem" tabindex="">...nach Projekt</a>
           </li>
+          -->
         </ul>
       </li>
       
diff --git a/src/main/webapp/WEB-INF/jsp/browse.jsp b/src/main/webapp/WEB-INF/jsp/browse.jsp
index fc1e0c8..e66bd34 100644
--- a/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -185,8 +185,10 @@
     <%@ include file="components/path.jsp" %>
     
     <c:if test="${isProject}">
+        <img class="avatar" src="${config.textgridHost}/1.0/digilib/rest/IIIF/${project.portalconfig.avatar}/full/,250/0/native.jpg" alt="${project.name}" title="${project.name}" />
         <h1>${project.name}</h1>
         <p>${project.portalconfig.description} <c:if test="${readme != null}"><a href="#README">[more...]</a></c:if></p>
+        <div class="clearboth"></div>
     </c:if>
 
     <c:choose>
diff --git a/src/main/webapp/WEB-INF/jsp/browseprojects.jsp b/src/main/webapp/WEB-INF/jsp/browseprojects.jsp
index 6686362..c0c0d9b 100644
--- a/src/main/webapp/WEB-INF/jsp/browseprojects.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browseprojects.jsp
@@ -32,7 +32,9 @@
   <main class="tgrep main">
   
     <h1>Projects</h1>
-    <p>Find here a list of projects which published data to the TextGrid Repository</p>
+    <p>Find here a list of projects which published data to the TextGrid Repository.
+    This is a new project presentation page which is still in development.
+    The old version <a href="/facet/project.value">is still available </a>.</p>
   
     <div class="tgrep browse">
     
-- 
GitLab


From e4f06fa882fdd6cf7d3b6df8b2ad6a3c0221b746 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 10:59:41 +0200
Subject: [PATCH 07/29] avatar size in gallery mode to 500px. closes #70

---
 src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp b/src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp
index 2804eef..e76891b 100644
--- a/src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp
+++ b/src/main/webapp/WEB-INF/jsp/components/singleGalleryProject.jsp
@@ -6,7 +6,7 @@
 
 <c:choose>
   <c:when test="${project.portalconfig.avatar != null}">
-    <c:url value="${config.textgridHost}/1.0/digilib/rest/IIIF/${project.portalconfig.avatar}/full/,250/0/native.jpg" var="imgUrl"></c:url>
+    <c:url value="${config.textgridHost}/1.0/digilib/rest/IIIF/${project.portalconfig.avatar}/full/,500/0/native.jpg" var="imgUrl"></c:url>
   </c:when>
   <c:otherwise>
     <c:url context="/" value="/static/images/no_image.svg" var="imgUrl"></c:url>
-- 
GitLab


From b254c2eadabb4f846701d1097fdd15014d64df97 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 11:12:28 +0200
Subject: [PATCH 08/29] sandbox enabled by default

---
 .../info/textgrid/rep/browsefacet/BrowseFacetController.java  | 2 +-
 .../textgrid/rep/browseproject/BrowseProjectController.java   | 2 +-
 src/main/java/info/textgrid/rep/search/SearchController.java  | 2 +-
 .../java/info/textgrid/rep/usersettings/UserSettings.java     | 2 +-
 src/main/webapp/WEB-INF/jsp/browse.jsp                        | 4 +++-
 5 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java b/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
index 80a2587..1a64f61 100644
--- a/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
+++ b/src/main/java/info/textgrid/rep/browsefacet/BrowseFacetController.java
@@ -37,7 +37,7 @@ public class BrowseFacetController {
       @RequestParam(value="limit", required=false, defaultValue="0") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
 
-    boolean sandbox = false;
+    boolean sandbox = true;
     if(userSettings != null) {
       sandbox = userSettings.getSandboxEnabled();
     }
diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index 0c55799..9d56bb4 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -108,7 +108,7 @@ public class BrowseProjectController {
 
     I18N i18n = i18nProvider.getI18N(locale);
 
-    boolean sandbox = false;
+    boolean sandbox = true;
     if(userSettings != null) {
       sandbox = userSettings.getSandboxEnabled();
     }
diff --git a/src/main/java/info/textgrid/rep/search/SearchController.java b/src/main/java/info/textgrid/rep/search/SearchController.java
index 533c1b1..9e12d03 100644
--- a/src/main/java/info/textgrid/rep/search/SearchController.java
+++ b/src/main/java/info/textgrid/rep/search/SearchController.java
@@ -63,7 +63,7 @@ public class SearchController {
 
     I18N i18n = i18nProvider.getI18N(locale);
 
-    boolean sandbox = false;
+    boolean sandbox = true;
     if(userSettings != null) {
       sandbox = userSettings.getSandboxEnabled();
     }
diff --git a/src/main/java/info/textgrid/rep/usersettings/UserSettings.java b/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
index 9336177..44fc792 100644
--- a/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
+++ b/src/main/java/info/textgrid/rep/usersettings/UserSettings.java
@@ -6,7 +6,7 @@ public class UserSettings implements Serializable{
 
 	private static final long serialVersionUID = 1786520003840881119L;
 
-	private Boolean sandboxEnabled = false;
+	private Boolean sandboxEnabled = true;
 
 	public Boolean getSandboxEnabled() {
 		return sandboxEnabled;
diff --git a/src/main/webapp/WEB-INF/jsp/browse.jsp b/src/main/webapp/WEB-INF/jsp/browse.jsp
index e66bd34..b868e36 100644
--- a/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -185,7 +185,9 @@
     <%@ include file="components/path.jsp" %>
     
     <c:if test="${isProject}">
-        <img class="avatar" src="${config.textgridHost}/1.0/digilib/rest/IIIF/${project.portalconfig.avatar}/full/,250/0/native.jpg" alt="${project.name}" title="${project.name}" />
+        <c:if test="${project.portalconfig.avatar != null}">
+          <img class="avatar" src="${config.textgridHost}/1.0/digilib/rest/IIIF/${project.portalconfig.avatar}/full/,250/0/native.jpg" alt="${project.name}" title="${project.name}" />
+        </c:if>
         <h1>${project.name}</h1>
         <p>${project.portalconfig.description} <c:if test="${readme != null}"><a href="#README">[more...]</a></c:if></p>
         <div class="clearboth"></div>
-- 
GitLab


From c4d6754cd600119df37b07aa6a7eb3e8e01ec276 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 11:17:44 +0200
Subject: [PATCH 09/29] limit default to 50 on browse-project

---
 .../textgrid/rep/browseproject/BrowseProjectController.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index 9d56bb4..288fbf5 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -103,7 +103,7 @@ public class BrowseProjectController {
       @RequestParam(value = "mode", defaultValue = "list") String mode,
       @PathVariable("id") String id,
       @RequestParam(name="start", required=false, defaultValue="0") int start,
-      @RequestParam(name="limit", required=false, defaultValue="10") int limit,
+      @RequestParam(name="limit", required=false, defaultValue="50") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
 
     I18N i18n = i18nProvider.getI18N(locale);
-- 
GitLab


From 0cb6082875072c571b40eecf6014ae71d86dcbdb Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 11:45:56 +0200
Subject: [PATCH 10/29] show all revisions, order reverse

---
 .../info/textgrid/rep/browse/BrowseController.java    | 11 +++++++++--
 src/main/webapp/WEB-INF/jsp/browse.jsp                |  3 +++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browse/BrowseController.java b/src/main/java/info/textgrid/rep/browse/BrowseController.java
index 7e95550..4854242 100644
--- a/src/main/java/info/textgrid/rep/browse/BrowseController.java
+++ b/src/main/java/info/textgrid/rep/browse/BrowseController.java
@@ -7,6 +7,7 @@ import java.math.BigInteger;
 import java.net.URLEncoder;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.Comparator;
 import java.util.List;
 import java.util.Locale;
 import java.util.TreeMap;
@@ -309,8 +310,14 @@ public class BrowseController {
     }
 
     if(revisions.getRevision().size() > 0) {
-      TreeMap revmap = new TreeMap<BigInteger, String>();
-
+      // order revisions reverse
+      Comparator<BigInteger> comp = new Comparator<BigInteger>() {
+        @Override
+        public int compare(BigInteger o1, BigInteger o2) {
+          return o2.compareTo(o1);
+        }
+      };
+      TreeMap revmap = new TreeMap<BigInteger, String>(comp);
       for(BigInteger rev : revisions.getRevision()) {
         revmap.put(rev, baseUri + "." + rev);
       }
diff --git a/src/main/webapp/WEB-INF/jsp/browse.jsp b/src/main/webapp/WEB-INF/jsp/browse.jsp
index b868e36..9398177 100644
--- a/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -73,6 +73,9 @@
                 </li>
             </c:forEach>
           </ul>
+          <c:if test="${revisions.size() > 6}">
+            <button class="tgrep sidebar_expand">${i18n['expand']}</button>
+          </c:if>
         </section>
       </c:if>
 
-- 
GitLab


From 3177dd064fea3fbf2c8262040393feac5fa1414e Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 11:52:07 +0200
Subject: [PATCH 11/29] keep viewmode in pager

---
 src/main/webapp/WEB-INF/jsp/components/pager.jsp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/main/webapp/WEB-INF/jsp/components/pager.jsp b/src/main/webapp/WEB-INF/jsp/components/pager.jsp
index 21629d3..7709bac 100644
--- a/src/main/webapp/WEB-INF/jsp/components/pager.jsp
+++ b/src/main/webapp/WEB-INF/jsp/components/pager.jsp
@@ -19,13 +19,13 @@
 
       <c:if test="${pager.start gt 0}">
       <li class="tg pagination_item">
-        <a class="tg pagination_link -first" href="?query=${query}${filterQueryString}&start=0&limit=${pager.limit}&order=${order}" title="${i18n['go-to-first-page']}">
+        <a class="tg pagination_link -first" href="?query=${query}${filterQueryString}&start=0&limit=${pager.limit}&order=${order}&mode=${mode}" title="${i18n['go-to-first-page']}">
           <span class="sr-only">${i18n['first-page']}</span>
         </a>
       </li>
 
       <li class="tg pagination_item">
-        <a class="tg pagination_link -prev" href="?query=${query}${filterQueryString}&start=${pager.start - pager.limit}&limit=${pager.limit}&order=${order}" title="${i18n['go-to-previous-page']}">
+        <a class="tg pagination_link -prev" href="?query=${query}${filterQueryString}&start=${pager.start - pager.limit}&limit=${pager.limit}&order=${order}&mode=${mode}" title="${i18n['go-to-previous-page']}">
           <span class="sr-only">${i18n['previous-page']}</span>
         </a>
       </li>
@@ -37,7 +37,7 @@
 
       <c:if test="${(page - 1) * pager.limit != pager.start}">
         <li class="tg pagination_item">
-          <a class="tg pagination_link" href="?query=${query}${filterQueryString}&start=${(page - 1) * pager.limit}&limit=${pager.limit}&order=${order}" title="${i18n['go-to-page']} ${page}">
+          <a class="tg pagination_link" href="?query=${query}${filterQueryString}&start=${(page - 1) * pager.limit}&limit=${pager.limit}&order=${order}&mode=${mode}" title="${i18n['go-to-page']} ${page}">
             <span class="sr-only">${i18n['page']}</span> ${page}
           </a>
         </li>
@@ -45,7 +45,7 @@
 
       <c:if test="${(page - 1) * pager.limit == pager.start}">
         <li class="tg pagination_item -current">
-          <a class="tg pagination_link" href="?query=${query}${filterQueryString}&start=${(page - 1) * limit}&limit=${pager.limit}&order=${order}" title="${i18n['go-to-page']} ${page}">
+          <a class="tg pagination_link" href="?query=${query}${filterQueryString}&start=${(page - 1) * limit}&limit=${pager.limit}&order=${order}&mode=${mode}" title="${i18n['go-to-page']} ${page}">
             <span class="sr-only">${i18n['page']}</span> ${page}
           </a>
         </li>
@@ -56,12 +56,12 @@
     <!-- next button -->
     <c:if test="${(pager.start + pager.limit) lt pager.hits }">
       <li class="tg pagination_item">
-        <a class="tg pagination_link -next" href="?query=${query}${filterQueryString}&start=${pager.start + pager.limit}&limit=${pager.limit}&order=${order}" title="${i18n['go-to-next-page']}">
+        <a class="tg pagination_link -next" href="?query=${query}${filterQueryString}&start=${pager.start + pager.limit}&limit=${pager.limit}&order=${order}&mode=${mode}" title="${i18n['go-to-next-page']}">
           <span class="sr-only">${i18n['next-page']}</span>
         </a>
       </li>
       <li class="tg pagination_item">
-        <a class="tg pagination_link -last" href="?query=${query}${filterQueryString}&start=${(pager.totalPages-1) * pager.limit}&limit=${pager.limit}&order=${order}" title="${i18n['go-to-last-page']}">
+        <a class="tg pagination_link -last" href="?query=${query}${filterQueryString}&start=${(pager.totalPages-1) * pager.limit}&limit=${pager.limit}&order=${order}&mode=${mode}" title="${i18n['go-to-last-page']}">
           <span class="sr-only">${i18n['last-page']}</span>
         </a>
       </li>
-- 
GitLab


From 9fd71ebf28e68eae7f860d42a445fac246a2160f Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 15:03:33 +0200
Subject: [PATCH 12/29] add a facet for edition.lang

---
 .../java/info/textgrid/rep/service/TgsearchClientService.java    | 1 +
 src/main/resources/i18n/Language_de.properties                   | 1 +
 src/main/resources/i18n/Language_en.properties                   | 1 +
 3 files changed, 3 insertions(+)

diff --git a/src/main/java/info/textgrid/rep/service/TgsearchClientService.java b/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
index 7b57c4e..dbcf01b 100644
--- a/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
+++ b/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
@@ -32,6 +32,7 @@ public class TgsearchClientService {
   }
 
   private List<String> facets = Arrays.asList(new String[] {
+      "edition.language",
       "edition.agent.value",
       "work.genre",
       "format",
diff --git a/src/main/resources/i18n/Language_de.properties b/src/main/resources/i18n/Language_de.properties
index ace3298..f76f662 100644
--- a/src/main/resources/i18n/Language_de.properties
+++ b/src/main/resources/i18n/Language_de.properties
@@ -20,6 +20,7 @@ download-text-only-zip=ZIP / nur Text
 edition.agent.value=Autor
 work.genre=Genre
 project.value=Projekt
+edition.language=Sprache
 
 # facet-group names & singleListResult.jsp
 format=Dateityp
diff --git a/src/main/resources/i18n/Language_en.properties b/src/main/resources/i18n/Language_en.properties
index 242bf33..bef00cd 100644
--- a/src/main/resources/i18n/Language_en.properties
+++ b/src/main/resources/i18n/Language_en.properties
@@ -20,6 +20,7 @@ download-text-only-zip=ZIP / text only
 edition.agent.value=Author
 work.genre=Genre
 project.value=Project
+edition.language=Language
 
 # facet-group names & singleListResult.jsp
 format=File Type
-- 
GitLab


From 1dc9bc742e7acc19dfd2b8ee42aca6fff7f2442b Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 15:21:37 +0200
Subject: [PATCH 13/29] search this project link

---
 .../textgrid/rep/browseproject/BrowseProjectController.java   | 4 ++++
 src/main/resources/i18n/Language_de.properties                | 3 +++
 src/main/resources/i18n/Language_en.properties                | 3 +++
 3 files changed, 10 insertions(+)

diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index 288fbf5..c85e24a 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -169,6 +169,10 @@ public class BrowseProjectController {
         mode.equals("gallery")));
     model.addAttribute("viewmodes", viewmodes);
 
+    List<ToolLink> tools = new ArrayList<ToolLink>();
+    tools.add(new ToolLink(i18n.get("search-project"), "/search?filter=project.id:" + id, false));
+    model.addAttribute("tools", tools);
+
     return "browse";
   }
 
diff --git a/src/main/resources/i18n/Language_de.properties b/src/main/resources/i18n/Language_de.properties
index f76f662..1227fbe 100644
--- a/src/main/resources/i18n/Language_de.properties
+++ b/src/main/resources/i18n/Language_de.properties
@@ -127,3 +127,6 @@ privpol=Datenschutzerklärung
 documentation=Dokumentation
 content=Inhalte
 navigation=Navigation
+
+# projects
+search-project=In diesem Projekt suchen
diff --git a/src/main/resources/i18n/Language_en.properties b/src/main/resources/i18n/Language_en.properties
index bef00cd..bf0c1db 100644
--- a/src/main/resources/i18n/Language_en.properties
+++ b/src/main/resources/i18n/Language_en.properties
@@ -128,3 +128,6 @@ help=Help
 documentation=Documentation
 content=Content
 navigation=Navigation
+
+# projects
+search-project=Search within this project
-- 
GitLab


From a134d4ae52190ff5f6739211a403219358ccb771 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 1 Jul 2020 16:28:03 +0200
Subject: [PATCH 14/29] last sandbox-flag found and defaulted to true

---
 .../textgrid/rep/browseproject/BrowseProjectController.java     | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index c85e24a..8bfd520 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -67,7 +67,7 @@ public class BrowseProjectController {
       @RequestParam(value="limit", required=false, defaultValue="0") int limit,
       @RequestParam(value="order", required=false, defaultValue="count.desc") String order) throws IOException {
 
-    boolean sandbox = false;
+    boolean sandbox = true;
     if(userSettings != null) {
       sandbox = userSettings.getSandboxEnabled();
     }
-- 
GitLab


From 876a64b0d2641d8173804a22697192727d4d2421 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Fri, 3 Jul 2020 12:01:20 +0200
Subject: [PATCH 15/29] limit default to 20. show current page and limit -
 closes #72

---
 .../rep/browseproject/BrowseProjectController.java        | 8 ++++----
 .../java/info/textgrid/rep/search/SearchController.java   | 2 +-
 src/main/sass/blocks/_tg-pagination.sass                  | 5 +++++
 src/main/webapp/WEB-INF/jsp/components/pager.jsp          | 1 -
 4 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index 8bfd520..69c3b70 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -99,12 +99,11 @@ public class BrowseProjectController {
   public String projectById(
       Locale locale,
       Model model,
+      @PathVariable("id") String id,
       @SessionAttribute(required=false, name="userSettings") UserSettings userSettings,
       @RequestParam(value = "mode", defaultValue = "list") String mode,
-      @PathVariable("id") String id,
       @RequestParam(name="start", required=false, defaultValue="0") int start,
-      @RequestParam(name="limit", required=false, defaultValue="50") int limit,
-      @RequestParam(value="order", required=false, defaultValue="count.desc") String order) {
+      @RequestParam(name="limit", required=false, defaultValue="20") int limit) {
 
     I18N i18n = i18nProvider.getI18N(locale);
 
@@ -148,7 +147,8 @@ public class BrowseProjectController {
     pager.calculatePages();
 
     model.addAttribute("pager", pager);
-
+    model.addAttribute("start", start);
+    model.addAttribute("limit", limit);
     model.addAttribute("results", res.getResult());
     model.addAttribute("isProject", true);
     model.addAttribute("project", project);
diff --git a/src/main/java/info/textgrid/rep/search/SearchController.java b/src/main/java/info/textgrid/rep/search/SearchController.java
index 9e12d03..4943de5 100644
--- a/src/main/java/info/textgrid/rep/search/SearchController.java
+++ b/src/main/java/info/textgrid/rep/search/SearchController.java
@@ -54,7 +54,7 @@ public class SearchController {
       @RequestParam(name="query", required=false, defaultValue="") String query,
       @RequestParam(name="order", required=false, defaultValue="relevance") String order,
       @RequestParam(name="start", required=false, defaultValue="0") int start,
-      @RequestParam(name="limit", required=false, defaultValue="10") int limit,
+      @RequestParam(name="limit", required=false, defaultValue="20") int limit,
       @RequestParam(name="filter", required=false) List<String> filter,
       @RequestParam(value="mode", defaultValue="list") String mode,
       @SessionAttribute(required=false, name="userSettings") UserSettings userSettings,
diff --git a/src/main/sass/blocks/_tg-pagination.sass b/src/main/sass/blocks/_tg-pagination.sass
index 022f6ab..bda3b19 100644
--- a/src/main/sass/blocks/_tg-pagination.sass
+++ b/src/main/sass/blocks/_tg-pagination.sass
@@ -24,3 +24,8 @@
 
 	&.-last
 		+icon('step-forward', false)
+
+.tg.pagination_item
+	&.-current > a
+		background: $pale-color
+		color: $text-color
diff --git a/src/main/webapp/WEB-INF/jsp/components/pager.jsp b/src/main/webapp/WEB-INF/jsp/components/pager.jsp
index 7709bac..d8e9b90 100644
--- a/src/main/webapp/WEB-INF/jsp/components/pager.jsp
+++ b/src/main/webapp/WEB-INF/jsp/components/pager.jsp
@@ -34,7 +34,6 @@
 
     <!-- pages -->
     <c:forEach items="${pager.pages}" var="page">
-
       <c:if test="${(page - 1) * pager.limit != pager.start}">
         <li class="tg pagination_item">
           <a class="tg pagination_link" href="?query=${query}${filterQueryString}&start=${(page - 1) * pager.limit}&limit=${pager.limit}&order=${order}&mode=${mode}" title="${i18n['go-to-page']} ${page}">
-- 
GitLab


From 6f4e1ba7e8e1f80de1d47ff631cd39b1e55c415d Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Fri, 3 Jul 2020 13:24:07 +0200
Subject: [PATCH 16/29] fix unit test with new default limit

---
 .../textgrid/rep/search/SearchControllerTest.java    | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/test/java/info/textgrid/rep/search/SearchControllerTest.java b/src/test/java/info/textgrid/rep/search/SearchControllerTest.java
index 567a9cb..ea97ded 100644
--- a/src/test/java/info/textgrid/rep/search/SearchControllerTest.java
+++ b/src/test/java/info/textgrid/rep/search/SearchControllerTest.java
@@ -76,21 +76,21 @@ public class SearchControllerTest {
           .andExpect(status().isOk())
           .andExpect(view().name("search"))
           .andExpect(forwardedUrl("/WEB-INF/jsp/search.jsp"))
-          // should be 10 results because of default limit
-          .andExpect(model().attribute("results", hasSize(10)));
+          // should be 20 results because of default limit
+          .andExpect(model().attribute("results", hasSize(20)));
   }
 
   @Test
-  public void getAliceLimit20() throws Exception {
+  public void getAliceLimit30() throws Exception {
       mvc.perform(MockMvcRequestBuilders.get("/search")
           .queryParam("query", "alice")
-          .queryParam("limit", "20")
+          .queryParam("limit", "30")
           .accept(MediaType.TEXT_HTML))
           .andExpect(status().isOk())
           .andExpect(view().name("search"))
           .andExpect(forwardedUrl("/WEB-INF/jsp/search.jsp"))
-          // should be 20 results because of limit
-          .andExpect(model().attribute("results", hasSize(20)));
+          // should be 30 results because of limit
+          .andExpect(model().attribute("results", hasSize(30)));
   }
 
   @Test
-- 
GitLab


From 86a8e2bd8a460c896cfaab4327da223cb83a25d6 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Mon, 6 Jul 2020 15:18:16 +0200
Subject: [PATCH 17/29] use project id for filtering and title from
 portalconfig. closes #6 and #73

---
 .../BrowseProjectController.java              |  8 +----
 .../textgrid/rep/search/SearchController.java |  4 ++-
 .../rep/service/TgsearchClientService.java    | 29 ++++++++++++++++++-
 .../resources/i18n/Language_de.properties     |  1 +
 .../resources/i18n/Language_en.properties     |  1 +
 src/main/webapp/WEB-INF/jsp/search.jsp        | 24 +++++++++++++--
 6 files changed, 55 insertions(+), 12 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
index 69c3b70..c36e6ff 100644
--- a/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
+++ b/src/main/java/info/textgrid/rep/browseproject/BrowseProjectController.java
@@ -13,7 +13,6 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.PathVariable;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.SessionAttribute;
@@ -77,12 +76,7 @@ public class BrowseProjectController {
     // common variables for browse-root aggregations and browse single items
     model.addAttribute("mode", mode);
 
-    ProjectsResponse pr = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/projects")
-      .queryParam("sandbox", sandbox)
-      .register(JacksonJsonProvider.class)
-      .request(MediaType.APPLICATION_JSON)
-      .get()
-      .readEntity(ProjectsResponse.class);
+    ProjectsResponse pr = this.tgsearchClient.getProjects(sandbox);
 
     List<ToolLink> viewmodes = new ArrayList<ToolLink>();
     viewmodes
diff --git a/src/main/java/info/textgrid/rep/search/SearchController.java b/src/main/java/info/textgrid/rep/search/SearchController.java
index 4943de5..a40d4fd 100644
--- a/src/main/java/info/textgrid/rep/search/SearchController.java
+++ b/src/main/java/info/textgrid/rep/search/SearchController.java
@@ -90,9 +90,9 @@ public class SearchController {
     viewmodes.add(new ToolLink(i18n.get("gallery"), Utils.searchUrl("gallery", query, filter, order, start, limit), mode.equals("gallery")));
     model.addAttribute("viewmodes", viewmodes);
     model.addAttribute("mode", mode);
-
     model.addAttribute("results", res.getResult());
     model.addAttribute("facetResponse", res.getFacetResponse());
+    model.addAttribute("projectmap", tgsearchClient.getProjectMap(sandbox));
     model.addAttribute("query", HtmlUtils.htmlEscape(query));
     model.addAttribute("order", order);
     model.addAttribute("start", start);
@@ -106,4 +106,6 @@ public class SearchController {
     return "search";
 
   }
+
+
 }
diff --git a/src/main/java/info/textgrid/rep/service/TgsearchClientService.java b/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
index dbcf01b..bf118ef 100644
--- a/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
+++ b/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
@@ -1,17 +1,24 @@
 package info.textgrid.rep.service;
 
 import java.util.Arrays;
+import java.util.HashMap;
 import java.util.List;
+import javax.ws.rs.client.Client;
+import javax.ws.rs.client.ClientBuilder;
+import javax.ws.rs.core.MediaType;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
+import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;
 import info.textgrid.clients.SearchClient;
 import info.textgrid.namespaces.middleware.tgsearch.FacetResponse;
 import info.textgrid.namespaces.middleware.tgsearch.Response;
 import info.textgrid.namespaces.middleware.tgsearch.ResultType;
 import info.textgrid.namespaces.middleware.tgsearch.Revisions;
+import info.textgrid.namespaces.middleware.tgsearch.portal.Project;
+import info.textgrid.namespaces.middleware.tgsearch.portal.ProjectsResponse;
 
 
 @Service
@@ -36,7 +43,7 @@ public class TgsearchClientService {
       "edition.agent.value",
       "work.genre",
       "format",
-      "project.value"
+      "project.id"
   });
 
   private void setupClient() {
@@ -101,6 +108,26 @@ public class TgsearchClientService {
 
   }
 
+  public HashMap<String, String> getProjectMap(boolean sandbox) {
+    HashMap<String, String> projects = new HashMap<String, String>();
+    ProjectsResponse pr = getProjects(sandbox);
+    for (Project p : pr.getProjects()) {
+      projects.put(p.getId(), p.getName());
+    }
+    return projects;
+  }
+
+  public ProjectsResponse getProjects(boolean sandbox) {
+    Client client = ClientBuilder.newClient(); // put this to constructor
+    ProjectsResponse pr = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/projects")
+        .queryParam("sandbox", sandbox)
+        .register(JacksonJsonProvider.class)
+        .request(MediaType.APPLICATION_JSON)
+        .get()
+        .readEntity(ProjectsResponse.class);
+    return pr;
+  }
+
   public Revisions listRevisions(String id) {
     return searchClient.infoQuery().listRevisions(id);
   }
diff --git a/src/main/resources/i18n/Language_de.properties b/src/main/resources/i18n/Language_de.properties
index 1227fbe..6bd36bb 100644
--- a/src/main/resources/i18n/Language_de.properties
+++ b/src/main/resources/i18n/Language_de.properties
@@ -20,6 +20,7 @@ download-text-only-zip=ZIP / nur Text
 edition.agent.value=Autor
 work.genre=Genre
 project.value=Projekt
+project.id=Projekt
 edition.language=Sprache
 
 # facet-group names & singleListResult.jsp
diff --git a/src/main/resources/i18n/Language_en.properties b/src/main/resources/i18n/Language_en.properties
index bf0c1db..f7fb48b 100644
--- a/src/main/resources/i18n/Language_en.properties
+++ b/src/main/resources/i18n/Language_en.properties
@@ -20,6 +20,7 @@ download-text-only-zip=ZIP / text only
 edition.agent.value=Author
 work.genre=Genre
 project.value=Project
+project.id=Project
 edition.language=Language
 
 # facet-group names & singleListResult.jsp
diff --git a/src/main/webapp/WEB-INF/jsp/search.jsp b/src/main/webapp/WEB-INF/jsp/search.jsp
index 5c05e3a..bf3e1ea 100644
--- a/src/main/webapp/WEB-INF/jsp/search.jsp
+++ b/src/main/webapp/WEB-INF/jsp/search.jsp
@@ -55,7 +55,15 @@
                       href="?query=${query}&order=${order}&limit=${limit}&mode=${mode}${fn:replace(filterQueryString, '&filter='.concat(afArray[0]).concat('%3A').concat(utils:urlencode(afArray[1])) , '')}">
                     <span class="sr-only">${i18n['remove-filter']}</span>
                   </a>
-                  <strong>${i18n[afArray[0]]}</strong>: ${afArray[1]}
+                  <c:choose>
+                    <c:when test="${afArray[0] == 'project.id'}">
+                      <c:set var="facetvalue" value="${projectmap[afArray[1]]}" />
+                    </c:when>
+                    <c:otherwise>
+                      <c:set var="facetvalue" value="${afArray[1]}" />
+                    </c:otherwise>
+                </c:choose>
+                  <strong>${i18n[afArray[0]]}</strong>: ${facetvalue}
                 </li>
               </c:forEach>
             </ul>
@@ -71,15 +79,25 @@
             <h3 class="tgrep sidebar_subheading">${i18n[facetGroup.name]}</h3>
             <ul class="tgrep sidebar_list">
               <c:forEach items="${facetGroup.facet}" var="facet">
+
+                <c:choose>
+                  <c:when test="${facetGroup.name == 'project.id'}">
+                    <c:set var="facetvalue" value="${projectmap[facet.value]}" />
+                  </c:when>
+                  <c:otherwise>
+                    <c:set var="facetvalue" value="${facet.value}" />
+                  </c:otherwise>
+                </c:choose>
+
                 <li class="tgrep sidebar_item">
-                  <c:set var="filtermatch" value="${facetGroup.name}:${facet.value}" />
+                  <c:set var="filtermatch" value="${facetGroup.name}:${facetvalue}" />
                   <c:choose>
                     <c:when test="${not empty filter and filter.contains(filtermatch)}">
                       ${facet.value}
                     </c:when>
                     <c:otherwise>
                       <a href="?query=${query}&order=${order}&limit=${limit}&mode=${mode}&filter=${facetGroup.name}:${utils:urlencode(facet.value)}${filterQueryString}"
-                      class="tgrep sidebar_link">${facet.value}</a>
+                      class="tgrep sidebar_link">${facetvalue}</a>
                     </c:otherwise>
                   </c:choose>
                   <span class="tgrep sidebar_count">${facet.count}</span>
-- 
GitLab


From 24ca45b44044505112eba9fb310ce86b1372f843 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Mon, 6 Jul 2020 15:48:36 +0200
Subject: [PATCH 18/29] tests need to run against esx1 for this branch

---
 src/main/resources/application.properties | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 95b16a0..a823608 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -7,7 +7,7 @@ tgrep.ssl = false
 server.servlet.session.cookie.secure: ${tgrep.ssl}
 
 # textgrid defaults
-textgrid.host: https://textgridlab.org
+textgrid.host: https://dev.textgridlab.org
 tgsearch.url: ${textgrid.host}/1.0/tgsearch-public
 handle.host: https://hdl.handle.net
 
@@ -24,4 +24,4 @@ lang.default: en
 tgsearch.query.facetlimit = 10000
 #tgsearch.query.facetlimit = 10
 
-sentry.enabled = false
\ No newline at end of file
+sentry.enabled = false
-- 
GitLab


From 0f1e98d8b7515f217922836a6dd9ce49a60e2c50 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 15 Sep 2021 16:00:36 +0200
Subject: [PATCH 19/29] put project root on base path, related to #102

---
 build.gradle                                    | 2 +-
 src/main/webapp/WEB-INF/jsp/components/path.jsp | 5 +++++
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index b4f5cfb..b0e3498 100644
--- a/build.gradle
+++ b/build.gradle
@@ -43,7 +43,7 @@ dependencies {
     implementation 'com.atlassian.commonmark:commonmark-ext-heading-anchor:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-yaml-front-matter:0.14.0'
-    implementation 'info.textgrid.middleware.clients:textgrid-clients:3.4.3.1-ES6-SNAPSHOT'
+    implementation 'info.textgrid.middleware.clients:textgrid-clients:3.9.2-ES6-SNAPSHOT'
     developmentOnly("org.springframework.boot:spring-boot-devtools")
     testImplementation('org.springframework.boot:spring-boot-starter-test') {
         exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
diff --git a/src/main/webapp/WEB-INF/jsp/components/path.jsp b/src/main/webapp/WEB-INF/jsp/components/path.jsp
index 6516681..656996b 100644
--- a/src/main/webapp/WEB-INF/jsp/components/path.jsp
+++ b/src/main/webapp/WEB-INF/jsp/components/path.jsp
@@ -6,6 +6,11 @@
 </c:if>
 
 <ul class="tgrep breadcrumbs">
+  <li class="tgrep breadcrumbs_item">
+    <a class="tgrep breadcrumbs_link" href="/project/${result.object.generic.generated.project.id}">
+      ${result.object.generic.generated.project.value}
+    </a>
+  </li>
   <c:forEach items="${result.pathResponse.pathGroup}" var="pathGroup">
     <c:forEach items="${pathGroup.path}" var="path">
       <c:forEach items="${path.entry}" var="pathEntry">
-- 
GitLab


From 5e41a461ed803c95ed5986a24bac0fb89a526eaf Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Fri, 17 Sep 2021 23:14:43 +0200
Subject: [PATCH 20/29] bulletpoints in landing page. related to #106

---
 src/main/webapp/WEB-INF/jsp/browse.jsp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/main/webapp/WEB-INF/jsp/browse.jsp b/src/main/webapp/WEB-INF/jsp/browse.jsp
index 2fe8cfe..17237f7 100644
--- a/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -374,7 +374,9 @@
 
     <c:if test="${not empty readme}">
     <hr id="README">
-      ${readme}
+      <div class="journal-content-article markdown-doc">
+        ${readme}
+      </div>
     </c:if>
 
     <c:if test="${not isProject}">
-- 
GitLab


From ddef25efd3992ea812ef0618788d9a9864e1ec99 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Thu, 23 Sep 2021 21:17:10 +0200
Subject: [PATCH 21/29] project name from config in path and citation link.
 closes #102

---
 .../info/textgrid/rep/browse/BrowseController.java     |  1 +
 .../java/info/textgrid/rep/shelf/ShelfController.java  |  1 +
 src/main/webapp/WEB-INF/jsp/components/citation.jsp    | 10 +++++-----
 src/main/webapp/WEB-INF/jsp/components/path.jsp        |  2 +-
 4 files changed, 8 insertions(+), 6 deletions(-)

diff --git a/src/main/java/info/textgrid/rep/browse/BrowseController.java b/src/main/java/info/textgrid/rep/browse/BrowseController.java
index 8a05f33..829bbc8 100644
--- a/src/main/java/info/textgrid/rep/browse/BrowseController.java
+++ b/src/main/java/info/textgrid/rep/browse/BrowseController.java
@@ -110,6 +110,7 @@ public class BrowseController {
 
     // for path, todo: create a tagfile for path
     model.addAttribute("result", metadata);
+    model.addAttribute("projectmap", tgsearchClient.getProjectMap(true));
 
     String format = metadata.getObject().getGeneric().getProvided().getFormat();
     model.addAttribute("format", format);
diff --git a/src/main/java/info/textgrid/rep/shelf/ShelfController.java b/src/main/java/info/textgrid/rep/shelf/ShelfController.java
index d051a5e..ee36d48 100644
--- a/src/main/java/info/textgrid/rep/shelf/ShelfController.java
+++ b/src/main/java/info/textgrid/rep/shelf/ShelfController.java
@@ -65,6 +65,7 @@ public class ShelfController {
 
     model.addAttribute("results", results);
     model.addAttribute("shelfItemString", shelf.getItemsAsString());
+    model.addAttribute("projectmap", tgsearchClientService.getProjectMap(true));
 
     return "shelf";
 
diff --git a/src/main/webapp/WEB-INF/jsp/components/citation.jsp b/src/main/webapp/WEB-INF/jsp/components/citation.jsp
index efc99ec..ee2395d 100644
--- a/src/main/webapp/WEB-INF/jsp/components/citation.jsp
+++ b/src/main/webapp/WEB-INF/jsp/components/citation.jsp
@@ -6,7 +6,7 @@
     <c:when test="${format == 'text/tg.edition+tg.aggregation+xml'}">
         <dl>
             <dt>${i18n['edition-citation-heading']}</dt>
-            <dd>TextGrid Repository (${fn:substring(metadata.object.generic.generated.issued, 0, 4)}). ${metadata.object.edition.agent[0].value}. ${metadata.object.generic.provided.title[0]}. ${metadata.object.generic.generated.project.value}.
+            <dd>TextGrid Repository (${fn:substring(metadata.object.generic.generated.issued, 0, 4)}). ${metadata.object.edition.agent[0].value}. ${metadata.object.generic.provided.title[0]}. ${projectmap[metadata.object.generic.generated.project.id]}.
               <a href="${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}">
                 ${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}
               </a>
@@ -17,7 +17,7 @@
     <c:when test="${format == 'text/tg.collection+tg.aggregation+xml'}">
         <dl>
             <dt>${i18n['collection-citation-heading']}</dt>
-            <dd>TextGrid Repository (${fn:substring(metadata.object.generic.generated.issued, 0, 4)}). ${metadata.object.generic.provided.title[0]}. ${metadata.object.generic.generated.project.value}. ${metadata.object.collection.collector[0].value}.
+            <dd>TextGrid Repository (${fn:substring(metadata.object.generic.generated.issued, 0, 4)}). ${metadata.object.generic.provided.title[0]}. ${projectmap[metadata.object.generic.generated.project.id]}. ${metadata.object.collection.collector[0].value}.
               <a href="${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}">
                 ${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}
               </a>
@@ -36,7 +36,7 @@
                       </c:forEach>
                   </c:forEach>
               </c:forEach>
-              ${metadata.object.generic.provided.title[0]}. ${metadata.object.generic.generated.project.value}. ${metadata.object.item.rightsHolder[0].value}.
+              ${metadata.object.generic.provided.title[0]}. ${projectmap[metadata.object.generic.generated.project.id]}. ${metadata.object.item.rightsHolder[0].value}.
               <a href="${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}">
                 ${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}
               </a>
@@ -47,7 +47,7 @@
     <c:when test="${format == 'text/tg.work+xml'}">
         <dl>
             <dt>${i18n['work-citation-heading']}</dt>
-            <dd>TextGrid Repository (${fn:substring(metadata.object.generic.generated.issued, 0, 4)}). ${metadata.object.work.agent[0].value}. ${metadata.object.generic.provided.title[0]}. ${metadata.object.generic.generated.project.value}.
+            <dd>TextGrid Repository (${fn:substring(metadata.object.generic.generated.issued, 0, 4)}). ${metadata.object.work.agent[0].value}. ${metadata.object.generic.provided.title[0]}. ${projectmap[metadata.object.generic.generated.project.id]}..
               <a href="${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}">
                 ${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}
               </a>
@@ -66,7 +66,7 @@
                       </c:forEach>
                   </c:forEach>
               </c:forEach>
-              ${metadata.object.generic.provided.title[0]}. ${metadata.object.generic.generated.project.value}. ${metadata.object.item.rightsHolder[0].value}.
+              ${metadata.object.generic.provided.title[0]}. ${projectmap[metadata.object.generic.generated.project.id]}. ${metadata.object.item.rightsHolder[0].value}.
               <a href="${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}">
                 ${config.handleHost}/${fn:substringAfter(metadata.object.generic.generated.pid[0].value, 'hdl:')}
               </a>
diff --git a/src/main/webapp/WEB-INF/jsp/components/path.jsp b/src/main/webapp/WEB-INF/jsp/components/path.jsp
index 656996b..d0f2334 100644
--- a/src/main/webapp/WEB-INF/jsp/components/path.jsp
+++ b/src/main/webapp/WEB-INF/jsp/components/path.jsp
@@ -8,7 +8,7 @@
 <ul class="tgrep breadcrumbs">
   <li class="tgrep breadcrumbs_item">
     <a class="tgrep breadcrumbs_link" href="/project/${result.object.generic.generated.project.id}">
-      ${result.object.generic.generated.project.value}
+      ${projectmap[result.object.generic.generated.project.id]}
     </a>
   </li>
   <c:forEach items="${result.pathResponse.pathGroup}" var="pathGroup">
-- 
GitLab


From 5dd86f08d5be90ed529e31ca29bbb621100c9f60 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Tue, 28 Sep 2021 22:20:33 +0200
Subject: [PATCH 22/29] max-width for avatar img. closes #113

---
 src/main/sass/_base.sass | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/main/sass/_base.sass b/src/main/sass/_base.sass
index 8ac5daf..e090cf9 100644
--- a/src/main/sass/_base.sass
+++ b/src/main/sass/_base.sass
@@ -309,6 +309,7 @@ iframe
 
 img.avatar
 	float: right
+	max-width: 50%
 
 /* override .tgrep ul style */
 .journal-content-article.markdown-doc
-- 
GitLab


From 7965ec03de8c709e136c23d36c163ccd81ccb431 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Tue, 28 Sep 2021 22:53:45 +0200
Subject: [PATCH 23/29] link to work from edition. related to #109

---
 src/main/resources/i18n/Language_de.properties | 1 +
 src/main/resources/i18n/Language_en.properties | 1 +
 src/main/webapp/WEB-INF/jsp/browse.jsp         | 4 ++++
 3 files changed, 6 insertions(+)

diff --git a/src/main/resources/i18n/Language_de.properties b/src/main/resources/i18n/Language_de.properties
index 2fa4232..4636800 100644
--- a/src/main/resources/i18n/Language_de.properties
+++ b/src/main/resources/i18n/Language_de.properties
@@ -99,6 +99,7 @@ slow-transform-pt2=Sekunden abgeschlossen werden konnte. Die Ursache ist sehr wa
 slow-transform-pt3=Sie können nun entweder den Transformationsservice direkt aufrufen oder das originale XML-Dokument herunterladen.
 download-xml=XML-Dokument herunterladen
 open-aggregator=Transformationsservice aufrufen
+related-work=Zugehöriges Werk
 
 #usersettings.jsp
 usersettings=Persönliche Einstellungen
diff --git a/src/main/resources/i18n/Language_en.properties b/src/main/resources/i18n/Language_en.properties
index 5d36f82..7b7b2cc 100644
--- a/src/main/resources/i18n/Language_en.properties
+++ b/src/main/resources/i18n/Language_en.properties
@@ -99,6 +99,7 @@ slow-transform-pt2=seconds. This is very probably caused by the length or the co
 slow-transform-pt3=You could try to open the transformation service directly or download the raw XML file.
 download-xml=Download XML
 open-aggregator=Open transformation service
+related-work=Related Work
 
 #usersettings.jsp
 usersettings=Personal Settings
diff --git a/src/main/webapp/WEB-INF/jsp/browse.jsp b/src/main/webapp/WEB-INF/jsp/browse.jsp
index 17237f7..37420a8 100644
--- a/src/main/webapp/WEB-INF/jsp/browse.jsp
+++ b/src/main/webapp/WEB-INF/jsp/browse.jsp
@@ -45,6 +45,10 @@
           <dl>
             <dt>${i18n['format']}</dt><dd>${metadata.object.generic.provided.format}</dd>
 
+            <c:if test="${not empty metadata.object.edition.isEditionOf}">
+            <dt>${i18n['related-work']}</dt><dd><a href="/browse/${metadata.object.edition.isEditionOf}">${metadata.object.edition.isEditionOf}</a></dd>
+            </c:if>
+
             <!-- show author when available, first agent otherwise -->
             <%@ include file="components/authorAndAgents.jsp" %>
 
-- 
GitLab


From 24cad530c448083515144aa3e9685605a4a69a0a Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Tue, 28 Sep 2021 23:20:12 +0200
Subject: [PATCH 24/29] only put projectroot in path if there are path entries.
 closes #110

---
 src/main/webapp/WEB-INF/jsp/components/path.jsp | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/main/webapp/WEB-INF/jsp/components/path.jsp b/src/main/webapp/WEB-INF/jsp/components/path.jsp
index d0f2334..034a06b 100644
--- a/src/main/webapp/WEB-INF/jsp/components/path.jsp
+++ b/src/main/webapp/WEB-INF/jsp/components/path.jsp
@@ -6,11 +6,13 @@
 </c:if>
 
 <ul class="tgrep breadcrumbs">
-  <li class="tgrep breadcrumbs_item">
-    <a class="tgrep breadcrumbs_link" href="/project/${result.object.generic.generated.project.id}">
-      ${projectmap[result.object.generic.generated.project.id]}
-    </a>
-  </li>
+  <c:if test="${not empty result.pathResponse.pathGroup}">
+    <li class="tgrep breadcrumbs_item">
+      <a class="tgrep breadcrumbs_link" href="/project/${result.object.generic.generated.project.id}">
+        ${projectmap[result.object.generic.generated.project.id]}
+      </a>
+    </li>
+  </c:if>
   <c:forEach items="${result.pathResponse.pathGroup}" var="pathGroup">
     <c:forEach items="${pathGroup.path}" var="path">
       <c:forEach items="${path.entry}" var="pathEntry">
-- 
GitLab


From eae0b4ed1f4955563a92232144cb875dca3f8398 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Thu, 30 Sep 2021 18:21:07 +0200
Subject: [PATCH 25/29] textgrid-clients 4.0.1

---
 build.gradle | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/build.gradle b/build.gradle
index b86718b..14cb38b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -43,7 +43,7 @@ dependencies {
     implementation 'com.atlassian.commonmark:commonmark-ext-heading-anchor:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-yaml-front-matter:0.14.0'
-    implementation 'info.textgrid.middleware.clients:textgrid-clients:3.9.2-ES6-SNAPSHOT'
+    implementation 'info.textgrid.middleware.clients:textgrid-clients:4.0.1'
     implementation 'jakarta.xml.ws:jakarta.xml.ws-api:2.3.3'
     developmentOnly("org.springframework.boot:spring-boot-devtools")
     testImplementation('org.springframework.boot:spring-boot-starter-test') {
-- 
GitLab


From c9408cd178a733d3c712a530adc2af5e7e4a0956 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Thu, 30 Sep 2021 18:24:18 +0200
Subject: [PATCH 26/29] close comment in nav.jsp

---
 src/main/webapp/WEB-INF/jsp/base/navigation.jsp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/main/webapp/WEB-INF/jsp/base/navigation.jsp b/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
index 0eb90aa..bb4b110 100644
--- a/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
+++ b/src/main/webapp/WEB-INF/jsp/base/navigation.jsp
@@ -49,7 +49,8 @@
           <!--
           <li class="" id="layout_18" role="presentation">
             <a aria-labelledby="layout_18" href="/facet/project.value" role="menuitem" tabindex="">${i18n['by-project']}</a>
-          </li>    
+          </li>
+          -->
         </ul>
       </li>
       
-- 
GitLab


From bfc6debac7ce90c16fc1db786f51553f3a4b1484 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 22 Dec 2021 02:20:55 +0100
Subject: [PATCH 27/29] use xslt from portal config for tei rendering

---
 build.gradle                                  |  2 +-
 .../textgrid/rep/browse/BrowseController.java |  5 +++-
 .../rep/service/AggregatorClientService.java  | 13 +++++++++-
 .../rep/service/TgsearchClientService.java    | 25 ++++++++++++++++++-
 4 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/build.gradle b/build.gradle
index 14cb38b..a090bdd 100644
--- a/build.gradle
+++ b/build.gradle
@@ -43,7 +43,7 @@ dependencies {
     implementation 'com.atlassian.commonmark:commonmark-ext-heading-anchor:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-gfm-tables:0.14.0'
     implementation 'com.atlassian.commonmark:commonmark-ext-yaml-front-matter:0.14.0'
-    implementation 'info.textgrid.middleware.clients:textgrid-clients:4.0.1'
+    implementation 'info.textgrid.middleware.clients:textgrid-clients:4.1.1-SNAPSHOT'
     implementation 'jakarta.xml.ws:jakarta.xml.ws-api:2.3.3'
     developmentOnly("org.springframework.boot:spring-boot-devtools")
     testImplementation('org.springframework.boot:spring-boot-starter-test') {
diff --git a/src/main/java/info/textgrid/rep/browse/BrowseController.java b/src/main/java/info/textgrid/rep/browse/BrowseController.java
index 829bbc8..bef0920 100644
--- a/src/main/java/info/textgrid/rep/browse/BrowseController.java
+++ b/src/main/java/info/textgrid/rep/browse/BrowseController.java
@@ -178,7 +178,10 @@ public class BrowseController {
       if (fragment != null) {
         teiHtml = this.aggregatorClient.renderTEIFragment(id, fragment);
       } else {
-        teiHtml = this.aggregatorClient.renderTEI(id);
+        String xsltUri = this.tgsearchClient.getProjectXsltUri(
+            metadata.getObject().getGeneric().getGenerated().getProject().getId());
+        log.debug("xslt for project is: " + xsltUri);
+        teiHtml = this.aggregatorClient.renderTEI(id, xsltUri);
         String tocHtml = this.aggregatorClient.renderToc(id);
         model.addAttribute("tocHtml", tocHtml);
       }
diff --git a/src/main/java/info/textgrid/rep/service/AggregatorClientService.java b/src/main/java/info/textgrid/rep/service/AggregatorClientService.java
index 89e8eb5..ffad093 100644
--- a/src/main/java/info/textgrid/rep/service/AggregatorClientService.java
+++ b/src/main/java/info/textgrid/rep/service/AggregatorClientService.java
@@ -12,6 +12,8 @@ import javax.ws.rs.client.WebTarget;
 import javax.ws.rs.core.Response;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
+import org.apache.cxf.feature.LoggingFeature;
+import org.apache.logging.log4j.Level;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -31,10 +33,14 @@ public class AggregatorClientService {
         .readTimeout(this.tgrepConfig.getAggregatorReadTimeout(), TimeUnit.SECONDS)
         .build()
         .property("thread.safe.client", "true");
-
   }
 
+
   public String renderTEI(String id) throws ServiceConnectionException {
+    return renderTEI(id, "");
+  }
+
+  public String renderTEI(String id, String xsltUri) throws ServiceConnectionException {
 
     String renderedTei = "";
 
@@ -43,6 +49,11 @@ public class AggregatorClientService {
         .queryParam("embedded", "true")
         .queryParam("mediatype", "text/xml");
 
+    if(!xsltUri.equals("")) {
+      log.debug("stylesheet: "+ xsltUri);
+      target = target.queryParam("stylesheet", xsltUri);
+    }
+
     try {
       Invocation.Builder builder = target.request();
       Response result = builder.get();
diff --git a/src/main/java/info/textgrid/rep/service/TgsearchClientService.java b/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
index 0206f00..c7dc517 100644
--- a/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
+++ b/src/main/java/info/textgrid/rep/service/TgsearchClientService.java
@@ -7,6 +7,7 @@ import java.util.List;
 import javax.ws.rs.client.Client;
 import javax.ws.rs.client.ClientBuilder;
 import javax.ws.rs.core.MediaType;
+import javax.xml.bind.JAXB;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.springframework.beans.factory.annotation.Autowired;
@@ -114,6 +115,28 @@ public class TgsearchClientService {
 
   }
 
+  public String getProjectXsltUri(String projectId) {
+    Project p = getProjectConfig(projectId);
+    JAXB.marshal(p, System.out);
+    if(p.getPortalconfig() != null) {
+      if( p.getPortalconfig().getXslt() != null) {
+        return p.getPortalconfig().getXslt().getHtml();
+      }
+    }
+    return "";
+  }
+
+  // TODO: as getProjects is called normally, it would be better to cache response!
+  public Project getProjectConfig(String projectId) {
+    Client client = ClientBuilder.newClient(); // TODO: put this to constructor
+    Project p = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/project/"+projectId)
+        .register(JacksonJsonProvider.class)
+        .request(MediaType.APPLICATION_JSON)
+        .get()
+        .readEntity(Project.class);
+    return p;
+  }
+
   public HashMap<String, String> getProjectMap(boolean sandbox) {
     HashMap<String, String> projects = new HashMap<String, String>();
     ProjectsResponse pr = getProjects(sandbox);
@@ -124,7 +147,7 @@ public class TgsearchClientService {
   }
 
   public ProjectsResponse getProjects(boolean sandbox) {
-    Client client = ClientBuilder.newClient(); // put this to constructor
+    Client client = ClientBuilder.newClient(); // TODO: put this to constructor
     ProjectsResponse pr = client.target(this.tgrepConfig.getTgsearchUrl()+"/portal/projects")
         .queryParam("sandbox", sandbox)
         .register(JacksonJsonProvider.class)
-- 
GitLab


From 444b6fb8091c4ae6f6f00e5671c00f512a873391 Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 20 Apr 2022 12:40:48 +0200
Subject: [PATCH 28/29] deactivate tests for prod server on this branch

---
 .../java/info/textgrid/rep/search/BrowseControllerTest.java  | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java b/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java
index 8b3120a..926d235 100644
--- a/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java
+++ b/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java
@@ -12,6 +12,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
 import java.math.BigInteger;
 import org.hamcrest.collection.IsEmptyCollection;
+import org.junit.Ignore;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
@@ -188,6 +189,8 @@ public class BrowseControllerTest {
         .andExpect(status().isOk());
   }
 
+  // TODO: does not work on dev server, activate on project-pages merge
+  @Ignore
   @Test
   public void browseAggregationHigherRevisionAvailable() throws Exception {
       mvc.perform(MockMvcRequestBuilders.get("/browse/3qz48.0")
@@ -209,6 +212,8 @@ public class BrowseControllerTest {
         .andExpect(status().is(404));
   }
 
+  // TODO: does not work on dev server, activate on project-pages merge
+  @Ignore
   @Test
   public void browsePlainText() throws Exception {
       mvc.perform(MockMvcRequestBuilders.get("/browse/3qtkq.0")
-- 
GitLab


From 92b800b452017a8a83ff6c29d3c7d083fb63116b Mon Sep 17 00:00:00 2001
From: Ubbo Veentjer <veentjer@sub.uni-goettingen.de>
Date: Wed, 20 Apr 2022 12:49:13 +0200
Subject: [PATCH 29/29] @Disabled is used in JUnit5

---
 .../java/info/textgrid/rep/search/BrowseControllerTest.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java b/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java
index 926d235..5b04cc2 100644
--- a/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java
+++ b/src/test/java/info/textgrid/rep/search/BrowseControllerTest.java
@@ -12,7 +12,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
 import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.view;
 import java.math.BigInteger;
 import org.hamcrest.collection.IsEmptyCollection;
-import org.junit.Ignore;
+import org.junit.jupiter.api.Disabled;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
@@ -190,7 +190,7 @@ public class BrowseControllerTest {
   }
 
   // TODO: does not work on dev server, activate on project-pages merge
-  @Ignore
+  @Disabled("does not work on dev server, activate on project-pages merge")
   @Test
   public void browseAggregationHigherRevisionAvailable() throws Exception {
       mvc.perform(MockMvcRequestBuilders.get("/browse/3qz48.0")
@@ -213,7 +213,7 @@ public class BrowseControllerTest {
   }
 
   // TODO: does not work on dev server, activate on project-pages merge
-  @Ignore
+  @Disabled("does not work on dev server, activate on project-pages merge")
   @Test
   public void browsePlainText() throws Exception {
       mvc.perform(MockMvcRequestBuilders.get("/browse/3qtkq.0")
-- 
GitLab