31
|
1 /****************************************************************************
|
|
2 * - sample module for digilib *
|
|
3 * *
|
|
4 * christian luginbuehl (luginbuehl@student.unibe.ch) *
|
|
5 ****************************************************************************/
|
|
6
|
|
7 // overriding (some kind of inheriting) init in navigation13_XX.js
|
|
8 function init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt) {
|
|
9
|
|
10 // debug window to check the parameters passed
|
|
11 //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);
|
|
12
|
|
13 // calling original init
|
|
14 init(pu, pn, ws, mo, mk, wx, wy, ww, wh);
|
|
15
|
|
16 att[9] = parseInt(pt);
|
|
17
|
|
18 pagesTotal();
|
|
19
|
|
20 focus();
|
|
21 }
|
|
22
|
|
23
|
|
24 /**
|
|
25 * shows page XX of YY in a dedicated frame
|
|
26 *
|
|
27 * ATTENTION: some stuff is still to do, because of some incompatibilities between servlet and client
|
|
28 * i should be able to read the total number of pages in dlImage.jsp
|
|
29 */
|
|
30 function pagesTotal() {
|
|
31
|
|
32 if (parent.pageFrame) {
|
|
33 parent.pageFrame.document.open();
|
|
34 parent.pageFrame.document.write('<html><head></head><body bgcolor="#CCCCCC" topmargin="5" marginheight="5">');
|
|
35 parent.pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: 11px">');
|
|
36 parent.pageFrame.document.write(att[1] + '<b> of </b>' + att[9] + '</p></body></html>');
|
|
37 parent.pageFrame.document.close();
|
|
38 }
|
|
39 }
|
|
40
|
|
41
|
|
42 /**
|
|
43 * overriding nextPage in navigation
|
|
44 */
|
|
45 function nextPage(keepArea) {
|
|
46
|
|
47 att[1] = parseInt(att[1]) + 1;
|
|
48
|
|
49 if (att[1] <= att[9] || isNaN(att[9])) {
|
|
50 loadPicture(0, keepArea);
|
|
51 } else {
|
|
52 att[1] = parseInt(att[1]) - 1;
|
|
53 alert("You are already on the last page!");
|
|
54 }
|
|
55 }
|
|
56
|
|
57
|
|
58 /**
|
|
59 * overriding 'page' in navigation
|
|
60 */
|
|
61 function page(keepArea) {
|
|
62
|
|
63 do {
|
|
64 page = prompt("Goto Page (1 - " + att[9] + "):", 1);
|
|
65 } while (!isNaN(att[9]) && (page != null) && ((page < 1) || (page > parent.numPages)));
|
|
66
|
|
67 if (page != null && page != att[1]) {
|
|
68 att[1] = page;
|
|
69 loadPicture(0, keepArea);
|
|
70 }
|
|
71 }
|
|
72
|
|
73
|
|
74 /**
|
|
75 * overriding 'loadPicture' in navigation
|
|
76 */
|
|
77 function loadPicture(detailGrade, keepArea) {
|
|
78
|
|
79 // the different detailGrades:
|
|
80 // 0 -> back, next, page
|
|
81 // 1 -> zoomout
|
|
82 // 2 -> zoomarea, zoompoint, moveto, scaledef
|
|
83
|
|
84 var newURL = "dlImage.jsp?"
|
|
85 newURL += "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3];
|
|
86
|
|
87 if (detailGrade == 0) {
|
|
88 att[4] = "0/0";
|
|
89 }
|
|
90
|
|
91 if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) {
|
|
92 att[5] = 0;
|
|
93 att[6] = 0;
|
|
94 att[7] = 1;
|
|
95 att[8] = 1;
|
|
96 }
|
|
97
|
|
98 newURL += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
|
|
99
|
|
100 if (navigator.appName.toLowerCase() == "netscape") { // mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.)
|
|
101 newURL += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
|
|
102 } else { // ie
|
|
103 newURL += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
|
|
104 }
|
|
105
|
|
106 newURL += "&pt=" + att[9];
|
|
107
|
|
108 // debug window - checking the parameters passed to the next image
|
|
109 //alert ("DEBUG MESSAGE (complete URL in loadPicture):\n\n" + newURL);
|
|
110
|
|
111 location.href = newURL;
|
|
112 } |