Now, electronic items that are not cleared for copyright are not downloadable
by students. Such items are visible to instructors and staff, with a clear
visual warning.
git-svn-id: svn://svn.open-ils.org/ILS-Contrib/servres/trunk@1131
6d9bc8c9-1ec2-4278-b937-
99fde70a366f
.itemtree li .mainline { padding-left: 8px; }
.itemtree li .author_pub { padding-left: 8px; font-size: 90%; margin: 2px 0; color: #111; }
+.itemtree li .forbidden_notice { padding-left: 8px; font-size: 90%; margin: 2px 0; color: darkred; }
.itemtree .metalink { padding-left: 8px; color: gray; }
.itemtree .metalink a {
list-style-image: url(tango/x-office-address-book.png);
}
+.itemtree li.forbidden {
+ background-color: #fdd;
+}
.instructors {
border: 1px solid #ccc;
"""Should an 'About' link be displayed for this item?"""
return self.item_type in ('URL',)
+ def copyright_status_ok(self):
+ return not (self.item_type == u'ELEC' and self.copyright_status == u'UK')
+
def item_download_url(self):
if self.item_type != 'ELEC':
return None
site = get_object_or_404(models.Site, pk=site_id)
item = get_object_or_404(models.Item, pk=item_id, site__id=site_id)
assert item.item_type == 'ELEC', _('Can only download ELEC documents!')
+
+ # don't allow download of items that need a declaration.
+ item_declaration_required = item.needs_declaration_from(request.user)
+ if item_declaration_required:
+ return HttpResponseRedirect(item.item_url())
+
+ # don't allow download of items that are not copyright-cleared.
+ if not (item.copyright_status_ok() or site.can_edit(request.user)):
+ return HttpResponseRedirect(item.item_url())
+
fileiter = item.fileobj.chunks()
resp = HttpResponse(fileiter)
resp['Content-Type'] = item.fileobj_mimetype or 'application/octet-stream'
<ul py:def="show_tree(tree, edit=False)"
py:if="tree"
class="itemtree">
- <li py:for="item, subs in tree" class="item_${item.item_type} an_item"
+ <li py:for="item, subs in tree" py:with="forbidden=not item.copyright_status_ok()" class="item_${item.item_type} an_item ${forbidden and 'forbidden' or ''}"
id="item_${item.id}">
<abbr py:if="item.marcxml" class="unapi-id" title="${item.id}"/>
<div class="availability" py:if="item.item_type == 'PHYS'">
<span py:if="item.publisher">${item.publisher}.</span>
<span py:if="item.published">${item.published}.</span>
</div>
+ <div class="forbidden_notice" py:if="forbidden">Awaiting copyright clearance: Not available to students.</div>
<div>
<div class="menublock" py:if="not (item.item_type=='HEADING' and not edit)">
<span py:if="item.needs_meta_link()">
<tr><th>Issue</th><td><input type="text" name="issue" value="${item.issue}"/></td></tr>
<tr><th>Pages</th><td><input type="text" name="pages" value="${item.pages}"/></td></tr>
<tr><th>ISBN</th><td><input type="text" name="isbn" value="${item.isbn}"/></td></tr>
- <tr>
+ <tr py:if="user.is_staff">
<th>Copyright Status</th>
<td>
<select name="copyright_status">
<option py:for="k,v in item.COPYRIGHT_STATUS_CHOICES"
py:attrs="{'selected': item.copyright_status==k or None}"
+ value="${k}"
py:content="v"/>
</select>
</td>
<xi:include href="../components/site.xhtml"/>
<head>
<title>${title}</title>
+ <style py:if="not is_editor">.forbidden { display: none; }</style>
</head>
<body>
${site_banner(site)}
<div py:if="item.item_type=='ELEC'">
<h2 class="metadata_subhead">Download the document</h2>
+ <div class="errors" py:if="not item.copyright_status_ok()">
+ Note: this item is awaiting <a href="edit/">copyright clearance</a>. Only staff and instructors may download it.
+ </div>
<div id="ask_to_download_panel">
<p py:if="custom_declaration" py:content="custom_declaration"/>
<p py:if="not custom_declaration">By pressing the 'Request' button
<xi:include href="components/site.xhtml"/>
<head>
<title>${title}</title>
+ <style py:if="not is_editor">.forbidden { display: none; }</style>
</head>
<body>
${site_banner(site)}