--- zogiLib/js/dllib.js 2005/11/08 10:13:31 1.6 +++ zogiLib/js/dllib.js 2005/11/08 18:10:10 1.7 @@ -17,7 +17,7 @@ Foundation, Inc., 59 Temple Place - Suit Authors: Christian Luginbuehl, 01.05.2003 (first version) DW 24.03.2004 (Changed for digiLib in Zope) - Robert Casties, 2.11.2004 + Robert Casties, 8.11.2005 ! Requires baselib.js ! @@ -186,7 +186,7 @@ function bestPicSize(elem, inset) { return ws; } -function setDLParam(e, s) { +function setDLParam(e, s, relative) { // sets parameter based on HTML event var nam; var val; @@ -198,10 +198,10 @@ function setDLParam(e, s) { val = s.value; } if (nam && val) { - setParameter(nam, val); + setParameter(nam, val, relative); display(); } else { - alert("unable to process event!"); + alert("ERROR: unable to process event!"); } return true; } @@ -217,7 +217,7 @@ function dl_param_init() { if (!baseScriptVersion) { base_init(); } - dlScriptVersion = "1.1b"; + 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(); @@ -274,7 +274,7 @@ function dl_init() { function display(detail) { // redisplay the page if (! detail) { - detail = 9; + detail = 255; } var queryString = getAllParameters(detail); location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString; @@ -460,7 +460,7 @@ function zoomFullpage() { function moveCenter() { // move visible area so that it's centered around the clicked point if ( (dlArea.width == 1.0) && (dlArea.height == 1.0) ) { - // noting to do + // nothing to do return; } window.focus(); @@ -503,7 +503,7 @@ function getRef() { var baseUrl = location.protocol + "//" + location.host + location.pathname; } var hyperlinkRef = baseUrl; - var par = getAllParameters(9); + var par = getAllParameters(7+16); // all without ddpi, pt if (par.length > 0) { hyperlinkRef += "?" + par; } @@ -563,33 +563,46 @@ function mirror(dir) { display(); } -function gotoPage(gopage) { - // goto given page nr (+/- relative) - setParameter("pn", gopage); +function gotoPage(gopage, keep) { + // goto given page nr (+/-: relative) + var oldpn = parseInt(getParameter("pn")); + setParameter("pn", gopage, true); var pn = parseInt(getParameter("pn")); if (pn < 1) { - pn = 1; - setParameter("pn", pn); + 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 } - // TODO: check for last page - display(1); } function gotoPageWin() { // dialog to ask for new page nr - var pn = getParameter('pn'); + var pn = getParameter("pn"); var gopage = window.prompt("Go to page", pn); if (gopage) { gotoPage(gopage); } } -function setParamWin(param, text) { +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); + setParameter(param, newval, relative); display(); } }