Mercurial > hg > digilib-old
changeset 311:05e51532a982
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 | 661a911a95d6 |
children | e1d587a4e9b1 |
files | client/digitallibrary/modules/contextMenu.js client/digitallibrary/modules/fitGIFs.js client/digitallibrary/modules/pagesTotal.js client/digitallibrary/modules/pdfMaker.js client/digitallibrary/oldskin/dcMain.jsp |
diffstat | 5 files changed, 82 insertions(+), 291 deletions(-) [+] |
line wrap: on
line diff
--- a/client/digitallibrary/modules/contextMenu.js Thu Oct 28 22:25:58 2004 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,117 +0,0 @@ -/**************************************************************************** - * - module for digilib: adds a menu for digilib functionality * - * * - * pressing [ctrl] + [left mousebutton] to bring it up * - * * - * to install this module, you do not just have to load it in * - * dlImage.jsp (like every module), but you also have to put the * - * following three lines in the <body> of dlImage.jsp: * - * * - * <script language="JavaScript"> * - * cm_htmlCode(); * - * </script> * - * * - * christian luginbuehl (luginbuehl@student.unibe.ch) * - ****************************************************************************/ - -browser = new checkBrowser(); - -var menu = false; - -if (browser.ns4) { - document.captureEvents(Event.MOUSEDOWN); - document.onmousedown = showmenu; -} else if (browser.ns6) { - document.addEventListener("mousedown", showmenu, true); -} else { - document.onmousedown = showmenu; -} - - -function checkBrowser() { - - this.ua = navigator.userAgent; - this.ver = navigator.appVersion; - this.dom = ( document.getElementById ); - this.opera = ( this.dom ) && ( this.ua.toLowerCase().indexOf("opera") > -1 ); - this.ie4 = ( document.all ) && ( !this.dom ); - this.ie5 = ( this.ver.indexOf("MSIE 5") > -1 ) && ( this.dom ); - this.ie6 = ( this.ver.indexOf("MSIE 6") > -1 ) && ( this.dom ); - this.ns4 = ( document.layers ) && ( !this.dom ); - this.ns6 = ( this.dom ) && ( parseInt(this.ver) >= 5 ) && ( !this.opera ); - this.ns = ( this.ns4 ) || ( this.ns6 ); - this.ie = ( this.ie4 ) || ( this.ie5 ) || ( this.ie6 ); - - return this; -} - - -function showmenu(event) { - - if (browser.ns4) { - if (event.which == 1 && (event.modifiers == Event.CONTROL_MASK) && !menu) { - menu = true; - document.layers["menu"].left = Math.min(event.pageX + 3, innerWidth - 160 + pageXOffset); - document.layers["menu"].top = Math.min(event.pageY + 3, innerHeight - 180 + pageYOffset); - document.layers["menu"].clip.width = 140; - document.layers["menu"].bgColor = "#DDDDDD"; - document.layers["menu"].margin = 4; - document.layers["menu"].visibility = "show"; - } else if (menu) { - menu = false; - document.layers["menu"].visibility = "hide"; - } - - } else if (browser.ns6) { - if (event.which == 1 && event.ctrlKey && !menu) { - menu = true; - document.getElementById("menu").style.left = Math.min(event.pageX + 3, innerWidth - 160 + pageXOffset); - document.getElementById("menu").style.top = Math.min(event.pageY + 3, innerHeight - 160 + pageYOffset); - document.getElementById("menu").style.visibility = "visible"; - } else if (menu) { - menu = false; - document.getElementById("menu").style.visibility = "hidden"; - } - } else { - event = window.event; - - if (event.button == 1 && event.ctrlKey && !menu) { - menu = true; - document.all["menu"].style.left = event.x + 3; - document.all["menu"].style.top = event.y + 3; - document.all["menu"].style.visibility = "visible"; - } else if (menu) { - menu = false; - document.all["menu"].style.visibility = "hidden"; - } - } -} - - -function cm_htmlCode() { - - document.write('<style type="text/css">\n'); - document.write(' table {border-left: 1px solid #CCCCCC; border-top: 1px solid #CCCCCC; border-right: 1px solid #000000; border-bottom: 1px solid #000000; }\n'); - document.write(' td {font-family: verdana; color: #666666; font-size: 11px; text-decoration: none}\n'); - document.write(' a:link, a:visited, a:active {font-family: verdana; color: #666666; font-size: 11px; font-weight: bold; text-decoration: none}\n'); - document.write(' a:hover {font-family: verdana; color: #000000; font-size: 11px; text-decoration: none}\n'); - document.write('</style>\n'); - document.write('<div ID="menu" style="position:absolute; width: 140px; background-color: #DDDDDD; visibility:hidden">\n'); - document.write(' <table width="140" align="center" cellspacing="0" cellpadding="0">\n'); - document.write(' <tr><td><a href="#" onmousedown="backPage(false)"> prev</a></td></tr>\n'); - document.write(' <tr><td><a href="#" onmousedown="nextPage(false)"> next</a></td></tr>\n'); - document.write(' <tr><td><a href="#" onmousedown="page(false)"> page #</a></td></tr>\n'); - document.write(' <tr><td align="center"><img src="modules/cm_separator.gif" width="136" height="3"></td></tr>\n'); - document.write(' <tr><td><a href="#" onmousedown="mark()"> mark</a></td></tr>\n'); - document.write(' <tr><td> reference <a href="#" onmousedown="ref(1)">html</a> <a href="#" onmousedown="ref(0)">latex</a></td></tr>\n'); - document.write(' <tr><td align="center"><img src="modules/cm_separator.gif" width="136" height="3"></td></tr>\n'); - document.write(' <tr><td><a href="#" onmousedown="zoomArea()"> zoom area</a></td></tr>\n'); - document.write(' <tr><td><a href="#" onmousedown="zoomPoint()"> zoom point</a></td></tr>\n'); - document.write(' <tr><td><a href="#" onmousedown="moveTo()"> move to</a></td></tr>\n'); - document.write(' <tr><td><a href="#" onmousedown="zoomOut()"> zoom out</a></td></tr>\n'); - document.write(' <tr><td align="center"><img src="modules/cm_separator.gif" width="136" height="3"></td></tr>\n'); - document.write(' <tr><td> scale <a href="#" onmousedown="scale(0.7)">0.7</a> <a href="#" onmousedown="scale(1.0)">1.0</a> <a href="#" onmousedown="scale(2.0)">2.0</a> <a href="#" onmousedown="scale(3.0)">3.0</a></td></tr>\n'); - document.write(' </table>\n'); - document.write('</div>\n'); - -}
--- a/client/digitallibrary/modules/fitGIFs.js Thu Oct 28 22:25:58 2004 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,58 +0,0 @@ -/* - -Copyright (C) 2003 WTWG, Uni Bern - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Author: Christian Luginbuehl, 22.05.2003 , Version Alcatraz 0.4 - -*/ - -/************************************************************************* - * fitGIFs.js : digilib-module * - * * - * desc: enable od disable the fitting of GIF/PNG images to the * - * drawing area. - * * - *************************************************************************/ - - -/** - * fitGIFs - */ -function fitGIFs() { - - if ( dlParams.mo.value != '' ) { - - idx_plus_after = dlParams.mo.value.indexOf("fit,"); - idx_plus_before = dlParams.mo.value.indexOf(",fit"); - idx_noplus = dlParams.mo.value.indexOf("fit"); - - if ( idx_plus_after > -1 ) { - dlParams.mo.value = dlParams.mo.value.slice(0, idx_plus_after) + dlParams.mo.value.slice(idx_plus_after+5); - } else if ( idx_plus_before > -1 ) { - dlParams.mo.value = dlParams.mo.value.slice(0, idx_plus_before) + dlParams.mo.value.slice(idx_plus_before+5); - } else if ( idx_noplus > -1 ) { - dlParams.mo.value = dlParams.mo.value.slice(0, idx_noplus) + dlParams.mo.value.slice(idx_noplus+4); - } else { - dlParams.mo.value += ",fit"; - } - } else { - dlParams.mo.value = "fit"; - } - - display(3); - -} \ No newline at end of file
--- a/client/digitallibrary/modules/pagesTotal.js Thu Oct 28 22:25:58 2004 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,99 +0,0 @@ -/* - -Copyright (C) 2003 WTWG, Uni Bern - -This program is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA - -Author: Christian Luginbuehl, 22.05.2003 , Version Alcatraz 0.4 - -*/ - -/************************************************************************* - * pagesTotal.js : digilib-module * - * * - * desc: displaying the total number of pages in a designated frame, * - * when calling pagesTotal(). also overrides nextPage() and * - * page() functions, by adding last-page tests. * - * * - *************************************************************************/ - - -/** - * shows 'page XX of YY' in a designated frame - */ -function showTotalPages() { - - var pf = parent.pageFrame; - - if ( pf ) { - pf.document.open(); - pf.document.write('<html><head></head>'); - pf.document.write('<body bgcolor="#CCCCCC" topmargin="5" marginheight="5">'); - pf.document.write('<p style="font-family: Verdana, Arial, Helvetica, sans-serif; text-align: center; color: #CC3333; font-size: 11px">'); - pf.document.write(dlParams.pn.value + '<b> of </b>' + dlParams.pt.value + '</p></body></html>'); - pf.document.close(); - } - -} - - -/** - * extending init from novaigation.js - */ -function init_pagesTotal() { - - init(); - - showTotalPages(); - -} - - -/** - * overriding 'page' in navigation.js - */ -function page(page, details) { - - if ( details == null ) { - details = 1; - } - - if ( page && page.indexOf('-') == 0 ) { - if ( dlParams.pn.value > 1 ) { - page = Math.max(parseInt(dlParams.pn.value) - parseInt(page.slice(1)), 1); - dlParams.pn.value = page; - display(details); - } else { - alert("You are already on the first page!"); - } - - } else if ( page && page.indexOf('+') == 0 ) { - if ( parseInt(dlParams.pn.value) < parseInt(dlParams.pt.value) ) { - page = Math.min(parseInt(dlParams.pn.value) + parseInt(page.slice(1)), dlParams.pt.value); - dlParams.pn.value = page; - display(details); - } else { - alert("You are already on the last page!"); - } - } else if ( page && page == parseInt(page) ) { - if ( (page > 0) && (page <= parseInt(dlParams.pt.value)) ) { - dlParams.pn.value = parseInt(page); - display(details); - } else { - alert ("Illegal page number (1 - " + dlParams.pt.value + ")!"); - } - } - -} \ No newline at end of file
--- a/client/digitallibrary/modules/pdfMaker.js Thu Oct 28 22:25:58 2004 +0200 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,17 +0,0 @@ -/**************************************************************************** - * - sample module for digilib * - * * - * christian luginbuehl (luginbuehl@student.unibe.ch) * - ****************************************************************************/ - -/** - * generates a pdf-file using a perl-script called makepdf - * - * ATTENTION: the script and this function are only in alpha stadium - */ -function makePDF() { - var pages = prompt("Enter the pages you like to make a PDF of:", att[1]); - if (pages != null && pages != "") { - top.location = "http://penelope.unibe.ch/cgi-bin/cgiwrap/luginbul/makepdf.cgi?dir=" + att[0] + "&pages=" + pages; - } -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/oldskin/dcMain.jsp Thu Oct 28 22:25:58 2004 +0200 @@ -0,0 +1,82 @@ +<%@ page language="java" %><%! +// authentication stuff - robert +// ----------------------------- +// create DocumentBean instance for all JSP requests +digilib.servlet.DocumentBean docBean = new digilib.servlet.DocumentBean(); + +// initialize DocumentBean instance in JSP init +public void jspInit() { + try { + // set servlet init-parameter + docBean.setConfig(getServletConfig()); + } catch (javax.servlet.ServletException e) { + System.out.println(e); + } +} +%><% + +// parsing the query +// ----------------- + +digilib.servlet.DigilibRequest dcRequest = new digilib.servlet.DigilibRequest(request); +// check if authentication is needed and redirect if necessary +docBean.doAuthentication(dcRequest, response); +// set number of pages +dcRequest.setValue("pt", docBean.getNumPages(dcRequest)); +// chop off /oldskin -- ugly ;-( +String baseUrl = dcRequest.getAsString("base.url"); +int p = baseUrl.lastIndexOf("/oldskin"); +if (p > 0) { + baseUrl = baseUrl.substring(0, p); +} +%> +<html> +<head> +<script type="text/javascript" src="../baselib.js"></script> +<script type="text/javascript" src="dclib.js"></script> +<script type="text/javascript"> +var baseUrl = "<%= baseUrl %>"; +newParameter('fn', '', 1); +newParameter('pn', 1, 1); +newParameter('pt', 9, 9); +newParameter('mx', '6x4', 1); +newParameter('mo', '', 1); +newParameter('dw', 0, 1); +newParameter('dh', 0, 1); +dc_init(); +</script> + +<style type="text/css"> +td { + font-family: Helvetica, Arial, sans-serif; + font-size: 11px; + color: #FFFFFF; + text-align: center; + vertical-align: middle; +} +.number { + font-family: Helvetica, Arial, sans-serif; + font-size: 11px; + color: #FFFFFF; + padding-top: 2px; +} +.nonumber { + font-family: Helvetica, Arial, sans-serif; + font-size: 11px; + color: #000000; + padding-top: 2px; +} +</style> +</head> + +<body bgcolor="#666666"> + +<div align="center"> +<script type="text/javascript"> + dc_render(document); +</script> +</div> + +</body> + +</html>