comparison client/digitallibrary/digilib.jsp @ 107:85126da2ae21 vendor start

XUL: Digilib Buttons in chrome
author engler
date Tue, 13 May 2003 21:02:22 +0200
parents f80cc302cad8
children
comparison
equal deleted inserted replaced
105:ecee3ff2f4d0 107:85126da2ae21
1 <%@ page language="java" %>
2
3 <%!
4 /*
5 Copyright (C) 2003 WTWG, Uni Bern
6
7 This program is free software; you can redistribute it and/or
8 modify it under the terms of the GNU General Public License
9 as published by the Free Software Foundation; either version 2
10 of the License, or (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
20
21 Author: Christian Luginbuehl, 01.05.2003 , Version Alcatraz 0.3
22 */
23 // authentication stuff - robert
24 // -----------------------------
25 // create DocumentBean instance for all JSP requests
26 digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean();
27
28 // initialize DocumentBean instance in JSP init
29 public void jspInit() {
30 try {
31 // set servlet init-parameter
32 docBean.setConfig(getServletConfig());
33 } catch (javax.servlet.ServletException e) {
34 System.out.println(e);
35 }
36 }
37 %>
38
39
40
41
42 <%
43
44 // parsing the query
45 // -----------------
46
47 //digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request);
48 digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest();
49 dlRequest.setWithRequest(request);
50 // check if authentication is needed and redirect if necessary
51 docBean.doAuthentication(dlRequest, response);
52
53 %>
54
55 <%
56
57 // the different levels of presentation
58 // ------------------------------------
59
60
61 // level 3 representation hack - lugi
62 // it would be musch more interesting to check
63 // if the sidebar is actually installed and in
64 // the case it isn't - automatically do it.
65 // however this requires client-side tests and
66 // so slows down everything.
67 // we might want to talk about it for a future
68 // release
69
70 if (dlRequest.getLv() == 3) {
71 String userAgent = request.getHeader("User-Agent").toLowerCase();
72
73 if (userAgent.indexOf("mozilla/5.0") == 0) {
74
75 // mozilla 5 that does not support xul-sidebars
76 if (userAgent.indexOf("opera") > -1) dlRequest.setLv(2);
77 if (userAgent.indexOf("chimera") > -1) dlRequest.setLv(2);
78 if (userAgent.indexOf("camino") > -1) dlRequest.setLv(2);
79 if (userAgent.indexOf("konqueror") > -1) dlRequest.setLv(2);
80 if (userAgent.indexOf("safari") > -1) dlRequest.setLv(2);
81 if (userAgent.indexOf("galeon") > -1) dlRequest.setLv(2);
82 if (userAgent.indexOf("skipstone") > -1) dlRequest.setLv(2);
83 if (userAgent.indexOf("k-meleon") > -1) dlRequest.setLv(2);
84 if (userAgent.indexOf("firebird") > -1) dlRequest.setLv(2);
85
86 // the chance is quite big, that the browser supports xul-sidebars
87 dlRequest.setLv(1);
88
89 } else {
90
91 // redirect to level 2 because of definitive lack of sidebar support
92 dlRequest.setLv(2);
93 }
94 }
95
96
97
98 switch (dlRequest.getLv()) {
99
100 // LEVEL 0 --------------------------------------------------------------
101
102 case 0:
103 %>
104
105 <%
106 break; // level 0
107
108
109
110
111 // LEVEL 1 --------------------------------------------------------------
112
113 case 1:
114 %>
115
116 <%
117 // checking if the height and width of this client is already known
118 if ((dlRequest.getDw() == 0) || (dlRequest.getDh() == 0)) {
119 %>
120
1 <html> 121 <html>
2 <title>Digital Document Library</title>
3 <head> 122 <head>
4 <jsp:useBean id="DB" scope="page" class="digilib.servlet.DocumentBean" /> 123 <script language="Javascript">
5 124
6 <% 125 function redirect() {
7 // set servlet init-parameter 126
8 DB.setConfig(getServletConfig()); 127 if (document.body) {
9 // check if authentication is needed and redirect if necessary 128
10 DB.doAuthentication(request, response); 129 // internet explorer + opera
11 %> 130 client = "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30);
131
132 } else {
133
134 // mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.)
135 client = "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30);
136
137 }
138
139 location.replace(document.URL + client);
140 }
141
142 </script>
143 </head>
144 <body bgcolor="#666666" onload="redirect()">
145 </body>
146 </html>
147
148 <%
149 } else {
150
151 // add number of pages
152 dlRequest.setPt(docBean.getNumPages(dlRequest));
153
154 String imageLocation = dlRequest.getBaseURL() + "/servlet/Scaler/?" + dlRequest.getAsString();
155 %>
156
157 <html>
158 <head>
159 <title>Digital Document Library - Alcatraz (Level 1)</title>
12 160
13 <script language="JavaScript"> 161 <script language="JavaScript">
14 162
15 // the document's query string (minus "?") 163 var baseUrl = "<%= dlRequest.getBaseURL() %>";
16 var query = location.search.substring(1);
17
18 // feel free to uncomment - i have never seen a problem so...
19 // // DEBUG
20 // alert('DIR: <%= DB.getDocuPath(request) %> PAGES: <%= DB.getNumPages(request) %>');
21
22 // number of pages of the document
23 var numPages = <%= DB.getNumPages(request) %>;
24 164
25 // browser version test to include the corresponding navigation-file 165 // browser version test to include the corresponding navigation-file
26 if ((navigator.appName.toLowerCase() == "netscape") && (parseFloat(navigator.appVersion) < 5.0)) { 166 if (navigator.userAgent.toLowerCase().indexOf("opera") > -1) {
27 top.document.write('<script src="navigation_n4.js"><\/script>'); 167 document.write('<script src="navigation_o6.js"><\/script>');
28 } else if (navigator.appName.toLowerCase() == "netscape") { 168 } else if (navigator.userAgent.toLowerCase().indexOf("msie") > -1) {
29 top.document.write('<script src="navigation_n6.js"><\/script>'); 169 document.write('<script src="navigation_ie.js"><\/script>');
30 } else if ((navigator.appName.toLowerCase() == "microsoft internet explorer") && (parseFloat(navigator.appVersion) >= 4.0)) { 170 } else if (navigator.userAgent.toLowerCase().indexOf("mozilla\/4") > -1) {
31 top.document.write('<script src="navigation11_ie.js"><\/script>'); 171 document.write('<script src="navigation_n4.js"><\/script>');
172 } else if (navigator.userAgent.toLowerCase().indexOf("mozilla\/5") > -1) {
173 document.write('<script src="navigation_n6.js"><\/script>');
32 } else { 174 } else {
33 alert('Your browser is not directly supported by this client right now.\n\nLoading now the optimised version for Netscape 6, that sticks the most to the w3c specifications.'); 175 alert('Your browser is not directly supported by this client right now.\n\nLoading now the optimised version for Netscape 6, that sticks the most to the w3c specifications.');
34 top.document.write('<script src="navigation_n6.js"><\/script>'); 176 document.write('<script src="navigation_n6.js"><\/script>');
35 } 177 }
178
179 // add module to show the total number of pages (not browser dependant!)
180 document.write('<script src="modules\/pagesTotal.js"><\/script>\n');
181 document.write('<script src="modules\/mirror.js"><\/script>\n');
182 document.write('<script src="modules\/imago.js"><\/script>\n');
183 document.write('<script src="modules\/pixelByPixel.js"><\/script>\n');
184 document.write('<script src="modules\/newReferences.js"><\/script>\n');
185 document.write('<script src="modules\/fitGIFs.js"><\/script>\n');
36 186
37 </script> 187 </script>
38 188
39 </head> 189 </head>
40 190
41 <frameset cols="*,90" border="0" onLoad="whichFrame = parent.mainFrame; initPicture(query); loadPicture(2); initScripts();"> 191 <body bgcolor="#666666" onload='init_imago("<%= dlRequest.getFilePath() %>", "<%= dlRequest.getPn() %>", "<%= dlRequest.getWs() %>", "<%= dlRequest.getMo() %>", "<%= dlRequest.getMk() %>", "<%= dlRequest.getWx() %>", "<%= dlRequest.getWy() %>", "<%= dlRequest.getWw() %>", "<%= dlRequest.getWh() %>", "<%= dlRequest.getPt() %>", "<%= dlRequest.getBrgt() %>", "<%= dlRequest.getCont() %>", "<%= dlRequest.getRot() %>", "<%= dlRequest.getRgba_s() %>", "<%= dlRequest.getRgbm_s() %>")'>
42 <frame name="mainFrame" src="about:blank" scrolling="auto"> 192
193 <div id="lay1" style="position: absolute; left: 10px; top: 10px; visibility: visible"><img name="pic" src="<%= imageLocation %>" border="0"></div>
194
195 <div id="dot0" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark1.gif" border="0"></div>
196 <div id="dot1" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark2.gif" border="0"></div>
197 <div id="dot2" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark3.gif" border="0"></div>
198 <div id="dot3" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark4.gif" border="0"></div>
199 <div id="dot4" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark5.gif" border="0"></div>
200 <div id="dot5" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark6.gif" border="0"></div>
201 <div id="dot6" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark7.gif" border="0"></div>
202 <div id="dot7" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="mark8.gif" border="0"></div>
203 <div id="eck1" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="olinks.gif" border="0"></div>
204 <div id="eck2" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="orechts.gif" border="0"></div>
205 <div id="eck3" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="ulinks.gif" border="0"></div>
206 <div id="eck4" style="position: absolute; left: -20; top: 100; visibility: hidden"><img src="urechts.gif" border="0"></div>
207
208 </body>
209
210 </html>
211 <%
212 }
213 %>
214
215 <%
216 break; // level 1
217
218
219
220
221 // LEVEL 2 --------------------------------------------------------------
222
223 case 2:
224 %>
225
226 <%
227 // retrieve request in new paramter format and redirect to level 1
228 dlRequest.setLv(1);
229 String query = "digilib.jsp?" + dlRequest.getAsString();
230 %>
231
232 <html>
233 <head>
234 <title>Digital Document Library - Alcatraz (Level 2)</title>
235 </head>
236
237 <frameset cols="*,90" border="0">
238 <frame name="mainFrame" src="<%= query %>" scrolling="auto">
43 <frameset rows="20,*" border="0"> 239 <frameset rows="20,*" border="0">
44 <frame name="pageFrame" src="about:blank" scrolling="no" noresize> 240 <frame name="pageFrame" src="about:blank" scrolling="no" noresize>
45 <frame name="rightFrame" src="navigation.html" scrolling="no" noresize> 241 <frame name="rightFrame" src="dlMenu.html" scrolling="no" noresize>
46 </frameset> 242 </frameset>
47 </frameset> 243 </frameset>
48 244
49 </html> 245 </html>
246
247 <%
248 break; // level 2
249
250 } // end switch
251
252 %>