Commit 95daa1ec authored by ssp's avatar ssp
Browse files

show catalogue link for the item’s parent element

* submodule commit for JS version
* code for PHP version
parent 7106beac
......@@ -590,6 +590,7 @@ private function locationDetails ($result) {
$this->appendInfoToContainer( $this->detailInfoItem('isbn', $location), $detailsData);
}
$this->appendInfoToContainer( $this->electronicURLs($location, $result), $detailsData);
$this->appendInfoToContainer( $this->parentLink($locationAll), $detailsData);
$this->appendInfoToContainer( $this->catalogueLink($locationAll), $detailsData);
// Only append location information if additional details exist
......@@ -810,13 +811,18 @@ private function electronicURLs ($location, $result) {
/**
* Returns a link for the current record that points to the catalogue page for that item.
* Checks whether the field with the passed name exists, extracts the
* first instance of it and manipulates it if configured to do so.
* @param string $fieldName
* @param array $locationAll
* @return DOMElement
* @return string
*/
private function catalogueLink ($locationAll) {
$catalogueURL = $locationAll['ch']['md-catalogue-url'][0]['values'][0];
private function processedCatalogueURLFromField ($fieldName, $locationAll) {
$URL = NULL;
$catalogueURL = $locationAll['ch']['md-' . $fieldName][0]['values'][0];
if ($catalogueURL) {
$URL = $catalogueURL;
/** Replace links to the Göttingen Opac by GVK-links if:
* 1) the user does not have a Göttingen IP and
* 2) we are not set up to always server SUB Opace links
......@@ -828,16 +834,59 @@ private function catalogueLink ($locationAll) {
$catalogueURL = preg_replace($opacBaseRegexp, $GVKBaseURL, $catalogueURL);
}
}
$linkElement = Null;
$targetName = $locationAll['attrs']['name'];
if ($catalogueURL && $targetName) {
return $URL;
}
/**
* Returns DOM elements linking to the catalogue page of the current
* record’s parent record, plus spacing.
* @param type $locationAll
* @return type
*/
private function parentLink ($locationAll) {
$result = NULL;
$URL = $this->processedCatalogueURLFromField('parent-catalogue-url', $locationAll);
if ($URL) {
$linkElement = $this->doc->createElement('a');
$linkElement->setAttribute('href', $catalogueURL);
$linkElement->setAttribute('class', 'pz2-detail-catalogueLink');
$linkElement->setAttribute('href', $URL);
$linkTitle = Tx_Extbase_Utility_Localization::translate('enthaltendes Werk im Katalog ansehen', 'Pazpar2');
$linkElement->setAttribute('title', $linkTitle);
$this->turnIntoNewWindowLink($linkElement);
$linkElement->setAttribute('class', 'pz2-detail-parent-catalogueLink');
$linkText = Tx_Extbase_Utility_Localization::translate('enthaltendes Werk', 'Pazpar2');
$linkElement->appendChild($this->doc->createTextNode($linkText));
$result = array($linkElement, $this->doc->createTextNode(' '));
}
return $result;
}
/**
* Returns a link for the current record that points to the catalogue page for that item.
* @param array $locationAll
* @return DOMElement
*/
private function catalogueLink ($locationAll) {
$linkElement = NULL;
$URL = $this->processedCatalogueURLFromField('catalogue-url', $locationAll);
$targetName = $locationAll['attrs']['name'];
if ($URL && $targetName) {
$linkElement = $this->doc->createElement('a');
$linkElement->setAttribute('href', $URL);
$linkTitle = Tx_Extbase_Utility_Localization::translate('Im Katalog ansehen', 'Pazpar2');
$linkElement->setAttribute('title', $linkTitle);
$this->turnIntoNewWindowLink($linkElement);
$linkElement->setAttribute('class', 'pz2-detail-catalogueLink');
/* Try to localise catalogue name, fall back to original target name
if no localisation is available */
$linkText = Tx_Extbase_Utility_Localization::translate($targetName, 'Pazpar2');
......
......@@ -147,7 +147,8 @@ Fields used to display data:
* language - ISO 639-2/B language code (not part of standard tmarc.xsl), German and English language names are included in the JavaScript
* abstract (not part of standard tmarc.xsl)
* creator (used for Guide links)
* catalogue-url (URL linking to the catalogue web page for that record, built using the stylesheets ard setup for the various targets.)
* catalogue-url (URL linking to the catalogue web page for that record, built using the stylesheets and setup for the various targets.)
* parent-catalogue-url (URL linking to the catalogue web page for related records to the current record, typically the containing parent collection.)
* subject
* mapscale (not part of standard tmarc.xsl), display the scale of maps and potentially draw the region covered by the map on an interactive map on the web page
......@@ -193,7 +194,7 @@ Many thanks go to [Indexdata](http://www.indexdata.com/) for their powerful pazp
## Version History ##
* 1.7.0 (2012-03-??): Support displaying the location covered by maps; Remove ZDB-JOP sid configuration from script. It has to be provided by the Proxy now
* 1.7.0 (2012-03-??): Support displaying the location covered by maps; Remove ZDB-JOP sid configuration from script, it has to be provided by the proxy now; Add ability to display a link to the parent record
* 1.6.0 (2012-02-24): Restructure Resources/Public to provide the JavaScript interface as a standalone repository: [pazpar2-js-client](https://github.com/ssp/pazpar2-js-client); change date format for Neuerwerbungen to YYYYMM; improved reliability of triggering the pazpar2 search
* 1.5.0 (2012-01-18): Add Geo-specific placeholder search term to main search field configuration; add second set of paging controls beneath the results; work around localisation breakage of TYPO3 4.6
* 1.4.0 (2012-01-16): Add keyword search and ability to display keywords in result details; add support for additional media types (letter, manuscript, image); small display tweaks; stop using deprecated form field View Helper
......
......@@ -78,6 +78,8 @@ Please run the search from a German university network for more complete results
<label index="Ausgabe">Edition</label>
<label index="In">In</label>
<label index="Im Katalog ansehen">View in catalogue.</label>
<label index="enthaltendes Werk im Katalog ansehen">View all associated items in catalogue.</label>
<label index="enthaltendes Werk">associated items</label>
<label index="Search is better with JavaScript.">JavaScript seems to be unavailable in your web browser. Without JavaScript, displaying the results of a query can take up to a minute in some cases. Please be patient or turn on JavaScript for a more interactive search experience.</label>
<label index="of">of</label>
<label index="Erscheint in separatem Fenster.">Link opens in a new Window.</label>
......@@ -208,6 +210,8 @@ Bei Zugriff aus einem deutschen Universitätsnetzwerk umfaßt Ihre Abfrage zusä
<label index="Ausgabe">Ausgabe</label>
<label index="In">In</label>
<label index="Im Katalog ansehen">Im Katalog ansehen.</label>
<label index="enthaltendes Werk im Katalog ansehen">Alle zugehörigen Publikationen im Katalog ansehen.</label>
<label index="enthaltendes Werk">zugehörige Publikationen</label>
<label index="Search is better with JavaScript.">Ihr Browser scheint kein JavaScript zu unterstützen. Ohne JavaScript kann es bei Anfragen mit vielen Ergebnissen eine Minute dauern, bis alle Ergebnisse verfügbar sind. Wir empfehlen daher, für die Suchfunktion JavaScript zu aktivieren.</label>
<label index="of">von</label>
<label index="Erscheint in separatem Fenster.">Erscheint in separatem Fenster.</label>
......
Subproject commit 0e919fd0294c4fb77096a176410347b15166fd30
Subproject commit f3be863e2e485cceb749665a3af7de95ff94aa4c
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment