Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
DARIAH-DE
TextGridRep Portal
Commits
4b138176
Commit
4b138176
authored
May 22, 2020
by
Ubbo Veentjer
Browse files
display some info if newer revision is available, basic list of published revisions (w.i.p.).
related to
#45
parent
5333eb03
Changes
5
Hide whitespace changes
Inline
Side-by-side
src/main/java/info/textgrid/rep/browse/BrowseController.java
View file @
4b138176
...
...
@@ -3,11 +3,14 @@ package info.textgrid.rep.browse;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.UnsupportedEncodingException
;
import
java.math.BigInteger
;
import
java.net.URLEncoder
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.Locale
;
import
java.util.TreeMap
;
import
javax.ws.rs.client.ClientBuilder
;
import
org.apache.commons.logging.Log
;
import
org.apache.commons.logging.LogFactory
;
...
...
@@ -20,6 +23,7 @@ import org.springframework.web.bind.annotation.RequestParam;
import
com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider
;
import
info.textgrid.clients.tgcrud.CrudClientException
;
import
info.textgrid.namespaces.middleware.tgsearch.ResultType
;
import
info.textgrid.namespaces.middleware.tgsearch.Revisions
;
import
info.textgrid.rep.i18n.I18N
;
import
info.textgrid.rep.i18n.I18NProvider
;
import
info.textgrid.rep.markdown.MarkdownUtils
;
...
...
@@ -112,6 +116,9 @@ public class BrowseController {
handleMarkdown
(
model
,
id
);
}
// add revisions info
listRevisions
(
model
,
id
,
metadata
);
return
"browse"
;
}
...
...
@@ -278,6 +285,25 @@ public class BrowseController {
model
.
addAttribute
(
"htmlContent"
,
content
);
}
private
void
listRevisions
(
Model
model
,
String
id
,
ResultType
metadata
)
{
Revisions
revisions
=
tgsearchClientService
.
listRevisions
(
id
);
int
displayRev
=
metadata
.
getObject
().
getGeneric
().
getGenerated
().
getRevision
();
BigInteger
latestRev
=
Collections
.
max
(
revisions
.
getRevision
());
if
(
BigInteger
.
valueOf
(
displayRev
).
compareTo
(
latestRev
)
<
0
)
{
model
.
addAttribute
(
"higherRevisionAvailable"
,
true
);
}
if
(
revisions
.
getRevision
().
size
()
>
0
)
{
TreeMap
revmap
=
new
TreeMap
<
BigInteger
,
String
>();
String
baseUri
=
id
.
substring
(
0
,
id
.
indexOf
(
"."
));
for
(
BigInteger
rev
:
revisions
.
getRevision
())
{
revmap
.
put
(
rev
,
baseUri
+
"."
+
rev
);
}
model
.
addAttribute
(
"revisions"
,
revmap
);
}
}
private
boolean
hasIiifManifest
(
String
id
)
{
...
...
src/main/java/info/textgrid/rep/service/TgsearchClientService.java
View file @
4b138176
...
...
@@ -11,6 +11,7 @@ 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
;
@Service
public
class
TgsearchClientService
{
...
...
@@ -95,4 +96,8 @@ public class TgsearchClientService {
}
public
Revisions
listRevisions
(
String
id
)
{
return
searchClient
.
infoQuery
().
listRevisions
(
id
);
}
}
src/main/resources/i18n/Language_de.properties
View file @
4b138176
...
...
@@ -86,6 +86,7 @@ collection-citation-heading=Zitationsvorschlag für diese Kollektion
aggregation-citation-heading
=
Zitationsvorschlag für diese Aggregation
work-citation-heading
=
Zitationsvorschlag für dieses Werk
item-citation-heading
=
Zitationsvorschlag für dieses Objekt
revisions
=
Revisionen
#usersettings.jsp
usersettings
=
Persönliche Einstellungen
...
...
src/main/resources/i18n/Language_en.properties
View file @
4b138176
...
...
@@ -86,6 +86,7 @@ collection-citation-heading=Citation Suggestion for this Collection
aggregation-citation-heading
=
Citation Suggestion for this Aggregation
work-citation-heading
=
Citation Suggestion for this Work
item-citation-heading
=
Citation Suggestion for this Object
revisions
=
Revisions
#usersettings.jsp
usersettings
=
Personal Settings
...
...
src/main/webapp/WEB-INF/jsp/browse.jsp
View file @
4b138176
...
...
@@ -36,6 +36,20 @@
<aside
class=
"tgrep sidebar"
>
<c:if
test=
"
${
higherRevisionAvailable
}
"
>
<section
class=
"tgrep sidebar_panel"
>
There is a higher revision available!
</section>
</c:if>
<c:if
test=
"
${
revisions
.
size
()
>
0
}
"
>
<section
class=
"tgrep sidebar_panel"
>
<h3
class=
"tgrep sidebar_subheading"
>
${i18n['revisions']}
</h3>
<c:forEach
items=
"
${
revisions
}
"
var=
"rev"
>
<a
href=
"/browse/${rev.value}"
>
${rev.key}
</a>
</c:forEach>
</section>
</c:if>
<section
class=
"tgrep sidebar_panel"
>
<h3
class=
"tgrep sidebar_subheading"
>
${i18n['metadata']}
</h3>
<!-- TODO: each for agent, pid, etc -->
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment