This file is indexed.

/usr/lib/xpbsmon/pref.tk is in torque-client-x11 2.4.16+dfsg-1.3ubuntu1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
#         OpenPBS (Portable Batch System) v2.3 Software License
# 
# Copyright (c) 1999-2000 Veridian Information Solutions, Inc.
# All rights reserved.
# 
# ---------------------------------------------------------------------------
# For a license to use or redistribute the OpenPBS software under conditions
# other than those described below, or to purchase support for this software,
# please contact Veridian Systems, PBS Products Department ("Licensor") at:
# 
#    www.OpenPBS.org  +1 650 967-4675                  sales@OpenPBS.org
#                        877 902-4PBS (US toll-free)
# ---------------------------------------------------------------------------
# 
# This license covers use of the OpenPBS v2.3 software (the "Software") at
# your site or location, and, for certain users, redistribution of the
# Software to other sites and locations.  Use and redistribution of
# OpenPBS v2.3 in source and binary forms, with or without modification,
# are permitted provided that all of the following conditions are met.
# After December 31, 2001, only conditions 3-6 must be met:
# 
# 1. Commercial and/or non-commercial use of the Software is permitted
#    provided a current software registration is on file at www.OpenPBS.org.
#    If use of this software contributes to a publication, product, or
#    service, proper attribution must be given; see www.OpenPBS.org/credit.html
# 
# 2. Redistribution in any form is only permitted for non-commercial,
#    non-profit purposes.  There can be no charge for the Software or any
#    software incorporating the Software.  Further, there can be no
#    expectation of revenue generated as a consequence of redistributing
#    the Software.
# 
# 3. Any Redistribution of source code must retain the above copyright notice
#    and the acknowledgment contained in paragraph 6, this list of conditions
#    and the disclaimer contained in paragraph 7.
# 
# 4. Any Redistribution in binary form must reproduce the above copyright
#    notice and the acknowledgment contained in paragraph 6, this list of
#    conditions and the disclaimer contained in paragraph 7 in the
#    documentation and/or other materials provided with the distribution.
# 
# 5. Redistributions in any form must be accompanied by information on how to
#    obtain complete source code for the OpenPBS software and any
#    modifications and/or additions to the OpenPBS software.  The source code
#    must either be included in the distribution or be available for no more
#    than the cost of distribution plus a nominal fee, and all modifications
#    and additions to the Software must be freely redistributable by any party
#    (including Licensor) without restriction.
# 
# 6. All advertising materials mentioning features or use of the Software must
#    display the following acknowledgment:
# 
#     "This product includes software developed by NASA Ames Research Center,
#     Lawrence Livermore National Laboratory, and Veridian Information
#     Solutions, Inc.
#     Visit www.OpenPBS.org for OpenPBS software support,
#     products, and information."
# 
# 7. DISCLAIMER OF WARRANTY
# 
# THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND. ANY EXPRESS
# OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT
# ARE EXPRESSLY DISCLAIMED.
# 
# IN NO EVENT SHALL VERIDIAN CORPORATION, ITS AFFILIATED COMPANIES, OR THE
# U.S. GOVERNMENT OR ANY OF ITS AGENCIES BE LIABLE FOR ANY DIRECT OR INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
# OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
# EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# 
# This license will be governed by the laws of the Commonwealth of Virginia,
# without reference to its choice of law rules.
################################################################################
# pref: defines the layout and functions of the user preferences
#       dialog box.
proc pref {callerDialogBox focusBox} {
  global prefDialogBox activeWindow dialog sysinfo

  set sysinfo(PREFLCK) 1

  busy_cursor
## Bring up the standard Dialog box ##
  set dialog(prefDialogBox) ".pref"
  set dbox [popupDialogBox $dialog(prefDialogBox) "User Preferences Dialog"]
  set activeWindow($dialog(prefDialogBox)) 1
  set dbox_top    [lindex $dbox 0]
  set dbox_bottom [lindex $dbox 1]


## TOP PART ##
  box $dbox_top.box1 -title "Sites Preference" \
	-entrylabels \
        [list [list "Site Name" "" ""] [list "View" MENU_ENTRY "ICON" "FULL"]] \
        -lboxlabels [list "Sites" "View"] -lboxwidths [list 19 4] \
	-lboxheights [list 10 10] \
	-remCmd "siteDelete \[boxGetCurselect $dbox_top.box1 0\]" \
 	-addCmd "siteAdd \[cleanstr \[box $dbox_top.box1 entryval 0\]\] $dbox_top.box1" \
	-grabBox $dialog(prefDialogBox) -noUpdateButton 1

  box $dbox_top.box2 -title ""  \
	-entrylabels [list "Server_Host" "DisplayLabel"] \
        -lboxlabels [list "Servers" "DisplayLabel"] -lboxwidths [list 15 10] \
	-lboxheights [list 10 10] -orient x -key 0 \
	-addCmd "serversPut $dbox_top.box2 \[boxGetCurselect $dbox_top.box1 0\]" \
	-remCmd "serverDelete \[boxGetCurselect $dbox_top.box1 0\],\[boxGetCurselect $dbox_top.box2 0\]" \
	-grabBox $dialog(prefDialogBox)

  set lbox1 [box $dbox_top.box1 lbox 0]
  set_listbox_cmd [box $dbox_top.box1 lbox 0] \
	"serversGet $dbox_top.box2 \[boxGetCurselect $dbox_top.box1 0\]"
  set updButton [box $dbox_top.box2 updateButton]

  $updButton configure -text "nodes.." -command \
   "prefServer \[boxGetCurselect $dbox_top.box1 0\] \[boxGetCurselect $dbox_top.box2 0\] $dialog(prefDialogBox) \[box $dbox_top.box2 entry 0\]"

## BOTTOM PART ##
  set cmdButtons \
  [buildCmdButtons $dbox_bottom {{{ok1 "done\nredisplay view"} {ok2 "done\ndon't redisplay view"} {help help}}} x 2m 21 3]

  set cmdFrame  [lindex $cmdButtons 0]
  set cmdOk1     [lindex $cmdButtons 1]
  set cmdOk2     [lindex $cmdButtons 2]
  set cmdHelp   [lindex $cmdButtons 3]

  $cmdOk1 configure -command "sitesPut $dbox_top.box1; prefComplete1 $dialog(prefDialogBox)"
  $cmdOk2 configure -command "sitesPut $dbox_top.box1; prefComplete2 $dialog(prefDialogBox)"

  $cmdHelp configure -command {xpbs_help pref $dialog(prefDialogBox)}


  pack $dbox_top.box1 $dbox_top.box2 -side top -anchor nw -fill both -expand 1
  tkwait visibility $dialog(prefDialogBox)
  sitesGet $dbox_top.box1
  remove_busy_cursor
  catch {tkwait window $dialog(prefDialogBox)}
  boxesUnset
  set activeWindow($dialog(prefDialogBox)) 0
  catch {grab $callerDialogBox}
  catch {focus $focusBox}

  set sysinfo(PREFLCK) 0
}

proc prefComplete1 {callerDialogBox} {
  global sysinfo

  destroy $callerDialogBox
  catch {$sysinfo(sysMenuButton) invoke $sysinfo(systemName)}
}

proc prefComplete2 {callerDialogBox} {
  global sysinfo

  destroy $callerDialogBox
}

proc siteNamesGet {} {
	global sysview

	set sites ""
	foreach s [array names sysview] {
		if {[lsearch -exact $sites $s] == -1} {
			lappend sites $s
		}
	}
	return $sites
}

proc siteNamesPrint {} {

	puts "Site Names:=================="
  	foreach s [siteNamesGet] {
		puts $s
	}
}

proc siteAdd {siteName boxframe} {
	global sysview

	set sysview($siteName) [box $boxframe entryval 1]
}

proc siteDelete {{siteName ""}} {
	global sysinfo sysview

        if { [string compare $siteName ""] == 0 } {
                return
        }

	catch {unset sysview($siteName)}
	catch {$sysinfo(sysMenuButton) delete $siteName}

        if {[string compare $sysinfo(systemName) $siteName] == 0} {
                systemDelete $sysinfo(systemFrame)
                set sysinfo(systemName) ""
                set sysinfo(systemFrame) ""
        }

}

proc serverDelete {serverid} {

	global sysnodes

	catch {unset sysnodes($serverid)}
}

# queryTableGet: get the query string for nodename of given 'type'.
proc queryTableGet {sitename nodename type} {
        global queryTable
        if { ![info exists queryTable($sitename,$nodename)] } {
                return ""
        }
        foreach q $queryTable($sitename,$nodename) {
                set query  [lindex $q 0]
                set t [lindex $q 2]
                if {[string compare $t $type] == 0} {
                        return $query
                }
        }
        return ""
}

proc queryTableDelete {nodeid} {
	global queryTable

	catch {unset queryTable($nodeid)}
}

proc queryTableSave {sitename boxframe} {
	global queryTable

	set host [box $boxframe title]
	set nrows [box $boxframe nrows]

	set qexprBox [box $boxframe lbox 0]
	set labelBox [box $boxframe lbox 1]
	set typeBox [box $boxframe lbox 2]

	catch {unset queryTable($sitename,$host)}
	for {set i 0} {$i < $nrows} {incr i} {
		set line ""
		lappend line [queryExprCreate "[$qexprBox get $i]"]
		lappend line [$labelBox get $i]
		lappend line [$typeBox get $i]

		lappend queryTable($sitename,$host) $line
	}
}

proc queryTableLoad {sitename boxframe} {
	global queryTable

	set host [box $boxframe title]

	if {![info exists queryTable($sitename,$host)]} {
		return
	}

	set qexprBox [box $boxframe lbox 0]
	set labelBox [box $boxframe lbox 1]
	set typeBox [box $boxframe lbox 2]

	$qexprBox delete 0 end
	$labelBox delete 0 end
	$typeBox delete 0 end

	foreach line $queryTable($sitename,$host) {
		set qexpr [lindex $line 0]
		set label [lindex $line 1]
		set type  [lindex $line 2]

		$qexprBox insert end $qexpr
		$labelBox insert end $label
		$typeBox insert end $type
		box $boxframe -nrows +1
    	}
  	boxSelect $boxframe 0
}

proc queryTablePrint {sitename} {
	global queryTable

	foreach h [array names queryTable] {
		set h_list [split $h ","]
		set sname [lindex $h_list 0]
		if {[string compare $sname $sitename] == 0} {
			puts "queryTable($h):================================="
			puts "=============== $queryTable($h)"
		}
	}
}

proc sitesGet {boxframe} {
  global sysview

  set box [box $boxframe entry 0]
  $box delete 0 end
  foreach s [siteNamesGet] {
	box $boxframe -entryval 0 $s
	box $boxframe -entryval 1 $sysview($s)
	boxAdd $boxframe
  }
}


proc sitesPut {boxframe} {
  global sysinfo canvas sysview

  set nrows [box $boxframe nrows]
  set siteBox [box $boxframe lbox 0]
  for {set i 0} {$i < $nrows} {incr i} {
    set sitename [$siteBox get $i]
    if [catch {$sysinfo(sysMenuButton) index $sitename}] {
    	$sysinfo(sysMenuButton) add radio -label $sitename \
	-variable sysinfo(systemName) \
	-value $sitename \
 	-command "displayView $sysinfo(main_frame) $sitename"

    }
  }
}

proc serverNamesGet {siteName} {
        global sysnodes

        set servers ""
        foreach s [array names sysnodes] {
                set s_list [split $s ","]
                set sname [lindex $s_list 0]
                set hname [lindex $s_list 1]
                if {[string compare $sname $siteName] == 0} {
                        lappend servers $hname
                }
        }
        return $servers
}

proc statNodes {server_name sysframe} {

	set nlist ""

        catch {pbsconnect $server_name} fd
        InfoBox_sendmsg "statNodes: pbsconnect($server_name): $fd" end
        if { $fd >= 0 } {
                catch {pbsstatnode} ninfo
                InfoBox_sendmsg "statNodes: pbsstatnode($server_name): " end

		foreach n $ninfo {
			set nname [lindex $n 0]
                        set attribl [lindex $n 1]

			foreach na $attribl {
				set attn [lindex $na 0]
				set attv [lindex $na 1]

				switch -exact -- $attn {
				  state	{
					nodeUpdateStat $sysframe $nname $attv
				  }
				  properties {
					set props ""
					lappend props $attv
					set line [list "$props" "Properties: " \
									  TEXT]
					systemNodeInfo2Append $sysframe $nname \
									  $line
				  }
				  np {
					set props ""
					lappend props $attv
					set line [list $props "Virtual PROCessors: " \
									  TEXT]
					systemNodeInfo2Append $sysframe $nname \
									  $line
				  }
				  ntype {
					set props ""
					lappend props $attv
					set line [list $props "NType: " \
									  TEXT]
					systemNodeInfo2Append $sysframe $nname \
									  $line
				  }
				  status {
					set props ""
					lappend props $attv
					set line [list $props "Status: " \
									  TEXT]
					systemNodeInfo2Append $sysframe $nname \
									  $line
				  }
				}
			}
			lappend nlist "$nname NOMOM_SNODE"
			systemNodeTypePut $sysframe $nname NOMOM_SNODE
		}

                catch {pbsdisconnect}
        	InfoBox_sendmsg "pbsdisconnect($server_name)" end
        }
	return $nlist
}

proc statNodesStateMap {state} {

	set stat [lindex [split $state ,] 0] 

	switch -exact -- $stat {
		FREE		-
		free		{ return FREE }
		OFFLINE		-	
		offline		{ return OFFLINE }
		DOWN		-
		down		{ return DOWN }
		RESERVED	-
		reserve		{ return RESERVED }
		INUSE-EXCLUSIVE	-
		job-exclusive	{ return INUSE-EXCLUSIVE }
		INUSE-SHARED	-
		job-sharing	{ return INUSE-SHARED }
		NOINFO		{ return NOINFO }
		default		{ return "" }
	}
}

proc nodesListMerge {nlist1 nlist2 frame} {

	set newlist ""
	set k 0
	foreach n1 $nlist1 {
		set nname [lindex $n1 0]
		set nodes($nname) [lrange $n1 1 end]
		set order($k) $nname
		incr k
	}
	foreach n2 $nlist2 {
		set nname [lindex $n2 0]
		set ntype [lindex $n2 1]
		if [info exists nodes($nname)] {
			set oldattr "$nodes($nname)"
			for {set i 1} {$i < [llength $n2]} {incr i} {
				set attr [lindex $n2 $i]
				if {$i == 1 && \
					[string compare $attr MOM] == 0} {
					set attr MOM_SNODE
					set ntype MOM_SNODE
				}
				if { $attr != {} } {
				   set j [expr $i-1]
				   if { $j < [llength $oldattr] } {
				     set oldattr [lreplace $oldattr $j $j $attr]
				   } else  {
				     lappend oldattr $attr
				   }	
				}
			}
			set nodes($nname) $oldattr
		} else {
			set nodes($nname) [lrange $n2 1 end]
			set order($k) $nname
			incr k
		}
		systemNodeTypePut $frame $nname $ntype
	}

	if [info exists order] {
		for {set k 0} {$k < [array size order]} {incr k} {
			set n $order($k)
			lappend newlist "$n $nodes($n)"
		}
	}

	return $newlist
}

proc serverNamesSorted {systemName servers nodesp frame} {
	global sysnodes

	upvar $nodesp nodeslist
	set newservers ""

	foreach s $servers {
		set nlist1 [statNodes $s $frame]
		set nlist2  [lrange $sysnodes($systemName,$s) 1 end]
		set nodeslist($s) [nodesListMerge $nlist1 $nlist2 $frame]

		set slen($s) [llength $nodeslist($s)]

		set i 0
		foreach os $newservers {
			if {$slen($s) < $slen($os)} {
				break
			}
			incr i
		}
		set newservers [linsert $newservers $i $s]

	}
	return $newservers
}

proc siteHasServers {siteName} {

	set sites [siteNamesGet]
	if {[lsearch -exact $sites $siteName] == -1} {
		return 0
	}
	return 1
}

proc serversPut {boxframe {siteName ""}} {
        global sysnodes

	if {[string compare $siteName ""] == 0} {
		return
	}

        set nrows [box $boxframe nrows]
        set svrBox [box $boxframe lbox 0]
	set labBox [box $boxframe lbox 1]
        for {set i 0} {$i < $nrows} {incr i} {
		set svrname  [$svrBox get $i]
		set svrlabel [$labBox get $i]
		if [info exists sysnodes($siteName,$svrname)] {
			set sysnodes($siteName,$svrname) \
			  [lreplace $sysnodes($siteName,$svrname) 0 0 $svrlabel]
		} else {
			set sysnodes($siteName,$svrname) $svrlabel
		}
        }
}

proc serversGet {boxframe siteName} {
	global sysnodes

        set srvBox [box $boxframe lbox 0]
        $srvBox delete 0 end
        set srvlBox [box $boxframe lbox 1]
        $srvlBox delete 0 end
	
        box $boxframe -nrows "-[box $boxframe nrows]"

        set entBox [box $boxframe entry 0]
        $entBox delete 0 end
        set labBox [box $boxframe entry 1]
        $labBox delete 0 end
        [box $boxframe titlelabel] configure -text "Servers@$siteName"

        foreach s [array names sysnodes] {
                set s_list [split $s ","]
                set sname [lindex $s_list 0]
                set hname [lindex $s_list 1]
                if {[string compare $sname $siteName] == 0} {
			set hlabel [lindex $sysnodes($sname,$hname) 0]
               		$srvBox insert end $hname
			$srvlBox insert end $hlabel
               		box $boxframe -nrows +1
                }
        }

        boxSelect $boxframe 0
}

proc sysnodesGet {sitename boxframe} {
	global sysnodes

	set host [box $boxframe title]

	if {![info exists sysnodes($sitename,$host)]} {
		return
	}

	set nodeBox [box $boxframe lbox 0]
	set typeBox [box $boxframe lbox 1]

	$nodeBox delete 0 end

	set nnodes 0
	foreach line [lrange $sysnodes($sitename,$host) 1 end] {
		set node [lindex $line 0]
		set type  [lindex $line 1]

		$nodeBox insert end $node
		$typeBox insert end $type
		box $boxframe -nrows +1
		incr nnodes
    	}
	if {$nnodes > 0} {
		boxSelect $boxframe 0
	}
}

proc sysnodesPut {sitename serverName box} {
	global sysnodes

	if [info exists sysnodes($sitename,$serverName)] {
		set sysnodes($sitename,$serverName) \
				[lindex $sysnodes($sitename,$serverName) 0]
	} else {
		set sysnodes($sitename,$serverName) ""
	}

	set nrows [box $box nrows]
	set ncols [box $box ncols]
	for {set i 0} {$i < $nrows} {incr i} {
		set val ""
		for {set j 0} {$j < $ncols} {incr j} {
			set lbox [box $box lbox $j]
			lappend val [$lbox get $i]
		}
		lappend sysnodes($sitename,$serverName) $val
	}
}

proc sysnodesPrint {sitename} {
	global sysnodes

	foreach s [array names sysnodes] {
		set s_list [split $s ","]
		set sname [lindex $s_list 0]
		if {[string compare $sname $sitename] == 0} {
			puts "sysnodes($s): $sysnodes($s)"
		}
	}
}


proc prefServerComplete {boxframe callerDialogBox} {

	set title [box $boxframe title]	
	set nrows [box $boxframe nrows]
	if {$nrows == 0} {
	   popupInfoBox $callerDialogBox \
    	    "Server $title does not have any nodes. Please complete info!" 700 $callerDialogBox
	   return
	}

	destroy $callerDialogBox
}

proc prefServer {siteName serverName callerDialogBox focusBox} {
  global activeWindow dialog sysnodes

  if {[string compare $serverName ""] == 0} {
	popupInfoBox $callerDialogBox "Server name not selected!!" 500 \
							$callerDialogBox
	return
  }
  busy_cursor
## Bring up the standard Dialog box ##
  set dialog(prefServerDialogBox) ".prefServer"
  set dbox [popupDialogBox $dialog(prefServerDialogBox) "Server Preference Dialog"]
  set activeWindow($dialog(prefServerDialogBox)) 1
  set dbox_top    [lindex $dbox 0]
  set dbox_bottom [lindex $dbox 1]


## TOP PART ##
 box $dbox_top.box -entrylabels \
        [list "Node_Name" [list "type" MENU_ENTRY "MOM" "NOMOM"]] \
	-title "$serverName" \
	-remCmd "queryTableDelete $siteName,\[boxGetCurselect $dbox_top.box 0\]" \
        -lboxlabels [list "Nodes" "Type"] -orient x \
        -lboxwidths [list 17 5] -lboxheights [list 10 10] \
        -grabBox $dialog(prefServerDialogBox) \
	-key [list 0 1]
  box $dbox_top.box -entryval 1 MOM

  set updButton [box $dbox_top.box updateButton]
  
  $updButton configure -text "query.." -command \
   "prefQuery $siteName \[boxGetCurselect $dbox_top.box 0\] \[boxGetCurselect $dbox_top.box 1\] $dialog(prefServerDialogBox) \[box $dbox_top.box entry 0\]"

## BOTTOM PART ##
  set cmdButtons \
  [buildCmdButtons $dbox_bottom {{{ok ok} {help help}}} x 2m 18 3]

  set cmdFrame  [lindex $cmdButtons 0]
  set cmdOk     [lindex $cmdButtons 1]
  set cmdHelp   [lindex $cmdButtons 2]

  $cmdOk configure \
    -command "sysnodesPut $siteName $serverName $dbox_top.box; destroy $dialog(prefServerDialogBox)"

  $cmdHelp configure -command {xpbs_help prefServer $dialog(prefServerDialogBox)}

  pack $dbox_top.box -side bottom -fill both -expand 1
  tkwait visibility $dialog(prefServerDialogBox)
  sysnodesGet $siteName $dbox_top.box
  remove_busy_cursor
  catch {tkwait window $dialog(prefServerDialogBox)}
  set activeWindow($dialog(prefServerDialogBox)) 0
  catch {grab $callerDialogBox}
  catch {focus $focusBox}
}

proc prefQuery {siteName nodeName nodeType callerDialogBox focusBox} {
  global prefQueryDialogBox activeWindow dialog queryTable
  if {[string compare $nodeName ""] == 0} {
	popupInfoBox $callerDialogBox "Node name not selected!!" 500 \
							$callerDialogBox
	return
  }

  if {[string compare $nodeType NOMOM] == 0} {
	popupInfoBox $callerDialogBox "Can't specify queries to send to a node not running MOM!!" 500 $callerDialogBox
	return
  }

  busy_cursor
## Bring up the standard Dialog box ##
  set dialog(prefQueryDialogBox) ".prefQuery"
  set dbox [popupDialogBox $dialog(prefQueryDialogBox) "Query Table Dialog"]
  set activeWindow($dialog(prefQueryDialogBox)) 1
  set dbox_top    [lindex $dbox 0]
  set dbox_bottom [lindex $dbox 1]


## TOP PART ##

  box $dbox_top.box -title "$nodeName" \
    -entrylabels [list "Query_Expr" "Display_Info" \
     [list "Display_Type" MENU_ENTRY TEXT SCALE]] \
     -lboxlabels [list "Queries" " " " "] -lboxwidths [list 20 20 20] \
	-lboxheights [list 10 10 10] -orient y \
	-key {0} -noUpdateButton 1 \
	-grabBox $dialog(prefQueryDialogBox)

  queryTableLoad $siteName $dbox_top.box

## BOTTOM PART ##
  set cmdButtons \
  [buildCmdButtons $dbox_bottom {{{ok ok} {help help}}} x 2m 18 3]

  set cmdFrame  [lindex $cmdButtons 0]
  set cmdOk     [lindex $cmdButtons 1]
  set cmdHelp   [lindex $cmdButtons 2]

  $cmdOk configure -command \
            "queryTableSave $siteName $dbox_top.box; destroy $dialog(prefQueryDialogBox)"
  $cmdHelp configure -command {xpbs_help prefQuery $dialog(prefQueryDialogBox)}

  pack $dbox_top.box -anchor nw -side left -padx 0 -pady 0
  tkwait visibility $dialog(prefQueryDialogBox)
  remove_busy_cursor
  catch {tkwait window $dialog(prefQueryDialogBox)}
  set activeWindow($dialog(prefQueryDialogBox)) 0
  catch {grab $callerDialogBox}
  catch {focus $focusBox}
}