comparison client/digitallibrary/modules/pagesTotal.js @ 107:85126da2ae21 vendor start

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