/[webpac]/trunk/openisis/tcl/demo.cgi
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 /trunk/openisis/tcl/demo.cgi

Parent Directory Parent Directory | Revision Log Revision Log


Revision 237 - (show annotations)
Mon Mar 8 17:43:12 2004 UTC (17 years, 7 months ago) by dpavlin
Original Path: openisis/current/tcl/demo.cgi
File size: 2478 byte(s)
initial import of openisis 0.9.0 vendor drop

1 #!/opt/isis/OpenIsis/tcl/bin/tspr
2 <%--
3 test Tcl server page
4 $Id: demo.cgi,v 1.1 2003/04/29 19:01:14 kripke Exp $
5 --%><%!
6
7 # package require mime;
8 # namespace import ::mime::*;
9 # a procedure to make live with requests easier:
10 # it uses the current value of the $isis server variable to send a request
11 # so we can switch servers by setting isis, yet use a single command
12 proc ::isis {request args} {
13 global isis
14 $isis .req delete
15 $isis .req set -type $request
16 # eval so that the single list of args becomes multiple parameters
17 eval $isis req $args
18 ::puts stderr "###req\n[$isis .req serialize]###res\n[$isis .res serialize]###"
19 # we don't clone the result rec, but provide a procedure
20 # if {"read" == $request} {
21 # clone result data as v; throws exception if no such record
22 # $isis .res .rec clone v
23 # }
24 # return the size (number of records or mfns)
25 $isis .res get size
26 }
27
28 # convenient access to the result
29 proc ::res {args} {
30 global isis
31 eval $isis .res $args
32 }
33
34 # wrapper for current result record
35 # add the "rowid" command, which the record is lacking for some reason
36 # add a "get first", if args is a single integer
37 proc ::v {args} {
38 global isis
39 if {"rowid" == $args} {
40 return [$isis .res get rowid]
41 }
42 if {[string is integer $args]} { # v 24
43 return [lindex [$isis .res .rec get $args] 0]
44 }
45 eval $isis .res .rec $args
46 }
47
48
49 %><%
50 # request standard tags
51 # -10 SCRIPT_NAME
52 # -11 PATH_INFO
53 # -12 REMOTE_USER
54 #
55 global env
56
57 set script [lindex [request get -10] 0]
58 set path [lindex [request get -11] 0]
59
60 set query [lindex [request get 1] 0]
61
62 set db cds
63
64 set ::isis [openIsis] ;# contact local server
65 $::isis add -syspath /opt/isis/db -dbpath $db -defaultdb $db
66 isis open
67
68 # query max row
69 isis maxrow
70 set max [res get rowid]
71 %><html>
72 <head>
73 <meta http-equiv="Content-Type" content="text/html; charset=Cp850">
74 </head>
75 <body>
76 max mfn in <%=db%> is <%=max%>
77 <form action="<%=script%>">
78 enter query or mfn:
79 <input type="text" name="1" value="<%=query%>"/>
80 <input type="submit" name="2" value="ok"/>
81 </form>
82 <br/>
83 <%
84 if [string is integer $query] {
85 set mfns $query
86 } else { # query
87 isis query -mode 128 -key $query
88 set mfns [res get rowid]
89 %>
90 found mfns
91 <%
92 foreach mfn $mfns {
93 %>
94 <a href="#<%=mfn%>"><%=mfn%></a>
95 <%
96 }
97 }
98 %>
99 <table>
100 <%
101 foreach mfn $mfns {
102 isis read -rowid $mfn
103 %>
104 <tr><td><b>MFN</b></td><td><b><a name="<%=mfn%>"/><%=mfn%></b></td></tr>
105 <%
106 ::openIsis::Tspr detail.tsp
107 }
108 %>
109 </table>
110 </body>
111 </html>

Properties

Name Value
svn:executable

  ViewVC Help
Powered by ViewVC 1.1.26