I was able to modify the theme_biblio_long function to dynamically generate a hyperlink call number relating to where the book would be shelved. Demo: go to each of these links and click on the Call Number hyperlink:
https://www.stanford.edu/group/cubberley/node/329
https://www.stanford.edu/group/cubberley/node/217
https://www.stanford.edu/group/cubberley/node/2019
https://www.stanford.edu/group/cubberley/node/2391
https://www.stanford.edu/group/cubberley/node/2075 )

I'd be happy to share my code for this if there's interest, but it's pretty specialized and tailored to our particular situation (I will post it in this issue once I get a chance to clean it up a touch).

But it got me thinking that it would be a great feature to have a form in the bibio admin interface that creates this functionality based on user input. Whattya think?

Comments

john bickar’s picture

OK, below is the relevant section of code:

function theme_biblio_long($node,$base='biblio',$style='classic') {

/*
*
* <snip>
*
*/

  if ($node->biblio_call_number) {
	$cubb = substr($node->biblio_call_number,0,4);
	if ($cubb == "Cubb") {	//case for Cubberley books
		$cubbref = substr($node->biblio_call_number,0,8);
		if ($cubbref == "Cubb Ref") {	//case for Cubberley Reference books
			$output .= '<h3>'.t("Call Number").':</h3> ' . l(check_plain($node->biblio_call_number),"stacks/reference?size=_original") . "\n";
		} else { //case for Cubberley non-reference books
			$callnumber = substr($node->biblio_call_number,5,3);
			if(is_numeric($callnumber)) { //Case for Deweys
				if ($callnumber >= 372) {
					$output .= '<h3>'.t("Call Number").':</h3> ' . l(check_plain($node->biblio_call_number),"stacks/north_balcony?size=_original") . "\n";
				} else {
					$output .= '<h3>'.t("Call Number").':</h3> ' . l(check_plain($node->biblio_call_number),"stacks/south_balcony?size=_original") . "\n";
				}	
			} else { //Case for LOCs
				$lb = 'LB';
				$lb_split = '1028.5';
				$callnumber = substr($node->biblio_call_number,5,10);
				preg_match_all('/[A-Z]{1,2}|[0-9]{1,4}\.[0-9]{1,3}|[0-9]{1,4}/',$callnumber,$callnumber_array);
/* this ^^^ looks in $callnumber for numeric up to 2 characters (section), numeric up to XXXX.XXX (number w/ decimal), 
*  then numeric up to 4 digits (number non-decimal)
*  then puts all that stuff into $callnumber_array
*/
				$lb_evaluate = strcmp($lb,$callnumber_array[0][0]);
				switch ($lb_evaluate) {//three-case scenario: <LB, >LB, =LB
					case 0:
						if (is_numeric($callnumber_array[0][1])) {
							if ($callnumber_array[0][1] >= $lb_split) { //case for > LB1028.5
								$output .= '<h3>'.t("Call Number").':</h3> ' . l(check_plain($node->biblio_call_number),"stacks/south_stacks?size=_original") . "\n";
							} else { //case for <LB1028.5
								$output .= '<h3>'.t("Call Number").':</h3> ' . l(check_plain($node->biblio_call_number),"stacks/north_stacks?size=_original") . "\n";
							}
						} else {
 					$output .= '<h3>'.t("Call Number").':</h3> ' . check_plain($node->biblio_call_number) . "\n" . $cubb;  //makes non-hyperlinked if the preg_match_all function did not return a numeric value
						}
						break;
					case 1:
						$output .= '<h3>'.t("Call Number").':</h3> ' . l(check_plain($node->biblio_call_number),"stacks/north_stacks?size=_original") . "\n";
						break;
					case -1:
						$output .= '<h3>'.t("Call Number").':</h3> ' . l(check_plain($node->biblio_call_number),"stacks/south_stacks?size=_original") . "\n";
						break;
				}
			}
		}
	} else {
		$output .= '<h3>'.t("Call Number").':</h3> ' . check_plain($node->biblio_call_number) . "\n";  //makes non-Cubberley books non-hyperlinked
	}
  } //end all call number processing

  if ($node->biblio_accession_number) $output .= '<h3>'.t("Accession Number").':</h3> ' . check_plain($node->biblio_accession_number) . "\n";

/*
*
* <snip>
*
*/

  return $output;
}
rjerome’s picture

Indeed this is somewhat specific to your application, but I have been giving some thought to generalizing the linking of various fields (author, title, keyword, publisher, etc.) to other resources. You have some serious logic involved you your case, so I'm not sure how you could capture this in a form, but certainly simpler cases shouldn't be too much of a problem.

By the way, you don't need the call the check_plain() inside your calls to l() since this is done in the l() function anyway.

Ron.

john bickar’s picture

One of the risks of pursuing this would be that of feature bloat. Biblio does what it does well, and trying to turn it into something it's not (e.g., an OPAC) may be barking up the wrong tree. Thanks for giving it some consideration. It's working for me based on the above modifications, so unless there's a general clamor for it, it probably wouldn't be worth the effort.

Thanks for the tip on the l() function. I'm a PHP hack; I typically can do just enough to get something working, so it's good to have knowledgeable input.

janusman’s picture

Shouldn't this be done from another module via hook_nodeapi() ?

"alter": the $node->content array has been rendered, so the node body or teaser is filtered and now contains HTML. This op should only be used when text substitution, filtering, or other raw text operations are necessary.

http://api.drupal.org/api/function/hook_nodeapi/6

Fred.E.Webber’s picture

Title: Hyperlinked call numbers » Hyperlinked call numbers (different than before)

Thanks for all the good work on this module.

I think it would be great to have the call numbers linked to the specific reference that are added to the bottom of the page. The call numbers can be wrapped in a local-referencing hyperlink such as,
<a href="#bib_001"><span hovertip="reference1">[1]</span></a>,
then a "named" anchor can be wrapped around the specific reference, for example,
<a name="bib_001">Study of Impact to Tibiae....</a>

Some of the pages my client has have dozens, sometimes hundreds of references; it can get pretty ugly scanning through all that to find reference #47.

While I'm at it, I'd also like to also suggest that hovering the mouse over the call number could result in a floating window that provides a mini-but-clickable version of the reference. Something like a more advanced version of a "title" attribute to a anchor tag or "help text".

liam morland’s picture

Issue summary: View changes
Status: Active » Closed (outdated)

This version is no longer maintained. If this issue is still relevant to the Drupal 7 version, please re-open and provide details.