GetBioghistTocHead
From DLXS Documentation
Back to Changing the Bioghist labels
DemofaFC::GetBioghistTocHead
This is a replacement for the base FindaidClass GetBioghistTocHead which uses the first <head> element in the <bioghist> for the Table of Contents and region labels for the <bioghist> instead of the Bentley practice of relying on the label attribute of the <archdesc> to determine the label for the <bioghist> See $DLXSROOT/cgi/f/findaid/FindaidClass/DemofaFC.pm for the full code.
#---------------------------------------------------------------------- # # Replacement to use <head> within Biohist for label # ---------------------------------------------------------------------- # NAME : GetBioghistTocHead # PURPOSE : # CALLS : # INPUT : # RETURNS : # GLOBALS : # SIDE-EFFECTS : # NOTES : The original code in the base class uses a query based on the encoding # practice of the Bentley Historical Library at the University of # Michigan. Though the distinction between # "collections" (papers of indiviudals) and "records" or "record group" # (records of organizations) is an archival distinction, the use of the # archdesc attribute to determine the label is probably a BHL idiosyncracy. # Our practice goes back to early discussions that whenever possible the # system / stylesheet should supply standard headings. # Most libraries probably hard code a <head>, in which case it would be necessary to # overide this method in as is done in the example subclass below. # ---------------------------------------------------------------------- sub GetBioghistTocHead { my $self = shift; my ( $cgi ) = @_; my $headText = ''; $headText = $self->GetSelfKeyInfo( 'bioghistheader' ); if ( $headText ) { return $headText; } my $tocheadsHashRef = $self->GetSelfKeyInfo( 'tocheads' ); # get properly idno properly formatted for query my $idno = ( $cgi->param( 'idno' ) || $cgi->param( 'didno' ) ); $idno = $self->GetQueryFactory()->pat50TruncationHandler( $idno ); # get region in which to look for idno my $idnoRgn; my $tm = $self->GetTermMapper( ); ASSERT( $idnoRgn = $tm->map( 'IDNO', 'synthetic', 'native' ), qq{ID not defined in map: } . $tm->GetMapfileName() ); my $xpat = $self->FindXPatContainingIdno( $idno ); #Modifications to the base class version start here. # Instead of the query that looked for the "level" attribute of the <archdesc> # we use a query to get the first <head> within <bioghist> # If it is not found we use the default label in the tocheads above. # subset1.1 to get the first head in case there are more than one? my $query = qq{pr.region."head" subset.1.1 (region "head" within (region "bioghist" within (region main incl ( $idnoRgn incl $idno )) ));}; my ( $error, $head ) = $xpat->GetSimpleResultsFromQuery( $query ); &DlpsUtils::StripAllRSetCruft( \$head ); if ($head) { $headText="$head"; } else { #use default $headText = $$tocheadsHashRef{ 'bioghist-t' }; } $self->{ 'bioghistheader' } = $headText; return $headText; }