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.

Picturae Webkitchen - Mediabank

Deprecated, please contact us to migrate to the 2.0 version of the Mediabank

Index

Mediabank - Getting Started

To setup the mediabank you need to include the follow scripts

    <script src="http://images.memorix.nl/topviewer/1.0/src/topviewer.compressed.js" type="text/javascript"></script>
<script src="http://webservices.picturae.com/mediabank/js/build/templates/mediabank_nl.js" type="text/javascript"></script>
<script src="http://webservices.picturae.com/mediabank/js/build/mediabank.js" type="text/javascript"></script>
    

And the following css file

    <link rel="stylesheet" href="//webservices.picturae.com/mediabank/css/mediabank.css">

The demo below uses foundation for it's grid markup if you want to use this you will need to include foundation grid css below.

    <link rel="stylesheet" href="//webservices.picturae.com/mediabank/css/foundation-grid.css">

To instantiate the javascript client you can call it as following:

    picturaeMediabank.require(['Mediabank'], function (Mediabank) {
    pm = new Mediabank({
        "apiKey": "{key}",
        "server": "{api-url}",
    });
    pm.run();
});
    

HTML

If you want to run the application from a subdirectory it's important to bootstrap the application with a base element

    <base href="http://example.com/mediabank/" />

The following html is required to render the application

    <!-- Container result page -->
<div data-bind="page: { id: 'gallery', role: 'start', sourceCache: true, withOnShow: $root.requireView('Gallery'), params: ['page', 'q', 'fq', 'rows', 'rm']}">
    <div class="row">
        <!-- Container search form -->
        <div class="medium-12 columns picturae-mediabank-search-container" data-bind="template: {name: 'picturae-mediabank-search', data: components.search}"></div>
    </div>
    <div class="row picturae-mediabank-result-container">
        <!-- Container filters -->
        <div class="medium-3 columns picturae-mediabank-filter-container" data-bind="template: {name: 'picturae-mediabank-filters', data: components.filters}"></div>
        <div class="medium-9 columns">
            <!-- Render pagination -->
            <!-- ko template: {name:'picturae-mediabank-pagination'} --><!-- /ko -->
            <!-- Render gallery -->
            <!-- ko template: { name: 'picturae-mediabank-gallery'} --><!-- /ko -->
            <div class="picturae-pagination-bottom" data-bind="template:{name:'picturae-mediabank-pagination'}"></div>
        </div>
    </div>
</div>

<!-- Container detail page -->
<div class="picturae-mediabank-detail-container" data-bind="page: {id: 'detail', sourceCache: true, withOnShow: $root.requireView('Detail'), params: ['page', 'q', 'fq']}">
    <div class="row">
        <!-- Container search form -->
        <div class="medium-12 columns" data-bind="template: {name: 'picturae-mediabank-search', data: components.search}"></div>
    </div>
    <div class="row">
        <div class="medium-12 columns picturae-mediabank-pagination-container">
            <!-- Render pagination -->
            <!-- ko template: {name:'picturae-mediabank-pagination'} --><!-- /ko -->
            <!-- Render detail image & metadata -->
            <!-- ko template: {name:'picturae-mediabank-detail'} --><!-- /ko -->
            <div class="picturae-pagination-bottom" data-bind="template:{name:'picturae-mediabank-pagination'}"></div>
        </div>
    </div>
</div>
<!-- Container modal for all filters -->
<div data-bind="page: {id: 'filters', modal: true, withOnShow: $root.requireView('Filter')}">
    <div data-bind="template: {name: 'picturae-mediabank-filters-all', 'afterRender': animateModal}"></div>
</div>
    

For horizontal filters you can change the filter element to the following:

    <div class="medium-12 columns picturae-mediabank-filter-container picturae-filter-no-hover picturae-filter-position-top"
                 data-bind="template: {name: 'picturae-mediabank-filters-top', data: components.filters}"></div>
    

If you would like the filters to display on hover too, remove the class "picturae-filter-no-hover"

Config

Predefined client configuration

To retrieve predefined configuration for the client there are 2 endpoints in the api, click on the links for an example in the demo config

Filters

To add filters you can set them as following

To discover fields that can be filtered you can use the following endpoint in the api:
/media/field?apiKey={key}

    pm = new Mediabank({
        "apiKey": "9af37644-6da5-4584-b641-6cf5a24fd7f3",
        "server": "http://mediabank.zend.picturae.pro",
        "filtersCount": 5 // Amount of filters to show
        "filterRows": 20, // Amount of filters to show in modal
        "filters": [
            {"field": "search_s_loc.prefixed"},
            {"field": "search_s_documenttype"},
        ]
    });
pm.run();
    

Metadata filter links

To show metadata as a link you can configure the following:

    pm = new Mediabank({
        "apiKey": "9af37644-6da5-4584-b641-6cf5a24fd7f3",
        "server": "http://mediabank.zend.picturae.pro",
        "filtersCount": 5 // Amount of filters to show
        "detailLinks": {
          "place": {
              "field": "place",
              "filter": "search_s_place.all" // optional define field in solr to link by default it will go to search_s_{field}
          }
       }
});
pm.run();
    

Pagination

It is possible to switch pagination styles currently there are 2

default: prev | next

    pm = new Mediabank({
        "apiKey": "9af37644-6da5-4584-b641-6cf5a24fd7f3",
        "server": "http://mediabank.zend.picturae.pro",
        "pagination": {
            "type" : "default",
         }
       }
});
pm.run();
    

sliding: first | prev | 1 | 2 | 3 | 4 | 5 | next | last

For the sliding style it is possible to define the amount of pages to show, it defaults to 10:

    pm = new Mediabank({
        "apiKey": "9af37644-6da5-4584-b641-6cf5a24fd7f3",
        "server": "http://mediabank.zend.picturae.pro",
        "pagination": {
            "type" : "sliding",
            "showPages": 20
         }
       }
});
pm.run();
    

Events

You can hook into the following event's:

  • reload (before the viewmodel will reload)
  • preAddMedia (before the media observableArray will be updated)
  • postReload (after the model is finished reloading)
    $(pm).on('reload', function(event, view){
    // Is triggered before the data is updated
});

$(pm).on('preAddMedia', function(event, view, media){
    // modify media before it is added to the array
});


$(pm).on('postReload', function(event, view){
  // Triggered after data reload
  // View contains a result mode to see if we are on the result or detail page e.g
  if (view.resultMode === 'detail') {
     // We are on the detail page
  }
});
    

Buttons on detail view

The following buttons are available by default.

  • Print
  • Download
  • Email
  • Facebook
  • Twitter
  • Pinterest
  • Permalink

To disable a button you can set the following configuration.

    pm = new Mediabank({
    "detailLinks": [{
        "id": "print",
        "show": false
    }, {
        "id": "download",
        "show": false
    }, {
        "id": "email",
        "show": false
    }, {
        "id": "facebook",
        "show": false
    }, {
        "id": "twitter",
        "show": false
    }, {
        "id": "pinterest",
        "show": false
    }, {
        "id": "permalink",
        "show": false
    }
    ]
});

Add custom button

It's possible to add your custom button, the example code below logs the currently selected image details and it's thumbnail

    var pm = new Mediabank({
    "detailLinks": [
        // Add custom button
        {
            "id": "addMedia",
            "css": "addMedia",
            "label": "Voeg media toe",
            "show": true,
            "click": function() {
                // do something with the current selected asset
                var asset = pm.getViewModel().getActiveAsset();
                if (asset) {
                    console.log(asset);
                    console.log('example use thumb :' + asset.thumb.medium);
                }
            }
        }
    ]
});

Tooltip configuration

It's possible to enable tooltips on gallery / grid result modes: In the client config you can add the following setting:

    toolTip: {
    settings: {
        placement:: "ne",
        smartPlacement: true
    }
}
    

For the tooltip powertip is used it's possible to configure all settings that are in the lib except manual this is always set to true: http://stevenbenner.github.io/jquery-powertip/#list-of-options

Name Default Type Description
followMouse false Boolean If set to true the tooltip will follow the users mouse cursor.
mouseOnToPopup false Boolean Allow the mouse to hover on the tooltip. This lets users interact with the content in the tooltip. Only works if followMouse is set to false.
placement 'n' String Placement location of the tooltip relative to the element it is open for. Values can be n, e, s, w, nw, ne, sw, se, nw-alt, ne-alt, sw-alt, or se-alt (as in north, east, south, and west). This only matters if followMouse is set to false.
smartPlacement false Boolean When enabled the plugin will try to keep tips inside the browser view port. If a tooltip would extend outside of the view port then its placement will be changed to an orientation that would be entirely within the current view port. Only applies if followMouse is set to false.
popupId 'powerTip' String HTML id attribute for the tooltip div.
offset 10 Number Pixel offset of the tooltip. This will be the offset from the element the tooltip is open for, or from from mouse cursor if followMouse is true.
fadeInTime 200 Number Tooltip fade-in time in milliseconds.
fadeOutTime 100 Number Tooltip fade-out time in milliseconds.
closeDelay 100 Number Time in milliseconds to wait after mouse cursor leaves the element before closing the tooltip. This serves two purposes: first, it is the mechanism that lets the mouse cursor reach the tooltip (cross the gap between the element and the tooltip div) for mouseOnToPopup tooltips. And, second, it lets the cursor briefly leave the element and return without causing the whole fade-out, intent test, and fade-in cycle to happen.
intentPollInterval 100 Number Hover intent polling interval in milliseconds.
intentSensitivity 7 Number Hover intent sensitivity. The tooltip will not open unless the number of pixels the mouse has moved within the intentPollInterval is less than this value. These default values mean that if the mouse cursor has moved 7 or more pixels in 100 milliseconds the tooltip will not open.

HTML 4 Mode

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://demo.webservices.picturae.pro/mediabank/detail/00af46a3-7525-2918-59ee-4c851fcb84c0
would become:
http://demo.webservices.picturae.pro/mediabank/#/detail/00af46a3-7525-2918-59ee-4c851fcb84c0

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>