# HG changeset patch # User engler # Date 1052852542 -7200 # Node ID 85126da2ae2113b60adc42a70bb6002b47071c11 # Parent ecee3ff2f4d05e5e21e7eedc4a3301117c4de7fa XUL: Digilib Buttons in chrome diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/CHANGES --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/CHANGES Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,50 @@ +changes document for digilib-client +----------------------------------- + + +CURRENT SYMLINKS + +navigation_XX.js -> navigation14_XX.js +digilib.jsp -> digilib19.jsp + + +CHANGES + +24.1.2003 - [different files] : roc +- New Servlet version 1.5b with internal cleanup and new Request and + Configuration classes. +- New JSPs dlInfo-js.jsp and server/dlConfig.jsp to show the request parameter + as JavaScript and the configuration settings as HTML. + +8.1.2003 - DigilibServlet.jar : roc +- New servlet and classes for JAI ImageIO (currently not used). + +27.8.2002 - digilib.jsp, digicat.jsp, dlImage.jsp : roc + +- Initialization of docBean only once in jspInit. +- Use of new DigilibRequest object for translation of +++-style requests + into parameter-style requests and processing of baseURL. + +13.8.2002 - [different files] : roc + +- changed all hardcoded occurrences of /docuserver/digitallibrary to + work relative or take the path from the request URL. Introduced a + variable baseURL to hold the URL path (up to digilib.jsp etc.). Now + it should be possible to install digilib in other directories. + +20.05.2002 - navigation_o6.js : luginbuehl + +- Opera browser support done. the 'b'-key does not work currently, beause + Opera uses this key on its own - have to work something out... + +18.05.2002 - [different files] : luginbuehl + +- works on Opera browser support (functionality is getting better, menu + still has lots of errors) +- working on a Opera version that does work independantly of the http + browser imitation set (though!) + +18.05.2002 - modules/pagesTotal.js : luginbuehl + +- fixied an error in function page(keepArea) which did not work on all + browsers correctly. diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/WEB-INF/digilib-auth.xml --- a/client/digitallibrary/WEB-INF/digilib-auth.xml Tue May 13 20:59:47 2003 +0200 +++ b/client/digitallibrary/WEB-INF/digilib-auth.xml Tue May 13 21:02:22 2003 +0200 @@ -1,5 +1,4 @@ - + diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/WEB-INF/digilib-config.xml --- a/client/digitallibrary/WEB-INF/digilib-config.xml Tue May 13 20:59:47 2003 +0200 +++ b/client/digitallibrary/WEB-INF/digilib-config.xml Tue May 13 21:02:22 2003 +0200 @@ -13,6 +13,12 @@ Directories with low-resolution images are first in list. --> + + + + + + - - Docuserver - - This is the web frontend of Docuserver. - - - - - Scaler - - The servlet to scale the digilib images. - - digilib.servlet.Scaler - - - config-file - - /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml - - - - 5 - - + + + digilib + + + This is the web frontend of the Digital Document Library. + + + + + Scaler + + + The servlet to scale the digilib images. + + + digilib.servlet.Scaler + + + + + config-file + + + /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml + + + + + 5 + + - doc-jsp - org.apache.jasper.servlet.JspServlet - - logVerbosityLevel - WARNING - - - - config-file - - /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml - - - 3 + + doc-jsp + + + org.apache.jasper.servlet.JspServlet + + + + + logVerbosityLevel + + + WARNING + + + + + config-file + + + /docuserver/www/digitallibrary/WEB-INF/digilib-config.xml + + + + 3 + - - + + + + Scaler + + + /servlet/Scaler/* + + - doc-jsp - *.jsp + + doc-jsp + + + *.jsp + - - - - - Authenticated Digilib - /authenticated/* - - - user - - - - - - FORM - - /digilib-login.html - /digilib-fail.html - - - - + + + + Authenticated Digilib + + + /authenticated/* + + + + + + user + + + + + + + FORM + + + + /digilib-login.html + + + /digilib-fail.html + + + diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/buttons/menu.js --- a/client/digitallibrary/buttons/menu.js Tue May 13 20:59:47 2003 +0200 +++ b/client/digitallibrary/buttons/menu.js Tue May 13 21:02:22 2003 +0200 @@ -1,13 +1,19 @@ -function checkBrowser(){ - this.ver = navigator.appVersion; - this.dom = document.getElementById ? 1 : 0; - this.ie5 = (this.ver.indexOf("MSIE 5")>-1 && this.dom) ? 1 : 0; - this.ie4 = (document.all && !this.dom) ? 1 : 0; - this.ns5 = (this.dom && parseInt(this.ver) >= 5) ? 1 : 0; - this.ns4 = (document.layers && !this.dom) ? 1 : 0; - this.ie = (this.ie4 || this.ie5); - return this; -} +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; +} browser = new checkBrowser(); @@ -63,7 +69,7 @@ } function awayItem(obj) { - changeBc("menu" + obj, ''); + changeBc("menu" + obj, '#666666'); timeID = setTimeout("hideMenu()", 700); } @@ -138,10 +144,17 @@ helpWindow.document.close(); // stupid workaround because of netscape 6, that doesen't know the opener property - // this workaround is still ok cause netscape 6 has eventbuffer checks so no overflow - if (browser.ns5) { + // this workaround is still ok because netscape 6 has eventbuffer checks so no overflow + if (browser.ns6) { semaphor = true; } + + // next stupid workaround because of opera 6, that somehow don't start the 'onLoad'- + // attribute in the body tag (the helpwindow does not finish loading) + if (browser.opera) { + setTimeout("semaphor = true;", 50); + } + } } diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/digicat.html --- a/client/digitallibrary/digicat.html Tue May 13 20:59:47 2003 +0200 +++ b/client/digitallibrary/digicat.html Tue May 13 21:02:22 2003 +0200 @@ -8,7 +8,9 @@ @@ -17,9 +19,12 @@

Digital Library Redirect

-

You should automatically be redirected to the Digital Library page.

+

You should automatically be redirected to the Digital Library page. + (digicat.jsp)

-

If this doesn't happen please click here.

+

If this doesn't happen make shure JavaScript is enabled in your browser. + The Digital Library pages need JavaScript to work. If your problem still + remains, please contact the administrator.


robert.casties@philo.unibe.ch
diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/digicat.jsp --- a/client/digitallibrary/digicat.jsp Tue May 13 20:59:47 2003 +0200 +++ b/client/digitallibrary/digicat.jsp Tue May 13 21:02:22 2003 +0200 @@ -1,28 +1,47 @@ +<%@ 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); + } +} +%> + +<% +// set up request object for base URL +digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); +// check if authentication is needed and redirect if necessary +docBean.doAuthentication(dlRequest, response); + +// add number of pages +dlRequest.setPt(docBean.getNumPages(dlRequest)); +%> + - - -<% -// set servlet init-parameter -DB.setConfig(getServletConfig()); -// check if authentication is needed and redirect if necessary -DB.doAuthentication(request, response); -%> - -

Digital Library Redirect

-

You should automatically be redirected to the Digital Library page.

+

You should automatically be redirected to the Digital Library page. + (digilib.jsp)

-

If this doesn't happen please click here.

+

If this doesn't happen make shure JavaScript is enabled in your browser. + The Digital Library pages need JavaScript to work. If your problem still + remains, please contact the administrator.


robert.casties@philo.unibe.ch
diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/digilib.jsp --- a/client/digitallibrary/digilib.jsp Tue May 13 20:59:47 2003 +0200 +++ b/client/digitallibrary/digilib.jsp Tue May 13 21:02:22 2003 +0200 @@ -1,49 +1,252 @@ - -Digital Document Library - - - -<% -// set servlet init-parameter -DB.setConfig(getServletConfig()); -// check if authentication is needed and redirect if necessary -DB.doAuthentication(request, response); -%> - - - - - - - - - - - - - - +<%@ page language="java" %> + +<%! +/* +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, 01.05.2003 , Version Alcatraz 0.3 +*/ +// 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 dlRequest = new digilib.servlet.DigilibRequest(request); +digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(); +dlRequest.setWithRequest(request); +// check if authentication is needed and redirect if necessary +docBean.doAuthentication(dlRequest, response); + +%> + +<% + +// the different levels of presentation +// ------------------------------------ + + +// level 3 representation hack - lugi + // it would be musch more interesting to check + // if the sidebar is actually installed and in + // the case it isn't - automatically do it. + // however this requires client-side tests and + // so slows down everything. + // we might want to talk about it for a future + // release + +if (dlRequest.getLv() == 3) { + String userAgent = request.getHeader("User-Agent").toLowerCase(); + + if (userAgent.indexOf("mozilla/5.0") == 0) { + + // mozilla 5 that does not support xul-sidebars + if (userAgent.indexOf("opera") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("chimera") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("camino") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("konqueror") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("safari") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("galeon") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("skipstone") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("k-meleon") > -1) dlRequest.setLv(2); + if (userAgent.indexOf("firebird") > -1) dlRequest.setLv(2); + + // the chance is quite big, that the browser supports xul-sidebars + dlRequest.setLv(1); + + } else { + + // redirect to level 2 because of definitive lack of sidebar support + dlRequest.setLv(2); + } +} + + + +switch (dlRequest.getLv()) { + + // LEVEL 0 -------------------------------------------------------------- + + case 0: +%> + +<% + break; // level 0 + + + + + // LEVEL 1 -------------------------------------------------------------- + + case 1: +%> + +<% + // checking if the height and width of this client is already known + if ((dlRequest.getDw() == 0) || (dlRequest.getDh() == 0)) { +%> + + + + + + + + + +<% + } else { + + // add number of pages + dlRequest.setPt(docBean.getNumPages(dlRequest)); + + String imageLocation = dlRequest.getBaseURL() + "/servlet/Scaler/?" + dlRequest.getAsString(); +%> + + + +Digital Document Library - Alcatraz (Level 1) + + + + + + + +
+ + + + + + + + + + + + + + + + + +<% + } +%> + +<% + break; // level 1 + + + + + // LEVEL 2 -------------------------------------------------------------- + + case 2: +%> + +<% + // retrieve request in new paramter format and redirect to level 1 + dlRequest.setLv(1); + String query = "digilib.jsp?" + dlRequest.getAsString(); +%> + + + +Digital Document Library - Alcatraz (Level 2) + + + + + + + + + + + + +<% + break; // level 2 + +} // end switch + +%> diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/dlImage.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/dlImage.jsp Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,94 @@ +<% +// checking if the height and width of this client is already known +if ((request.getParameter("dw") == null) || (request.getParameter("dh") == null)) { +%> + + + + + + + + + +<% +} else { + +digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(); +/* default values for parameters +dlRequest.setFn("/"); // url of the page/document +dlRequest.setPn(1); // page number +dlRequest.setWs(1); // scale factor +dlRequest.setMo(""); // special options like 'fit' for gifs +dlRequest.setMk("0/0"); // marks +dlRequest.setWx(0); // left edge of image (float from 0 to 1) +dlRequest.setWy(0); // top edge in image (float from 0 to 1) +dlRequest.setWw(1); // width of image (float from 0 to 1) +dlRequest.setWh(1); // height of image (float from 0 to 1) +*/ +// overrriding default parameters with provided parameters from query-string +dlRequest.setWithRequest(request); + +String imageLocation = dlRequest.getBaseURL() + "/servlet/Scaler/?" + dlRequest.getAsString(); +%> + + + + + + + +
+ + + + + + + + + + + + + + + +<% +} +%> diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/dlInfo-js.jsp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/dlInfo-js.jsp Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,44 @@ +<%@ 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); + } +} +%> + +<% +// parse the query +digilib.servlet.DigilibRequest dlRequest = new digilib.servlet.DigilibRequest(request); +// add number of pages from DocBean +dlRequest.setPt(docBean.getNumPages(dlRequest)); +%> + +// Automatically generated JavaScript snippet with parameters + +var dlreqPt = <%= dlRequest.getPt() %>; // total number of pages (generated by sevlet) + +var dlreqRequestPath = "<%= dlRequest.getRequestPath() %>"; // url of the page/document +var dlreqFn = "<%= dlRequest.getFn() %>"; // url of the page/document +var dlreqFilePath = "<%= dlRequest.getFilePath() %>"; // effective path of the page/document +var dlreqPn = "<%= dlRequest.getPn() %>"; // page number +var dlreqDw = "<%= dlRequest.getDw() %>"; // width of client in pixels +var dlreqDh = "<%= dlRequest.getDh() %>"; // height of client in pixels +var dlreqWx = "<%= dlRequest.getWx() %>"; // left edge of image (float from 0 to 1) +var dlreqWy = "<%= dlRequest.getWy() %>"; // top edge in image (float from 0 to 1) +var dlreqWw = "<%= dlRequest.getWw() %>"; // width of image (float from 0 to 1) +var dlreqWh = "<%= dlRequest.getWh() %>"; // height of image (float from 0 to 1) +var dlreqWs = "<%= dlRequest.getWs() %>"; // scale factor +var dlreqMo = "<%= dlRequest.getMo() %>"; // special options like 'fit' for gifs +var dlreqMk = "<%= dlRequest.getMk() %>"; // marks +var dlreqBaseURL = "<%= dlRequest.getBaseURL() %>"; // base URL (from http:// to below /servlet) diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/dlMenu.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/dlMenu.html Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,108 @@ + + + + + + + + +
+
+
+

+
+

+
+
+
+

+

+ + + + + + + + + + + + + + + + + + + + + + + + diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/modules/cm_separator.gif Binary file client/digitallibrary/modules/cm_separator.gif has changed diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/modules/contextMenu.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/modules/contextMenu.js Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,117 @@ +/**************************************************************************** + * - 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 of dlImage.jsp: * + * * + * * + * * + * 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('\n'); + document.write('\n'); + +} diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/modules/fitGIFs.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/modules/fitGIFs.js Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,54 @@ +/* +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, 01.05.2003 , Version Alcatraz 0.3 +*/ +/**************************************************************************** + * - fitGIFs module for digilib * + * * + * christian luginbuehl (luginbuehl@student.unibe.ch) * + ****************************************************************************/ + + + +/** + * fitGIFs + */ +function fitGIFs() { + + if (att.mo != "") { + + idx_plus_after = att.mo.indexOf("fit,"); + idx_plus_before = att.mo.indexOf(",fit"); + idx_noplus = att.mo.indexOf("fit"); + + if (idx_plus_after > -1) { + att.mo = att.mo.slice(0, idx_plus_after) + att.mo.slice(idx_plus_after+5); + } else if (idx_plus_before > -1) { + att.mo = att.mo.slice(0, idx_plus_before) + att.mo.slice(idx_plus_before+5); + } else if (idx_noplus > -1) { + att.mo = att.mo.slice(0, idx_noplus) + att.mo.slice(idx_noplus+4); + } else { + att.mo += ",fit"; + } + } else { + att.mo = "fit"; + } + + loadPicture(2); + +} diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/modules/imago.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/modules/imago.js Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,181 @@ +/* +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, 01.05.2003 , Version Alcatraz 0.3 +*/ +/**************************************************************************** + * - imago module for digilib * + * * + * adds brightness and color manipulation to digilib * + * * + * christian luginbuehl (luginbuehl@student.unibe.ch) * + ****************************************************************************/ + +// overriding (some kind of inheriting) init in navigation_XX.js +function init_imago(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt, brgt, cont, rot, rgba, rgbm) { + + // debug window to check the parameters passed + //alert ("DEBUG message (parameters in init imago.js):\n\npu = " + pu + "\npn = " + pn + "\nws = " + ws + "\nmo = " + mo + "\nmk = " + mk + "\nwx = " + wx + "\nwy = " + wy + "\nww = " + ww + "\nwh = " + wh + "\npt = " + pt + "\nbrgt = " + brgt + "\ncont = " + cont + "\nrot = " + rot + "\nrgba = " + rgba + "\nrgbm = " + rgbm); + + // calling original init + init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt); + + att.brgt = parseInt(brgt); + att.cont = parseFloat(cont); + att.rot = parseFloat(rot); + att.rgba = rgba; + att.rgbm = rgbm; + + focus(); +} + + +/** + * overriding 'loadPicture' in navigation + */ +function loadPicture(detailGrade, keepArea) { + + // the different detailGrades: + // 0 -> back, next, page + // 1 -> zoomout + // 2 -> zoomarea, zoompoint, moveto, scaledef + + var newQuery = "fn=" + att.fn + "&pn=" + att.pn + "&ws=" + att.ws + "&mo=" + att.mo; + + if (detailGrade == 0) { + att.mk = "0/0"; + att.brgt = 0; + att.cont = 0; + } + + if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) { + att.wx = 0; + att.wy = 0; + att.ww = 1; + att.wh = 1; + } + + newQuery += "&mk=" + att.mk + "&wx=" + att.wx + "&wy=" + att.wy + "&ww=" + att.ww + "&wh=" + att.wh; + + if (navigator.appName.toLowerCase() == "netscape") { // mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.) + newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30); + } else { // ie, opera + newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30); + } + + newQuery += "&pt=" + att.pt; + + newQuery += "&brgt=" + att.brgt; + newQuery += "&cont=" + att.cont; + newQuery += "&rot=" + att.rot; + newQuery += "&rgba=" + att.rgba; + newQuery += "&rgbm=" + att.rgbm; + + newQuery += "&lv=1"; + + // debug window - checking the parameters passed to the next image + //alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery); + //alert(location.host + ":" + location.port + location.pathname); + location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery; +} + + +/** + * brightness (value of brightness between -255 - +255) + */ +function brightness(value) { + + if ((value < -255) || (value > 255)) { + + alert ("Illegal brightness value (-255 to +255)"); + + } else { + + att.brgt = value; + + loadPicture(2); + } + +} + +/** + * contrast (value of contrast - range?) + */ +function contrast(value) { + + att.cont = parseFloat(value); + + loadPicture(2); + +} + +/** + * rotation (value from 0 to 360 degrees) + */ +function rotation(value) { + + value = parseFloat(value) % 360; + + if (value < 0) { + value += 360; + } + + att.rot = value; + + loadPicture(2); + +} + +/** + * rgb add (r/g/b, each value from -255 to +255) + */ +function rgba(value) { + + values = value.split("/"); + + if (values.length != 3) { + alert ("Illegal parameter format (r/g/b)"); + } else if ((values[0] < -255) || (values[0] > 255)) { + alert ("Illegal red additioner (-255 to 255)"); + } else if ((values[1] < -255) || (values[1] > 255)) { + alert ("Illegal green additioner (-255 to 255)"); + } else if ((values[2] < -255) || (values[2] > 255)) { + alert ("Illegal blue additioner (-255 to 255)"); + } else { + + att.rgba = value; + loadPicture(2); + + } +} + +/** + * rgb multiply (r/g/b, each value from ??? ) + */ +function rgbm(value) { + + values = value.split("/"); + + if (values.length != 3) { + alert ("Illegal parameter format (r/g/b)"); + } else { + + att.rgbm = value; + loadPicture(2); + + } +} diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/modules/pagesTotal.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/modules/pagesTotal.js Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,132 @@ +/* +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, 01.05.2003 , Version Alcatraz 0.3 +*/ +/**************************************************************************** + * - sample module for digilib * + * * + * christian luginbuehl (luginbuehl@student.unibe.ch) * + ****************************************************************************/ + +// overriding (some kind of inheriting) init in navigation13_XX.js +function init_pagesTotal(pu, pn, ws, mo, mk, wx, wy, ww, wh, pt) { + + // debug window to check the parameters passed + //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); + + // calling original init + init(pu, pn, ws, mo, mk, wx, wy, ww, wh); + + att.pt = parseInt(pt); + + pagesTotal(); + + focus(); +} + + +/** + * shows page XX of YY in a dedicated frame + * + * ATTENTION: some stuff is still to do, because of some incompatibilities between servlet and client + * i should be able to read the total number of pages in dlImage.jsp + */ +function pagesTotal() { + + if (parent.pageFrame) { + parent.pageFrame.document.open(); + parent.pageFrame.document.write(''); + parent.pageFrame.document.write('

'); + parent.pageFrame.document.write(att.pn + ' of ' + att.pt + '

'); + parent.pageFrame.document.close(); + } +} + + +/** + * overriding nextPage in navigation + */ +function nextPage(keepArea) { + + att.pn = parseInt(att.pn) + 1; + + if (att.pn <= att.pt || isNaN(att.pt)) { + loadPicture(0, keepArea); + } else { + att.pn = parseInt(att.pn) - 1; + alert("You are already on the last page!"); + } +} + + +/** + * overriding 'page' in navigation + */ +function page(keepArea) { + + do { + var page = prompt("Goto Page (1 - " + att.pt + "):", 1); + + } while ((page != null) && ((isNaN(page)) || (page < 1) || (page > att.pt))); + + if ((page != null) && (page != att.pn)) { + att.pn = page; + loadPicture(0, keepArea); + } +} + + +/** + * overriding 'loadPicture' in navigation + */ +function loadPicture(detailGrade, keepArea) { + + // the different detailGrades: + // 0 -> back, next, page + // 1 -> zoomout + // 2 -> zoomarea, zoompoint, moveto, scaledef + + var newQuery = "fn=" + att.fn + "&pn=" + att.pn + "&ws=" + att.ws + "&mo=" + att.mo; + + if (detailGrade == 0) { + att.mk = "0/0"; + } + + if ((detailGrade == 1) || (detailGrade == 0 && !keepArea)) { + att.wx = 0; + att.wy = 0; + att.ww = 1; + att.wh = 1; + } + + newQuery += "&mk=" + att.mk + "&wx=" + att.wx + "&wy=" + att.wy + "&ww=" + att.ww + "&wh=" + att.wh; + + if (navigator.appName.toLowerCase() == "netscape") { // mozilla-browsers (netscape 4.xx, netscape 6.xx, etc.) + newQuery += "&dw=" + (innerWidth-30) + "&dh=" + (innerHeight-30); + } else { // ie, opera + newQuery += "&dw=" + (document.body.clientWidth-30) + "&dh=" + (document.body.clientHeight-30); + } + + newQuery += "&pt=" + att.pt; + newQuery += "&lv=1"; + + // debug window - checking the parameters passed to the next image + //alert ("DEBUG MESSAGE (query-string in loadPicture):\n\n" + newQuery); + + location.href = location.protocol + "//" + location.host + location.pathname + "?" + newQuery; +} diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/modules/pdfMaker.js --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/client/digitallibrary/modules/pdfMaker.js Tue May 13 21:02:22 2003 +0200 @@ -0,0 +1,17 @@ +/**************************************************************************** + * - 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; + } +} diff -r ecee3ff2f4d0 -r 85126da2ae21 client/digitallibrary/navcat_ie.js --- a/client/digitallibrary/navcat_ie.js Tue May 13 20:59:47 2003 +0200 +++ b/client/digitallibrary/navcat_ie.js Tue May 13 21:02:22 2003 +0200 @@ -1,23 +1,3 @@ -/* navcat_ie -- JS library for digilib (IE version) - - Digital Image Library servlet components - - Copyright (C) 2001, 2002 Christian Luginbuehl (luginbuehl@student.unibe.ch) - - 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. - - Please read license.txt for the full details. A copy of the GPL - may be found at http://www.gnu.org/copyleft/lgpl.html - - 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 - -*/ - // these two global variables have to be initialised before the frist use of the functions below // to fill in the attributes you can use the function initPicture provided below // - array with all attributes @@ -44,7 +24,7 @@ whichFrame.document.write(''); whichFrame.document.write('