X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=src%2Fopacdisp.c;h=79c1dde29a958c7f6bc25404f6d4e3151670cdde;hb=77d6853aec94df6c69da9cd35d8ba982b9b12299;hp=157e58fb0c3c7c25c75f32f46c56c184a5abf5d5;hpb=c6e47cbbff56f39f6d81b079ebaeac41d793d4d9;p=yaz-moved-to-github.git diff --git a/src/opacdisp.c b/src/opacdisp.c index 157e58f..79c1dde 100644 --- a/src/opacdisp.c +++ b/src/opacdisp.c @@ -1,8 +1,12 @@ /* - * Copyright (c) 2003, Index Data. + * Copyright (C) 1995-2005, Index Data ApS * See the file LICENSE for details. * - * $Id: opacdisp.c,v 1.1 2003-10-27 12:21:34 adam Exp $ + * $Id: opacdisp.c,v 1.5 2005-02-25 17:05:09 adam Exp $ + */ +/** + * \file opacdisp.c + * \brief Implements OPAC record display */ #include @@ -11,6 +15,7 @@ #include #include +#include static void opac_element_str(WRBUF wrbuf, int l, const char *elem, const char *data) @@ -45,11 +50,22 @@ static void opac_element_bool(WRBUF wrbuf, int l, const char *elem, int *data) } } -void yaz_display_OPAC(WRBUF wrbuf, Z_OPACRecord *r, int flags) +void yaz_opac_decode_wrbuf(yaz_marc_t mt, Z_OPACRecord *r, WRBUF wrbuf) { int i; + wrbuf_puts(wrbuf, "\n"); + if (r->bibliographicRecord) + { + Z_External *ext = r->bibliographicRecord; + + wrbuf_puts (wrbuf, " \n"); + if (ext->which == Z_External_octet) + yaz_marc_decode_wrbuf(mt, ext->u.octet_aligned->buf, + ext->u.octet_aligned->len, wrbuf); + wrbuf_puts (wrbuf, " \n"); + } for (i = 0; i < r->num_holdingsData; i++) { Z_HoldingsRecord *h = r->holdingsData[i]; @@ -57,8 +73,13 @@ void yaz_display_OPAC(WRBUF wrbuf, Z_OPACRecord *r, int flags) if (h->which == Z_HoldingsRecord_marcHoldingsRecord) { - wrbuf_puts (wrbuf, " \n"); - /* h->u.marcHoldingsRecord) */ + Z_External *ext = h->u.marcHoldingsRecord; + + wrbuf_puts (wrbuf, " \n"); + if (ext->which == Z_External_octet) + yaz_marc_decode_wrbuf(mt, ext->u.octet_aligned->buf, + ext->u.octet_aligned->len, wrbuf); + wrbuf_puts (wrbuf, " \n"); } else if (h->which == Z_HoldingsRecord_holdingsAndCirc) { @@ -77,6 +98,8 @@ void yaz_display_OPAC(WRBUF wrbuf, Z_OPACRecord *r, int flags) opac_element_str (wrbuf, 2, "localLocation", d->localLocation); opac_element_str (wrbuf, 2, "shelvingLocation", d->shelvingLocation); opac_element_str (wrbuf, 2, "callNumber", d->callNumber); + opac_element_str (wrbuf, 2, "shelvingData", d->shelvingData); + opac_element_str (wrbuf, 2, "copyNumber", d->copyNumber); opac_element_str (wrbuf, 2, "publicNote", d->publicNote); opac_element_str (wrbuf, 2, "reproductionNote", d->reproductionNote); @@ -133,3 +156,13 @@ void yaz_display_OPAC(WRBUF wrbuf, Z_OPACRecord *r, int flags) } wrbuf_puts(wrbuf, "\n"); } + +void yaz_display_OPAC(WRBUF wrbuf, Z_OPACRecord *opac_rec, int flags) +{ + yaz_marc_t mt = yaz_marc_create(); + + yaz_marc_xml(mt, YAZ_MARC_MARCXML); + yaz_opac_decode_wrbuf(mt, opac_rec, wrbuf); + yaz_marc_destroy(mt); +} +