# HG changeset patch # User robcast # Date 1456392114 -3600 # Node ID b084694ec6182b4fb764899a30c05dbb4a2380ea # Parent 43614b59adf8720cc2ec50a096b229c00d7f81b0# Parent ef98becd15b1626010d8d1166f4214f22b87fee6 Merge from default ef98becd15b1626010d8d1166f4214f22b87fee6 diff -r 43614b59adf8 -r b084694ec618 .hgignore --- a/.hgignore Fri Nov 13 17:38:04 2015 +0100 +++ b/.hgignore Thu Feb 25 10:21:54 2016 +0100 @@ -119,4 +119,14 @@ syntax: regexp ^doc/\.project$ syntax: regexp -^doc/target$ \ No newline at end of file +^doc/target$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.cookie-range\.min\.js$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.min\.js$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.css$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.js$ +syntax: regexp +^webapp/src/main/webapp/jquery/jquery\.digilib-basic\.min\.css$ \ No newline at end of file diff -r 43614b59adf8 -r b084694ec618 common/src/main/java/digilib/conf/DigilibConfiguration.java --- a/common/src/main/java/digilib/conf/DigilibConfiguration.java Fri Nov 13 17:38:04 2015 +0100 +++ b/common/src/main/java/digilib/conf/DigilibConfiguration.java Thu Feb 25 10:21:54 2016 +0100 @@ -57,7 +57,7 @@ /** digilib version */ public static String getClassVersion() { - return "2.3.7"; + return "2.3.8"; } /* non-static getVersion for Java inheritance */ diff -r 43614b59adf8 -r b084694ec618 common/src/main/java/digilib/image/ImageJobDescription.java --- a/common/src/main/java/digilib/image/ImageJobDescription.java Fri Nov 13 17:38:04 2015 +0100 +++ b/common/src/main/java/digilib/image/ImageJobDescription.java Thu Feb 25 10:21:54 2016 +0100 @@ -183,6 +183,30 @@ } /** + * Creates new ImageJobDescription by merging Parameters from a + * DigilibRequest and adding an ImageSEt. + * + * @param dlReq + * @param imgs + * @param dlcfg + * @return + * @throws ImageOpException + * @throws IOException + */ + public static ImageJobDescription getInstanceWithImgs(DigilibRequest dlReq, ImageSet imgs, DigilibConfiguration dlcfg) + throws IOException, ImageOpException { + ImageJobDescription newMap = new ImageJobDescription(dlcfg); + // add all params to this map + newMap.params.putAll(dlReq.getParams()); + newMap.initOptions(); + newMap.setImageSet(imgs); + newMap.prepareScaleParams(); + // add ImageJobDescription back into DigilibRequest + dlReq.setJobDescription(newMap); + return newMap; + } + + /** * Creates new ImageJobDescription by merging Parameters from another * ParameterMap. * @@ -747,6 +771,14 @@ return imgSize; } + /** + * Set the image size. + * + * @param size + */ + public void setImgSize(ImageSize size) { + this.imgSize = size; + } /** * Return the X scale factor. diff -r 43614b59adf8 -r b084694ec618 doc/src/site/markdown/scaler-api.md --- a/doc/src/site/markdown/scaler-api.md Fri Nov 13 17:38:04 2015 +0100 +++ b/doc/src/site/markdown/scaler-api.md Thu Feb 25 10:21:54 2016 +0100 @@ -6,7 +6,7 @@ Unknown parameters will be silently ignored. -Recognised parameters (as of Version 2.2.2, for the most recent list of +Recognised parameters (as of Version 2.3.7, for the most recent list of parameters [use the source](https://sourceforge.net/p/digilib/code/ci/default/tree/servlet/src/main/java/digilib/conf/DigilibServletRequest.java) ): @@ -58,13 +58,16 @@ `osize` mode. - `scale`: absolute scale factor applied to the highest resolution image for `ascale` mode. -- `colop`: color operation. One of "GRAYSCALE" (produces grayscale - image), "NTSC\_GRAY" (uses NTSC formula to produce grayscale image), - "INVERT" (inverts colors), "MAP\_GRAY\_BGR" (produces false-color image - mapping brightness values to color scale from blue via green to red). +- `colop`: color operation. One of + - `GRAYSCALE` (produces grayscale image) + - `NTSC_GRAY` (uses NTSC formula to produce grayscale image) + - `BITONAL` (produces black-and-white image) + - `INVERT` (inverts colors) + - `MAP_GRAY_BGR` (produces false-color image mapping brightness values to color scale from blue via green to red). - `mo`: list of flags for the mode of operation separated by comma ",". - - `fit`: always scale the image to fit \[`dw` x `dh`\] (default). - - `clip`: send the file in its original resolution, cropped + - `fit`: scale the image proportionally to fit inside \[`dw` x `dh`\], preserving its aspect ratio (default). + - `squeeze`: scale the image to fit \[`dw` x `dh`\], changing its aspect ratio. + - `clip`: send the file in the highest resolution, cropped to fit \[`dw` x `dh`\]. - `osize`: scale to original size based on image resolution (from the image metadata) and display resolution @@ -81,14 +84,16 @@ - `errcode`: send error response as HTTP status code. - `q0`-`q2`: quality of interpolation in scaling (q0: worst, q2 best). - - `lores`: try to use pre-scaled images (default) - `hires`: only use the highest resolution image. + - `autores`: use the pre-scaled image that is bigger than the requested size (default). + - `lores`: prefer the next-smaller pre-scaled image. - `vmir`: mirror image vertically. - `hmir`: mirror image horizontally. - `jpg`: the resulting image is always sent as JPEG (otherwise TIFF and PNG images are sent as PNG). - `png`: the resulting image is always sent as PNG (otherwise JPEG and J2K images are sent as JPEG). + - `pxarea`: interpret `wx`, `wy`, `ww`, `wh` as pixel coordinates on the highest resolution image. The image to be loaded is specified by the `request_path` (deprecated) and/or the `fn` parameter (preferred) and the optional @@ -102,9 +107,9 @@ Find more information on the directory layout [here](image-directories.html). The image will always be scaled equally in horizontal and vertical direction, -preserving the aspect ratio, +preserving the aspect ratio (except with `mo=squeeze`), such that the resulting image does not exceed the rectangle \[`dw` x `dh`\]. If only either height or width is given the image is scaled to match only the given dimension. The size of the resulting image in the other -dimension is determined by the aspect ratio of the image. +dimension is determined by the aspect ratio of the image or the selected area. diff -r 43614b59adf8 -r b084694ec618 servlet/src/main/java/digilib/auth/MetaAccessServletAuthOps.java --- a/servlet/src/main/java/digilib/auth/MetaAccessServletAuthOps.java Fri Nov 13 17:38:04 2015 +0100 +++ b/servlet/src/main/java/digilib/auth/MetaAccessServletAuthOps.java Thu Feb 25 10:21:54 2016 +0100 @@ -42,7 +42,6 @@ import digilib.io.DocuDirCache; import digilib.io.DocuDirent; import digilib.io.FileOpException; -import digilib.io.FileOps; import digilib.meta.MetadataMap; import digilib.util.HashTree; import digilib.util.XMLListLoader; @@ -50,9 +49,28 @@ /** * Implementation of AuthOps using "access" information from file metadata and * roles mapped to IP-number ranges defined in an XML config file. + *

+ * Tags "digilib-access" and "digilib-adresses" are read from the configuration file: + *

+ * {@code
+ * 
+ *   
+ * 
+ * }
+ * 
+ * A user must supply one of the roles under "role" to access any object with the metadata "access" type of "type". + * Roles under "role" must be separated by comma only (no spaces). + *
  
+ * {@code
+ * 
+ *   
+ *
+ * + * } + *
+ * A computer with an ip address that matches "ip" is automatically granted all roles under "role". + * The ip address is matched from the left (in full quads). Roles under "role" must be separated by comma only (no spaces). * - * The configuration file is read by an XMLListLoader into HashTree objects for - * IP numbers. */ public class MetaAccessServletAuthOps extends ServletAuthOpsImpl { @@ -74,9 +92,10 @@ } /** - * Initialize. + * Initialize authentication operations. * - * Read configuration files and setup authorization arrays. + * Reads tags "digilib-access" and "digilib-adresses" from configuration file + * and sets up authentication arrays. * * @throws AuthOpException * Exception thrown on error. @@ -136,7 +155,7 @@ // try to get image file from DirCache DigilibConfiguration config = dlRequest.getDigilibConfig(); DocuDirCache cache = (DocuDirCache) config.getValue(DigilibServletConfiguration.DIR_CACHE_KEY); - imgs = cache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), FileOps.FileClass.IMAGE); + imgs = cache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn")); } } catch (FileOpException e) { throw new AuthOpException("No file for auth check!"); diff -r 43614b59adf8 -r b084694ec618 servlet/src/main/java/digilib/auth/PathServletAuthOps.java --- a/servlet/src/main/java/digilib/auth/PathServletAuthOps.java Fri Nov 13 17:38:04 2015 +0100 +++ b/servlet/src/main/java/digilib/auth/PathServletAuthOps.java Thu Feb 25 10:21:54 2016 +0100 @@ -37,10 +37,29 @@ import digilib.util.XMLListLoader; /** - * Implementation of AuthOps using paths defined in an XML config file. + * Implements AuthOps using paths defined in an XML config file. + *

+ * Tags "digilib-paths" and "digilib-adresses" are read from the configuration file: + *

+ * {@code
+ * 
+ *   
+ * 
+ * }
+ * 
+ * A user must supply one of the roles under "role" to access the directory "name". + * Roles under "role" must be separated by comma only (no spaces). + *
  
+ * {@code
+ * 
+ *   
+ *
+ * + * } + *
+ * A computer with an ip address that matches "ip" is automatically granted all roles under "role". + * The ip address is matched from the left (in full quads). Roles under "role" must be separated by comma only (no spaces). * - * The configuration file is read by an XMLListLoader into HashTree objects for - * authentication paths and IP numbers. */ public class PathServletAuthOps extends ServletAuthOpsImpl { @@ -62,9 +81,10 @@ } /** - * Initialize. + * Initialize authentication operations. * - * Read configuration files and setup authentication arrays. + * Reads tags "digilib-paths" and "digilib-adresses" from configuration file + * and sets up authentication arrays. * * @throws AuthOpException * Exception thrown on error. @@ -95,15 +115,13 @@ /** * Return authorization roles needed for request. * - * Returns the list of authorization roles that are needed to access the + * Returns the list of authorization roles that are required to access the * specified path. No list means the path is free. * - * The location information of the request is also considered. + * The location information of the request is determined by ServletRequest.getRemoteAddr(). * - * @param filepath - * filepath to be accessed. - * @param request - * ServletRequest with address information. + * @param dlRequest + * DigilibServletRequest with image path and remote address information. * @throws AuthOpException * Exception thrown on error. * @return List of Strings with role names. diff -r 43614b59adf8 -r b084694ec618 servlet/src/main/java/digilib/servlet/ServletOps.java --- a/servlet/src/main/java/digilib/servlet/ServletOps.java Fri Nov 13 17:38:04 2015 +0100 +++ b/servlet/src/main/java/digilib/servlet/ServletOps.java Thu Feb 25 10:21:54 2016 +0100 @@ -446,7 +446,7 @@ writer.println("{"); writer.println("\"@context\" : \"http://iiif.io/api/image/2/context.json\","); writer.println("\"@id\" : \"" + url + "\","); - writer.println("\"@protocol\" : \"http://iiif.io/api/image\","); + writer.println("\"protocol\" : \"http://iiif.io/api/image\","); writer.println("\"width\" : " + size.width + ","); writer.println("\"height\" : " + size.height + ","); writer.println("\"profile\" : ["); diff -r 43614b59adf8 -r b084694ec618 webapp/pom.xml --- a/webapp/pom.xml Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/pom.xml Thu Feb 25 10:21:54 2016 +0100 @@ -14,6 +14,7 @@ true + 3 @@ -35,16 +36,109 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 2.19 - - ${skipTests} - - - + + org.apache.maven.plugins + maven-surefire-plugin + 2.19 + + ${skipTests} + + + + + + com.samaxes.maven + minify-maven-plugin + 1.7.4 + + + digilib-basic-minify + + + jquery + + + jquery.digilib.js + jquery.digilib.geometry.js + jquery.digilib.arrows.js + jquery.digilib.buttons.js + jquery.digilib.dialogs.js + jquery.digilib.sliders.js + jquery.digilib.birdseye.js + jquery.digilib.marks.js + jquery.digilib.regions.js + + jquery.digilib-basic.js + YUI + true + + jquery + + jquery.digilib.css + jquery.digilib.buttons-full-32-sprite.css + jquery.range.css + + jquery.digilib-basic.css + + + minify + + + + digilib-ann-minify + + jquery + + + jquery.digilib.js + jquery.digilib.geometry.js + jquery.digilib.arrows.js + jquery.digilib.buttons.js + jquery.digilib.dialogs.js + jquery.digilib.sliders.js + jquery.digilib.birdseye.js + jquery.digilib.marks.js + jquery.digilib.regions.js + jquery.digilib.vector.js + jquery.digilib.annotator.js + showdown.js + + jquery.digilib-ann.js + YUI + true + + jquery + + jquery.digilib.css + jquery.digilib.buttons-full-32-sprite.css + jquery.range.css + + jquery.digilib-ann.css + + + minify + + + + cookie-range-minify + + jquery + + + jquery.cookie.js + jquery.range.js + + jquery.cookie-range.js + YUI + + + minify + + + + + @@ -103,14 +197,6 @@ srv3 - - org.apache.maven.plugins - maven-compiler-plugin - - 1.7 - 1.7 - - @@ -180,6 +266,37 @@ + + create-sprites + + + + + net.jangaroo + smartsprites-maven-plugin + 1.8 + + src/main/webapp/jquery + ${basedir}/src/main/webapp/jquery/ + INFO + AUTO + false + UTF-8 + -sprite + + + + createSprites + generate-resources + + createSprites + + + + + + + diff -r 43614b59adf8 -r b084694ec618 webapp/src/main/webapp/digilib.html --- a/webapp/src/main/webapp/digilib.html Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/src/main/webapp/digilib.html Thu Feb 25 10:21:54 2016 +0100 @@ -11,20 +11,10 @@ } - - - - - - - - - - - - - - + + + + + diff -r 43614b59adf8 -r b084694ec618 webapp/src/main/webapp/jquery/digilib-auth.html --- a/webapp/src/main/webapp/jquery/digilib-auth.html Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/src/main/webapp/jquery/digilib-auth.html Thu Feb 25 10:21:54 2016 +0100 @@ -26,6 +26,7 @@ + + + + + + + + + + + + + + + + + + + + +
+

digilib doesn't work! Please switch on Javascript or notify the server administrator!

+ +
+ + + diff -r 43614b59adf8 -r b084694ec618 webapp/src/main/webapp/jquery/digilib-mpiwg.html --- a/webapp/src/main/webapp/jquery/digilib-mpiwg.html Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/src/main/webapp/jquery/digilib-mpiwg.html Thu Feb 25 10:21:54 2016 +0100 @@ -11,26 +11,12 @@ } - - - - - - - - - - - - - - - - - - + + + + + - + + - - - - - - - - - - - - - + + + + - + - - + + + @@ -38,12 +48,10 @@ -

digilib doesn't work! Please switch on Javascript or notify the server administrator!

- diff -r 43614b59adf8 -r b084694ec618 webapp/src/main/webapp/jquery/jquery.cookie.js --- a/webapp/src/main/webapp/jquery/jquery.cookie.js Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.cookie.js Thu Feb 25 10:21:54 2016 +0100 @@ -1,96 +1,114 @@ -/** - * Cookie plugin - * - * Copyright (c) 2006 Klaus Hartl (stilbuero.de) - * Dual licensed under the MIT and GPL licenses: - * http://www.opensource.org/licenses/mit-license.php - * http://www.gnu.org/licenses/gpl.html - * - */ - -/** - * Create a cookie with the given name and value and other optional parameters. - * - * @example $.cookie('the_cookie', 'the_value'); - * @desc Set the value of a cookie. - * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true }); - * @desc Create a cookie with all available options. - * @example $.cookie('the_cookie', 'the_value'); - * @desc Create a session cookie. - * @example $.cookie('the_cookie', null); - * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain - * used when the cookie was set. - * - * @param String name The name of the cookie. - * @param String value The value of the cookie. - * @param Object options An object literal containing key/value pairs to provide optional cookie attributes. - * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object. - * If a negative value is specified (e.g. a date in the past), the cookie will be deleted. - * If set to null or omitted, the cookie will be a session cookie and will not be retained - * when the the browser exits. - * @option String path The value of the path atribute of the cookie (default: path of page that created the cookie). - * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie). - * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will - * require a secure protocol (like HTTPS). - * @type undefined - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ - -/** - * Get the value of a cookie with the given name. - * - * @example $.cookie('the_cookie'); - * @desc Get the value of a cookie. - * - * @param String name The name of the cookie. - * @return The value of the cookie. - * @type String - * - * @name $.cookie - * @cat Plugins/Cookie - * @author Klaus Hartl/klaus.hartl@stilbuero.de - */ -jQuery.cookie = function(name, value, options) { - if (typeof value != 'undefined') { // name and value given, set cookie - options = options || {}; - if (value === null) { - value = ''; - options.expires = -1; - } - var expires = ''; - if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) { - var date; - if (typeof options.expires == 'number') { - date = new Date(); - date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000)); - } else { - date = options.expires; - } - expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE - } - // CAUTION: Needed to parenthesize options.path and options.domain - // in the following expressions, otherwise they evaluate to undefined - // in the packed version for some reason... - var path = options.path ? '; path=' + (options.path) : ''; - var domain = options.domain ? '; domain=' + (options.domain) : ''; - var secure = options.secure ? '; secure' : ''; - document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join(''); - } else { // only name given, get cookie - var cookieValue = null; - if (document.cookie && document.cookie != '') { - var cookies = document.cookie.split(';'); - for (var i = 0; i < cookies.length; i++) { - var cookie = jQuery.trim(cookies[i]); - // Does this cookie string begin with the name we want? - if (cookie.substring(0, name.length + 1) == (name + '=')) { - cookieValue = decodeURIComponent(cookie.substring(name.length + 1)); - break; - } - } - } - return cookieValue; - } -}; +/*! + * jQuery Cookie Plugin v1.4.1 + * https://github.com/carhartl/jquery-cookie + * + * Copyright 2006, 2014 Klaus Hartl + * Released under the MIT license + */ +(function (factory) { + if (typeof define === 'function' && define.amd) { + // AMD (Register as an anonymous module) + define(['jquery'], factory); + } else if (typeof exports === 'object') { + // Node/CommonJS + module.exports = factory(require('jquery')); + } else { + // Browser globals + factory(jQuery); + } +}(function ($) { + + var pluses = /\+/g; + + function encode(s) { + return config.raw ? s : encodeURIComponent(s); + } + + function decode(s) { + return config.raw ? s : decodeURIComponent(s); + } + + function stringifyCookieValue(value) { + return encode(config.json ? JSON.stringify(value) : String(value)); + } + + function parseCookieValue(s) { + if (s.indexOf('"') === 0) { + // This is a quoted cookie as according to RFC2068, unescape... + s = s.slice(1, -1).replace(/\\"/g, '"').replace(/\\\\/g, '\\'); + } + + try { + // Replace server-side written pluses with spaces. + // If we can't decode the cookie, ignore it, it's unusable. + // If we can't parse the cookie, ignore it, it's unusable. + s = decodeURIComponent(s.replace(pluses, ' ')); + return config.json ? JSON.parse(s) : s; + } catch(e) {} + } + + function read(s, converter) { + var value = config.raw ? s : parseCookieValue(s); + return $.isFunction(converter) ? converter(value) : value; + } + + var config = $.cookie = function (key, value, options) { + + // Write + + if (arguments.length > 1 && !$.isFunction(value)) { + options = $.extend({}, config.defaults, options); + + if (typeof options.expires === 'number') { + var days = options.expires, t = options.expires = new Date(); + t.setMilliseconds(t.getMilliseconds() + days * 864e+5); + } + + return (document.cookie = [ + encode(key), '=', stringifyCookieValue(value), + options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE + options.path ? '; path=' + options.path : '', + options.domain ? '; domain=' + options.domain : '', + options.secure ? '; secure' : '' + ].join('')); + } + + // Read + + var result = key ? undefined : {}, + // To prevent the for loop in the first place assign an empty array + // in case there are no cookies at all. Also prevents odd result when + // calling $.cookie(). + cookies = document.cookie ? document.cookie.split('; ') : [], + i = 0, + l = cookies.length; + + for (; i < l; i++) { + var parts = cookies[i].split('='), + name = decode(parts.shift()), + cookie = parts.join('='); + + if (key === name) { + // If second argument (value) is a function it's a converter... + result = read(cookie, value); + break; + } + + // Prevent storing a cookie that we couldn't decode. + if (!key && (cookie = read(cookie)) !== undefined) { + result[name] = cookie; + } + } + + return result; + }; + + config.defaults = {}; + + $.removeCookie = function (key, options) { + // Must not alter options, thus extending a fresh object... + $.cookie(key, '', $.extend({}, options, { expires: -1 })); + return !$.cookie(key); + }; + +})); diff -r 43614b59adf8 -r b084694ec618 webapp/src/main/webapp/jquery/jquery.digilib.annotator.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.annotator.js Thu Feb 25 10:21:54 2016 +0100 @@ -82,8 +82,9 @@ * show/hide annotations */ toggleAnnotations : function (data) { - var show = !data.settings.isAnnotationsVisible; - data.settings.isAnnotationsVisible = show; + var show = !data.dlOpts.isAnnotationsVisible; + data.dlOpts.isAnnotationsVisible = show; + fn.storeOptions(data); fn.highlightButtons(data, 'annotations', show); renderAnnotations(data); }, @@ -106,7 +107,7 @@ // save new token in cookie auth.withToken(function (tkn) { data.dlOpts.annotationToken = auth.token; - fn.storeOptions(data); + fn.storeOptions(data); // clear annotations data.annotations = []; annotator.plugins.Store.annotations = []; @@ -341,15 +342,17 @@ var renderAnnotations = function (data) { if (data.annotations == null || data.annotator == null) return; - var annotations = data.annotations; + var annotations = data.annotations; var cssPrefix = data.settings.cssPrefix; var $elem = data.$elem; // show annotation user state $elem.find('div#'+cssPrefix+'button-annotationuser').attr('title', 'annotation user: '+data.settings.annotationUser); // create vector shapes var shapes = []; - for (var i = 0; i < annotations.length; ++i) { - shapes.push(createShape(data, annotations[i])); + if (data.dlOpts.isAnnotationsVisible) { + for (var i = 0; i < annotations.length; ++i) { + shapes.push(createShape(data, annotations[i])); + } } annotationLayer.shapes = shapes; // render vector layer @@ -367,7 +370,7 @@ var createShape = function (data, annot) { if (annot == null || annot.annotation == null) return; - if (!data.settings.isAnnotationsVisible) return; + if (!data.dlOpts.isAnnotationsVisible) return; var cssPrefix = data.settings.cssPrefix; var annotation = annot.annotation; var idx = ''; @@ -764,6 +767,13 @@ console.debug("annotations: handleSetup"); var data = this; var settings = data.settings; + // merge isVisible setting with value from cookie + if (data.dlOpts.isAnnotationsVisible == null) { + data.dlOpts.isAnnotationsVisible = settings.isAnnotationsVisible; + } else if (typeof data.dlOpts.isAnnotationsVisible == 'string') { + // make string into boolean + data.dlOpts.isAnnotationsVisible = (data.dlOpts.isAnnotationsVisible == 'true'); + } // create annotation shapes layer annotationLayer = { 'projection': 'screen', diff -r 43614b59adf8 -r b084694ec618 webapp/src/main/webapp/jquery/jquery.digilib.arrows.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.arrows.js Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.arrows.js Thu Feb 25 10:21:54 2016 +0100 @@ -187,9 +187,9 @@ // button properties var action = buttonConfig.onclick; var tooltip = buttonConfig.tooltip; - var icon = imagePath + buttonConfig.icon; + var iconId = buttonConfig.icon.slice(0, -4); // construct the button html - var $button = $('
'); + var $button = $('
'); if (!show) { $button.hide(); } diff -r 43614b59adf8 -r b084694ec618 webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js --- a/webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js Fri Nov 13 17:38:04 2015 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.birdseye.js Thu Feb 25 10:21:54 2016 +0100 @@ -2,7 +2,7 @@ * #%L * digilib bird's eye view plugin * %% - * Copyright (C) 2011 - 2013 Bibliotheca Hertziana, MPIWG Berlin + * Copyright (C) 2011 - 2016 Bibliotheca Hertziana, MPIWG Berlin * %% * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as @@ -59,12 +59,13 @@ showBirdDiv : function (data, show) { var settings = data.settings; if (data.$birdDiv == null) { - // no bird div -> create + // no bird div: create it setupBirdDiv(data); } + // console.debug('showBirdDiv, visible:' + settings.isBirdDivVisible +' , show:' + show); var on = digilib.fn.showDiv(settings.isBirdDivVisible, data.$birdDiv, show); settings.isBirdDivVisible = on; - //digilib.fn.highlightButtons(data, 'bird', on); + // digilib.fn.highlightButtons(data, 'bird', on); updateBirdDiv(data); digilib.fn.storeOptions(data); } @@ -102,45 +103,45 @@ $data.on('changeZoomArea', handleChangeZoomArea); }; - var handleSetup = function (evt) { - console.debug("birdseye: handleSetup"); var data = this; - // bird's eye view creation - if (data.settings.isBirdDivVisible) { + var visible = data.settings.isBirdDivVisible; + var auto = data.settings.autoBirdDiv; + console.debug("birdseye: handleSetup, auto:"+auto, ", visible:"+visible); + // create bird's eye view + if (visible || auto) { setupBirdDiv(data); - data.$birdDiv.show(); } }; var handleUpdate = function (evt) { - console.debug("birdseye: handleUpdate"); - var data = this; - if (data.settings.isBirdDivVisible) { - renderBirdArea(data); - setupBirdDrag(data); - } + // console.debug("birdseye: handleUpdate"); + // var data = this; }; var handleRedisplay = function (evt) { // TODO: do we need this? console.debug("birdseye: handleRedisplay"); var data = this; + if (data.settings.autoBirdDiv) { + data.settings.isBirdDivVisible = !digilib.fn.isFullArea(data.zoomArea); + } actions.showBirdDiv(data, data.settings.isBirdDivVisible); }; var handleChangeZoomArea = function (evt, zoomArea) { - //console.debug("birdseye: handleDragZoom za="+zoomArea); - var data = this; - updateBirdZoom(data, zoomArea); + var data = this; + if (data.settings.isBirdDivVisible && zoomArea.moved) { + moveBirdZoom(data, zoomArea); + } }; // returns URL for bird's eye view image var getBirdImgUrl = function (data) { var settings = data.settings; var birdDivOptions = { - dw : settings.birdDivWidth, - dh : settings.birdDivHeight + dw : settings.birdDivWidth, + dh : settings.birdDivHeight }; var birdSettings = $.extend({}, settings, birdDivOptions); // use only the relevant parameters @@ -153,8 +154,12 @@ var setupBirdDiv = function (data) { var cssPrefix = data.settings.cssPrefix; var $elem = data.$elem; - // the bird's eye div - var $birdDiv = $('