From 1b1f2fd6ce9fe0f226598a8217beee22f2b2aff1 Mon Sep 17 00:00:00 2001 From: Dan Scott Date: Mon, 7 Jan 2013 18:16:57 -0500 Subject: [PATCH] Make series in record details behave Add graphic 880 field support, as well as relying on mkurl() macro to generate the desired URL and show the complete series on a single line instead of having subfields appear on separate rows. Add a sample record that contains a 440 series field linked to an 880 field. Signed-off-by: Dan Scott Signed-off-by: Kathy Lussier Signed-off-by: Ben Shum --- .../templates/opac/parts/record/series.tt2 | 41 +++++++++++++------ .../tests/datasets/sql/bibs_graphic_880.sql | 3 +- 2 files changed, 31 insertions(+), 13 deletions(-) diff --git a/Open-ILS/src/templates/opac/parts/record/series.tt2 b/Open-ILS/src/templates/opac/parts/record/series.tt2 index aa96243ca3..7cdf1b1323 100644 --- a/Open-ILS/src/templates/opac/parts/record/series.tt2 +++ b/Open-ILS/src/templates/opac/parts/record/series.tt2 @@ -1,21 +1,38 @@ -[% +[%- series_tags = ['440', '490', '800', '810', '811', '830', '694']; loc = ctx.search_ou; -%] -[% BLOCK render_series; +BLOCK render_series; results = []; FOR tag IN series_tags; - FOR node IN ctx.marc_xml.findnodes('//*[@tag="' _ tag _ '"]/*'); - node_uri = node.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', '') | uri; - node_html = node.textContent | html; - IF !loop.first; - results.last = result.last _ ''; + FOR node IN ctx.marc_xml.findnodes('//*[@tag="' _ tag _ '"]'); + all_terms = []; + graphics = []; + FOR subfield IN node.childNodes; + NEXT UNLESS subfield.nodeName == "subfield"; + code = subfield.getAttribute('code'); + IF code == '6'; + linked_fields = [subfield.textContent()]; + target_field = node.getAttribute('tag'); + get_linked_880s; + END; + NEXT UNLESS code.match('[a-z]'); + # at this point, we actually have a partial term to use. + single_term = subfield.textContent | html; + all_terms.push(subfield.textContent.replace('[#"^$\+\-,\.:;&|\[\]()]', '')); + total_term = all_terms.join(" ").replace('\s+$', ''); + + url = mkurl(ctx.opac_root _ '/results', + { qtype=>'series', query=>total_term }, stop_parms + ); + series = series _ '' _ single_term _ ' '; END; - results.push('' _ node_html _ '' - ); + FOREACH link880 IN graphics; + link = link880.value | html; + series = series _ '
' _ link _ '
'; + END; + results.push(series); + END; END; FOR entry IN results; diff --git a/Open-ILS/tests/datasets/sql/bibs_graphic_880.sql b/Open-ILS/tests/datasets/sql/bibs_graphic_880.sql index 5bf269c73e..a6c3f09e2d 100644 --- a/Open-ILS/tests/datasets/sql/bibs_graphic_880.sql +++ b/Open-ILS/tests/datasets/sql/bibs_graphic_880.sql @@ -5,5 +5,6 @@ INSERT INTO marcxml_import (tag, marc) VALUES (:bib_tag, '01750 am a2200481Ia 45002784593CONIFER20121031173514.0121026s2012 ja ac 001 0beng d97849249713324924971332engjpnDS890.M442K3513 2012 880-01Kaimai, Jun,1957-Matsumoto Shigeharu :bearing witness /Kaimai Jun ; English adaptation by Waku Miller.Bearing witness1st English ed.Tokyo :International House of Japan,2012.xviii, 219 p., [1] leaf of plates :ill., portraits ;24 cm.LTCB international library selection ; no. 31Translation of: Matsumoto Shigeharu den : saigo no riberarisuto.Includes index.880-03Matsumoto, Shigeharu,1899-1989.880-04Dōmei Tsūshinsha.LiberalsJapanBiography.JournalistsJapanBiography.Miller, Waku.LTCB international library selection ;no. 31.100-01開米潤,1957-240-02松本重治伝.English600-03松本重治,1899-1989.610-04同盟通信社.5894462OCoLC2784593biblio'), (:bib_tag, '01964cam a2200397Ia 45002802833CONIFER20110408114902.0m d cr unu||||||||090106s1979 gw ob 001 0 eng d9780387095141 (New York)0387095144 (New York)9783540095149 (Berlin)3540095144 (Berlin)(OCoLC)ocn297188498SPLNMSPLNMGW5XECaOWAQA3.L28 no. 727QA377$1880-01Saitō, Yoshimi.Spectral representations for Schrödinger operators with long-range potentials[electronic resource] /Yoshimi Saitō.Berlin ;New York :Springer-Verlag,1979.148 p. ;25 cm.Lecture notes in mathematics,0075-8434 ;727Includes bibliographical references (p. [141]-144) and index.Access restricted to users with a valid University of Windsor ID ; Ontario Council of University Libraries ; Springer Science+Business Media, LLC.OWADifferential equations, Elliptic.SpringerSP(before 2005)_2012_11_3349.mrc.2012_11_5Schrödinger operator.Scattering (Mathematics)Spectral theory (Mathematics)Print version:Saitō, Yoshimi.Spectral representations for Schrödinger operators with long-range potentials.Berlin ; New York : Springer-Verlag, 19790387095144(DLC) 79015958(OCoLC)5101219Lecture notes in mathematics (Springer-Verlag) ;727.http://ezproxy.uwindsor.ca/login?url=http://books.scholarsportal.info/viewdoc.html?id=/ebooks/ebooks2/springer/2011-04-14/2/3540095144Available OnlineWINDSYShttp://ezproxy.uwindsor.ca/login?url=http://dx.doi.org/10.1007/BFb0070997Available OnlineWINDSYS100-01/$1齋藤, 義實297188498OCoLC2802833biblio'), (:bib_tag, '02921nam a2200625Ia 4500892053CONIFER20081125080111.0m d cr cn| 081017s2006 ja a sb 001 0 eng d97844312877594431287752(OCoLC)ocn262693560(OCoLC)262693560978-4-431-28774-2Springerhttp://www.springerlink.comGW5XEengGW5XEMAINQP123.B68 2006eb2006 G-560WF 102I608b 2006$1QPlcco612.222880-01Breathing, feeding, and neuroprotection[electronic resource] /I . Homma, S. Shioda, eds.880-02Tokyo ;New York :Springer,c2006.xvi, 148 p. :ill. ;24 cm.Includes bibliographical references and index.Central regulation of breathing -- Neurogeneration and neuroprotection -- Brain functions in health and disease -- Brain functions by the Dipole Tracing method.Electronic reproduction.New York :Springer,2008.Mode of access: World Wide Web.System requirements: Web browser.Title from title screen (viewed on Oct. 10, 2008).Access may be restricted to users at subscribing institutions.RespirationRegulation.Blood-brain barrier.Neurophysiology.Respiratory MechanicsphysiologyCongresses.Respiratory TransportphysiologyCongresses.Biological ClocksCongresses.Blood-Brain BarrierinnervationCongresses.Brain StemphysiologyCongresses.Nerve RegenerationphysiologyCongresses.880-03Nō.jlabsh/3Electronic books.local880-04Homma, Ikuo.880-00Shioda, S.(Seiji)SpringerLink (Online service)Original44312877449784431287742(DLC) 2006923431(OCoLC)69982830Available online from SpringerLinkhttp://librweb.laurentian.ca/login?url=http://dx.doi.org/10.1007/4-431-28775-2LUSYSAvailable online from ScholarsPortalhttp://librweb.laurentian.ca/login?url=http://resolver.scholarsportal.info/isbn/9784431287759LUSYS245-01/$1Breathing,Feeding,and,Neuroprotection/[electronic resource]I。Homma;S。Shioda[編]。260-02/$1[東京]:[シュプリンガー・フェアラーク東京],c2006。650-03/$1jlabsh/3700-00/$1本間生夫700-04/$1塩田清二92ONTCL1a892053Sirsi_Auto892053biblio'), -(:bib_tag, '02737nam a2200589Ia 4500925636CONIFER20081125083147.0m d cr cn| 081017s2002 gw a sb 100 0 eng d 9783540461456 3540461450(OCoLC)ocn262687400(OCoLC)262687400978-3-540-44123-6Springerhttp://www.springerlink.comGW5XEengGW5XEMAINQA76.9.D37D396 2002eb$1Qlcco658.4/038/028557422DaWaK 2002(2002 :Aix-en-Provence, France)Data warehousing and knowledge discovery[electronic resource] :4th international conference, DaWaK 2002, Aix-en-Provence, France, September 4-6, 2002 : proceedings /Yahiko Kambayashi, Werner Winiwarter, Masatoshi Arikawa (eds.).Berlin ;New York :Springer,2002.xiii, 337 p. :ill. ;24 cm.Lecture notes in computer science ;2114Includes bibliographical references.Electronic reproduction.New York :Springer,2008.Mode of access: World Wide Web.System requirements: Web browser.Title from title screen (viewed on Oct. 10, 2008).Access may be restricted to users at subscribing institutions.Data warehousingCongresses.Database searchingCongresses.BANCO DE DADOS (CONGRESSOS)larpcalREDES E COMUNICAÇÃO DE DADOS (CONGRESSOS)larpcalRECUPERAÇÃO DA INFORMAÇÃO (CONGRESSOS)larpcalData-analyse.gttKennismanagement.gttData warehouse.gttBases de donnéesInterrogationCongrès.Entrepôts de données (Informatique)Congrès.Electronic books.localKambayashi, Y.Winiwarter, Werner.880-01Arikawa, Masatoshi.SpringerLink (Online service)Original35404412399783540441236(DLC) 2002030275(OCoLC)50291185Available online from SpringerLinkhttp://librweb.laurentian.ca/login?url=http://dx.doi.org/10.1007/3-540-46145-0LUSYShttp://link.springer-ny.com/link/service/series/0558/tocs/t2454.htmRestricted to Springer LINK subscribersAvailable online from Scholars Portalhttp://librweb.laurentian.ca/login?url=http://resolver.scholarsportal.info/isbn/9783540461456LUSYS700-01/$1有川, 正俊92ONTCL1a925636Sirsi_Auto925636biblio') +(:bib_tag, '02737nam a2200589Ia 4500925636CONIFER20081125083147.0m d cr cn| 081017s2002 gw a sb 100 0 eng d 9783540461456 3540461450(OCoLC)ocn262687400(OCoLC)262687400978-3-540-44123-6Springerhttp://www.springerlink.comGW5XEengGW5XEMAINQA76.9.D37D396 2002eb$1Qlcco658.4/038/028557422DaWaK 2002(2002 :Aix-en-Provence, France)Data warehousing and knowledge discovery[electronic resource] :4th international conference, DaWaK 2002, Aix-en-Provence, France, September 4-6, 2002 : proceedings /Yahiko Kambayashi, Werner Winiwarter, Masatoshi Arikawa (eds.).Berlin ;New York :Springer,2002.xiii, 337 p. :ill. ;24 cm.Lecture notes in computer science ;2114Includes bibliographical references.Electronic reproduction.New York :Springer,2008.Mode of access: World Wide Web.System requirements: Web browser.Title from title screen (viewed on Oct. 10, 2008).Access may be restricted to users at subscribing institutions.Data warehousingCongresses.Database searchingCongresses.BANCO DE DADOS (CONGRESSOS)larpcalREDES E COMUNICAÇÃO DE DADOS (CONGRESSOS)larpcalRECUPERAÇÃO DA INFORMAÇÃO (CONGRESSOS)larpcalData-analyse.gttKennismanagement.gttData warehouse.gttBases de donnéesInterrogationCongrès.Entrepôts de données (Informatique)Congrès.Electronic books.localKambayashi, Y.Winiwarter, Werner.880-01Arikawa, Masatoshi.SpringerLink (Online service)Original35404412399783540441236(DLC) 2002030275(OCoLC)50291185Available online from SpringerLinkhttp://librweb.laurentian.ca/login?url=http://dx.doi.org/10.1007/3-540-46145-0LUSYShttp://link.springer-ny.com/link/service/series/0558/tocs/t2454.htmRestricted to Springer LINK subscribersAvailable online from Scholars Portalhttp://librweb.laurentian.ca/login?url=http://resolver.scholarsportal.info/isbn/9783540461456LUSYS700-01/$1有川, 正俊92ONTCL1a925636Sirsi_Auto925636biblio'), +(:bib_tag, '02145cam a2200505Ia 4500964180MAnMC20061016090635.0060622s2005 cc a 000 0 chi d7801885120 :$7.35(OCoLC)70159732BKLBKLBKLACTRANOGchiengNOGA$1880-01Cai, Zhizhong,1948-880-02Laozi shuo I : Zhi zhe de di yu =the Dao speaks I : the whispers of wisdom /Cai Zhizhong zhu ; Brian Bruya yi.880-03Zhi zhe de di yuDao speaks IWhispers of wisdom880-04Di 1 ban.880-05Beijing Shi :Xian dai chu ban she,2005.4, 93 p. :chiefly ill. ;21 cm.880-06Cai Zhizhong man hua zhong ying wen ban.880-07Laozi.Dao de jing.880-08LaoziCriticism and interpretation.880-09LaoziCaricatures and cartoons.Chinese language materials.Philosophy, TaoistCaricatures and cartoons.TaoismComic books, strips, etc.100-01/$1蔡志忠,1948-245-02/$1老子说 I : 智者的低语 =the Dao speaks I : the whispers of wisdom /蔡志忠著 ; Brian Bruya 译.246-03/$1智者的低语250-04/$1第1版.260-05/$1北京市 :现代出版社,2005.440-06/$1蔡志忠漫画中英文版.600-07/$1老子.道德經.600-08/$1老子Criticism and interpretation.600-09/$1老子Caricatures and cartoons.100701106101601-0C0NOGnobcw 10-16-2006gaaagplMBIMBIStacksC 299.5 C123LA V.1book3186700219120812.00nonreferenceholdablecirculatingvisibleAvailablegaaagplMBIMBIStacksC 299.5 C123LA V.1book3186700218768512.00nonreferenceholdablecirculatingvisibleAvailable964180AUTOGEN964180biblio') ; -- 2.43.2