Work on HTML3 detection. Tables are used to display history.
[egate.git] / www / z39util.tcl
index 7903fd4..e703062 100644 (file)
@@ -1,5 +1,5 @@
 #
-# $Id: z39util.tcl,v 1.25 1996/01/24 16:59:29 adam Exp $
+# $Id: z39util.tcl,v 1.27 1996/01/26 17:41:26 adam Exp $
 #
 proc saveState {} {
     uplevel #0 {
@@ -105,6 +105,8 @@ proc display-brief {zset no tno} {
        set publisher [$zset getMarc $no field 260 * b]
         set year [$zset getMarc $no field 260 * c]
     } ] } {
+        html { <a href="http:} $env(SCRIPT_NAME) /
+        html $sessionId {/showfull.egw/} $setNo + $tno + $no + full {">}
         set p 0
         foreach a $author {
             if {$p} {
@@ -130,32 +132,20 @@ proc display-brief {zset no tno} {
         if {$p} {
             html ": "
         }
-        html { <a href="http:} $env(SCRIPT_NAME) /
-        html $sessionId {/showfull.egw/} $setNo + $tno + $no + full {">}
        set nope 1
         foreach v $title {
             html $v
             set nope 0
         }
         if {$nope} {
-            html {No title} 
-        }
-        html {</a> }
-       foreach v $cover {
-           html $v
-       }
-        if {0} {
-            html {<br>}
-            foreach v $location {
-                html " $v"
-            }
-            foreach v $publisher {
-                html " $v"
-            }
-            foreach v $year {
-                html " $v"
+            set v [join $cover ""]
+            if {[string length $v] > 40} {
+                html [string range $v 0 38] "..."
+            } else {
+                html $v
             }
-        }
+       }
+        html {</a> }
     }
     html "<br>\n"
 }
@@ -561,6 +551,7 @@ proc z39scan {setNo scanNo tno scanLines scanPos cache} {
 
     $zz callback [list scan-response $zs]
 
+    egw_log debug "scan: ${scanAttr} ${scanTerm}"
     set sessionWait 0
     $zs scan "${scanAttr} ${scanTerm}"
 
@@ -610,16 +601,31 @@ proc display-scan {setNo scanNo tno} {
             set hist($setNo,[expr $scanNo + 1],scanTerm) $t
         }
     }
+    html {<table border=0><tr>}
+    html {<td align=left><b>Scan term</b>}
+    html {<td align=right><b>Hits</b>}
+    html {<tr>} \n
+
     for {set i 0} {$i < $m} {incr i} {
-        regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm
-        html {<a href="http:} $env(SCRIPT_NAME)
-        html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo +
-        html $hist($setNo,scan) +  $tterm {">}
+        html {<td align=left>}
+        if {0} {
+            regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm
+            html {<a href="http:} $env(SCRIPT_NAME)
+            html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo +
+            html $hist($setNo,scan) +  $tterm {">}
+        } else {
+            regsub -all {\ } [lindex [$zs scanLine $i] 1] + tterm
+            html {<a href="http:} $env(SCRIPT_NAME)
+            html / $sessionId {/search.egw/} $setNo +
+            html hyper + $tterm {">}
+        }
         html [lindex [$zs scanLine $i] 1]
-        html {</a>: <em>}
+        html {</a>} 
+        html {<td align=right>}
         html [lindex [$zs scanLine $i] 2]
-        html "</em><br>\n"
+        html {<tr>} \n
     }
+    html {</table} \n
 }
 
 proc z39search {setNo piggy tno elements} {
@@ -943,45 +949,92 @@ proc z39history {} {
     global env
     global sessionId
     global targets
+    global html3
 
     if {![info exists nextSetNo]} {
         return
     }
-    html "<h2>History</h2><dl><br>\n"
+    html "<h2>History</h2><br>\n"
+    if {$html3} {
+        html {<table width=500 border=1><tr>}
+        html {<td align=left><b>Target</b>}
+        html {<td align=left><b>Database</b>}
+        html {<td align=right><b>Hits</b>}
+        html {<td><b>Query</b>}
+        html {<tr>} "\n"
+    } else {
+        html {<dl>} "\n"
+    }
     for {set setNo 1} {$setNo < $nextSetNo} {incr setNo} {
         if {$hist($setNo,scan) > 0} continue
         set host $hist($setNo,host)
-        html {<dt> } [lindex $targets($host) 0]
-        if {[llength [lindex $targets($host) 1]] > 1} {
-            html ": "
-            foreach b $hist($setNo,database) {
-                html " $b"
+        if {$html3} {
+            html {<td align=left>}
+        } else {
+            html {<dt> }
+        }
+        html [lindex $targets($host) 0]
+        if {$html3} {
+            html {<td align=left>} [join $hist($setNo,database)]
+        } else {
+            if {[llength [lindex $targets($host) 1]] > 1} {
+                html ": "
+                foreach b $hist($setNo,database) {
+                    html " $b"
+                }
             }
+            html {. }
+        }
+        if {$html3} {
+            html {<td align=right>}
         }
-        html {. }
-
         if {[info exists hist($setNo,hits)]} {
             html { <a href="http:} $env(SCRIPT_NAME)
             html / $sessionId {/search.egw/} $setNo + 1
             html + $hist($setNo,maxPresent)
-            html {">Result</a>: } $hist($setNo,hits) { hits.}
+            if {1} {
+                html {">} $hist($setNo,hits) {</a>}
+            } else {
+                html {">Result</a>: } $hist($setNo,hits) { hits.}
+            }
         } else {
-            html {Search failed.}
+            if {$html3} {
+                html {Failed}
+            } else {
+                html {Search failed.}
+            }
+        }
+        if {$html3} {
+            html {<td align=left>}
+        } else {
+            html "<dd>\n"
         }
-        html "<dd>\n"
         html { <a href="http:} $env(SCRIPT_NAME)
-        html / $sessionId {/query.egw/} $host + $setNo 
-        html {">Query</a>: }
+        html / $sessionId {/query.egw/} $host + $setNo
+        if {$html3} {
+            html {">}
+        } else {
+            html {">Query</a>: }
+        }
         set op {}
         for {set i 1} {$i <= 3} {incr i} {
             if {[string length $hist($setNo,form,entry$i)] > 0} {
                 html " <b>" [join $op " "] "</b> "
-                html $hist($setNo,form,menu$i) "=" $hist($setNo,form,entry$i)
+                html [join $hist($setNo,form,menu$i)] "=" 
+                html $hist($setNo,form,entry$i)
                 set op $hist($setNo,form,logic$i)
             }
         }
+        if {$html3} {
+            html {</a><tr>} "\n"
+        }
     }
-    html "</dl>\n"
+    if {$html3} {
+        html {</table><p>}
+    } else {
+        html {</dl>}
+    }
+    html "\n"
 }
 
 proc displayError {msga msgb} {
@@ -996,10 +1049,11 @@ proc displayError {msga msgb} {
 
 proc button-europagate {} {
     global useIcons
+    html {<a href="http://europagate.dtv.dk/">}
     if {$useIcons} {
         html {<img src="/egwgif/button-egw.gif" alt="Europagate" border=0></a>}
     } else {
-        html {Europagate | }
+        html {Europagate</a> | }
     }
 }
 
@@ -1012,9 +1066,9 @@ proc button-define-target {more} {
     html / $sessionId {/tform.egw}
     if {$useIcons} {
         html {"><img src="/egwgif/button-define-target.gif" }
-       html {alt="New Target" border=0></a>}
+       html {alt="Define Target" border=0></a>}
     } else {
-        html {">New Target</a>}
+        html {">Define Target</a>}
         if {$more} {
             html " | \n"
         } else {
@@ -1027,9 +1081,15 @@ proc button-new-target {more} {
     global useIcons
     global env
     global sessionId
+    global mMode
 
     html {<a href="http:} $env(SCRIPT_NAME)
-    html / $sessionId {/targets.egw}
+    html / $sessionId 
+    if {$mMode} {
+        html {/mtargets.egw}
+    } else {
+        html {/targets.egw}
+    }
     if {$useIcons} {
         html {"><img src="/egwgif/button-new-target.gif" }
        html {alt="New Target" border=0></a>}
@@ -1070,9 +1130,16 @@ proc button-new-query {more setNo} {
     global env
     global sessionId
     global hist
+    global mMode
 
     html {<a href="http:} $env(SCRIPT_NAME)
-    html / $sessionId {/query.egw/} $hist($setNo,host) + $setNo {">}
+    html / $sessionId 
+    if {$mMode} {
+        html {/mquery.egw/} $setNo
+    } else {
+        html {/query.egw/} $hist($setNo,host) + $setNo
+    }
+    html {">}
     if {$useIcons} {
         html {<img src="/egwgif/button-new-query.gif" }
        html {alt="New Query" border=0></a>}
@@ -1110,7 +1177,7 @@ proc button-scan-window {more setNo} {
 proc maintenance {} {
     html {<hr>This page is maintained by }
     html {<a href="mailto:pwh@dtv.dk"> Peter Wad Hansen </a>.}
-    html {Last modified 24. january 1996. <br>}
+    html {Last modified 26. january 1996. <br>}
     html {<em> This and the following pages are under construction and }
     html {will continue to be so until the end of January 1996.</em>}
 }