Issue #56, remove diagnostics tools menu, remove missing document list functionality
This commit is contained in:
@@ -10,7 +10,7 @@ from common.utils import encapsulate, validate_path
|
||||
from dynamic_search.classes import SearchModel
|
||||
from history.api import register_history_type
|
||||
from history.permissions import PERMISSION_HISTORY_VIEW
|
||||
from main.api import register_diagnostic, register_maintenance_links
|
||||
from main.api import register_maintenance_links
|
||||
from navigation.api import (register_links, register_model_list_columns,
|
||||
register_top_menu)
|
||||
from navigation.links import link_spacer
|
||||
@@ -26,8 +26,7 @@ from .links import (document_clear_image_cache,
|
||||
document_document_type_edit,
|
||||
document_multiple_document_type_edit, document_download,
|
||||
document_edit, document_history_view, document_list,
|
||||
document_list_recent, document_missing_list,
|
||||
document_multiple_delete,
|
||||
document_list_recent, document_multiple_delete,
|
||||
document_multiple_clear_transformations,
|
||||
document_multiple_download,
|
||||
document_multiple_update_page_count, document_page_edit,
|
||||
@@ -104,7 +103,6 @@ register_links('documents:document_page_transformation_list', [document_page_tra
|
||||
register_links('documents:document_page_transformation_create', [document_page_transformation_create], menu_name='sidebar')
|
||||
register_links(['documents:document_page_transformation_edit', 'documents:document_page_transformation_delete'], [document_page_transformation_create], menu_name='sidebar')
|
||||
|
||||
register_diagnostic('documents', _(u'Documents'), document_missing_list)
|
||||
register_maintenance_links([document_clear_image_cache], namespace='documents', title=_(u'Documents'))
|
||||
register_model_list_columns(Document, [
|
||||
{
|
||||
|
||||
@@ -54,7 +54,6 @@ document_clear_transformations = {'text': _(u'Clear transformations'), 'view': '
|
||||
document_multiple_clear_transformations = {'text': _(u'Clear transformations'), 'view': 'documents:document_multiple_clear_transformations', 'famfam': 'page_paintbrush', 'permissions': [PERMISSION_DOCUMENT_TRANSFORM]}
|
||||
document_print = {'text': _(u'Print'), 'view': 'documents:document_print', 'args': 'object.id', 'famfam': 'printer', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
|
||||
document_history_view = {'text': _(u'History'), 'view': 'history:history_for_object', 'args': ['"documents"', '"document"', 'object.id'], 'famfam': 'book_go', 'permissions': [PERMISSION_HISTORY_VIEW]}
|
||||
document_missing_list = {'text': _(u'Find missing document files'), 'view': 'documents:document_missing_list', 'famfam': 'folder_page', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
|
||||
|
||||
# Tools
|
||||
document_clear_image_cache = {'text': _(u'Clear the document image cache'), 'view': 'documents:document_clear_image_cache', 'famfam': 'camera_delete', 'permissions': [PERMISSION_DOCUMENT_TOOLS], 'description': _(u'Clear the graphics representations used to speed up the documents\' display and interactive transformations results.')}
|
||||
|
||||
@@ -59,8 +59,6 @@ urlpatterns = patterns('documents.views',
|
||||
url(r'^page/transformation/(?P<document_page_transformation_id>\d+)/edit/$', 'document_page_transformation_edit', (), 'document_page_transformation_edit'),
|
||||
url(r'^page/transformation/(?P<document_page_transformation_id>\d+)/delete/$', 'document_page_transformation_delete', (), 'document_page_transformation_delete'),
|
||||
|
||||
url(r'^missing/list/$', 'document_missing_list', (), 'document_missing_list'),
|
||||
|
||||
# Admin views
|
||||
url(r'^type/list/$', 'document_type_list', (), 'document_type_list'),
|
||||
url(r'^type/create/$', 'document_type_create', (), 'document_type_create'),
|
||||
|
||||
@@ -550,28 +550,6 @@ def document_multiple_clear_transformations(request):
|
||||
return document_clear_transformations(request, document_id_list=request.GET.get('id_list', []))
|
||||
|
||||
|
||||
def document_missing_list(request):
|
||||
Permission.objects.check_permissions(request.user, [PERMISSION_DOCUMENT_VIEW])
|
||||
|
||||
previous = request.POST.get('previous', request.GET.get('previous', request.META.get('HTTP_REFERER', None)))
|
||||
|
||||
if request.method != 'POST':
|
||||
return render_to_response('main/generic_confirm.html', {
|
||||
'previous': previous,
|
||||
'message': _(u'On large databases this operation may take some time to execute.'),
|
||||
}, context_instance=RequestContext(request))
|
||||
else:
|
||||
missing_id_list = []
|
||||
for document in Document.objects.only('id',):
|
||||
if not storage_backend.exists(document.file):
|
||||
missing_id_list.append(document.pk)
|
||||
|
||||
return render_to_response('main/generic_list.html', {
|
||||
'object_list': Document.objects.in_bulk(missing_id_list).values(),
|
||||
'title': _(u'Missing documents'),
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
def document_page_view(request, document_page_id):
|
||||
document_page = get_object_or_404(DocumentPage, pk=document_page_id)
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ from __future__ import absolute_import
|
||||
from project_setup.api import register_setup
|
||||
from project_tools.api import register_tool
|
||||
|
||||
from .links import admin_site, diagnostics, maintenance_menu
|
||||
from .links import admin_site, maintenance_menu
|
||||
|
||||
register_setup(admin_site)
|
||||
register_tool(diagnostics)
|
||||
register_tool(maintenance_menu)
|
||||
|
||||
@@ -3,17 +3,10 @@ from django.utils.functional import lazy
|
||||
|
||||
diagnostics = {}
|
||||
tools = {}
|
||||
# TODO: Use Django's included reverse_lazy
|
||||
reverse_lazy = lazy(reverse, str)
|
||||
|
||||
|
||||
def register_diagnostic(namespace, title, link):
|
||||
namespace_dict = diagnostics.get(namespace, {'title': None, 'links': []})
|
||||
namespace_dict['title'] = title
|
||||
link['url'] = link.get('url', reverse_lazy(link['view']))
|
||||
namespace_dict['links'].append(link)
|
||||
diagnostics[namespace] = namespace_dict
|
||||
|
||||
|
||||
def register_maintenance_links(links, title=None, namespace=None):
|
||||
namespace_dict = tools.get(namespace, {'title': None, 'links': []})
|
||||
namespace_dict['title'] = title
|
||||
|
||||
@@ -6,5 +6,4 @@ def is_superuser(context):
|
||||
|
||||
|
||||
maintenance_menu = {'text': _(u'Maintenance'), 'view': 'main:maintenance_menu', 'famfam': 'wrench', 'icon': 'wrench.png'}
|
||||
diagnostics = {'text': _(u'Diagnostics'), 'view': 'main:diagnostics', 'famfam': 'pill', 'icon': 'pill.png'}
|
||||
admin_site = {'text': _(u'Admin site'), 'view': 'admin:index', 'famfam': 'keyboard', 'icon': 'keyboard.png', 'condition': is_superuser}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 1.4 KiB |
Reference in New Issue
Block a user