#!/bin/sh
# the next line restarts using wish \
exec wish "$0" "$@"

source [ file join $env(TCLTOOLS_HOME) TclToolInits.tcl ]
TclToolInits GUI UTILS GUIUTILS

# THIS is the promote window information

set MiP   [lindex $argv 0]
set PorT  [lindex $argv 1]
set pList [lindex $argv 2]
set Hname [lindex $argv 3]
set Dname [lindex $argv 4]

# READ the user GUI preferences

GUIprefsRead

# SET up the promote window

set bW .proPoPuP
if [winfo exists $bW] { destroy $bW }

GUIFrame $bW -1 pack|top||both|true
wm deiconify .
set W $bW.msg
GUIboxText  $W 45 15 pack|top||both|true

$W configure -foreground #000000

GUItextWrite $W "UDF PROMOTE  -  DATA ONLINE\n\n" "" [list "" "" bold]

GUItextWrite $W "[lindex $pList 1]\n"
GUItextWrite $W "[lindex $pList 2]\n"
GUItextWrite $W "[lindex $pList 3]\n"
GUItextWrite $W "[lindex $pList 4]\n"
GUItextWrite $W "[lindex $pList 5]\n\n"

set Yr  [lindex $pList 6]
set Dy  [lindex $pList 7] 
set Tm  [lindex $pList 8]
set Hr  [expr int($Tm / 3600000)]
set Mn  [expr int(($Tm % 3600000) / 60000 )]
set Ss  [expr int((($Tm % 3600000) % 60000 ) /1000 )]
GUItextWrite $W [format "TIME: %4d %3d %02d:%02d:%02d" $Yr $Dy $Hr $Mn $Ss] 
set Yr  [lindex $pList 9]
set Dy  [lindex $pList 10] 
set Tm  [lindex $pList 11]
set Hr  [expr int($Tm / 3600000)]
set Mn  [expr int(($Tm % 3600000) / 60000 )]
set Ss  [expr int((($Tm % 3600000) % 60000 ) /1000 )]
GUItextWrite $W [format "  to  %4d %3d %02d:%02d:%02d" $Yr $Dy $Hr $Mn $Ss]\n\n


GUItextWrite $W "$Hname\n"
if { [string length $Dname] > 0 } { GUItextWrite $W "$Dname" }

# SET up the promote window

raise $W
update

after 10000
destroy .
