[open-ils-commits] r1163 - in servres/trunk/conifer: . libsystems static syrup templates/components templates/item (gfawcett)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 5 21:36:00 EST 2011


Author: gfawcett
Date: 2011-01-05 21:35:59 -0500 (Wed, 05 Jan 2011)
New Revision: 1163

Modified:
   servres/trunk/conifer/TODO
   servres/trunk/conifer/libsystems/marcxml.py
   servres/trunk/conifer/static/main.css
   servres/trunk/conifer/syrup/models.py
   servres/trunk/conifer/templates/components/site.xhtml
   servres/trunk/conifer/templates/item/item_metadata.xhtml
Log:
for physical video items, display the video type.

Modified: servres/trunk/conifer/TODO
===================================================================
--- servres/trunk/conifer/TODO	2011-01-06 02:35:56 UTC (rev 1162)
+++ servres/trunk/conifer/TODO	2011-01-06 02:35:59 UTC (rev 1163)
@@ -2,8 +2,6 @@
 
 * add/remove individuals in course sites
 
-* make sure volume, issue, source title, etc. are exposed over unAPI.
-
 * make "DVD" and other media types obvious (icons, explicit descriptions, etc.)
 
 * bookbag-URL search should import all items from the bookbag (if they don't already exist)
@@ -113,3 +111,5 @@
 
 * repair unAPI -- it seems broken on SHOWCASE (it was just not working for non-physical items)
 
+* make sure volume, issue, source title, etc. are exposed over unAPI.
+

Modified: servres/trunk/conifer/libsystems/marcxml.py
===================================================================
--- servres/trunk/conifer/libsystems/marcxml.py	2011-01-06 02:35:56 UTC (rev 1162)
+++ servres/trunk/conifer/libsystems/marcxml.py	2011-01-06 02:35:59 UTC (rev 1163)
@@ -26,6 +26,9 @@
 def record_to_dictionary(rec, multiples=True):
     tree = _to_tree(rec)
     dct = {}
+    for cf in tree.findall('{http://www.loc.gov/MARC21/slim}controlfield'):
+        t = cf.attrib['tag']
+        dct.setdefault(t, []).append(cf.text)
     for df in tree.findall('{http://www.loc.gov/MARC21/slim}datafield'):
         t = df.attrib['tag']
         for sf in df.findall('{http://www.loc.gov/MARC21/slim}subfield'):
@@ -47,6 +50,9 @@
     out = []
     for r in records:
         dct = {}
+        for cf in r.findall('{http://www.loc.gov/MARC21/slim}controlfield'):
+            t = cf.attrib['tag']
+            dct.setdefault(t, []).append(cf.text)
         for df in r.findall('{http://www.loc.gov/MARC21/slim}datafield'):
             t = df.attrib['tag']
             for sf in df.findall('{http://www.loc.gov/MARC21/slim}subfield'):

Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css	2011-01-06 02:35:56 UTC (rev 1162)
+++ servres/trunk/conifer/static/main.css	2011-01-06 02:35:59 UTC (rev 1163)
@@ -244,6 +244,8 @@
     list-style-image: url(tango/x-office-address-book.png);
 }
 
+.itemtree li .videotype { font-weight: bold; font-size: 90%; }
+
 .itemtree li.forbidden {
     background-color: #fdd;
 }

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2011-01-06 02:35:56 UTC (rev 1162)
+++ servres/trunk/conifer/syrup/models.py	2011-01-06 02:35:59 UTC (rev 1163)
@@ -744,6 +744,20 @@
                     '%d total copies in library system'
                     % (avail, desk, lib))
 
+    _video_type_re = re.compile(r'tag="007">v(.)')
+    _video_types = {'c':'videocartridge',
+                    'd':'videodisc',
+                    'f':'videocassette',
+                    'r':'videoreel',
+                    'z':'video, other format'}
+    def video_type(self):
+        if not self.marcxml:
+            return None
+        m = self._video_type_re.search(self.marcxml)
+        if m:
+            vtype = m.group(1)
+            return self._video_types.get(vtype, 'video, unknown format')
+
     # TODO: stuff I'm not sure about yet. I don't think it belongs here.
 
     def title_hl(self, terms):

Modified: servres/trunk/conifer/templates/components/site.xhtml
===================================================================
--- servres/trunk/conifer/templates/components/site.xhtml	2011-01-06 02:35:56 UTC (rev 1162)
+++ servres/trunk/conifer/templates/components/site.xhtml	2011-01-06 02:35:59 UTC (rev 1163)
@@ -53,6 +53,7 @@
 		<a href="${item.item_url()}" class="mainlink">${item}</a> 
       </div>
       <div class="author_pub" py:if="item.author or item.publisher or item.published">
+	<span py:with="vt=item.video_type()"><span class="videotype" py:if="vt">[${vt}]</span></span>
 		<span py:if="item.author">${item.author}<span py:if="item.author[-1]!='.'">.</span></span>
 		<span py:if="item.published">(${item.published}).</span>
 		<span py:if="item.source_title"><i>${item.source_title}.</i></span>

Modified: servres/trunk/conifer/templates/item/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_metadata.xhtml	2011-01-06 02:35:56 UTC (rev 1162)
+++ servres/trunk/conifer/templates/item/item_metadata.xhtml	2011-01-06 02:35:59 UTC (rev 1163)
@@ -4,6 +4,7 @@
 hier = item.hierarchy()[:-1]
 title = item.title
 is_editor = site.can_edit(request.user)
+vidtype = item.video_type()
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -42,6 +43,7 @@
     <table class="metadata_table" style="margin-top: 1em;">
       <tr><th>Title</th><td>${item.title}</td></tr>
       <tr py:if="item.source_title"><th>Title of source</th><td>${item.source_title}</td></tr>
+      <tr py:if="vidtype"><th>Format</th><td>${vidtype}</td></tr>
       <tr py:if="item.author"><th>Author(s)</th><td>${item.author}</td></tr>
       <tr py:if="item.publisher"><th>Publisher</th><td>${item.publisher}</td></tr>
       <tr py:if="item.published"><th>Published</th><td>${item.published}</td></tr>



More information about the open-ils-commits mailing list