Owen Leonard
d1d9f4698e
This patch corrects instances of the double-underscore function being used in .tt and .inc files where the single-underscore function should be used instead. To test, apply the patch and update a translation, e.g. fr-FR: > cd misc/translator > perl translate update fr-FR - Open the corresponding .po file for JavaScript strings, in this case misc/translator/po/fr-FR-staff-prog.po - Confirm that the strings are now in the .po file for translation. You should find these lines: - koha-tmpl/intranet-tmpl/prog/en/includes/js-biblio-format.inc: "No title." - koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/detail.tt: "Check in and add to bundle" "Ignore holds and add to bundle" - koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/add_items-step1.tt: "Please enter only a barcode, or only a biblionumber." - koha-tmpl/intranet-tmpl/prog/en/modules/course_reserves/batch_add_items.tt: "Please enter only barcodes, or only biblionumbers." - koha-tmpl/intranet-tmpl/prog/en/modules/tools/additional-contents.tt: "Please specify a content for 'Default'" - Check fr-FR-opac-bootstrap.po for these lines: - koha-tmpl/opac-tmpl/bootstrap/en/includes/calendar.inc: "Please enter a valid date (should match %s)." - koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-basket.tt: "No item was selected" - koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-reserve.tt, koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt, koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-shelves.tt: "No item was selected" Signed-off-by: David Cook <dcook@prosentient.com.au> Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
73 lines
3.2 KiB
PHP
73 lines
3.2 KiB
PHP
<script>
|
|
(function() {
|
|
/**
|
|
* Format the biblio response from a Koha RESTful API request.
|
|
* @param {Object} biblio The biblio json object as returned from the Koha RESTful API
|
|
* @param {Object} config A configuration object
|
|
* Valid keys are: `link`
|
|
* @return {string} The formatted HTML string
|
|
*/
|
|
window.$biblio_to_html = function(biblio, config) {
|
|
|
|
if (!biblio) {
|
|
return ''; // empty string for no biblio
|
|
}
|
|
|
|
var title = '';
|
|
|
|
if ( config && config.biblio_id_only ) {
|
|
title = escape_str(biblio.biblio_id);
|
|
}
|
|
else {
|
|
title = '<span class="biblio-title">';
|
|
if (biblio.title != null && biblio.title != '') {
|
|
title += escape_str(biblio.title);
|
|
} else {
|
|
title += _("No title");
|
|
}
|
|
title += '</span>';
|
|
|
|
// add subtitle
|
|
if (biblio.subtitle != null && biblio.subtitle != '') {
|
|
title += ' <span class="biblio-subtitle">' + escape_str(biblio.subtitle) + '</span>';
|
|
}
|
|
}
|
|
|
|
// set title as link
|
|
if (config && config.link) {
|
|
if (config.link === 'marcdetail') {
|
|
title = '<a href="/cgi-bin/koha/catalogue/MARCdetail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
|
|
} else if (config.link === 'labeled_marc') {
|
|
title = '<a href="/cgi-bin/koha/catalogue/labeledMARCdetail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
|
|
} else if (config.link === 'isbd') {
|
|
title = '<a href="/cgi-bin/koha/catalogue/ISBDdetail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
|
|
} else {
|
|
title = '<a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=' + encodeURIComponent(biblio.biblio_id) + '" class="title">' + title + '</a>';
|
|
}
|
|
}
|
|
|
|
if ( !config || !config.biblio_id_only ) {
|
|
// add medium
|
|
if (biblio.medium != null && biblio.medium != '') {
|
|
title += ' <span class="biblio-medium">' + escape_str(biblio.medium) + '</span>';
|
|
}
|
|
|
|
// add part numbers/names
|
|
let part_numbers = (typeof biblio.part_number === 'string') ? biblio.part_number.split("|") : [];
|
|
let part_names = (typeof biblio.part_name === 'string') ? biblio.part_name.split("|") : [];
|
|
let i = 0;
|
|
while (part_numbers[i] || part_names[i]) {
|
|
if (part_numbers[i]) {
|
|
title += ' <span class="part-number">' + escape_str(part_numbers[i]) + '</span>';
|
|
}
|
|
if (part_names[i]) {
|
|
title += ' <span class="part-name">' + escape_str(part_names[i]) + '</span>';
|
|
}
|
|
i++;
|
|
}
|
|
}
|
|
|
|
return title;
|
|
};
|
|
})();
|
|
</script>
|