[OPEN-ILS-GENERAL] add marc field in opac

Dan Scott dan at coffeecode.net
Wed Feb 10 20:20:15 EST 2010


On Wed, 2010-02-10 at 17:39 -0500, Soulliere, Robert wrote:
> Levani,
> 
> The best guidance for adding new fields is found on the Wiki here:
> http://www.open-ils.org/dokuwiki/doku.php?id=scratchpad:supercat_opac_example
> 
> I was experimenting with this on our test server today. Here are some other very simple examples.
> 
> Add Call Number (MARC tag 050):
> <tr>
>                 <td nowrap='nowrap' class='rdetail_desc'>Call Number</td>
>                 <td type='opac/slot-data+marcxml' query='datafield[tag=050] subfield'  class='rdetail_item'>
>                     <script type='opac/slot-format'>
>                      return dojox.data.dom.textContent(item);
>                     </script>
>                 </td>
>             </tr>
> 
> 
> Add statement of responsibility (MARC tag 245 subfield c) - this is useful if you want to place statement of responsibility in a separate field from title.
> 
> <tr>
>                 <td nowrap='nowrap' class='rdetail_desc'>Statement of Responsibility</td>
>                <td type='opac/slot-data' query='datafield[tag=245] subfield[code=c]' class='rdetail_item'>
>                     <script type='opac/slot-format'>
>                     return dojox.data.dom.textContent(item);
>                     </script>
>                 </td>
>             </tr>

I'm scheduled to give a presentation to give at EG 2010 on the use of
BibTemplate.js. To boil it down to a single example, you might want to
try something like:

<tr class='hide_me' id='tag506'>
	<td nowrap='nowrap' class='rdetail_desc'>Usage restrictions</td>
	<td type='opac/slot-data' query='datafield[tag=506] subfield[code=a]'
class='rdetail_item'>
		<script type='opac/slot-format'><![CDATA[
		dojo.query('#tag506').removeClass('hide_me');
		return '<span>' + dojox.data.dom.textContent(item) + '</span> ';
		]]></script>
	</td>
</tr>

1. class='hide_me' hides the row entirely; we won't unhide it unless
there is actually some content to display

2. id='tag506' gives us a handle to use to unhide the row if we do have
some content to display

3. inside the <script> tag, the first thing we do is unhide the row
(because we won't hit this script unless there is something to display)

4. then we return the content. I wrap it in a span tag in case there are
multiple instances, this pushes each instance onto its own line instead
of concatenating all of the instances together.

There you go, now you don't have to attend my session!

I've thought about advocating something like the Laurentian detail page
as a new default - you can grab a copy from
http://svn.open-ils.org/trac/ILS-Contrib/browser/conifer/branches/rel_1_6_0/web/opac/skin/lul/xml/rdetail/rdetail_summary.xml - just be careful with the online resources customization that wants to do a live lookup of SFX resources if the item has an ISSN.

For a live example, see
http://laurentian.concat.ca/opac/en-CA/skin/lul/xml/rdetail.xml?r=821890&t=music&tp=keyword&l=105&d=1&hc=11189&rt=keyword




More information about the Open-ils-general mailing list