Skip to content

Commit

Permalink
Merge pull request #41 from ErykKul/23_RO-Crate_previewer
Browse files Browse the repository at this point in the history
RO-Crate previewer
  • Loading branch information
qqmyers authored Dec 7, 2023
2 parents b158f37 + 57467e6 commit eca36ed
Show file tree
Hide file tree
Showing 6 changed files with 120 additions and 1 deletion.
25 changes: 25 additions & 0 deletions 5.2curlcommands.md
Original file line number Diff line number Diff line change
Expand Up @@ -824,3 +824,28 @@ curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin
"contentType":"image/tiff"
}'
```

### RO-Crate Previewer (beta)

```bash
curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \
'{
"displayName":"Show RO-Crate",
"description":"View the RO-Crate metadata file.",
"toolName":"rocratePreviewer",
"scope":"file",
"types":["preview"],
"toolUrl":"https://gdcc.github.io/dataverse-previewers/previewers/betatest/ROCratePreview.html",
"toolParameters": {
"queryParameters":[
{"fileid":"{fileId}"},
{"siteUrl":"{siteUrl}"},
{"key":"{apiToken}"},
{"datasetid":"{datasetId}"},
{"datasetversion":"{datasetVersion}"},
{"locale":"{localeCode}"}
]
},
"contentType":"application/ld+json; profile=\"http://www.w3.org/ns/json-ld#flattened http://www.w3.org/ns/json-ld#compacted https://w3id.org/ro/crate\""
}'
```
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ The Spreadsheet Previewer was contributed by [anncie-pcss](https://github.com/an

[Max Planck Digital Library](https://github.com/MPDL) contributed the ZIP Previewer.

[erykkul](https://github.com/erykkul) contributed the Markdown (MD) Previewer.
[erykkul](https://github.com/erykkul) contributed the Markdown (MD) Previewer and the RO-Crate previewer.

[Jan Range](https://github.com/JR-1991) contributed the H5Web Previewer.

Expand Down
44 changes: 44 additions & 0 deletions previewers/betatest/ROCrate.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<html>

<head>
<meta charset="utf-8">
<title class="rocratePreviewText">RO-Crate Preview</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="js/xss.js"></script>
<script type="text/javascript" src="js/rocrate.js"></script>
<script src="lib/jquery.i18n.js"></script>
<script src="lib/jquery.i18n.messagestore.js"></script>
<script src="lib/jquery.i18n.language.js"></script>
<script type="text/javascript" src="js/retriever.js"></script>
<!-- Latest compiled and minified CSS -->
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css"
integrity="sha384-HSMxcRTRxnN+Bdg0JdbxYKrThecOKuH5zCYotlSAcp1+c8xmyTe9GYg1l9a69psu" crossorigin="anonymous">
<!-- Optional theme -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link type="text/css" rel="stylesheet" href="css/preview.css" />
<style>
table.table {
padding-bottom: 300px;
}
</style>
</head>

<body class="container">
<main><img id='logo' alt='Site Logo'>
<h1 class="page-title rocratePreviewText">RO-Crate Preview</h1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'>
<div class="container">
<div id="scripts"></div>
<div class="jumbotron">
<div id="check"></div>
</div>
<div id="summary"></div>
</div>
</div>
</div>
</main>
</body>

</html>
1 change: 1 addition & 0 deletions previewers/betatest/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"zipPreviewText": "ZIP Preview",
"mdPreviewText": "Markdown Preview",
"ncmlPreviewText": "NcML Preview",
"rocratePreviewText": "RO-Crate Preview",
"prev": "Previous",
"next": "Next",
"pageText": "Page:",
Expand Down
29 changes: 29 additions & 0 deletions previewers/betatest/js/ro-crate-dynamic.min.js

Large diffs are not rendered by default.

20 changes: 20 additions & 0 deletions previewers/betatest/js/rocrate.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
$(document).ready(function () {
startPreview(true);
});

function translateBaseHtmlPage() {
$('.rocratePreviewText').text($.i18n("rocratePreviewText"));
}

function writeContentAndData(data, fileUrl, file, title, authors) {
addStandardPreviewHeader(file, title, authors);
const scripts = document.getElementById("scripts");
var s1 = document.createElement("script");
s1.type = "application/ld+json";
s1.text = data;
scripts.append(s1);
var s2 = document.createElement("script");
s2.type = "text/javascript";
s2.src = "js/ro-crate-dynamic.min.js";
scripts.append(s2);
}

0 comments on commit eca36ed

Please sign in to comment.