comparison client/digitallibrary/oldskin/dclib.js @ 313:24dbc008be14

big autumn cleaning :-) - finally digilib.jsp uses the new javascript code - dito digicat.jsp - all files corresponding to the old frontend moved into /oldskin - all icons moved into /img
author robcast
date Thu, 28 Oct 2004 22:25:58 +0200
parents
children 23866acd6509
comparison
equal deleted inserted replaced
312:e1d587a4e9b1 313:24dbc008be14
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
35 // put the query parameters (sans "?") in the parameters array
36 parseParameters(location.search.slice(1));
37 }
38
39 function display(detail) {
40 // redisplay the page
41 if (! detail) {
42 detail = 9;
43 }
44 var queryString = getAllParameters(detail);
45 location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString;
46 }
47
48 function dc_render(doc) {
49
50 var fWidth = document.body ? document.body.clientWidth : innerWidth;
51 var fHeight = document.body ? document.body.clientHeight : innerHeight;
52
53 var mx = getParameter("mx");
54 cells = mx.split('x');
55
56 var dw = getParameter("dw");
57 var dh = getParameter("dh");
58 var pt = getParameter("pt");
59 var pn = getParameter("pn");
60
61 var picWidth = (dw != 0) ? dw : Math.floor((fWidth-30)/cells[0])-2*cells[0]-1;
62 var picHeight = (dh != 0) ? dh : picWidth;
63
64 if (cells.length > 1) {
65 picHeight = (dh != 0) ? dh : Math.floor(((fHeight-30)-12*cells[1])/cells[1])-2*cells[1]-1;
66 } else {
67 cells[1] = Math.ceil(pt/cells[0]);
68 }
69
70 var cellWidth = parseInt(picWidth)+8;
71 var cellHeight = parseInt(picHeight)+18;
72
73 doc.writeln('<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">');
74
75 for (var j = 0; j < cells[1]; j++) {
76 doc.writeln('<tr>');
77 for (var i = 0; i < cells[0]; i++) {
78 var idx = parseInt(pn)+i+j*cells[0];
79 var img = baseUrl + "/servlet/Scaler?fn=" + getParameter("fn") + "&pn=" + idx;
80 img += "&dw=" + picWidth + "&dh=" + picHeight + "&mo=" + getParameter("mo");
81 doc.write('<td width="'+cellWidth+'" height="'+cellHeight+'">');
82 if (idx <= pt) {
83 doc.write('<a href="'+dl_link(idx)+'" target="_blank"><img src="'+img+'" border="0"></a><div class="number">'+idx+'</div>');
84 } else {
85 doc.write('<div class="nonumber">'+idx+'</div>');
86 }
87 doc.writeln('</td>');
88 }
89 doc.writeln(' </tr>');
90 }
91 doc.writeln('</table>');
92 }
93
94
95 function dl_link(i) {
96 var link = baseUrl+"/digilib.jsp?fn="+getParameter("fn")+"&pn="+i+"&mo="+getParameter("mo");
97 return link;
98 }
99
100
101 function Backpage() {
102 var pn = parseInt(getParameter("pn"));
103 if (pn <= 1) {
104 pn = 1;
105 alert("You are already on the first page!");
106 }
107
108 pn = pn - parseInt(cells[0]*cells[1]);
109
110 if (pn < 1) {
111 pn = 1;
112 }
113 setParameter("pn", pn);
114 display();
115 }
116
117 function Nextpage() {
118 var pn = parseInt(getParameter("pn"));
119 pn = pn + parseInt(cells[0]*cells[1]);
120 setParameter("pn", pn);
121 display();
122 }