for physical video items, display the video type.
authorgfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 6 Jan 2011 02:35:59 +0000 (02:35 +0000)
committergfawcett <gfawcett@6d9bc8c9-1ec2-4278-b937-99fde70a366f>
Thu, 6 Jan 2011 02:35:59 +0000 (02:35 +0000)
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1163 6d9bc8c9-1ec2-4278-b937-99fde70a366f

conifer/TODO
conifer/libsystems/marcxml.py
conifer/static/main.css
conifer/syrup/models.py
conifer/templates/components/site.xhtml
conifer/templates/item/item_metadata.xhtml

index 5f0319d..3560aa3 100644 (file)
@@ -2,8 +2,6 @@ NEW:
 
 * 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 @@ RECENTLY DONE:
 
 * 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.
+
index 9292b0a..23c2f92 100644 (file)
@@ -26,6 +26,9 @@ def marcxml_to_records(rec):
 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 @@ def marcxml_to_dictionary(rec, multiples=False):
     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'):
index 964509c..06a831c 100644 (file)
@@ -244,6 +244,8 @@ li.item_HEADING  .headingmainline a.mainlink:hover {
     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;
 }
index dd7f645..076783c 100644 (file)
@@ -744,6 +744,20 @@ class Item(BaseModel):
                     '%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):
index 7d9cc92..bc142f0 100644 (file)
@@ -53,6 +53,7 @@ searchtext = _('search this site...')
                <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>
index bda6bf7..6a56a84 100644 (file)
@@ -4,6 +4,7 @@ site_title = '%s: %s (%s)' % (site.course.code, site.course.name, site.term)
 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 @@ is_editor = site.can_edit(request.user)
     <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>