* 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?)
+
+* add a hook for a MARC-record-to-maybe-cover-image-URL function
#feeds_panel,
.little_action_panel
-{ float: right; font-size: 95%; margin: 8 0; clear: both; }
+{ float: right; font-size: 95%; margin: 8 0; clear: both; text-align: right; }
.breadcrumbs { margin: 8 8 8 0; }
var menublock = $(this);
var blockid = 'menublock' + (blocknum++);
menublock.attr('id', blockid);
- var opener = '<a class="menublockopener" onmouseout="maybe_cancelblock(\'' + blockid + '\');" onmouseover="maybe_openblock(\'' + blockid + '\');" href="javascript:openblock(\'' + blockid + '\');">»</a>';
+ var opener = '<a class="menublockopener" onmouseout="maybe_cancelblock(\'' + blockid + '\');" onmouseover="maybe_openblock(\'' + blockid + '\');" href="javascript:maybe_openblock(\'' + blockid + '\');">»</a>';
menublock.before(opener);
menublock.hide();
}
else:
return self.parent_heading.hierarchy() + [self]
+ def children(self):
+ return Item.objects.filter(parent_heading=self)
+
def needs_meta_link(self):
"""Should an 'About' link be displayed for this item?"""
(ITEM_PREFIX + r'dl/(?P<filename>.*)$', 'item_download'),
(ITEM_PREFIX + r'meta$', 'item_metadata'),
(ITEM_PREFIX + r'edit/$', 'item_edit'),
+ (ITEM_PREFIX + r'delete/$', 'item_delete'),
(ITEM_PREFIX + r'add/$', 'item_add'), # for adding sub-things
(ITEM_PREFIX + r'add/cat_search/$', 'item_add_cat_search'),
item.save()
return HttpResponseRedirect(item.parent_url())
+@instructors_only
+def item_delete(request, course_id, item_id):
+ course = get_object_or_404(models.Course, pk=course_id)
+ item = get_object_or_404(models.Item, pk=item_id, course__id=course_id)
+ if request.method != 'POST':
+ return g.render('item_delete_confirm.xhtml', **locals())
+ else:
+ if 'yes' in request.POST:
+ # I think Django's ON DELETE CASCADE-like behaviour will
+ # take care of the sub-items.
+ if item.parent_heading:
+ redir = HttpResponseRedirect(item.parent_heading.item_url('meta'))
+ else:
+ redir = HttpResponseRedirect(course.course_url())
+ item.delete()
+ return redir
+ else:
+ return HttpResponseRedirect('../meta')
@members_only
def item_download(request, course_id, item_id, filename):
<span id="i18n-save-order">Save Sequence</span>
<span id="i18n-resequence-items">Resequence Items</span>
<span id="i18n-new-order-saved">The new sequence has been saved.</span>
- <div id="ropanelmessage" style="clear: right; width: 10em;"
+ <div id="eropanelmessage" style="clear: right; width: 10em;"
class="little_action_panel">Drag the items around. Then click Save Sequence, above.</div>
</div>
</div>
+ <div py:def="offer_to_delete(item)" class="little_action_panel" py:if="item.id">
+ <a href="../delete/">Delete this item</a>
+ </div>
</html>
<body>
${course_banner(course)}
${nested_title(parent_item)}
+ ${offer_to_delete(item)}
<h2>${title}</h2>
<h3>Metadata</h3>
<div py:if="not is_edit">
<body>
${course_banner(course)}
${nested_title(parent_item)}
+ ${offer_to_delete(item)}
<h3>${title}</h3>
<form action=".?item_type=${item_type}" method="POST">
<table>
<body>
${course_banner(course)}
${nested_title(parent_item)}
+ ${offer_to_delete(item)}
<h3>${title}</h3>
<form action=".?item_type=${item_type}" method="POST">
<body>
${course_banner(course)}
${nested_title(parent_item)}
+ ${offer_to_delete(item)}
<h3>${title}</h3>
<form action=".?item_type=${item_type}" method="POST">
<table>
--- /dev/null
+<?python
+course_title = '%s: %s (%s)' % (course.code, course.title, course.term)
+hier = item.hierarchy()[:-1]
+if item.item_type == 'HEADING':
+ title = _('Delete this heading?')
+ children = item.children()
+else:
+ title = _('Delete this item?')
+ children = []
+metadata = item.metadata_set.all()
+?>
+<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"/>
+ <xi:include href="components/course.xhtml"/>
+ <head>
+ <title>${title}</title>
+ </head>
+ <body>
+ ${course_banner(course)}
+ ${nested_title(item)}
+ <h1>${title}</h1>
+ <p>Are you sure you want to delete this?</p>
+ <p py:if="children">
+ <strong>Note: this will also delete all items under the heading!</strong>
+ </p>
+ <table class="metadata_table" style="margin-top: 1em;">
+ <tr><th>Title</th><td>${item.title}</td></tr>
+ <tr><th>Type</th><td>${item.get_item_type_display()}</td></tr>
+ <tr py:if="item.url"><th>URL</th><td><a href="${item.url}">${item.url}</a></td></tr>
+ </table>
+ <p>
+ <form action="." method="POST">
+ <input type="submit" name="yes" value="Yes, delete it" style="padding: 4 12; margin-right: 24;"/>
+ <input type="submit" name="no" value="Cancel"/>
+ </form>
+ </p>
+ </body>
+</html>
+
<body>
${course_banner(course)}
${nested_title(item)}
+ <div py:if="is_editor" class="little_action_panel">
+ <div>
+ <a href="edit/">Edit this heading</a>
+ </div>
+ <div>
+ <a href="delete/">Delete this heading</a>
+ </div>
+ <div>
+ <a href="relocate/">Relocate this heading</a>
+ </div>
+ </div>
<p py:if="not item_tree">
There are no items in this section.
</p>
hier = item.hierarchy()[:-1]
title = item.title
metadata = item.metadata_set.all()
+is_editor = course.can_edit(request.user)
?>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:xi="http://www.w3.org/2001/XInclude"
<body>
${course_banner(course)}
${nested_title(item)}
+ <div py:if="is_editor">
+ <div class="little_action_panel">
+ <a href="edit/">Edit this item</a>
+ </div>
+ <div class="little_action_panel">
+ <a href="delete/">Delete this item</a>
+ </div>
+ </div>
<table class="metadata_table" style="margin-top: 1em;">
<tr><th>Title</th><td>${item.title}</td></tr>
<tr><th>Type</th><td>${item.get_item_type_display()}</td></tr>