Mercurial > hg > digilib
changeset 1154:1aca768f2dc3
big clean up! digillib.html (and .jsp) in the root is jquery-version now. all old stuff moved to /oldskin (digicat is still old).
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/api/ImgInfo-json.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,44 @@ +<%@page language="java" + import="digilib.io.FileOps, digilib.io.ImageFileSet, digilib.io.ImageFile, digilib.util.ImageSize, digilib.servlet.DigilibConfiguration" + contentType="application/json"%><%! +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><% +// parsing the query +digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); +docBean.setRequest(dlRequest); +// dir cache +digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); +digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); +// get file +FileOps.FileClass fc = FileOps.FileClass.IMAGE; +ImageFileSet imgFile = (ImageFileSet) dirCache.getFile(dlRequest.getFilePath(), dlRequest.getAsInt("pn"), fc); + +%>{<% + if (imgFile != null) { + imgFile.checkMeta(); + ImageFile img = (ImageFile) imgFile.getBiggest(); + ImageSize imgSize = img.getSize(); + %> + "filename" : "<%= imgFile.getName() %>", + "aspect" : <%= imgFile.getAspect() %>, + "dpi_x" : <%= imgFile.getResX() %>, + "dpi_y" : <%= imgFile.getResY() %><% + + if (imgSize != null) { + %>, + "width" : <%= imgSize.getWidth() %>, + "height" : <%= imgSize.getHeight() %> +<% } + } +%>}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/api/dirInfo-xml.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,47 @@ +<%@page import="digilib.io.FileOps"%><%@ page language="java" %><%! +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><?xml version="1.0" encoding="UTF-8" ?> +<% +// process request +// get digilib config +digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); +// parsing the query +digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); +// dir cache +digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); +// get directory +digilib.io.DocuDirectory dir = dirCache.getDirectory(dlRequest.getFilePath()); +FileOps.FileClass fc = FileOps.FileClass.IMAGE; +int dirSize = dir != null ? dir.size(fc) : 0; + +%><!-- Automatically generated XML snippet with directory info --> +<dir><% if (dir != null) { %> + <size><%= dirSize %></size> + <name><%= dir.getDirName() %></name> + <fsname><%= dir.getDir().getPath() %></fsname> +<% + if (!dlRequest.hasOption("mo", "dir")) { + for (int i = 0; i < dirSize; i++) { + digilib.io.DocuDirent f = dir.get(i, fc); + String fn = (f != null) ? f.getName() : "null"; +%> <file> + <index><%= i+1 %></index> + <name><%= digilib.io.FileOps.basename(fn) %></name> + <fsname><%= fn %></fsname> + </file> +<% + } // for + } // if not dironly + } // if dir +%></dir>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/api/dlContext-xml.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,43 @@ +<%@ page language="java" %><%! +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><?xml version="1.0" encoding="UTF-8" ?> +<% +// process request +// get digilib config +digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); +// parsing the query +digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); +// dir cache +digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); + +%><!-- Automatically generated XML snippet with document context --> +<result> +<% +int pn = dlRequest.getAsInt("pn"); +String fn = dlRequest.getFilePath(); +String ctx = ""; +digilib.io.DocuDirent f = dirCache.getFile(fn, pn, digilib.io.FileOps.FileClass.IMAGE); +if (f != null) { + //ctx = "hasfile:"+f.getName(); + f.checkMeta(); + java.util.HashMap meta = f.getFileMeta(); + if (meta != null) { + //ctx = "JSP:hasmeta!"; + if (meta.containsKey("context")) { + ctx = (String) meta.get("context"); + } + } +} +%><%= ctx %> +</result>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/api/dlInfo-json.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,36 @@ +<%@ page language="java" %> +<%! +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><% +// parsing the query +digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); +docBean.setRequest(dlRequest); +%> +// JSON format metadata about request and image +{ +<% + Object[] keys = dlRequest.getParams().keySet().toArray(); + java.util.Arrays.sort(keys); + int l = keys.length; + for (int i = 0; i < l; i++) { + String key = (String) keys[i]; + String val = dlRequest.getAsString(key); + if (val.length() == 0) { + val = ""; + } + %>"<%= key %>" : "<%= val %>", +<% + } +%> +}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/api/dlInfo-xml.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,38 @@ +<%@ page language="java" %><%! +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><?xml version="1.0" encoding="UTF-8" ?> +<% +// process request +// get digilib config +digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); +// parsing the query +digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); +docBean.setRequest(dlRequest); + +%><!-- Automatically generated XML snippet with document parameters --> +<document-parameters> +<% + Object[] keys = dlRequest.getParams().keySet().toArray(); + java.util.Arrays.sort(keys); + int l = keys.length; + for (int i = 0; i < l; i++) { + String key = (String) keys[i]; + String val = dlRequest.getAsString(key); + if (val.length() == 0) { + val = ""; + } +%> <parameter name="<%= key %>" value="<%= val %>"/> +<% + } +%></document-parameters>
--- a/webapp/src/main/webapp/baselib.js Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,638 +0,0 @@ -/* Copyright (C) 2003,2004 IT-Group MPIWG, WTWG Uni Bern and others - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Authors: - Christian Luginbuehl, 01.05.2003 (first version) - DW 24.03.2004 (Changed for digiLib in Zope) - Robert Casties, 22.1.2008 - -*/ - -function base_init() { - // init function - baseScriptVersion = "1.2.4"; - dlParams = new Object(); - browserType = getBrowserType(); -} - - -function getInt(n) { - // returns always an integer - n = parseInt(n); - if (isNaN(n)) return 0; - return n; -} - -function defined(x) { - // returns if x is defined - return (typeof arguments[0] != "undefined"); -} - -function cropFloat(x) { - // auxiliary function to crop senseless precision - return parseInt(10000*x)/10000; -} - -function getBrowserType() { - // browser sniffer - var bt = Object(); - bt.doDHTML = false; - bt.versIE = 0; - - if ((! document.cssonly && document.layers) || document.all || document.getElementById) { - var vers = navigator.appVersion.split('MSIE '); - vers = vers[vers.length - 1]; - bt.versIE = getInt(vers); - bt.isIE = navigator.userAgent.indexOf('MSIE') >= 0; - bt.isMac = navigator.platform.indexOf('Mac') >= 0; - bt.isWin = navigator.platform.indexOf('Win') >= 0; - bt.isN4 = (navigator.userAgent.indexOf('Mozilla/4.') >= 0) && ! bt.isIE; - bt.isIEWin = bt.versIE > 0 && bt.isWin; - if (navigator.appVersion.indexOf('MSIE') < 0 || ! bt.isMac || bt.versIE >= 5) { - bt.doDHTML = true; - bt.isOpera = navigator.userAgent.indexOf(' Opera ') >= 0; - bt.isKonq = navigator.userAgent.indexOf(' Konqueror') >= 0; - } - } - return bt; -} - -// fixes for javascript < 1.2 -if (! Array.prototype.push) { - Array.prototype.push = function(val) { - this[this.length] = val; - return this.length; - } - Array.prototype.pop = function() { - var val = this[this.length-1]; - this.length -= 1; - return val; - } -} - - -/* ********************************************** - * geometry classes - * ******************************************** */ - -/* - * Size class - */ -function Size(w, h) { - this.width = parseFloat(w); - this.height = parseFloat(h); - return this; -} -Size.prototype.toString = function() { - return this.width + "x" + this.height; -} - - -/* - * Position class - */ -function Position(x, y) { - this.x = parseFloat(x); - this.y = parseFloat(y); - return this; -} -Position.prototype.toString = function() { - return this.x + "," + this.y; -} - -/* - * Rectangle class - */ -function Rectangle(x, y, w, h) { - this.x = parseFloat(x); - this.y = parseFloat(y); - this.width = parseFloat(w); - this.height = parseFloat(h); - return this; -} -Rectangle.prototype.toString = function() { - return this.width+"x"+this.height+"@"+this.x+","+this.y; -} -Rectangle.prototype.copy = function() { - // returns a copy of this Rectangle - return new Rectangle(this.x, this.y, this.width, this.height); -} -Rectangle.prototype.getPosition = function() { - // returns the position of this Rectangle - return new Position(this.x, this.y); -} -Rectangle.prototype.getSize = function() { - // returns the size of this Rectangle - return new Size(this.width, this.height); -} -Rectangle.prototype.getArea = function() { - // returns the area of this Rectangle - return (this.width * this.height); -} -Rectangle.prototype.containsPosition = function(pos) { - // returns if the given Position lies in this Rectangle - return ((pos.x >= this.x)&&(pos.y >= this.y)&&(pos.x <= this.x+this.width)&&(pos.y <= this.y+this.width)); -} -Rectangle.prototype.intersect = function(rect) { - // returns the intersection of the given Rectangle and this one - var sec = rect.copy(); - if (sec.x < this.x) { - sec.width = sec.width - (this.x - sec.x); - sec.x = this.x; - } - if (sec.y < this.y) { - sec.height = sec.height - (this.y - sec.y); - sec.y = this.y; - } - if (sec.x + sec.width > this.x + this.width) { - sec.width = (this.x + this.width) - sec.x; - } - if (sec.y + sec.height > this.y + this.height) { - sec.height = (this.y + this.height) - sec.y; - } - return sec; -} -Rectangle.prototype.fit = function(rect) { - // returns a Rectangle that fits into this one (by moving first) - var sec = rect.copy(); - sec.x = Math.max(sec.x, this.x); - sec.x = Math.max(sec.x, this.x); - if (sec.x + sec.width > this.x + this.width) { - sec.x = this.x + this.width - sec.width; - } - if (sec.y + sec.height > this.y + this.height) { - sec.y = this.y + this.height - sec.height; - } - return sec.intersect(this); -} - -/* - * Transform class - * - * defines a class of affine transformations - */ -function Transform() { - this.m00 = 1.0; - this.m01 = 0.0; - this.m02 = 0.0; - this.m10 = 0.0; - this.m11 = 1.0; - this.m12 = 0.0; - this.m20 = 0.0; - this.m21 = 0.0; - this.m22 = 1.0; - return this; -} -Transform.prototype.concat = function(traf) { - // add Transform traf to this Transform - for (var i = 0; i < 3; i++) { - for (var j = 0; j < 3; j++) { - var c = 0.0; - for (var k = 0; k < 3; k++) { - c += traf["m"+i+k] * this["m"+k+j]; - } - this["m"+i+j] = c; - } - } - return this; -} -Transform.prototype.transform = function(rect) { - // returns transformed Rectangle or Position with this Transform applied - var x = this.m00 * rect.x + this.m01 * rect.y + this.m02; - var y = this.m10 * rect.x + this.m11 * rect.y + this.m12; - if (rect.width) { - var width = this.m00 * rect.width + this.m01 * rect.height; - var height = this.m10 * rect.width + this.m11 * rect.height; - return new Rectangle(x, y, width, height); - } - return new Position(x, y); -} -Transform.prototype.invtransform = function(pos) { - // returns transformed Position pos with the inverse of this Transform applied - var det = this.m00 * this.m11 - this.m01 * this.m10; - var x = (this.m11 * pos.x - this.m01 * pos.y - this.m11 * this.m02 + this.m01 * this.m12) / det; - var y = (- this.m10 * pos.x + this.m00 * pos.y + this.m10 * this.m02 - this.m00 * this.m12) / det; - return new Position(x, y); -} -function getRotation(angle, pos) { - // returns a Transform that is a rotation by angle degrees around [pos.x, pos.y] - var traf = new Transform(); - if (angle != 0) { - var t = 2.0 * Math.PI * parseFloat(angle) / 360.0; - traf.m00 = Math.cos(t); - traf.m01 = - Math.sin(t); - traf.m10 = Math.sin(t); - traf.m11 = Math.cos(t); - traf.m02 = pos.x - pos.x * Math.cos(t) + pos.y * Math.sin(t); - traf.m12 = pos.y - pos.x * Math.sin(t) - pos.y * Math.cos(t); - } - return traf; -} -function getTranslation(pos) { - // returns a Transform that is a translation by [pos.x, pos,y] - var traf = new Transform(); - traf.m02 = pos.x; - traf.m12 = pos.y; - return traf; -} -function getScale(size) { - // returns a Transform that is a scale by [size.width, size.height] - var traf = new Transform(); - traf.m00 = size.width; - traf.m11 = size.height; - return traf; -} - - -/* ********************************************** - * parameter routines - * ******************************************** */ - -function newParameter(name, defaultValue, detail) { - // create a new parameter with a name and a default value - if (defined(dlParams[name])) { - alert("Fatal: An object with name '" + name + "' already exists - cannot recreate!"); - return false; - } else { - dlParams[name] = new Object(); - dlParams[name].defaultValue = defaultValue; - dlParams[name].hasValue = false; - dlParams[name].value = defaultValue; - dlParams[name].detail = detail; - return dlParams[name]; - } -} - -function getParameter(name) { - // returns the named parameter value or its default value - if (defined(dlParams[name])) { - if (dlParams[name].hasValue) { - return dlParams[name].value; - } else { - return dlParams[name].defaultValue; - } - } else { - return null; - } -} - -function setParameter(name, value, relative) { - // sets parameter value (relative values with +/- unless literal) - if (defined(dlParams[name])) { - if ((relative)&&(value.slice)) { - var sign = value.slice(0,1); - if (sign == '+') { - dlParams[name].value = parseFloat(dlParams[name].value) + parseFloat(value.slice(1)); - } else if (sign == '-') { - dlParams[name].value = parseFloat(dlParams[name].value) - parseFloat(value.slice(1)); - } else { - dlParams[name].value = value; - } - } else { - dlParams[name].value = value; - } - dlParams[name].hasValue = true; - return true; - } - return false; -} - -function hasParameter(name) { - // returns if the parameter's value has been set - if (defined(dlParams[name])) { - return dlParams[name].hasValue; - } - return false; -} - -function getAllParameters(detail) { - // returns a string of all parameters in query format - if (! detail) { - detail = 255; - } - var params = new Array(); - for (param in dlParams) { - if (((dlParams[param].detail & detail) > 0)&&(dlParams[param].hasValue)) { - var val = getParameter(param); - if (val != "") { - params.push(param + "=" + val); - } - } - } - return params.join("&"); -} - -function parseParameters(query) { - // gets parameter values from query format string - var params = query.split("&"); - for (var i = 0; i < params.length; i++) { - var keyval = params[i].split("="); - if (keyval.length == 2) { - setParameter(keyval[0], keyval[1]); - } - } -} - - -/* ********************************************** - * HTML/DOM routines - * ******************************************** */ - -function getElement(tagid, quiet) { - // returns the element object with the id tagid - var e; - if (document.getElementById) { - e = document.getElementById(tagid); - } else if (document.all) { - alert("document.all!"); - e = document.all[tagid]; - } else if (document.layers) { - e = document.layers[tagid]; - } - if (e) { - return e; - } else { - if (! quiet) { - alert("unable to find element: "+tagid); - } - return null; - } -} - -function getElementPosition(elem) { - // returns a Position with the position of the element - var x = 0; - var y = 0; - if (defined(elem.offsetParent)) { - // use .offsetLeft for most browsers - var e = elem; - while (e) { - if (browserType.isIE) { - if (browserType.isMac) { - // IE for Mac extraspecial - if (e.offsetParent.tagName == "BODY") { - x += e.clientLeft; - y += e.clientTop; - break; - } - } else { - // special for IE - if ((e.tagName != "TABLE") && (e.tagName != "BODY")) { - x += e.clientLeft; - y += e.clientTop; - } - } - } - x += e.offsetLeft; - y += e.offsetTop; - e = e.offsetParent; - } - } else if (defined(elem.x)) { - // use .x for other (which?) - x = elem.x; - y = elem.y; - } else if (defined(elem.pageX)) { - // use pageX for N4 - x = elem.pageX; - y = elem.pageY; - } else { - alert("unable to get position of "+elem+" (id:"+elem.id+")"); - } - return new Position(getInt(x), getInt(y)); -} - -function getElementSize(elem) { - // returns a Rectangle with the size of the element - var width = 0; - var height = 0; - if (defined(elem.offsetWidth)) { - width = elem.offsetWidth; - height = elem.offsetHeight; - } else if (defined(elem.width)) { - width = elem.width; - height = elem.height; - } else if (defined(elem.clip.width)) { - width = elem.clip.width; - height = elem.clip.height; - } else { - alert("unable to get size of "+elem+" (id:"+elem.id+")"); - } - return new Size(getInt(width), getInt(height)); -} - -function getElementRect(elem) { - // returns a Rectangle with the size and position of the element - var pos = getElementPosition(elem); - var size = getElementSize(elem); - return new Rectangle(pos.x, pos.y, size.width, size.height); -} - -function moveElement(elem, rect) { - // moves and sizes the element - if (elem.style) { - if (defined(rect.x)) { - elem.style.left = Math.round(rect.x) + "px"; - elem.style.top = Math.round(rect.y) + "px"; - } - if (defined(rect.width)) { - elem.style.width = Math.round(rect.width) + "px"; - elem.style.height = Math.round(rect.height) + "px"; - } - } else if (document.layers) { - if (defined(rect.x)) { - elem.pageX = getInt(rect.x); - elem.pageY = getInt(rect.y); - } - if (defined(rect.width)) { - elem.clip.width = getInt(rect.width); - elem.clip.height = getInt(rect.height); - } - } else { - alert("moveelement: no style nor layer property!"); - return false; - } - return true; -} - -function showElement(elem, show) { - // shows or hides the element - if (elem.style) { - if (show) { - elem.style.visibility = "visible"; - } else { - elem.style.visibility = "hidden"; - } - } else if (defined(elem.visibility)) { - if (show) { - elem.visibility = "show"; - } else { - elem.visibility = "hide"; - } - } else { - alert("showelement: no style nor layer property!"); - } - return true; -} - -function isElementVisible(elem) { - // returns of the is shown or hidden - if (elem.style) { - return (elem.style.visibility == "visible"); - } else if (defined(elem.visibility)) { - return (elem.visibility == "show"); - } else { - alert("iselementvisible: no style nor layer property!"); - } -} - -function evtPosition(evt) { - // returns the on-screen Position of the Event - var x; - var y; - evt = (evt) ? evt : window.event; - if (!evt) { - alert("no event found! "+evt); - return; - } - if (defined(evt.pageX)) { - x = parseInt(evt.pageX); - y = parseInt(evt.pageY); - } else if (defined(evt.clientX)) { - x = parseInt(document.body.scrollLeft+evt.clientX); - y = parseInt(document.body.scrollTop+evt.clientY); - } else { - alert("evtPosition: don't know how to deal with "+evt); - } - return new Position(x, y); -} - -function registerEvent(type, elem, handler) { - // register the given event handler on the indicated element - if (elem.addEventListener) { - elem.addEventListener(type, handler, false); - } else { - if (type == "mousedown") { - if (elem.captureEvents) { - elem.captureEvents(Event.MOUSEDOWN); - } - elem.onmousedown = handler; - } else if (type == "mouseup") { - if (elem.captureEvents) { - elem.captureEvents(Event.MOUSEUP); - } - elem.onmouseup = handler; - } else if (type == "mousemove") { - if (elem.captureEvents) { - elem.captureEvents(Event.MOUSEMOVE); - } - elem.onmousemove = handler; - } else if (type == "keypress") { - if (elem.captureEvents) { - elem.captureEvents(Event.KEYPRESS); - } - elem.onkeypress = handler; - } else { - alert("registerEvent: unknown event type "+type); - return false; - } - } - return true; -} - -function unregisterEvent(type, elem, handler) { - // unregister the given event handler from the indicated element - if (elem.removeEventListener) { - elem.removeEventListener(type, handler, false); - } else { - if (type == "mousedown") { - if (elem.releaseEvents) { - elem.releaseEvents(Event.MOUSEDOWN); - } - elem.onmousedown = null; - } else if (type == "mouseup") { - if (elem.releaseEvents) { - elem.releaseEvents(Event.MOUSEUP); - } - elem.onmouseup = null; - } else if (type == "mousemove") { - if (elem.releaseEvents) { - elem.releaseEvents(Event.MOUSEMOVE); - } - elem.onmousemove = null; - } else if (type == "keypress") { - if (elem.releaseEvents) { - elem.releaseEvents(Event.KEYPRESS); - } - elem.onkeypress = null; - } else { - alert("unregisterEvent: unknown event type "+type); - return false; - } - } - return true; -} - - -// old registerXXYY API for compatibility -function registerMouseDown(elem, handler) { - return registerEvent("mousedown", elem, handler); -} -function unregisterMouseDown(elem, handler) { - return unregisterEvent("mousedown", elem, handler); -} -function registerMouseMove(elem, handler) { - return registerEvent("mousemove", elem, handler); -} -function unregisterMouseMove(elem, handler) { - return unregisterEvent("mousemove", elem, handler); -} -function registerKeyDown(handler) { - return registerEvent("keypress", elem, handler); -} - - -function getWinSize() { - // returns a Size with the current window size (mostly from www.quirksmode.org) - var wsize = new Size(100, 100); - if (defined(self.innerHeight)) { - // all except Explorer - if ((self.innerWidth == 0)||(self.innerHeight == 0)) { - // Safari 1.2 (and other) bug - if (parent) { - wsize.height = parent.innerHeight; - wsize.width = parent.innerWidth; - } - } else { - wsize.width = self.innerWidth; - wsize.height = self.innerHeight; - } - } else if (document.documentElement && document.documentElement.clientHeight) { - // Explorer 6 Strict Mode - wsize.width = document.documentElement.clientWidth; - wsize.height = document.documentElement.clientHeight; - } else if (document.body) { - // other Explorers - wsize.width = document.body.clientWidth; - wsize.height = document.body.clientHeight; - } - return wsize; -} - -function openWin(url, name, params) { - // open browser window - var ow = window.open(url, name, params); - ow.focus(); -}
--- a/webapp/src/main/webapp/digicat.html Fri Feb 22 17:14:49 2013 +0100 +++ b/webapp/src/main/webapp/digicat.html Fri Feb 22 17:18:30 2013 +0100 @@ -10,11 +10,10 @@ //this.location = "http://"+location.host+"/docuserver/digitallibrary/digicat.jsp"+location.search; -this.location.replace(this.location.href.replace(/\.html/, ".jsp")); +this.location.replace(this.location.href.replace(/digicat\.html/, "oldskin/digicat.jsp")); // -- End of JavaScript code -------------- --> - -</SCRIPT> +</script> <body> <h1>Digital Library Redirect</h1> @@ -22,10 +21,11 @@ <p>You should automatically be redirected to the Digital Library page. (<tt>digicat.<b>jsp</b></tt>)</p> -<p>If this doesn't happen make shure JavaScript is enabled in your browser. +<p>If this doesn't happen make sure JavaScript is enabled in your browser. The Digital Library pages need JavaScript to work. If your problem still remains, please contact the administrator.</p> <hr> -<address>robert.casties@philo.unibe.ch</address> -</body> </html> +<address>robcast@berlios.de</address> +</body> +</html>
--- a/webapp/src/main/webapp/digicat.jsp Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,39 +0,0 @@ -<%@ page language="java" %><%! -// authentication stuff - robert -// ----------------------------- -// create DocumentBean instance for all JSP requests -digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); - -// initialize DocumentBean instance in JSP init -public void jspInit() { - try { - // set servlet init-parameter - docBean.setConfig(getServletConfig()); - } catch (javax.servlet.ServletException e) { - System.out.println(e); - } -} -%><% - -// parsing the query -// ----------------- - -digilib.servlet.DigilibServletRequest dcRequest = new digilib.servlet.DigilibServletRequest(request); -// check if authentication is needed and redirect if necessary -docBean.doAuthentication(dcRequest, response); - -// set number of pages -dcRequest.setValue("pt", docBean.getNumPages(dcRequest)); -String baseUrl = dcRequest.getAsString("base.url"); -%> -<html> -<head> -<title>Digital Document Library - Digicat</title> -</head> - -<frameset cols="*,90" border="0"> - <frame name="mainFrame" src="oldskin/dcMain.jsp?<%= dcRequest.getAsString() %>" scrolling="auto"> - <frame name="rightFrame" src="oldskin/dcMenu.html" scrolling="no" noresize> -</frameset> - -</html>
--- a/webapp/src/main/webapp/digilib-fail.html Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<html> <head> -<title>Login to digilib</title> -</head> - -<body> -<h1>Login to digilib failed</h1> - -<p>The name and password are incorrect!</p> - -<p>You can use the browser's "Back" button and try again.</p> - -</body> -</html>
--- a/webapp/src/main/webapp/digilib-login.html Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,30 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<html> <head> -<title>Login to digilib</title> -</head> - -<body> - -<h2>This document requires authentication</h2> - -<p>Please enter the name and the password to access this document.<p> - -<form method=POST action=j_security_check> -<table> - <tr> - <td>Name:</td> - <td><input type="text" name="j_username"></td> - </tr> - <tr> - <td>Password:</td> - <td><input type="password" name="j_password"></td> - </tr> - <tr> - <td></td> - <td><input type="SUBMIT" value=" OK "></td> - </tr> - </table> -</form> - -</body> -</html>
--- a/webapp/src/main/webapp/digilib.html Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,29 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<html> -<head> -<title>Digital Library Redirect</title> -</head> - -<script LANGUAGE="JavaScript"> -<!-- Beginning of JavaScript -------- - -// this.location = "http://"+location.host+"/docuserver/digitallibrary/digilib.jsp"+location.search; - -this.location.replace(this.location.href.replace(/\.html/, ".jsp")); - -// -- End of JavaScript code -------------- --> -</script> - -<body> -<h1>Digital Library Redirect</h1> - -<p>You should automatically be redirected to the Digital Library page. - (<tt>digilib.<b>jsp</b></tt>)</p> - -<p>If this doesn't happen make shure JavaScript is enabled in your browser. - The Digital Library pages need JavaScript to work. If your problem still - remains, please contact the administrator.</p> - -<hr> -<address>robert.casties@philo.unibe.ch</address> -</body> </html>
--- a/webapp/src/main/webapp/digilib.jsp Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,40 +0,0 @@ -<%@ page language="java" %><%! -// authentication stuff - robert -// ----------------------------- -// create DocumentBean instance for all JSP requests -digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); - -// initialize DocumentBean instance in JSP init -public void jspInit() { - try { - // set servlet init-parameter - docBean.setConfig(getServletConfig()); - } catch (javax.servlet.ServletException e) { - System.out.println(e); - } -} -%><% - -// parsing the query -// ----------------- - -digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); -// check if authentication is needed and redirect if necessary -docBean.doAuthentication(dlRequest, response); - -String digiURL = "digimage.jsp?" + dlRequest.getAsString(); - -%><html> -<head> -<title>Digital Document Library</title> -</head> - -<frameset cols="*,90" border="0" onload="pageFrame.show()"> - <frame name="mainFrame" src="<%= digiURL %>" scrolling="auto"> - <frameset rows="25,*" border="0"> - <frame name="pageFrame" src="oldskin/pageWin.html" scrolling="no" noresize> - <frame name="rightFrame" src="oldskin/dlMenu.html" scrolling="no" noresize> - </frameset> -</frameset> - -</html>
--- a/webapp/src/main/webapp/digimage.jsp Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,86 +0,0 @@ -<%@ page language="java" %><%! -// -- JSP init ------------- - -// create DocumentBean instance for all JSP requests -digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); - -// initialize DocumentBean instance in JSP init -public void jspInit() { - try { - // set servlet init-parameter - docBean.setConfig(getServletConfig()); - } catch (javax.servlet.ServletException e) { - System.out.println(e); - } -} -// -- end of JSP init ------------- -%><% -// -- JSP request ------------- - -// parsing the query -// ----------------- -digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); -docBean.setRequest(dlRequest); -// check if authentication is needed and redirect if necessary -docBean.doAuthentication(response); -// add number of pages -dlRequest.setValue("pt", docBean.getNumPages()); -// store objects for jsp:include -pageContext.setAttribute("docBean", docBean, PageContext.REQUEST_SCOPE); -%><html> -<head> - <title>Digital Document Library (L1)</title> - <script type="text/javascript" src="baselib.js"></script> - <script type="text/javascript" src="dllib.js"></script> -<script type="text/javascript"> - base_init(); - var dlTarget = window.name; - var baseUrl = '<%= dlRequest.getAsString("base.url") %>'; - var toolbarEnabledURL = window.location.href; - newParameter('fn', '', 1); - newParameter('pn', '1', 1); - newParameter('ws', '1.0', 2); - newParameter('mo', '', 2); - newParameter('wx', '0.0', 4); - newParameter('wy', '0.0', 4); - newParameter('ww', '1.0', 4); - newParameter('wh', '1.0', 4); - newParameter('brgt', '0.0', 4); - newParameter('cont', '0.0', 4); - newParameter('rot', '0.0', 4); - newParameter('rgba', '', 4); - newParameter('rgbm', '', 4); - newParameter('ddpi', '', 8); - newParameter('ddpix', '', 8); - newParameter('ddpiy', '', 8); - newParameter('mk', '', 16); - newParameter('pt', '0', 32); - setParameter('pt', '<%= dlRequest.getAsString("pt") %>'); - document.id='digilib'; - dl_param_init(); -</script> -</head> -<body bgcolor="#666666" onload="dl_init();"> -<% if (dlRequest.hasOption("clop", "noarrows")) { -%><jsp:include page="digimage_img_inc.jsp" /><% -} else { -%><jsp:include page="digimage_tbl_inc.jsp" /><% -} -%> - - <div id="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark1.gif" border="0"></div> - <div id="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark2.gif" border="0"></div> - <div id="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark3.gif" border="0"></div> - <div id="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark4.gif" border="0"></div> - <div id="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark5.gif" border="0"></div> - <div id="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark6.gif" border="0"></div> - <div id="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark7.gif" border="0"></div> - <div id="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark8.gif" border="0"></div> - <div id="eck1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/olinks.gif" border="0"></div> - <div id="eck2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/orechts.gif" border="0"></div> - <div id="eck3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/ulinks.gif" border="0"></div> - <div id="eck4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/urechts.gif" border="0"></div> - -</body> - -</html>
--- a/webapp/src/main/webapp/digimage_img_inc.jsp Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,25 +0,0 @@ -<%@ page language="java" %><% -// retrieve objects from context -digilib.servlet.DocumentBean docBean = (digilib.servlet.DocumentBean) pageContext.getAttribute("docBean", pageContext.REQUEST_SCOPE); -digilib.servlet.DigilibServletRequest dlRequest = docBean.getRequest(); -String ua = request.getHeader("User-Agent"); -boolean isN4 = ((ua.indexOf("Mozilla/4.") > -1)&&(ua.indexOf("MSIE") == -1)); -%> -<% - if (isN4) { -%><ilayer name="scaler"><% - } else { -%><div id="scaler"><% - } -%> -<script type="text/javascript"> -var ps = bestPicSize(getElement('scaler'), 10); -document.write('<img id="pic" src="<%= dlRequest.getAsString("base.url") + "/servlet/Scaler?" + dlRequest.getAsString('s') %>&dw='+ps.width+'&dh='+ps.height+'" />'); -</script> -<% - if (isN4) { -%></ilayer><% - } else { -%></div><% - } -%>
--- a/webapp/src/main/webapp/digimage_tbl_inc.jsp Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,61 +0,0 @@ -<%@ page language="java" %><% -// retrieve objects from context -digilib.servlet.DocumentBean docBean = (digilib.servlet.DocumentBean) pageContext.getAttribute("docBean", PageContext.REQUEST_SCOPE); -digilib.servlet.DigilibServletRequest dlRequest = docBean.getRequest(); -String ua = request.getHeader("User-Agent"); -boolean isN4 = ((ua.indexOf("Mozilla/4.") > -1)&&(ua.indexOf("MSIE") == -1)); -%> -<table border="0" cellpadding="0" cellspacing="0"> - <tr> - <td></td> - <td align="center"><% - if (docBean.canMoveUp()) { - %><a href="javascript:moveBy(0, -0.5)"><img src="img/up.gif" border="0" /></a><% - } - %></td> - <td></td> - </tr> - <tr> - <td valign="center"><% - if (docBean.canMoveLeft()) { - %><a href="javascript:moveBy(-0.5, 0)"><img src="img/left.gif" border="0" /></a><% - } - %></td> - <td> -<% - if(isN4) { - %><ilayer name="scaler"><% - } else { - %><div id="scaler" style="visibility:visible"><% - } -%> -<script type="text/javascript"> -var ps = bestPicSize(getElement('scaler'), 10); -document.write('<img id="pic" src="<%= - dlRequest.getAsString("base.url") + "/servlet/Scaler?" + dlRequest.getAsString('s') -%>&dw='+ps.width+'&dh='+ps.height+'" />'); -</script> -<% - if(isN4) { - %></ilayer><% - } else { - %></div><% - } -%> - </td> - <td valign="center"><% - if (docBean.canMoveRight()) { - %><a href="javascript:moveBy(0.5, 0)"><img src="img/right.gif" border="0" /></a><% - } - %></td> - </tr> - <tr> - <td></td> - <td align="center"><% - if (docBean.canMoveDown()) { - %><a href="javascript:moveBy(0, 0.5)"><img src="img/down.gif" border="0" /></a><% - } - %></td> - <td></td> - </tr> -</table>
--- a/webapp/src/main/webapp/dllib.js Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,616 +0,0 @@ -/* Copyright (C) 2003,2004 IT-Group MPIWG, WTWG Uni Bern and others - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Authors: - Christian Luginbuehl, 01.05.2003 (first version) - DW 24.03.2004 (Changed for digiLib in Zope) - Robert Casties, 8.11.2005 - - ! Requires baselib.js ! - -*/ - - -function identify() { - // used for identifying a digilib instance - // Relato uses that function - lugi - return "Digilib 0.6"; -} - - -/* - * more parameter handling - */ - -function parseArea() { - // returns area Rectangle from current parameters - return new Rectangle(getParameter("wx"), getParameter("wy"), getParameter("ww"), getParameter("wh")); -} - -function setParamFromArea(rect) { - // sets digilib wx etc. from rect - setParameter("wx", cropFloat(rect.x)); - setParameter("wy", cropFloat(rect.y)); - setParameter("ww", cropFloat(rect.width)); - setParameter("wh", cropFloat(rect.height)); - return true; -} - -function parseTrafo(elem) { - // returns Transform from current dlArea and picsize - var picsize = getElementRect(elem); - var trafo = new Transform(); - // subtract area offset and size - trafo.concat(getTranslation(new Position(-dlArea.x, -dlArea.y))); - trafo.concat(getScale(new Size(1/dlArea.width, 1/dlArea.height))); - // scale to screen size - trafo.concat(getScale(picsize)); - trafo.concat(getTranslation(picsize)); - // rotate - //trafo.concat(getRotation(- getParameter("rot"), new Position(0.5*picsize.width, 0.5*picsize.height))); - // mirror - //if (hasFlag("hmir")) { - //trafo.m00 = - trafo.m00; - //} - //if (hasFlag("vmir")) { - //trafo.m11 = - trafo.m11; - //} - return trafo; -} - - -function parseMarks() { - // returns marks array from current parameters - var marks = new Array(); - var ma; - var mk = getParameter("mk"); - if (mk.indexOf(";") >= 0) { - // old format with ";" - ma = mk.split(";"); - } else { - ma = mk.split(","); - } - for (var i = 0; i < ma.length ; i++) { - var pos = ma[i].split("/"); - if (pos.length > 1) { - marks.push(new Position(pos[0], pos[1])); - } - } - return marks; -} - -function getAllMarks() { - // returns a string with all marks in query format - var marks = new Array(); - for (var i = 0; i < dlMarks.length; i++) { - marks.push(cropFloat(dlMarks[i].x) + "/" + cropFloat(dlMarks[i].y)); - } - return marks.join(","); -} - -function addMark(pos) { - // add a mark - dlMarks.push(pos); - setParameter("mk", getAllMarks()); - return true; -} - -function deleteMark() { - // delete the last mark - dlMarks.pop(); - setParameter("mk", getAllMarks()); - return true; -} - -function hasFlag(mode) { - // returns if mode flag is set - return (dlFlags[mode]); -} - -function addFlag(mode) { - // add a mode flag - dlFlags[mode] = mode; - setParameter("mo", getAllFlags()); - return true; -} - -function removeFlag(mode) { - // remove a mode flag - if (dlFlags[mode]) { - delete dlFlags[mode]; - } - setParameter("mo", getAllFlags()); - return true; -} - -function toggleFlag(mode) { - // change a mode flag - if (dlFlags[mode]) { - delete dlFlags[mode]; - } else { - dlFlags[mode] = mode; - } - setParameter("mo", getAllFlags()); - return true; -} - -function getAllFlags() { - // returns a string with all flags in query format - var fa = new Array(); - for (var f in dlFlags) { - if ((f != "")&&(dlFlags[f] != null)) { - fa.push(f); - } - } - return fa.join(","); -} - -function parseFlags() { - // sets dlFlags from the current parameters - var flags = new Object(); - var fa = getParameter("mo").split(","); - for (var i = 0; i < fa.length ; i++) { - var f = fa[i]; - if (f != "") { - flags[f] = f; - } - } - return flags; -} - - -function bestPicSize(elem, inset) { - // returns a Size with the best image size for the given element - if (! defined(inset)) { - inset = 25; - } - var ws = getWinSize(); - var es = getElementPosition(elem); - if (es) { - ws.width = ws.width - es.x - inset; - ws.height = ws.height - es.y - inset; - } - return ws; -} - -function setDLParam(e, s, relative) { - // sets parameter based on HTML event - var nam; - var val; - if (s.type && (s.type == "select-one")) { - nam = s.name; - val = s.options[s.selectedIndex].value; - } else if (s.name && s.value) { - nam = s.name; - val = s.value; - } - if (nam && val) { - setParameter(nam, val, relative); - display(); - } else { - alert("ERROR: unable to process event!"); - } - return true; -} - - -/* ********************************************** - * digilib specific routines - * ******************************************** */ - - -function dl_param_init() { - // parameter initialisation before onload - if (!baseScriptVersion) { - base_init(); - } - dlScriptVersion = "1.2b"; - dlArea = new Rectangle(0.0, 0.0, 1.0, 1.0); - dlMaxArea = new Rectangle(0.0, 0.0, 1.0, 1.0); - dlTrafo = new Transform(); - dlMarks = new Array(); - dlFlags = new Object(); - elemScaler = null; - picElem = null; - ZOOMFACTOR = Math.sqrt(2); - - // put the query parameters (sans "?") in the parameters array - parseParameters(location.search.slice(1)); - // treat special parameters - dlMarks = parseMarks(); - dlArea = parseArea(); - dlFlags = parseFlags(); -} - - -function dl_init() { - // initalisation on load - if (!dlScriptVersion) { - dl_param_init(); - } - elemScaler = getElement("scaler", true); - picElem = getElement("pic", true); - if (picElem == null && elemScaler) { - // in N4 pic is in the scaler layer - picElem = elemScaler.document.images[0]; - } - if ((!elemScaler)||(!picElem)) { - alert("Sorry, digilib doesn't work here!"); - return false; - } - // give a name to the window containing digilib - if (defined(dlTarget)&&(dlTarget)) { - window.name = dlTarget; - } else { - window.name = "digilib"; - } - // put the query parameters (sans "?") in the parameters array - parseParameters(location.search.slice(1)); - // treat special parameters - dlMarks = parseMarks(); - dlArea = parseArea(); - dlFlags = parseFlags(); - // wait for image to load and display marks - renderMarks(); - // done - focus(); - return; -} - - -function display(detail) { - // redisplay the page - if (! detail) { - detail = 255; - } - var queryString = getAllParameters(detail); - location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString; -} - - -/* ********************************************** - * interactive digilib functions - * ******************************************** */ - - -function renderMarks() { - // put the visible marks on the image - var mark_count = dlMarks.length; - // make shure the image is loaded so we know its size - if (defined(picElem.complete) && picElem.complete == false && ! browserType.isN4 ) { - setTimeout("renderMarks()", 100); - } else { - dlTrafo = parseTrafo(picElem); - for (var i = 0; i < 8; i++) { - var me = getElement("dot"+i); - if (i < mark_count) { - if (dlArea.containsPosition(dlMarks[i])) { - var mpos = dlTrafo.transform(dlMarks[i]); - // suboptimal to place -5 pixels and not half size of mark-image - mpos.x = mpos.x -5; - mpos.y = mpos.y -5; - moveElement(me, mpos); - showElement(me, true); - } - } else { - // hide the other marks - showElement(me, false); - } - } - } -} - - -function setMark(reload) { - // add a mark where clicked - if ( dlMarks.length > 7 ) { - alert("Only 8 marks are possible at the moment!"); - return; - } - window.focus(); - - function markEvent(evt) { - // event handler adding a new mark - unregisterEvent("mousedown", elemScaler, markEvent); - var p = dlTrafo.invtransform(evtPosition(evt)); - addMark(p); - if (defined(reload)&&(!reload)) { - // don't redisplay - renderMarks(); - return; - } - display(); - } - - // starting event capture - registerEvent("mousedown", elemScaler, markEvent); -} - - -function removeMark(reload) { - // remove the last mark - deleteMark(); - if (defined(reload)&&(!reload)) { - // don't redisplay - renderMarks(); - return; - } - display(); -} - - -function zoomArea() { - var click = 1; - var pt1, pt2; - var eck1pos, eck2pos, eck3pos, eck4pos; - window.focus(); - var eck1 = getElement("eck1"); - var eck2 = getElement("eck2"); - var eck3 = getElement("eck3"); - var eck4 = getElement("eck4"); - - function zoomClick(evt) { - // mouse click handler - if (click == 1) { - // first click -- start moving - click = 2; - pt1 = evtPosition(evt); - pt2 = pt1; - eck1pos = pt1; - eck2pos = new Position(pt1.x - 12, pt1.y); - eck3pos = new Position(pt1.x, pt1.y - 12); - eck4pos = new Position(pt1.y - 12, pt1.y - 12); - moveElement(eck1, eck1pos); - moveElement(eck2, eck2pos); - moveElement(eck3, eck3pos); - moveElement(eck4, eck4pos); - showElement(eck1, true); - showElement(eck2, true); - showElement(eck3, true); - showElement(eck4, true); - // show moving - registerEvent("mousemove", elemScaler, zoomMove); - registerEvent("mousemove", eck4, zoomMove); - // enable drag-to-zoom - registerEvent("mouseup", elemScaler, zoomClick); - registerEvent("mouseup", eck4, zoomClick); - } else { - // second click -- end moving - pt2 = evtPosition(evt); - showElement(eck1, false); - showElement(eck2, false); - showElement(eck3, false); - showElement(eck4, false); - unregisterEvent("mousemove", elemScaler, zoomMove); - unregisterEvent("mousemove", eck4, zoomMove); - unregisterEvent("mousedown", elemScaler, zoomClick); - unregisterEvent("mousedown", eck4, zoomClick); - var p1 = dlTrafo.invtransform(pt1); - var p2 = dlTrafo.invtransform(pt2); - var ww = p2.x-p1.x; - var wh = p2.y-p1.y; - if ((ww > 0)&&(wh > 0)) { - setParameter("wx", cropFloat(p1.x)); - setParameter("wy", cropFloat(p1.y)); - setParameter("ww", cropFloat(ww)); - setParameter("wh", cropFloat(wh)); - parseArea(); - // zoomed is always fit - setParameter("ws", 1); - display(); - } - } - } - - function zoomMove(evt) { - // mouse move handler - pt2 = evtPosition(evt); - // restrict marks to move right and down - eck1pos = pt1; - eck2pos = new Position(Math.max(pt1.x, pt2.x)-12, pt1.y); - eck3pos = new Position(pt1.x, Math.max(pt1.y, pt2.y)-12); - eck4pos = new Position(Math.max(pt1.x, pt2.x)-12, Math.max(pt1.y, pt2.y)-12); - moveElement(eck1, eck1pos); - moveElement(eck2, eck2pos); - moveElement(eck3, eck3pos); - moveElement(eck4, eck4pos); - } - - // starting event capture - registerEvent("mousedown", elemScaler, zoomClick); - registerEvent("mousedown", eck4, zoomClick); -} - -function zoomBy(factor) { - // zooms by the given factor - var newarea = dlArea.copy(); - newarea.width /= factor; - newarea.height /= factor; - newarea.x -= 0.5 * (newarea.width - dlArea.width); - newarea.y -= 0.5 * (newarea.height - dlArea.height); - newarea = dlMaxArea.fit(newarea); - setParamFromArea(newarea); - display(); -} - - -function zoomFullpage() { - // zooms out to show the whole image - setParameter("wx", 0.0); - setParameter("wy", 0.0); - setParameter("ww", 1.0); - setParameter("wh", 1.0); - display(); -} - - -function moveCenter() { - // move visible area so that it's centered around the clicked point - if ( (dlArea.width == 1.0) && (dlArea.height == 1.0) ) { - // nothing to do - return; - } - window.focus(); - - function moveCenterEvent(evt) { - // move to handler - unregisterEvent("mousedown", elemScaler, moveCenterEvent); - var pt = dlTrafo.invtransform(evtPosition(evt)); - var newarea = new Rectangle(pt.x-0.5*dlArea.width, pt.y-0.5*dlArea.height, dlArea.width, dlArea.height); - newarea = dlMaxArea.fit(newarea); - // set parameters - setParamFromArea(newarea); - parseArea(); - display(); - } - - // starting event capture - registerEvent("mousedown", elemScaler, moveCenterEvent); -} - -function moveBy(movx, movy) { - // move visible area by movx and movy (in units of ww, wh) - if ((dlArea.width == 1.0)&&(dlArea.height == 1.0)) { - // nothing to do - return; - } - var newarea = dlArea.copy(); - newarea.x += parseFloat(movx)*dlArea.width; - newarea.y += parseFloat(movy)*dlArea.height; - newarea = dlMaxArea.fit(newarea); - // set parameters - setParamFromArea(newarea); - parseArea(); - display(); -} - -function getRef() { - // returns a reference to the current digilib set - if (! baseUrl) { - var baseUrl = location.protocol + "//" + location.host + location.pathname; - } - var hyperlinkRef = baseUrl; - var par = getAllParameters(7+16); // all without ddpi, pt - if (par.length > 0) { - hyperlinkRef += "?" + par; - } - return hyperlinkRef; -} - -function getRefWin(type, msg) { - // shows an alert with a reference to the current digilib set - if (! msg) { - msg = "Link for HTML documents"; - } - prompt(msg, getRef()); -} - -function getQuality() { - // returns the current q setting - for (var i = 0; i < 3; i++) { - if (hasFlag("q"+i)) { - return i; - } - } - return 1 -} - -function setQuality(qual) { - // set the image quality - for (var i = 0; i < 3; i++) { - removeFlag("q"+i); - if (i == qual) { - addFlag("q"+i); - } - } - setParameter("mo", getAllFlags()); - display(); -} - -function setQualityWin(msg) { - // dialog for setting quality - if (! msg) { - msg = "Quality (0..2)"; - } - var q = getQuality(); - var newq = window.prompt(msg, q); - if (newq) { - setQuality(newq); - } -} - -function mirror(dir) { - // mirror the image horizontally or vertically - if (dir == "h") { - toggleFlag("hmir"); - } else { - toggleFlag("vmir"); - } - setParameter("mo", getAllFlags()); - display(); -} - -function gotoPage(gopage, keep) { - // goto given page nr (+/-: relative) - var oldpn = parseInt(getParameter("pn")); - // try setParameter with relative value - setParameter("pn", gopage, true); - // check the result - var pn = parseInt(getParameter("pn")); - if (pn < 1) { - alert("No such page! (Page number too low)"); - setParameter("pn", oldpn); - return; - } - if (hasParameter("pt")) { - pt = parseInt(getParameter("pt")) - if (pn > pt) { - alert("No such page! (Page number too high)"); - setParameter("pn", oldpn); - return; - } - } - if (keep) { - display(15+32); // all, no mark - } else { - display(3+32); // fn, pn, ws, mo + pt - } -} - -function gotoPageWin() { - // dialog to ask for new page nr - var pn = getParameter("pn"); - var gopage = window.prompt("Go to page", pn); - if (gopage) { - gotoPage(gopage); - } -} - -function setParamWin(param, text, relative) { - // dialog to ask for new parameter value - var val = getParameter(param); - var newval = window.prompt(text, val); - if (newval) { - setParameter(param, newval, relative); - display(); - } -} - -function showOptions(show) { - // show or hide option div - var elem = getElement("dloptions"); - showElement(elem, show); -} \ No newline at end of file
--- a/webapp/src/main/webapp/empty.html Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,8 +0,0 @@ -<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> -<html> -<head> -</head> - -<body> -</body> -</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/greyskin/digilib.html Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,29 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +<title>Digital Library Redirect</title> +</head> + +<script LANGUAGE="JavaScript"> +<!-- Beginning of JavaScript -------- + +// this.location = "http://"+location.host+"/docuserver/digitallibrary/digilib.jsp"+location.search; + +this.location.replace(this.location.href.replace(/digilib\.html/, "diginew.jsp")); + +// -- End of JavaScript code -------------- --> +</script> + +<body> +<h1>Digital Library Redirect</h1> + +<p>You should automatically be redirected to the Digital Library page. + (<tt>digilib.<b>jsp</b></tt>)</p> + +<p>If this doesn't happen make shure JavaScript is enabled in your browser. + The Digital Library pages need JavaScript to work. If your problem still + remains, please contact the administrator.</p> + +<hr> +<address>robert.casties@philo.unibe.ch</address> +</body> </html>
--- a/webapp/src/main/webapp/jquery/jquery.digilib.js Fri Feb 22 17:14:49 2013 +0100 +++ b/webapp/src/main/webapp/jquery/jquery.digilib.js Fri Feb 22 17:18:30 2013 +0100 @@ -38,7 +38,7 @@ var defaults = { // version of this script - 'version' : 'jquery.digilib.js 2.1.11', + 'version' : 'jquery.digilib.js 2.1.12', // logo url 'logoUrl' : 'img/digilib-logo-text1.png', // homepage url (behind logo) @@ -207,6 +207,12 @@ var pos = url.indexOf('/jquery/'); if (pos > 0) { elemSettings.digilibBaseUrl = url.substring(0, pos); + } else { + // then maybe its the root-digilib.html + 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 @@ -755,7 +761,7 @@ // bind default function (only once) $(data).off('imageInfo', handleImageInfo); $(data).on('imageInfo', handleImageInfo); - var url = settings.digilibBaseUrl + '/ImgInfo-json.jsp'; + var url = settings.digilibBaseUrl + '/spi/ImgInfo-json.jsp'; url += '?' + getParamString(settings, ['fn', 'pn'], defaults); // TODO: better error handling $.getJSON(url, function (json) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/baselib.js Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,638 @@ +/* Copyright (C) 2003,2004 IT-Group MPIWG, WTWG Uni Bern and others + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Authors: + Christian Luginbuehl, 01.05.2003 (first version) + DW 24.03.2004 (Changed for digiLib in Zope) + Robert Casties, 22.1.2008 + +*/ + +function base_init() { + // init function + baseScriptVersion = "1.2.4"; + dlParams = new Object(); + browserType = getBrowserType(); +} + + +function getInt(n) { + // returns always an integer + n = parseInt(n); + if (isNaN(n)) return 0; + return n; +} + +function defined(x) { + // returns if x is defined + return (typeof arguments[0] != "undefined"); +} + +function cropFloat(x) { + // auxiliary function to crop senseless precision + return parseInt(10000*x)/10000; +} + +function getBrowserType() { + // browser sniffer + var bt = Object(); + bt.doDHTML = false; + bt.versIE = 0; + + if ((! document.cssonly && document.layers) || document.all || document.getElementById) { + var vers = navigator.appVersion.split('MSIE '); + vers = vers[vers.length - 1]; + bt.versIE = getInt(vers); + bt.isIE = navigator.userAgent.indexOf('MSIE') >= 0; + bt.isMac = navigator.platform.indexOf('Mac') >= 0; + bt.isWin = navigator.platform.indexOf('Win') >= 0; + bt.isN4 = (navigator.userAgent.indexOf('Mozilla/4.') >= 0) && ! bt.isIE; + bt.isIEWin = bt.versIE > 0 && bt.isWin; + if (navigator.appVersion.indexOf('MSIE') < 0 || ! bt.isMac || bt.versIE >= 5) { + bt.doDHTML = true; + bt.isOpera = navigator.userAgent.indexOf(' Opera ') >= 0; + bt.isKonq = navigator.userAgent.indexOf(' Konqueror') >= 0; + } + } + return bt; +} + +// fixes for javascript < 1.2 +if (! Array.prototype.push) { + Array.prototype.push = function(val) { + this[this.length] = val; + return this.length; + } + Array.prototype.pop = function() { + var val = this[this.length-1]; + this.length -= 1; + return val; + } +} + + +/* ********************************************** + * geometry classes + * ******************************************** */ + +/* + * Size class + */ +function Size(w, h) { + this.width = parseFloat(w); + this.height = parseFloat(h); + return this; +} +Size.prototype.toString = function() { + return this.width + "x" + this.height; +} + + +/* + * Position class + */ +function Position(x, y) { + this.x = parseFloat(x); + this.y = parseFloat(y); + return this; +} +Position.prototype.toString = function() { + return this.x + "," + this.y; +} + +/* + * Rectangle class + */ +function Rectangle(x, y, w, h) { + this.x = parseFloat(x); + this.y = parseFloat(y); + this.width = parseFloat(w); + this.height = parseFloat(h); + return this; +} +Rectangle.prototype.toString = function() { + return this.width+"x"+this.height+"@"+this.x+","+this.y; +} +Rectangle.prototype.copy = function() { + // returns a copy of this Rectangle + return new Rectangle(this.x, this.y, this.width, this.height); +} +Rectangle.prototype.getPosition = function() { + // returns the position of this Rectangle + return new Position(this.x, this.y); +} +Rectangle.prototype.getSize = function() { + // returns the size of this Rectangle + return new Size(this.width, this.height); +} +Rectangle.prototype.getArea = function() { + // returns the area of this Rectangle + return (this.width * this.height); +} +Rectangle.prototype.containsPosition = function(pos) { + // returns if the given Position lies in this Rectangle + return ((pos.x >= this.x)&&(pos.y >= this.y)&&(pos.x <= this.x+this.width)&&(pos.y <= this.y+this.width)); +} +Rectangle.prototype.intersect = function(rect) { + // returns the intersection of the given Rectangle and this one + var sec = rect.copy(); + if (sec.x < this.x) { + sec.width = sec.width - (this.x - sec.x); + sec.x = this.x; + } + if (sec.y < this.y) { + sec.height = sec.height - (this.y - sec.y); + sec.y = this.y; + } + if (sec.x + sec.width > this.x + this.width) { + sec.width = (this.x + this.width) - sec.x; + } + if (sec.y + sec.height > this.y + this.height) { + sec.height = (this.y + this.height) - sec.y; + } + return sec; +} +Rectangle.prototype.fit = function(rect) { + // returns a Rectangle that fits into this one (by moving first) + var sec = rect.copy(); + sec.x = Math.max(sec.x, this.x); + sec.x = Math.max(sec.x, this.x); + if (sec.x + sec.width > this.x + this.width) { + sec.x = this.x + this.width - sec.width; + } + if (sec.y + sec.height > this.y + this.height) { + sec.y = this.y + this.height - sec.height; + } + return sec.intersect(this); +} + +/* + * Transform class + * + * defines a class of affine transformations + */ +function Transform() { + this.m00 = 1.0; + this.m01 = 0.0; + this.m02 = 0.0; + this.m10 = 0.0; + this.m11 = 1.0; + this.m12 = 0.0; + this.m20 = 0.0; + this.m21 = 0.0; + this.m22 = 1.0; + return this; +} +Transform.prototype.concat = function(traf) { + // add Transform traf to this Transform + for (var i = 0; i < 3; i++) { + for (var j = 0; j < 3; j++) { + var c = 0.0; + for (var k = 0; k < 3; k++) { + c += traf["m"+i+k] * this["m"+k+j]; + } + this["m"+i+j] = c; + } + } + return this; +} +Transform.prototype.transform = function(rect) { + // returns transformed Rectangle or Position with this Transform applied + var x = this.m00 * rect.x + this.m01 * rect.y + this.m02; + var y = this.m10 * rect.x + this.m11 * rect.y + this.m12; + if (rect.width) { + var width = this.m00 * rect.width + this.m01 * rect.height; + var height = this.m10 * rect.width + this.m11 * rect.height; + return new Rectangle(x, y, width, height); + } + return new Position(x, y); +} +Transform.prototype.invtransform = function(pos) { + // returns transformed Position pos with the inverse of this Transform applied + var det = this.m00 * this.m11 - this.m01 * this.m10; + var x = (this.m11 * pos.x - this.m01 * pos.y - this.m11 * this.m02 + this.m01 * this.m12) / det; + var y = (- this.m10 * pos.x + this.m00 * pos.y + this.m10 * this.m02 - this.m00 * this.m12) / det; + return new Position(x, y); +} +function getRotation(angle, pos) { + // returns a Transform that is a rotation by angle degrees around [pos.x, pos.y] + var traf = new Transform(); + if (angle != 0) { + var t = 2.0 * Math.PI * parseFloat(angle) / 360.0; + traf.m00 = Math.cos(t); + traf.m01 = - Math.sin(t); + traf.m10 = Math.sin(t); + traf.m11 = Math.cos(t); + traf.m02 = pos.x - pos.x * Math.cos(t) + pos.y * Math.sin(t); + traf.m12 = pos.y - pos.x * Math.sin(t) - pos.y * Math.cos(t); + } + return traf; +} +function getTranslation(pos) { + // returns a Transform that is a translation by [pos.x, pos,y] + var traf = new Transform(); + traf.m02 = pos.x; + traf.m12 = pos.y; + return traf; +} +function getScale(size) { + // returns a Transform that is a scale by [size.width, size.height] + var traf = new Transform(); + traf.m00 = size.width; + traf.m11 = size.height; + return traf; +} + + +/* ********************************************** + * parameter routines + * ******************************************** */ + +function newParameter(name, defaultValue, detail) { + // create a new parameter with a name and a default value + if (defined(dlParams[name])) { + alert("Fatal: An object with name '" + name + "' already exists - cannot recreate!"); + return false; + } else { + dlParams[name] = new Object(); + dlParams[name].defaultValue = defaultValue; + dlParams[name].hasValue = false; + dlParams[name].value = defaultValue; + dlParams[name].detail = detail; + return dlParams[name]; + } +} + +function getParameter(name) { + // returns the named parameter value or its default value + if (defined(dlParams[name])) { + if (dlParams[name].hasValue) { + return dlParams[name].value; + } else { + return dlParams[name].defaultValue; + } + } else { + return null; + } +} + +function setParameter(name, value, relative) { + // sets parameter value (relative values with +/- unless literal) + if (defined(dlParams[name])) { + if ((relative)&&(value.slice)) { + var sign = value.slice(0,1); + if (sign == '+') { + dlParams[name].value = parseFloat(dlParams[name].value) + parseFloat(value.slice(1)); + } else if (sign == '-') { + dlParams[name].value = parseFloat(dlParams[name].value) - parseFloat(value.slice(1)); + } else { + dlParams[name].value = value; + } + } else { + dlParams[name].value = value; + } + dlParams[name].hasValue = true; + return true; + } + return false; +} + +function hasParameter(name) { + // returns if the parameter's value has been set + if (defined(dlParams[name])) { + return dlParams[name].hasValue; + } + return false; +} + +function getAllParameters(detail) { + // returns a string of all parameters in query format + if (! detail) { + detail = 255; + } + var params = new Array(); + for (param in dlParams) { + if (((dlParams[param].detail & detail) > 0)&&(dlParams[param].hasValue)) { + var val = getParameter(param); + if (val != "") { + params.push(param + "=" + val); + } + } + } + return params.join("&"); +} + +function parseParameters(query) { + // gets parameter values from query format string + var params = query.split("&"); + for (var i = 0; i < params.length; i++) { + var keyval = params[i].split("="); + if (keyval.length == 2) { + setParameter(keyval[0], keyval[1]); + } + } +} + + +/* ********************************************** + * HTML/DOM routines + * ******************************************** */ + +function getElement(tagid, quiet) { + // returns the element object with the id tagid + var e; + if (document.getElementById) { + e = document.getElementById(tagid); + } else if (document.all) { + alert("document.all!"); + e = document.all[tagid]; + } else if (document.layers) { + e = document.layers[tagid]; + } + if (e) { + return e; + } else { + if (! quiet) { + alert("unable to find element: "+tagid); + } + return null; + } +} + +function getElementPosition(elem) { + // returns a Position with the position of the element + var x = 0; + var y = 0; + if (defined(elem.offsetParent)) { + // use .offsetLeft for most browsers + var e = elem; + while (e) { + if (browserType.isIE) { + if (browserType.isMac) { + // IE for Mac extraspecial + if (e.offsetParent.tagName == "BODY") { + x += e.clientLeft; + y += e.clientTop; + break; + } + } else { + // special for IE + if ((e.tagName != "TABLE") && (e.tagName != "BODY")) { + x += e.clientLeft; + y += e.clientTop; + } + } + } + x += e.offsetLeft; + y += e.offsetTop; + e = e.offsetParent; + } + } else if (defined(elem.x)) { + // use .x for other (which?) + x = elem.x; + y = elem.y; + } else if (defined(elem.pageX)) { + // use pageX for N4 + x = elem.pageX; + y = elem.pageY; + } else { + alert("unable to get position of "+elem+" (id:"+elem.id+")"); + } + return new Position(getInt(x), getInt(y)); +} + +function getElementSize(elem) { + // returns a Rectangle with the size of the element + var width = 0; + var height = 0; + if (defined(elem.offsetWidth)) { + width = elem.offsetWidth; + height = elem.offsetHeight; + } else if (defined(elem.width)) { + width = elem.width; + height = elem.height; + } else if (defined(elem.clip.width)) { + width = elem.clip.width; + height = elem.clip.height; + } else { + alert("unable to get size of "+elem+" (id:"+elem.id+")"); + } + return new Size(getInt(width), getInt(height)); +} + +function getElementRect(elem) { + // returns a Rectangle with the size and position of the element + var pos = getElementPosition(elem); + var size = getElementSize(elem); + return new Rectangle(pos.x, pos.y, size.width, size.height); +} + +function moveElement(elem, rect) { + // moves and sizes the element + if (elem.style) { + if (defined(rect.x)) { + elem.style.left = Math.round(rect.x) + "px"; + elem.style.top = Math.round(rect.y) + "px"; + } + if (defined(rect.width)) { + elem.style.width = Math.round(rect.width) + "px"; + elem.style.height = Math.round(rect.height) + "px"; + } + } else if (document.layers) { + if (defined(rect.x)) { + elem.pageX = getInt(rect.x); + elem.pageY = getInt(rect.y); + } + if (defined(rect.width)) { + elem.clip.width = getInt(rect.width); + elem.clip.height = getInt(rect.height); + } + } else { + alert("moveelement: no style nor layer property!"); + return false; + } + return true; +} + +function showElement(elem, show) { + // shows or hides the element + if (elem.style) { + if (show) { + elem.style.visibility = "visible"; + } else { + elem.style.visibility = "hidden"; + } + } else if (defined(elem.visibility)) { + if (show) { + elem.visibility = "show"; + } else { + elem.visibility = "hide"; + } + } else { + alert("showelement: no style nor layer property!"); + } + return true; +} + +function isElementVisible(elem) { + // returns of the is shown or hidden + if (elem.style) { + return (elem.style.visibility == "visible"); + } else if (defined(elem.visibility)) { + return (elem.visibility == "show"); + } else { + alert("iselementvisible: no style nor layer property!"); + } +} + +function evtPosition(evt) { + // returns the on-screen Position of the Event + var x; + var y; + evt = (evt) ? evt : window.event; + if (!evt) { + alert("no event found! "+evt); + return; + } + if (defined(evt.pageX)) { + x = parseInt(evt.pageX); + y = parseInt(evt.pageY); + } else if (defined(evt.clientX)) { + x = parseInt(document.body.scrollLeft+evt.clientX); + y = parseInt(document.body.scrollTop+evt.clientY); + } else { + alert("evtPosition: don't know how to deal with "+evt); + } + return new Position(x, y); +} + +function registerEvent(type, elem, handler) { + // register the given event handler on the indicated element + if (elem.addEventListener) { + elem.addEventListener(type, handler, false); + } else { + if (type == "mousedown") { + if (elem.captureEvents) { + elem.captureEvents(Event.MOUSEDOWN); + } + elem.onmousedown = handler; + } else if (type == "mouseup") { + if (elem.captureEvents) { + elem.captureEvents(Event.MOUSEUP); + } + elem.onmouseup = handler; + } else if (type == "mousemove") { + if (elem.captureEvents) { + elem.captureEvents(Event.MOUSEMOVE); + } + elem.onmousemove = handler; + } else if (type == "keypress") { + if (elem.captureEvents) { + elem.captureEvents(Event.KEYPRESS); + } + elem.onkeypress = handler; + } else { + alert("registerEvent: unknown event type "+type); + return false; + } + } + return true; +} + +function unregisterEvent(type, elem, handler) { + // unregister the given event handler from the indicated element + if (elem.removeEventListener) { + elem.removeEventListener(type, handler, false); + } else { + if (type == "mousedown") { + if (elem.releaseEvents) { + elem.releaseEvents(Event.MOUSEDOWN); + } + elem.onmousedown = null; + } else if (type == "mouseup") { + if (elem.releaseEvents) { + elem.releaseEvents(Event.MOUSEUP); + } + elem.onmouseup = null; + } else if (type == "mousemove") { + if (elem.releaseEvents) { + elem.releaseEvents(Event.MOUSEMOVE); + } + elem.onmousemove = null; + } else if (type == "keypress") { + if (elem.releaseEvents) { + elem.releaseEvents(Event.KEYPRESS); + } + elem.onkeypress = null; + } else { + alert("unregisterEvent: unknown event type "+type); + return false; + } + } + return true; +} + + +// old registerXXYY API for compatibility +function registerMouseDown(elem, handler) { + return registerEvent("mousedown", elem, handler); +} +function unregisterMouseDown(elem, handler) { + return unregisterEvent("mousedown", elem, handler); +} +function registerMouseMove(elem, handler) { + return registerEvent("mousemove", elem, handler); +} +function unregisterMouseMove(elem, handler) { + return unregisterEvent("mousemove", elem, handler); +} +function registerKeyDown(handler) { + return registerEvent("keypress", elem, handler); +} + + +function getWinSize() { + // returns a Size with the current window size (mostly from www.quirksmode.org) + var wsize = new Size(100, 100); + if (defined(self.innerHeight)) { + // all except Explorer + if ((self.innerWidth == 0)||(self.innerHeight == 0)) { + // Safari 1.2 (and other) bug + if (parent) { + wsize.height = parent.innerHeight; + wsize.width = parent.innerWidth; + } + } else { + wsize.width = self.innerWidth; + wsize.height = self.innerHeight; + } + } else if (document.documentElement && document.documentElement.clientHeight) { + // Explorer 6 Strict Mode + wsize.width = document.documentElement.clientWidth; + wsize.height = document.documentElement.clientHeight; + } else if (document.body) { + // other Explorers + wsize.width = document.body.clientWidth; + wsize.height = document.body.clientHeight; + } + return wsize; +} + +function openWin(url, name, params) { + // open browser window + var ow = window.open(url, name, params); + ow.focus(); +}
--- a/webapp/src/main/webapp/oldskin/dcMain.jsp Fri Feb 22 17:14:49 2013 +0100 +++ b/webapp/src/main/webapp/oldskin/dcMain.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -25,14 +25,14 @@ dcRequest.setValue("pt", docBean.getNumPages(dcRequest)); // chop off /oldskin -- ugly ;-( String baseUrl = dcRequest.getAsString("base.url"); -int p = baseUrl.lastIndexOf("/oldskin"); +/* int p = baseUrl.lastIndexOf("/oldskin"); if (p > 0) { baseUrl = baseUrl.substring(0, p); -} +} */ %> <html> <head> -<script type="text/javascript" src="../baselib.js"></script> +<script type="text/javascript" src="baselib.js"></script> <script type="text/javascript" src="dclib.js"></script> <script type="text/javascript"> base_init();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digicat.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,39 @@ +<%@ page language="java" %><%! +// authentication stuff - robert +// ----------------------------- +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><% + +// parsing the query +// ----------------- + +digilib.servlet.DigilibServletRequest dcRequest = new digilib.servlet.DigilibServletRequest(request); +// check if authentication is needed and redirect if necessary +docBean.doAuthentication(dcRequest, response); + +// set number of pages +dcRequest.setValue("pt", docBean.getNumPages(dcRequest)); +String baseUrl = dcRequest.getAsString("base.url"); +%> +<html> +<head> +<title>Digital Document Library - Digicat</title> +</head> + +<frameset cols="*,90" border="0"> + <frame name="mainFrame" src="dcMain.jsp?<%= dcRequest.getAsString() %>" scrolling="auto"> + <frame name="rightFrame" src="dcMenu.html" scrolling="no" noresize> +</frameset> + +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digilib-fail.html Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,14 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> <head> +<title>Login to digilib</title> +</head> + +<body> +<h1>Login to digilib failed</h1> + +<p>The name and password are incorrect!</p> + +<p>You can use the browser's "Back" button and try again.</p> + +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digilib-login.html Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,30 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> <head> +<title>Login to digilib</title> +</head> + +<body> + +<h2>This document requires authentication</h2> + +<p>Please enter the name and the password to access this document.<p> + +<form method=POST action=j_security_check> +<table> + <tr> + <td>Name:</td> + <td><input type="text" name="j_username"></td> + </tr> + <tr> + <td>Password:</td> + <td><input type="password" name="j_password"></td> + </tr> + <tr> + <td></td> + <td><input type="SUBMIT" value=" OK "></td> + </tr> + </table> +</form> + +</body> +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digilib.html Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,29 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +<title>Digital Library Redirect</title> +</head> + +<script LANGUAGE="JavaScript"> +<!-- Beginning of JavaScript -------- + +// this.location = "http://"+location.host+"/docuserver/digitallibrary/digilib.jsp"+location.search; + +this.location.replace(this.location.href.replace(/\.html/, ".jsp")); + +// -- End of JavaScript code -------------- --> +</script> + +<body> +<h1>Digital Library Redirect</h1> + +<p>You should automatically be redirected to the Digital Library page. + (<tt>digilib.<b>jsp</b></tt>)</p> + +<p>If this doesn't happen make shure JavaScript is enabled in your browser. + The Digital Library pages need JavaScript to work. If your problem still + remains, please contact the administrator.</p> + +<hr> +<address>robert.casties@philo.unibe.ch</address> +</body> </html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digilib.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,39 @@ +<%@ page language="java" %><%! +// authentication stuff - robert +// ----------------------------- +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><% + +// parsing the query +// ----------------- + +digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); +// check if authentication is needed and redirect if necessary +docBean.doAuthentication(dlRequest, response); + +String digiURL = "digimage.jsp?" + dlRequest.getAsString(); + +%><html> +<head> +<title>Digital Document Library</title> +</head> +<frameset cols="*,90" border="0" onload="pageFrame.show()"> + <frame name="mainFrame" src="<%= digiURL %>" scrolling="auto"> + <frameset rows="25,*" border="0"> + <frame name="pageFrame" src="pageWin.html" scrolling="no" noresize> + <frame name="rightFrame" src="dlMenu.html" scrolling="no" noresize> + </frameset> +</frameset> + +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digimage.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,86 @@ +<%@ page language="java" %><%! +// -- JSP init ------------- + +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +// -- end of JSP init ------------- +%><% +// -- JSP request ------------- + +// parsing the query +// ----------------- +digilib.servlet.DigilibServletRequest dlRequest = new digilib.servlet.DigilibServletRequest(request); +docBean.setRequest(dlRequest); +// check if authentication is needed and redirect if necessary +docBean.doAuthentication(response); +// add number of pages +dlRequest.setValue("pt", docBean.getNumPages()); +// store objects for jsp:include +pageContext.setAttribute("docBean", docBean, PageContext.REQUEST_SCOPE); +%><html> +<head> + <title>Digital Document Library (L1)</title> + <script type="text/javascript" src="baselib.js"></script> + <script type="text/javascript" src="dllib.js"></script> +<script type="text/javascript"> + base_init(); + var dlTarget = window.name; + var baseUrl = '<%= dlRequest.getAsString("base.url") %>'; + var toolbarEnabledURL = window.location.href; + newParameter('fn', '', 1); + newParameter('pn', '1', 1); + newParameter('ws', '1.0', 2); + newParameter('mo', '', 2); + newParameter('wx', '0.0', 4); + newParameter('wy', '0.0', 4); + newParameter('ww', '1.0', 4); + newParameter('wh', '1.0', 4); + newParameter('brgt', '0.0', 4); + newParameter('cont', '0.0', 4); + newParameter('rot', '0.0', 4); + newParameter('rgba', '', 4); + newParameter('rgbm', '', 4); + newParameter('ddpi', '', 8); + newParameter('ddpix', '', 8); + newParameter('ddpiy', '', 8); + newParameter('mk', '', 16); + newParameter('pt', '0', 32); + setParameter('pt', '<%= dlRequest.getAsString("pt") %>'); + document.id='digilib'; + dl_param_init(); +</script> +</head> +<body bgcolor="#666666" onload="dl_init();"> +<% if (dlRequest.hasOption("clop", "noarrows")) { +%><jsp:include page="digimage_img_inc.jsp" /><% +} else { +%><jsp:include page="digimage_tbl_inc.jsp" /><% +} +%> + + <div id="dot0" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark1.gif" border="0"></div> + <div id="dot1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark2.gif" border="0"></div> + <div id="dot2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark3.gif" border="0"></div> + <div id="dot3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark4.gif" border="0"></div> + <div id="dot4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark5.gif" border="0"></div> + <div id="dot5" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark6.gif" border="0"></div> + <div id="dot6" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark7.gif" border="0"></div> + <div id="dot7" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/mark8.gif" border="0"></div> + <div id="eck1" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/olinks.gif" border="0"></div> + <div id="eck2" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/orechts.gif" border="0"></div> + <div id="eck3" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/ulinks.gif" border="0"></div> + <div id="eck4" style="position:absolute; left:-20; top:100; visibility:hidden"><img src="img/urechts.gif" border="0"></div> + +</body> + +</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digimage_img_inc.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,25 @@ +<%@ page language="java" %><% +// retrieve objects from context +digilib.servlet.DocumentBean docBean = (digilib.servlet.DocumentBean) pageContext.getAttribute("docBean", pageContext.REQUEST_SCOPE); +digilib.servlet.DigilibServletRequest dlRequest = docBean.getRequest(); +String ua = request.getHeader("User-Agent"); +boolean isN4 = ((ua.indexOf("Mozilla/4.") > -1)&&(ua.indexOf("MSIE") == -1)); +%> +<% + if (isN4) { +%><ilayer name="scaler"><% + } else { +%><div id="scaler"><% + } +%> +<script type="text/javascript"> +var ps = bestPicSize(getElement('scaler'), 10); +document.write('<img id="pic" src="<%= dlRequest.getAsString("base.url") + "/servlet/Scaler?" + dlRequest.getAsString('s') %>&dw='+ps.width+'&dh='+ps.height+'" />'); +</script> +<% + if (isN4) { +%></ilayer><% + } else { +%></div><% + } +%>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/digimage_tbl_inc.jsp Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,61 @@ +<%@ page language="java" %><% +// retrieve objects from context +digilib.servlet.DocumentBean docBean = (digilib.servlet.DocumentBean) pageContext.getAttribute("docBean", PageContext.REQUEST_SCOPE); +digilib.servlet.DigilibServletRequest dlRequest = docBean.getRequest(); +String ua = request.getHeader("User-Agent"); +boolean isN4 = ((ua.indexOf("Mozilla/4.") > -1)&&(ua.indexOf("MSIE") == -1)); +%> +<table border="0" cellpadding="0" cellspacing="0"> + <tr> + <td></td> + <td align="center"><% + if (docBean.canMoveUp()) { + %><a href="javascript:moveBy(0, -0.5)"><img src="img/up.gif" border="0" /></a><% + } + %></td> + <td></td> + </tr> + <tr> + <td valign="center"><% + if (docBean.canMoveLeft()) { + %><a href="javascript:moveBy(-0.5, 0)"><img src="img/left.gif" border="0" /></a><% + } + %></td> + <td> +<% + if(isN4) { + %><ilayer name="scaler"><% + } else { + %><div id="scaler" style="visibility:visible"><% + } +%> +<script type="text/javascript"> +var ps = bestPicSize(getElement('scaler'), 10); +document.write('<img id="pic" src="<%= + dlRequest.getAsString("base.url") + "/servlet/Scaler?" + dlRequest.getAsString('s') +%>&dw='+ps.width+'&dh='+ps.height+'" />'); +</script> +<% + if(isN4) { + %></ilayer><% + } else { + %></div><% + } +%> + </td> + <td valign="center"><% + if (docBean.canMoveRight()) { + %><a href="javascript:moveBy(0.5, 0)"><img src="img/right.gif" border="0" /></a><% + } + %></td> + </tr> + <tr> + <td></td> + <td align="center"><% + if (docBean.canMoveDown()) { + %><a href="javascript:moveBy(0, 0.5)"><img src="img/down.gif" border="0" /></a><% + } + %></td> + <td></td> + </tr> +</table>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/dllib.js Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,616 @@ +/* Copyright (C) 2003,2004 IT-Group MPIWG, WTWG Uni Bern and others + +This program is free software; you can redistribute it and/or +modify it under the terms of the GNU General Public License +as published by the Free Software Foundation; either version 2 +of the License, or (at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA + +Authors: + Christian Luginbuehl, 01.05.2003 (first version) + DW 24.03.2004 (Changed for digiLib in Zope) + Robert Casties, 8.11.2005 + + ! Requires baselib.js ! + +*/ + + +function identify() { + // used for identifying a digilib instance + // Relato uses that function - lugi + return "Digilib 0.6"; +} + + +/* + * more parameter handling + */ + +function parseArea() { + // returns area Rectangle from current parameters + return new Rectangle(getParameter("wx"), getParameter("wy"), getParameter("ww"), getParameter("wh")); +} + +function setParamFromArea(rect) { + // sets digilib wx etc. from rect + setParameter("wx", cropFloat(rect.x)); + setParameter("wy", cropFloat(rect.y)); + setParameter("ww", cropFloat(rect.width)); + setParameter("wh", cropFloat(rect.height)); + return true; +} + +function parseTrafo(elem) { + // returns Transform from current dlArea and picsize + var picsize = getElementRect(elem); + var trafo = new Transform(); + // subtract area offset and size + trafo.concat(getTranslation(new Position(-dlArea.x, -dlArea.y))); + trafo.concat(getScale(new Size(1/dlArea.width, 1/dlArea.height))); + // scale to screen size + trafo.concat(getScale(picsize)); + trafo.concat(getTranslation(picsize)); + // rotate + //trafo.concat(getRotation(- getParameter("rot"), new Position(0.5*picsize.width, 0.5*picsize.height))); + // mirror + //if (hasFlag("hmir")) { + //trafo.m00 = - trafo.m00; + //} + //if (hasFlag("vmir")) { + //trafo.m11 = - trafo.m11; + //} + return trafo; +} + + +function parseMarks() { + // returns marks array from current parameters + var marks = new Array(); + var ma; + var mk = getParameter("mk"); + if (mk.indexOf(";") >= 0) { + // old format with ";" + ma = mk.split(";"); + } else { + ma = mk.split(","); + } + for (var i = 0; i < ma.length ; i++) { + var pos = ma[i].split("/"); + if (pos.length > 1) { + marks.push(new Position(pos[0], pos[1])); + } + } + return marks; +} + +function getAllMarks() { + // returns a string with all marks in query format + var marks = new Array(); + for (var i = 0; i < dlMarks.length; i++) { + marks.push(cropFloat(dlMarks[i].x) + "/" + cropFloat(dlMarks[i].y)); + } + return marks.join(","); +} + +function addMark(pos) { + // add a mark + dlMarks.push(pos); + setParameter("mk", getAllMarks()); + return true; +} + +function deleteMark() { + // delete the last mark + dlMarks.pop(); + setParameter("mk", getAllMarks()); + return true; +} + +function hasFlag(mode) { + // returns if mode flag is set + return (dlFlags[mode]); +} + +function addFlag(mode) { + // add a mode flag + dlFlags[mode] = mode; + setParameter("mo", getAllFlags()); + return true; +} + +function removeFlag(mode) { + // remove a mode flag + if (dlFlags[mode]) { + delete dlFlags[mode]; + } + setParameter("mo", getAllFlags()); + return true; +} + +function toggleFlag(mode) { + // change a mode flag + if (dlFlags[mode]) { + delete dlFlags[mode]; + } else { + dlFlags[mode] = mode; + } + setParameter("mo", getAllFlags()); + return true; +} + +function getAllFlags() { + // returns a string with all flags in query format + var fa = new Array(); + for (var f in dlFlags) { + if ((f != "")&&(dlFlags[f] != null)) { + fa.push(f); + } + } + return fa.join(","); +} + +function parseFlags() { + // sets dlFlags from the current parameters + var flags = new Object(); + var fa = getParameter("mo").split(","); + for (var i = 0; i < fa.length ; i++) { + var f = fa[i]; + if (f != "") { + flags[f] = f; + } + } + return flags; +} + + +function bestPicSize(elem, inset) { + // returns a Size with the best image size for the given element + if (! defined(inset)) { + inset = 25; + } + var ws = getWinSize(); + var es = getElementPosition(elem); + if (es) { + ws.width = ws.width - es.x - inset; + ws.height = ws.height - es.y - inset; + } + return ws; +} + +function setDLParam(e, s, relative) { + // sets parameter based on HTML event + var nam; + var val; + if (s.type && (s.type == "select-one")) { + nam = s.name; + val = s.options[s.selectedIndex].value; + } else if (s.name && s.value) { + nam = s.name; + val = s.value; + } + if (nam && val) { + setParameter(nam, val, relative); + display(); + } else { + alert("ERROR: unable to process event!"); + } + return true; +} + + +/* ********************************************** + * digilib specific routines + * ******************************************** */ + + +function dl_param_init() { + // parameter initialisation before onload + if (!baseScriptVersion) { + base_init(); + } + dlScriptVersion = "1.2b"; + dlArea = new Rectangle(0.0, 0.0, 1.0, 1.0); + dlMaxArea = new Rectangle(0.0, 0.0, 1.0, 1.0); + dlTrafo = new Transform(); + dlMarks = new Array(); + dlFlags = new Object(); + elemScaler = null; + picElem = null; + ZOOMFACTOR = Math.sqrt(2); + + // put the query parameters (sans "?") in the parameters array + parseParameters(location.search.slice(1)); + // treat special parameters + dlMarks = parseMarks(); + dlArea = parseArea(); + dlFlags = parseFlags(); +} + + +function dl_init() { + // initalisation on load + if (!dlScriptVersion) { + dl_param_init(); + } + elemScaler = getElement("scaler", true); + picElem = getElement("pic", true); + if (picElem == null && elemScaler) { + // in N4 pic is in the scaler layer + picElem = elemScaler.document.images[0]; + } + if ((!elemScaler)||(!picElem)) { + alert("Sorry, digilib doesn't work here!"); + return false; + } + // give a name to the window containing digilib + if (defined(dlTarget)&&(dlTarget)) { + window.name = dlTarget; + } else { + window.name = "digilib"; + } + // put the query parameters (sans "?") in the parameters array + parseParameters(location.search.slice(1)); + // treat special parameters + dlMarks = parseMarks(); + dlArea = parseArea(); + dlFlags = parseFlags(); + // wait for image to load and display marks + renderMarks(); + // done + focus(); + return; +} + + +function display(detail) { + // redisplay the page + if (! detail) { + detail = 255; + } + var queryString = getAllParameters(detail); + location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString; +} + + +/* ********************************************** + * interactive digilib functions + * ******************************************** */ + + +function renderMarks() { + // put the visible marks on the image + var mark_count = dlMarks.length; + // make shure the image is loaded so we know its size + if (defined(picElem.complete) && picElem.complete == false && ! browserType.isN4 ) { + setTimeout("renderMarks()", 100); + } else { + dlTrafo = parseTrafo(picElem); + for (var i = 0; i < 8; i++) { + var me = getElement("dot"+i); + if (i < mark_count) { + if (dlArea.containsPosition(dlMarks[i])) { + var mpos = dlTrafo.transform(dlMarks[i]); + // suboptimal to place -5 pixels and not half size of mark-image + mpos.x = mpos.x -5; + mpos.y = mpos.y -5; + moveElement(me, mpos); + showElement(me, true); + } + } else { + // hide the other marks + showElement(me, false); + } + } + } +} + + +function setMark(reload) { + // add a mark where clicked + if ( dlMarks.length > 7 ) { + alert("Only 8 marks are possible at the moment!"); + return; + } + window.focus(); + + function markEvent(evt) { + // event handler adding a new mark + unregisterEvent("mousedown", elemScaler, markEvent); + var p = dlTrafo.invtransform(evtPosition(evt)); + addMark(p); + if (defined(reload)&&(!reload)) { + // don't redisplay + renderMarks(); + return; + } + display(); + } + + // starting event capture + registerEvent("mousedown", elemScaler, markEvent); +} + + +function removeMark(reload) { + // remove the last mark + deleteMark(); + if (defined(reload)&&(!reload)) { + // don't redisplay + renderMarks(); + return; + } + display(); +} + + +function zoomArea() { + var click = 1; + var pt1, pt2; + var eck1pos, eck2pos, eck3pos, eck4pos; + window.focus(); + var eck1 = getElement("eck1"); + var eck2 = getElement("eck2"); + var eck3 = getElement("eck3"); + var eck4 = getElement("eck4"); + + function zoomClick(evt) { + // mouse click handler + if (click == 1) { + // first click -- start moving + click = 2; + pt1 = evtPosition(evt); + pt2 = pt1; + eck1pos = pt1; + eck2pos = new Position(pt1.x - 12, pt1.y); + eck3pos = new Position(pt1.x, pt1.y - 12); + eck4pos = new Position(pt1.y - 12, pt1.y - 12); + moveElement(eck1, eck1pos); + moveElement(eck2, eck2pos); + moveElement(eck3, eck3pos); + moveElement(eck4, eck4pos); + showElement(eck1, true); + showElement(eck2, true); + showElement(eck3, true); + showElement(eck4, true); + // show moving + registerEvent("mousemove", elemScaler, zoomMove); + registerEvent("mousemove", eck4, zoomMove); + // enable drag-to-zoom + registerEvent("mouseup", elemScaler, zoomClick); + registerEvent("mouseup", eck4, zoomClick); + } else { + // second click -- end moving + pt2 = evtPosition(evt); + showElement(eck1, false); + showElement(eck2, false); + showElement(eck3, false); + showElement(eck4, false); + unregisterEvent("mousemove", elemScaler, zoomMove); + unregisterEvent("mousemove", eck4, zoomMove); + unregisterEvent("mousedown", elemScaler, zoomClick); + unregisterEvent("mousedown", eck4, zoomClick); + var p1 = dlTrafo.invtransform(pt1); + var p2 = dlTrafo.invtransform(pt2); + var ww = p2.x-p1.x; + var wh = p2.y-p1.y; + if ((ww > 0)&&(wh > 0)) { + setParameter("wx", cropFloat(p1.x)); + setParameter("wy", cropFloat(p1.y)); + setParameter("ww", cropFloat(ww)); + setParameter("wh", cropFloat(wh)); + parseArea(); + // zoomed is always fit + setParameter("ws", 1); + display(); + } + } + } + + function zoomMove(evt) { + // mouse move handler + pt2 = evtPosition(evt); + // restrict marks to move right and down + eck1pos = pt1; + eck2pos = new Position(Math.max(pt1.x, pt2.x)-12, pt1.y); + eck3pos = new Position(pt1.x, Math.max(pt1.y, pt2.y)-12); + eck4pos = new Position(Math.max(pt1.x, pt2.x)-12, Math.max(pt1.y, pt2.y)-12); + moveElement(eck1, eck1pos); + moveElement(eck2, eck2pos); + moveElement(eck3, eck3pos); + moveElement(eck4, eck4pos); + } + + // starting event capture + registerEvent("mousedown", elemScaler, zoomClick); + registerEvent("mousedown", eck4, zoomClick); +} + +function zoomBy(factor) { + // zooms by the given factor + var newarea = dlArea.copy(); + newarea.width /= factor; + newarea.height /= factor; + newarea.x -= 0.5 * (newarea.width - dlArea.width); + newarea.y -= 0.5 * (newarea.height - dlArea.height); + newarea = dlMaxArea.fit(newarea); + setParamFromArea(newarea); + display(); +} + + +function zoomFullpage() { + // zooms out to show the whole image + setParameter("wx", 0.0); + setParameter("wy", 0.0); + setParameter("ww", 1.0); + setParameter("wh", 1.0); + display(); +} + + +function moveCenter() { + // move visible area so that it's centered around the clicked point + if ( (dlArea.width == 1.0) && (dlArea.height == 1.0) ) { + // nothing to do + return; + } + window.focus(); + + function moveCenterEvent(evt) { + // move to handler + unregisterEvent("mousedown", elemScaler, moveCenterEvent); + var pt = dlTrafo.invtransform(evtPosition(evt)); + var newarea = new Rectangle(pt.x-0.5*dlArea.width, pt.y-0.5*dlArea.height, dlArea.width, dlArea.height); + newarea = dlMaxArea.fit(newarea); + // set parameters + setParamFromArea(newarea); + parseArea(); + display(); + } + + // starting event capture + registerEvent("mousedown", elemScaler, moveCenterEvent); +} + +function moveBy(movx, movy) { + // move visible area by movx and movy (in units of ww, wh) + if ((dlArea.width == 1.0)&&(dlArea.height == 1.0)) { + // nothing to do + return; + } + var newarea = dlArea.copy(); + newarea.x += parseFloat(movx)*dlArea.width; + newarea.y += parseFloat(movy)*dlArea.height; + newarea = dlMaxArea.fit(newarea); + // set parameters + setParamFromArea(newarea); + parseArea(); + display(); +} + +function getRef() { + // returns a reference to the current digilib set + if (! baseUrl) { + var baseUrl = location.protocol + "//" + location.host + location.pathname; + } + var hyperlinkRef = baseUrl; + var par = getAllParameters(7+16); // all without ddpi, pt + if (par.length > 0) { + hyperlinkRef += "?" + par; + } + return hyperlinkRef; +} + +function getRefWin(type, msg) { + // shows an alert with a reference to the current digilib set + if (! msg) { + msg = "Link for HTML documents"; + } + prompt(msg, getRef()); +} + +function getQuality() { + // returns the current q setting + for (var i = 0; i < 3; i++) { + if (hasFlag("q"+i)) { + return i; + } + } + return 1 +} + +function setQuality(qual) { + // set the image quality + for (var i = 0; i < 3; i++) { + removeFlag("q"+i); + if (i == qual) { + addFlag("q"+i); + } + } + setParameter("mo", getAllFlags()); + display(); +} + +function setQualityWin(msg) { + // dialog for setting quality + if (! msg) { + msg = "Quality (0..2)"; + } + var q = getQuality(); + var newq = window.prompt(msg, q); + if (newq) { + setQuality(newq); + } +} + +function mirror(dir) { + // mirror the image horizontally or vertically + if (dir == "h") { + toggleFlag("hmir"); + } else { + toggleFlag("vmir"); + } + setParameter("mo", getAllFlags()); + display(); +} + +function gotoPage(gopage, keep) { + // goto given page nr (+/-: relative) + var oldpn = parseInt(getParameter("pn")); + // try setParameter with relative value + setParameter("pn", gopage, true); + // check the result + var pn = parseInt(getParameter("pn")); + if (pn < 1) { + alert("No such page! (Page number too low)"); + setParameter("pn", oldpn); + return; + } + if (hasParameter("pt")) { + pt = parseInt(getParameter("pt")) + if (pn > pt) { + alert("No such page! (Page number too high)"); + setParameter("pn", oldpn); + return; + } + } + if (keep) { + display(15+32); // all, no mark + } else { + display(3+32); // fn, pn, ws, mo + pt + } +} + +function gotoPageWin() { + // dialog to ask for new page nr + var pn = getParameter("pn"); + var gopage = window.prompt("Go to page", pn); + if (gopage) { + gotoPage(gopage); + } +} + +function setParamWin(param, text, relative) { + // dialog to ask for new parameter value + var val = getParameter(param); + var newval = window.prompt(text, val); + if (newval) { + setParameter(param, newval, relative); + display(); + } +} + +function showOptions(show) { + // show or hide option div + var elem = getElement("dloptions"); + showElement(elem, show); +} \ No newline at end of file
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/webapp/src/main/webapp/oldskin/empty.html Fri Feb 22 17:18:30 2013 +0100 @@ -0,0 +1,8 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +</head> + +<body> +</body> +</html>
--- a/webapp/src/main/webapp/server/dlCache.jsp Fri Feb 22 17:14:49 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ -<%@ page language="java" %> - -<%! -// authentication stuff - robert -// ----------------------------- -// create DocumentBean instance for all JSP requests -digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); - -// initialize DocumentBean instance in JSP init -public void jspInit() { - try { - // set servlet init-parameter - docBean.setConfig(getServletConfig()); - } catch (javax.servlet.ServletException e) { - System.out.println(e); - } -} -%> - -<% -// get digilib config -digilib.servlet.DigilibConfiguration dlConfig = docBean.getDlConfig(); -// dir cache -digilib.io.DocuDirCache dirCache = (digilib.io.DocuDirCache) dlConfig.getValue("servlet.dir.cache"); -%> - -<html> -<head> -<title>Digilib cache info</title> -</head> - -<h1>Digilib cache info</h1> - - - <table> - <tr> - <td>size (directories)</td><td><b><%= dirCache.size() %></b></td> - <td></td> - </tr> - <tr> - <td>numFiles</td><td><b><%= dirCache.getNumFiles() %></b></td> - <td></td> - </tr> - <tr> - <td>hits</td><td><b><%= dirCache.getHits() %></b></td> - <td></td> - </tr> - <tr> - <td>misses</td><td><b><%= dirCache.getMisses() %></b></td> - <td></td> - </tr> -</table> - -<table> -<% - Object[] keys = dirCache.getChildren("", true).toArray(); - java.util.Arrays.sort(keys); - int l = keys.length; - for (int i = 0; i < l; i++) { - String key = (String) keys[i]; - // digilib.io.DocuDirectory val = (digilib.io.DocuDirectory) dirCache.getDirectory(key); -%> - <tr> - <td valign="top"><%= key %></td><td><b><%= 1 /* val.getDirName() */ %></b></td> - <td></td> - </tr> -<% - } -%> -</table> - -</body> -</html>