Commit 9631751c authored by Ubbo Veentjer's avatar Ubbo Veentjer
Browse files

help links for download@search and voyant@browse. link to errata. closes #26

parent 47b3e4af
Pipeline #140657 canceled with stages
......@@ -16,7 +16,7 @@ import info.textgrid.namespaces.middleware.tgsearch.ResultType;
import info.textgrid.rep.i18n.I18N;
import info.textgrid.rep.i18n.I18NProvider;
import info.textgrid.rep.service.TgsearchClientService;
import info.textgrid.rep.shared.ViewMode;
import info.textgrid.rep.shared.ToolLink;
@Controller
@SessionAttributes("basket")
......@@ -58,9 +58,9 @@ public class BasketController {
}
}
List<ViewMode> viewmodes = new ArrayList<ViewMode>();
viewmodes.add(new ViewMode(i18n.get("list"), "/shelf?mode=list", false));
viewmodes.add(new ViewMode(i18n.get("gallery"), "/shelf?mode=gallery", false));
List<ToolLink> viewmodes = new ArrayList<ToolLink>();
viewmodes.add(new ToolLink(i18n.get("list"), "/shelf?mode=list", false));
viewmodes.add(new ToolLink(i18n.get("gallery"), "/shelf?mode=gallery", false));
model.addAttribute("viewmodes", viewmodes);
model.addAttribute("results", results);
......
......@@ -31,7 +31,7 @@ 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.shared.ViewMode;
import info.textgrid.rep.shared.ToolLink;
@Controller
public class BrowseController {
......@@ -78,10 +78,10 @@ public class BrowseController {
// if no id, browse all root aggregations
if (id == null || id.equals("root")) {
List<ViewMode> viewmodes = new ArrayList<ViewMode>();
List<ToolLink> viewmodes = new ArrayList<ToolLink>();
viewmodes
.add(new ViewMode(i18n.get("list"), "/browse/root?mode=list", mode.equals("list")));
viewmodes.add(new ViewMode(i18n.get("gallery"), "/browse/root?mode=gallery",
.add(new ToolLink(i18n.get("list"), "/browse/root?mode=list", mode.equals("list")));
viewmodes.add(new ToolLink(i18n.get("gallery"), "/browse/root?mode=gallery",
mode.equals("gallery")));
model.addAttribute("viewmodes", viewmodes);
......@@ -138,7 +138,7 @@ public class BrowseController {
*/
private void handleXml(Model model, I18N i18n, String id, ResultType metadata, String fragment) {
List<ViewMode> tools = new ArrayList<ViewMode>();
List<ToolLink> tools = new ArrayList<ToolLink>();
// identifier@type of trier dfg-viewer mets is METSXMLID
// TODO: look into relation/tg:rootElementNamespace
......@@ -151,7 +151,7 @@ public class BrowseController {
try {
String tgcrudUrl4DFGViewer = URLEncoder.encode(
tgrepConfig.getTextgridHost() + "/1.0/tgcrud-public/rest/" + id + "/data", "UTF-8");
tools.add(new ViewMode("DFG-Viewer",
tools.add(new ToolLink("DFG-Viewer",
"http://dfg-viewer.de/v3/?set[zoom]=min&set[mets]=" + tgcrudUrl4DFGViewer, false));
} catch (UnsupportedEncodingException e) {
log.error("error encoding url", e);
......@@ -174,8 +174,8 @@ public class BrowseController {
// Mirador link may be shown for METS/MODS or TEI files (if manifest available for this file)
if (hasIiifManifest(metadata.getObject().getGeneric().getGenerated().getProject().getId())) {
tools.add(new ViewMode("Mirador", tgrepConfig.getToolMiradorHost() + "/?uri=" + id, false));
tools.add(new ViewMode(
tools.add(new ToolLink("Mirador", tgrepConfig.getToolMiradorHost() + "/?uri=" + id, false));
tools.add(new ToolLink(
"<img style='margin-top:2px; height: 21px;' title='Drop icon on Mirador to open manifest' src='" + tgrepConfig.getTextgridHost() + "/1.0/iiif/manifests/img/iiif-logo.svg'>",
tgrepConfig.getTextgridHost() + "/1.0/iiif/manifests/" + id + "/manifest.json", false
));
......@@ -189,25 +189,28 @@ public class BrowseController {
* @param tools
* @param id
*/
private List<ViewMode> addTeiTools(String id) {
private List<ToolLink> addTeiTools(String id) {
// CLARIN Language Resource Switchboard (LRS)
List<ViewMode> tools = new ArrayList<ViewMode>();
List<ToolLink> tools = new ArrayList<ToolLink>();
try {
// XML
String xml4switchboard = URLEncoder.encode(tgrepConfig.getTextgridHost() + "/1.0/tgcrud-public/rest/" + id + "/data", "UTF-8");
tools.add(new ViewMode("Switchboard (TEI)", tgrepConfig.getToolSwitchboardHost() + "/" + xml4switchboard + "/application%2Ftei+xml", false));
tools.add(new ToolLink("Switchboard (TEI)", tgrepConfig.getToolSwitchboardHost() + "/" + xml4switchboard + "/application%2Ftei+xml", false));
// txt
String text4switchboard = URLEncoder.encode(tgrepConfig.getTextgridHost() + "/1.0/aggregator/text/" + id , "UTF-8");
tools.add(new ViewMode("Switchboard (txt)", tgrepConfig.getToolSwitchboardHost() + "/" + text4switchboard + "/text%2Fplain", false));
tools.add(new ToolLink("Switchboard (txt)", tgrepConfig.getToolSwitchboardHost() + "/" + text4switchboard + "/text%2Fplain", false));
} catch (UnsupportedEncodingException e) {
log.error("error encoding url for switchboard", e);
}
// Voyant
tools.add(new ViewMode("Voyant", tgrepConfig.getVoyantHost() + "/?input=" + tgrepConfig.getTextgridHost() + "/1.0/tgcrud-public/rest/" + id + "/data", false));
tools.add(
new ToolLink("Voyant", tgrepConfig.getVoyantHost() + "/?input=" + tgrepConfig.getTextgridHost() + "/1.0/tgcrud-public/rest/" + id + "/data", false)
.setHelpLink("/docs/voyant")
);
// Annotate
tools.add(new ViewMode("Annotate", tgrepConfig.getToolAnnotateHost() + "/data.html?uri=" + id, false, "annotation-button"));
tools.add(new ToolLink("Annotate", tgrepConfig.getToolAnnotateHost() + "/data.html?uri=" + id, false, "annotation-button"));
return tools;
}
......@@ -221,15 +224,15 @@ public class BrowseController {
* @param mode
*/
private void handleAggregations(Model model, I18N i18n, String id, String format, String mode) {
List<ViewMode> viewmodes = new ArrayList<ViewMode>();
List<ToolLink> viewmodes = new ArrayList<ToolLink>();
viewmodes
.add(new ViewMode(i18n.get("list"), Utils.browseUrl(id) + "?mode=list", mode.equals("list")));
viewmodes.add(new ViewMode(i18n.get("gallery"), Utils.browseUrl(id) + "?mode=gallery",
.add(new ToolLink(i18n.get("list"), Utils.browseUrl(id) + "?mode=list", mode.equals("list")));
viewmodes.add(new ToolLink(i18n.get("gallery"), Utils.browseUrl(id) + "?mode=gallery",
mode.equals("gallery")));
if (format.equals("text/tg.edition+tg.aggregation+xml")) {
viewmodes.add(new ViewMode("TEI-Corpus", Utils.browseUrl(id) + "?mode=xml", mode.equals("xml")));
viewmodes.add(new ToolLink("TEI-Corpus", Utils.browseUrl(id) + "?mode=xml", mode.equals("xml")));
}
model.addAttribute("viewmodes", viewmodes);
......@@ -266,8 +269,8 @@ public class BrowseController {
*/
private void handleImages(Model model, String id) {
model.addAttribute("image", true);
List<ViewMode> tools = new ArrayList<ViewMode>();
tools.add(new ViewMode("Digilib", tgrepConfig.getToolDigilibHost() + "/digilib.html?fn=" + id, false));
List<ToolLink> tools = new ArrayList<ToolLink>();
tools.add(new ToolLink("Digilib", tgrepConfig.getToolDigilibHost() + "/digilib.html?fn=" + id, false));
model.addAttribute("tools", tools);
}
......
......@@ -20,7 +20,7 @@ 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.shared.ViewMode;
import info.textgrid.rep.shared.ToolLink;
@Controller
public class SearchController {
......@@ -81,9 +81,9 @@ public class SearchController {
model.addAttribute("pager", pager);
List<ViewMode> viewmodes = new ArrayList<ViewMode>();
viewmodes.add(new ViewMode(i18n.get("list"), Utils.searchUrl("list", query, filter, order, start, limit), mode.equals("list")));
viewmodes.add(new ViewMode(i18n.get("gallery"), Utils.searchUrl("gallery", query, filter, order, start, limit), mode.equals("gallery")));
List<ToolLink> viewmodes = new ArrayList<ToolLink>();
viewmodes.add(new ToolLink(i18n.get("list"), Utils.searchUrl("list", query, filter, order, start, limit), mode.equals("list")));
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);
......
package info.textgrid.rep.shared;
import java.io.Serializable;
public class ToolLink implements Serializable {
private static final long serialVersionUID = -5848034800808088323L;
private String url;
private String label;
private boolean active;
private String cssClass;
private String helpLink;
public ToolLink(String label, String url, boolean active) {
this.label = label;
this.url = url;
this.active = active;
}
public ToolLink(String label, String url, boolean active, String cssClass) {
this.label = label;
this.url = url;
this.active = active;
this.setCssClass(cssClass);
}
public String getUrl() {
return url;
}
public ToolLink setUrl(String url) {
this.url = url;
return this;
}
public String getLabel() {
return label;
}
public ToolLink setLabel(String label) {
this.label = label;
return this;
}
public boolean isActive() {
return active;
}
public ToolLink setActive(boolean active) {
this.active = active;
return this;
}
public String getCssClass() {
return cssClass;
}
public ToolLink setCssClass(String cssClass) {
this.cssClass = cssClass;
return this;
}
public String getHelpLink() {
return helpLink;
}
public ToolLink setHelpLink(String helpLink) {
this.helpLink = helpLink;
return this;
}
}
package info.textgrid.rep.shared;
import java.io.Serializable;
public class ViewMode implements Serializable {
private static final long serialVersionUID = -5848034800808088323L;
private String url;
private String label;
private boolean active;
private String cssClass;
public ViewMode(String label, String url, boolean active) {
this.label = label;
this.url = url;
this.active = active;
}
public ViewMode(String label, String url, boolean active, String cssClass) {
this.label = label;
this.url = url;
this.active = active;
this.setCssClass(cssClass);
}
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public boolean isActive() {
return active;
}
public void setActive(boolean active) {
this.active = active;
}
public String getCssClass() {
return cssClass;
}
public void setCssClass(String cssClass) {
this.cssClass = cssClass;
}
}
......@@ -69,6 +69,9 @@
<li class="" id="layout_18" role="presentation">
<a aria-labelledby="layout_18" href="/docs/voyant" role="menuitem" tabindex="">Voyant</a>
</li>
<li class="" id="layout_18" role="presentation">
<a aria-labelledby="layout_18" href="/docs/errata" role="menuitem" tabindex="">Errata</a>
</li>
</ul>
</li>
<!--
......
......@@ -144,6 +144,9 @@
<c:forEach items="${tools}" var="tool">
<li class="tgrep sidebar_item">
<a href="${tool.url}" rel="noindex nofollow" class="tgrep sidebar_link ${tool.cssClass}">${tool.label}</a>
<c:if test="${tool.helpLink != null}">
<a href ="${tool.helpLink}" class=""><icon class="info-link"></a>
</c:if>
</li>
</c:forEach>
</ul>
......
......@@ -55,7 +55,7 @@
</c:if>
<div class="tg dropdown" role="group">
<a class="tg dropdown_toggle -download">${i18n['download-all']}</a>
<a href ="/docs/download"><icon class="info-link -large"></a> <a class="tg dropdown_toggle -download">${i18n['download-all']}</a>
<ul class="tg dropdown_menu">
<li class="tg dropdown_item"><a class="tg dropdown_link" href="${config.aggregatorUrl}/zip/query?query=${utils:urlencode(realQueryString)}${filterQueryString}${aggregatorSandboxParam}" data-type="zip">ZIP</a></li>
<li class="tg dropdown_item"><a class="tg dropdown_link" href="${config.aggregatorUrl}/zip/query?query=${utils:urlencode(realQueryString)}${filterQueryString}${aggregatorSandboxParam}&transform=text&meta=false&only=text/xml&dirnames=" data-type="zip">${i18n['download-text-only-zip']}</a></li>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment