/* * @progname cron.ll * @version 4.0 * @author Stephen Dum * @category * @output HTML * @description Generate calendar of birth, death, marriage events arranged by the year, month and day that they occurred. Generates a top level index by year, with actual events stored in a separate html file for each decade. Some properties must be set in your lifelines configuration file for this report to run, see comments at beginning of the report for details. Warning, this report requires lifelines version 3.0.50 or later. by Stephen Dum (stephen.dum@verizon.net) Version 1 March 2003 Version 2 November 2005 Support privitizing data Version 3 December 2005 Do html char set encoding Version 4 June 2006 incorporated mods by Dave Eaton (dwe@arde.com) May 2006 This program was inspired by similar efforts by Mitch Blank (mitch@ctrpnt.com) but without ever seeing the code he used to do a similar thing. The code used in cron.ll is very similar to anniver.ll. Other than the sort order and print out details, the two programs share about 3/4 of their code. Before using, there are a few properties that need to be customized for your own environment so add them to your .linesrc ( or for windows lines.cfg) file. You can also set them on the command line (like -Ianniver.htmldir=/tmp/foo) The properties that are looked up are: user.fullname -- name of the database owner user.email -- email address of the db owner cron.htmldir -- path to the directory to store results in e.g. /home/joe/genealogy/html (program expects a subdir in this directory with the name of the database in it.) cron.backgroundimage -- path to the background image, no image if not defined. e.g. ../../image/crink.jpg this places image at the same level as /home/joe/genealogy/html privatization: This report respects 2 levels of privatization 1. if a record "RESN confidential" exists on an individual they are skipped (as this report is designed to be shared, this seems like a reasonable default) 2. skip anyone estimated to be living History. Version 2 Add code to allow respecting privatized data. Version 3 switch from baptism() to get_baptism() for wider coverage use translation tables to convert data to properly escaped html. This is very codeset dependent. Version 4 added changes by Dave Eaton (dwe@arde.com) These were actually changes to anniver4, but merged here too. Added "firstyear" that events may be on the calendar Added "includedeath" check to drop deaths if those are not desired Added ability to generate report for descendants of more than one individual Added ability to generate report only for living people (omitting confidential if desired) */ /* customization globals */ char_encoding("ASCII") option("explicitvars") global(base_filename) /* where to store the results */ global(background) /* path of background image relative to final html * location, or "" */ global(hi_bg_color) /* highlighted year background color */ global(lo_bg_color) /* non-highlighted year background color */ global(db_owner) /* name of database owner - from config file */ global(owner_email) /* email of database owner - from config file */ global(justliving) /* should we generate a report only for living people? */ global(privatize) /* should we privatize the data * 0 = display all data * 1 = skip confidential records * 2 = skip confidential and living */ global(withkey) /* should we include key's in the output */ global(cutoff_year) /* 100 years before today */ /* birth >= cutoff_year is about 101 years, * and we consider person living */ global(firstyear) /* earliest year for which entries should be included */ global(includedeath) /* if set, then include the death events on the calendar */ global(month_name) /* names of the months */ global(events) /* list of events to print */ global(dates) /* list of dates of the events */ global(keynames) /* name(s) of the key individuals for this report */ proc main () { /* initialization of globals */ set(hi_bg_color,"\"#ddb99f\"") set(lo_bg_color,"\"#e5d3c5\"") set(db_owner, getproperty("user.fullname")) set(owner_email, concat("mailto:",getproperty("user.email"))) set(background,getproperty("cron.backgroundimage")) set(base_filename,concat(getproperty("cron.htmldir"),"/",database(),"/")) if (not(test("d",base_filename))) { print("Error, property cron.htmldir=",base_filename, ", is not a directory,aborting\n") print("Please read comments at beginning of report about setting properties\n") return() } /* other globals*/ list(month_name) enqueue(month_name,"January") enqueue(month_name,"February") enqueue(month_name,"March") enqueue(month_name,"April") enqueue(month_name,"May") enqueue(month_name,"June") enqueue(month_name,"July") enqueue(month_name,"August") enqueue(month_name,"September") enqueue(month_name,"October") enqueue(month_name,"November") enqueue(month_name,"December") extractdate(gettoday(),day,mon,cutoff_year) decr(cutoff_year,100) set(cs,getproperty("codeset")) if (eqstr(cs,"UTF-8")) { set(srccs,"UTF-8") set(dstcs,"UTF-8//html") } elsif (eqstr(cs,"ISO-8859-15")) { set(srccs,"ISO-8859-15//html") set(dstcs,"UTF-8") } else { print("\nDatabase codeset ",cs," not supported, exiting\n") } /* end of initialization of globals */ getint(justliving,"Enter 1 to include only living people, 0 otherwise") if (justliving) { /* Default the choices which conflict with "justliving" */ set(includedeath,0) /* We want living people, so see if we also want confidental */ getint(noconfidential,"Enter 1 to omit confidential living people, 0 otherwise") if (noconfidential) { set(privatize,1) } else { set(privatize,0) } } else { getint(privatize,"\nPrivatization: 0 print all data; 1 skip confidential records; 2 skip confidential and living") getint(includedeath,"Enter 1 to include deaths on calendar, 0 otherwise") } getint(withkey,"Enter 1 to include keys, 0 otherwise") getint(firstyear,"Enter oldest year to be on calendar, 0 for no limit") getindi(person,"Enter person for whom to find descendants (return for all)") indiset(thisgen) indiset(allgen) list(events) list(dates) list(keynames) set(firstpass,1) /* if a person is entered, the generated list of people include * person and spouse, and all the children of either * and then recursively the people, their spouses and all the children * thereof */ if (person) { while (person) { addtoset(thisgen, person, 0) addtoset(allgen, person, 0) print("Computing descendants of ", name(person), " ") enqueue(keynames,concat(name(person))) set(thisgensize,1) set(gen,neg(1)) while(thisgensize) { set(gen,add(gen,1)) print("adding ",d(thisgensize)," individuals for generation ",d(gen),"\n") indiset(spouse) set(spouse,spouseset(thisgen)) set(thisgen,childset(union(thisgen,spouse))) set(allgen,union(allgen,spouse)) set(allgen,union(allgen,thisgen)) set(thisgensize,length(thisgen)) /* the following check prevents looping if the * database has been corrupted and a parent is listed * as a child of that parent, and diagnoses the fault */ if (eq(length(intersect(allgen,thisgen)),thisgensize)) { set(thisgensize,0) print("Warning child is listed as its own parent\n") forindiset(thisgen,indi,val,i) { print (name(indi)," ") } print("\n") } } if (firstpass) { print ("Total of ") set(firstpass,0) } else { print ("New total of ") } print (d(length(allgen))," individuals",nl()) getindi(person,"Enter next person for whom to find descendants") } /* now generate list of events */ forindiset(allgen,indi,val,i) { if (not(mod(i,100))) { print(".") } call add_indi(indi) } print("\n") } else { print("Traversing all individuals ") forindi (indi, val) { if (not(mod(val,100))) { print(".") } call add_indi(indi) set(max,val) } print (nl(), "Total of ",d(max)," individuals",nl()) } print( d(length(dates))," events generated",nl()) print("sorting data") rsort(events,dates) /* Now print out all the data for each year */ print(nl()) list(yearmask) set(lastyear,-1) set(lastmonth,-1) set(lastdecade,-1) set(in_year,0) print( d(length(dates))," events",nl()) while(length(dates)) { set(val,pop(dates)) set(event,pop(events)) set(year,div(val,10000)) set(mon, mod(val,10000)) set(day, mod(mon,100)) set(mon, div(mon,100)) set(decade, div(year,10)) /* print(d(mon),"/",d(day),"/",d(year)," ", event, nl()) debug */ if (ne(lastdecade,decade)) { if (ne(lastdecade,-1)) { if (in_year) { "\n" set(in_year,0) } call write_tail() } call openfile(concat("dec",d(decade)),concat(d(mul(decade,10)), " - ",d(add(mul(decade,10),9))," Events")) set(lastdecade,decade) } if (ne(lastyear,year)) { if (in_year) { "\n" } "
" d(year) "
" nl()
push(yearmask,year)
"
| " "" title "\n" " | " if (srccs) { convertcode(event,srccs,dstcs) } else { event } " | \n" } if (in_year) { "
Click on the year to see the events that occurred in that year.\n" "
| " d(cur_year) "\n | \n" } else { if (or(lt(cur_year,minyear),gt(cur_year,maxyear))) { /* blank out year */ "" nl() } else { /* print year without a link to year page */ " | " d(cur_year) " | " nl() } } incr(cur_year) if (eq(mod(cur_year,10),0)) { "