Mercurial > hg > digilib
changeset 1529:b330eafffed6
Merge with 3a11aadd443c90444245e59e989e5793729f32a7
author | robcast |
---|---|
date | Thu, 08 Sep 2016 13:56:20 +0200 |
parents | 08d64f3d1f76 (current diff) 3a11aadd443c (diff) |
children | 70e1225fe08c |
files | webapp/src/main/webapp/jquery/digilib-ann.html webapp/src/main/webapp/jquery/digilib-auth.html webapp/src/main/webapp/jquery/jquery.digilib.annotator.js |
diffstat | 7 files changed, 154 insertions(+), 36 deletions(-) [+] |
line wrap: on
line diff
--- a/webapp/src/main/webapp/jquery/digilib-ann.html Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/digilib-ann.html Thu Sep 08 13:56:20 2016 +0200 @@ -40,13 +40,13 @@ // URL of annotation server 'annotationServerUrl' : '//localhost:18080/AnnotationManagerN4J/annotator', // are annotations read-only? - 'annotationsReadOnly' : false, + 'annotationsReadOnly' : true, // URL of authentication token server - 'annotationTokenUrl' : 'http://localhost:8080/test/annotator/token/getLoginToken', + //'annotationTokenUrl' : 'http://localhost:8080/test/annotator/token/getLoginToken', // list of Annotator plugins - 'annotatorPlugins' : ['Auth', 'GroupPermissions', 'Markdown', 'DigilibIntegrator', 'Store'] + //'annotatorPlugins' : ['Auth', 'GroupPermissions', 'Markdown', 'DigilibIntegrator', 'Store'] //'annotatorPlugins' : ['Auth', 'Permissions', 'Markdown', 'DigilibIntegrator', 'Store'] - //'annotatorPlugins' : ['Store', 'Markdown', 'DigilibIntegrator'] + 'annotatorPlugins' : ['Store', 'Markdown', 'DigilibIntegrator'] }; var $div = $('div#digilib'); $div.digilib(opts);
--- a/webapp/src/main/webapp/jquery/digilib-auth.html Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/digilib-auth.html Thu Sep 08 13:56:20 2016 +0200 @@ -31,7 +31,7 @@ <script type="text/javascript"> $(document).ready(function(){ var opts = { - authServerUrl : 'http://localhost:18080/ldap-openid-connect-server/authorize', + authServerUrl : 'http://localhost:18080/openid-connect-server-webapp/authorize', authClientId : 'client', authOnErrorMode : true }; @@ -45,7 +45,7 @@ <body> <div id="digilib"> <p>digilib doesn't work! Please switch on Javascript or notify the server administrator!</p> - <img src="http://digilib.sourceforge.net/images/digilib-logo-big.png" /> + <!-- <img src="http://digilib.sourceforge.net/images/digilib-logo-big.png" /> --> </div> </body> </html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/jquery/digilib-map.html Thu Sep 08 13:56:20 2016 +0200 @@ -0,0 +1,98 @@ +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <meta http-equiv="content-type" content="text/html; charset=utf-8" /> + <meta name="viewport" content="initial-scale=1.0"/> + <title>Digilib jQuery: fullscreen</title> + + <style type="text/css"> + body { + background: silver; + } + </style> + + <script type="text/javascript" src="jquery.js"></script> + <script type="text/javascript" src="jquery.cookie.js"></script> + <script type="text/javascript" src="jquery.digilib.js"></script> + <link rel="stylesheet" type="text/css" href="jquery.digilib.css" /> + <link rel="stylesheet" type="text/css" href="jquery.digilib.buttons-full-32-sprite.css" /> + <script type="text/javascript" src="jquery.digilib.geometry.js"></script> + <script type="text/javascript" src="jquery.range.js"></script> + <link rel="stylesheet" type="text/css" href="jquery.range.css" /> + <script type="text/javascript" src="jquery.digilib.buttons.js"></script> + <script type="text/javascript" src="jquery.digilib.dialogs.js"></script> + <script type="text/javascript" src="jquery.digilib.sliders.js"></script> + <script type="text/javascript" src="jquery.digilib.birdseye.js"></script> + <script type="text/javascript" src="jquery.digilib.marks.js"></script> + <script type="text/javascript" src="jquery.digilib.vector.js"></script> + <script type="text/javascript" src="showdown.js"></script> + <script type="text/javascript" src="annotator-dl.js"></script> + <script type="text/javascript" src="jquery.digilib.annotator.js"></script> + <link rel="stylesheet" type="text/css" href="annotator.min.css" /> + + <script type="text/javascript"> + $(document).ready(function(){ + var settings = { + interactionMode : 'fullscreen', + 'buttonSettings' : { + 'fullscreen' : { + // path to button images (must end with a slash) + 'imagePath' : 'img/fullscreen/32/', + 'buttonSetWidth' : 36, + 'standardSet' : ["reference", + "zoomin","zoomout","zoomarea","zoomfull","pagewidth", + "annotationpolygon","annotationuser","annotations", + "bird","reset","about",], + 'buttonSets' : ['standardSet'] + }, + }, + // are annotations read-only? + 'annotationsReadOnly' : false, + // URL of annotation server + 'annotationServerUrl' : 'http://hertz-test64.biblhertz.it:3000/map', + // URL of authentication token server + 'annotationTokenUrl' : 'http://hertz-test64.biblhertz.it:3000/token', + // list of Annotator plugins + 'annotatorPlugins' : ['Auth', 'DigilibIntegrator', 'Markdown', 'Store', 'Tags'] + // annotationPageUri + // 'annotationPageUri' : function() { return window.location.href } + }; + // store additional data (apart from 'rows') from loadAnnotationsFromSearch + var _onLoadAnnotationsFromSearch = function (data) { + if (data == null) { + data = {}; + } + this.annotator.data = data; + console.log('maps: data', data); + return this._onLoadAnnotations(data.rows || []); + }; + // monkey patch the annotator Store plugin + var handleSetup = function (evt) { + console.log('maps: handleSetup'); + this.annotator.plugins.Store._onLoadAnnotationsFromSearch = _onLoadAnnotationsFromSearch; + } + // add zoom area params to loadAnnotationsFromSearch url + var getZoomArea = function (data) { + return data.zoomArea.toString(); + }; + // monkey patches for annotator_dl.js + var hook = function (data) { + data.settings.annotatorPluginSettings.Store.loadFromSearch.za = getZoomArea; + $(data).on('setup', handleSetup); // too late, annotations have already been loaded + }; + var $div = $('div#digilib'); + $div.digilib(settings, hook); + + }); + + </script> + </head> + + <body> + <div id="digilib"> + <p>digilib doesn't work! Please switch on Javascript or notify the server administrator!</p> + <!-- <img src="//digilib.sourceforge.net/images/digilib-logo-big.png" /> --> + </div> + </body> +</html> +
--- a/webapp/src/main/webapp/jquery/jquery-test-measure.html Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery-test-measure.html Thu Sep 08 13:56:20 2016 +0200 @@ -36,13 +36,10 @@ $(document).ready(function(){ var opts = { interactionMode : 'fullscreen', - showRegionNumbers : true + showRegionNumbers : true, }; var $div = $('div#digilib'); $div.digilib(opts); - DIGILIB = function (action) { - return $div.digilib(action); - }; }); </script> </head>
--- a/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Thu Sep 08 13:56:20 2016 +0200 @@ -233,7 +233,7 @@ // password entered in JS-prompt password = window.prompt("Please authenticate: Password", ''); // set params for Auth plugin - auth.options.requestData.password = password; + auth.options.requestData.password = password; // try to use the safe url for the password if (data.settings.annotationSafeTokenUrl != null) { auth.options.tokenUrl = data.settings.annotationSafeTokenUrl; @@ -796,11 +796,10 @@ $(document).off("mousedown", annotator.checkForStartSelection); $(document).off("mouseup", annotator.checkForEndSelection); // set plugin parameters - var def = defaults.annotatorPluginSettings; var pluginParams = {}; // merge settings // (deep copy of defaults from plugin and options from HTML) - $.extend(true, pluginParams, defaults.annotatorPluginSettings, data.options.annotatorPluginSettings); + $.extend(true, pluginParams, defaults.annotatorPluginSettings, data.settings.annotatorPluginSettings); // function to evaluate plugin settings var evalParams = function (params) { if (params == null) return;
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.js Thu Sep 08 13:56:20 2016 +0200 @@ -101,7 +101,9 @@ // parameters used by background image 'previewImgParamNames' : ['fn','pn','dw','dh','mo','rot'], // reserved space in full page display (default value accounts for body margins) - 'scalerInsets' : { 'x' : 26, 'y': 20 } + 'scalerInsets' : { 'x' : 26, 'y': 20 }, + // number of decimal places, for cropping parameters wx,wy,wh,ww + 'decimals' : 4 }; // list of plugins @@ -123,7 +125,7 @@ * @param options * @returns */ - init : function(options) { + init : function(options, hook) { // import geometry classes if (plugins.geometry == null) { $.error("jquery.digilib.geometry plugin not found!"); @@ -221,7 +223,7 @@ pos = url.indexOf('/digilib.html'); if (pos > 0) { elemSettings.digilibBaseUrl = url.substring(0, pos); - } + } } } else { // may be we got the scaler URL from the img @@ -258,6 +260,11 @@ } // create HTML structure for scaler setupScalerDiv(data); + // additional initializations before setup (e.g. for single nested settings) + if (typeof hook === 'function') { + hook(data); + console.debug('init hook', hook, data); + } // send setup event $(data).trigger('setup'); }); @@ -844,22 +851,31 @@ retrieveOptions(data); }; - /** put area into parameters + /** put area dimensions into parameters * */ - var packArea = function (settings, area) { - if (!area) return; - // zoom area - settings.wx = cropFloat(area.x); - settings.wy = cropFloat(area.y); - settings.ww = cropFloat(area.width); - settings.wh = cropFloat(area.height); + var packArea = function (data, area) { + // pack the dimensions of the zoom into parameters + if (!area) return; + // use higher precision if the image is large and mode="lpic" (large picture) + var decimals = defaults.decimals; + var imgInfo = data.imgInfo; + if (data.scalerFlags.lpic != null + && imgInfo != null + && Math.max(imgInfo.width, imgInfo.height) > 10000) { + decimals = 5; + } + var settings = data.settings; + settings.wx = cropFloat(area.x, decimals); + settings.wy = cropFloat(area.y, decimals); + settings.ww = cropFloat(area.width, decimals); + settings.wh = cropFloat(area.height, decimals); }; /** pack scaler flags into parameters * */ - var packScalerFlags = function (settings, flags) { + var packScalerFlags = function (data, flags) { if (!flags) return; var mo = ''; for (var f in flags) { @@ -868,16 +884,15 @@ } mo += f; } - settings.mo = mo; + data.settings.mo = mo; }; /** put objects back into parameters * */ var packParams = function (data) { - var settings = data.settings; - packArea(settings, data.zoomArea); - packScalerFlags(settings, data.scalerFlags); + packArea(data, data.zoomArea); + packScalerFlags(data, data.scalerFlags); // store user interface options in cookie storeOptions(data); // trigger pack handlers @@ -971,7 +986,10 @@ console.debug("cached img.load"); $img.trigger('load'); } - if (data.scalerFlags.clip != null || data.scalerFlags.osize != null) { + if (data.scalerFlags.clip != null + || data.scalerFlags.osize != null + || data.scalerFlags.lpic != null + ) { // we need image info, do we have it? if (data.imgInfo == null) { loadImageInfo(data); @@ -1006,7 +1024,11 @@ console.debug("cached img.load"); $img.trigger('load'); } - if (data.scalerFlags.clip != null || data.scalerFlags.osize != null) { + // parameter "mo" + if (data.scalerFlags.clip != null + || data.scalerFlags.osize != null + || data.scalerFlags.lpic != null) + { // we need image info, do we have it? if (data.imgInfo == null) { loadImageInfo(data); @@ -1755,14 +1777,16 @@ /** return number with reduced precision. * ("crop senseless precision") */ - var cropFloat = function (x) { - return parseInt(10000 * x, 10) / 10000; + var cropFloat = function (x, dec) { + // return parseInt(10000 * x, 10) / 10000; + var decimals = dec || defaults.decimals; + return +(Math.round(x + "e+" + decimals) + "e-" + decimals); }; /** return string from number with reduced precision. */ - var cropFloatStr = function (x) { - return cropFloat(x).toString(); + var cropFloatStr = function (x, dec) { + return cropFloat(x, dec).toString(); }; /**
--- a/webapp/src/main/webapp/jquery/jquery.digilib.regions.js Thu Sep 08 13:53:42 2016 +0200 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.regions.js Thu Sep 08 13:56:20 2016 +0200 @@ -232,7 +232,7 @@ var show = !data.settings.isRegionVisible; data.settings.isRegionVisible = show; fn.highlightButtons(data, 'regions', show); - renderRegions(data, 1); + renderRegions(data, 0); return show; },