Explain now also finds Gils attributes.
authorPer M. Hansen <perhans@indexdata.dk>
Wed, 17 Mar 1999 09:24:11 +0000 (09:24 +0000)
committerPer M. Hansen <perhans@indexdata.dk>
Wed, 17 Mar 1999 09:24:11 +0000 (09:24 +0000)
Support for search with Gils attributes added.
Stop button added.
The medium format extended and cleaned up (kommas between termes).
Lots of minor but fixes.

client2/client.tcl
client2/explain.tcl
client2/formats/line.tcl
client2/formats/medium.tcl
client2/irtdb.tcl

index 03cfdd4..be0b37d 100644 (file)
@@ -5,24 +5,27 @@ proc irmenu {w} {
     menu $w -tearoff off
 }
 
-proc debug-window {} {
-    set w .debug-window
-    toplevel $w
-
-    wm title $w "Debug Window" 
+proc debug-window {text} {
+    if {[winfo exists .debug-window.top.t]} {
+        .debug-window.top.t insert end "$text \n"
+    } else {
+        set w .debug-window
+        toplevel $w
     
-    frame $w.top -relief raised -border 1
-    frame $w.bot -relief raised -border 1
-    pack  $w.top -side top -fill both -expand yes
-    pack  $w.bot -fill both
-    scrollbar $w.top.s -command [list $w.top.t yview]
-    text $w.top.t -width 60 -height 10 -wrap word -relief flat -borderwidth 0 \
-        -font fixed -yscroll [list $w.top.s set]
-    pack $w.top.s -side right -fill y
-    pack $w.top.t -expand yes -fill both -expand y
+        wm title $w "Debug Window" 
+        
+        frame $w.top -relief raised -border 1
+        frame $w.bot -relief raised -border 1
+        pack  $w.top -side top -fill both -expand yes
+        pack  $w.bot -fill both
+        scrollbar $w.top.s -command [list $w.top.t yview]
+        text $w.top.t -width 60 -height 10 -wrap word -relief flat \
+            -borderwidth 0 -font fixed -yscroll [list $w.top.s set]
+        pack $w.top.s -side right -fill y
+        pack $w.top.t -expand yes -fill both -expand y
+        .debug-window.top.t insert end "$text \n"
+    }
 }
-debug-window
-
     
 # Procedure configure-enable-e {w n}
 #  w   is a menu
@@ -115,10 +118,11 @@ set elementSetNames None
 set delayRequest {}
 set debugMode 0
 set queryAutoOld 0
+set leadText 1
 
 set queryTypes {Simple}
-set queryButtons { { {I 0} {I 1} {I 2} } }
-set queryInfo { { {Title {1=4 4=1}} {Author {1=1}} \
+set queryButtonsBib1 { { {I 0} {I 1} {I 2} } }
+set queryInfoBib1 { { {Title {1=4 4=1}} {Author {1=1}} \
         {Subject {1=21}} {Any {1=1016}} } }
 set queryAuto 1
 wm minsize . 0 0
@@ -126,7 +130,8 @@ wm minsize . 0 0
 set setOffset 0
 set setMax 0
 
-set syntaxList {None sep USMARC UNIMARC UKMARC DANMARC FINMARC NORMARC PICAMARC sep SUTRS sep GRS1}
+set syntaxList {None sep USMARC UNIMARC UKMARC DANMARC FINMARC NORMARC \
+    PICAMARC sep SUTRS sep GRS1}
 
 
 set font(bb,normal) {Helvetica 24}
@@ -170,7 +175,6 @@ if {[file readable [file join $libdir tagsets.tcl]]} {
 
 # Read the global target configuration file.
 if {[file readable [file join $libdir irtdb.tcl]]} {
-#    source "${libdir}/irtdb.tcl"
     source [file join $libdir irtdb.tcl]
 }
 # Read the local target configuration file.
@@ -179,14 +183,12 @@ if {[file readable "irtdb.tcl"]} {
 }
 
 # Read the user configuration file.
-if {[file readable [file join $libdir .clientrc.tcl]]} {
-#    source "${libdir}/.clientrc.tcl"
-    source [file join $libdir .clientrc.tcl]
+if {[file readable "~/.clientrc.tcl"]} {
+    source "~/.clientrc.tcl"
 }
 
-source "bib-1.tcl"
-
 set queryAutoOld $queryAuto
+set attribute$attributeTypeSelected 1
 
 # Convert old format to new format...
 foreach target [array names profile] {
@@ -194,7 +196,7 @@ foreach target [array names profile] {
     if {[string first , $target] == -1} {
     if {![info exists profile($target,port)]} {
         foreach n [array names profile Default,*] {
-        set profile($target,[string range $n 8 end]) $profile($n)
+            set profile($target,[string range $n 8 end]) $profile($n)
         }
         set profile($target,description) [lindex $profile($target) 0]
         set profile($target,host) [lindex $profile($target) 1]
@@ -223,21 +225,31 @@ set profile(Default,windowNumber) $wno
 
 # These globals describe the current query type. They are set to the
 # first query type.
-set queryButtonsFind [lindex $queryButtons 0]
-set queryInfoFind [lindex $queryInfo 0]
+if {[info exists queryButtons$attributeTypeSelected]} {
+    update
+    set queryButtonsFind [lindex [set "queryButtons$attributeTypeSelected"] 0]
+} else {
+    set queryButtonsFind [lindex [set queryButtonsBib1] 0]
+    set queryButtons$attributeTypeSelected $queryButtonsBib1
+} 
+if {[info exists queryInfo$attributeTypeSelected]} {   
+    set queryInfoFind [lindex [set "queryInfo$attributeTypeSelected"] 0]
+} else {
+    set queryInfoFind [lindex [set queryInfoBib1] 0]
+    set queryInfo$attributeTypeSelected $queryInfoBib1
+}    
 
 # Procedure read-formats
 # Read all Tcl source files in the subdirectory 'formats'.
 # The name of each source will correspond to a display format.
 proc read-formats {} {
-    global displayFormats
-    global libdir
+    global displayFormats libdir
 
     set oldDir [pwd]
     cd [file join $libdir formats]
     set formats [glob {*.[tT][cC][lL]}]
     foreach f $formats {
-    if {[file readable $f]} {
+        if {[file readable $f]} {
             source $f
             set l [string length $f]
             set f [string tolower [string range $f 0 [expr $l - 5]]]
@@ -262,7 +274,7 @@ proc set-wrap {m} {
 # puts utility for debugging.
 proc dputs {m} {
     global debugMode
-    if {$debugMode} {
+    if {$debugMode == 1} {
         puts $m
     }
 }
@@ -369,13 +381,15 @@ proc destroyGW {w} {
 proc toplevelG {w} {
     global windowGeometry
 
-    toplevel $w
+    if {![winfo exists $w]} {
+        toplevel $w
+    }
     if {[info exists windowGeometry($w)]} {
         set g $windowGeometry($w)
         if {$g != ""} {
             wm geometry $w $g
         }
-    }
+    } 
     bind $w <Destroy> [list destroyGW $w]
 }
 
@@ -572,14 +586,24 @@ proc show-message {msg} {
 # Inserts text at the insertion point in widget w. The text is tagged 
 # with the tags in args.
 proc insertWithTags {w text args} {
+    global leadText
+    set text [string trimright $text ,]
     set start [$w index insert]
-    $w insert insert $text
+    if {[lsearch {marc-text marc-it marc-id} $args] == -1||$leadText} {
+        $w insert insert "$text"
+    } else {
+        $w insert insert ", $text"
+    }
     foreach tag [$w tag names $start] {
         $w tag remove $tag $start insert
     }
     foreach i $args {
         $w tag add $i $start insert
     }
+    set leadText 0
+    if {[lsearch -exact {marc-head marc-pref marc-tag marc-small-head} $args] != -1} {
+        set leadText 1
+    }
 }
 
 # Procedure popup-license and displays LICENSE information.
@@ -624,7 +648,7 @@ proc about-target {} {
     top-down-window $w
 
     frame $w.top.a -relief ridge -border 2
-    frame $w.top.p -relief ridge -border 2
+    frame $w.top.p -relief ridge -border 2 -background white
     pack $w.top.a $w.top.p -side top -fill x
 
     label $w.top.a.about -text "About"
@@ -632,13 +656,13 @@ proc about-target {} {
     pack $w.top.a.about $w.top.a.irtcl -side top
 
     set i [z39 targetImplementationName]
-    label $w.top.p.in -text "Implementation name: $i"
+    label $w.top.p.in -text "Implementation name: $i" -background white
     set i [z39 targetImplementationId]
-    label $w.top.p.ii -text "Implementation id: $i"
+    label $w.top.p.ii -text "Implementation id: $i" -background white
     set i [z39 targetImplementationVersion]
-    label $w.top.p.iv -text "Implementation version: $i"
+    label $w.top.p.iv -text "Implementation version: $i" -background white
     set i [z39 options]
-    label $w.top.p.op -text "Protocol options: $i"
+    label $w.top.p.op -text "Protocol options: $i" -background white
     pack $w.top.p.in $w.top.p.ii $w.top.p.iv $w.top.p.op -side top -anchor nw
 
     bottom-buttons $w [list {Close} [list destroy $w]] 1
@@ -733,7 +757,7 @@ proc popup-marc {sno no b df} {
 
         text $w.top.record -width 60 -height 5 -wrap word -relief flat \
             -borderwidth 0 -font fixed \
-            -yscrollcommand [list $w.top.s set] -background grey85
+            -yscrollcommand [list $w.top.s set] -background white
         scrollbar $w.top.s -command [list $w.top.record yview] 
         $w.top.record tag configure marc-tag -foreground blue
         $w.top.record tag configure marc-id -foreground red
@@ -747,11 +771,8 @@ proc popup-marc {sno no b df} {
         pack $w.top.s -side right -fill y
         pack $w.top.record -expand yes -fill both
         
-        bottom-buttons $w [list \
-            {Close} [list destroy $w] \
-            {Prev} {} \
-            {Next} {} \
-            {Duplicate} {}] 0
+        bottom-buttons $w [list {Close} [list destroy $w] \
+            {Prev} {} {Next} {} {Duplicate} {}] 0
         menubutton $w.bot.formats -text "Format" -menu $w.bot.formats.m -relief raised
         irmenu $w.bot.formats.m
         pack $w.bot.formats -expand yes -ipadx 2 -ipady 2 -padx 3 -pady 3 -side left
@@ -767,6 +788,7 @@ proc popup-marc {sno no b df} {
     $w.top.record delete 0.0 end
     set recordType [z39.$sno recordType $no]
     wm title $w "$recordType record #$no"
+    focus $w
 
     $w.bot.2 configure -command [list popup-marc $sno [expr $no-1] $b $df]
     $w.bot.4 configure -command [list popup-marc $sno [expr $no+1] $b $df]
@@ -886,11 +908,11 @@ proc define-target-action {} {
         }
     }
     foreach n [array names profile Default,*] {
-    set profile($target,[string range $n 8 end]) $profile($n)
-
+        set profile($target,[string range $n 8 end]) $profile($n)
     }
     incr profile(Default,windowNumber)
     
+#    debug-window "Target er her $target"
     protocol-setup $target
     destroy .target-define
 }
@@ -997,7 +1019,8 @@ proc close-target {} {
     z39 disconnect
     show-target {} {}
     show-status {Not connected} 0 0
-    .top.options.m.query.slist entryconfigure 2 -state disabled
+#    .top.options.m.query.slist entryconfigure 2 -state disabled
+    configure-enable-e .top.options.m.query.slist 2
     init-title-lines
     show-message {}
     configure-disable-e .top.target.m 1
@@ -1042,17 +1065,46 @@ proc load-set {} {
     place-force $w .
     top-down-window $w
 
-    frame $w.top.filename
-    pack $w.top.filename -side top -anchor e -pady 2
-    
-    entry-fields $w.top {filename} \
-            {{Filename:}} \
-            {load-set-action} {destroy .load-set}
+#    frame $w.top.filename
+    frame $w.top.left
+    frame $w.top.right
+#    pack $w.top.filename -side top -anchor e -pady 2
+    pack $w.top.left $w.top.right -side left -anchor e -pady 2
+      
+    entry-fields $w.top {left} {{Filename:}} {load-set-action} {destroy .load-set}
+    button $w.top.right.but -text "Browse ..." \
+        -command "fileDialog $w $w.top.left.entry open"
+    pack $w.top.right.but -side right
     
     top-down-ok-cancel $w {load-set-action} 1
-    focus $oldFocus
+#    focus $oldFocus
+    focus $w
+}
+
+proc fileDialog {w ent operation} {
+    #   Type names             Extension(s)    Mac File Type(s)
+    #
+    #---------------------------------------------------------
+    set types {
+       {"Text files"           {.txt}              }
+       {"Text files"           {}                      TEXT}
+       {"Tcl Scripts"          {.tcl}              TEXT}
+       {"All files"            *}
+    }
+    if {$operation == "open"} {
+       set file [tk_getOpenFile -filetypes $types -parent $w]
+    } else {
+       set file [tk_getSaveFile -filetypes $types -parent $w \
+           -initialfile Untitled -defaultextension .txt]
+    }
+    if [string compare $file ""] {
+       $ent delete 0 end
+       $ent insert 0 $file
+       $ent xview end
+    }
 }
 
+
 # Procedure init-request
 # Sends an initialize request to the target. This procedure is called
 # when a connect has been established.
@@ -1109,12 +1161,6 @@ proc explain-crash {target base} {
     open-target $target $base
 }
 
-# Procedure explain-check 
-# Stub function to check explain. May be overwritten later.
-#proc explain-check {target response} 
-#    eval $response [list $target]
-
-
 # Procedure ready-response
 # Called after a target has been initialized and, possibly, explained
 proc ready-response {base target} {
@@ -1157,16 +1203,29 @@ proc ready-response {base target} {
 #proc ready-response-actions {target base}
 #This procedure take care of all the actions that should start if connect is succesfull.
 proc ready-response-actions {target base} {
-    global profile queryAuto attributeTypeSelected
+    global profile queryAuto attributeTypeSelected queryTypes
+    set autoNr [lsearch $queryTypes Auto]
     configureOptionsSyntax $target $base
-    if {[info exists profile($target,AttributeDetails,$base,Bib1Use)] && $queryAuto == 1} {
-        changeQueryButtons $target $base 
+#    if {[info exists profile($target,AttributeDetails,$base,\
+#        $attributeTypeSelected)] && $queryAuto == 1} 
+    if {[info exists profile($target,AttributeDetails,$base,$attributeTypeSelected)]} {
+        changeQueryButtons $target $base
         change-queryInfo $target $base
-        query-select 2
-        .top.options.m.query.slist entryconfigure 2 -state normal
+        .top.options.m.query.slist entryconfigure $autoNr -state normal
+        .top.options.m.query.clist entryconfigure $autoNr -state normal
+        if {$queryAuto == 1} {
+            query-select $autoNr
+        } else {
+            query-select 0
+        }
     } else {
         query-select 0
-        .top.options.m.query.slist entryconfigure 2 -state disabled
+#        .top.options.m.query.slist entryconfigure $autoNr -state disabled
+        configure-disable-e .top.options.m.query.slist $autoNr
+#        if {![info exists profile($target,AttributeDetails,$base,$attributeTypeSelected)]} 
+#            .top.options.m.query.clist entryconfigure $autoNr -state disabled
+            configure-disable-e .top.options.m.query.clist $autoNr
+#        
     }
     if {[info exists attributeTypeSelected]} {
         global attribute[set attributeTypeSelected]
@@ -1184,7 +1243,8 @@ proc ready-response-actions {target base} {
 # sets many search-related Z39-settings. The global $setNo is set
 # to the result set number (z39.$setNo).
 proc search-request {bflag} {
-    global setNo setNoLast profile hostid busy cancelFlag delayRequest recordSyntax elementSetNames
+    global setNo setNoLast profile hostid busy cancelFlag delayRequest \
+        recordSyntax elementSetNames
 
     set target $hostid
     
@@ -1206,6 +1266,7 @@ proc search-request {bflag} {
     set delayRequest {} 
 
     set query [index-query]
+    debug-window "Query er her: \"${query}\""
     if {![string length $query]} {
         return
     }
@@ -1213,16 +1274,16 @@ proc search-request {bflag} {
     set setNo $setNoLast
     ir-set z39.$setNo z39
     
-    if {$profile($target,namedResultSets)} {
+    if {$profile($target,namedResultSets) == 1} {
         z39.$setNo setName $setNo
         dputs "setName=${setNo}"
     } else {
         z39.$setNo setName default
         dputs "setName=default"
     }
-    if {$profile($target,queryRPN)} {
+    if {$profile($target,queryRPN) == 1} {
         z39.$setNo queryType rpn
-    } elseif {$profile($target,queryCCL)} {
+    } elseif {$profile($target,queryCCL) == 1} {
         z39.$setNo queryType ccl
     }
     dputs Setting
@@ -1242,7 +1303,7 @@ proc search-request {bflag} {
         z39.$setNo mediumSetElementSetNames $elementSetNames
     }
     z39 callback {search-response}
-    z39.$setNo search $query
+    z39.${setNo} search $query
     show-status Searching 1 0
 }
 
@@ -1297,15 +1358,15 @@ proc scan-request {} {
         entry $w.top.entry -relief sunken 
         pack $w.top.entry -fill x -padx 4 -pady 2
         bind $w.top.entry <KeyRelease> [list scan-term-h $attr]
-        listbox $w.top.list -yscrollcommand [list $w.top.scroll set] -font fixed 
+        listbox $w.top.list -yscrollcommand [list $w.top.scroll set] \
+            -font fixed -background white
         scrollbar $w.top.scroll -orient vertical -border 1
         pack $w.top.list -side left -fill both -expand yes
         pack $w.top.scroll -side right -fill y
         $w.top.scroll config -command [list $w.top.list yview]
         
         bottom-buttons $w [list {Close} [list destroy $w] \
-                {Up} [list scan-up $attr] \
-                {Down} [list scan-down $attr]] 0
+            {Up} [list scan-up $attr] {Down} [list scan-down $attr]] 0
         bind $w.top.list <Up> [list scan-up $attr]
         bind $w.top.list <Down> [list scan-down $attr]
         focus $w.top.entry
@@ -1827,7 +1888,7 @@ proc define-target-dialog {} {
     frame $w.top.target
     pack $w.top.target -side top -anchor e -pady 2 
     entry-fields $w.top {target} {{Target:}} \
-            {define-target-action} {destroy .target-define}
+        {define-target-action} {destroy .target-define}
     top-down-ok-cancel $w {define-target-action} 1
 }
 
@@ -1870,8 +1931,8 @@ proc add-database {target wp} {
     top-down-window $w
     frame $w.top.database
     pack $w.top.database -side top -anchor e -pady 2
-       entry-fields $w.top {database} {{Database to add:}} \
-            [list add-database-action $target $wp] {destroy .database-select}
+    entry-fields $w.top {database} {{Database to add:}} \
+        [list add-database-action $target $wp] {destroy .database-select}
 
     top-down-ok-cancel $w [list add-database-action $target $wp] 1
     focus $oldFocus
@@ -1912,7 +1973,7 @@ proc advanced-setup {target b} {
     toplevelG $w
     wm title $w "Advanced setup $target"
     top-down-window $w
-     if {![string length $target]} {
+    if {![string length $target]} {
         set target Default
     }
     dputs target
@@ -1925,17 +1986,17 @@ proc advanced-setup {target b} {
     frame $w.top.preferredMessageSize
 
     pack $w.top.largeSetLowerBound $w.top.smallSetUpperBound \
-            $w.top.mediumSetPresentNumber $w.top.presentChunk \
-            $w.top.maximumRecordSize $w.top.preferredMessageSize \
-            -side top -anchor e -pady 2
+        $w.top.mediumSetPresentNumber $w.top.presentChunk \
+        $w.top.maximumRecordSize $w.top.preferredMessageSize \
+        -side top -anchor e -pady 2
     
     entry-fields $w.top {largeSetLowerBound smallSetUpperBound \
-            mediumSetPresentNumber presentChunk maximumRecordSize \
-            preferredMessageSize} \
-            {{Large Set Lower Bound:} {Small Set Upper Bound:} \
-            {Medium Set Present Number:} {Present Chunk:} \
-            {Maximum Record Size:} {Preferred Message Size:}} \
-            [list advanced-setup-action $target $b] [list destroy $w]
+        mediumSetPresentNumber presentChunk maximumRecordSize \
+        preferredMessageSize} \
+        {{Large Set Lower Bound:} {Small Set Upper Bound:} \
+        {Medium Set Present Number:} {Present Chunk:} \
+        {Maximum Record Size:} {Preferred Message Size:}} \
+        [list advanced-setup-action $target $b] [list destroy $w]
 
     $w.top.largeSetLowerBound.entry configure -textvariable \
     profileS($target,largeSetLowerBound)
@@ -2005,7 +2066,7 @@ proc database-select {} {
 
     label $w.top.databases.label -text "List"
     listbox $w.top.databases.list -width 20 -height 6 \
-            -yscrollcommand "$w.top.databases.scroll set"
+        -yscrollcommand "$w.top.databases.scroll set"
     scrollbar $w.top.databases.scroll -orient vertical -border 1
     pack $w.top.databases.label -side top -fill x -padx 2 -pady 2
     pack $w.top.databases.list -side left -fill both -expand yes -padx 2 -pady 2
@@ -2032,7 +2093,8 @@ proc cascade-dblist {target base} {
     global profile
 
     set w .top.service.m.dblist
-    $w delete 0 200
+#    $w delete 0 200
+    $w delete 0 end
     if {[info exists profile($target,databases)]} {
         foreach db $profile($target,databases) {
             $w add command -label $db \
@@ -2092,20 +2154,25 @@ proc cascade-target-list {} {
 #  i       Query type number (integer)
 # This procedure is called when the user selects a Query type. The current
 # query type information given by the globals $queryButtonsFind and
-# $queryInfoFind are affected by this operation.
+# $queryInfoFind are changed by this operation.
 proc query-select {i} {
-    global queryButtonsFind queryInfoFind queryButtons queryInfo queryAuto queryAutoOld hostid currentDb profile
-    
-    if {$queryAutoOld == 1 && $queryAuto == 0} {
+    global queryButtonsFind queryInfoFind  queryTypes queryAuto queryAutoOld \
+        hostid currentDb profile attributeTypeSelected
+    global queryButtons$attributeTypeSelected queryInfo$attributeTypeSelected
+    foreach n $queryTypes {
+        global query$n
+        set query$n 0
+    }
+    set query[lindex $queryTypes $i] 1
+    if {$queryAutoOld && !$queryAuto} {
         set queryAutoOld $queryAuto
-        return
     }
-    if {$queryAutoOld == 0 && $queryAuto == 1 && [info exists profile($hostid,AttributeDetails,$currentDb,Bib1Use)] == 0} {
+    if {!$queryAutoOld && $queryAuto && ![info exists profile($hostid,\
+        AttributeDetails,$currentDb,[lindex $queryTypes $i])]} {
         set queryAutoOld $queryAuto
-        return
     }
-    set queryInfoFind [lindex $queryInfo $i]
-    set queryButtonsFind [lindex $queryButtons $i]
+    set queryInfoFind [lindex [set queryInfo$attributeTypeSelected] $i]
+    set queryButtonsFind [lindex [set queryButtons$attributeTypeSelected] $i]
     index-lines .lines 1 $queryButtonsFind $queryInfoFind activate-index
 }
 
@@ -2113,12 +2180,12 @@ proc query-select {i} {
 # Commits a new query type definition by extending the globals
 # $queryTypes, $queryButtons and $queryInfo.
 proc query-new-action {} {
-    global queryTypes queryButtons queryInfo settingsChanged
-
+    global queryTypes settingsChanged attributeTypeSelected
+    global queryButtons$attributeTypeSelected queryInfo$attributeTypeSelected
     set settingsChanged 1
     lappend queryTypes [.query-new.top.index.entry get]
-    lappend queryButtons {}
-    lappend queryInfo {}
+    lappend queryButtons$attributeTypeSelected {}
+    lappend queryInfo$attributeTypeSelected {}
 
     destroy .query-new
     cascade-query-list
@@ -2146,13 +2213,16 @@ proc query-new {} {
 #  queryNo     query type number (integer)
 # Procedure that deletes the query type specified by $queryNo.
 proc query-delete-action {queryNo} {
-    global queryTypes queryButtons queryInfo settingsChanged
+    global queryTypes settingsChanged attributeTypeSelected
+    global queryInfo$attributeTypeSelected queryButtons$attributeTypeSelected
 
     set settingsChanged 1
 
     set queryTypes [lreplace $queryTypes $queryNo $queryNo]
-    set queryButtons [lreplace $queryButtons $queryNo $queryNo]
-    set queryInfo [lreplace $queryInfo $queryNo $queryNo]
+    set queryButtons$attributeTypeSelected [lreplace [set queryButtons$attributeTypeSelected] \
+        $queryNo $queryNo]
+    set queryInfo$attributeTypeSelected [lreplace [set queryInfo$attributeTypeSelected] \
+        $queryNo $queryNo]
     destroy .query-delete
     cascade-query-list
 }
@@ -2182,24 +2252,22 @@ proc query-delete {queryNo} {
 # Procedure cascade-query-list
 # Updates the entries below Options|Query to list all query types.
 proc cascade-query-list {} {
-    global queryTypes hostid queryAuto attributeTypes
+    global queryTypes hostid attributeTypes queryAuto
     set w .top.options.m.query
     set i 0
     $w.clist delete 0 last
     foreach n $queryTypes {
-        if {$n == "Auto"} {
-            $w.clist add check -label $n -variable queryAuto -command [list query-select $i]
-        } else {
-            $w.clist add command -label $n -command [list query-select $i]      
-        }
+        $w.clist add check -label $n -variable query$n -command [list query-select $i]
+        global query$n
         incr i
     }
     set i 0
     $w.slist delete 0 last
     foreach n $queryTypes {
         if {$n == "Auto"} {
-               if {$hostid == "Default"} {
-                $w.slist add command -label $n -state disabled -command [list query-setup $i]
+            if {$hostid == "Default"} {
+                $w.slist add command -label $n -state disabled \
+                    -command [list query-setup $i]
             } else {
                 $w.slist add command -label $n -command [list query-setup $i]
             }
@@ -2212,13 +2280,19 @@ proc cascade-query-list {} {
     $w.tlist delete 0 last
     foreach n $attributeTypes {
         global attribute$n
-        $w.tlist add check -label $n -variable attribute$n -command [list attribute-select $i]
+        $w.tlist add check -label $n -variable attribute$n \
+            -command [list attribute-select $i]
         incr i
     }
     set i 0
     $w.dlist delete 0 last
     foreach n $queryTypes {
-        $w.dlist add command -label $n -command [list query-delete $i]
+        if {$n == "Auto"} {
+            $w.dlist add command -label $n -state disabled \
+                -command [list query-setup $i]
+        } else {
+            $w.dlist add command -label $n -command [list query-delete $i]
+        }
         incr i
     }
 }
@@ -2260,8 +2334,8 @@ proc save-geometry {} {
 # is normally kept in the directory /usr/local/lib/irtcl.
 # All query types and target defintion profiles are saved.
 proc save-settings {} {
-    global profile libdir settingsChanged queryTypes queryButtons queryInfo queryAuto attributeTypes attributeTypeSelected
-
+    global profile libdir settingsChanged queryTypes queryAuto \
+        attributeTypes attributeTypeSelected
     if {[file writable [file join $libdir irtdb.tcl]]} {
         set f [open [file join $libdir irtdb.tcl] w]
     } else {
@@ -2274,8 +2348,11 @@ proc save-settings {} {
     puts $f "set attributeTypes [list $attributeTypes]"
     puts $f "set attributeTypeSelected [list $attributeTypeSelected]"
     puts $f "set queryTypes [list $queryTypes]"
-    puts $f "set queryButtons [list $queryButtons]"
-    puts $f "set queryInfo [list $queryInfo]"
+    foreach attrtype $attributeTypes {
+        global queryButtons$attrtype queryInfo$attrtype
+        catch {puts $f "set queryButtons$attrtype [list [set queryButtons$attrtype]]"}
+        catch {puts $f "set queryInfo$attrtype [list [set queryInfo$attrtype]]"}
+    }
     puts $f "set queryAuto [list $queryAuto]"
     close $f
     set settingsChanged 0
@@ -2337,6 +2414,34 @@ proc exit-action {} {
 proc listbuttonaction {w name h user i} {
     $w configure -text [lindex $name 0]
     $h [lindex $name 1] $user $i
+    if {[regexp {.lines.[ ]*([0-9]+).*} $w match j]} {
+        global attributeTypeSelected queryTypes hostid currentDb profile
+        global queryButtons$attributeTypeSelected
+        set n -1
+        foreach type $queryTypes {
+            global query$type
+            if {[set query$type] == 1} {
+                set n [lsearch $queryTypes $type]
+            }
+        }
+        if {$n == -1} {
+            return
+        }
+        set list [lindex [set queryButtons$attributeTypeSelected] $n]
+        set length [llength $list]
+        if {$j < $length} {
+#            set new [lreplace [lindex [set queryButtons$attributeTypeSelected] $n] $j $j [list I $i]]
+            set new [lreplace $list $j $j [list I $i]]
+        } else {
+            set new [lappend $list [list I $i]]
+        }
+        set queryButtons$attributeTypeSelected \
+            [lreplace [set queryButtons$attributeTypeSelected] $n $n $new]
+        set profile($hostid,queryButtons,$currentDb) $new
+        
+    }
+#    debug-window "[lindex $name 0], [lindex $name 1], i er her $i, winduesnavnet er $w, n er $n"
+#    debug-window "new er $new"
 }
 
 # Procedure listbuttonx {button no names handle user}
@@ -2381,7 +2486,7 @@ proc listbuttonx {button no names handle user} {
 # and menu widgets.
 proc listbutton {button no names} {
     menubutton $button -text [lindex $names $no] -width 10 -menu ${button}.m \
-            -relief raised -border 1
+        -relief raised -border 1
     irmenu ${button}.m
     ${button}.m configure -tearoff off
     foreach name $names {
@@ -2455,11 +2560,15 @@ proc query-add-index-action {queryNo} {
 #  queryNo      query type number (integer)
 # Handler that adds new query line.
 proc query-add-line {queryNo} {
-    set w .query-setup
-
     global queryInfoTmp queryButtonsTmp
+    
+    set w .query-setup
 
     lappend queryButtonsTmp {I 0}
+    
+    set height [expr [winfo height $w] + 100]
+#    set windowGeometry($w) ${height}x[winfo width $w]+0+0
+    $w configure -height $height -width [winfo width $w]
 
     index-lines $w.top.lines 0 $queryButtonsTmp $queryInfoTmp activate-e-index
 }
@@ -2505,12 +2614,15 @@ proc query-add-index {queryNo} {
 # globals $queryInfo and $queryButtons. This procedure is executed when
 # the user commits the query setup changes by pressing button "Ok".
 proc query-setup-action {queryNo} {
-    global queryButtons queryInfo queryButtonsTmp queryInfoTmp queryButtonsFind \
-        queryInfoFind settingsChanged hostid currentDb profile
+    global queryButtonsTmp queryInfoTmp queryButtonsFind \
+        queryInfoFind settingsChanged hostid currentDb profile attributeTypeSelected
+    global queryInfo$attributeTypeSelected queryButtons$attributeTypeSelected
     set settingsChanged 1
-    set queryInfo [lreplace $queryInfo $queryNo $queryNo $queryInfoTmp]
-    set queryButtons [lreplace $queryButtons $queryNo $queryNo $queryButtonsTmp]
-    if {[info exists profile($hostid,AttributeDetails,$currentDb,Bib1Use)]} {
+    set queryInfo$attributeTypeSelected [lreplace [set queryInfo$attributeTypeSelected] \
+        $queryNo $queryNo $queryInfoTmp]
+    set queryButtons$attributeTypeSelected [lreplace \
+        [set queryButtons$attributeTypeSelected] $queryNo $queryNo $queryButtonsTmp]
+    if {[info exists profile($hostid,AttributeDetails,$currentDb,Bib1)]} {
         set profile($hostid,queryButtons,$currentDb) $queryButtonsTmp
     }
     set queryInfoFind $queryInfoTmp
@@ -2528,7 +2640,7 @@ proc attribute-select {queryNo} {
         global attribute[set type]
         set attribute$type 0
     }
-    set attribute[lindex $attributeTypes $queryNo] 1
+    set attribute$attributeTypeSelected 1
 }
 
 #proc changeQueryButtons {target base}
@@ -2536,18 +2648,15 @@ proc attribute-select {queryNo} {
 #base        database name
 #Substitutes the third element (the Auto element) in queryButtons with 
 #profile(target,queryButtons,base). The third element in queryInfo is also substituted with
-#profile(target,AttributeDetails,base,Bib1Use)
+#profile(target,AttributeDetails,base,attributeTypeSelected)
 proc changeQueryButtons {target base} {
-    source bib-1.tcl
-    global profile queryButtons queryInfo
+    global profile queryInfo attributeTypeSelected queryTypes
+    global queryButtons$attributeTypeSelected
+    set n [lsearch $queryTypes Auto]
     if {[info exists profile($target,queryButtons,$base)]} {
-        set queryButtons [lreplace $queryButtons 2 2 $profile($target,queryButtons,$base)]
-        foreach tag $profile($target,AttributeDetails,$base,Bib1Use) {
-            if {$tag < 1037} {
-                lappend tempList [list $bib1($tag) 1=$tag]
-            }
-        }
-        set queryInfo [lreplace $queryInfo 2 2 $tempList]
+        set queryButtons$attributeTypeSelected [lreplace [set \
+            queryButtons$attributeTypeSelected] $n $n $profile($target,queryButtons,$base)]
+        change-queryInfo $target $base
     }
 }
 
@@ -2586,21 +2695,21 @@ proc activate-index {value no i} {
 proc update-attr {} {
     set w .index-setup
     listbuttonv $w.top.relation.b relationTmpValue\
-            {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
-            {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
-            {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
+        {{None} 0 {Less than} 1 {Greater than or equal} 2 {Equal} 3 \
+        {Greater than or equal} 4 {Greater than} 5 {Not equal} 6 \
+        {Phonetic} 100 {Stem} 101 {Relevance} 102 {AlwaysMatches} 103}
     listbuttonv $w.top.position.b positionTmpValue {{None} 0 \
-            {First in field} 1 {First in subfield} 2 {Any position in field} 3}
+        {First in field} 1 {First in subfield} 2 {Any position in field} 3}
     listbuttonv $w.top.structure.b structureTmpValue {{None} 0 {Phrase} 1 \
-            {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list}  6 \
-            {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
-            {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
-            {local-number} 107 {string} 108 {numeric string} 109}
+        {Word} 2 {Key} 3 {Year} 4 {Date (norm)} 5 {Word list}  6 \
+        {Date (un-norm)} 100 {Name (norm)} 101 {Date (un-norm)} 102 \
+        {Structure} 103 {urx} 104 {free-form} 105 {doc-text} 106 \
+        {local-number} 107 {string} 108 {numeric string} 109}
     listbuttonv $w.top.truncation.b truncationTmpValue {{Auto} 0 {Right} 1 \
-            {Left} 2 {Left and right} 3 {No truncation} 100 \
-            {Process #} 101 {Re-1} 102 {Re-2} 103}
+        {Left} 2 {Left and right} 3 {No truncation} 100 \
+        {Process #} 101 {Re-1} 102 {Re-2} 103}
     listbuttonv $w.top.completeness.b completenessTmpValue {{None} 0 \
-            {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
+        {Incomplete subfield} 1 {Complete subfield} 2 {Complete field} 3}
 }
 
 # Procedure use-attr {init}
@@ -2610,136 +2719,35 @@ proc update-attr {} {
 # is 0 the current selection of the listbox is read and the global
 # $useTmpValue is set to the current use-value.
 proc use-attr {init} {
-    global useTmpValue
-    source bib-1.tcl
-    set attr {
-        {None}                           0
-        {Personal name}                  1 
-        {Corporate name}                 2 
-        {Conference name}                3 
-        {Title}                          4 
-        {Title-series}                   5 
-        {Title-uniform}                  6 
-        {ISBN}                           7 
-        {ISSN}                           8 
-        {LC card number}                 9 
-        {BNB card number}                10
-        {BGF(sic) number}                11 
-        {Local number}                   12 
-        {Dewey classification}           13 
-        {UDC classification}             14 
-        {Bliss classification}           15 
-        {LC call number}                 16 
-        {NLM call number}                17 
-        {NAL call number}                18 
-        {MOS call number}                19 
-        {Local classification}           20 
-        {Subject heading}                21 
-        {Subject-RAMEAU}                 22 
-        {BDI-index-subject}              23 
-        {INSPEC-subject}                 24 
-        {MESH-subject}                   25 
-        {PA-subject}                     26 
-        {LC-subject-heading}             27 
-        {RVM-subject-heading}            28 
-        {Local subject index}            29 
-        {Date}                           30 
-        {Date of publication}            31 
-        {Date of acquisition}            32 
-        {Title-key}                      33 
-        {Title-collective}               34 
-        {Title-parallel}                 35 
-        {Title-cover}                    36 
-        {Title-added-title-page}         37 
-        {Title-caption}                  38 
-        {Title-running}                  39 
-        {Title-spine}                    40 
-        {Title-other-variant}            41 
-        {Title-former}                   42 
-        {Title-abbreviated}              43 
-        {Title-expanded}                 44 
-        {Subject-PRECIS}                 45 
-        {Subject-RSWK}                   46 
-        {Subject-subdivision}            47 
-        {Number-natl-bibliography}       48 
-        {Number-legal-deposit}           49 
-        {Number-govt-publication}        50 
-        {Number-publisher-for-music}     51 
-        {Number-DB}                      52 
-        {Number-local-call}              53 
-        {Code-language}                  54 
-        {Code-geographic-area}           55 
-        {Code-institution}               56 
-        {Name and title}                 57 
-        {Name-geographic}                58 
-        {Place-publication}              59 
-        {CODEN}                          60 
-        {Microform-generation}           61 
-        {Abstract}                       62 
-        {Note}                           63 
-        {Author-title}                 1000 
-        {Record type}                  1001 
-        {Name}                         1002 
-        {Author}                       1003 
-        {Author-name-personal}         1004 
-        {Author-name-corporate}        1005 
-        {Author-name-conference}       1006 
-        {Identifier-standard}          1007 
-        {Subject-LC-children's}        1008 
-        {Subject-name-personal}        1009 
-        {Body of text}                 1010 
-        {Date/time added to database}  1011 
-        {Date/time last modified}      1012 
-        {Authority/format identifier}  1013 
-        {Concept-text}                 1014 
-        {Concept-reference}            1015 
-        {Any}                          1016 
-        {Server choice}                1017 
-        {Publisher}                    1018 
-        {Record source}                1019 
-        {Editor}                       1020 
-        {Bib-level}                    1021 
-        {Geographic class}             1022 
-        {Indexed by}                   1023 
-        {Map scale}                    1024 
-        {Music key}                    1025 
-        {Related periodical}           1026 
-        {Report number}                1027 
-        {Stock number}                 1028 
-        {Thematic number}              1030 
-        {Material type}                1031 
-        {Doc ID}                       1032 
-        {Host item}                    1033 
-        {Content type}                 1034 
-        {Anywhere}                     1035 
-    }
+    global useTmpValue attributeTypeSelected
+    set ats [string tolower $attributeTypeSelected]
+    source ${ats}.tcl
+    
     set w .index-setup
 
     if {$init} {
         set s 0
         set lno 0
-        for {set i 0} {$i < 1037} {incr i} {
-            $w.top.use.list insert end $bib1($i)
-            incr i
-            if {$useTmpValue == $bib1($i)} {
+        foreach i [lsort -integer [array names $ats]] {
+            $w.top.use.list insert end "[set ${ats}($i)]"
+            if {$useTmpValue == $i} {
                 set s $lno
             }
-            if {$i == 63} {
-                set i 1000
-            }
             incr lno
-        }
+        } 
         $w.top.use.list selection clear 0 end
         $w.top.use.list selection set $s $s
-        incr s -3
-        if {$s < 0} {
-            set s 0
-        }
+#        incr s -3
+#        if {$s < 0} 
+#            set s 0
+#        
         $w.top.use.list yview $s
     } else {
-        set lno [lindex [$w.top.use.list curselection] 0]
-        set i [expr {$lno+$lno+1}]
-        set useTmpValue $bib1($i)
+        set j [lindex [$w.top.use.list curselection] 0]
+        set i [lindex [lsort -integer [array names ${ats}]] $j]
+#        debug-window "[$w.top.use.list curselection] [set ${ats}($i)]"
+#        set useTmpValue [set ${ats}($i)]
+        set useTmpValue $i
         dputs "useTmpValue=$useTmpValue"
     }
 }
@@ -2794,7 +2802,7 @@ proc index-setup {attr queryNo indexNo} {
     set w .index-setup
 
     global relationTmpValue structureTmpValue truncationTmpValue \
-        completenessTmpValue positionTmpValue useTmpValue
+        completenessTmpValue positionTmpValue useTmpValue attributeTypeSelected
     set relationTmpValue 0
     set truncationTmpValue 0
     set structureTmpValue 0
@@ -2806,7 +2814,7 @@ proc index-setup {attr queryNo indexNo} {
     toplevelG $w
 
     set n [lindex $attr 0]
-    wm title $w "Index setup $n"
+    wm title $w "Index setup: $n, $attributeTypeSelected"
 
     top-down-window $w
 
@@ -2893,10 +2901,10 @@ proc index-setup {attr queryNo indexNo} {
     pack $w.top.completeness.label $w.top.completeness.b -fill x
 
     # Ok-cancel
-    bottom-buttons $w [list \
-        {Ok} [list index-setup-action $attr $queryNo $indexNo] \
-        {Cancel} [list destroy $w]] 0
-
+    bottom-buttons $w [list {Ok} \
+        [list index-setup-action $attr $queryNo $indexNo] {Cancel} [list destroy $w]] 0
+    
+    focus $w
 }
 
 # Procedure query-edit-index {queryNo}
@@ -2935,21 +2943,29 @@ proc query-delete-index {queryNo} {
     
 # Procedure query-setup {queryNo}
 #  queryNo     query number
-# Makes a dialog in which a query type an be customized.
+# Makes a dialog in which a query type can be customized.
 proc query-setup {queryNo} {
+    global queryTypes queryButtonsTmp queryInfoTmp queryIndexTmp attributeTypeSelected
+    global queryInfo$attributeTypeSelected queryButtons$attributeTypeSelected
     set w .query-setup
 
-    global queryTypes queryButtons queryInfo queryButtonsTmp queryInfoTmp queryIndexTmp
-    
     set queryIndexTmp 0
     set queryName [lindex $queryTypes $queryNo]
-    set queryInfoTmp [lindex $queryInfo $queryNo]
-    set queryButtonsTmp [lindex $queryButtons $queryNo]
+    if {[info exists queryInfo$attributeTypeSelected]} {
+        set queryInfoTmp [lindex [set queryInfo$attributeTypeSelected] $queryNo]
+    } else {
+        set queryInfoTmp [lindex $queryInfoBib1 $queryNo]
+    }
+    if {[info exists queryButtons$attributeTypeSelected]} {
+        set queryButtonsTmp [lindex [set queryButtons$attributeTypeSelected] $queryNo]
+    } else {
+        set queryButtonsTmp [lindex $queryButtonsBib1 $queryNo]
+    }
 
     toplevelG $w
 
     wm minsize $w 0 0
-    wm title $w "Query setup $queryName"
+    wm title $w "Query setup $queryName - $attributeTypeSelected"
 
     top-down-window $w
 
@@ -2970,7 +2986,8 @@ proc query-setup {queryNo} {
     frame $w.top.index -relief ridge -border 2
     pack $w.top.index -pady 6 -padx 6 -side right -fill y
 
-    listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set]
+    listbox $w.top.index.list -yscrollcommand [list $w.top.index.scroll set] \
+        -background white
     scrollbar $w.top.index.scroll -orient vertical -border 1 \
         -command [list $w.top.index.list yview]
     bind $w.top.index.list <Double-1> [list query-edit-index $queryNo]
@@ -2981,7 +2998,7 @@ proc query-setup {queryNo} {
     $w.top.index.list selection clear 0 end
     $w.top.index.list selection set 0 0
     foreach x $queryInfoTmp {
-    $w.top.index.list insert end [lindex $x 0]
+        $w.top.index.list insert end [lindex $x 0]
     }
 
     # Bottom
@@ -2991,6 +3008,7 @@ proc query-setup {queryNo} {
             Edit [list query-edit-index $queryNo] \
             Delete [list query-delete-index $queryNo] \
             Cancel [list destroy $w]] 0
+    focus $w
 }
 
 # Procedure index-clear
@@ -3067,17 +3085,17 @@ proc index-query {} {
             }
             set term "\{${term}\}"
             if {$right && $left} {
-                set term "@attrset $attributeTypeSelected @attr 5=3 ${term}"
+                set term "@attr 5=3 ${term}"
             } elseif {$right} {
-                set term "@attrset $attributeTypeSelected @attr 5=1 ${term}"
+                set term "@attr 5=1 ${term}"
             } elseif {$left} {
-                set term "@attrset $attributeTypeSelected @attr 5=2 ${term}"
+                set term "@attr 5=2 ${term}"
             }
             if {$relation != ""} {
-                set term "@attrset $attributeTypeSelected @attr 2=${relation} ${term}"
+                set term "@attr 2=${relation} ${term}"
             }
             foreach a $attr {
-                set term "@attrset $attributeTypeSelected @attr $a ${term}"
+                set term "@attr $a ${term}"
             }
             if {$qs != ""} {
                 set qs "@and ${qs} ${term}"
@@ -3087,8 +3105,15 @@ proc index-query {} {
         }
         incr i
     }
-    dputs "qs=  $qs"
-    return $qs
+    debug-window "Querystring er her $qs"
+    if {$qs == ""} {
+        return ""
+    } else {
+        set qs "@attrset $attributeTypeSelected $qs"
+        dputs "qs=  $qs"
+        debug-window "....og nu er den $qs\n"
+        return $qs
+    }
 }
 
 # Procedure index-focus-in {w i}
@@ -3165,15 +3190,17 @@ proc configureOptionsSyntax {target base} {
     global profile syntaxList recordSyntax 
     set activate 0
     set i -1
+    set j 0
     set w .top.options.m.syntax
     if {[info exists profile($target,RecordSyntaxes,$base)]} {
         foreach syntax $syntaxList {
             incr i
             if {$syntax == "sep"} {continue}
+            incr j
             if {[lsearch $profile($target,RecordSyntaxes,$base) $syntax] != -1} {
                 configure-enable-e $w $i
                 if {$activate == 0} {
-                    $w invoke $i
+                    $w invoke $j
                     set recordSyntax $syntax
                     set activate 1
                 }
@@ -3185,16 +3212,19 @@ proc configureOptionsSyntax {target base} {
         foreach syntax $syntaxList {
             incr i
             if {$syntax == "sep"} {continue}
+            incr j
+            if {$syntax == $recordSyntax} {
+                $w invoke $j
+            }
             configure-enable-e $w $i
         }
-        $w invoke 0
     }
 }
 
 # Init: The geometry information for the main window is set - either
 # to a default value or to the value in windowGeometry(.)
 if {[catch {set g $windowGeometry(.)}]} {
-    wm geometry . 420x340
+    wm geometry . 500x410
 } else {
     wm geometry . $g
 }
@@ -3211,16 +3241,17 @@ frame .bot  -border 1 -relief raised
 pack .top .lines .mid -side top -fill x
 pack .data -side top -fill both -expand yes
 pack .bot -fill x
+#irmenu .top.file
 
 # Init: Definition of File menu.
-menubutton .top.file -text File -menu .top.file.m
+menubutton .top.file -text File -menu .top.file.m -underline 0
 irmenu .top.file.m
 .top.file.m add command -label {Save settings} -command {save-settings}
 .top.file.m add separator
 .top.file.m add command -label Exit -command {exit-action}
 
 # Init: Definition of Target menu.
-menubutton .top.target -text Target -menu .top.target.m
+menubutton .top.target -text Target -menu .top.target.m -underline 0
 irmenu .top.target.m
 .top.target.m add cascade -label Connect -menu .top.target.m.clist
 .top.target.m add command -label Disconnect -command {close-target}
@@ -3238,7 +3269,7 @@ irmenu .top.target.m.slist
 cascade-target-list
 
 # Init: Definition of Service menu.
-menubutton .top.service -text Service -menu .top.service.m
+menubutton .top.service -text Service -menu .top.service.m -underline 0
 irmenu .top.service.m
 .top.service.m add cascade -label Database -menu .top.service.m.dblist
 .top.service.m add cascade -label Present -menu .top.service.m.present
@@ -3255,13 +3286,13 @@ irmenu .top.service.m.present
 irmenu .top.service.m.dblist
 
 # Init: Definition of Set menu.
-menubutton .top.rset -text Set -menu .top.rset.m
+menubutton .top.rset -text Set -menu .top.rset.m -underline 1
 irmenu .top.rset.m
 .top.rset.m add command -label Load -command {load-set}
 .top.rset.m add separator
 
 # Init: Definition of the Options menu.
-menubutton .top.options -text Options -menu .top.options.m
+menubutton .top.options -text Options -menu .top.options.m -underline 0
 irmenu .top.options.m
 .top.options.m add cascade -label Query -menu .top.options.m.query
 .top.options.m add cascade -label Format -menu .top.options.m.formats
@@ -3325,7 +3356,7 @@ irmenu .top.options.m.elements
 .top.options.m.elements add radiobutton -label Brief -value B -variable elementSetNames
 
 # Init: Definition of Help menu.
-menubutton .top.help -text "Help" -menu .top.help.m
+menubutton .top.help -text "Help" -menu .top.help.m -underline 0
 irmenu .top.help.m
 
 #.top.help.m add command -label "Help on help" -command {tkerror "Help on help not available. Sorry"}
@@ -3335,18 +3366,25 @@ irmenu .top.help.m
 # Init: Pack menu bar items.
 pack .top.file .top.target .top.service .top.rset .top.options -side left
 pack .top.help -side right
+#.top configure -menu .top.file
 
-# Init: Define query area.
-index-lines .lines 1 $queryButtonsFind [lindex $queryInfo 0] activate-index
+# Init: Define query area buttons with icons.
+index-lines .lines 1 $queryButtonsFind [lindex [set \
+    queryInfo$attributeTypeSelected] 0] activate-index
 image create photo scan -file [file join $libdir bitmaps a-z.gif]
 image create photo clear -file [file join $libdir bitmaps trash.gif]
 image create photo present -file [file join $libdir bitmaps page.gif]
 image create photo search -file [file join $libdir bitmaps search.gif]
-button .mid.search -image search -command {search-request 0} -state disabled -relief flat
+image create photo stop -file [file join $libdir bitmaps stop.gif]
+button .mid.search -image search -command {search-request 0} \
+    -state disabled -relief flat
 button .mid.scan -image scan -command scan-request -state disabled -relief flat
-button .mid.present -image present -command [list present-more 10] -state disabled -relief flat
+button .mid.present -image present -command [list present-more 10] \
+    -state disabled -relief flat
 button .mid.clear -image clear -command index-clear -relief flat
+button .mid.stop -image stop -command cancel-operation -relief flat
 pack .mid.search .mid.scan .mid.present .mid.clear -side left -fill y -pady 1
+pack .mid.stop -side left -fill y -padx 20
 
 # Init: Define record area in main window.
 text .data.record -font fixed -height 2 -width 20 -wrap none -borderwidth 0 \
index 30f113a..30973f2 100644 (file)
@@ -11,7 +11,7 @@ proc get-attributeDetails {target base} {
                                unset profile($arrayname)
                        }
                }
-               .debug-window.top.t insert end "Explain\n"
+               debug-window "Explain"
                while {![catch {set rec [z39.attributeDetails getExplain $index attributeDetails]}]} {
                        set db [lindex [lindex $rec 1] 1]
                        foreach tagset [lrange [lindex $rec 2] 1 end] {
@@ -19,7 +19,7 @@ proc get-attributeDetails {target base} {
                                        foreach attributeType [lindex $tagset 1] {
                                                if {[lindex [lindex $attributeType 0] 1] == 1} {
                                                        foreach attributeValues [lrange [lindex $attributeType 2] 1 end] {
-                                                               lappend profile($target,AttributeDetails,$db,Bib1Use) \
+                                                               lappend profile($target,AttributeDetails,$db,Bib1) \
                                                                        [lindex [lindex [lindex $attributeValues 0] 1] 1]
                                                        }
                                                }                                               
@@ -46,13 +46,20 @@ proc get-attributeDetails {target base} {
 #Procedure change-queryInfo {target base}
 #The queryInfo array is set according to the attributes obtained by explain.
 proc change-queryInfo {target base} {
-       global queryInfo profile bib1
-       foreach tag $profile($target,AttributeDetails,$base,Bib1Use) {
-               if {$tag < 1037} {
-                       lappend tempList [list $bib1($tag) 1=$tag]
-               }
-       }
-       set queryInfo [lreplace $queryInfo 2 2 $tempList]
+       global queryInfo profile attributeTypeSelected queryTypes
+       global queryInfo$attributeTypeSelected
+       set n [lsearch $queryTypes Auto]
+       foreach tag $profile($target,AttributeDetails,$base,$attributeTypeSelected) {
+#        if {$tag < 2000} 
+#            lappend tempList [list $bib1($tag) 1=$tag]
+#         else 
+#            lappend tempList [list $gils($tag) 1=$tag]
+        set ats [string tolower $attributeTypeSelected]
+        global $ats
+        source ${ats}.tcl
+        lappend tempList [list "[set ${ats}($tag)]" 1=$tag]      
+    }
+       set queryInfo$attributeTypeSelected [lreplace [set queryInfo$attributeTypeSelected] $n $n $tempList]
 }
 
 
@@ -60,7 +67,7 @@ proc change-queryInfo {target base} {
 # Issue search request with explain-attribute set and specific category.
 proc explain-search-request {target zz category finish response fresponse} {
     z39 callback [list explain-search-response $target $zz $category $finish \
-            $response $fresponse]
+        $response $fresponse]
     ir-set $zz z39
     $zz databaseNames IR-Explain-1
     $zz preferredRecordSyntax explain
@@ -168,11 +175,11 @@ proc explain-check-fail {target zz category finish} {
     eval $finish [list $target]
 }
 
-proc prettyDump {x} {
-    foreach y $x {
-               prettyDumpR $y 0
-    }
-}
+#proc prettyDump {x} 
+#    foreach y $x 
+#              prettyDumpR $y 0
+    
+
 
 proc prettyDumpR {x ind} {
     for {set i 0} {$i < $ind} {incr i} {
@@ -197,44 +204,49 @@ proc prettyDumpR {x ind} {
 proc explain-check-ok {target zz category finish} {
     global profile settingsChanged currentDb
 
-    puts ""
-    puts ""
-    puts ""
-    puts ""
+#    puts ""
+#    puts ""
+#    puts ""
+#    puts ""
     set crec [z39.categoryList getExplain 1 categoryList]
-    puts "--- categoryList"
-    puts $crec
+#    puts "--- categoryList"
+#    puts $crec
 
     set rec [z39.targetInfo getExplain 1]
     set trec [z39.targetInfo getExplain 1 targetInfo]
-    puts "--- targetInfo"
-    puts $rec
+#    puts "--- targetInfo"
+#    puts $rec
 
     set no 1
     while {1} {
         if {
                [catch {set rec [z39.databaseInfo getExplain $no databaseInfo]}]
         } break
-       puts "--- databaseInfo $no"
-               puts $rec
+#      puts "--- databaseInfo $no"
+#              puts $rec
        lappend dbRecs $rec
        set db [lindex [lindex $rec 1] 1]
                if {![string length $db]} break
-       lappend dbList $db
+               #Here the explain database IR-Explain-1 is skipped from the database list.
+               if {$db != "IR-Explain-1"} {
+           lappend dbList $db
+       }
+       debug-window "${no}: $db"
        incr no
     }
     if {[info exists dbList]} {
         set profile($target,databases) $dbList
     }
     cascade-target-list
+    cascade-dblist $target 1
 
     set no 1
     while {1} {
         if {
                [catch {set rec [z39.attributeDetails getExplain $no attributeDetails]}]
                } break
-        puts "--- attributeDetails $no"
-               puts $rec
+#        puts "--- attributeDetails $no"
+#              puts $rec
         incr no
     }
     set data [lindex [lindex [lindex [lindex [lindex $trec 12] 1] 1] 1] 1]
index 3857320..01f249f 100644 (file)
@@ -4,95 +4,43 @@
 # Sebastian Hammer, Adam Dickmeiss
 #
 # $Log: line.tcl,v $
-# Revision 1.1  1998-09-30 10:53:54  perhans
+# Revision 1.2  1999-03-17 09:24:11  perhans
+# Explain now also finds Gils attributes.
+# Support for search with Gils attributes added.
+# Stop button added.
+# The medium format extended and cleaned up (kommas between termes).
+# Lots of minor but fixes.
+#
+# Revision 1.1  1998/09/30 10:53:54  perhans
 # New client with better Explain support and nice icons.
-#
-# Revision 1.15  1997/11/24 11:34:38  adam
-# Using odr_nullval() instead of ODR_NULLVAL when appropriate.
-#
-# Revision 1.14  1997/11/19 11:22:10  adam
-# Object identifiers can be accessed in GRS-1 records.
-#
-# Revision 1.13  1996/04/12 12:25:27  adam
-# Modified display of GRS-1 records to include headings for standard
-# tag sets.
-#
-# Revision 1.12  1996/03/29  16:05:36  adam
-# Bug fix: GRS records wasn't recognized.
-#
-# Revision 1.11  1996/01/23  15:24:21  adam
-# Wrore more comments.
-#
-# Revision 1.10  1995/10/17  17:39:46  adam
-# Minor bug fix in call to display-grs-line.
-#
-# Revision 1.9  1995/10/17  14:18:09  adam
-# Minor changes in presentation formats.
-#
-# Revision 1.8  1995/10/17  10:58:08  adam
-# More work on presentation formats.
-#
-# Revision 1.7  1995/09/20  11:37:06  adam
-# Work on GRS.
-#
-# Revision 1.6  1995/06/29  12:34:20  adam
-# IrTcl now works with both tk4.0b4/tcl7.4b4 and tk3.6/tcl7.3
-#
-# Revision 1.5  1995/06/22  13:16:28  adam
-# Feature: SUTRS. Setting getSutrs implemented.
-# Work on display formats.
-#
-# Revision 1.4  1995/06/19  08:10:21  adam
-# Inverse highligt colours in monochrome mode.
-#
-# Revision 1.3  1995/06/16  12:29:00  adam
-# Use insertWithTags on diagnostic errors.
-#
-# Revision 1.2  1995/06/13  14:39:06  adam
-# Fix: if {$var != ""} doesn't work if var is a large numerical!
-# Highlight when line format is used.
-#
-# Revision 1.1  1995/06/12  15:18:10  adam
-# Work on presentation formats. These are used in the main window as well
-# as popup windows.
-#
-#
+
 proc display-grs-line {w r i} {
     global tagSet
     
-    if {[tk4]} {
-        set start [$w index insert]
-    }
     set head Untitled
     foreach e $r {
-        if {![tk4]} {
-            for {set j 0} {$j < $i} {incr j} {
-                insertWithTags $w "  " marc-tag
-            }
-        }
         set ttype [lindex $e 0]
         set tval [lindex $e 2]
-       if {$ttype == 2 && $tval == 1} {
-           if {[lindex $e 3] == "subtree"} {
-               set f [lindex $e 4]
-               foreach e $f {
-                   if {[lindex $e 0] == 1 && [lindex $e 2] == 19} {
-                       break
-                   }
-               }
-           }
-           if {[lindex $e 3] == "string"} {
+           if {$ttype == 2 && $tval == 1} {
+               if {[lindex $e 3] == "subtree"} {
+                   set f [lindex $e 4]
+                       foreach e $f {
+                           if {[lindex $e 0] == 1 && [lindex $e 2] == 19} {
+                                   break
+                           }
+                       }
+               }
+               if {[lindex $e 3] == "string"} {
                 set head [lindex $e 4]
-           }
+               }
             break
-       }
+           }
     }
     insertWithTags $w $head marc-text
     insertWithTags $w "\n"
     if {[tk4]} {
-        $w tag configure indent$i \
-                -lmargin1 [expr $i * 10] \
-                -lmargin2 [expr $i * 10 + 5]
+        $w tag configure indent$i -lmargin1 [expr $i * 10] \
+            -lmargin2 [expr $i * 10 + 5]
         $w tag add indent$i $start insert
     }
 }
@@ -105,20 +53,12 @@ proc display-grs-line {w r i} {
 #         should be displayed.
 # This procedure attempts to display records in a line-per-line format.
 proc display-line {sno no w hflag} {
-    global monoFlag
     set type [z39.$sno type $no] 
     if {$hflag} {
-        if {! $monoFlag} {
-            $w tag bind r$no <Any-Enter> \
-                [list $w tag configure r$no -background gray80]
-            $w tag bind r$no <Any-Leave> \
-                [list $w tag configure r$no -background {}]
-        } else {
-            $w tag bind r$no <Any-Enter> \
-                [list $w tag configure r$no -background black -foreground white]
-            $w tag bind r$no <Any-Leave> \
-                [list $w tag configure r$no -background {} -foreground {}]
-        }
+        $w tag bind r$no <Any-Enter> \
+            [list $w tag configure r$no -background black -foreground white]
+        $w tag bind r$no <Any-Leave> \
+            [list $w tag configure r$no -background {} -foreground {}]
     } else {
         $w delete 0.0 end
     }
@@ -136,7 +76,7 @@ proc display-line {sno no w hflag} {
             if {[catch {
                 set title [lindex [z39.$sno getMarc $no field 245 * a] 0]
                 set year  [lindex [z39.$sno getMarc $no field 260 * c] 0]
-                insertWithTags $w "$title - " marc-text
+                insertWithTags $w "$title" marc-text
                 insertWithTags $w "$year\n" marc-it
             }]} {
                 insertWithTags $w "Unknown record type: $rtype\n" marc-id
index 06452a9..c35fa2c 100644 (file)
@@ -14,7 +14,7 @@ proc display-grs-medium {w r i} {
         set ttype [lindex $e 0]
         set tval [lindex $e 2]
         if {$ttype == 3} {
-            insertWithTags $w "$tval " marc-pref
+            insertWithTags $w "$tval per" marc-pref
         } elseif {[info exists tagSet($ttype,$tval)]} {
             insertWithTags $w "$tagSet($ttype,$tval) " marc-pref
         } else {
@@ -80,15 +80,15 @@ proc display-medium {sno no w hflag} {
     if {[llength $i]} {
         insertWithTags $w "Title " marc-pref
         insertWithTags $w [string trimright [lindex $i 0] /] marc-text
-        set i [z39.$sno getMarc $no field 245 * b]
+        set i [concat [z39.$sno getMarc $no field 245 * b] [z39.$sno getMarc $no field 251 * a]]
         if {"x$i" != "x"} {
             insertWithTags $w [string trimright [lindex $i 0] /] marc-text
         }
         $w insert end "\n"
     }
-    set i [z39.$sno getMarc $no field 700 * a]
+    set i [concat [z39.$sno getMarc $no field 700 * a] [z39.$sno getMarc $no field 700 * h]]
     if {![llength $i]} {
-        set i [z39.$sno getMarc $no field 100 * a]
+        set i [concat [z39.$sno getMarc $no field 100 * a] [z39.$sno getMarc $no field 100 * h]]
     }
     if {[llength $i]} {
         if {[llength $i] > 1} {
@@ -116,15 +116,14 @@ proc display-medium {sno no w hflag} {
         insertWithTags $w "Keywords " marc-pref
         foreach x $i {
             if {$n > 0} {
-                $w insert end ", "
+#                $w insert end ", "
             }
             insertWithTags $w $x marc-it
             incr n
         }
         $w insert end "\n"
     }
-    set i [concat [z39.$sno getMarc $no field 260 * a] \
-            [z39.$sno getMarc $no field 260 * b] [z39.$sno getMarc $no field 260 * c]]
+    set i [concat [z39.$sno getMarc $no field 260 * b] [z39.$sno getMarc $no field 260 * a]]
     if {[llength $i]} {
         insertWithTags $w "Publisher " marc-pref
         foreach x $i {
@@ -132,7 +131,16 @@ proc display-medium {sno no w hflag} {
         }
         $w insert end "\n"
     }
-    set i [z39.$sno getMarc $no field 300 * a]
+    set i [z39.$sno getMarc $no field 260 * c]
+    if {[llength $i]} {
+        insertWithTags $w "Year " marc-pref
+        foreach x $i {
+            insertWithTags $w $x marc-text
+        }
+        $w insert end "\n"
+    }
+    set i [concat [z39.$sno getMarc $no field 300 * a] [z39.$sno getMarc $no field 300 * b] \
+        [z39.$sno getMarc $no field 300 * c] [z39.$sno getMarc $no field 300 * e]]
     if {[llength $i]} {
         insertWithTags $w "Phys. Desc. " marc-pref
         foreach x $i {
@@ -148,6 +156,14 @@ proc display-medium {sno no w hflag} {
         }
         $w insert end "\n"
     }
+    set i [z39.$sno getMarc $no field 021 * a]
+    if {[llength $i]} {
+        insertWithTags $w "ISBN " marc-pref
+        foreach x $i {
+            insertWithTags $w $x marc-text
+        }
+        $w insert end "\n"
+    }
     set i [z39.$sno getMarc $no field 022 * a]
     if {[llength $i]} {
         insertWithTags $w "ISSN " marc-pref
index b4f7260..29ff5e7 100644 (file)
@@ -25,14 +25,45 @@ set profile(BIBSYS,timeDefine) 878567355
 set profile(BIBSYS,timeLastExplain) {}
 set profile(BIBSYS,timeLastInit) 908447189
 set profile(BIBSYS,welcomeMessage) {}
-set profile(BIBSYS,windowNumber) 3
-set profile(Bagel:210,AttributeDetails,gils,Bib1Use) {1012 1019 1007 62 1005 4}
+set profile(BIBSYS,windowNumber) 5
+set profile(Bagel2,AttributeDetails,gils,Bib1) {1012 1019 1007 62 1005 4}
+set profile(Bagel2,AttributeDetails,gils,Gils) {1012 1019 1007 62 1005 4 2032 2029 2067 2026 2025 2024 2023 2005 2066 2018 2016 2014 2011 2000 2008 2007 2006 2045 2041 2040 2039 2038 2059}
+set profile(Bagel2,AttributeDetails,marc,Bib1) {1005 30 1018 1006 59 4 1003 1004}
+set profile(Bagel2,authentication) {}
+set profile(Bagel2,comstack) tcpip
+set profile(Bagel2,databases) {dranet.dra.com IR-Explain-1 gils marc}
+set profile(Bagel2,description) {}
+set profile(Bagel2,host) bagel.indexdata.dk
+set profile(Bagel2,idAuthentication) {}
+set profile(Bagel2,largeSetLowerBound) 2
+set profile(Bagel2,maxResultSets) {}
+set profile(Bagel2,maxResultSize) {}
+set profile(Bagel2,maxTerms) {}
+set profile(Bagel2,maximumRecordSize) 50000
+set profile(Bagel2,mediumSetPresentNumber) 0
+set profile(Bagel2,multipleDatabases) 1
+set profile(Bagel2,namedResultSets) 1
+set profile(Bagel2,port) 210
+set profile(Bagel2,preferredMessageSize) 30000
+set profile(Bagel2,presentChunk) 4
+set profile(Bagel2,protocol) Z39
+set profile(Bagel2,queryCCL) 0
+set profile(Bagel2,queryRPN) 1
+set profile(Bagel2,recentNews) {}
+set profile(Bagel2,smallSetUpperBound) 0
+set profile(Bagel2,targetInfoName) Zebra
+set profile(Bagel2,timeDefine) {}
+set profile(Bagel2,timeLastExplain) 921514458
+set profile(Bagel2,timeLastInit) {}
+set profile(Bagel2,welcomeMessage) {}
+set profile(Bagel2,windowNumber) 8
+set profile(Bagel:210,AttributeDetails,gils,Bib1) {1012 1019 1007 62 1005 4}
 set profile(Bagel:210,AttributeDetails,gils,Gils) {1012 1019 1007 62 1005 4 2032 2029 2067 2026 2025 2024 2023 2005 2066 2018 2016 2014 2011 2000 2008 2007 2006 2045 2041 2040 2039 2038 2059}
-set profile(Bagel:210,AttributeDetails,marc,Bib1Use) {1005 30 1018 1006 59 4 1003 1004}
+set profile(Bagel:210,AttributeDetails,marc,Bib1) {1005 30 1018 1006 59 4 1003 1004}
 set profile(Bagel:210,RecordSyntaxes,gils) {SUTRS GRS1 USMARC}
 set profile(Bagel:210,authentication) {}
 set profile(Bagel:210,comstack) tcpip
-set profile(Bagel:210,databases) {dranet.dra.com IR-Explain-1 gils marc}
+set profile(Bagel:210,databases) {dranet.dra.com gils marc}
 set profile(Bagel:210,description) {}
 set profile(Bagel:210,host) bagel.indexdata.dk
 set profile(Bagel:210,idAuthentication) {}
@@ -48,7 +79,7 @@ set profile(Bagel:210,port) 210
 set profile(Bagel:210,preferredMessageSize) 30000
 set profile(Bagel:210,presentChunk) 4
 set profile(Bagel:210,protocol) Z39
-set profile(Bagel:210,queryButtons,gils) {{I 4} {I 5} {I 3}}
+set profile(Bagel:210,queryButtons,gils) {{I 3} {I 0} {I 9} {I 1}}
 set profile(Bagel:210,queryButtons,marc) {{I 6} {I 5} {I 2}}
 set profile(Bagel:210,queryCCL) 0
 set profile(Bagel:210,queryRPN) 1
@@ -56,10 +87,10 @@ set profile(Bagel:210,recentNews) {}
 set profile(Bagel:210,smallSetUpperBound) 0
 set profile(Bagel:210,targetInfoName) Zebra
 set profile(Bagel:210,timeDefine) {}
-set profile(Bagel:210,timeLastExplain) 913116790
-set profile(Bagel:210,timeLastInit) 913116790
+set profile(Bagel:210,timeLastExplain) 921596846
+set profile(Bagel:210,timeLastInit) 921596846
 set profile(Bagel:210,welcomeMessage) {}
-set profile(Bagel:210,windowNumber) 1
+set profile(Bagel:210,windowNumber) 2
 set {profile(Bell Laboratories Library Network,authentication)} {}
 set {profile(Bell Laboratories Library Network,comstack)} tcpip
 set {profile(Bell Laboratories Library Network,databases)} {ir-explain-1 books gils netlib ls-lr z39dbs acc1 acc2 acc3 factbook books}
@@ -86,7 +117,7 @@ set {profile(Bell Laboratories Library Network,timeDefine)} 878567355
 set {profile(Bell Laboratories Library Network,timeLastExplain)} 907838464
 set {profile(Bell Laboratories Library Network,timeLastInit)} 907838464
 set {profile(Bell Laboratories Library Network,welcomeMessage)} {Salutations - this is Lucent Technologies experimental Z39.50 server. No guarentees, but free and unlimited access!}
-set {profile(Bell Laboratories Library Network,windowNumber)} 14
+set {profile(Bell Laboratories Library Network,windowNumber)} 22
 set {profile(Bibliothèque Nationale du Québec,authentication)} {}
 set {profile(Bibliothèque Nationale du Québec,comstack)} tcpip
 set {profile(Bibliothèque Nationale du Québec,databases)} IRIS
@@ -113,7 +144,34 @@ set {profile(Biblioth
 set {profile(Bibliothèque Nationale du Québec,timeLastExplain)} {}
 set {profile(Bibliothèque Nationale du Québec,timeLastInit)} 887288466
 set {profile(Bibliothèque Nationale du Québec,welcomeMessage)} {}
-set {profile(Bibliothèque Nationale du Québec,windowNumber)} 9
+set {profile(Bibliothèque Nationale du Québec,windowNumber)} 11
+set {profile(British Library ,authentication)} {}
+set {profile(British Library ,comstack)} tcpip
+set {profile(British Library ,description)} {}
+set {profile(British Library ,host)} z3950.bl.uk
+set {profile(British Library ,idAuthentication)} {}
+set {profile(British Library ,largeSetLowerBound)} 2
+set {profile(British Library ,maxResultSets)} {}
+set {profile(British Library ,maxResultSize)} {}
+set {profile(British Library ,maxTerms)} {}
+set {profile(British Library ,maximumRecordSize)} 50000
+set {profile(British Library ,mediumSetPresentNumber)} 0
+set {profile(British Library ,multipleDatabases)} 0
+set {profile(British Library ,namedResultSets)} 1
+set {profile(British Library ,port)} 2020
+set {profile(British Library ,preferredMessageSize)} 30000
+set {profile(British Library ,presentChunk)} 4
+set {profile(British Library ,protocol)} Z39
+set {profile(British Library ,queryCCL)} 0
+set {profile(British Library ,queryRPN)} 1
+set {profile(British Library ,recentNews)} {}
+set {profile(British Library ,smallSetUpperBound)} 0
+set {profile(British Library ,targetInfoName)} {}
+set {profile(British Library ,timeDefine)} {}
+set {profile(British Library ,timeLastExplain)} {}
+set {profile(British Library ,timeLastInit)} {}
+set {profile(British Library ,welcomeMessage)} {}
+set {profile(British Library ,windowNumber)} 15
 set {profile(British Library:,authentication)} {}
 set {profile(British Library:,comstack)} tcpip
 set {profile(British Library:,description)} {}
@@ -146,7 +204,7 @@ set {profile(British Library:,welcomeMessage)} {}
 set {profile(British Library:,windowNumber)} 4
 set profile(DanBib,authentication) {}
 set profile(DanBib,comstack) tcpip
-set profile(DanBib,databases) DANBIBV2
+set profile(DanBib,databases) danbib
 set profile(DanBib,description) {Danish Union Catalogue}
 set profile(DanBib,host) ir.dbc.bib.dk
 set profile(DanBib,idAuthentication) {}
@@ -158,7 +216,7 @@ set profile(DanBib,maximumRecordSize) 50000
 set profile(DanBib,mediumSetPresentNumber) 0
 set profile(DanBib,multipleDatabases) 0
 set profile(DanBib,namedResultSets) 1
-set profile(DanBib,port) 2100
+set profile(DanBib,port) 210
 set profile(DanBib,preferredMessageSize) 30000
 set profile(DanBib,presentChunk) 4
 set profile(DanBib,protocol) Z39
@@ -169,9 +227,38 @@ set profile(DanBib,smallSetUpperBound) 0
 set profile(DanBib,targetInfoName) {}
 set profile(DanBib,timeDefine) 878567355
 set profile(DanBib,timeLastExplain) {}
-set profile(DanBib,timeLastInit) 887289885
+set profile(DanBib,timeLastInit) 921070893
 set profile(DanBib,welcomeMessage) {}
-set profile(DanBib,windowNumber) 6
+set profile(DanBib,windowNumber) 7
+set {profile(Danbib V2,authentication)} {}
+set {profile(Danbib V2,comstack)} tcpip
+set {profile(Danbib V2,databases)} danbibv2
+set {profile(Danbib V2,description)} {}
+set {profile(Danbib V2,host)} z3950.dbc.dk
+set {profile(Danbib V2,idAuthentication)} {}
+set {profile(Danbib V2,largeSetLowerBound)} 2
+set {profile(Danbib V2,maxResultSets)} {}
+set {profile(Danbib V2,maxResultSize)} {}
+set {profile(Danbib V2,maxTerms)} {}
+set {profile(Danbib V2,maximumRecordSize)} 50000
+set {profile(Danbib V2,mediumSetPresentNumber)} 0
+set {profile(Danbib V2,multipleDatabases)} 0
+set {profile(Danbib V2,namedResultSets)} 1
+set {profile(Danbib V2,port)} 210
+set {profile(Danbib V2,preferredMessageSize)} 30000
+set {profile(Danbib V2,presentChunk)} 4
+set {profile(Danbib V2,protocol)} Z39
+set {profile(Danbib V2,queryButtons,gils)} {{I 3} {I 0} {I 9}}
+set {profile(Danbib V2,queryCCL)} 0
+set {profile(Danbib V2,queryRPN)} 1
+set {profile(Danbib V2,recentNews)} {}
+set {profile(Danbib V2,smallSetUpperBound)} 0
+set {profile(Danbib V2,targetInfoName)} {}
+set {profile(Danbib V2,timeDefine)} {}
+set {profile(Danbib V2,timeLastExplain)} {}
+set {profile(Danbib V2,timeLastInit)} 921161232
+set {profile(Danbib V2,welcomeMessage)} {}
+set {profile(Danbib V2,windowNumber)} 21
 set profile(Default,authentication) {}
 set profile(Default,comstack) tcpip
 set profile(Default,description) {}
@@ -197,7 +284,7 @@ set profile(Default,timeDefine) {}
 set profile(Default,timeLastExplain) {}
 set profile(Default,timeLastInit) {}
 set profile(Default,welcomeMessage) {}
-set profile(Default,windowNumber) 18
+set profile(Default,windowNumber) 26
 set profile(LOC,authentication) {}
 set profile(LOC,comstack) tcpip
 set profile(LOC,databases) {BOOKS NAMES AUTH MAPS MUSIC BIB SERIALS SUBJECTS}
@@ -216,6 +303,7 @@ set profile(LOC,port) 2210
 set profile(LOC,preferredMessageSize) 16384
 set profile(LOC,presentChunk) 4
 set profile(LOC,protocol) Z39
+set profile(LOC,queryButtons,gils) {{I 3} {I 0} {I 0} {I 9}}
 set profile(LOC,queryCCL) 0
 set profile(LOC,queryRPN) 1
 set profile(LOC,recentNews) {}
@@ -226,9 +314,9 @@ set profile(LOC,targetMaxResultSize) {}
 set profile(LOC,targetMaxTerms) {}
 set profile(LOC,timeDefine) 878567355
 set profile(LOC,timeLastExplain) {}
-set profile(LOC,timeLastInit) 907942726
+set profile(LOC,timeLastInit) 921242271
 set profile(LOC,welcomeMessage) {}
-set profile(LOC,windowNumber) 11
+set profile(LOC,windowNumber) 14
 set {profile(OCLC FirstSearch,authentication)} {}
 set {profile(OCLC FirstSearch,comstack)} tcpip
 set {profile(OCLC FirstSearch,databases)} {AGRICOLA MEDLINE}
@@ -247,6 +335,7 @@ set {profile(OCLC FirstSearch,port)} 210
 set {profile(OCLC FirstSearch,preferredMessageSize)} 30000
 set {profile(OCLC FirstSearch,presentChunk)} 4
 set {profile(OCLC FirstSearch,protocol)} Z39
+set {profile(OCLC FirstSearch,queryButtons,AGRICOLA)} {{I 3} {I 0} {I 9} {I 10}}
 set {profile(OCLC FirstSearch,queryCCL)} 0
 set {profile(OCLC FirstSearch,queryRPN)} 1
 set {profile(OCLC FirstSearch,recentNews)} {}
@@ -257,9 +346,9 @@ set {profile(OCLC FirstSearch,targetMaxResultSize)} {}
 set {profile(OCLC FirstSearch,targetMaxTerms)} {}
 set {profile(OCLC FirstSearch,timeDefine)} {}
 set {profile(OCLC FirstSearch,timeLastExplain)} {}
-set {profile(OCLC FirstSearch,timeLastInit)} 907164654
+set {profile(OCLC FirstSearch,timeLastInit)} 921243170
 set {profile(OCLC FirstSearch,welcomeMessage)} {}
-set {profile(OCLC FirstSearch,windowNumber)} 12
+set {profile(OCLC FirstSearch,windowNumber)} 19
 set profile(Penn,authentication) {}
 set profile(Penn,comstack) tcpip
 set profile(Penn,databases) CATALOG
@@ -290,7 +379,7 @@ set profile(Penn,timeDefine) 878567355
 set profile(Penn,timeLastExplain) {}
 set profile(Penn,timeLastInit) 902483000
 set profile(Penn,welcomeMessage) {}
-set profile(Penn,windowNumber) 17
+set profile(Penn,windowNumber) 25
 set {profile(Steiermrkische Landesbibliothek,authentication)} {}
 set {profile(Steiermrkische Landesbibliothek,comstack)} tcpip
 set {profile(Steiermrkische Landesbibliothek,databases)} {lbopac miopac}
@@ -319,9 +408,36 @@ set {profile(Steiermrkische Landesbibliothek,targetMaxResultSize)} {}
 set {profile(Steiermrkische Landesbibliothek,targetMaxTerms)} {}
 set {profile(Steiermrkische Landesbibliothek,timeDefine)} {}
 set {profile(Steiermrkische Landesbibliothek,timeLastExplain)} 893840781
-set {profile(Steiermrkische Landesbibliothek,timeLastInit)} {}
+set {profile(Steiermrkische Landesbibliothek,timeLastInit)} 921596910
 set {profile(Steiermrkische Landesbibliothek,welcomeMessage)} {}
-set {profile(Steiermrkische Landesbibliothek,windowNumber)} 2
+set {profile(Steiermrkische Landesbibliothek,windowNumber)} 3
+set profile(Steiermrkische,authentication) {}
+set profile(Steiermrkische,comstack) tcpip
+set profile(Steiermrkische,description) {}
+set profile(Steiermrkische,host) one.stmk.gv.at
+set profile(Steiermrkische,idAuthentication) {}
+set profile(Steiermrkische,largeSetLowerBound) 2
+set profile(Steiermrkische,maxResultSets) {}
+set profile(Steiermrkische,maxResultSize) {}
+set profile(Steiermrkische,maxTerms) {}
+set profile(Steiermrkische,maximumRecordSize) 50000
+set profile(Steiermrkische,mediumSetPresentNumber) 0
+set profile(Steiermrkische,multipleDatabases) 0
+set profile(Steiermrkische,namedResultSets) 1
+set profile(Steiermrkische,port) 2100
+set profile(Steiermrkische,preferredMessageSize) 30000
+set profile(Steiermrkische,presentChunk) 4
+set profile(Steiermrkische,protocol) Z39
+set profile(Steiermrkische,queryCCL) 0
+set profile(Steiermrkische,queryRPN) 1
+set profile(Steiermrkische,recentNews) {}
+set profile(Steiermrkische,smallSetUpperBound) 0
+set profile(Steiermrkische,targetInfoName) {}
+set profile(Steiermrkische,timeDefine) {}
+set profile(Steiermrkische,timeLastExplain) {}
+set profile(Steiermrkische,timeLastInit) 901511630
+set profile(Steiermrkische,welcomeMessage) {}
+set profile(Steiermrkische,windowNumber) 17
 set {profile(University of Crete,authentication)} {}
 set {profile(University of Crete,comstack)} tcpip
 set {profile(University of Crete,databases)} ptolemeos_ii
@@ -349,7 +465,7 @@ set {profile(University of Crete,timeDefine)} {}
 set {profile(University of Crete,timeLastExplain)} {}
 set {profile(University of Crete,timeLastInit)} 907077673
 set {profile(University of Crete,welcomeMessage)} {}
-set {profile(University of Crete,windowNumber)} 5
+set {profile(University of Crete,windowNumber)} 6
 set {profile(Z39.50 Implementors Workshop mailing list,authentication)} {}
 set {profile(Z39.50 Implementors Workshop mailing list,comstack)} tcpip
 set {profile(Z39.50 Implementors Workshop mailing list,databases)} ziw
@@ -377,7 +493,7 @@ set {profile(Z39.50 Implementors Workshop mailing list,timeDefine)} {}
 set {profile(Z39.50 Implementors Workshop mailing list,timeLastExplain)} {}
 set {profile(Z39.50 Implementors Workshop mailing list,timeLastInit)} {}
 set {profile(Z39.50 Implementors Workshop mailing list,welcomeMessage)} {}
-set {profile(Z39.50 Implementors Workshop mailing list,windowNumber)} 13
+set {profile(Z39.50 Implementors Workshop mailing list,windowNumber)} 20
 set profile(arcatarget,authentication) {}
 set profile(arcatarget,comstack) tcpip
 set profile(arcatarget,databases) {IEI-books IR-Explain-1}
@@ -408,7 +524,7 @@ set profile(arcatarget,timeDefine) 878567355
 set profile(arcatarget,timeLastExplain) 887289477
 set profile(arcatarget,timeLastInit) 887289477
 set profile(arcatarget,welcomeMessage) {buon lavoro}
-set profile(arcatarget,windowNumber) 10
+set profile(arcatarget,windowNumber) 12
 set profile(author,authentication) {}
 set profile(author,comstack) tcpip
 set profile(author,databases) {spain portugal france england belgium}
@@ -436,7 +552,7 @@ set profile(author,timeDefine) 878567355
 set profile(author,timeLastExplain) {}
 set profile(author,timeLastInit) 887288138
 set profile(author,welcomeMessage) {}
-set profile(author,windowNumber) 16
+set profile(author,windowNumber) 24
 set profile(dranet,authentication) {}
 set profile(dranet,comstack) tcpip
 set profile(dranet,databases) drewdb
@@ -465,9 +581,9 @@ set profile(dranet,targetMaxResultSize) {}
 set profile(dranet,targetMaxTerms) {}
 set profile(dranet,timeDefine) 878567355
 set profile(dranet,timeLastExplain) {}
-set profile(dranet,timeLastInit) 887289573
+set profile(dranet,timeLastInit) 921243760
 set profile(dranet,welcomeMessage) {}
-set profile(dranet,windowNumber) 8
+set profile(dranet,windowNumber) 10
 set profile(libris,authentication) {}
 set profile(libris,comstack) tcpip
 set profile(libris,databases) libr
@@ -490,10 +606,133 @@ set profile(libris,queryRPN) 1
 set profile(libris,recentNews) {}
 set profile(libris,smallSetUpperBound) 0
 set profile(libris,targetInfoName) {}
-set profile(libris,windowNumber) 7
+set profile(libris,timeDefine) 878567355
+set profile(libris,timeLastExplain) {}
+set profile(libris,timeLastInit) 887285394
+set profile(libris,welcomeMessage) {}
+set profile(libris,windowNumber) 9
+set profile(madison,authentication) {}
+set profile(madison,comstack) tcpip
+set profile(madison,databases) madison
+set profile(madison,description) {University of Wisconsin-Madison}
+set profile(madison,host) z3950.adp.wisc.edu
+set profile(madison,idAuthentication) {}
+set profile(madison,largeSetLowerBound) 2
+set profile(madison,maxResultSets) {}
+set profile(madison,maxResultSize) {}
+set profile(madison,maxTerms) {}
+set profile(madison,maximumRecordSize) 16384
+set profile(madison,mediumSetPresentNumber) 0
+set profile(madison,multipleDatabases) 0
+set profile(madison,namedResultSets) 1
+set profile(madison,port) 210
+set profile(madison,preferredMessageSize) 8192
+set profile(madison,presentChunk) 4
+set profile(madison,protocol) Z39
+set profile(madison,queryButtons,madison) {{I 3} {I 0} {I 10}}
+set profile(madison,queryCCL) 0
+set profile(madison,queryRPN) 1
+set profile(madison,recentNews) {}
+set profile(madison,smallSetUpperBound) 0
+set profile(madison,targetInfoName) {University of Wisconsin, Madison}
+set profile(madison,targetMaxResultSets) {}
+set profile(madison,targetMaxResultSize) {}
+set profile(madison,targetMaxTerms) {}
+set profile(madison,timeDefine) 878567355
+set profile(madison,timeLastExplain) {}
+set profile(madison,timeLastInit) 921244129
+set profile(madison,welcomeMessage) {}
+set profile(madison,windowNumber) 13
+set profile(pica,authentication) {}
+set profile(pica,comstack) tcpip
+set profile(pica,databases) {IR-Explain-1 NCC-IBL OLC}
+set profile(pica,description) {}
+set profile(pica,host) tolk.pica.nl
+set profile(pica,idAuthentication) {}
+set profile(pica,largeSetLowerBound) 2
+set profile(pica,maxResultSets) 99
+set profile(pica,maxResultSize) 9999
+set profile(pica,maxTerms) 10
+set profile(pica,maximumRecordSize) 50000
+set profile(pica,mediumSetPresentNumber) 0
+set profile(pica,multipleDatabases) 0
+set profile(pica,namedResultSets) 1
+set profile(pica,port) 210
+set profile(pica,preferredMessageSize) 30000
+set profile(pica,presentChunk) 4
+set profile(pica,protocol) Z39
+set profile(pica,queryCCL) 0
+set profile(pica,queryRPN) 1
+set profile(pica,recentNews) {strings { language {text {Geen nieuws.}} } { language {text {}} } }
+set profile(pica,smallSetUpperBound) 0
+set profile(pica,targetInfoName) Tolk2
+set profile(pica,timeDefine) {}
+set profile(pica,timeLastExplain) 893841938
+set profile(pica,timeLastInit) 897485351
+set profile(pica,welcomeMessage) {Welkom bij Pica!}
+set profile(pica,windowNumber) 1
+set profile(zno,authentication) {}
+set profile(zno,comstack) tcpip
+set profile(zno,databases) Default
+set profile(zno,description) {}
+set profile(zno,host) sino.dtv.dk
+set profile(zno,idAuthentication) {}
+set profile(zno,largeSetLowerBound) 2
+set profile(zno,maxResultSets) {}
+set profile(zno,maxResultSize) {}
+set profile(zno,maxTerms) {}
+set profile(zno,maximumRecordSize) 50000
+set profile(zno,mediumSetPresentNumber) 0
+set profile(zno,multipleDatabases) 0
+set profile(zno,namedResultSets) 1
+set profile(zno,port) 9999
+set profile(zno,preferredMessageSize) 30000
+set profile(zno,presentChunk) 4
+set profile(zno,protocol) Z39
+set profile(zno,queryCCL) 0
+set profile(zno,queryRPN) 1
+set profile(zno,recentNews) {}
+set profile(zno,smallSetUpperBound) 0
+set profile(zno,targetInfoName) {}
+set profile(zno,timeDefine) {}
+set profile(zno,timeLastExplain) {}
+set profile(zno,timeLastInit) 891593773
+set profile(zno,welcomeMessage) {}
+set profile(zno,windowNumber) 16
+set profile(ztest9999,authentication) {}
+set profile(ztest9999,comstack) tcpip
+set profile(ztest9999,databases) {Default IR-Explain-1}
+set profile(ztest9999,description) {YAZ server on localhost}
+set profile(ztest9999,descripton) {This target is not a target with real bibliographic record - it just illustrates how Explain data might look like.}
+set profile(ztest9999,host) localhost
+set profile(ztest9999,idAuthentication) {}
+set profile(ztest9999,largeSetLowerBound) 2
+set profile(ztest9999,maxResultSets) {}
+set profile(ztest9999,maxResultSize) {}
+set profile(ztest9999,maxTerms) {}
+set profile(ztest9999,maximumRecordSize) 50000
+set profile(ztest9999,mediumSetPresentNumber) 0
+set profile(ztest9999,multipleDatabases) 1
+set profile(ztest9999,namedResultSets) 1
+set profile(ztest9999,port) 9999
+set profile(ztest9999,preferredMessageSize) 30000
+set profile(ztest9999,presentChunk) 4
+set profile(ztest9999,protocol) Z39
+set profile(ztest9999,queryCCL) 0
+set profile(ztest9999,queryRPN) 1
+set profile(ztest9999,recentNews) {}
+set profile(ztest9999,smallSetUpperBound) 0
+set profile(ztest9999,targetInfoName) Zebra
+set profile(ztest9999,timeDefine) 878567355
+set profile(ztest9999,timeLastExplain) 897392133
+set profile(ztest9999,timeLastInit) 897392253
+set profile(ztest9999,welcomeMessage) {}
+set profile(ztest9999,windowNumber) 18
 set attributeTypes {Bib1 Gils}
-set attributeTypeSelected Gils
-set queryTypes {Simple Phrase Auto}
-set queryButtons {{{I 3} {I 0} {I 0}} {{I 0} {I 1} {I 0}} {{I 4} {I 5} {I 3}}}
-set queryInfo {{{Title {1=4}} {Author {1=1}} {Subject {1=21}} {Any {1=1016}} {Query 1=1016 2=102} {Title-rank 1=4 2=102} {Date/time 1=1012} {Title-regular 1=4 2=3 4=2 5=102} {Ranked 1=1016 2=102 3=3 4=1 6=1} {per {}}} {{Title 1=4 4=1 6=2} {Author 1=1003 4=1 6=2} {ISBN 1=7} {ISSN 1=8} {Year 1=30 4=4 6=2} {Any {}}} {{{Date/time last mod.} 1=1012} {Record-source 1=1019} {Identifier--standard 1=1007} {Abstract 1=62} {{Author, corporate} 1=1005} {Title 1=4}}}
-set queryAuto 1
+set attributeTypeSelected Bib1
+set queryTypes {Simple phrase Auto}
+set queryButtonsBib1 {{{I 3} {I 0} {I 10}} {{I 0} {I 1} {I 0}} {{I 3} {I 0} {I 9} {I 1}}}
+set queryInfoBib1 {{{Title {1=4}} {Author {1=1}} {Subject {1=21}} {Any {1=1016}} {Query 1=1016 2=102} {Title-rank 1=4 2=102} {Date/time 1=1012} {Title-regular 1=4 2=3 4=2 5=102} {Ranked 1=1016 2=102 3=3 4=1 6=1} {ISBN 1=7 5=1} {Publisher 1=1018}} {{Title 1=4 4=1 6=2} {Author 1=1003 4=1 6=2} {ISBN 1=7} {ISSN 1=8} {Year 1=30 4=4 6=2} {Any {1=1016}}} {{{Date/time last mod.} 1=1012} {Record-source 1=1019} {Identifier--standard 1=1007} {Abstract 1=62} {{Author, corporate} 1=1005} {Title 1=4}}}
+set queryButtonsGils {{{I 3} {I 0} {I 9}} {{I 0} {I 1} {I 0}} {{I 5} {I 3} {I 4}}}
+set queryInfoGils {{{Title {1=4}} {Author {1=1}} {Subject {1=21}} {Any {1=1016}} {Query 1=1016 2=102} {Title-rank 1=4 2=102} {Date/time 1=1012} {Title-regular 1=4 2=3 4=2 5=102} {Ranked 1=1016 2=102 3=3 4=1 6=1} {ISBN 1=7}} {{Title 1=4 4=1 6=2} {Author 1=1003 4=1 6=2} {ISBN 1=7} {ISSN 1=8} {Year 1=30 4=4 6=2} {Any {1=1016}}} {{{Date/time last mod.} 1=1012} {Record-source 1=1019} {Identifier--standard 1=1007} {Abstract 1=62} {{Author, corporate} 1=1005} {Title 1=4} {{Contact Telephone*} 1=2032} {{Contact Country*} 1=2029} {{Point of Contact*} 1=2067} {{Contact City*} 1=2026} {{Contact Street Address*} 1=2025} {{Contact Organization*} 1=2024} {{Contact Name*} 1=2023} {{Use Constraints*} 1=2005} {{Access Constraints*} 1=2066} {{Technical Prerequisites*} 1=2018} {{Resource Description*} 1=2016} {{Distributor Telephone*} 1=2014} {{Distributor Country*} 1=2011} {Distributor* 1=2000} {{Distributor City*} 1=2008} {{Distributor Street Address*} 1=2007} {{Distributor Organization*} 1=2006} {{Time Period Textual*} 1=2045} {{South Bounding Coordinate*} 1=2041} {{North Bounding Coordinate*} 1=2040} {{East Bounding Coordinate*} 1=2039} {{West Bounding Coordinate*} 1=2038} {{Spatial Domain*} 1=2059}}}
+set queryAuto 0