[open-ils-commits] r1196 - in servres/trunk/conifer: integration syrup/views templates/item (artunit)
svn at svn.open-ils.org
svn at svn.open-ils.org
Fri Jan 14 01:25:46 EST 2011
Author: artunit
Date: 2011-01-14 01:25:43 -0500 (Fri, 14 Jan 2011)
New Revision: 1196
Modified:
servres/trunk/conifer/integration/uwindsor.py
servres/trunk/conifer/syrup/views/items.py
servres/trunk/conifer/templates/item/item_add_cat_search.xhtml
Log:
snag bibid from url search
Modified: servres/trunk/conifer/integration/uwindsor.py
===================================================================
--- servres/trunk/conifer/integration/uwindsor.py 2011-01-13 02:36:03 UTC (rev 1195)
+++ servres/trunk/conifer/integration/uwindsor.py 2011-01-14 06:25:43 UTC (rev 1196)
@@ -155,8 +155,14 @@
return None
def cat_search(query, start=1, limit=10):
+ bibid=0
if query.startswith(EG_BASE):
# query is an Evergreen URL
+ # snag the bibid at this point
+ params = dict([x.split("=") for x in query.split("&")])
+ for key in params.keys():
+ if key.find('?r') != -1:
+ bibid = params[key]
results = M.marcxml_to_records(I.url_to_marcxml(query))
numhits = len(results)
else:
@@ -176,7 +182,7 @@
tree = M.marcxml_to_records(marc)[0]
results.append(tree)
numhits = int(superpage['count'])
- return results, numhits
+ return results, numhits, bibid
def bib_id_to_marcxml(bib_id):
"""
Modified: servres/trunk/conifer/syrup/views/items.py
===================================================================
--- servres/trunk/conifer/syrup/views/items.py 2011-01-13 02:36:03 UTC (rev 1195)
+++ servres/trunk/conifer/syrup/views/items.py 2011-01-14 06:25:43 UTC (rev 1196)
@@ -244,11 +244,11 @@
site=site, parent_item=parent_item)
query = request.GET.get('query','').strip()
start, limit = (int(request.GET.get(k,v)) for k,v in (('start',1),('limit',10)))
- results, numhits = integration.cat_search(query, start, limit)
+ results, numhits, bibid = integration.cat_search(query, start, limit)
return g.render('item/item_add_cat_search.xhtml',
results=results, query=query,
start=start, limit=limit, numhits=numhits,
- site=site, parent_item=parent_item)
+ site=site, parent_item=parent_item, bibid=bibid)
else:
# User has selected an item; add it to site.
raw_pickitem = request.POST.get('pickitem', '').strip()
@@ -298,6 +298,7 @@
author=dublin.get('dc:creator'),
publisher=dublin.get('dc:publisher',''),
published=pubdate,
+ bib_id=request.POST.get('bibid'),
marcxml=raw_pickitem,
**dct)
item.save()
Modified: servres/trunk/conifer/templates/item/item_add_cat_search.xhtml
===================================================================
--- servres/trunk/conifer/templates/item/item_add_cat_search.xhtml 2011-01-13 02:36:03 UTC (rev 1195)
+++ servres/trunk/conifer/templates/item/item_add_cat_search.xhtml 2011-01-14 06:25:43 UTC (rev 1196)
@@ -75,6 +75,7 @@
<td>
<form action="." method="POST">
<!-- !TODO: is utf8 okay here? I shouldn't have to do any decoding here. -->
+ <input type="hidden" name="bibid" value="${bibid}"/>
<input type="hidden" name="pickitem" value="${ET.tostring(res)}"/>
<input type="submit" value="Pick this item"/>
</form>
More information about the open-ils-commits
mailing list