Skip to content

Commit

Permalink
Merge pull request #46 from GlobalDataverseCommunityConsortium/develop
Browse files Browse the repository at this point in the history
Deploy Internationalization
  • Loading branch information
qqmyers authored Jun 23, 2020
2 parents 88b45d6 + 64eacf0 commit a0fcdf2
Showing 25 changed files with 1,430 additions and 94 deletions.
96 changes: 73 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -6,12 +6,18 @@ A collection of data file previewers that conform to the [Dataverse](https://dat


## Installation
These previewers can be run without downloading them by simply running the curl command(s) below to register then with your local dataverse instance. (You can also create local copies and register those). There is one command per mimetype you wish to preview (i.e. multiple commands to cover different types of images.) You can run any/all of the commands as you like. Note that the Hypothesis annotation previewer assumes a custom mimetype and may not be useful for most Dataverses (contact [QDR](mailto:qdr@syr.edu) for more information). Dataverse 4.11+ is required.
These previewers can be run without downloading them by simply running the curl command(s) below to register then with your local dataverse instance. (You can also create local copies and register those).

For updates such as enabling Internationalization, which change the parameters you need to register with (Internationalization requires that Dataverse send the localeCode to the previewers), you'll need to delete the registrations for existing previewers (using the Dataverse externalTools API) and re-register them again using the updated curl commands below.

There is one command per mimetype you wish to preview (i.e. multiple commands to cover different types of images.) You can run any/all of the commands as you like. Note that the Hypothesis annotation previewer assumes a custom mimetype and may not be useful for most Dataverses (contact [QDR](mailto:qdr@syr.edu) for more information). Dataverse 4.11+ is required.

Note that Dataverse installations configured to redirect to S3 storage for file downloads will need to enable CORS at the storage layer as well as the application layer (the latter is enabled by default). (See, for example, [Amazon's CORS configuration guidance](https://docs.aws.amazon.com/AmazonS3/latest/user-guide/add-cors-configuration.html)).

Also note that using the commands below means that your installation will automatically start using updated versions of the previewers when the master branch of this repository is updated. We intend to announce upcoming changes on the dataverse-community@google-groups.com mailing list, but if you do not want this behavior, you can download the previewers and host them on your own server, adjusting the curl commands below to reference your local copies.

## How do they work?
The tools here are lightweight wrappers around standard HTML5 functionality (e.g. audio, video), or third-party libraries (pdf) or some combination (e.g. standard image displays with a third-party library to allow zooming, simple text/html displays with third-party libraries used to sanitize content to avoid security issues).
The tools here are lightweight wrappers around standard HTML5 functionality (e.g. audio, video), or third-party libraries (pdf, spreadsheets) or some combination (e.g. standard image displays with a third-party library to allow zooming, simple text/html displays with third-party libraries used to sanitize content to avoid security issues).

## Customizations:
The previewers will use your favicon if it exists at the default Dataverse location: ```<your site URL>/javax.faces.resource/images/favicondataverse.png.xhtml```
@@ -25,24 +31,30 @@ File creation date is only shown in the header for Dataverse v4.12+.

Video seeking does not work on some browsers and some Dataverse instances due to the lack of support in some Dataverse storageIO drivers for partial file downloads. As of now, Seeking does not work in Chrome but does work in Firefox. Other browsers haven't been tested.

The image previewer only works with image/tiff files on some browsers (as of ~Jan 2020), so the registration for that mimetype ha been removed from the list below.
The image previewer only works with image/tiff files on some browsers (as of ~Jan 2020), so the registration for that mimetype has been removed from the list below.

## Acknowledgements
## Acknowledgments
The original tools were developed through the [Qualitative Data Repository](https://qdr.syr.edu) but are being offered to the Dataverse community at large.

The Spreadsheet Previewer was contributed by [anncie-pcss](https://github.com/anncie-pcss).

[pdurbin](https://github.com/pdurbin) updated the retriever.js script to allow previewers to be embedded directly in the Dataverse file pages.

[juancorr](https://github.com/juancorr) added internationlization and provided a Spanish translation for the existing previewers.

[kaitlinnewson](https://github.com/kaitlinnewson) provided a French translation for the existing previewers.

## How can I help?

If you are interested in adding additional previewers, or in maintaining/enhancing existing ones, contact us at [dataverse-dev@googlegroups.com](mailto:dataverse-dev@googlegroups.com) or work through github to fork/make pull-requests against the repository.

The wiki now contains a [How To Create a Previewer](https://github.com/GlobalDataverseCommunityConsortium/dataverse-previewers/wiki/How-to-create-a-previewer) page that provides a detailed guide to developing new previewers starting from the existing HTML/Javascript templates. (You can also build previewers using any language you choose, starting from the External Tools API in Dataverse.)

Contributors are expected to keep the master branch in a 'production-ready' state, as Dataverse instances may be using the html, javascript, and css files there directly via their github.io URLs (see curl commands below).

By commiting code to the repository, Contributors are agreeing to make it available under the [MIT Open Source license](https://globaldataversecommunityconsortium.github.io/dataverse-previewers/LICENSE).
By committing code to the repository, Contributors are agreeing to make it available under the [MIT Open Source license](https://globaldataversecommunityconsortium.github.io/dataverse-previewers/LICENSE).

## Curl commands to configure these tools with your dataverse instance:
## Curl commands to configure these tools with your Dataverse instance:
You should be able to cut/paste any/all of the commands below to run on your Dataverse machine:

>curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \\
@@ -59,7 +71,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"text/plain\\"
@@ -79,7 +92,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"text/html\\"
@@ -99,7 +113,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"audio/mp3\\"
@@ -119,7 +134,29 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"audio/mpeg\\"
>}"
>curl -X POST -H 'Content-type: application/json' http://localhost:8080/api/admin/externalTools -d \\
>"{
> \\"displayName\\":\\"Play Audio\\",
> \\"description\\":\\"Listen to an audio file.\\",
> \\"scope\\":\\"file\\",
> \\"type\\":\\"explore\\",
> \\"hasPreviewMode\\":\\"true\\",
> \\"toolUrl\\":\\"https://globaldataversecommunityconsortium.github.io/dataverse-previewers/previewers/AudioPreview.html\",
> \\"toolParameters\\": {
> \\"queryParameters\\":[
> {\\"fileid\\":\\"{fileId}\\"},
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"audio/wav\\"
@@ -139,7 +176,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"audio/ogg\\"
@@ -159,7 +197,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"image/gif\\"
@@ -179,7 +218,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"image/jpeg\\"
@@ -199,7 +239,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"image/png\\"
@@ -219,7 +260,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"application/pdf\\"
@@ -239,7 +281,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"video/mp4\\"
@@ -259,7 +302,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"video/ogg\\"
@@ -279,7 +323,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"video/quicktime\\"
@@ -299,7 +344,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"text/comma-separated-values\\"
@@ -319,7 +365,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"text/tab-separated-values\\"
@@ -339,7 +386,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"application/x-stata-syntax\\"
@@ -359,7 +407,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"type/x-r-syntax\\"
@@ -379,7 +428,8 @@ You should be able to cut/paste any/all of the commands below to run on your Dat
> {\\"siteUrl\\":\\"{siteUrl}\\"},
> {\\"key\\":\\"{apiToken}\\"},
> {\\"datasetid\\":\\"{datasetId}\\"},
> {\\"datasetversion\\":\\"{datasetVersion}\\"}
> {\\"datasetversion\\":\\"{datasetVersion}\\"},
> {\\"locale\\":\\"{localeCode}\\"}
> ]
> },
> \\"contentType\\":\\"application/x-json-hypothesis\\"
9 changes: 7 additions & 2 deletions previewers/AudioPreview.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script type="text/javascript" src="/dataverse-previewers/previewers/js/audio.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="/dataverse-previewers/previewers/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">
@@ -12,11 +16,12 @@
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title">Audio Preview
<H1 class="page-title audioPreviewText">Audio Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>

10 changes: 7 additions & 3 deletions previewers/HtmlPreview.html
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/html.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="/dataverse-previewers/previewers/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">
@@ -12,11 +16,11 @@
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title">Html Preview
<H1 class="page-title htmlPreviewText">Html Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
<div class='preview'></div>
</div>
</body>
</html>
</html>
8 changes: 6 additions & 2 deletions previewers/HypothesisPreview.html
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/xss.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/showdown.min.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/showdown-xss-filter.js"></script>
<script type="text/javascript" src="/dataverse-previewers/previewers/js/hypothesis.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="/dataverse-previewers/previewers/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">
@@ -15,7 +19,7 @@
<body class="container">
<img id='logo'></img>
<H1 class="page-title">
<a href="https://qdr.syr.edu/ati">ATI</a> Annotations
<a href="https://qdr.syr.edu/ati">ATI</a><span class="annotationsText">Annotations</span>
</H1>
<div class='preview-header'></div>
<div class="hypothesis">
8 changes: 6 additions & 2 deletions previewers/ImagePreview.html
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<meta charset="utf-8">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>

<script type="text/javascript" src="/dataverse-previewers/previewers/js/image.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery-zoom/1.7.21/jquery.zoom.min.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="/dataverse-previewers/previewers/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">
@@ -13,7 +17,7 @@
</head>
<body class="container">
<img id='logo'></img>
<H1 class="page-title">Image Preview
<H1 class="page-title imagePreviewText">Image Preview
</H1>
<div class='preview-container'>
<div class='preview-header'></div>
Loading

0 comments on commit a0fcdf2

Please sign in to comment.