annotate client/digitallibrary/modules/pagesTotal.js @ 45:81f5e75718ac

bugfixes and new module
author luginbue
date Sun, 07 Jul 2002 18:03:54 +0200
parents e918bd61084d
children 56ff1711e367
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28
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 {
40
e918bd61084d opera support done, bugfixes
luginbue
parents: 28
diff changeset
64 var page = prompt("Goto Page (1 - " + att[9] + "):", 1);
e918bd61084d opera support done, bugfixes
luginbue
parents: 28
diff changeset
65
e918bd61084d opera support done, bugfixes
luginbue
parents: 28
diff changeset
66 } while ((page != null) && ((isNaN(page)) || (page < 1) || (page > att[9])));
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
67
40
e918bd61084d opera support done, bugfixes
luginbue
parents: 28
diff changeset
68 if ((page != null) && (page != att[1])) {
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
69 att[1] = page;
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
70 loadPicture(0, keepArea);
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 /**
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
76 * overriding 'loadPicture' in navigation
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
77 */
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
78 function loadPicture(detailGrade, keepArea) {
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
79
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
80 // the different detailGrades:
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
81 // 0 -> back, next, page
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
82 // 1 -> zoomout
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
83 // 2 -> zoomarea, zoompoint, moveto, scaledef
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
84
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
85 var newQuery = "fn=" + att[0] + "&pn=" + att[1] + "&ws=" + att[2] + "&mo=" + att[3];
28
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
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
98 newQuery += "&mk=" + att[4] + "&wx=" + att[5] + "&wy=" + att[6] + "&ww=" + att[7] + "&wh=" + att[8];
28
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.)
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
101 newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
102 } else { // ie, opera
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
103 newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
104 }
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
105
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
106 newQuery += "&pt=" + att[9];
28
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
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
109 //alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
110
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
111 location.href = location.pathname + "?" + newQuery;
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
112 }