| 1 |
/* |
| 2 |
* @progname index_html.ll |
| 3 |
* @version 1.3 |
| 4 |
* @author Scott McGee ([email protected]) |
| 5 |
* @category |
| 6 |
* @output HTML |
| 7 |
* @description |
| 8 |
|
| 9 |
This report program converts a LifeLines database into html index document. |
| 10 |
You will need to change the contents of proc html_address() and to |
| 11 |
set the value of HREF appropriately to your server. |
| 12 |
You need to set the value of PATH to point to the directory to put |
| 13 |
the file into. |
| 14 |
You also need to set the value of HOST to be the http server and |
| 15 |
path where you will server these files from. |
| 16 |
|
| 17 |
@(#)index_html.ll 1.3 10/14/95 |
| 18 |
by Scott McGee ([email protected]) |
| 19 |
|
| 20 |
*/ |
| 21 |
|
| 22 |
global(INDEX) |
| 23 |
global(HREF) |
| 24 |
global(PATH) |
| 25 |
global(RVAL) |
| 26 |
global(FB) |
| 27 |
global(nl) |
| 28 |
global(last_surname) |
| 29 |
global(name_count) |
| 30 |
global(surname_count) |
| 31 |
global(owner_email) |
| 32 |
global(db_owner) |
| 33 |
|
| 34 |
proc main() |
| 35 |
{ |
| 36 |
set(db_owner, getproperty("user.fullname")) |
| 37 |
set(owner_email, getproperty("user.email")) |
| 38 |
set(FB, 0) |
| 39 |
set(nl, nl()) |
| 40 |
set(last_surname, "ZZ") |
| 41 |
list(RVAL) |
| 42 |
indiset(INDEX) |
| 43 |
set(PATH, "/users/smcgee/www/") |
| 44 |
set(HOST, "http://www.emcee.com") |
| 45 |
set(HREF, concat( |
| 46 |
"http://www.emcee.com/~smcgee/cgi-bin/genweb_cgi/DB=", |
| 47 |
database(), |
| 48 |
"/INDEX=")) |
| 49 |
print("processing database\n") |
| 50 |
set(count, 0) |
| 51 |
forindi(me,num) |
| 52 |
{ |
| 53 |
if(eq(count, 100)){ |
| 54 |
set(count, 0) |
| 55 |
print(".") |
| 56 |
}else{ |
| 57 |
incr(count) |
| 58 |
} |
| 59 |
addtoset(INDEX,me,1) |
| 60 |
} |
| 61 |
print("\nwriting file\n") |
| 62 |
set(name_count, 0) |
| 63 |
set(surname_count, 0) |
| 64 |
call create_index_file() |
| 65 |
print("\n", d(name_count), " individuals, ", d(surname_count), " surnames\n") |
| 66 |
} |
| 67 |
|
| 68 |
proc create_index_file() |
| 69 |
{ |
| 70 |
namesort(INDEX) |
| 71 |
set(fn, save(concat(PATH, concat("genweb/", database(), "_idx.html")))) |
| 72 |
newfile(fn, FB) |
| 73 |
call html_header(0) |
| 74 |
"<BODY>" nl |
| 75 |
"<IMG SRC=\"http://www.emcee.com/~smcgee/pics/genweb.gif\" ALT = \"\"><BR><BR>\n" |
| 76 |
"<H1> INDEX </H1>" nl |
| 77 |
"<UL>" nl |
| 78 |
forindiset(INDEX, me, v, n) |
| 79 |
{ |
| 80 |
call href(me) nl |
| 81 |
} |
| 82 |
"</UL>" nl |
| 83 |
call html_address() |
| 84 |
"</BODY>" nl |
| 85 |
"</HTML>" nl |
| 86 |
} |
| 87 |
|
| 88 |
proc href(me) |
| 89 |
{ |
| 90 |
if(me) |
| 91 |
{ |
| 92 |
call print_name(me, 1) |
| 93 |
incr(name_count) |
| 94 |
if(ne(strcmp(surname(me), last_surname), 0)){ |
| 95 |
incr(surname_count) |
| 96 |
print(surname(me)) |
| 97 |
print("\n") |
| 98 |
set(last_surname, save(surname(me))) |
| 99 |
"<A NAME=" qt() last_surname qt() "></A>\n" |
| 100 |
} |
| 101 |
"<LI><A HREF=" qt() HREF key(me) "?LookupInternal" qt() ">\n" |
| 102 |
pop(RVAL) |
| 103 |
"</A> -" |
| 104 |
if (evt, birth(me)) { |
| 105 |
" born " |
| 106 |
short(evt) |
| 107 |
} |
| 108 |
else { |
| 109 |
if (evt, baptism(me)) { |
| 110 |
" baptised " |
| 111 |
short(evt) |
| 112 |
} |
| 113 |
else { |
| 114 |
if (evt, bapt(me)) { |
| 115 |
" baptised " |
| 116 |
short(evt) |
| 117 |
} |
| 118 |
} |
| 119 |
} |
| 120 |
if (evt, death(me)) { |
| 121 |
" died " |
| 122 |
short(evt) |
| 123 |
} |
| 124 |
} |
| 125 |
} |
| 126 |
proc html_header(isindex) |
| 127 |
{ |
| 128 |
"<HTML>" nl |
| 129 |
"<HEAD>" nl |
| 130 |
"<LINK rev=\"made\" HREF=\"mailto:" owner_email "\">" |
| 131 |
if(isindex) { "<ISINDEX>" nl } |
| 132 |
"<TITLE>Index of database - " |
| 133 |
database() |
| 134 |
"</TITLE>" nl |
| 135 |
"</HEAD>" nl |
| 136 |
} |
| 137 |
|
| 138 |
proc html_address() |
| 139 |
{ |
| 140 |
"<HR>" nl |
| 141 |
"<ADDRESS>Last update : " |
| 142 |
date(gettoday()) |
| 143 |
"<br>" db_owner " // " owner_email " </ADDRESS>" nl |
| 144 |
} |
| 145 |
|
| 146 |
proc print_name (me, last) |
| 147 |
{ |
| 148 |
call get_title(me) |
| 149 |
set(junk, pop(RVAL)) |
| 150 |
push(RVAL, save(concat(fullname(me, 0, not(last), 45), junk))) |
| 151 |
} |
| 152 |
|
| 153 |
proc get_title (me) |
| 154 |
{ |
| 155 |
fornodes(inode(me), node) |
| 156 |
{ |
| 157 |
if (not(strcmp("TITL", tag(node)))) { set(n, node) } |
| 158 |
} |
| 159 |
if (n) { push(RVAL, save(concat(" ", value(n)))) } |
| 160 |
else { push(RVAL, "") } |
| 161 |
} |
| 162 |
|
| 163 |
proc rjt(n, w) |
| 164 |
{ |
| 165 |
if (lt(n, 10)) { set(d, 1) } |
| 166 |
elsif (lt(n, 100)) { set(d, 2) } |
| 167 |
elsif (lt(n, 1000)) { set(d, 3) } |
| 168 |
elsif (lt(n, 10000)) { set(d, 4) } |
| 169 |
else { set(d, 5) } |
| 170 |
if (lt(d, w)) |
| 171 |
{ set(pad, save( trim(" ", sub(w, d)))) } |
| 172 |
else |
| 173 |
{ set(pad, "") } |
| 174 |
push(RVAL, save( concat(pad, save(d(n))))) |
| 175 |
} |
| 176 |
func bapt (indi) { |
| 177 |
fornodes(inode(indi), node) { |
| 178 |
if (eq(0, strcmp(tag(node), "BAPL"))) { |
| 179 |
return(node) |
| 180 |
} |
| 181 |
if (eq(0, strcmp(tag(node), "BAPM"))) { |
| 182 |
return(node) |
| 183 |
} |
| 184 |
} |
| 185 |
return(0) |
| 186 |
} |