[greenstone-devel] Re: Web Library cgi program

From Stefan Boddie
DateFri, 18 Apr 2003 11:26:56 +1200
Subject [greenstone-devel] Re: Web Library cgi program
In-Reply-To (005001c2ffab$736785d0$6701a8c0-dellPC)
Kevin Ollivier wrote:
> Hi all,
> I'm in the process of developing a web-browser
> application for EClass (our e-learning app) that has
> server functionality embedded and would pop up when the
> end user inserts an EClass CD. I'm using Python/wxPython
> to put this together, and have a CGI-capable web server
> (the one in the Python libraries) as the backend. All
> seems to be running fine, however, I hit a snag when
> trying to integrate Greenstone into this. Basically, the
> problem is that Greenstone's library CGI program requires
> gsdlhome to be set to an absolute path in gsdlsite.cfg,
> but I won't know the absolute path until the server has
> been started.
> Is there any way I can have the library accept a relative
> path to gsdlhome and/or determine it's absolute path
> dynamically? If not, where in the library CGI code are
> these values read in? =)

gsdlhome is read in twice.

The first is very early in the main() function in
src/recpt/librarymain.cpp. The line "cservers = new
collectset(gsdlhome);" calls the constructor for the
collectset class (src/colservr/collectset.cpp) which reads
in the gsdlsite.cfg file. It needs to do so here so it can
locate the gsdl/collect directory, find what collections are
available and assign collection servers etc.

The second time gsdlsite.cfg is read is in the cgiwrapper()
function in src/recpt/cgiwrapper.cpp.

Both times gsdlsite.cfg is read by one of the two
site_cfg_read() functions in src/recpt/recptconfig.cpp.
These are the functions you probably need to alter if you
want to try to determine the value of gsdlhome dynamically.

Hope this helps.