# determine audience from the collection, only show if the item is not for general release
my $collection = hcc_getcollectionname($item{collectionid});
if ($collection ne 'Main') {
print ''."\n";
};
if ($item{'district'} or $item{'location'} or $item{'settlement'}) {
my $place = $item{'settlement'};
if (($item{'settlement'} and $item{'settlement'} ne '' ) and ($item{'location'} and $item{'location'} eq '' )) {
$place = $place.', ';
};
$place = $place.$item{'location'};
if (($item{'district'} and $item{'district'} ne '' ) and ($item{'location'} and $item{'location'} ne '' )) {
$place = $place.', ';
};
$place = $place.$item{'district'};
print ''."\n";
} else {
print ''."\n";
};
##Don't show RON name to public (DC.Creator is required by SiteMorse though, so include as just HCC) :
##my $rondetails;
##if ($item{'rontitle'} or $item{'ronorganisation'}) {
## $rondetails = $item{'rontitle'}.', '.$item{'ronorganisation'}.', ';
## print ''."\n";
##};
print ''."\n";
use HTTP::Date;
if ($item{'datecreated'}) {
print ''."\n";
};
print ''."\n";
#CH 25/04/2008: strapline not used here any more:
#my $strapline='';
#if (defined $item{strapline}) {
# # Trim the strapline down to 80 characters :
# $strapline = substr($item{strapline},0,80);
# # and find the last whole word :
# $strapline =~ s/(.*)\s\w+?$/$1/;
# if (length($item{strapline}) > length($strapline)) {
# $strapline=$strapline.'...';
# };
# $strapline=' - '.hcc_string_to_xhtml(fnc_striphtml($strapline));
#};
#FEMG - description built seperately for each item type May 2006
# print ''."\n";
#CH 25/04/2008: don't output DC.Description - we have a normal meta tag description already:
#my $dc_desc = fnc_dc_description();
#if ($dc_desc) {
# print ''."\n";
#};
if ($item{'abstract'}) {
print ''."\n";
};
if ($item{'at_a_glance_xml'}) {
my @entry = split(/<\/page>.*?
Tips and advice on using hertsdirect.
/, /gs;
$line =~ s/
/, /gs;
#CH 25/04/2008: convert HTML tags to a space, not null:
#$line =~ s/<.*?>//gs;
$line =~ s/<.*?>/ /gs;
$line = hcc_string_to_xhtml($line);
return $line;
};
#------------------------------------------------------------------------------------------------------------------------
# keywords function
#---------------------------------------------------------------------------------
# everything that needs to be seached on that isn't shown on the page
sub fnc_keywords {
# build keywords
my $mkeywords;
if ($item{keywords}) {
$mkeywords = $item{keywords}.', ';
};
if ($item{altspell}) {
$mkeywords = $mkeywords.$item{altspell}.', ';
};
if ($item{extrasearchterms}) {
$mkeywords = $mkeywords.$item{extrasearchterms}.', ';
};
if ($item{district}) {
$mkeywords = $mkeywords.$item{district}.', ';
};
if ($item{location} and ($item{itemtypename} ne 'Staff')) {
$mkeywords = $mkeywords.$item{location}.', ';
};
if ($item{settlement}) {
$mkeywords = $mkeywords.$item{settlement}.', ';
};
$mkeywords =~ s/(, )$//; # remove trailing comma
$mkeywords =~ s/,+/,/; # remove duplicate commas
$mkeywords = hcc_string_to_xhtml($mkeywords);
return $mkeywords;
};# description function
#------------------------------------------------------------------------------------------------------------------------
sub fnc_dc_description {
# build best description for each item type - FEMG May 2006
# this function can by used for any view
my $dc_description = "";
my $typename = $item{itemtypename};
if (($typename eq "Article") || ($typename eq "Feature")) {
$dc_description = fnc_descstriphtml($item{'strapline'});
if (length($dc_description) < 40) {
$dc_description = $dc_description.' '.fnc_descstriphtml($item{'bodytxt1'});
}
if (length($dc_description) > 150) {
$dc_description = fnc_shorten($dc_description);
}
}
elsif ($typename eq "Document") {
$dc_description = fnc_shorten(fnc_descstriphtml($item{'abstract'}));
}
elsif ($typename eq "School") {
$dc_description = fnc_descstriphtml($item{'type'}.', '.$item{'address4'});
# $dc_description = fnc_descstriphtml('Address: '.fnc_stripcolons($item{'address1'}).
# '; Town: '.fnc_stripcolons($item{'address4'}).'; Postcode: '.fnc_stripcolons($item{'postcode'}).
# '; Head: '.fnc_stripcolons($item{'headteachersurname'}).'; Phone: '.fnc_stripcolons($item{'phone'}).
# '; Comnet: '.fnc_stripcolons($item{'comnetphone'}).';');
}
# Organisation search results might well be simplified so next few lines are hopefully redundant
# elsif ($typename eq "Organisation") {
# my $org_address = $item{'address1'};
# $org_address =~ s/\n/, /g;
# $dc_description = fnc_shorten($item{summary} || $item{maintext} || $item{Description});
# $dc_description = fnc_descstriphtml('Summary: '.fnc_stripcolons($dc_description).
# '; Name: '.fnc_stripcolons($item{'name1'}).'; Position: '.fnc_stripcolons($item{'position1'}).
# '; Address: '.fnc_stripcolons($org_address).'; Postcode: '.fnc_stripcolons($item{'postcode1'}).
# '; Phone: '.fnc_stripcolons($item{'phone1'}).';');
# }
elsif ($typename eq "Organisation") {
$dc_description = fnc_shorten(fnc_descstriphtml($item{summary} || $item{maintext} || $item{Description}));
}
#CH 25/04/2008: don't do this - NewsBranches do have a description field:
#elsif ($typename eq "Newsbranch") {
# $dc_description = "News and Contents";
#}
elsif ($typename eq "Unit") {
$dc_description = fnc_shorten($dc_description.fnc_descstriphtml($item{'summary'} || $item{'description'}));
}
elsif ($typename eq "Staff") {
if ($item{type} && (length($item{type}) > 3)) {
$dc_description = $item{type}.' - ';
};
$dc_description =+ fnc_shorten($dc_description.fnc_descstriphtml($item{'summary'}));
$dc_description =~ s/( - )$//; # remove hyphen at end of line if there is no summary
#$dc_description = fnc_descstriphtml('Name: '.fnc_stripcolons($dc_description).
# '; Summary: '.fnc_shortest(fnc_stripcolons($item{'summary'})).
# '; Type: '.fnc_stripcolons($item{'type'}).';');
#$dc_description =~ s/(Name\: \;|Summary\: \;|Type\: \;)//g; #remove empty elements
}
elsif ($typename eq "Phones" && (length($item{type}) > 3)) {
$dc_description = fnc_descstriphtml($item{type});
#$dc_description = fnc_descstriphtml('Type: '.fnc_stripcolons($item{'type'}).
#'; Name: '.fnc_stripcolons($item{'name'}).'; Phone: '.fnc_stripcolons($item{'phonenumber'}).
#'; Comnet: '.fnc_stripcolons($item{'comnetphone'}).';');
}
else {
$dc_description = fnc_shorten(fnc_descstriphtml($item{'description'}));
#CH 25/04/2008: don't use header Introduction if no description - the GSA will extract its own snippet from page contents:
#if ($dc_description eq "") {
# $dc_description = fnc_shorten(fnc_descstriphtml($item{'header'}));
#};
};
#CH 25/04/2008: don't default to using item typename (we don't want that in the GSA)
# if ($dc_description eq "") {
# $dc_description = $typename;
# };
return $dc_description;
};
#------------------------------------------------------------------------------------------------------------------------
sub fnc_shorten ($) {
local ($/) = "";
my ($line) = @_;
# Trim the line down to 140 characters
my $newline = substr($line,0,140);
$newline =~ s/\n/ /g;
# and find the last whole word.
$newline =~ s/(.*)\s.+?$/$1.../ if (length($newline) == 140);
return $newline;
};
#------------------------------------------------------------------------------------------------------------------------
sub fnc_descstriphtml ($) {
# Strip out all HTML tags that have been embedded in the field text e.g. images, that would come out in the search results.
my ($line) = @_;
#CH 25/04/2008: convert HTML tags to a space, not null:
#$line =~ s/<.*?>//gs;
$line =~ s/<.*?>/ /gs;
$line = hcc_string_to_xhtml($line); #encodes things like ampersands within results, so as to validate as XHTML.
return $line;
};
#------------------------------------------------------------------------------------------------------------------------
# stripcolons function not currently in use
#sub fnc_stripcolons ($) {
## Strip out all colons and semicolons embedded in the field text, to make parsing easier.
# my ($line) = @_;
# $line =~ s/[;:]//gs;
# return $line;
#};
Community directory
Find organisations and business info
Housing associations
Navigate back to...
Accessibility »
Also on hertsdirect