2
* @progname dump_html.ll
9
dump_html.ll is designed to dump an entire database to static HTML files.
12
@(#)dump_html.ll 1.3 10/1/95
15
Before using, there are a few properties that need to be customized for your
16
own environment. These are done by adding them to your .linesrc ( or for
17
windows lines.cfg) file. This report is does not need to be modified.
19
The properties that are looked up are:
20
user.fullname -- Name of the database owner
21
user.email -- Email address of db owner
22
genweb.image -- define with path to image if you have one to use
23
genweb.page -- define with path to page if you have one
24
genweb.page_nam -- where your 'homepage' is
25
genweb.isLDS -- define if true
26
genweb.add_index -- define as 1 to add <ISINDEX> to INDEX file
30
include("extract_set.li")
34
global(found) /* external file to inline image found flag */
35
global(per_file) /* number of people per file to write */
36
global(first) /* first person shouldn't be asked about */
38
global(RVAL) /* ?? (part of borrowed code) */
39
global(last_surname) /* last surname in index - used for anchors */
40
global(first_indi) /* starting person */
42
/* customization globals - customize values assigned in main */
43
global(db_owner) /* name of database owner */
44
global(owner_addr) /* url of database owner (mailto or homepage) */
45
global(genweb_image) /* name of genweb image to place on each page */
46
global(genweb_page) /* URL of base genweb (or homepage) web page */
47
global(page_name) /* name of base genweb (or homepage) web page */
48
global(LDS) /* display LDS Ordinances? (1=yes 0=no) */
49
global(html_index) /* put HTML <ISINDEX> tag in INDEX file (1=yes 0=no) */
55
call set_static_html_globals()
58
print("Reading data...\n")
60
addtoset(out_set, j, n)
63
call html_out(out_set)
66
proc set_static_html_globals(){
67
/* customize these globals to customize the output to your site */
68
set(db_owner, getproperty("user.fullname"))
69
set(owner_addr, getproperty("user.email"))
70
set(genweb_image, getproperty("genweb.image"))
71
set(genweb_page, getproperty("genweb.page"))
72
set(page_name, getproperty("genweb.page_name")) /* might change to "my homepage" */
73
set(LDS, getproperty("genweb.isLDS"))
74
set(html_index, getproperty("genweb.add_index")) /* use 1 to add <ISINDEX> to INDEX file */
78
set(s, concat("There are ", d(lengthset(o)),
79
" people in your list, how many per file?"))
81
set(per_file, atoi(a))
87
set(href_table, init_href(o))
88
forindiset(o, i, j, n) {
90
if(eq(loop_count, 0)) {
92
call write_head(file_count)
95
call genhtml(indi, o, href_table)
96
if(or(eq(loop_count, per_file), eq(n, lengthset(o)))) {
102
call do_index(o, href_table)
106
proc write_head(count) {
107
set(filename, concat("genweb/", database(), "/genweb_", d(count), ".html"))
108
print("Writing ", filename, "\n")
113
".html </TITLE>\n" "</HEAD><BODY>\n"
117
"\" ALT = \"\"><BR><BR>\n"
122
"<BR><HR><ADDRESS>\n"
125
"Database maintained by "
126
"<A HREF=\"" owner_addr "\">\n"
132
proc genhtml (i, o, href_table) {
133
/* print(" ", fullname(i,0,1,300), "\n") */
146
set(path, get_picture(i))
149
if(nestr(lower(trim(path, 4)), "http")) {
150
if(nestr(lower(trim(path, 3)), "ftp")) {
151
if(nestr(lower(trim(path, 5)), "file:")) {
152
if(nestr(lower(trim(path, 6)), "gopher")) {
159
"\" ALT = \"\"><BR><BR>\n"
163
"<EM>Born</EM> : " long(e) "<BR>\n"
166
"<EM>Baptised</EM> : " long(e) "<BR>\n"
169
"<EM>Baptised</EM> : " long(e) "<BR>\n"
172
"<EM>Died</EM> : " long(e) "<BR>\n"
175
"<EM>Buried</EM> : " long(e) "<BR> \n"
180
fornodes(inode(i), node) {
181
if (eq(0, strcmp(tag(node), "BAPL"))) {
184
"<BR>LDS Ordinances: B "
187
/* determine if endowed */
188
if (eq(0, strcmp(tag(node), "ENDL"))) {
191
"<BR>LDS Ordinances: "
196
/* determine if sealed to parents */
197
set(fam, fnode(parents(i)))
200
fornodes(fam, node) {
201
if(and(eqstr("CHIL", tag(node)), eqstr(xref(ind), value(node)))) {
202
fornodes(node, next) {
203
if(eqstr(tag(next), "SLGC")) {
206
"<BR>LDS Ordinances: "
223
"<EM>" "Father</EM> : "
224
set (path, get_href(p, href_table))
232
if (t,title(p)) {t " "}
239
"<EM>" "Mother</EM> : "
240
set (path, get_href(p, href_table))
248
if (t,title(p)) {t " "}
254
families(i, f, s, n) {
256
if (gt(nfamilies(i), 1)) {
261
if (s) { /* family has a spouse */
262
set (path, get_href(s, href_table))
270
if (t,title(s)) {t " "}
276
if (e, marriage(f)) {
281
if (e, divorced(f)) {
287
fornodes(fnode(f), node) {
288
if (eq(0, strcmp(tag(node), "SLGS"))) {
289
"<BR>LDS Ordinances: SS\n"
296
set (path, get_href(c, href_table))
304
if (t,title(c)) {t " "}
315
/* Insert code here for Pedigree and Descendant charts
317
"Pedigree Chart<BR>\n"
321
families(i, f, s, n) {
333
"[<A HREF=\"INDEX.html\">"
334
"Index to database</A>]<BR>\n"
336
"[<A HREF=\"" genweb_page "\">"
344
func init_href(outset){
347
forindiset(outset, indi, j, number) {
348
insert(href_table, save(key(indi)), number)
353
func get_href(indi, href_table) {
356
set(value, lookup(href_table, key(indi)))
358
set(number, add(div(sub(value, 1), per_file), 1))
359
set(path, concat("genweb_", d(number), ".html"))
365
proc print_notes(indi){
367
traverse(inode(indi), node, l) {
368
if (not(strcmp("NOTE", tag(node)))) {
370
"<EM>Notes</EM> : <BR>\n"
377
fornodes(node, next) {
386
proc show_path (node){
389
push(path, tag(node))
390
set(node, parent(node))
393
while (s, pop(path)) {
394
if(eqstr(lower(s), "indi")){
396
}elsif(eqstr(lower(s), "fam")){
398
}elsif(eqstr(lower(s), "famc")){
400
}elsif(eqstr(lower(s), "fams")){
402
}elsif(eqstr(lower(s), "note")){
404
}elsif(eqstr(lower(s), "birt")){
406
}elsif(eqstr(lower(s), "deat")){
408
}elsif(eqstr(lower(s), "buri")){
410
}elsif(eqstr(lower(s), "plac")){
420
proc do_index(indi_set, href_table) {
421
set(last_surname, "ZZ")
427
print("Writing INDEX.html\n")
428
call create_index_file(index, href_table)
429
print("Writing GENDEX.txt\n")
430
call create_gendex_file(index, href_table)
433
proc create_gendex_file(index, href_table) {
434
set(fn, save(concat("genweb/", database(), "/GENDEX.txt")))
436
forindiset(index, me, v, n)
438
set(path, concat(save(get_href(me, href_table)), "#", key(me)))
446
if (evt, birth(me)) {
450
if (evt, birth(me)) {
454
if (evt, death(me)) {
458
if (evt, death(me)) {
465
proc create_index_file(index, href_table) {
466
set(fn, save(concat("genweb/", database(), "/INDEX.html")))
468
call html_header("Interactive Genealogical Server Index", html_index)
473
"\" ALT = \"\"><BR><BR>\n"
477
forindiset(index, me, v, n)
479
call href(me, href_table)
486
proc href(me, href_table) {
488
call print_name(me, 1)
489
if(ne(strcmp(upper(surname(me)), last_surname), 0)) {
490
print(" ", upper(surname(me)), "\n")
491
set(last_surname, save(upper(surname(me))))
492
"<A NAME=" qt() last_surname qt() "></A>\n"
495
set (path, get_href(me, href_table))
511
proc html_header(str, isindex) {
523
proc print_name (me, last) {
526
push(RVAL, save(concat(fullname(me, 1, not(last), 45), junk)))
529
proc get_title (me) {
530
fornodes(inode(me), node) {
531
if (not(strcmp("TITL", tag(node)))) {
536
push(RVAL, save(concat(" ", value(n))))
550
elsif (lt(n, 1000)) {
553
elsif (lt(n, 10000)) {
560
set(pad, save( trim(" ", sub(w, d))))
565
push(RVAL, save( concat(pad, save(d(n)))))
568
proc othernames(indi){
571
fornodes(inode(indi), subnode){
572
if(eqstr(tag(subnode), "NAME")){
575
"<BR><EM>Other Names</EM>: \n<UL>"
577
call nameval(subnode)
579
}elsif(gt(count, 2)){
581
call nameval(subnode)
594
fornodes(inode(indi), subnode){
595
if(eqstr(tag(subnode), "AFN")){
604
proc nameval(namenode){
606
extractnames(namenode, np, nc, sc)
613
proc print_html(indi){
614
fornodes(inode(indi), node) {
615
if (eqstr("REPORT", tag(node))) {
617
if (eqstr("TYPE", tag(m))) {
618
if (eqstr("HTML", value(m))) {
621
if (eqstr("DATA", tag(o))) {
628
if (eqstr("HTML-STATIC", value(m))) {
631
if (eqstr("DATA", tag(o))) {
644
fornodes(fnode(fam), node) {
645
if (eq(0, strcmp(tag(node), "DIV"))) {