| 1 |
/* |
| 2 |
* @progname cgi_html.li |
| 3 |
* @version 1.4 |
| 4 |
* @author Scott McGee ([email protected]) |
| 5 |
* @category |
| 6 |
* @output HTML |
| 7 |
* @description |
| 8 |
|
| 9 |
This is a library of CGI based functions and data used by a variety of |
| 10 |
CGI GenWeb programs. It also provides all needed customizing data in one |
| 11 |
file to allow easy customization of the genweb CGI system to a new site. |
| 12 |
|
| 13 |
The proc set_cgi_globals() should be called early in programs using this |
| 14 |
library, before any other calls to its code are made. This proc sets the |
| 15 |
customization globals. |
| 16 |
|
| 17 |
The do_head() proc will output the header info for the html files. The |
| 18 |
input parameters are the individual for whom the file is generated, and the |
| 19 |
title string which would usually be Pedigree, Descendant, or Individual to |
| 20 |
indicate the type of file produced. |
| 21 |
|
| 22 |
The do_tail() proc is similar but writes the trailer info or the html file. |
| 23 |
It too requires you to pass the indi for whom the file is generated. |
| 24 |
|
| 25 |
The href() function will return a string containing an anchor linking to |
| 26 |
the indi specified as an input parameter and (via CGI) returning the type |
| 27 |
of report specified in the second (type) parameter. This type must be one |
| 28 |
of Pedigree, Descendant, or Lookup (for individual page). |
| 29 |
|
| 30 |
@(#)cgi_html.li 1.4 10/13/95 |
| 31 |
*/ |
| 32 |
|
| 33 |
/* customization globals */ |
| 34 |
global(db_owner) /* name of database owner */ |
| 35 |
global(owner_addr) /* URL of database owner (mailto or homepage) */ |
| 36 |
global(use_image) /* flag to indicate whether to use GenWeb image */ |
| 37 |
global(genweb_image) /* name of GenWeb image to place on each page */ |
| 38 |
global(use_page) /* flag to add link to GenWeb page or homepage */ |
| 39 |
global(genweb_page) /* URL of base GenWeb (or homepage) web page */ |
| 40 |
global(page_name) /* name of base GenWeb (or homepage) web page */ |
| 41 |
global(cgi_script) /* URL of base CGI script */ |
| 42 |
global(index_url) /* base URL of database index files */ |
| 43 |
global(localhost) /* base URL for locally hosted files */ |
| 44 |
|
| 45 |
/* other globals */ |
| 46 |
global(is_indi_html) /* signals if report generates an indi HTML file */ |
| 47 |
|
| 48 |
|
| 49 |
/*************************************************************************** |
| 50 |
* This function is used to initialize all the site specific customization * |
| 51 |
* globals. This should be the only part of the entire GenWeb CGI system * |
| 52 |
* that needed editing to install on a new site. * |
| 53 |
**************************************************************************/ |
| 54 |
proc set_cgi_html_globals(){ |
| 55 |
/* customize these globals to customize the output to your site */ |
| 56 |
set(db_owner, getproperty("user.fullname")) |
| 57 |
set(owner_addr, getproperty("user.email")) |
| 58 |
set(use_image, 1) /* 1 to use image, 0 to not use image */ |
| 59 |
set(genweb_image, "http://www.emcee.com/~smcgee/pics/genweb.gif") |
| 60 |
set(use_page, 1) /* 1 to use link to page, 0 if not */ |
| 61 |
set(genweb_page, "http://www.emcee.com/~smcgee/genweb/genweb.html") |
| 62 |
set(page_name, "GenWeb page") /* might change to "my homepage" */ |
| 63 |
set(cgi_script, "http://www.emcee.com/~smcgee/cgi-bin/genweb.cgi") |
| 64 |
set(index_url, concat("http://www.emcee.com/~smcgee/genweb/", |
| 65 |
save(database()), "_idx.html")) |
| 66 |
set(localhost, "http://www.emcee.com/") |
| 67 |
|
| 68 |
set(is_indi_html, 0) /* default to non-indi HTML report */ |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
/************************************************************************** |
| 73 |
* do_chart_head() - this function writes the common header portion of an * |
| 74 |
* HTML file. It specifies the chart type in both the <TITLE> and in a * |
| 75 |
* header (<H3>) line along with the name of the individual. * |
| 76 |
*************************************************************************/ |
| 77 |
proc do_chart_head(indi, title){ |
| 78 |
"<HTML><HEAD>\n" |
| 79 |
"<TITLE>" |
| 80 |
name(indi,0) |
| 81 |
" : " |
| 82 |
title |
| 83 |
" Chart" |
| 84 |
"</TITLE>\n" |
| 85 |
"</HEAD><BODY>\n" |
| 86 |
if(use_image){ |
| 87 |
"<IMG SRC=\"" |
| 88 |
genweb_image |
| 89 |
"\" ALT = \"\"><BR><BR>\n" |
| 90 |
} |
| 91 |
"<H1>" |
| 92 |
givens(indi) |
| 93 |
" " |
| 94 |
surname(indi) |
| 95 |
" - " |
| 96 |
title |
| 97 |
" Chart</H1>\n" |
| 98 |
} |
| 99 |
|
| 100 |
|
| 101 |
/*************************************************************************** |
| 102 |
* do_tail() - this function writes the common trailer portion of the HTML * |
| 103 |
* file. * |
| 104 |
**************************************************************************/ |
| 105 |
proc do_tail(indi){ |
| 106 |
"<HR>\n" |
| 107 |
"<BR>\n" |
| 108 |
if(eq(is_indi_html, 0)){ /* do this stuff only for non-indi HTML reports */ |
| 109 |
"[<A HREF=\"" |
| 110 |
cgi_script |
| 111 |
"/DB=" |
| 112 |
database() |
| 113 |
"/INDEX=" |
| 114 |
key(indi) |
| 115 |
"/?LookupInternal\">" |
| 116 |
"Back to Individual Page</A>]<BR>" |
| 117 |
} |
| 118 |
"[<A HREF=\"" |
| 119 |
index_url |
| 120 |
"\">" |
| 121 |
"Index to database</A>]<BR>\n" |
| 122 |
if(use_page){ |
| 123 |
"[<A HREF=\"" |
| 124 |
genweb_page |
| 125 |
"\">" |
| 126 |
"Return to GenWeb page</A>]<BR> \n" |
| 127 |
} |
| 128 |
"<BR><HR><BR>\n" |
| 129 |
"HTML files created on demand by \n" |
| 130 |
"<A HREF=\"http://www.emcee.com/~smcgee/lifelines.html\">\n" |
| 131 |
"LifeLines</A>, a genealogical database program by \n" |
| 132 |
"<A HREF=\"mailto:[email protected]\">\n" |
| 133 |
"Thomas Wetmore</A>!\n" |
| 134 |
"<BR><ADDRESS>\n" |
| 135 |
"Database maintained by \n" |
| 136 |
"<A HREF=\"" |
| 137 |
owner_addr |
| 138 |
"\">\n" |
| 139 |
db_owner |
| 140 |
"</A>" |
| 141 |
"<BR>\n" |
| 142 |
"Report generated " |
| 143 |
date(gettoday()) |
| 144 |
"</ADDRESS>\n" |
| 145 |
"</BODY></HTML>\n" |
| 146 |
} |
| 147 |
|
| 148 |
|
| 149 |
/*********************************************************************** |
| 150 |
* href() - this function will return a string with an anchor of the * |
| 151 |
* specified type. Currently supported types are "Lookup", "Pedigree", * |
| 152 |
* and "Descendant". * |
| 153 |
**********************************************************************/ |
| 154 |
func href(indi, type){ |
| 155 |
"<A HREF=\"" |
| 156 |
cgi_script |
| 157 |
"/DB=" |
| 158 |
database() |
| 159 |
"/INDEX=" |
| 160 |
key(indi) |
| 161 |
"/?" |
| 162 |
type |
| 163 |
"Internal\">" |
| 164 |
if(is_indi_html){ |
| 165 |
if(t, title(indi)){ |
| 166 |
t |
| 167 |
" " |
| 168 |
} |
| 169 |
fullname(indi,0,1,50) |
| 170 |
}else{ |
| 171 |
fullname(indi,1,1,30) |
| 172 |
} |
| 173 |
"</a>" |
| 174 |
} |