Welcome to the documentation of the Picturae Webkitchen components, on this website you can find information how to implement our components on your own website.
You can also try the demo to see how our application should behave. In case you have any questions you can contact us at contact@picturae.com.
To setup the archives component you need to include the follow scripts
<script src="http://images.memorix.nl/topviewer/1.0/src/topviewer.compressed.js"></script>
<script src="//webservices.picturae.com/archives/js/dist/web-kitchen.1.0.0.min.js" type="text/javascript"></script>
<script src="//webservices.picturae.com/archives/translations/nl_NL.js" type="text/javascript"></script>
<script src="//webservices.picturae.com/archives/packages/nl_NL/archives/full.js" type="text/javascript"></script>
The topviewer can be ommited if no scans are going to be displayed. The translations and the templates package are multilingual - currently nl_NL and en_GB versions are present.
You can also make use of some default styling which will be a good base to build your customization on
<link rel="stylesheet" href="//webservices.picturae.com/archives/css/screen.css">
At the place in your html where you want the archives component booted you shall include the master/layout template (or write your own). For example:
<!-- ko template: {name: 'archives/layout/with-modal'} --><!-- /ko -->
In many use cases the default layout will not be perfectly suitable for your use case (because of the desire to use a css framework like foundation or bootstrap and benefit from their grid systems). In that case you will either need to write your own layout template overwrite or be provided with one. Both cases are not in the scope of the current tutorial.
To instantiate the javascript client you can call it as follows (this is also the minimum required configuration):
$(function () {
PicturaeApi.archives({
basePath: "<the path in your page where the component lives. E.g. '/archives'>",
url: "<api url>",
key: "<api key>"
});
});
Here is a list of the supported application options
Name | Default | Type | Description |
---|---|---|---|
basePath | N/A | String | As the component does not use query params for its routing but works with SEF urls it needs to know what the base path where it runs is so it can parse a requested URL correctly |
key | N/A | String | The api key provided by Picturae |
url | N/A | String | The url of the data api |
language | en_GB | String | Possible values are:
|
container | body | Object | The DOM element on which the ko.applyBindings() will be called. If knockout is already used in the basePath where you are trying to boot the archives component this is the way to prevent calling applyBindings multiple times on the same elements which will cause knockout errors |
ondemand | false | Boolean | If you are using the default templates when this option is set to true a button for requesting scans will be displayed next to files in the details tree. When clicked the onScanOnDemand event will be triggered |
scans | null | Object |
When the option is set scans will be displayed when browsing files. The configuration object supports the following properties:
|
views | null | Object | View specific options. A full list of the supported options is available below |
events | null | Object | A list of event handlers. For a full reference of the supported events please go to the events chapter |
View | Available options |
---|---|
search |
|
details |
|
When the modal option is used for scans and facetvalues views instead of just setting it to true an options object with the width and height properties is also accepted.
Hide facets | The option solr.facets.field.{fieldName}.visible allows hiding a particular field's facets when set to FALSE. |
---|---|
Reorder facets | The option for reordering facets is frontend.views.search.facets.order. It needs to be an array of fieldnames. Not listed fields will still be shown after those ones. |
Reorder facet values | The facets values may be ordered by index or count (as known from Solr). This is done by setting solr.facets.field.{fieldName}.sort to either index or count. |
A list of the supported events:
Event | Callback params | Description |
---|---|---|
onAfterResultsUpdate | response | Called after an api request was completed and the search results has been updated |
onAfterDetailsUpdate | response | Called when the record has been loaded/reloaded in details view |
onScanOnDemand | file | Fired when the scan on demand button is clicked for a file |
onScanTopviewerLoad | viewer | An event raised right after the scans viewer was initialized and scans are going to be displayed |
It is possible to force html 4 urls with a # instead of / (push state), this can be useful if you do not have the option to rewrite url's in your server.
http://example.com/archives/details/NL-RtHNI-110000135/
would become:
http://example.com/archives#details/NL-RtHNI-110000135/
This should only be done as last resort, as it's not possible to provide any server side fallback as everything behind the # is not passed to the server.
Add the following script to the head of your document, it's important that this script loads before the mediabank.js.
<script type="text/javascript" language="javascript">
window.History = { options: { html4Mode: true} };
</script>
It's also important to have the correct base href else you could get an extra level in your hash, if your url is located on: http://example.com/archive it's important to keep an extra slash in the base href
<base href="http://example.com/archives/" />