annotate client/digitallibrary/modules/pagesTotal.js @ 106:56ff1711e367

XUL Buttons in chrome
author engler
date Wed, 14 May 2003 12:00:40 +0200
parents 81f5e75718ac
children 12b887d3a482
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
1 /*
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
2 Copyright (C) 2003 WTWG, Uni Bern
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
3
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
4 This program is free software; you can redistribute it and/or
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
5 modify it under the terms of the GNU General Public License
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
6 as published by the Free Software Foundation; either version 2
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
7 of the License, or (at your option) any later version.
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
8
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
9 This program is distributed in the hope that it will be useful,
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
12 GNU General Public License for more details.
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
13
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
14 You should have received a copy of the GNU General Public License
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
15 along with this program; if not, write to the Free Software
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
16 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
17
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
18 Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
19 */
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
20 /****************************************************************************
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
21 * - sample module for digilib *
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
22 * *
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
23 * christian luginbuehl (luginbuehl@student.unibe.ch) *
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
24 ****************************************************************************/
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
25
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
26 // overriding (some kind of inheriting) init in navigation13_XX.js
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
27 function init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt) {
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
29 // debug window to check the parameters passed
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
30 //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
31
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
32 // calling original init
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
33 init(pu, pn, ws, mo, mk, wx, wy, ww, wh);
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
34
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
35 att.pt = parseInt(pt);
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
36
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
37 pagesTotal();
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
38
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
39 focus();
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 /**
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
44 * shows page XX of YY in a dedicated frame
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
45 *
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
46 * 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
47 * 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
48 */
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
49 function pagesTotal() {
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
50
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
51 if (parent.pageFrame) {
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
52 parent.pageFrame.document.open();
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
53 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
54 parent.pageFrame.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: 11px">');
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
55 parent.pageFrame.document.write(att.pn + '<b> of </b>' + att.pt + '</p></body></html>');
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
56 parent.pageFrame.document.close();
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
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
60
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
61 /**
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
62 * overriding nextPage in navigation
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
63 */
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
64 function nextPage(keepArea) {
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
65
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
66 att.pn = parseInt(att.pn) + 1;
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
67
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
68 if (att.pn <= att.pt || isNaN(att.pt)) {
28
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 } else {
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
71 att.pn = parseInt(att.pn) - 1;
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
72 alert("You are already on the last page!");
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
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
77 /**
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
78 * overriding 'page' in navigation
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
79 */
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
80 function page(keepArea) {
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
81
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
82 do {
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
83 var page = prompt("Goto Page (1 - " + att.pt + "):", 1);
40
e918bd61084d opera support done, bugfixes
luginbue
parents: 28
diff changeset
84
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
85 } while ((page != null) && ((isNaN(page)) || (page < 1) || (page > att.pt)));
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
86
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
87 if ((page != null) && (page != att.pn)) {
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
88 att.pn = page;
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
89 loadPicture(0, keepArea);
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
90 }
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
91 }
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
92
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
93
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
94 /**
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
95 * overriding 'loadPicture' in navigation
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
96 */
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
97 function loadPicture(detailGrade, keepArea) {
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
98
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
99 // the different detailGrades:
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
100 // 0 -> back, next, page
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
101 // 1 -> zoomout
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
102 // 2 -> zoomarea, zoompoint, moveto, scaledef
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
103
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
104 var newQuery = "fn=" + att.fn + "&pn=" + att.pn + "&ws=" + att.ws + "&mo=" + att.mo;
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
105
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
106 if (detailGrade == 0) {
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
107 att.mk = "0/0";
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
108 }
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
109
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
110 if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) {
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
111 att.wx = 0;
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
112 att.wy = 0;
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
113 att.ww = 1;
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
114 att.wh = 1;
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
115 }
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
116
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
117 newQuery += "&mk=" + att.mk + "&wx=" + att.wx + "&wy=" + att.wy + "&ww=" + att.ww + "&wh=" + att.wh;
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
118
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
119 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
120 newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
121 } else { // ie, opera
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
122 newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
123 }
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
124
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
125 newQuery += "&pt=" + att.pt;
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
126 newQuery += "&lv=1";
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
127
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
128 // debug window - checking the parameters passed to the next image
45
81f5e75718ac bugfixes and new module
luginbue
parents: 40
diff changeset
129 //alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery);
28
904f2b2f0cf5 cleaning up a bit - more follows
luginbue
parents:
diff changeset
130
106
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
131 location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery;
56ff1711e367 XUL Buttons in chrome
engler
parents: 45
diff changeset
132 }