<commit_before>package Collections;

use strict;

## sub createTimePlaceString($hash_ref)
#
#    description:  Creates a string representing the time and place for
#		   the collection
#
#    parameters:   $hash_ref is a reference to a hash which is a row of
#				   			 collection data.
#		   		   $class is the CSS class attribute for the size of the text
#
#    returns:	   the 'time - place' string.
##
sub createTimePlaceString{
    my $data_hash = shift;
    my $dbt = shift;
    my $class = shift or "tiny";

    my $timeplace = "";
#   my @timeterms = ( "locage", "intage", "epoch", "period" );

#   for my $tt (@timeterms){
#       if (!$timeplace){
#	    $timeplace = $data_hash->{$tt."_max"};
#	    if ( $data_hash->{$tt."_min"} && $data_hash->{$tt."_min"} ne $data_hash->{$tt."_max"} ){
#		# string could still be empty from missing the previous tt.
#		if($timeplace ne ""){
#		    $timeplace .= "/" . $data_hash->{$tt."_min"};
#		}
#		else{
#		    $timeplace = $data_hash->{$tt."_min"};
#		}
#	    }
#	}
#	if($timeplace){
#	    last;
#	}
#   }

    my $isql = "SELECT eml_interval,interval_name FROM intervals WHERE interval_no=" . $data_hash->{"max_interval_no"};
    my $intref = @{$dbt->getData($isql)}[0];
    my $interval_name = $intref->{'interval_name'};
    if ( $intref->{'eml_interval'} )	{
      $interval_name = $intref->{'eml_interval'} . " " . $interval_name;
    }
	
	my $interval_name2;
	
    my $isql = "SELECT eml_interval,interval_name FROM intervals WHERE interval_no=" . $data_hash->{"min_interval_no"};
    $intref =  @{$dbt->getData($isql)}[0];
    if ( $intref )	{
		$interval_name2 = $intref->{interval_name};
		if ( $intref->{'eml_interval'} )	{
			$interval_name2 = $intref->{'eml_interval'} . " " . $interval_name2;
		}
    }

    $timeplace .= $interval_name;
    if ( $interval_name2 )	{
    	$timeplace .= " - " . $interval_name2;
    }

    $timeplace .= "</span></td><td align=\"middle\" valign=\"top\"><span class=tiny>";

    $data_hash->{"country"} =~ s/ /&nbsp;/;
    $timeplace .= $data_hash->{"country"};
    if($data_hash->{"state"}){
	$data_hash->{"state"} =~ s/ /&nbsp;/;
	$timeplace = $timeplace . " (" . $data_hash->{"state"} . ")";
    }

    $timeplace = "</b> <span class=$class>" . $timeplace . "</span>\n";

    return $timeplace;
}

sub createCollectionDetailLink{
    my $exec_url = shift;
    my $coll_no = shift;
    my $link_text = shift;

    return "<a href=\"$exec_url?action=displayCollectionDetails&".
	   "collection_no=$coll_no\">$link_text</a>";
}

1;
<commit_msg>slight fixes.. considering each of these functions is only used in one place in TaxonInfo, may delete this module later<commit_after>package Collections;

use strict;

## sub createTimePlaceString($hash_ref)
#
#    description:  Creates a string representing the time and place for
#		   the collection
#
#    parameters:   $hash_ref is a reference to a hash which is a row of
#				   			 collection data.
#		   		   $class is the CSS class attribute for the size of the text
#
#    returns:	   the 'time - place' string.
##
sub createTimePlaceString{
    my $data_hash = shift;
    my $dbt = shift;
    my $class = shift;
    if (!$class) { $class = "tiny"; }

    my $timeplace = "";

    my $isql = "SELECT eml_interval,interval_name FROM intervals WHERE interval_no=" . $data_hash->{"max_interval_no"};
    my $intref = @{$dbt->getData($isql)}[0];
    my $interval_name = $intref->{'interval_name'};
    if ( $intref->{'eml_interval'} )	{
      $interval_name = $intref->{'eml_interval'} . " " . $interval_name;
    }
	
	my $interval_name2;
	
    my $isql = "SELECT eml_interval,interval_name FROM intervals WHERE interval_no=" . $data_hash->{"min_interval_no"};
    $intref =  @{$dbt->getData($isql)}[0];
    if ( $intref )	{
		$interval_name2 = $intref->{interval_name};
		if ( $intref->{'eml_interval'} )	{
			$interval_name2 = $intref->{'eml_interval'} . " " . $interval_name2;
		}
    }

    $timeplace = "<span class=\"$class\">";
    
    $timeplace .= $interval_name;
    if ( $interval_name2 )	{
    	$timeplace .= " - " . $interval_name2;
    }

    $timeplace .= "</span></td><td align=\"middle\" valign=\"top\"><span class=\"$class\">";

    $data_hash->{"country"} =~ s/ /&nbsp;/;
    $timeplace .= $data_hash->{"country"};
    if($data_hash->{"state"}){
	    $data_hash->{"state"} =~ s/ /&nbsp;/;
	    $timeplace .= " (" . $data_hash->{"state"} . ")";
    }
    $timeplace .= "</span>\n";

    return $timeplace;
}

sub createCollectionDetailLink{
    my $exec_url = shift;
    my $coll_no = shift;
    my $link_text = shift;

    return "<a href=\"$exec_url?action=displayCollectionDetails&".
	   "collection_no=$coll_no\">$link_text</a>";
}

1;

{'fraction_non_alphanumeric': 0.18601190476190477, 'fraction_numerical': 0.003826530612244898, 'mean_word_length': 3.163716814159292, 'pattern_counts': {'":': 0, '<': 20, '<?xml version=': 0, '>': 56, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5179227', 'n_tokens_mistral': 1736, 'n_tokens_neox': 1677, 'n_words': 365}