[open-ils-commits] r460 - in servres/trunk/conifer: static syrup syrup/views templates/phys (gfawcett)
svn at svn.open-ils.org
svn at svn.open-ils.org
Wed May 6 20:15:55 EDT 2009
Author: gfawcett
Date: 2009-05-06 20:15:54 -0400 (Wed, 06 May 2009)
New Revision: 460
Added:
servres/trunk/conifer/templates/phys/circlist_for_term.xhtml
servres/trunk/conifer/templates/phys/circlist_index.xhtml
Modified:
servres/trunk/conifer/static/main.css
servres/trunk/conifer/syrup/urls.py
servres/trunk/conifer/syrup/views/items.py
Log:
added preliminary 'Notify circ of wanted items' screen.
More work to be done on the backend query, as well as on the display
and possible export-format of data for circ.
Modified: servres/trunk/conifer/static/main.css
===================================================================
--- servres/trunk/conifer/static/main.css 2009-05-07 00:15:51 UTC (rev 459)
+++ servres/trunk/conifer/static/main.css 2009-05-07 00:15:54 UTC (rev 460)
@@ -318,6 +318,7 @@
text-align: left; width: 120px;
}
.gap { height: 24px; }
+.metadata_table td { max-width: 800px; overflow: hidden; }
/* panels that appear when specific OPTIONs or radio-buttons are selected. */
.specific { padding: 8px; margin: 0 16px; background-color: #eef; }
Modified: servres/trunk/conifer/syrup/urls.py
===================================================================
--- servres/trunk/conifer/syrup/urls.py 2009-05-07 00:15:51 UTC (rev 459)
+++ servres/trunk/conifer/syrup/urls.py 2009-05-07 00:15:54 UTC (rev 460)
@@ -51,6 +51,7 @@
(r'^phys/checkout/$', 'phys_checkout'),
(r'^phys/mark_arrived/$', 'phys_mark_arrived'),
(r'^phys/mark_arrived/match/$', 'phys_mark_arrived_match'),
+ (r'^phys/circlist/$', 'phys_circlist'),
(r'^course/(?P<course_id>\d+)/reseq$', 'course_reseq'),
(ITEM_PREFIX + r'reseq', 'item_heading_reseq'),
Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py 2009-05-07 00:15:51 UTC (rev 459)
+++ servres/trunk/conifer/syrup/views/items.py 2009-05-07 00:15:54 UTC (rev 460)
@@ -481,3 +481,30 @@
item.metadata_set.create(name='syrup:barcode', value=barcode)
item.save()
return g.render('phys/mark_arrived_outcome.xhtml')
+
+ at admin_only
+def phys_circlist(request):
+ term_code = request.GET.get('term')
+ if not term_code:
+ terms = models.Term.objects.order_by('code')
+ return g.render('phys/circlist_index.xhtml', terms=terms)
+
+ term = get_object_or_404(models.Term, code=term_code)
+
+ # gather the list of wanted items for this term.
+ # Fixme, I need a better way.
+
+ cursor = django.db.connection.cursor()
+ q = "select item_id from syrup_metadata where name='syrup:barcode'"
+ cursor.execute(q)
+ bad_ids = set([r[0] for r in cursor.fetchall()])
+ cursor.close()
+
+ wanted = models.Item.objects.filter(
+ item_type='PHYS', course__term=term).select_related('metadata')
+ wanted = [w for w in wanted if w.id not in bad_ids]
+ return g.render('phys/circlist_for_term.xhtml',
+ term=term,
+ wanted=wanted)
+
+
Added: servres/trunk/conifer/templates/phys/circlist_for_term.xhtml
===================================================================
--- servres/trunk/conifer/templates/phys/circlist_for_term.xhtml (rev 0)
+++ servres/trunk/conifer/templates/phys/circlist_for_term.xhtml 2009-05-07 00:15:54 UTC (rev 460)
@@ -0,0 +1,47 @@
+<?python
+title = _('Wanted items: %s') % term
+from conifer.libsystems.z3950.marcxml import marcxml_dictionary_to_dc as to_dublin
+dc_keys = ['dc:title', 'dc:creator', 'dc:publisher', 'dc:date']
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="../master.xhtml"/>
+<head>
+ <title>${title}</title>
+</head>
+<body>
+ <h1>${title}</h1>
+
+<table class="pagetable">
+ <thead>
+ <tr><th>#</th><th>Title</th><th>Author</th><th>Publisher</th><th>PubDate</th></tr>
+ </thead>
+ <tbody py:for="resultnum, res in enumerate(w.marc() for w in wanted)"
+ py:with="dc=to_dublin(res)">
+ <tr>
+ <td>${resultnum+1}.</td>
+ <td>
+ ${dc.get('dc:title', '???')}
+ <a href="javascript:$('#full_${resultnum}').toggle(); void(0);">details</a>
+ <p py:if="res.get('8569')" style="margin: 8px 0; font-size: 90%; color: darkred;">
+ Electronic resource. <a href="${res.get('856u')}">view</a>
+ </p>
+ </td>
+ <td py:for="k in dc_keys[1:]">${dc.get(k) or '—'}</td>
+ </tr>
+ <tr id="full_${resultnum}" style="display: none;">
+ <td colspan="5" style="padding-left: 36;">
+ <table class="metadata_table">
+ <?python allkeys = res.keys(); allkeys.sort(); ?>
+ <tr py:for="k in allkeys">
+ <th>${k}</th><td>${res[k]}</td>
+ </tr>
+ </table>
+ </td>
+ </tr>
+ </tbody>
+ </table>
+
+</body>
+</html>
Added: servres/trunk/conifer/templates/phys/circlist_index.xhtml
===================================================================
--- servres/trunk/conifer/templates/phys/circlist_index.xhtml (rev 0)
+++ servres/trunk/conifer/templates/phys/circlist_index.xhtml 2009-05-07 00:15:54 UTC (rev 460)
@@ -0,0 +1,21 @@
+<?python
+title = _('Notify Circulation of wanted items')
+?>
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:xi="http://www.w3.org/2001/XInclude"
+ xmlns:py="http://genshi.edgewall.org/">
+<xi:include href="../master.xhtml"/>
+<head>
+ <title>${title}</title>
+</head>
+<body>
+ <h1>${title}</h1>
+ <p>Please select a term:</p>
+ <form action="." method="GET">
+ <select name="term">
+ <option py:for="term in terms" value="${term.code}">${term}</option>
+ </select>
+ <input type="submit" value="Continue"/>
+ </form>
+</body>
+</html>
More information about the open-ils-commits
mailing list