Casting and Costume Management Application
Check-in [378f4f98a4]
Not logged in

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Initial working Backstage application.
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:378f4f98a4bbc192f63e67c80d3e8a0dbc67401b
User & Date: gerald 2014-12-17 07:34:11
Context
2014-12-18
07:28
Full implementation of backstage application. check-in: 7a2df02d9f user: gerald tags: trunk
2014-12-17
07:34
Initial working Backstage application. check-in: 378f4f98a4 user: gerald tags: trunk
2014-12-12
23:40
Initial checkin for backstage client and its support routines. check-in: 6475c56831 user: gerald tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to MakeBackstageApp.tcl.

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
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Tcl

set ofd [open BackStage.tcl w]
set fileList {
    src/PreBackStageMain.tcl
    src/Functions/ClearGui.tcl
    src/Functions/InitializeSystem.tcl
    src/Functions/isAdult.tcl
    src/Functions/PerformerDetails.tcl

    src/Functions/SetCb.tcl
    src/Functions/SetPerformer.tcl
    src/Functions/ClientRoutines.tcl

    src/Guis/ClientRoutineGuis.tcl
    src/Guis/PerformerTab.tcl
    src/Guis/CreatePerformerDetailGui.tcl
    src/Guis/CreatePerformerCostumePreview.tcl
    src/Guis/TkError.tcl

}











foreach file [glob src/msgcat/*.msg] {
    lappend fileList $file
}

lappend fileList {src/BackStageMain.tcl}








<




>



>





>

>
>
>
>
>
>
>
>
>
>







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
# the next line restarts using tclsh \
exec tclsh "$0" "$@"

package require Tcl

set ofd [open BackStage.tcl w]
set fileList {

    src/Functions/ClearGui.tcl
    src/Functions/InitializeSystem.tcl
    src/Functions/isAdult.tcl
    src/Functions/PerformerDetails.tcl
    src/Functions/PopulatePerformers.tcl
    src/Functions/SetCb.tcl
    src/Functions/SetPerformer.tcl
    src/Functions/ClientRoutines.tcl
    src/Functions/ExitApplication.tcl
    src/Guis/ClientRoutineGuis.tcl
    src/Guis/PerformerTab.tcl
    src/Guis/CreatePerformerDetailGui.tcl
    src/Guis/CreatePerformerCostumePreview.tcl
    src/Guis/TkError.tcl
    src/Guis/BuildBackStageMenu.tcl
}

set ifd [open src/PreBackStageMain.tcl r]
fcopy $ifd $ofd
close $ifd

set ifd [open src/Upgrades/Database/CreateDatabase.sql r]
puts $ofd "set CreateDatabaseSql {"
fcopy $ifd $ofd
close $ifd
puts $ofd "}"

foreach file [glob src/msgcat/*.msg] {
    lappend fileList $file
}

lappend fileList {src/BackStageMain.tcl}

Changes to src/BackStageMain.tcl.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
..
19
20
21
22
23
24
25

26
27
28
29
30
31
32
33
34
35
36






37








38







39







proc SortAuditions {args} {
    return;
}

proc SortPerformers {args} {
    return;
}

proc SortShowInfo {args} {
    return;
}

proc SetTitle {args} {
    variable windows
    variable systemInfo
................................................................................
        set w [winfo toplevel $windows(MainPerformerTab)]
        set showName [lindex [db eval {select ShowDescription from Show where ShowID = $systemInfo(ShowSelection)}] 0]
        wm title $w "Ballet Hysell Back Stage -- $showName"
    }
    return;
}


SetDefaultContext
set systemInfo(Mode) Backstage

InitializeSystem no
db function isAdult isAdult

set MassUpdate(Enabled) 0
set MassUpdate(SelectionList) {}

SaveSystemInfo







BuildPerformerTab . yes








SetTitle







wm deiconify .











<
<
<
<







 







>
|
|

|
|

|
|

|

>
>
>
>
>
>
|
>
>
>
>
>
>
>
>
|
>
>
>
>
>
>
>

>
>
>
>
>
>
1
2
3
4
5




6
7
8
9
10
11
12
..
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

proc SortAuditions {args} {
    return;
}





proc SortShowInfo {args} {
    return;
}

proc SetTitle {args} {
    variable windows
    variable systemInfo
................................................................................
        set w [winfo toplevel $windows(MainPerformerTab)]
        set showName [lindex [db eval {select ShowDescription from Show where ShowID = $systemInfo(ShowSelection)}] 0]
        wm title $w "Ballet Hysell Back Stage -- $showName"
    }
    return;
}

set status [catch {
    SetDefaultContext
    set systemInfo(Mode) Backstage

    InitializeSystem no
    db function isAdult isAdult

    set MassUpdate(Enabled) 0
    set MassUpdate(SelectionList) {}

    SaveSystemInfo

    ::ttk::notebook .backStage
    grid configure .backStage -sticky nsew
    grid columnconfigure . .backStage -weight 1
    grid rowconfigure . .backStage -weight 1
    menu .menuBar
    . configure -menu .menuBar
    BuildPerformerTab .backStage yes
    BuildBackStageMenu .menuBar
    foreach col {FirstName LastName PhoneNumber MobileNumber} {
        set systemInfo(ViewColumn,Performer,$col) 1
    }
    foreach col {ShowDescription CharacterDescription CostumeNote} {
        set systemInfo(ViewColumn,CostumePreview,$col) 1
    }
    AddjustViewableColumns
    SetTitle
    PopulatePerformers
    PopulatePerformerDetails PerformerDetails
    PopulateCostumePreview
    wm attributes . -fullscreen yes
} errMsg]


wm deiconify .

if {$status} {
    console show
    puts stderr $errMsg
    puts stderr $::errorInfo
}

Changes to src/Functions/ClientRoutines.tcl.

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
...
172
173
174
175
176
177
178

179
180
181
182
183
184
185
186
187


























188
189
190
191
192
193
194
...
257
258
259
260
261
262
263

264
265




266
267
268

269
270
271
272
273
274
275
...
365
366
367
368
369
370
371


372
373
374
375
376
377
378
...
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
#
# Pre-requisite Conditions : None
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc CreateClientDb {} {



    ::log::log debug "[string repeat { } [info level]][info level 0]"

    ##
    ## Create the Show table
    ##
    db eval {
        CREATE TABLE Show (
            ShowID              TEXT,
            ShowDescription     TEXT,
            ShowClass           TEXT
        )
    }

    ##
    ## Create the Performers table
    ##
    db eval {
        CREATE TABLE Performers (
            HysellId        INTEGER,
            LastName        TEXT,
            FirstName       TEXT,
            Birthdate       DATE,
            Address         TEXT,
            City            TEXT,
            State           TEXT,
            ZipCode         TEXT,
            ParentName      TEXT,
            ParentLast      TEXT,
            PhoneNumber     TEXT,
            MobileNumber    TEXT,
            EmailAddress    TEXT,
            ParentName2     TEXT,
            ParentLast2     TEXT,
            PhoneNumber2    TEXT,
            MobileNumber2   TEXT,
            EmailAddress2   TEXT,
            School          TEXT,
            DancingSchool   TEXT,
            Notes           TEXT,
            Active          BOOLEAN,
            Report          BOOLEAN
        )
    }

    ##
    ## Create the Casting table -- but we add a column to flag auditions that
    ## need to go to the server.
    ##
    db eval {
        CREATE TABLE Casting (
            ShowID              TEXT,
            HysellId            TEXT,
            auditionnumber      INTEGER,
            inShow              BOOLEAN,
            changed             BOOLEAN
        )
    }

    ##
    ## Create the Costume Assignments table -- but we add a column to flag auditions that
    ## need to go to the server.
    ##
    db eval {
        CREATE TABLE costumeassignments (
            auditionnumber INTEGER,
            characterid    TEXT,
            costume1       TEXT,
            costume2       TEXT,
            costume3       TEXT,
            costume4       TEXT,
            costumenote    TEXT,
            showid         TEXT
        )
    }

    ##
    ## Create the Characters table -- but we add a column to flag auditions that
    ## need to go to the server.
    ##
    db eval {
        CREATE TABLE characters (
            charactercode  TEXT,
            characterdescr TEXT,
            characterclass TEXT,
            showclass      TEXT,
            Act            INTEGER DEFAULT '1',
            Scene          INTEGER DEFAULT '1'
        )
    }

    ##
    ## Define the Costume Preview View
    ##
    db eval {
        create view CostumePreview as
            select ca.HysellId as HysellId,
                   ca.ShowId as ShowId,
                    s.ShowDescription as ShowDescription,
                   ch.characterclass as CharacterClass,
                   ch.charactercode as CharacterCode,
                   ch.characterdescr as CharacterDescription,
                    a.costume1 as Costume1,
                    a.costume2 as Costume2,
                    a.costume3 as Costume3,
                    a.costume4 as Costume4,
                    a.costumenote as CostumeNote
                from costumeassignments a,
                     characters ch,
                     show s,
                     casting ca
                where a.showid = s.ShowID
                  and a.auditionnumber = ca.auditionnumber
                  and a.characterid = ch.charactercode
                  and s.ShowClass = ch.showclass
                  and s.ShowID = ca.ShowId
                order by ca.HysellId,s.ShowDescription,ch.characterclass,ch.characterdescr
    }

    return
}

###########################################################################
#
................................................................................
    set DisplayConnectionStatusGui(statusMessage) {}
    set DisplayConnectionStatusGui(status) 0
    DisplayConnectionStatus
    GetServerAddress
    ::log::log info "Checking for file {$systemInfo(DatabaseFile)}"
    if {![file exists $systemInfo(DatabaseFile)]} {
        sqlite3 db $systemInfo(DatabaseFile)

        CreateClientDb
    } else {
        sqlite3 db $systemInfo(DatabaseFile)
    }
    PullDatabase
    UndisplayConnectionStatus
    db close
    return
}



























###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
# Procedure Name : udpEventHandler
................................................................................
    set serverInfo(port) {}

    set group 224.5.1.21
    set port  7772

    set socket [udp_open $port]
    fconfigure $socket -mcastadd $group

    fileevent $socket readable [list udpEventHandler $socket]
    vwait serverInfo(host)




    if {![info exists systemInfo(clientId)] || [string equal $systemInfo(clientId) {}]} {
        RegisterClient
    }

}



###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
................................................................................
# Original Author : Gerald W. Lester
#
###########################################################################
proc PullDatabase {} {
    variable systemInfo
    variable serverInfo
    variable DisplayConnectionStatusGui



    switch -exact -- $systemInfo(Mode) {
        AuditionEntryOnly {
            set dataType AUDITIONDATA
        }
        Backstage {
            set dataType BACKSTAGEDATA
................................................................................
            ##
            ## Unsupported mode, so do nothing
            ##
            return
        }
    }

    set DisplayConnectionStatusGui(statusMessage) [::msgcat::mc status,Downloading]

    update idletasks

    ##
    ## Open the socket
    ##
    set socket [socket $serverInfo(host) $serverInfo(port)]
    fconfigure $socket -translation lf -blocking yes

    ##
    ## Send the update
    ##
    set dataPacket [list GET $dataType]
    ::log::log info "\t Sending {$dataPacket}"
    puts $socket $dataPacket
    flush $socket

    ##
    ## Get the database back
    ##
    set response {}
    set status [gets $socket header]
    ::log::log info "\t Received {$response} with status {$header}"
    lassign $header cmd dataLength
    set dataDict [read $socket $dataLenght]

    ##
    ## Close the socket
    ##
    close $socket

    ##
    ## Populate the database
    ##
    set sqlFmt {insert into %1s(%2$s) values (%3$s)}
    foreach table [dict keys $dataDict] {
        db eval "delete from $table"
        set dataList [dict get $dataDict $table]
        set colList [lindex $dataList 0]
        set bindList \$[join $colList {,$}]"
        set sqlCmd [format $sqlFmt $table [join $colList {,}] $bindLis]
        foreach row [lrange $dataList 1 end] {
            lassign $row {*}$colList
            db eval $sqlCmd
        }
    }

    ##
    ## All done
    ##
    return;

}







>
>
>


<
<
<
|
|
<
<
<
<
<
<
<
<
<
|
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







>









>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







 







>


>
>
>
>
|


>







 







>
>







 







|
>









|

|









|

|









|




|
|












17
18
19
20
21
22
23
24
25
26
27
28



29
30









31



































































































32
33
34
35
36
37
38
..
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
...
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
...
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
...
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
#
# Pre-requisite Conditions : None
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc CreateClientDb {} {
    global CreateDatabaseSql
    global lastSql

    ::log::log debug "[string repeat { } [info level]][info level 0]"




    foreach sqlCmd [split $CreateDatabaseSql {;}] {
        set lastSql $sqlCmd









        db eval $sqlCmd



































































































    }

    return
}

###########################################################################
#
................................................................................
    set DisplayConnectionStatusGui(statusMessage) {}
    set DisplayConnectionStatusGui(status) 0
    DisplayConnectionStatus
    GetServerAddress
    ::log::log info "Checking for file {$systemInfo(DatabaseFile)}"
    if {![file exists $systemInfo(DatabaseFile)]} {
        sqlite3 db $systemInfo(DatabaseFile)
        db function isAdult isAdult
        CreateClientDb
    } else {
        sqlite3 db $systemInfo(DatabaseFile)
    }
    PullDatabase
    UndisplayConnectionStatus
    db close
    return
}

proc ReloadDatabaseFromServer {} {
    set saveInfo [::log::lvSuppress info]
    set savedebug [::log::lvSuppress debug]
    ::log::lvSuppress info 0
    ::log::lvSuppress debug 0
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    variable DisplayConnectionStatusGui
    variable systemInfo

    set DisplayConnectionStatusGui(statusMessage) {}
    set DisplayConnectionStatusGui(status) 0
    DisplayConnectionStatus
    if {![GetServerAddress]} {
        return
    }
    ::log::log info "Checking for file {$systemInfo(DatabaseFile)}"
    PullDatabase
    UndisplayConnectionStatus
    PopulatePerformers
    PopulatePerformerDetails PerformerDetails
    PopulateCostumePreview
    ::log::lvSuppress info $saveInfo
    ::log::lvSuppress debug $savedebug
    return
}

###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
# Procedure Name : udpEventHandler
................................................................................
    set serverInfo(port) {}

    set group 224.5.1.21
    set port  7772

    set socket [udp_open $port]
    fconfigure $socket -mcastadd $group
    set afterId [after 120000 {set serverInfo(host) {-1}}]
    fileevent $socket readable [list udpEventHandler $socket]
    vwait serverInfo(host)
    catch {after cancel $afterId}
    if {$serverInfo(host) eq {-1}} {
        ::log::info "[string repeat { } [info level]]\t Timeout!!!"
        return 0
    } elseif {![info exists systemInfo(clientId)] || [string equal $systemInfo(clientId) {}]} {
        RegisterClient
    }
    return 1
}



###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
................................................................................
# Original Author : Gerald W. Lester
#
###########################################################################
proc PullDatabase {} {
    variable systemInfo
    variable serverInfo
    variable DisplayConnectionStatusGui

    global sqlCmd dataDict

    switch -exact -- $systemInfo(Mode) {
        AuditionEntryOnly {
            set dataType AUDITIONDATA
        }
        Backstage {
            set dataType BACKSTAGEDATA
................................................................................
            ##
            ## Unsupported mode, so do nothing
            ##
            return
        }
    }

    set DisplayConnectionStatusGui(statusMessage) \
        [::msgcat::mc status,Downloading $serverInfo(host) $serverInfo(port)]
    update idletasks

    ##
    ## Open the socket
    ##
    set socket [socket $serverInfo(host) $serverInfo(port)]
    fconfigure $socket -translation lf -blocking yes

    ##
    ## Send the update request
    ##
    set dataPacket [list GET $systemInfo(clientId) $dataType]
    ::log::log info "\t Sending {$dataPacket}"
    puts $socket $dataPacket
    flush $socket

    ##
    ## Get the database back
    ##
    set response {}
    set status [gets $socket header]
    ::log::log info "\t Received {$header} with status {$status}"
    lassign $header cmd dataLength
    set dataDict [read $socket $dataLength]

    ##
    ## Close the socket
    ##
    close $socket

    ##
    ## Populate the database
    ##
    set sqlFmt {insert into %1$s(%2$s) values (%3$s)}
    foreach table [dict keys $dataDict] {
        db eval "delete from $table"
        set dataList [dict get $dataDict $table]
        set colList [lindex $dataList 0]
        set bindList \$[join $colList {,$}]
        set sqlCmd [format $sqlFmt $table [join $colList {,}] $bindList]
        foreach row [lrange $dataList 1 end] {
            lassign $row {*}$colList
            db eval $sqlCmd
        }
    }

    ##
    ## All done
    ##
    return;

}

Changes to src/Functions/ExitApplication.tcl.

57
58
59
60
61
62
63

64
#
###########################################################################
proc ExitApplication {} {
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    SaveSystemInfo
    catch {db close}
    destroy .

}







>

57
58
59
60
61
62
63
64
65
#
###########################################################################
proc ExitApplication {} {
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    SaveSystemInfo
    catch {db close}
    destroy .
    after1 {exit}
}

Changes to src/Functions/InitializeSystem.tcl.

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
...
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
    variable systemInfo
    global env

    set savedInfoFound no

    if {$systemInfo(isAndroid)} {
        set locationList [list]






        lappend locationList \
            $env(EXTERNAL_FILES) \
            $env(EXTERNAL_STORAGE2) \
            $env(EXTERNAL_STORAGE) \
            $env(INTERNAL_STORAGE) \
            $env(HOME) \
            {/sdcard} \
            {/sdcard/home}





    } else {
        set locationList [list ./ $env(HOME)]
    }



    foreach location $locationList {
        if {[set savedInfoFound [LoadSystemInfo $location]]} {
            set systemInfo(path) $location
            break
        }
    }





    if {$restoreContext && (!$savedInfoFound || ![file exists $systemInfo(DatabaseFile)])} {
        set types {
            {{Database Files}       {.db}}
        }
        set savedInfoFound no
        set dbfn [tk_getOpenFile \
................................................................................
            destroy .
            return
        }
        set systemInfo(DatabaseFile) $dbfn
        SetDefaultContext
    } elseif {!$restoreContext && !$savedInfoFound}  {
        foreach location $locationList {
            if {[file $location isdirectory]} {
                set systemInfo(DatabaseFile) [file join $location OpenShowManagement.db]
                break
            }
         }
        GetClientName
        GetDatabaseFromServer
    }

    set systemInfo(path) $location
    sqlite3 db $systemInfo(DatabaseFile)

    if {![string equal $systemInfo(Mode) AuditionEntryOnly]} {
        after 1 [list trace add variable systemInfo(ShowSelection) write PopulateAuditions]
    }
    if {$restoreContext} {
        RestoreContext
    }

    return;







>
>
>
>
>
>

<
<
<
<
<


>
>
>
>
>



>
>







>
>
>
>







 







|











|







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
...
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
    variable systemInfo
    global env

    set savedInfoFound no

    if {$systemInfo(isAndroid)} {
        set locationList [list]

        foreach varName {EXTERNAL_STORAGE2 EXTERNAL_STORAGE} {
            if {[info exists env($varName)]} {
               lappend locationList $env($varName)
            }
        }
        lappend locationList \





            {/sdcard} \
            {/sdcard/home}
        foreach varName {INTERNAL_STORAGE HOME EXTERNAL_FILES} {
            if {[info exists env($varName)]} {
               lappend locationList $env($varName)
            }
        }
    } else {
        set locationList [list ./ $env(HOME)]
    }

    puts stdout "Location list is {$locationList}"

    foreach location $locationList {
        if {[set savedInfoFound [LoadSystemInfo $location]]} {
            set systemInfo(path) $location
            break
        }
    }
    if {![info exists systemInfo(path)]} {
        set systemInfo(path) [lindex $locationList 0]
    }
    puts stdout "Location is {$systemInfo(path)}"

    if {$restoreContext && (!$savedInfoFound || ![file exists $systemInfo(DatabaseFile)])} {
        set types {
            {{Database Files}       {.db}}
        }
        set savedInfoFound no
        set dbfn [tk_getOpenFile \
................................................................................
            destroy .
            return
        }
        set systemInfo(DatabaseFile) $dbfn
        SetDefaultContext
    } elseif {!$restoreContext && !$savedInfoFound}  {
        foreach location $locationList {
            if {[file isdirectory $location]} {
                set systemInfo(DatabaseFile) [file join $location OpenShowManagement.db]
                break
            }
         }
        GetClientName
        GetDatabaseFromServer
    }

    set systemInfo(path) $location
    sqlite3 db $systemInfo(DatabaseFile)

    if {$systemInfo(Mode) ni {AuditionEntryOnly Backstage}} {
        after 1 [list trace add variable systemInfo(ShowSelection) write PopulateAuditions]
    }
    if {$restoreContext} {
        RestoreContext
    }

    return;

Changes to src/Functions/ServerFunctions.tcl.

25
26
27
28
29
30
31

32
33
34
35
36
37
38
39
40
41
42
43
44
45
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
...
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
...
181
182
183
184
185
186
187
188

189
190
191
192
193
194
195
196

197
198
199
200
201
202
203
...
322
323
324
325
326
327
328
329







330
331
332
333
334
335
336
    variable serverInfo

    if {$serverInfo(state)} {
        ##
        ## Now active
        ##
        GetMyIp

        set serverInfo(tcpSocket) [socket -server AcceptConnection 8082]
        set group 224.5.1.21
        set port  7772
        set serverInfo(udpSocket)  [udp_open]
        fconfigure $serverInfo(udpSocket) -buffering none -remote [list $group $port]
        BroadCastIp
        ::log::log info "\t Started server on $serverInfo(ipAddr):8080"
    } else {
        ##
        ## Now inactive
        ##
        after cancel $serverInfo(afterId)
        close $serverInfo(tcpSocket)
        close $serverInfo(udpSocket)
................................................................................
#
###########################################################################
proc BroadCastIp {} {
    variable serverInfo
    variable systemInfo

    set serverInfo(afterId) [after 5000 [list BroadCastIp]]
    puts -nonewline $serverInfo(udpSocket) [list server $systemInfo(ShowSelection) $serverInfo(ipAddr) 8080]
    flush $serverInfo(udpSocket)
    return
}


###########################################################################
#
................................................................................
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc GetMyIp {} {
    variable serverInfo

    if { [ catch {
        set ip 127.0.0.1
        set sid [ socket -async [ info hostname ] 22 ]
        update idletasks
        set serverInfo(ipAddr) [ lindex [ fconfigure $sid -sockname ] 0 ]
        ::close $sid
    } err ] } {
        catch { ::close $sid }
        puts stderr "myIP error: '$err' on port 22 (sshd). using 127.0.0.1"

    }

    return

}





###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
................................................................................
                        update Clients
                            set UploadedAt = $now
                            where ClientId = $clientId
                    }
                }
                GET     {
                    set clientId [lindex $clientRequest 1]
                    switch -exact -- [lindex $clientRequest 2] {

                        AUDITIONDATA -
                        BACKSTAGEDATA {
                            set reply [ProccesGetRequest $clientId [lindex $clientRequest 2]]
                        }
                        default {
                            ##
                            ## Not supported at this time, so do nothing
                            ##

                        }                    }

                    ::log::log info "\tReply is {$reply}"
                    puts -nonewline $channel $reply
                    flush $channel
                    db eval {
                        update Clients
................................................................................
    ##
    ## Build the data dictionary
    ##
    set sqlFmt {select %s from %s %s}
    set showId $systemInfo(ShowSelection)
    foreach table $tableList($clientType) {
        if {{showid} in $columnList($table)} {
            set whereClause {where showid = $showId}







        } else {
            set whereClause {}
        }
        set sqlCmd [format $sqlFmt [join $columnList($table) {,}] $table $whereClause]
        set rowList [list]
        lappend rowList $columnList($table)
        db eval $sqlCmd dbArr {







>
|





|







 







|







 







|
|
|
|
|
|
<
|
<
>
|
>
|
>
|
>
>
>







 







|
>


|





>







 







|
>
>
>
>
>
>
>







25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
..
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
...
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
...
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
...
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
    variable serverInfo

    if {$serverInfo(state)} {
        ##
        ## Now active
        ##
        GetMyIp
        set serverInfo(tcpPort) 8082
        set serverInfo(tcpSocket) [socket -server AcceptConnection $serverInfo(tcpPort)]
        set group 224.5.1.21
        set port  7772
        set serverInfo(udpSocket)  [udp_open]
        fconfigure $serverInfo(udpSocket) -buffering none -remote [list $group $port]
        BroadCastIp
        ::log::log info "\t Started server on $serverInfo(ipAddr):$serverInfo(tcpPort)"
    } else {
        ##
        ## Now inactive
        ##
        after cancel $serverInfo(afterId)
        close $serverInfo(tcpSocket)
        close $serverInfo(udpSocket)
................................................................................
#
###########################################################################
proc BroadCastIp {} {
    variable serverInfo
    variable systemInfo

    set serverInfo(afterId) [after 5000 [list BroadCastIp]]
    puts -nonewline $serverInfo(udpSocket) [list server $systemInfo(ShowSelection) $serverInfo(ipAddr) $serverInfo(tcpPort)]
    flush $serverInfo(udpSocket)
    return
}


###########################################################################
#
................................................................................
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc GetMyIp {} {
    variable serverInfo

    set serverInfo(ipAddr) {}
    set serverSocket [socket -server GetMyIpPart2 0]
    set serverPort [lindex [fconfigure $serverSocket -sockname] 2]
    set sid [socket -async [info hostname] $serverPort]
    vwait serverInfo(ipAddr)
    close $sid

    close $serverSocket

    return
}

proc GetMyIpPart2 {socket ipAddr port} {
    variable serverInfo

    set serverInfo(ipAddr) [lindex [fconfigure $socket -sockname] 0]
    close $socket
}


###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
................................................................................
                        update Clients
                            set UploadedAt = $now
                            where ClientId = $clientId
                    }
                }
                GET     {
                    set clientId [lindex $clientRequest 1]
                    set requestType [lindex $clientRequest 2]
                    switch -exact -- $requestType {
                        AUDITIONDATA -
                        BACKSTAGEDATA {
                            set reply [ProccesGetRequest $clientId $requestType]
                        }
                        default {
                            ##
                            ## Not supported at this time, so do nothing
                            ##
                            set reply "Request type '$requestType' is not supported"
                        }                    }

                    ::log::log info "\tReply is {$reply}"
                    puts -nonewline $channel $reply
                    flush $channel
                    db eval {
                        update Clients
................................................................................
    ##
    ## Build the data dictionary
    ##
    set sqlFmt {select %s from %s %s}
    set showId $systemInfo(ShowSelection)
    foreach table $tableList($clientType) {
        if {{showid} in $columnList($table)} {
            set whereClause {
                where showid in (
                    select a.showid
                        from Show a, Show b
                        where b.ShowID = $showId
                          and a.ShowClass = b.ShowClass
                )
            }
        } else {
            set whereClause {}
        }
        set sqlCmd [format $sqlFmt [join $columnList($table) {,}] $table $whereClause]
        set rowList [list]
        lappend rowList $columnList($table)
        db eval $sqlCmd dbArr {

Changes to src/Functions/SetPerformer.tcl.

92
93
94
95
96
97
98

99
100
101
102
103
104
105
106
107

108
109
110
111
112
113
114
        }
        if {![string match *auditionTab* $w]} {
            SortAuditions {}
        }
        if {![string match *performerTab* $w]} {
            SortPerformers {}
        }

        set nb $windows(MainNotebook)
        if {[string equal [$nb tab [$nb index current] -text] {Performer View}]} {
            set windows(performerDetailedArrayName) PerformerDetails
            set menuWidget $windows(Mainmenu).tools
            $menuWidget entryconfigure {Copy Family Information} -state normal
        } elseif {![info exists windows(CopyFamilyInfo)] || ![winfo viewable $windows(CopyFamilyInfo)]} {
            set windows(performerDetailedArrayName) {}
            set menuWidget $windows(Mainmenu).tools
            $menuWidget entryconfigure {Copy Family Information} -state disabled

        }
    }

    PopulatePerformerDetails PerformerDetails
    PopulateCostumePreview

    after 1 {set SetPerformer 0}







>
|
|
|
|
|
|
|
|
|
>







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
        }
        if {![string match *auditionTab* $w]} {
            SortAuditions {}
        }
        if {![string match *performerTab* $w]} {
            SortPerformers {}
        }
        if {[info exists windows(MainNotebook)]} {
            set nb $windows(MainNotebook)
            if {[string equal [$nb tab [$nb index current] -text] {Performer View}]} {
                set windows(performerDetailedArrayName) PerformerDetails
                set menuWidget $windows(Mainmenu).tools
                $menuWidget entryconfigure {Copy Family Information} -state normal
            } elseif {![info exists windows(CopyFamilyInfo)] || ![winfo viewable $windows(CopyFamilyInfo)]} {
                set windows(performerDetailedArrayName) {}
                set menuWidget $windows(Mainmenu).tools
                $menuWidget entryconfigure {Copy Family Information} -state disabled
            }
        }
    }

    PopulatePerformerDetails PerformerDetails
    PopulateCostumePreview

    after 1 {set SetPerformer 0}

Added src/Guis/BuildBackStageMenu.tcl.





































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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

###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure
#                           that you update this header block. Thanks.
#
# Procedure Name : BuildBackStageMenu
#
# Description : Build the menu for the main window of the BackStage application.
#
# Arguments :
#       menuWidget  - Menu widget for main window
#
# Returns : Nothing
#
# Side-Effects : None
#
# Exception Conditions : None
#
# Pre-requisite Conditions : None
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc BuildBackStageMenu {menuWidget} {
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    variable PerformerColList
    variable CostumePreviewDisplayList
    variable systemInfo

    ##
    ## Add in File menu
    ##
    $menuWidget add cascade \
        -label {File} \
        -underline 0 \
        -menu $menuWidget.file
    menu $menuWidget.file
    $menuWidget.file add command \
        -label {Download from Server} \
        -command ReloadDatabaseFromServer
    $menuWidget.file add command \
        -label {Upload to Server} \
        -state disabled \
        -command SendDatabaseToServer
    $menuWidget.file add separator
    $menuWidget.file add command \
        -label {Exit} \
        -underline 1 \
        -command [list after 1 ExitApplication]

    ##
    ## Add in voew menu
    ##
    $menuWidget add cascade \
        -label {View} \
        -underline 0 \
        -menu $menuWidget.filter
    menu $menuWidget.filter
    $menuWidget.filter add cascade \
        -label {Performer Columns} \
        -menu $menuWidget.filter.performerColumns
    menu $menuWidget.filter.performerColumns
    foreach col [lrange $PerformerColList 0 end-2]  {
        set systemInfo(ViewColumn,Performer,$col) 0
        $menuWidget.filter.performerColumns add checkbutton \
            -label [::msgcat::mc $col]  \
            -offvalue 0 \
            -onvalue 1 \
            -variable systemInfo(ViewColumn,Performer,$col) \
            -command AddjustViewableColumns
    }
    $menuWidget.filter add cascade \
        -label {Costume Columns} \
        -underline 1 \
        -menu $menuWidget.filter.previewColumns
    menu $menuWidget.filter.previewColumns
    foreach col $CostumePreviewDisplayList {
        set systemInfo(ViewColumn,CostumePreview,$col) 0
        $menuWidget.filter.previewColumns add checkbutton \
            -label [::msgcat::mc $col]  \
            -offvalue 0 \
            -onvalue 1 \
            -variable systemInfo(ViewColumn,CostumePreview,$col) \
            -command AddjustViewableColumns
    }

    return;
}

proc AddjustViewableColumns {} {
    variable PerformerColList
    variable CostumePreviewDisplayList
    variable systemInfo
    variable windows

    set displayColumns [list]
    foreach col [lrange $PerformerColList 0 end-2]  {
        if {$systemInfo(ViewColumn,Performer,$col)} {
            lappend displayColumns $col
        }
    }
    $windows(PerformerViews) configure -displaycolumns $displayColumns

    set displayColumns [list]
    foreach col $CostumePreviewDisplayList  {
        if {$systemInfo(ViewColumn,CostumePreview,$col)} {
            lappend displayColumns $col
        }
    }
    $windows(CostumePreview) configure -displaycolumns $displayColumns

    return;
}

Changes to src/Guis/ClientRoutineGuis.tcl.

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
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    variable windows
    variable DisplayConnectionStatusGui
    variable systemInfo

    set DisplayConnectionStatusGui(status) 0


    set w [toplevel .displayConnectionStatusGui]
    set windows(DisplayConnectionStatus) $w
    wm title $w {Server Connection Status}
    wm attributes $w -topmost yes
    wm protocol $w WM_DELETE_WINDOW {after 1 {destroy .}}
    wm resizable $w yes no

    ::ttk::frame $w.main
    grid configure $w.main -sticky nsew
    grid columnconfigure $w $w.main -weight 1
    grid rowconfigure $w $w.main -weight 1

    ::ttk::frame $w.main.data
    grid configure $w.main.data -sticky ew
    ::ttk::label $w.main.data.label \
        -textvariable ::DisplayConnectionStatusGui(statusMessage) \
        -width 80
    grid configure $w.main.data.label -sticky ew
    grid columnconfigure $w.main.data $w.main.data.label -weight 1

    grid columnconfigure $w.main $w.main.data -weight 1


    return;
}

###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure







>
|
|
|
|
|
|

|
|
|
|

|
|
|
|
|
|
|

|
>







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
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    variable windows
    variable DisplayConnectionStatusGui
    variable systemInfo

    set DisplayConnectionStatusGui(status) 0

    if {![winfo exists .displayConnectionStatusGui]} {
        set w [toplevel .displayConnectionStatusGui]
        set windows(DisplayConnectionStatus) $w
        wm title $w {Server Connection Status}
        wm attributes $w -topmost yes
        wm protocol $w WM_DELETE_WINDOW {after 1 {destroy .}}
        wm resizable $w yes no

        ::ttk::frame $w.main
        grid configure $w.main -sticky nsew
        grid columnconfigure $w $w.main -weight 1
        grid rowconfigure $w $w.main -weight 1

        ::ttk::frame $w.main.data
        grid configure $w.main.data -sticky ew
        ::ttk::label $w.main.data.label \
            -textvariable ::DisplayConnectionStatusGui(statusMessage) \
            -width 80
        grid configure $w.main.data.label -sticky ew
        grid columnconfigure $w.main.data $w.main.data.label -weight 1

        grid columnconfigure $w.main $w.main.data -weight 1
    }

    return;
}

###########################################################################
#
# Procedure Header - as this procedure is modified, please be sure

Changes to src/Guis/CreatePerformerCostumePreview.tcl.

37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    ttk::scrollbar $w.vsb \
        -orient vertical \
        -command [list $w.data yview]
    ttk::scrollbar $w.hsb \
        -orient horizontal \
        -command [list $w.data xview]
    $w.data column #0 \
        -width 30 \
        -stretch n \
        -anchor c
    $w.data heading #0 \
        -anchor c \
        -text [::msgcat::mc CostumePreview]
    foreach col $CostumePreviewColList {
        $w.data column $col \
            -stretch y \
            -anchor e \







|
|
|







37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
    ttk::scrollbar $w.vsb \
        -orient vertical \
        -command [list $w.data yview]
    ttk::scrollbar $w.hsb \
        -orient horizontal \
        -command [list $w.data xview]
    $w.data column #0 \
        -width [expr {4 + [string length [::msgcat::mc CostumePreview]]}] \
        -stretch y \
        -anchor e
    $w.data heading #0 \
        -anchor c \
        -text [::msgcat::mc CostumePreview]
    foreach col $CostumePreviewColList {
        $w.data column $col \
            -stretch y \
            -anchor e \

Changes to src/Guis/CreatePerformerDetailGui.tcl.

56
57
58
59
60
61
62

63
64
65
66
67
68
69
..
87
88
89
90
91
92
93

94
95













96
97
98


99
100
101
102
103
104
105
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc CreatePerformerDetailGui {w arrayName} {
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    variable PerformerColList


    foreach col $PerformerColList {
        if {$col in {HysellId Active Report}} {
            continue
        }
        ::ttk::label $w.lbl_$col -text [::msgcat::mc $col]
        ::ttk::entry $w.ent_$col -textvariable ${arrayName}($col)
................................................................................
            -offvalue {N} \
            -text [::msgcat::mc $item] \
            -variable ${arrayName}($item)
        grid configure $w.top.cb_$item -row $row -column [incr col] -sticky ew
    }
    grid columnconfigure $w.top 5 -weight 1


    incr row
    set col 0













    foreach item {FirstName LastName BirthDate EmailAddress} {
        grid configure $w.lbl_$item -row $row -column [incr col] -sticky ew
        grid configure $w.ent_$item -row $row -column [incr col] -sticky ew


    }

    incr row
    set col 0
    set expandList {}
    foreach item {Address City State ZipCode} {
        grid configure $w.lbl_$item -row $row -column [incr col] -sticky ew







>







 







>
|
|
>
>
>
>
>
>
>
>
>
>
>
>
>
|
|
|
>
>







56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
..
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
#
# Original Author : Gerald W. Lester
#
###########################################################################
proc CreatePerformerDetailGui {w arrayName} {
    ::log::log debug "[string repeat { } [info level]][info level 0]"
    variable PerformerColList
    variable systemInfo

    foreach col $PerformerColList {
        if {$col in {HysellId Active Report}} {
            continue
        }
        ::ttk::label $w.lbl_$col -text [::msgcat::mc $col]
        ::ttk::entry $w.ent_$col -textvariable ${arrayName}($col)
................................................................................
            -offvalue {N} \
            -text [::msgcat::mc $item] \
            -variable ${arrayName}($item)
        grid configure $w.top.cb_$item -row $row -column [incr col] -sticky ew
    }
    grid columnconfigure $w.top 5 -weight 1

    if {$systemInfo(isAndroid)} {
        incr row
        set col 0
        foreach item {FirstName LastName} {
            grid configure $w.lbl_$item -row $row -column [incr col] -sticky ew
            grid configure $w.ent_$item -row $row -column [incr col] -sticky ew
        }
        incr row
        set col 0
        foreach item {BirthDate EmailAddress} {
            grid configure $w.lbl_$item -row $row -column [incr col] -sticky ew
            grid configure $w.ent_$item -row $row -column [incr col] -sticky ew
        }
    } else {
        incr row
        set col 0
        foreach item {FirstName LastName BirthDate EmailAddress} {
            grid configure $w.lbl_$item -row $row -column [incr col] -sticky ew
            grid configure $w.ent_$item -row $row -column [incr col] -sticky ew
        }

    }

    incr row
    set col 0
    set expandList {}
    foreach item {Address City State ZipCode} {
        grid configure $w.lbl_$item -row $row -column [incr col] -sticky ew

Changes to src/Guis/PerformerTab.tcl.

156
157
158
159
160
161
162





163
164
165

166
167
168
    set p [ttk::frame $w.preview]
    CreatePerformerCostumePreview $p


    ##
    ## Manage the subwindows
    ##





    $w add $l
    $w add $d
    $w add $p


    return;
}







>
>
>
>
>
|
|
|
>



156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
    set p [ttk::frame $w.preview]
    CreatePerformerCostumePreview $p


    ##
    ## Manage the subwindows
    ##
    if {$isStandalone} {
        $w insert end $l -text {Selector}
        $w insert end $d -text {Details}
        $w insert end $p -text {Casting}
    } else {
        $w add $l
        $w add $d
        $w add $p
    }

    return;
}

Changes to src/Guis/TkError.tcl.

61
62
63
64
65
66
67





68
69
70
71
72
73
74
75
76
77
78
79
80
    append msg "\n\t Error Code:" $::errorCode
    append msg "\n\t Error Info:" $::errorInfo
    catch {
        puts stderr $msg
        puts stderr {}
        puts stderr {}
    }





    catch {
        tk_messageBox \
            -default ok \
            -detail $msg \
            -icon error \
            -message {Unexpected application error encountered.} \
            -parent . \
            -title {Applicaiton Error}
            -type ok
    }

    return;
}







>
>
>
>
>







|





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
    append msg "\n\t Error Code:" $::errorCode
    append msg "\n\t Error Info:" $::errorInfo
    catch {
        puts stderr $msg
        puts stderr {}
        puts stderr {}
    }

    if {$::systemInfo(isAndroid)} {
        console show
    }

    catch {
        tk_messageBox \
            -default ok \
            -detail $msg \
            -icon error \
            -message {Unexpected application error encountered.} \
            -parent . \
            -title {Applicaiton Error} \
            -type ok
    }

    return;
}

Changes to src/Main.tcl.

41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
package require msgcat
package require csv
package require log
package require struct
package require struct::set

if {[catch {package require udp}]} {
    set udpPresent yes
} else {
    set udpPresent no
}

set systemInfo(udpPresent) $udpPresent
set systemInfo(isAndroid) no

set baseDir [file dirname [info script]]

................................................................................
    }
}

BuildMainWindow

SetDefaultContext

#after 1 [list trace add variable systemInfo(ShowSelection) write PopulateAuditions]

InitializeSystem
db function isAdult isAdult

ApplyUpgrades

set MassUpdate(Enabled) 0
set MassUpdate(SelectionList) {}

PopulatePerformerDetails PerformerDetails

SaveSystemInfo

::log::lvSuppress info 0







|

|







 







<
<













41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
...
137
138
139
140
141
142
143


144
145
146
147
148
149
150
151
152
153
154
155
156
package require msgcat
package require csv
package require log
package require struct
package require struct::set

if {[catch {package require udp}]} {
    set udpPresent no
} else {
    set udpPresent yes
}

set systemInfo(udpPresent) $udpPresent
set systemInfo(isAndroid) no

set baseDir [file dirname [info script]]

................................................................................
    }
}

BuildMainWindow

SetDefaultContext



InitializeSystem
db function isAdult isAdult

ApplyUpgrades

set MassUpdate(Enabled) 0
set MassUpdate(SelectionList) {}

PopulatePerformerDetails PerformerDetails

SaveSystemInfo

::log::lvSuppress info 0

Changes to src/PreBackStageMain.tcl.

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
package require tdbc 1.0
package require tdbc::sqlite3
package require msgcat
package require log
package require struct
package require struct::set








if {[catch {package require udp}]} {
    set udpPresent yes
} else {
    set udpPresent no
}

set systemInfo(udpPresent) $udpPresent

if {[llength [info commands borg]]} {
    set systemInfo(isAndroid) yes
} else {
    set systemInfo(isAndroid) no
}


#::log::lvSuppress debug 0
#::log::lvSuppress info 0
wm withdraw .
set baseDir [file dirname [info script]]

set CopyFamilyInfo(fieldList) {EmailAddress Address City State ZipCode ParentName ParentLast PhoneNumber MobileNumber  ParentName2 ParentLast2 PhoneNumber2 MobileNumber2}







>
>
>
>
>
>
>













>







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
package require tdbc 1.0
package require tdbc::sqlite3
package require msgcat
package require log
package require struct
package require struct::set

catch {
    package require tkconclient
    tkconclient::start 12345
}

::log::lvSuppress info 0

if {[catch {package require udp}]} {
    set udpPresent yes
} else {
    set udpPresent no
}

set systemInfo(udpPresent) $udpPresent

if {[llength [info commands borg]]} {
    set systemInfo(isAndroid) yes
} else {
    set systemInfo(isAndroid) no
}


#::log::lvSuppress debug 0
#::log::lvSuppress info 0
wm withdraw .
set baseDir [file dirname [info script]]

set CopyFamilyInfo(fieldList) {EmailAddress Address City State ZipCode ParentName ParentLast PhoneNumber MobileNumber  ParentName2 ParentLast2 PhoneNumber2 MobileNumber2}

Added src/Upgrades/Database/CreateDatabase.sql.



















































































































































































































































































































































































































































>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
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
CREATE TABLE Casting (
    ShowId TEXT,
    HysellId TEXT,
    auditionnumber INTEGER,
    InShow BOOLEAN DEFAULT('Y')
);
CREATE TABLE characters (
    charactercode text,
    characterdescr text,
    characterclass text,
    showclass TEXT,
    Act INTEGER DEFAULT '1',
    Scene INTEGER DEFAULT '1');
CREATE TABLE Clients (
    ShowId          Text,
    ClientId        Text,
    ClientName      Text,
    Uploaded        Boolean,
    DownloadedAt    Date,
    UploadedAt      Date
);
CREATE TABLE ClientHysellMap (
    ClientId        Text,
    LocalHID        Integer,
    HyselID         Integer
);
CREATE TABLE costumeassignments (
    auditionnumber integer,
    characterid text,
    costume1 text,
    costume2 text,
    costume3 text,
    costume4 text,
    costumenote text,
    showid TEXT
);
CREATE TABLE Performers (
    HysellId INTEGER,
    FirstName TEXT,
    LastName TEXT,
    BirthDate DATE,
    Address TEXT,
    City TEXT,
    State TEXT,
    ZipCode TEXT,
    ParentName TEXT,
    PhoneNumber TEXT,
    MobileNumber TEXT,
    EmailAddress TEXT,
    Notes TEXT,
    Active BOOLEAN,
    Report BOOLEAN,
    ParentName2 TEXT,
    PhoneNumber2 TEXT,
    MobileNumber2 TEXT,
    EmailAddress2 TEXT,
    School TEXT,
    SchoolGrade TEXT,
    DancingSchool TEXT,
    ParentLast TEXT,
    ParentLast2 TEXT
);
CREATE TABLE Show (
    ShowID TEXT,
    ShowDescription TEXT,
    ShowClass TEXT
);


CREATE VIEW CastingView as
    select distinct s.ShowID "ShowId",
            s.ShowDescription "ShowDescription",
            s.ShowClass "ShowClass",
            p.HysellId "HysellId",
            p.FirstName "FirstName",
            p.LastName "LastName",
            p.BirthDate "BirthDate",
            p.Address "Address",
            p.City "City",
            p.State "State",
            p.ZipCode "ZipCode",
            p.ParentName "ParentName",
            p.PhoneNumber "PhoneNumber",
            p.MobileNumber "MobileNumber",
            p.EmailAddress "EmailAddress",
            p.Notes "Notes",
            p.Active "Active",
            p.Report "Report",
            p.ParentName2 "ParentName2",
            p.PhoneNumber2 "PhoneNumber2",
            p.MobileNumber2 "MobileNumber2",
            p.EmailAddress2 "EmailAddress2",
            p.School "School",
            p.SchoolGrade "SchoolGrade",
            p.DancingSchool "DancingSchool",
            p.ParentLast "ParentLast",
            p.ParentLast2 "ParentLast2",
            isAdult(strftime('%%Y',date('now'))-substr(BirthDate,-4)) "IsAdult",
            c.auditionnumber "AuditionNumber",
            c.InShow "InShow"
        from Show s, Performers p, Casting c
        where c.HysellId = p.HysellId
          and C.ShowId = s.ShowID;
CREATE VIEW CostumingView as
    select distinct s.ShowID "ShowId",
            s.ShowDescription "ShowDescription",
            s.ShowClass "ShowClass",
            p.HysellId "HysellId",
            p.FirstName "FirstName",
            p.LastName "LastName",
            p.BirthDate "BirthDate",
            p.Address "Address",
            p.City "City",
            p.State "State",
            p.ZipCode "ZipCode",
            p.ParentName "ParentName",
            p.PhoneNumber "PhoneNumber",
            p.MobileNumber "MobileNumber",
            p.EmailAddress "EmailAddress",
            p.Notes "Notes",
            p.Active "Active",
            p.Report "Report",
            p.ParentName2 "ParentName2",
            p.PhoneNumber2 "PhoneNumber2",
            p.MobileNumber2 "MobileNumber2",
            p.EmailAddress2 "EmailAddress2",
            p.School "School",
            p.SchoolGrade "SchoolGrade",
            p.DancingSchool "DancingSchool",
            p.ParentLast "ParentLast",
            p.ParentLast2 "ParentLast2",
            isAdult(strftime('%%Y',date('now'))-substr(BirthDate,-4)) "IsAdult",
            c.auditionnumber "AuditionNumber",
            c.InShow "InShow",
            cs.charactercode "CharacterCode",
            cs.characterdescr "CharacterDescr",
            cs.characterclass "CharacterClass",
            cs.Act "Act",
            cs.Scene "Scene",
            a.costume1 "Costume1",
            a.costume2 "Costume2",
            a.costume3 "Costume3",
            a.costume4 "Costume4",
            a.costumenote "CostumeNote"
        from Show s, Performers p, Casting c, costumeassignments a, characters cs
        where c.auditionnumber = a.auditionnumber
          and c.HysellId = p.HysellId
          and a.characterid = cs.charactercode
          and a.showid = s.ShowID
          and a.showid = c.ShowID
          and s.ShowClass = cs.showclass;
CREATE VIEW CostumePreview as
    select ca.HysellId as HysellId,
           ca.ShowId as ShowId,
            s.ShowDescription as ShowDescription,
           ch.characterclass as CharacterClass,
           ch.charactercode as CharacterCode,
           ch.characterdescr as CharacterDescription,
            a.costume1 as Costume1,
            a.costume2 as Costume2,
            a.costume3 as Costume3,
            a.costume4 as Costume4,
            a.costumenote as CostumeNote
        from costumeassignments a,
             characters ch,
             show s,
             casting ca
        where a.showid = s.ShowID
          and a.auditionnumber = ca.auditionnumber
          and a.characterid = ch.charactercode
          and s.ShowClass = ch.showclass
          and s.ShowID = ca.ShowId
        order by ca.HysellId,s.ShowDescription,ch.characterclass,ch.characterdescr;
CREATE VIEW ShowPerformerView AS
    SELECT  s.ShowID,
            s.ShowDescription,
            p.FirstName,
            p.LastName,
            p.BirthDate,
            p.School,
            p.DancingSchool,
            c.InShow,
            p.Active,
            p.Report,
            p.ParentName,
            p.ParentLast,
            p.PhoneNumber,
            p.MobileNumber,
            p.EmailAddress,
            p.Address,
            p.City,
            p.State,
            p.ZipCode,
            p.ParentName2,
            p.ParentLast2,
            p.PhoneNumber2,
            p.MobileNumber2,
            p.EmailAddress2
    FROM Show s, Performers p, Casting c
    WHERE s.ShowID = c.ShowId AND c.HysellId = p.HysellId;
CREATE TABLE ReportDefinitions (
    ReportName      Text,
    ReportType      Text,
    ReportSql       Text,
    UserDefined     Boolean,
    ReportColumns   Text,
    Restrictions    Test,
    InitalFile      Test,
    PrependShowId   Boolean,
    Title           Text,
    Description     Text
);
CREATE TABLE UpgradeInfo (
    UpgradedOn  datetime,
    FromVersion text,
    ToVersion   text
);

Changes to src/msgcat/en.msg.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

::msgcat::mcmset en {
    tm,Title,Show {Show Table Maintenance}
    tm,Title,characters {Character Classes Table Maintenance}
    tm,Title,Performers {Performers Table Maintenance}
    status,Searching {Searching for server...}
    status,Registering {Registering Client...}
    status,Downloading {Getting initial data from server...}
    status,Uploading {Uploading Database...}
    addSelected {<}
    addAll {<<}
    removeSelected {>}
    removeAll {>>}
    New     {New}
    Delete  {Delete}







|







35
36
37
38
39
40
41
42
43
44
45
46
47
48
49

::msgcat::mcmset en {
    tm,Title,Show {Show Table Maintenance}
    tm,Title,characters {Character Classes Table Maintenance}
    tm,Title,Performers {Performers Table Maintenance}
    status,Searching {Searching for server...}
    status,Registering {Registering Client...}
    status,Downloading {Getting initial data from server %1$s:%2$s}
    status,Uploading {Uploading Database...}
    addSelected {<}
    addAll {<<}
    removeSelected {>}
    removeAll {>>}
    New     {New}
    Delete  {Delete}