- 'tags': list(save_form.fields['stage_completed'].choices),
- 'can_pubmark': request.user.has_perm('catalogue.can_pubmark'),
- })
-
-
-@require_GET
-def editor_readonly(request, slug, chunk=None, template_name='wiki/document_details_readonly.html'):
- try:
- chunk = Chunk.get(slug, chunk)
- revision = request.GET['revision']
- except (Chunk.MultipleObjectsReturned, Chunk.DoesNotExist, KeyError):
- raise Http404
- if not chunk.book.accessible(request):
- return HttpResponseForbidden("Not authorized.")
-
- access_time = datetime.now()
- last_books = request.session.get("wiki_last_books", {})
- last_books[slug, chunk.slug] = {
- 'time': access_time,
- 'title': chunk.book.title,
- }
-
- if len(last_books) > MAX_LAST_DOCS:
- oldest_key = min(last_books, key=lambda x: last_books[x]['time'])
- del last_books[oldest_key]
- request.session['wiki_last_books'] = last_books
-
- return render(request, template_name, {
- 'chunk': chunk,
- 'revision': revision,
- 'readonly': True,
- 'REDMINE_URL': settings.REDMINE_URL,