/[webpac]/trunk2/openisis/idm.jsp
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk2/openisis/idm.jsp

Parent Directory Parent Directory | Revision Log Revision Log


Revision 337 - (show annotations)
Thu Jun 10 19:22:40 2004 UTC (16 years, 4 months ago) by dpavlin
File size: 21258 byte(s)
new trunk for webpac v2

1 <%--
2 openisis - an open implementation of the ISIS database
3 Version 0.8.x (microversion see file Version)
4 Copyright (C) 2001-2002 by Erik Grziwotz, erik@openisis.org
5
6 This library is free software; you can redistribute it and/or
7 modify it under the terms of the GNU Lesser General Public
8 License as published by the Free Software Foundation; either
9 version 2.1 of the License, or (at your option) any later version.
10
11 This library is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 Lesser General Public License for more details.
15
16 You should have received a copy of the GNU Lesser General Public
17 License along with this library; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19
20 This software is dedicated to the memory of Eckart Dietrich.
21
22 This software is inspired by (but contains no code of) the iAPI
23 Copyright (C) 2000 by Robert Janusz, rj@jezuici.krakow.pl.
24 See iAPI.txt for what it contains.
25 EOH
26 --%><%@page
27 import="org.openisis.*,java.io.IOException,java.util.*,java.net.URLEncoder"
28 contentType="text/html; charset=iso-8859-1"
29 %><%!
30 static final String ID = "$Id: idm.jsp,v 1.4 2002/12/13 21:30:27 kripke Exp $";
31 static final String EMPTY = "";
32 static Db db;
33 static String dberr = EMPTY;
34 static String me = "idm";
35 static {
36 try {
37 String[] args = new String[] { "-v", "info", "-encoding", "Cp850" };
38 db = Db.open( "/var/db/idm/doku", args );
39 } catch (IOException e) {
40 e.printStackTrace();
41 dberr = e.toString();
42 }
43 };
44 static String NV ( String x ) { return null==x ? EMPTY : x; }
45 static int ROWS = 10; // number of rows to show at once
46 static int TERMS = 50; // number of terms to show at once
47 static int[] tag = {
48 100, 101, 200, 201,
49 301, 302, 430, 435,
50 28, 450, 800, 18
51 };
52 static String[] t = {
53 "Autor(en)", "author", // 100
54 "weitere Personen", "other contributors", // 101
55 "K&ouml;rperschaft als Hrsg.", "corporate body as editor", // 200
56 "weitere K&ouml;rperschaften", "other corporate bodies", // 201
57 "Titel ohne Autorennennung", "title (without indiv. author)", // 301
58 "Titel mit Autor", "title (with author)", // 302
59 "Erscheinungsvermerk", "publisher: name and place", // 430
60 "Erscheinungsjahr", "year of publication", // 435
61 "Erscheinungsland", "country of publication", // 28
62 "Ges.Titel/Ser.Titel/Bandnr.", "series title", // 450
63 "Schlagworte", "keywords", // 800
64 "Dokument Nr.", "no of document", // 18
65 // unused fields:
66 "Universit&auml;tseinrichtung (10):", EMPTY,
67 "Projekt (12):", EMPTY,
68 "Erfassungsdatum (16):", EMPTY,
69 "Dokumententyp (22):", EMPTY,
70 "Physikalische Form (24):", EMPTY,
71 "Sprache des Dokumentes (26):", EMPTY,
72 "Physische Form (440):", EMPTY,
73 "Quelle (Zeitschrift) (480):", EMPTY,
74 "Quelle (Monographie) (490):", EMPTY,
75 "ISBN (600):", EMPTY,
76 "Abstract (900):", EMPTY,
77 EMPTY, EMPTY,
78 EMPTY, EMPTY,
79 // 50: other texts
80 "Dokumentations-Datenbank des IDM der Universit&auml;t Bielefeld",
81 "documentation database of the IDM at the university of Bielefeld",
82 "Suchen", "search",
83 "English", "Deutsch", //54
84 "?", "?",
85 "weiter", "more",
86 "allen Feldern", "all fields", //60
87 // the ops
88 "und","and",
89 "oder","or",
90 "ohne","without",
91 "zur&uuml;cksetzen","reset",
92 "Name","Surname",//70
93 "Vorname","Given name",
94 "Institut","Institution",
95 "Strasse","Street",
96 "Ort","City",
97 "Land","Country", // 80
98 "Postleitzahl","Zip code",
99 "Bestellen", "order",
100 "Abschicken", "Submit",
101 "Einträge", "rows",
102 "bis", "to", // 90
103 "von", "of",
104 "für", "for",
105 "Indexeinträge beginnend mit", "terms starting with ",
106 "neue Suche", "new Query",
107 // 100: hilfe
108 "<h4>Willkommen bei der Dokumentations-Datenbank des\n"
109 +" IDM der Universit&auml;t Bielefeld</h4>\n"
110 +" Sie können bis zu drei Suchbegriffe verknüpfen.\n"
111 +" Jeder Suchbegriff kann auf ein Feld eingeschränkt werden.<br>\n"
112 +" Die ?-Funktion zeigt Ihnen alle Suchbegriffe,\n"
113 +" die mit dem Feldinhalt beginnen, ggf. auf mehreren Seiten.\n"
114 +" Diese Werte können per Klick übernommen werden.<br><br>\n"
115 +" Mit 'Suchen' wird die Anfrage ausgelöst.\n"
116 +" Es werden jeweils "+ROWS+" Sätze angezeigt.<br><br>\n"
117 +" Kopien von Titeln können gegen Kostenerstattung bestellt werden.<br>\n"
118 +" <h4>Suchtipps</h4>\n"
119 +" Für Prefixsuche beenden Sie den Begriff mit * oder $.<br>\n"
120 +" Die Suche wird auf jeweils 1000 Treffer eingeschränkt.\n"
121 +" Bei sehr häufigen Suchbegriffen, etwa 'a$', gibt es in jedem Satz\n"
122 +" mehrere Treffer, sodass weniger als 1000 Sätze gefunden werden.<br>\n"
123 +" \n"
124 +" Eine engere Suche, etwa durch Einschränkung auf ein Feld,\n"
125 +" kann in einem solchen Fall u.U. mehr Sätze finden!<br>\n"
126 +" Verwenden Sie bei mehreren Begriffen den präzisesten zuerst.<br>\n"
127 +" \n"
128 +" <h4>Cookies</h4>\n"
129 +" Die Funktion ist stark beeinträchtigt,\n"
130 +" falls Sie das Session-Cookie ablehnen.<br>\n"
131 +" Ein Session-Cookie wird nicht auf Ihrer Festplatte gespeichert,\n"
132 +" sondern verschwindet beim Schließen des Browsers.\n"
133 +" \n"
134 ,
135 // 101: help
136 "<h4>welcome to the documentation database of the"
137 +" IDM at the university of Bielefeld</h4>"
138 +" Up to three search terms may be combined.\n"
139 +" Each term can be restricted to a specific database field.<br>\n"
140 +" Use the ? beneath a field to display all entries in the index\n"
141 +" starting with the currently entered term.\n"
142 +" Click them for use in your query.<br><br>\n"
143 +" The 'search' button starts the query.\n"
144 +" Up to "+ROWS+" records are displayed at once.<br><br>\n"
145 +" You can order copies of each article for a nominal fee.<br>\n"
146 +" <h4>search tips</h4>\n"
147 +" Use a trailing * or $ to search by prefix.<br>\n"
148 +" The query will be restricted to 1000 hits.\n"
149 +" Very frequent terms like 'a$' will have several hits within\n"
150 +" each record, giving less than 1000 records total.<br>\n"
151 +" Restricting the query, e.g. by choosing a database field,\n"
152 +" may thus find more records!<br>\n"
153 +" When combining multiple terms, use the most specific one first\n"
154 +" for best results.<br>\n"
155 +" \n"
156 +" <h4>Cookies</h4>\n"
157 +" This page will not work properly,\n"
158 +" if you do not accept the session cookie.<br>\n"
159 +" This is not stored on your hard disc,\n"
160 +" but deleted after you quit your browser.\n"
161 ,
162 "entfernen", "remove",
163 "E-Mail", "e mail",
164 "Telefon", "phone",
165 "bitte füllen Sie die markierten Felder aus",
166 "please fill in all marked fields",
167 // 110
168 "Ihre Bestellung wurde abgeschickt. Vielen Dank",
169 "Your order has been submitted. Thank you",
170 "Ihre Bestellung konnte leider nicht abgeschickt werden."
171 +" Bitte versuchen Sie es später",
172 "Your order could not be submitted. Please try again later",
173 };
174 static final String[] ORDER = {
175 "Xlastname", "firstname", "institution", "Xstreet",
176 "Xcity", "country", "Xzip", "mail", "phone",
177 };
178 static final int[] ORDERT = { 70,72,74,76, 78,80,82,104,106 };
179
180 // check button value independet of language used
181 static boolean chkbutton ( int n, String param ) {
182 return t[n].equals( param ) || t[n+1].equals( param );
183 }
184 static int chkint ( int min, int max, int def, String param ) {
185 if ( null != param ) try {
186 int j = Integer.parseInt(param);
187 if ( min <= j && j <= max )
188 return j;
189 } catch (Exception e) {
190 }
191 return def;
192 }
193
194 static final int OP_AND = 0;
195 static final int OP_OR = 1;
196 static final int OP_NOT = 2;
197 static final char[] OP = { '*', '+', '^' };
198
199 static final String ORDERMAIL = "idmdoku@openisis.org";
200 static final String[] MAILHEADERS = {
201 Mail.TO, ORDERMAIL,
202 Mail.FROM, "Online-Katalog <server@openisis.org>",
203 Mail.SUBJECT, "online Bestellung",
204 };
205
206 static final int LINES = 3;
207
208 static class Ses {
209 int l; // lang, 0 or 1
210 int off = 0;
211 int rows = ROWS;
212 int view; // last seen view
213 int idx; // field to save index into
214 int msec; //
215
216 String qry;
217 int[] set;
218 int len;
219
220 // form content:
221 String[] t = new String[LINES];
222 String[] o = new String[ORDER.length]; // order data
223 int[] f = new int[LINES]; // 0 or 1+index of selected tag
224 int[] op = new int[LINES];
225
226 Iterator i;
227 String term = EMPTY;
228 ArrayList orders;
229
230 public Ses () {
231 for ( int i=0; i<LINES; i++ )
232 t[i] = EMPTY;
233 }
234
235 public String mkqry ()
236 {
237 StringBuffer q = new StringBuffer();
238 boolean had = false;
239 for ( int i=0; i<LINES; i++ ) {
240 String v = t[i];
241 int l = v.length();
242 if ( 0 == l )
243 continue;
244 if ( had )
245 q.append(' ').append(OP[op[i]]).append(' ');
246 had = true;
247 boolean blank = 0 <= v.indexOf(' ');
248 if ( blank )
249 q.append('"');
250 if ( '*' == v.charAt(l-1) )
251 q.append( v.substring(0,l-1) ).append('$');
252 else
253 q.append( v );
254 if ( blank )
255 q.append('"');
256 if ( 0 < f[i] && f[i] <= tag.length )
257 q.append('/').append(tag[f[i]-1]);
258 }
259 return qry = q.toString();
260 } // mkqry
261 };
262
263 // tasks: what to do
264 static final int DO_HELP = 0; // default: display help
265 static final int DO_QUERY = 1; // new search
266 static final int DO_QUERYN = 2; // next results
267 static final int DO_INDEX = 3; // display index
268 static final int DO_INDEXN = 4; // next index terms
269 static final int DO_ORDER = 5; // display order form
270 static final int DO_ORDERS = 6; // submit order form
271 static final int DO_LANG = 7; // toggle language
272 static final int DO_BLANK = 8; // empty search
273
274 // views: what to display
275 static final int VW_HELP = 0; // default: display help
276 static final int VW_QUERY = 1; // query results
277 static final int VW_INDEX = 2; // index terms
278 static final int VW_ORDER = 3; // order form
279
280 %><%
281 Ses s;
282 try {
283 s = (Ses) session.getAttribute( me );
284 } catch ( Exception e ) { s = null; }
285 if ( null == s )
286 session.setAttribute( me, s = new Ses() );
287
288 int task = DO_HELP;
289 String order = null;
290
291 // figure out, what to do
292 String wants = request.getParameter( "do" );
293 if ( chkbutton( 52, wants ) )
294 task = DO_QUERY;
295 else if ( chkbutton( 54, wants ) )
296 task = DO_LANG;
297 else if ( "order".equals( wants ) )
298 task = DO_ORDER;
299 else if ( chkbutton( 86, wants ) )
300 task = DO_ORDERS;
301 else if ( "more".equals( wants ) )
302 task = DO_INDEXN;
303 else if ( "new".equals( wants ) )
304 task = DO_BLANK;
305 else if ( null != request.getParameter( "off" ) )
306 task = DO_QUERYN;
307 else // check "index" buttons i0, i1 ...
308 for ( int i=0; i<LINES; i++ )
309 if ( chkbutton( 56, request.getParameter("i"+i) ) ) {
310 task = DO_INDEX;
311 s.idx = i;
312 break;
313 }
314
315 // save common form data
316 for ( int i=0; i<LINES; i++ ) {
317 String p;
318 s.f[i] = chkint( 0, tag.length, s.f[i], request.getParameter( "f"+i ) );
319 s.op[i] = chkint( 0, OP.length-1, s.op[i], request.getParameter( "op"+i ) );
320 if ( null != (p = request.getParameter( "t"+i )) )
321 s.t[i] = p.trim();
322 if ( DO_HELP == task && chkbutton( 56, request.getParameter("i"+i) ) ) {
323 task = DO_INDEX;
324 s.idx = i;
325 }
326 }
327 s.rows = chkint( 1, 5*ROWS, s.rows, request.getParameter( "rows" ) );
328 s.off = chkint( 0, s.len-1, s.off, request.getParameter( "off" ) );
329 for ( int i=0; i<ORDER.length; i++ ) {
330 String v = request.getParameter( ORDER[i] );
331 if ( null != v )
332 s.o[i] = v;
333 }
334
335 switch ( task ) {
336 case DO_BLANK:
337 for ( int i=0; i<LINES; i++ ) {
338 s.f[i] = s.op[i] = 0;
339 s.t[i] = EMPTY;
340 }
341 s.len = 0;
342 s.i = null;
343 s.set = null;
344 case DO_HELP:
345 s.view = VW_HELP;
346 break;
347 case DO_QUERY:
348 long then = System.currentTimeMillis();
349 s.set = db.search( s.mkqry(), Db.QRY_SIMPLE );
350 long now = System.currentTimeMillis();
351 s.len = null == s.set ? 0 : s.set.length;
352 s.off = 0;
353 s.msec = (int)(now - then);
354 case DO_QUERYN:
355 s.view = VW_QUERY;
356 break;
357 case DO_INDEX:
358 String term = s.t[ s.idx ];
359 /*
360 if ( 0 == term.length() ) {
361 s.view = VW_HELP;
362 break;
363 }
364 */
365 if ( term.endsWith("*") || term.endsWith("$") )
366 term=term.substring(0,term.length()-1);
367 s.i = db.terms( s.term = term );
368 case DO_INDEXN:
369 s.view = VW_INDEX;
370 break;
371 case DO_LANG:
372 s.l = 1 - s.l; // don't change view
373 break;
374 case DO_ORDER:
375 String id = request.getParameter("id");
376 if ( null != id ) {
377 if ( null == s.orders )
378 s.orders = new ArrayList();
379 boolean isnew = true;
380 for ( int i=0; i<s.orders.size(); i++ ) {
381 String[] o = (String[])s.orders.get(i);
382 if ( id.equals( o[0] ) ) {
383 isnew = false;
384 break;
385 }
386 }
387 if ( isnew )
388 s.orders.add( new String[] {
389 id, NV(request.getParameter("ti")) } );
390 }
391 if ( null != s.orders ) {
392 int sz = s.orders.size()-1;
393 int rm = chkint( 0, sz, -1, request.getParameter("rm") );
394 if ( 0 <= rm ) {
395 s.orders.remove( rm );
396 if ( 0 == sz )
397 s.orders = null;
398 }
399 }
400 if ( null == s.orders )
401 task = DO_HELP;
402 break;
403 case DO_ORDERS:
404 if ( null == s.orders ) {
405 task = DO_HELP;
406 break;
407 }
408 StringBuffer o = new StringBuffer();
409 int i = 0;
410 for ( ; i<ORDER.length; i++ ) {
411 String v = s.o[i];
412 if ( null == v )
413 v = EMPTY;
414 if ( 0 == v.length() && 'X' == ORDER[i].charAt(0) ) {
415 order = t[108+s.l]; // required field missing
416 task = DO_ORDER;
417 break;
418 }
419 o.append( t[ORDERT[i]] ).append( ": " ).append( v ).append( '\n' );
420 }
421 if ( ORDER.length == i ) { // survived
422 o.append( "\nbestellt:\n\n" );
423 for ( i=0; i<s.orders.size(); i++ ) {
424 String[] p = (String[])s.orders.get(i);
425 o.append( p[0] ).append( ": " ).append( p[1] ).append( '\n' );
426 }
427 try {
428 (new Mail.Smtp( ORDERMAIL )).put(
429 Mail.message( MAILHEADERS, o.toString() )
430 );
431 order = o.append("\n\n").append(t[110+s.l]).toString();
432 s.orders = null;
433 } catch (Exception e) {
434 order = o.append("\n\n")
435 .append( "<h2>" )
436 .append(t[112+s.l])
437 .append( "</h2>\n<!--" )
438 .append( e.getMessage() )
439 .append( "-->\n" )
440 .toString();
441 task = DO_ORDER;
442 }
443 }
444 s.view = VW_ORDER;
445 }
446 int maxrow = s.off + s.rows;
447 if ( maxrow >= s.len )
448 maxrow = s.len;
449
450 %><html>
451 <head>
452 <title><%=t[50+s.l]%></title>
453 <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
454 <meta name="description" content="">
455 <meta http-equiv="Cache-Control" content="no-cache">
456 <meta http-equiv="Pragmas" content="no-cache">
457 <meta http-equiv="Robots" content="index,nofollow">
458 <link href="http://purl.org/dc" rel="schema.DC">
459 <meta name="DC.Title" content="IDM - documentation database">
460 <meta name="DC.Subject" content="">
461 <meta name="DC.Description" content="">
462 <meta name="DC.Creator" content="idm openisis">
463 <meta name="DC.Publisher" content="University of Bielefeld">
464 <meta name="DC.Date" content="2002-11-30" scheme="W3CDTF">
465 <meta name="DC.Type" content="Text" scheme="DCMIType">
466 <meta name="DC.Format" content="text/html">
467 <meta name="DC.Identifier" content="http://openisis.org/openisis/idm">
468 <link href="http://www.uni-bielefeld.de/icons/uni-logo-icon-16.png" type="image/png" rel="icon">
469 <link href="http://www.uni-bielefeld.de/css/unistandard.css" type="text/css" rel="stylesheet">
470 <!--
471 <style TYPE="text/css">
472 td {
473 font-family: Verdana, Arial, Helvetica, Geneva, sans-serif;
474 font-size: 12px
475 }
476 </style>
477 -->
478 </head>
479 <body bgcolor="#ffffff">
480 <!-- heading table: useless but nice ;) -->
481 <table width="100%" cols="1" cellpadding="0" border="0" cellspacing="0">
482 <tr>
483 <td align="center">
484 <a href="http://www.uni-bielefeld.de/idm/service/dokument.html">
485 <img src="/img/idm/service.gif" width="472" height="34"
486 alt="service" border="0">
487 </a>
488 <a href="http://www.uni-bielefeld.de/">
489 <img src="/img/idm/siegel.gif" width="27" height="27"
490 vspace="10" hspace="0"
491 alt="Universität Bielefeld" border="0">
492 </a>
493 </td>
494 </tr>
495 <tr>
496 <td align="center">
497 <img src="/img/idm/1pixgrau.gif" width="575"
498 vspace="0" hspace="0" height="3"
499 alt="=================================================">
500 <br></td>
501 </tr>
502 <tr>
503 <td width="470" height="25" bgcolor="#9DCCE6">
504 <a href="http://www.uni-bielefeld.de/idm/service/dokument.html">
505 <b>&nbsp;<%=t[50+s.l]%></b>
506 </a>
507 </td>
508 </tr>
509 </table>
510
511 <!-- form table: either query or order form -->
512 <form action="<%=me%>" method="GET">
513 <%
514 if ( DO_ORDER == task ) {
515 %>
516 <table width="575" cellpadding="0" border="0" cellspacing="0">
517 <%
518 for ( int i=0; i<ORDER.length; i++ ) {
519 String lbl = t[ORDERT[i]+s.l], nm = ORDER[i];
520 String req = 'X' == nm.charAt(0) ? "*" : "";
521 String v = null == s.o[i] ? "" : Field.html(s.o[i]);
522 %>
523 <tr><td><%=lbl%></td>
524 <td><input name="<%=nm%>" value="<%=v%>" size="40"><%=req%></td><tr>
525 <%
526 }
527 for(int i=0;i<s.orders.size();i++) {
528 String[] o = (String[])s.orders.get(i);
529 %>
530 <tr>
531 <td><%=Field.html(o[0])%></td>
532 <td><%=Field.html(o[1])%>
533 &nbsp;(<a class="intern" href="<%=me%>?do=order&rm=<%=i%>"><%=t[102+s.l]%></a>)
534 </td>
535 </tr>
536 <%
537 }
538 %>
539 <tr>
540 <td colspan="2" align="center">
541 <img src="/img/idm/1pixgrau.gif" width="575"
542 vspace="0" hspace="0" height="1"
543 alt="-------------------------------------------------">
544 <br></td>
545 </tr>
546 </table>
547 <input type="submit" name="do" value="<%=t[86+s.l]%>">
548 <%
549 } else {
550 %>
551 <table width="100%" cols="3" cellpadding="0" border="0" cellspacing="0">
552 <%
553 for ( int l=0; l<LINES; l++ ) {
554 %>
555 <tr valign="top" height="33">
556 <td>
557 <%
558 if ( 0 < l ) for ( int o=0; o<OP.length; o++ ) {
559 String checked = o == s.op[l] ? " checked" : "";
560 %>
561 <input type="radio" name="op<%=l%>"<%=checked%> value="<%=o%>"/>
562 <%=t[62+2*o+s.l] %>
563 <%
564 } // for ops
565 %>
566 </td>
567 <td>
568 <input type="text" name="t<%=l%>" size="24"
569 value="<%=Field.html(s.t[l])%>"/>
570 <input type="submit" name="i<%=l%>"
571 value="<%=t[56+s.l]%>"/>
572 </td>
573 <td align="left">
574 in <select name="f<%=l%>" size=1>
575 <option value="0"<%=(0==s.f[l])?" selected":""%>
576 ><%=t[60+s.l]%></option>
577 <%
578 for(int i=0; i<tag.length;i++) {
579 %>
580 <option value="<%=i+1%>"<%=(i+1==s.f[l])?" selected":""%>
581 ><%=t[2*i+s.l]%></option>
582 <%
583 } // for fields
584 %>
585 </select>
586 </td>
587 </tr>
588 <%
589 } // for lines
590 %>
591
592 <tr>
593 <td colspan="3" align="center" valign="center" height="7">
594 <img src="/img/idm/1pixgrau.gif" width="575"
595 vspace="3" hspace="0" height="1"
596 alt="-------------------------------------------------">
597 <br></td>
598 </tr>
599
600 </table>
601 <!-- <%= dberr %> -->
602 <input type="submit" name="do" value="<%=t[52+s.l]%>"/>
603 <input type="reset" name="reset" value="<%=t[68+s.l] %>"/>
604 <%--
605 <input type="text" name="rows" size="2" value="<%=s.rows%>"/> rows at once
606 --%>
607 <input type="submit" name="do" value="<%=t[54+s.l]%>"/>
608 <%
609 } // query form
610
611 if ( VW_QUERY == s.view && 0 < s.len ) {
612 if ( 0 < s.off ) {
613 int boff = s.off-s.rows;
614 if ( boff < 0 ) boff = 0;
615 %>
616 &nbsp;&nbsp;<a class="intern" href="<%=me%>?off=<%=boff%>">
617 <b>&lt;&lt;</b><%=t[88+s.l]%> <%=boff+1%>
618 <%=t[90+s.l]%> <%=boff+s.rows%></a>
619 <%
620 }
621 if ( maxrow < s.len ) {
622 int nmax = maxrow+s.rows;
623 if ( nmax > s.len )
624 nmax = s.len;
625 %>
626 &nbsp;&nbsp;<a class="intern" href="<%=me%>?off=<%=maxrow%>">
627 <%=t[88+s.l]%> <%=maxrow+1%>
628 <%=t[90+s.l]%> <%=nmax%><b>&gt;&gt;</b></a>
629 <%
630 }
631 }
632
633 %>
634 &nbsp;&nbsp;<a class="intern" href="<%=me%>?do=new"><%=t[98+s.l]%></a>
635 </form>
636 <hr>
637 <!-- switch view: help, query, index or order -->
638 <%
639 switch ( s.view ) {
640 default:
641 case VW_HELP:
642 %>
643 <%=t[100+s.l]%>
644 <%
645 break;
646 case VW_QUERY:
647 if ( 0 == s.len ) {
648 %>
649 0 <%=t[88+s.l]%> <%=t[94+s.l]%> '<%=s.qry%>'
650 <%
651 } else {
652 %>
653 <h4> <%=t[88+s.l]%> <%=s.off+1%>
654 <%=t[90+s.l]%> <%=maxrow%>
655 <%=t[92+s.l]%> <%=s.len%>
656 <%=t[94+s.l]%> '<%=s.qry%>' </h4>
657
658 <%-- start output --%>
659 <table cols="2" width="100%">
660 <%
661 for ( int i=s.off; i<maxrow; i++ ) {
662 Rec r = db.readRow( s.set[i] );
663 if ( null == r ) continue;
664 %>
665 <tr><td colspan="2"><hr></td></tr>
666 <%
667 for ( int j=0; j<tag.length; j++ ) {
668 out.println( r.v(
669 "<tr><td valign=\"top\" width=\"150\">"+t[2*j+s.l]
670 +"</td><td valign=\"top\">",
671 null, // cond,repeated prefix
672 tag[j], Db.MDL|Db.PS|Db.HTI, 0, 0, // tag and mode, len, off
673 ";<br>","</td></tr>")
674 );
675 }
676 String ti = r.v("",301,Db.MDL, 0, 0,"");
677 if ( null == ti || 0 == ti.length() )
678 ti = r.v("",302,Db.MDL, 0, 0,"");
679 String link = me+"?do=order"
680 + "&id=" + URLEncoder.encode( r.v("",18,Db.MDL, 0, 0,"") )
681 + "&ti=" + URLEncoder.encode( ti );
682 %>
683 <tr><td colspan="2" align="right">
684 <a class="intern" href="<%=link%>"><b>&gt;&gt;</b> <%=t[84+s.l]%></a>
685 </td></tr>
686 <%
687 }
688 %>
689 </table>
690 <%
691 }
692 break; // case VW_QUERY
693 case VW_INDEX:
694 %>
695 <h4><%=t[96+s.l]%> '<%=Field.html(s.term)%>'</h4>
696 <%
697 if ( null == s.i || ! s.i.hasNext() ) {
698 } else {
699 int i = TERMS;
700 while ( 0 < i-- && s.i.hasNext() ) {
701 String ix = (String)s.i.next();
702 if ( 0 == ix.length() ) continue;
703 String u = URLEncoder.encode( ix );
704 %>
705 <a class="intern" href="<%=me%>?t<%=s.idx%>=<%=u%>"><%=Field.html(ix)%></a><br>
706 <%
707 }
708 if ( 0 > i ) { // more
709 %>
710 <p align = "right">
711 <a class="intern" href="<%=me%>?do=more"><b>&gt;&gt;</b> <%=t[58+s.l]%></a><br>
712 </p>
713 <%
714 } else
715 s.i = null;
716 }
717 break; // case VW_INDEX
718 case VW_ORDER:
719 %>
720 <pre>
721 <%= order %>
722 </pre>
723 <%
724 } // switch
725 %>
726 <!-- <%= ID %> -->
727 </body></html>

  ViewVC Help
Powered by ViewVC 1.1.26