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

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Jan 5 22:01:00 EST 2011


Author: gfawcett
Date: 2011-01-05 22:00:58 -0500 (Wed, 05 Jan 2011)
New Revision: 1164

Modified:
   servres/trunk/conifer/TODO
   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:
show call number on index and metadata pages; better item-availability presentation.

Modified: servres/trunk/conifer/TODO
===================================================================
--- servres/trunk/conifer/TODO	2011-01-06 02:35:59 UTC (rev 1163)
+++ servres/trunk/conifer/TODO	2011-01-06 03:00:58 UTC (rev 1164)
@@ -2,14 +2,11 @@
 
 * add/remove individuals in course sites
 
-* 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)
+  -- actually, I'm not 100% certain about this, esp if we implement "Sakai linkup" below.
 
 * Sakai linkup -- test, seems not to work on SHOWCASE
 
-* show call number (852c) on index pages
-
 * index pages when printed, should show call all numbers clearly
 
 * search should include course number (fragments too, not just full course codes)
@@ -113,3 +110,7 @@
 
 * make sure volume, issue, source title, etc. are exposed over unAPI.
 
+* make "DVD" and other media types obvious (icons, explicit descriptions, etc.)
+
+* show call number on index pages
+

Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css	2011-01-06 02:35:59 UTC (rev 1163)
+++ servres/trunk/conifer/static/main.css	2011-01-06 03:00:58 UTC (rev 1164)
@@ -356,6 +356,14 @@
 ul.heading_tree ul { margin: 0; padding-left: 25px; }
 
 
-.availability { float: right; color: darkred; background-color: #eee; padding: 4px; min-width: 24px; }
-.availability .available { color: green; }
-.avail_nonphys { background-color: white; }
\ No newline at end of file
+.availability {
+    float: right; color: darkred; background-color: #eee; 
+    width: 150px; margin-left: 8px; 
+    font-size: 90%;
+}
+.availability div { padding: 2px 4px; }
+.availability a { text-decoration: none; }
+.availability .available { color: darkgreen; background-color: #ded; }
+.availability .unavailable { color: darkred; background-color: #edd; }
+.avail_nonphys { background-color: white; }
+.availability .callnumber { margin: 2px 0; }

Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py	2011-01-06 02:35:59 UTC (rev 1163)
+++ servres/trunk/conifer/syrup/models.py	2011-01-06 03:00:58 UTC (rev 1164)
@@ -659,8 +659,18 @@
 
     #--------------------------------------------------
     # MARC
+
+    _marc_dict_cache = None
+
     def marc_as_dict(self):
-        return MX.record_to_dictionary(self.marcxml)
+        # cache a copy of the dict expansion, since it's semi-expensive to
+        # generate, and is sometimes used more than once on the same page.
+        if self._marc_dict_cache is None:
+            if not self.marcxml:
+                self._marc_dict_cache = {}
+            else:
+                self._marc_dict_cache = MX.record_to_dictionary(self.marcxml)
+        return self._marc_dict_cache
 
     def marc_dc_subset(self):
         return json.dumps(self.marc_as_dict())
@@ -750,6 +760,7 @@
                     'f':'videocassette',
                     'r':'videoreel',
                     'z':'video, other format'}
+
     def video_type(self):
         if not self.marcxml:
             return None
@@ -758,6 +769,18 @@
             vtype = m.group(1)
             return self._video_types.get(vtype, 'video, unknown format')
 
+    def call_number(self):
+        dct = self.marc_as_dict()
+        if dct:
+            try:
+                if '090a' in dct:   # for films. FIXME, is this legit?
+                    return dct['090a']
+                cn = ('%s %s' % (dct.get('050a', ''), 
+                                 dct.get('050b', ''))).strip()
+                return cn
+            except:
+                return None
+
     # 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:59 UTC (rev 1163)
+++ servres/trunk/conifer/templates/components/site.xhtml	2011-01-06 03:00:58 UTC (rev 1164)
@@ -33,16 +33,19 @@
     <li py:for="item, subs in tree" py:with="forbidden=not item.copyright_status_ok()" class="item_${item.item_type} an_item ${forbidden and 'forbidden' or ''}"
 	id="item_${item.id}">
       <abbr py:if="not item.item_type=='HEADING'" class="unapi-id" title="${item.id}"/>
+      <?python
+	stat = callhook('item_status', item) if (item.item_type == 'PHYS') else None
+	valid = stat is not None
+      ?>
       <div class="availability" py:if="item.item_type == 'PHYS'">
-	<?python
-	  stat = callhook('item_status', item) if (item.item_type == 'PHYS') else None
-	  valid = stat is not None
-	?>
+	<a href="${item.item_url()}">
 	<div py:if="valid" py:with="(_lib, _desk, _avail) = stat"
 	     class="${_avail &gt; 0 and 'available' or 'unavailable'}"
 	     title="${_avail} of ${_desk} copies available at reserves desk; ${_lib} total copies in library system">
-	  ${_avail}/${_desk}
+	  <div>${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})</div>
+	  <div class="callnumber">${item.call_number()}</div>
 	</div>
+	</a>
 	<div py:if="not valid" title="No copies are available at the reserves desk. No further status information is available.">
 	  &#x2205;
 	</div>

Modified: servres/trunk/conifer/templates/item/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_metadata.xhtml	2011-01-06 02:35:59 UTC (rev 1163)
+++ servres/trunk/conifer/templates/item/item_metadata.xhtml	2011-01-06 03:00:58 UTC (rev 1164)
@@ -5,6 +5,7 @@
 title = item.title
 is_editor = site.can_edit(request.user)
 vidtype = item.video_type()
+callnum = item.call_number()
 ?>
 <html xmlns="http://www.w3.org/1999/xhtml"
       xmlns:xi="http://www.w3.org/2001/XInclude"
@@ -51,6 +52,7 @@
       <tr py:if="item.issue"><th>Issue</th><td>${item.issue}</td></tr>
       <tr py:if="item.pages"><th>Pages</th><td>${item.pages}</td></tr>
       <tr py:if="item.isbn"><th>ISBN</th><td>${item.isbn}</td></tr>
+      <tr py:if="callnum"><th>Call Number</th><td>${callnum}</td></tr>
       <tr py:if="item.item_type=='ELEC'"><th>Copyright status</th><td>${item.get_copyright_status_display()}</td></tr>
       <tr><th>Type</th><td>${item.get_item_type_display()}</td></tr>
       <tr py:if="item.item_type=='PHYS'"



More information about the open-ils-commits mailing list