changeset 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 e1d587a4e9b1
children 074c3117f292
files client/digitallibrary/oldskin/dclib.js
diffstat 1 files changed, 122 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/client/digitallibrary/oldskin/dclib.js	Thu Oct 28 22:25:58 2004 +0200
@@ -0,0 +1,122 @@
+/*
+Copyright (C) 2003-2004 WTWG Uni Bern, MPIWG Berlin
+ 
+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, 07.04.2004 , Version Alcatraz 0.6
+  Robert Casties 28.10.2004
+
+!! requires baselib.js !!
+
+*/
+
+function identify() {
+  return 'Digicat v0.4';
+}
+
+var cells = null;
+
+
+function dc_init() {
+
+  // put the query parameters (sans "?") in the parameters array
+  parseParameters(location.search.slice(1));
+}
+
+function display(detail) {
+    // redisplay the page
+    if (! detail) {
+	detail = 9;
+    }
+    var queryString = getAllParameters(detail);
+    location.href = location.protocol + "//" + location.host + location.pathname + "?" + queryString;
+}
+
+function dc_render(doc) {
+	
+  var fWidth  = document.body ? document.body.clientWidth : innerWidth;
+  var fHeight = document.body ? document.body.clientHeight : innerHeight;
+
+  var mx = getParameter("mx");
+  cells = mx.split('x');
+  
+  var dw = getParameter("dw");
+  var dh = getParameter("dh");
+  var pt = getParameter("pt");
+  var pn = getParameter("pn");
+
+  var picWidth = (dw != 0) ? dw : Math.floor((fWidth-30)/cells[0])-2*cells[0]-1;
+  var picHeight = (dh != 0) ? dh : picWidth;
+
+  if (cells.length > 1) {
+    picHeight = (dh != 0) ? dh : Math.floor(((fHeight-30)-12*cells[1])/cells[1])-2*cells[1]-1;
+  } else {
+    cells[1] = Math.ceil(pt/cells[0]);
+  }
+
+  var cellWidth  = parseInt(picWidth)+8;
+  var cellHeight = parseInt(picHeight)+18;
+
+  doc.writeln('<table width="100%" height="100%" border="0" cellspacing="1" cellpadding="0">');
+
+  for (var j = 0; j < cells[1]; j++) {
+      doc.writeln('<tr>');
+      for (var i = 0; i < cells[0]; i++) {
+	  var idx  = parseInt(pn)+i+j*cells[0];
+	  var img  = baseUrl + "/servlet/Scaler?fn=" + getParameter("fn") + "&pn=" + idx;
+	  img += "&dw=" + picWidth + "&dh=" + picHeight + "&mo=" + getParameter("mo");
+	  doc.write('<td width="'+cellWidth+'" height="'+cellHeight+'">');
+	  if (idx <= pt) {
+	      doc.write('<a href="'+dl_link(idx)+'" target="_blank"><img src="'+img+'" border="0"></a><div class="number">'+idx+'</div>');
+	  } else {
+	      doc.write('<div class="nonumber">'+idx+'</div>');
+	  }
+	  doc.writeln('</td>');
+      }
+      doc.writeln(' </tr>');
+  }
+  doc.writeln('</table>');
+}
+
+
+function dl_link(i) {
+    var link = baseUrl+"/digilib.jsp?fn="+getParameter("fn")+"&pn="+i+"&mo="+getParameter("mo");
+    return link;
+}  
+
+
+function Backpage() {
+    var pn = parseInt(getParameter("pn"));
+    if (pn <= 1) {
+	pn = 1;
+        alert("You are already on the first page!");
+    }
+
+    pn = pn - parseInt(cells[0]*cells[1]);
+
+    if (pn < 1) {
+    	pn = 1;
+    }
+    setParameter("pn", pn);
+    display();
+}
+
+function Nextpage() {
+    var pn = parseInt(getParameter("pn"));
+    pn = pn + parseInt(cells[0]*cells[1]);
+    setParameter("pn", pn);
+    display();
+}