dueinfo = ''
callno = ''
circmod = ''
+ alldues = []
+
for org, callnum, loc, stats in counts:
callprefix = ''
callsuffix = ''
attachtest = re.search(settings.ATTACHMENT, callnum)
if loc == RESERVES_DESK_NAME:
- desk += anystatus_here
+ desk += anystatus_here
avail += avail_here
+ dueinfo = ''
+
if (voltest and vol > 0):
if (int(voltest.group(1)) > vol):
callsuffix = "/" + callnum
else:
callprefix = callnum + "/"
- elif attachtest and callno.find(attachtest.group(0)) == -1:
+ elif attachtest and callno.find(attachtest.group(0)) == -1:
if len(callno) > 0:
callsuffix = "/" + callnum
else:
callprefix = callnum
- else:
- callno = callnum
- dueinfo = ''
- lib += anystatus_here
- copyids = E1(settings.OPENSRF_CN_CALL, bib_id, callnum, org)
+ else:
+ callno = callnum
+
+ lib += anystatus_here
+ copyids = E1(settings.OPENSRF_CN_CALL, bib_id, callnum, org)
- """
- we want to return the resource that will be returned first if
- already checked out
- """
- for copyid in copyids:
+
+ """
+ we want to return the resource that will be returned first if
+ already checked out
+ """
+ for copyid in copyids:
circinfo = E1(settings.OPENSRF_FLESHED2_CALL, copyid)
- if loc == RESERVES_DESK_NAME:
+
+ thisloc = circinfo.get("location")
+ if thisloc:
+ thisloc = thisloc.get("name")
+
+ if thisloc == RESERVES_DESK_NAME:
bringfw = attachtest
+
# multiple volumes
if voltest and callno.find(voltest.group(0)) == -1:
bringfw = True
tmpinfo = dueinfo
dueinfo = voltest.group(0) + ': ' + time.strftime(settings.DUE_FORMAT,earliestdue)
if len(tmpinfo) > 0:
- dueinfo = dueinfo + "/" + dueinfo
+ dueinfo = dueinfo + "/" + tmpinfo
callprefix = callsuffix = ''
elif attachtest:
tmpinfo = dueinfo
else:
callno = callnum
if len(tmpinfo) > 0:
- dueinfo = dueinfo + "/" + dueinfo
+ dueinfo = dueinfo + "/" + tmpinfo
if not bringfw:
dueinfo = time.strftime(settings.DUE_FORMAT,earliestdue)
earliestdue = duetime
dueinfo = time.strftime(DUE_FORMAT,earliestdue)
callno = callnum
-
- if voltest or attachtest:
- callno = callprefix + callno + callsuffix
- if voltest:
- vol = int(voltest.group(1))
- return (lib, desk, avail, callno, dueinfo, circmod)
+
+ alldisplay = callnum + ' Available'
+ if (avail == 0):
+ alldisplay = '%s %s' % (callnum, dueinfo)
+ alldues.append(alldisplay)
+
+ if voltest or attachtest:
+ if callno.find(callprefix) == -1:
+ callno = callprefix + callno
+ if callno.find(callsuffix) == -1:
+ callno = callno + callsuffix
+ if voltest:
+ vol = int(voltest.group(1))
+ return (lib, desk, avail, callno, dueinfo, circmod, alldues)
except:
print "due date/call problem: ", bib_id
print "*** print_exc:"
?>
<div class="availability" py:if="item.item_type == 'PHYS'">
<a href="${item.item_url()}">
- <div py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo, _circmod) = stat"
+ <div py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo, _circmod, _alldues) = stat"
class="${_avail > 0 and 'available' or 'unavailable'}"
title="${_avail} of ${_desk} copies available at reserves desk; ${_lib} total copies in library system">
<div>${_avail and 'Available' or 'Unavailable'} (${_avail}/${_desk})</div>
</div>
</a>
- <div py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo, _circmod) = stat">
- <div py:if="_desk > 1 and item.bib_id and gethook('bib_id_to_url')"
- py:with="url=callhook('bib_id_to_url', item.bib_id)">
- <a py:if="url" href="${url}">View status of all copies in catalogue</a>
- </div>
+ <div py:if="valid" py:with="(_lib, _desk, _avail, _callno, _dueinfo, _circmod, _alldues) = stat">
+ <div id="status_${item.id}" style="display: none;">
+ <script type="text/javascript">
+ function show_stuff(the_id){
+ document.getElementById('status_' + the_id).style.display="block";
+ document.getElementById('showlink_' + the_id).style.display="none";
+ document.getElementById('hidelink_' + the_id).style.display="block";
+ }
+ function hide_stuff(the_id){
+ document.getElementById('status_' + the_id).style.display="none";
+ document.getElementById('showlink_' + the_id).style.display="block";
+ document.getElementById('hidelink_' + the_id).style.display="none";
+ }
+ </script>
+ <div py:for="k in _alldues">
+ ${k}
+ </div>
+ </div>
+ <div id="showlink_${item.id}" py:if="len(_alldues) > 1">
+ <a href="javascript:show_stuff('${item.id}');">Show status of all copies</a>
+ </div>
+ <div style="display: none;" id="hidelink_${item.id}" py:if="len(_alldues) > 1">
+ <a href="javascript:hide_stuff('${item.id}');">Hide status details</a>
+ </div>
</div>
</div>