From: gfawcett Date: Thu, 6 Jan 2011 03:00:58 +0000 (+0000) Subject: show call number on index and metadata pages; better item-availability presentation. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=04ac4551b0c414c0b109ccb12c159d4ec249a971;p=Syrup.git show call number on index and metadata pages; better item-availability presentation. git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1164 6d9bc8c9-1ec2-4278-b937-99fde70a366f --- diff --git a/conifer/TODO b/conifer/TODO index 3560aa3..a0d1fea 100644 --- a/conifer/TODO +++ b/conifer/TODO @@ -2,14 +2,11 @@ NEW: * 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 @@ RECENTLY DONE: * 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 + diff --git a/conifer/static/main.css b/conifer/static/main.css index 06a831c..4711255 100644 --- a/conifer/static/main.css +++ b/conifer/static/main.css @@ -356,6 +356,14 @@ ul.heading_tree { margin: 0; padding-left: 0; } 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; } diff --git a/conifer/syrup/models.py b/conifer/syrup/models.py index 076783c..cc45f6e 100644 --- a/conifer/syrup/models.py +++ b/conifer/syrup/models.py @@ -659,8 +659,18 @@ class Item(BaseModel): #-------------------------------------------------- # 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 @@ class Item(BaseModel): 'f':'videocassette', 'r':'videoreel', 'z':'video, other format'} + def video_type(self): if not self.marcxml: return None @@ -758,6 +769,18 @@ class Item(BaseModel): 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): diff --git a/conifer/templates/components/site.xhtml b/conifer/templates/components/site.xhtml index bc142f0..1481f50 100644 --- a/conifer/templates/components/site.xhtml +++ b/conifer/templates/components/site.xhtml @@ -33,16 +33,19 @@ searchtext = _('search this site...')
  • +
    - +
    - ${_avail}/${_desk} +
    ${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})
    +
    ${item.call_number()}
    +
    diff --git a/conifer/templates/item/item_metadata.xhtml b/conifer/templates/item/item_metadata.xhtml index 6a56a84..afe53c7 100644 --- a/conifer/templates/item/item_metadata.xhtml +++ b/conifer/templates/item/item_metadata.xhtml @@ -5,6 +5,7 @@ hier = item.hierarchy()[:-1] title = item.title is_editor = site.can_edit(request.user) vidtype = item.video_type() +callnum = item.call_number() ?> Issue${item.issue} Pages${item.pages} ISBN${item.isbn} + Call Number${callnum} Copyright status${item.get_copyright_status_display()} Type${item.get_item_type_display()}