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

Overview
Comment:Extended to use the `is_dead` flag when generating output. TODO: Interaction with public email addresses.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 512cb9e0437dbe6b705ed855a8a5903cff2e1baaf1111fc723dba3abce6ee421
User & Date: aku 2017-10-27 18:27:43.252
Context
2017-10-27
18:49
Disable mail contacts for dead people. check-in: 7f07885201 user: aku tags: trunk
18:27
Extended to use the `is_dead` flag when generating output. TODO: Interaction with public email addresses. check-in: 512cb9e043 user: aku tags: trunk
2017-10-18
15:25
Fixed leftover typo. check-in: 56556d827d user: aku tags: trunk
Changes
Unified Diff Ignore Whitespace Patch
Changes to cm-ingest.tcl.
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5

# argv0  : /home/www/src/website/build.tcl
# top    : /home/www/src/
# argv[0]: Location of CM database (default: $HOME/.cm/managed)

proc main {} {
    cmdline
    drop_descriptions
    pull_contacts




|







1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/env tclsh
# -*- tcl -*-
package require Tcl 8.5

# argv0  : /home/www/src/website/cm-ingest.tcl
# top    : /home/www/src/
# argv[0]: Location of CM database (default: $HOME/.cm/managed)

proc main {} {
    cmdline
    drop_descriptions
    pull_contacts
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
proc pull_contacts {} {
    global c t
    package require sha1
    
    set c {}
    # c :: dict (dname --> 'tag'  --> string
    #                      'bio'  --> string

    #                      'type' --> person|company|mailinglist
    #                      'link' --> (url    --> title)
    #                      'mail' --> (addr   --> '.')
    #                      'org'  --> (dname' --> '.') associations
    #                      'rep'  --> (dname' --> '.') representatives
    #                      'aff'  --> (dname' --> '.') affiliates (reverse org)

    set t {}
    # t :: dict (type  --> list (dname))
    
    cm eval {
	SELECT C.id         AS id
	,      C.tag        AS tag
	,      C.dname      AS dname
	,      C.biography  AS bio
	,      C.bio_public AS bpublic

	,      CT.text AS type
	FROM contact      C
	,    contact_type CT
	WHERE c.type = CT.id
	ORDER BY dname
    } {
	ping
	set type [string tolower $type]
	set hash [sha1::sha1 -hex $dname]

	dict set c $dname contacts 0
	dict set c $dname tag  $tag
	dict set c $dname hash $hash
	dict set c $dname type $type

	if {$bpublic} {
	    dict set c $dname bio $bio
	}
	foreach n {link mail org aff rep bio} {
	    if {[dict exists $c $dname $n]} continue
	    dict set c $dname $n {}
	}







>
















>
|













>







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
proc pull_contacts {} {
    global c t
    package require sha1
    
    set c {}
    # c :: dict (dname --> 'tag'  --> string
    #                      'bio'  --> string
    #                      'dead' --> bool
    #                      'type' --> person|company|mailinglist
    #                      'link' --> (url    --> title)
    #                      'mail' --> (addr   --> '.')
    #                      'org'  --> (dname' --> '.') associations
    #                      'rep'  --> (dname' --> '.') representatives
    #                      'aff'  --> (dname' --> '.') affiliates (reverse org)

    set t {}
    # t :: dict (type  --> list (dname))
    
    cm eval {
	SELECT C.id         AS id
	,      C.tag        AS tag
	,      C.dname      AS dname
	,      C.biography  AS bio
	,      C.bio_public AS bpublic
	,      C.is_dead    AS dead
	,      CT.text      AS type
	FROM contact      C
	,    contact_type CT
	WHERE c.type = CT.id
	ORDER BY dname
    } {
	ping
	set type [string tolower $type]
	set hash [sha1::sha1 -hex $dname]

	dict set c $dname contacts 0
	dict set c $dname tag  $tag
	dict set c $dname hash $hash
	dict set c $dname type $type
	dict set c $dname dead $dead
	if {$bpublic} {
	    dict set c $dname bio $bio
	}
	foreach n {link mail org aff rep bio} {
	    if {[dict exists $c $dname $n]} continue
	    dict set c $dname $n {}
	}
173
174
175
176
177
178
179


180
181

182
183
184


185
186
187
188
189
190
191
}

proc dump_descriptions {} {
    global c
    puts "Writing descriptions ..."
    dict for {dname def} $c {
	set bio [dict get $def bio]


	if {$bio eq {}} continue


	set hash [dict get $def hash]
	into desc_$hash pages



	lappend map @dname@   $dname
	lappend map @type@    [bio-type $dname]
	lappend map "\t    "  {}
	lappend map \t\t      {    }
	lappend map \t        {}

	>> [string trimleft [string map $map {







>
>


>



>
>







176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
}

proc dump_descriptions {} {
    global c
    puts "Writing descriptions ..."
    dict for {dname def} $c {
	set bio [dict get $def bio]
	# TODO: Show links ?

	if {$bio eq {}} continue

	set dead [dict get $def dead]
	set hash [dict get $def hash]
	into desc_$hash pages

	if {$dead} { append dname " " "✝" }
	
	lappend map @dname@   $dname
	lappend map @type@    [bio-type $dname]
	lappend map "\t    "  {}
	lappend map \t\t      {    }
	lappend map \t        {}

	>> [string trimleft [string map $map {
366
367
368
369
370
371
372



373
374
375
376
377
378
379
}

proc start {dname} {
    global c
    set tag  [dict get $c $dname tag]
    set hash [dict get $c $dname hash]
    set bio  [dict get $c $dname bio]




    if {$bio ne {}} {
	set first [first $bio cut]
	append dname \
	    <br><br> \
	    "<ul style='list-style-type:none'><li><table><tr><td>" \
	    $first







>
>
>







374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
}

proc start {dname} {
    global c
    set tag  [dict get $c $dname tag]
    set hash [dict get $c $dname hash]
    set bio  [dict get $c $dname bio]
    if {[dict get $c $dname dead]} {
	append dname " &#10013;"
    }

    if {$bio ne {}} {
	set first [first $bio cut]
	append dname \
	    <br><br> \
	    "<ul style='list-style-type:none'><li><table><tr><td>" \
	    $first