annotate client/digitallibrary/modules/pagesTotal.js @ 31:904f2b2f0cf5

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