[open-ils-commits] r277 - in servres/trunk/conifer: . custom static syrup templates (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Sun Apr 5 15:18:11 EDT 2009
Author: gfawcett
Date: 2009-04-05 15:18:07 -0400 (Sun, 05 Apr 2009)
New Revision: 277
Modified:
servres/trunk/conifer/TODO
servres/trunk/conifer/custom/lib_integration.py
servres/trunk/conifer/static/main.css
servres/trunk/conifer/syrup/models.py
servres/trunk/conifer/syrup/views.py
servres/trunk/conifer/templates/item_add_cat_search.xhtml
servres/trunk/conifer/templates/item_metadata.xhtml
Log:
physical item view: check and display item-status
Modified: servres/trunk/conifer/TODO
===================================================================
--- servres/trunk/conifer/TODO 2009-04-05 18:34:25 UTC (rev 276)
+++ servres/trunk/conifer/TODO 2009-04-05 19:18:07 UTC (rev 277)
@@ -2,6 +2,9 @@
IMPORTANT:
+* finish the physical-item received workflow.
+ * how to model 'received' in the database?
+
* does 'move to new heading' show up in the right places? Should be like 'edit'.
* a short-number for physical items. Sort of a barcode, but intended
Modified: servres/trunk/conifer/custom/lib_integration.py
===================================================================
--- servres/trunk/conifer/custom/lib_integration.py 2009-04-05 18:34:25 UTC (rev 276)
+++ servres/trunk/conifer/custom/lib_integration.py 2009-04-05 19:18:07 UTC (rev 277)
@@ -41,10 +41,12 @@
from conifer.libsystems.z3950.marcxml import marcxml_to_dictionary
+ at caching('itemstatus', timeout=300)
@SIP
def patron_info(conn, barcode):
return conn.patron_info(barcode)
+ at caching('itemstatus', timeout=300)
@SIP
def item_status(conn, barcode):
return conn.item_info(barcode)
Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css 2009-04-05 18:34:25 UTC (rev 276)
+++ servres/trunk/conifer/static/main.css 2009-04-05 19:18:07 UTC (rev 277)
@@ -54,7 +54,7 @@
/* heading sizes and colours. */
h1 { font-size: 150%; }
-h2 { font-size: 135%; }
+h2 { font-size: 125%; }
h3 { font-size: 120%; }
h1 { color: navy; }
@@ -226,7 +226,8 @@
{ float: right; font-size: 95%; margin: 8 0; clear: both; text-align: right; }
-.breadcrumbs { margin: 8 8 8 0; }
+.breadcrumbs { margin: 8 8 8 0; width: 800;
+ text-indent: -24; padding-left: 24; }
.errorlist { float: right; }
.errorlist li { color: red; font-size: 90%; }
@@ -273,3 +274,4 @@
ul.heading_tree li { list-style: none; }
ul.heading_tree { margin: 0; padding-left: 0; }
ul.heading_tree ul { margin: 0; padding-left: 25; }
+
Modified: servres/trunk/conifer/syrup/models.py
===================================================================
--- servres/trunk/conifer/syrup/models.py 2009-04-05 18:34:25 UTC (rev 276)
+++ servres/trunk/conifer/syrup/models.py 2009-04-05 19:18:07 UTC (rev 277)
@@ -7,6 +7,7 @@
from django.utils.translation import ugettext as _
from conifer.custom import course_codes # fixme, not sure if conifer.custom is a good parent.
from conifer.custom import course_sections # fixme, not sure if conifer.custom is a good parent.
+from conifer.custom import lib_integration
import re
import random
@@ -461,8 +462,20 @@
else:
return self.course.course_url()
+ def describe_physical_item_status(self):
+ """Return a (bool,str) tuple: whether the item is available,
+ and a friendly description of the physical item's status"""
+ if self.item_type != 'PHYS':
+ return False, _('(Not a physical item)')
+
+ #fixme: just having barcode in item-metadata doesn't mean 'in Reserves'
+ bc = self.barcode()
+ if not bc:
+ return False, _('On order')
+ else:
+ status = lib_integration.item_status(bc)
+ return status['available'], _(status['status'])
-
metadata_attributes = {
'dc:contributor': _('Contributor'),
'dc:coverage': _('Coverage'),
Modified: servres/trunk/conifer/syrup/views.py
===================================================================
--- servres/trunk/conifer/syrup/views.py 2009-04-05 18:34:25 UTC (rev 276)
+++ servres/trunk/conifer/syrup/views.py 2009-04-05 19:18:07 UTC (rev 277)
@@ -710,8 +710,20 @@
@instructors_only
def item_add_cat_search(request, course_id, item_id):
+ # this chunk stolen from item_add(). Refactor.
+ parent_item_id = item_id
+ if parent_item_id=='0':
+ parent_item = None
+ course = get_object_or_404(models.Course, pk=course_id)
+ else:
+ parent_item = get_object_or_404(models.Item, pk=parent_item_id, course__id=course_id)
+ assert parent_item.item_type == 'HEADING', _('You can only add items to headings!')
+ course = parent_item.course
+ #----------
+
if request.method != 'POST':
- return g.render('item_add_cat_search.xhtml', results=[], query='')
+ return g.render('item_add_cat_search.xhtml', results=[], query='',
+ course=course, parent_item=parent_item)
# POST handler
query = request.POST.get('query','').strip()
@@ -721,7 +733,8 @@
assert query, 'must provide a query.'
results = lib_integration.cat_search(query)
return g.render('item_add_cat_search.xhtml',
- results=results, query=query)
+ results=results, query=query,
+ course=course, parent_item=parent_item)
else:
# User has selected an item; add it to course site.
#fixme, this block copied from item_add. refactor.
Modified: servres/trunk/conifer/templates/item_add_cat_search.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_add_cat_search.xhtml 2009-04-05 18:34:25 UTC (rev 276)
+++ servres/trunk/conifer/templates/item_add_cat_search.xhtml 2009-04-05 19:18:07 UTC (rev 277)
@@ -9,6 +9,7 @@
xmlns:py="http://genshi.edgewall.org/">
<xi:include href="master.xhtml"/>
<xi:include href="paginate.xhtml"/>
+<xi:include href="components/course.xhtml"/>
<head>
<title>${title}</title>
<script type="text/javascript">
@@ -20,7 +21,9 @@
</script>
</head>
<body>
- <h1>${title}</h1>
+ ${course_banner(course)}
+ ${nested_title(parent_item)}
+ <h2>${title}</h2>
<form method="POST" action=".">
<input type="text" id="query" name="query" value="${query}"
style="font-size: larger; width: 600;"/>
Modified: servres/trunk/conifer/templates/item_metadata.xhtml
===================================================================
--- servres/trunk/conifer/templates/item_metadata.xhtml 2009-04-05 18:34:25 UTC (rev 276)
+++ servres/trunk/conifer/templates/item_metadata.xhtml 2009-04-05 19:18:07 UTC (rev 277)
@@ -13,6 +13,10 @@
<xi:include href="components/course.xhtml"/>
<head>
<title>${title}</title>
+ <style>
+ .available { color: green; border-left: 16px green solid; padding-left: 8px; }
+ .unavailable { color: red; border-left: 16px red solid; padding-left: 8px; }
+ </style>
</head>
<body>
${course_banner(course)}
@@ -28,18 +32,22 @@
<table class="metadata_table" style="margin-top: 1em;">
<tr><th>Title</th><td>${item.title}</td></tr>
<tr><th>Type</th><td>${item.get_item_type_display()}</td></tr>
+ <tr py:if="item.item_type=='PHYS'"
+ py:with="avail, status = item.describe_physical_item_status()">
+ <th>Status</th><td><div class="${avail and 'available' or 'unavailable'}">${status}</div></td>
+ </tr>
<tr py:if="item.url"><th>URL</th><td><a href="${item.url}">${item.url}</a></td></tr>
</table>
<div py:if="item.item_type=='ELEC'">
- <h2 class="metadata_subhead">Attached document</h2>
- <table class="metadata_table">
- <tr><th>Content type</th><td>${item.fileobj_mimetype}</td></tr>
- <tr><th>Size</th><td>${item.fileobj.size} bytes</td></tr>
- <tr><th/><td><a class="bigdownload" href="${item.item_url()}">Download</a></td></tr>
- </table>
+ <h2 class="metadata_subhead">Attached document</h2>
+ <table class="metadata_table">
+ <tr><th>Content type</th><td>${item.fileobj_mimetype}</td></tr>
+ <tr><th>Size</th><td>${item.fileobj.size} bytes</td></tr>
+ <tr><th/><td><a class="bigdownload" href="${item.item_url()}">Download</a></td></tr>
+ </table>
</div>
<div py:if="metadata">
- <h2 class="metadata_subhead">Additional metadata</h2>
+ <h3>Additional metadata</h3>
<table class="metadata_table">
<tr py:for="attr in metadata">
<th>${attr.get_name_display()}</th>
More information about the open-ils-commits
mailing list