Bug fix.
[egate.git] / www / nwi.egw
1 <html>
2 {
3 # $Id: nwi.egw,v 1.7 1996/05/22 16:50:26 adam Exp $
4     source ztargets.conf
5
6     set scriptQuery nwi.egw
7     set scriptTarget {}
8     set utilExtension nwiutil.tcl
9
10     if {![info exists debug]} {
11         if {[lindex $sessionParms 1] == "1"} {
12             set debug 1
13         } else {
14             set debug 0
15         }
16     }
17     if {[info commands saveState] == ""} {
18         source z39util.tcl
19     }
20     set html3 [lindex $sessionParms 0]
21     if {[string length $html3] == 0} {
22         if {![info exists env(HTTP_USER_AGENT)]} {
23             set html3 1
24         } elseif {[string first Mozilla $env(HTTP_USER_AGENT)] == 0} {
25             set html3 1
26             egw_log debug "New user using Netscape"
27         } else {
28             set html3 0
29             egw_log debug "New user Not using Netscape"
30         }
31     }
32 }
33 <head>
34 <title> Nordic Web Index, Simple search </title>
35 </head>
36 <body>
37 {
38     global setNo
39     global nextSetNo
40     global hist
41     global targets
42
43     if {[catch {set setNo $nextSetNo}]} {
44         set nextSetNo 1
45         set setNo 1
46     }
47
48     set useIcons 1
49     button-main
50
51     set curSort score
52     set curFormat brief
53     set curEntry {}
54
55     set initSet 0
56
57     catch {
58         set initSet [lindex $sessionParms 0]
59         if {$initSet < 0} {
60             set initSet 0
61         }
62         if {$initSet} {
63             for {set i 1} {$i <= $hist($initSet,0,host)} {incr i} {
64                 lappend curTargets $hist($initSet,$i,host)
65             }
66             set curSort $hist($initSet,sort)
67             set curFormat $hist($initSet,format)
68             set curEntry $hist($initSet,form,entry1)
69         }
70     }
71     html {<form action="http:} $env(SCRIPT_NAME)
72     html / $sessionId {/msearch.egw/} $setNo {" method=get>} \n
73
74     html "<dl>"
75     html {<dt><b>Enter your query</b><dd>}
76
77     html {<input type="text" name="entry1" size=50 value="}
78     html [join $curEntry] {">}
79     html {<input type=submit value="Search"><br>}
80
81     html {<dt><b>and search the following servers</b><dd>}
82
83     set hosts {
84             {mars.dtv.dk:9999/Default} 
85             {nwi.ub2.lu.se:2121/sverige}
86     }
87     foreach t $hosts {
88         html {<input type="checkbox" name="host" }
89         if {[info exists curTargets]} {
90             if {[lsearch -exact $curTargets $t] != -1} {
91                 html {checked }
92             }
93         }
94         html {value="} $t {"> } [lindex $targets($t) 0]
95     }
96     catch {unset curTargets}
97     html {<p><dt><b>Display each record in <select name="format"><dd>}
98     if {![string compare $curFormat brief]} {
99         html "<option>brief\n"
100         html "<option>medium\n"
101     } else {
102         html "<option>medium\n"
103         html "<option>brief\n"
104     }
105     html "</select> notation"
106     html { and sort by <select name="sort">}
107     if {![string compare $curSort score]} {
108         html "<option>score\n"
109         html "<option>server\n"
110     } else {
111         html "<option>server\n"
112         html "<option>score\n"
113     }
114     html "</select></b><br></dl>\n"
115
116     html {<input type=submit value="Search"><input type=reset value="Reset">}
117
118     html "\n<br><p><hr>\n"
119
120     if {0} {
121     html {<form action="http:} $env(SCRIPT_NAME)
122     html / $sessionId {/msearch.egw/} $setNo {" method=get>} \n
123     }
124
125     html {<b>Advanced search</b><br>}
126
127     set host [lindex $hosts 0]
128     set fields [lindex $targets($host) 2]
129     for {set no 2} {$no < 6} {incr no} {
130
131         html {<select name="menu} $no {">} \n
132         set template {}
133         if {$initSet} {
134             set template [join $hist($initSet,form,menu$no)]
135         }
136         if {[string length $template] > 0} {
137             html {<option> } $template "\n"
138         }
139         foreach f $fields {
140             set name [lindex $f 0]
141             if {$template == $name} continue
142             html {<option> } $name \n
143         }
144         html "</select>\n"
145
146         html {<input type="text" name="entry} $no {" size=35 value="}
147
148         if {$initSet} {
149             if {[info exists hist($initSet,form,entry$no)]} {
150                 html [join $hist($initSet,form,entry$no) " "]
151             }
152         }
153         html {">} \n
154         if {$no < 5} {
155             html {<select name="logic} $no {">} \n
156             set template {}
157             if {$initSet} {
158                 set template [join $hist($initSet,form,logic$no) " "]
159             }
160             if {[string length $template] > 0} {
161                 html "<option> " $template \n
162             }
163             foreach op {And Or {And not}} {
164                 if {$template == $op} continue
165                 html "<option> " [join $op " "] \n
166             }
167             html "</select>\n"
168         }
169         html "<br>\n"
170     }
171     unset hosts
172     html "</form><br>\n"
173     set useIcons 0
174     button-main
175
176
177     catch maintenance
178 }
179
180