IMPORTANT:
+* 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
for easier communicatinon between patrons and staff.
(Update views.search() when this is in place)
* People should be able to register themselves into open courses.
That is, actually become a member of them.
-* delete Item / delete Heading
-
-* testing on broken browsers (you know who you are)
-
-* the code is littered with 'dwarf' refrences. Factor out into config.
-
-* allow for bulk-import on add-physical-item
-
MAYBE:
* Generating barcodes in emails, printable screens? (3 of 9 enough?)
LOG = sys.stderr #None # for pexpect debugging, try LOG = sys.stderr
YAZ_CLIENT = 'yaz-client'
-GENERAL_TIMEOUT = 10
+GENERAL_TIMEOUT = 20
PRESENT_TIMEOUT = 30
def search(host, database, query, start=1, limit=None):
'dc:title': _('Title'),
'dc:type': _('Type'),
'syrup:barcode': _('Barcode'),
- 'syrup:marc': _('MARC'),
+ 'syrup:marc': _('MARC'), # MARC in JSON format.
'syrup:enumeration': _('Enumeration'),
'syrup:chronology': _('Chronology')}
item = m.ForeignKey(Item)
#fixme, arbitrary sizes.
name = m.CharField('Attribute', max_length=128, choices=metadata_attribute_choices)
- value = m.CharField(max_length=4096)
+ value = m.CharField(max_length=8192) # on postgres it doesn't matter how big.
#------------------------------------------------------------
# News items
# POST handler
query = request.POST.get('query','').strip()
- _pickitem = request.POST.get('pickitem', '').strip()
- if not _pickitem:
+ raw_pickitem = request.POST.get('pickitem', '').strip()
+ if not raw_pickitem:
# process the query.
assert query, 'must provide a query.'
results = lib_integration.cat_search(query)
if not course.can_edit(request.user):
return _access_denied(_('You are not an editor.'))
- pickitem = eval(_pickitem) # fixme, dangerous. cache result server-side instead, or encrypt it.
+ pickitem = simplejson.loads(raw_pickitem)
dublin = marcxml_dictionary_to_dc(pickitem)
item = course.item_set.create(parent_heading=parent_item,
md = item.metadata_set.create(item=item, name=dc, value=value)
# store the whole darn MARC-dict as well.
json = simplejson.dumps(pickitem)
- item.metadata_set.create(item=item, name='syrup:marc', value=json)
+ item.metadata_set.create(item=item, name='syrup:marc', value=raw_pickitem)
item.save()
return HttpResponseRedirect('../../../%d/' % item.id)
<?python
+from django.utils.simplejson import dumps
title = _('Add physical item: Catalogue search')
# I just made up these keys...
keys = [('245a', 'Title'), ('100a', 'Author'), ('260b', 'Publisher'), ('260c', 'PubDate'), ('700a', 'Editor')]
<!-- !This ought to be in paginate.xhtml, not here. how to do? -->
$(function() { $('.pagetable').tablesorter(); });
</script>
+ <script py:if="request.method != 'POST'"> <!-- !focus on query box if nothing to scroll. -->
+ $(function() { $('#query').focus(); });
+ </script>
</head>
<body>
<h1>${title}</h1>
<form method="POST" action=".">
- <input type="text" name="query" value="${query}" style="font-size: larger;"/>
+ <input type="text" id="query" name="query" value="${query}" style="font-size: larger;"/>
<input type="submit" value="Search"/>
</form>
<p><a href="javascript:$('.lesser').show(); void(0);">show more detail</a></p>
<tr>
<th/><td>
<form action="." method="POST">
- <input type="hidden" name="pickitem" value="${repr(res)}"/>
+ <input type="hidden" name="pickitem" value="${dumps(res)}"/>
<input type="submit" value="Pick this item"/>
</form>
</td>