This version of Lookup allows the use of either YAZ or SRU.  And you can swap at
any time via Admin screen settings. But if you want to use YAZ, you will have to
add it to your PHP on the server; SRU does not require any such addition but has
perfrmance issues. (See step #5 below for YAZ installation info.) Be sure to
read through all the steps below. There have been many changes from previous
versions.

##############################################################################
## Open Biblio Modifications #################################################
##############################################################################
The following modifications must be made to your copy of OpenBiblio to support
Lookup and possible future add-ons/plug-ins. These may be only a one time
modification to OpenBiblio. Future versions of OpenBiblio may include them.
 
 .........
  a.  Using 'cut & Paste, add the following to the end of file
 .........
	'\openbiblio\shared\common.php'.
  ###################################################################
  ## plugin Support
  ###################################################################
  function getPlugIns($wanted) {
		clearstatcache();
		$lists = array();
  	if (is_dir('../plugins')) {
			//echo "Plugin Dir found: <br />";
  	  ## find all plugin directories
			if ($dirHndl = opendir('../plugins')) {
		    # look at all plugin dirs
		    while (false !== ($plug = readdir($dirHndl))) {
		      if (($plug == '.') || ($plug == '..')) continue;
  	      //echo "plugin => $plug<br />";
  	      $plugPath = "../plugins/$plug";
  	      if (is_dir($plugPath)) {
						if ($filHndl = opendir($plugPath)) {
		    			while (false !== ($file = readdir($filHndl))) {
		    			  if (($file == '.') || ($file == '..')) continue;
  	      			//echo "file => $file<br />";
  	      			if ($file == $wanted) $list[] = "../plugins/$plugPath/$file";
  	      		}
  	      		closedir($filHndl);
						}
					}
  		  }
  		  closedir($dirHndl);
			}
		}
		return $list;
	}

 .........
 b. Using 'cut & Paste, add the following to the end of files
 .........
	'\openbiblio\navbars\admin.php' and '\openbiblio\navbars\cataloging.php'.
	(note. Change the 'admin.nav' to 'cataloging.nav' for the second file.)
	<?php
	$list = getPlugIns('admin.nav');
	for ($x=0; $x<count($list); $x++) {
		include_once ($list[$x]);
	}
	?>

 .........
 c. Using 'cut & Paste, modify file "..\classes\Localize.php to read as:
 .........
  function Localize ($locale, $section) {
    $localePath = "../locale/".$locale."/".$section.".php";
    include($localePath);
    ## ##################################
    ## adds suport for plugins - fl, 2009
    ## ##################################
		$list = getPlugIns($section.'.tran');
		for ($x=0; $x<count($list); $x++) {
			include($list[$x]);
		}
    ## ##################################
    $this->_trans = $trans;
    return true;
  }

 .........
 d. Go to file ".../shared/header_top.php" and find the line for "</head>". Insert
	the following just above it as shown:
 .........
	</script>
	<?php
	## ---------------------------------------------------------------------
	## --- added for Fred LaPlante's Lookup Function -----------------------
	if (file_exists('customHead.php')) {
		include ('customHead.php');
	}
	## ---------------------------------------------------------------------
	?>
	</head>

 .........
 e. Go to file ".../shared/common.php" and find the line for
 '# Escaping shorthands', Insert the following just above it as shown below:
 .........
	/* Work around PHP's braindead include_path stuff. */
	function REL($sf, $if) {
		return dirname($sf)."/".$if;
	}

  # Escaping shorthands

 .........
 f. Go to file ".../catalog/inputFuncs.php". find the lines containing
    "($cntrlType == OBIB_TEXTAREA_CNTRL)" and change the lines following  as shown
    here:
 .........
  if ($cntrlType == OBIB_TEXTAREA_CNTRL) {
    ## lookup mods - June 2009
    //echo "<textarea name=\"values[".H($formIndex)."]\"";
    //echo " cols=\"".H($cols)."\" rows=\"".H($rows)."\">\n";
    //echo H($value)."</textarea>";
    $attrs= array('cols'=>H($cols),'rows'=>H($rows));
    echo inputField('textarea', "values[".H($formIndex)."]", H($value), $attrs);
  } else {
    ## lookup mods - June 2009
    //echo "<input type=\"text\"";
    //echo " name=\"values[".H($formIndex)."]\"";
    //echo " size=\"".H($size)."\" maxlength=\"".H($maxLen)."\" ";
    //echo "value=\"".H($value)."\" >\n";
    $attrs= array('size'=>H($size),'maxlength'=>H($maxLen));
    echo inputField('text', "values[".H($formIndex)."]", H($value), $attrs);
  }

 .........
 g. Go to file ".../functions/inputFuncs.php". find the lines containing
		a long complex 'switch' structure.  In there you will find 4 or more
		references like --> name="'.H($name).'"
		Wherever you do, change it to read: id="'.H($name).'" name="'.H($name).'"
 .........

##############################################################################
## Lookup v2 installation ####################################################
##############################################################################

##############################################################################
## Step 1. ###################################################################
##############################################################################
 Extract the following database files files and move them to your openbiblio
   MySQL data directory:

	- 'cutter.MYD', 'cutter.frm', and 'cutter.MYI'
	- 'lookup_settings.MYD', 'lookup_settings.frm', and 'lookup_settings.MYI'
	- 'lookup_hosts.MYD', 'lookup_hosts.frm', and 'lookup_hosts.MYI'

##############################################################################
## Step 2. ###################################################################
##############################################################################
 If it does not already exist, create a new 'lookup2' folder within openbiblio.

 .........
 a.Extract and move all *.php files, *.js and *.txt to the new
 	 '..\openbiblio\lookup2' directory.
 .........
 b. You may remove any of the old 'lookup' files in '..\openbiblio\catalog' from
   previous versions of Lookup, though they will be ignored if you leave them
	 there.
 .........

##############################################################################
## Step 3. ###################################################################
##############################################################################
 This step replaces previous Navigation and translation file changes. It has
 been tested with multiple plugins.

 .........
 a. If it does not already exist, create a new 'plugins' folder within openbiblio.
 .........
 b. If it does not already exist, create a new 'lookup2' folder within 'plugins'.
 .........
 c. Copy the *.nav and *.tran files to this 'lookup2' folder.

##############################################################################
## Step 4. ###################################################################
##############################################################################
 If you would like to have the "new copy" form automatically appear when
	 finished adding new bibliographic data:
 .........
	a. locate the line containing "../shared/biblio_view.php" near line 38 of
	   file "..../catalog/biblio_new.php".
 .........
	b. replace it with the following
  #**************************************************************************
  //------following line auto transfers to new copy form (new function)
  header("Location: ../catalog/biblio_copy_new_form.php?bibid=".$bibid."&msg=".$msg);
  exit();
  #**************************************************************************
 
##############################################################################
## Step 5. ###################################################################
##############################################################################
 YAZ instalation (not required if you only wish to use SRU):
	 The YAZ module provides the MARC Z39.50 protocol support which this
	 application requires to use the YAZ protocol. YAZ is provided with most
	 distributions of PHP, but activation varies.

	 For Windows, things have gotten complicated since PHP5 arrived.
	 The best process to follow is described at
	 http://blog.theburrowfamily.net/2008/09/27/php526-apache-22-and-php_yaz/
	 In effect the process amounts to copying a set of .dll files from a download
	 into your Apache directory.

	 For **NIX installations you will probably have to recompile PHP with
	 appropriate switches.

	 Additional details can be found at http://www.php.net/manual/en/ref.yaz.php
	 as well as at http://www.IndexData.com (the PHP-YAZ author). Also there have
	 been seveal threads on the matter at the OpneBiblio help forum.

	 After activating YAZ, be sure to stop and restart the Web Server (usually Apache).

	 Failure to activate YAZ, usually shows up as a blank screen after attempting
	 a search. To determine if YAZ has been properly activated, look at the
	 phpinfo.php page with your browser.  Bring up the page and search for YAZ.
	 If not found, its not active.

	 note: Some PHP distributions make finding the correct version of php.ini dificult,
	 but its location is shown in phpinfo.

##############################################################################
## Step 6. ##################################################################
##############################################################################
   Configuration is done through the Lookup Opts and Lookup Hosts selections on
	 the Admin Page. Go there and make appropriate changes and selections. I have
	 provided data for those hosts that are known to me. Feel free to modify or
	 add to the list as you wish.
	 (Thanks to Peter Zweck for the National Library of Australia link).
	 (Thanks to Christoph Lange of Germany for the GVK link).

##############################################################################
## Step 7. ##################################################################
##############################################################################
  Useage suggestions or comments:
- In the event of problems with first time use, be sure to check your
	directory names for correct case and spelling. Email me for help if needed.
- In the event of trouble installing YAZ, I suggest trying the newer SRU protocol
	if your Z39.50 server supports it.
- The LC cutter mechanism used may be too crude for all but the smallest libraries. 
  Cutter - Sanborn 3-digit table duplicates the standard published texts.
- Author names must be in the form of: surname, given name (i.e. LaPlante, Fred).
- Some title and author searches may result in many seemingly unrelated hits.  
  Using the author's full name, rather than last name only, may correct this.
- Remote servers may timeout with no visible information. As suggested on the
	'Patience' screen, use of the F5 button usually results in success.
	
Fred LaPlante
flaplante at flos-inc dot com

