313
|
1 /*
|
|
2 Copyright (C) 2003-2004 WTWG Uni Bern, MPIWG Berlin
|
|
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:
|
|
19 Christian Luginbuehl, 07.04.2004 , Version Alcatraz 0.6
|
|
20 Robert Casties 28.10.2004
|
|
21
|
|
22 !! requires baselib.js !!
|
|
23
|
|
24 */
|
|
25
|
|
26 function identify() {
|
|
27 return 'Digicat v0.4';
|
|
28 }
|
|
29
|
|
30 var cells = null;
|
|
31
|
|
32
|
|
33 function dc_init() {
|
|
34 // put the query parameters (sans "?") in the parameters array
|
|
35 parseParameters(location.search.slice(1));
|
|
36 }
|
|
37
|
|
38 function display(detail) {
|
|
39 // redisplay the page
|
|
40 if (! detail) {
|
|
41 detail = 9;
|
|
42 }
|
|
43 var queryString = getAllParameters(detail);
|
|
44 location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString;
|
|
45 }
|
|
46
|
|
47 function dc_render(doc) {
|
319
|
48 // creates the HTML for the image table
|
|
49 var wsize = getWinSize();
|
|
50 var fWidth = wsize.width;
|
|
51 var fHeight = wsize.height;
|
313
|
52
|
319
|
53 var mx = getParameter("mx");
|
|
54 cells = mx.split('x');
|
313
|
55
|
319
|
56 var dw = getParameter("dw");
|
|
57 var dh = getParameter("dh");
|
|
58 var pt = getParameter("pt");
|
|
59 var pn = parseInt(getParameter("pn"));
|
|
60 var fn = getParameter("fn");
|
591
|
61 var par_mo = (hasParameter("mo")) ? "&mo="+getParameter("mo") : "";
|
313
|
62
|
319
|
63 var picWidth = (dw != 0) ? dw : Math.floor((fWidth-30)/cells[0])-2*cells[0]-1;
|
|
64 var picHeight = (dh != 0) ? dh : picWidth;
|
313
|
65
|
319
|
66 if (cells.length > 1) {
|
|
67 picHeight = (dh != 0) ? dh : Math.floor(((fHeight-30)-12*cells[1])/cells[1])-2*cells[1]-1;
|
|
68 } else {
|
|
69 cells[1] = Math.ceil(pt/cells[0]);
|
|
70 }
|
313
|
71
|
319
|
72 var cellWidth = parseInt(picWidth)+8;
|
|
73 var cellHeight = parseInt(picHeight)+18;
|
|
74
|
|
75 doc.writeln('<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">');
|
313
|
76
|
319
|
77 for (var j = 0; j < cells[1]; j++) {
|
|
78 doc.writeln('<tr>');
|
|
79 for (var i = 0; i < cells[0]; i++) {
|
|
80 var idx = pn+i+j*cells[0];
|
|
81 var img = baseUrl + "/servlet/Scaler?fn=" + fn + "&pn=" + idx;
|
|
82 img += "&dw=" + picWidth + "&dh=" + picHeight + par_mo;
|
|
83 doc.write('<td width="'+cellWidth+'" height="'+cellHeight+'">');
|
|
84 if (idx <= pt) {
|
|
85 doc.write('<a href="'+dl_link(idx)+'" target="_blank"><img src="'+img+'" border="0"></a><div class="number">'+idx+'</div>');
|
|
86 } else {
|
|
87 doc.write('<div class="nonumber">'+idx+'</div>');
|
|
88 }
|
|
89 doc.writeln('</td>');
|
|
90 }
|
|
91 doc.writeln(' </tr>');
|
|
92 }
|
|
93 doc.writeln('</table>');
|
313
|
94 }
|
|
95
|
|
96
|
|
97 function dl_link(i) {
|
|
98 var link = baseUrl+"/digilib.jsp?fn="+getParameter("fn")+"&pn="+i+"&mo="+getParameter("mo");
|
|
99 return link;
|
|
100 }
|
|
101
|
|
102
|
|
103 function Backpage() {
|
|
104 var pn = parseInt(getParameter("pn"));
|
|
105 if (pn <= 1) {
|
|
106 pn = 1;
|
|
107 alert("You are already on the first page!");
|
|
108 }
|
|
109
|
|
110 pn = pn - parseInt(cells[0]*cells[1]);
|
|
111
|
|
112 if (pn < 1) {
|
|
113 pn = 1;
|
|
114 }
|
|
115 setParameter("pn", pn);
|
|
116 display();
|
|
117 }
|
|
118
|
|
119 function Nextpage() {
|
|
120 var pn = parseInt(getParameter("pn"));
|
|
121 pn = pn + parseInt(cells[0]*cells[1]);
|
|
122 setParameter("pn", pn);
|
|
123 display();
|
|
124 }
|