# HG changeset patch # User luginbue # Date 1014254371 -3600 # Node ID 904f2b2f0cf5a41102da4bf465939f697e12d808 # Parent 8dbd7b41d5910847592653fb7dee42938269bab0 cleaning up a bit - more follows diff -r 8dbd7b41d591 -r 904f2b2f0cf5 client/digitallibrary/modules/pagesTotal.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/modules/pagesTotal.js Thu Feb 21 02:19:31 2002 +0100 @@ -0,0 +1,112 @@ +/**************************************************************************** + * - sample module for digilib * + * * + * christian luginbuehl (luginbuehl@student.unibe.ch) * + ****************************************************************************/ + +// overriding (some kind of inheriting) init in navigation13_XX.js +function init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt) { + + // debug window to check the parameters passed + //alert ("DEBUG message (parameters in init pagesTotal.js):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh + "\npt = " + pt); + + // calling original init + init(pu, pn, ws, mo, mk, wx, wy, ww, wh); + + att[9] = parseInt(pt); + + pagesTotal(); + + focus(); +} + + +/** + * shows page XX of YY in a dedicated frame + * + * ATTENTION: some stuff is still to do, because of some incompatibilities between servlet and client + * i should be able to read the total number of pages in dlImage.jsp + */ +function pagesTotal() { + + if (parent.pageFrame) { + parent.pageFrame.document.open(); + parent.pageFrame.document.write('
'); + parent.pageFrame.document.write(''); + parent.pageFrame.document.write(att[1] + ' of ' + att[9] + '
'); + parent.pageFrame.document.close(); + } +} + + +/** + * overriding nextPage in navigation + */ +function nextPage(keepArea) { + + att[1] = parseInt(att[1]) + 1; + + if (att[1] <= att[9] || isNaN(att[9])) { + loadPicture(0, keepArea); + } else { + att[1] = parseInt(att[1]) - 1; + alert("You are already on the last page!"); + } +} + + +/** + * overriding 'page' in navigation + */ +function page(keepArea) { + + do { + page = prompt("Goto Page (1 - " + att[9] + "):", 1); + } while (!isNaN(att[9]) && (page != null) && ((page < 1) || (page > parent.numPages))); + + if (page != null && page != att[1]) { + att[1] = page; + loadPicture(0, keepArea); + } +} + + +/** + * overriding 'loadPicture' in navigation + */ +function loadPicture(detailGrade, keepArea) { + + // the different detailGrades: + // 0 -> back, next, page + // 1 -> zoomout + // 2 -> zoomarea, zoompoint, moveto, scaledef + + var newURL = "dlImage.jsp?" + newURL += "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3]; + + if (detailGrade == 0) { + att[4] = "0/0"; + } + + if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) { + att[5] = 0; + att[6] = 0; + att[7] = 1; + att[8] = 1; + } + + newURL += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8]; + + if (navigator.appName.toLowerCase() == "netscape") { // mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.) + newURL += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30); + } else { // ie + newURL += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30); + } + + newURL += "&pt=" + att[9]; + + // debug window - checking the parameters passed to the next image + //alert ("DEBUG MESSAGE (complete URL in loadPicture):\n\n" + newURL); + + location.href = newURL; +} \ No newline at end of file