Move link conversions, consolidate FrontPageLink with new link class
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
{% load i18n %}
|
||||
{% load static %}
|
||||
|
||||
{% load navigation_tags %}
|
||||
{% load project_tags %}
|
||||
|
||||
{% block title %} :: {% trans 'Home' %}{% endblock %}
|
||||
@@ -37,6 +38,7 @@
|
||||
|
||||
<div class="well center-block">
|
||||
<div class="row">
|
||||
{% get_menu_links 'front page menu' as object_navigation_links %}
|
||||
{% with 'navigation/large_button_link.html' as link_template %}
|
||||
{% with 'col-xs-12 col-sm-6 col-md-4 col-lg-4' as div_class %}
|
||||
{% include 'navigation/generic_navigation.html' %}
|
||||
|
||||
@@ -3,11 +3,13 @@ from __future__ import unicode_literals
|
||||
from navigation import Menu
|
||||
|
||||
__all__ = (
|
||||
'menu_facet', 'menu_object', 'menu_main', 'menu_multi_item',
|
||||
'menu_secondary', 'menu_setup', 'menu_sidebar', 'menu_tools'
|
||||
'menu_facet', 'menu_front_page', 'menu_object', 'menu_main',
|
||||
'menu_multi_item', 'menu_secondary', 'menu_setup', 'menu_sidebar',
|
||||
'menu_tools'
|
||||
)
|
||||
|
||||
menu_facet = Menu(name='object facet')
|
||||
menu_front_page = Menu(name='front page menu')
|
||||
menu_object = Menu(name='object menu')
|
||||
menu_main = Menu(name='main menu')
|
||||
menu_multi_item = Menu(name='multi item menu')
|
||||
|
||||
@@ -9,11 +9,14 @@ from actstream import registry
|
||||
|
||||
from acls.api import class_permissions
|
||||
from common.classes import ModelAttribute
|
||||
from common import menu_facet, menu_object, menu_setup
|
||||
from common import (
|
||||
menu_facet, menu_front_page, menu_object, menu_secondary, menu_setup,
|
||||
menu_sidebar, menu_multi_item
|
||||
)
|
||||
from common.utils import encapsulate, validate_path
|
||||
from dynamic_search.classes import SearchModel
|
||||
from events.permissions import PERMISSION_EVENTS_VIEW
|
||||
from main import FrontPageButton, MissingItem
|
||||
from main import MissingItem
|
||||
from main.api import register_maintenance_links
|
||||
from navigation.api import register_model_list_columns
|
||||
from rest_api.classes import APIEndPoint
|
||||
@@ -22,25 +25,31 @@ from statistics.classes import StatisticNamespace
|
||||
from documents import settings as document_settings
|
||||
from .links import (
|
||||
link_clear_image_cache, link_document_clear_transformations,
|
||||
link_document_content, link_document_delete, link_document_document_type_edit,
|
||||
link_document_events_view, document_multiple_document_type_edit,
|
||||
link_document_download, link_document_edit, link_document_list, link_document_list_recent,
|
||||
document_multiple_delete, document_multiple_clear_transformations,
|
||||
document_multiple_download, document_multiple_update_page_count,
|
||||
document_page_edit, document_page_navigation_first,
|
||||
document_page_navigation_last, document_page_navigation_next,
|
||||
document_page_navigation_previous, document_page_rotate_left,
|
||||
document_page_rotate_right, document_page_text,
|
||||
document_page_transformation_list, document_page_transformation_create,
|
||||
document_page_transformation_edit, document_page_transformation_delete,
|
||||
document_page_view, document_page_view_reset, document_page_zoom_in,
|
||||
document_page_zoom_out, link_document_preview, link_document_print,
|
||||
link_document_properties, document_type_create, document_type_delete,
|
||||
document_type_edit, document_type_filename_create,
|
||||
document_type_filename_delete, document_type_filename_edit,
|
||||
document_type_filename_list, document_type_list, link_document_type_setup,
|
||||
link_document_update_page_count, document_version_download,
|
||||
link_document_version_list, document_version_revert
|
||||
link_document_content, link_document_delete,
|
||||
link_document_document_type_edit, link_document_events_view,
|
||||
link_document_multiple_document_type_edit, link_document_download,
|
||||
link_document_edit, link_document_list, link_document_list_recent,
|
||||
link_document_multiple_delete,
|
||||
link_document_multiple_clear_transformations,
|
||||
link_document_multiple_download,
|
||||
link_document_multiple_update_page_count, link_document_page_edit,
|
||||
link_document_page_navigation_first, link_document_page_navigation_last,
|
||||
link_document_page_navigation_next,
|
||||
link_document_page_navigation_previous, link_document_page_rotate_left,
|
||||
link_document_page_rotate_right, link_document_page_text,
|
||||
link_document_page_transformation_list,
|
||||
link_document_page_transformation_create,
|
||||
link_document_page_transformation_edit,
|
||||
link_document_page_transformation_delete, link_document_page_view,
|
||||
link_document_page_view_reset, link_document_page_zoom_in,
|
||||
link_document_page_zoom_out, link_document_preview, link_document_print,
|
||||
link_document_properties, link_document_type_create,
|
||||
link_document_type_delete, link_document_type_edit,
|
||||
link_document_type_filename_create, link_document_type_filename_delete,
|
||||
link_document_type_filename_edit, link_document_type_filename_list,
|
||||
link_document_type_list, link_document_type_setup,
|
||||
link_document_update_page_count, link_document_version_download,
|
||||
link_document_version_list, link_document_version_revert
|
||||
)
|
||||
from .models import (
|
||||
Document, DocumentPage, DocumentPageTransformation, DocumentType,
|
||||
@@ -62,11 +71,20 @@ class DocumentsApp(apps.AppConfig):
|
||||
verbose_name = _('Documents')
|
||||
|
||||
def ready(self):
|
||||
APIEndPoint('documents')
|
||||
DocumentPage.add_to_class('get_transformation_list', lambda document_page: DocumentPageTransformation.objects.get_for_document_page_as_list(document_page))
|
||||
|
||||
MissingItem(label=_('Create a document type'), description=_('Every uploaded document must be assigned a document type, it is the basic way Mayan EDMS categorizes documents.'), condition=lambda: not DocumentType.objects.exists(), view='documents:document_type_list')
|
||||
ModelAttribute(Document, label=_('Label'), name='label', type_name='field')
|
||||
|
||||
menu_front_page.bind_links(links=[link_document_list_recent, link_document_list])
|
||||
|
||||
# Document type links
|
||||
#register_links(DocumentType, [document_type_edit, document_type_filename_list, document_type_delete])
|
||||
#register_links([DocumentType, 'documents:document_type_create', 'documents:document_type_list'], [document_type_list, document_type_create], menu_name='secondary_menu')
|
||||
#register_links(DocumentTypeFilename, [document_type_filename_edit, document_type_filename_delete])
|
||||
#register_links([DocumentTypeFilename, 'documents:document_type_filename_list', 'documents:document_type_filename_create'], [document_type_filename_create], menu_name='sidebar')
|
||||
menu_object.bind_links(links=[link_document_type_edit, link_document_type_filename_list, link_document_type_delete], sources=[DocumentType])
|
||||
menu_secondary.bind_links(links=[link_document_type_list, link_document_type_create], sources=[DocumentType, 'documents:document_type_create', 'documents:document_type_list'])
|
||||
|
||||
menu_object.bind_links(links=[link_document_type_filename_edit, link_document_type_filename_delete], sources=[DocumentTypeFilename])
|
||||
menu_sidebar.bind_links(links=[link_document_type_filename_create], sources=[DocumentTypeFilename, 'documents:document_type_filename_list', 'documents:document_type_filename_create'])
|
||||
|
||||
# Register document facet links
|
||||
menu_facet.bind_links(links=[link_document_preview], sources=[Document], position=0)
|
||||
@@ -77,24 +95,14 @@ class DocumentsApp(apps.AppConfig):
|
||||
# Document actions
|
||||
menu_object.bind_links(links=[link_document_edit, link_document_document_type_edit, link_document_print, link_document_delete, link_document_download, link_document_clear_transformations, link_document_update_page_count], sources=[Document])
|
||||
|
||||
#register_links([Document], [document_multiple_clear_transformations, document_multiple_delete, document_multiple_download, document_multiple_update_page_count, document_multiple_document_type_edit, link_spacer], menu_name='multi_item_links')
|
||||
menu_multi_item.bind_links(links=[link_document_multiple_clear_transformations, link_document_multiple_delete, link_document_multiple_download, link_document_multiple_update_page_count, link_document_multiple_document_type_edit], sources=[Document])
|
||||
menu_object.bind_links(links=[link_document_version_revert, link_document_version_download], sources=[DocumentVersion])
|
||||
|
||||
# Document Version links
|
||||
#register_links(DocumentVersion, [document_version_revert, document_version_download])
|
||||
menu_object.bind_links(links=[link_document_page_transformation_list, link_document_page_view, link_document_page_text, link_document_page_edit], sources=[DocumentPage])
|
||||
menu_sidebar.bind_links(links=[link_document_page_navigation_first, link_document_page_navigation_previous, link_document_page_navigation_next, link_document_page_navigation_last], sources=[DocumentPage])
|
||||
|
||||
# Document page links
|
||||
#register_links(DocumentPage, [
|
||||
# document_page_transformation_list, document_page_view,
|
||||
# document_page_text, document_page_edit,
|
||||
#])
|
||||
menu_facet.bind_links(links=[link_document_page_rotate_left, link_document_page_rotate_right, link_document_page_zoom_in, link_document_page_zoom_out, link_document_page_view_reset], sources=['documents:document_page_view'])
|
||||
|
||||
# Document page navigation links
|
||||
#register_links(DocumentPage, [
|
||||
# document_page_navigation_first, document_page_navigation_previous,
|
||||
# document_page_navigation_next, document_page_navigation_last
|
||||
#], menu_name='sidebar')
|
||||
|
||||
#register_links(['documents:document_page_view'], [document_page_rotate_left, document_page_rotate_right, document_page_zoom_in, document_page_zoom_out, document_page_view_reset], menu_name='form_header')
|
||||
#register_links(DocumentPageTransformation, [document_page_transformation_edit, document_page_transformation_delete])
|
||||
#register_links('documents:document_page_transformation_list', [document_page_transformation_create], menu_name='sidebar')
|
||||
#register_links('documents:document_page_transformation_create', [document_page_transformation_create], menu_name='sidebar')
|
||||
@@ -141,15 +149,4 @@ class DocumentsApp(apps.AppConfig):
|
||||
namespace.add_statistic(DocumentStatistics(name='document_stats', label=_('Document tendencies')))
|
||||
namespace.add_statistic(DocumentUsageStatistics(name='document_usage', label=_('Document usage')))
|
||||
|
||||
APIEndPoint('documents')
|
||||
|
||||
ModelAttribute(Document, label=_('Label'), name='label', type_name='field')
|
||||
|
||||
FrontPageButton(link=link_document_list_recent)
|
||||
FrontPageButton(link=link_document_list)
|
||||
|
||||
registry.register(Document)
|
||||
|
||||
DocumentPage.add_to_class('get_transformation_list', lambda document_page: DocumentPageTransformation.objects.get_for_document_page_as_list(document_page))
|
||||
|
||||
MissingItem(label=_('Create a document type'), description=_('Every uploaded document must be assigned a document type, it is the basic way Mayan EDMS categorizes documents.'), condition=lambda: not DocumentType.objects.exists(), view='documents:document_type_list')
|
||||
|
||||
@@ -72,34 +72,34 @@ link_clear_image_cache = Link(
|
||||
)
|
||||
|
||||
# Document pages
|
||||
link_document_page_transformation_list = Link(args='page.pk', class='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text=_('Page transformations'), view='documents:document_page_transformation_list')
|
||||
link_document_page_transformation_create = Link(args='page.pk', class='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text= _('Create new transformation'), view='documents:document_page_transformation_create')
|
||||
link_document_page_transformation_edit = Link(args='transformation.pk', class='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text=_('Edit'), view='documents:document_page_transformation_edit')
|
||||
link_document_page_transformation_delete = Link(args='transformation.pk', class='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text=_('Delete'), view='documents:document_page_transformation_delete')
|
||||
link_document_page_view = Link(args='page.pk', class='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Page image'), view='documents:document_page_view')
|
||||
link_document_page_text = Link(args='page.pk', class='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Page text'), view='documents:document_page_text')
|
||||
link_document_page_edit = Link(class='no-parent-history', permissions=[PERMISSION_DOCUMENT_EDIT], text=_('Edit page text'), view='documents:document_page_edit', args='page.pk')
|
||||
link_document_page_navigation_next = Link(text=_('Next page'), 'class': 'no-parent-history', 'view': 'documents:document_page_navigation_next', 'args': 'page.pk', 'famfam': 'resultset_next', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'conditional_disable': is_last_page, 'keep_query': True}
|
||||
link_document_page_navigation_previous = Link(text=_('Previous page'), 'class': 'no-parent-history', 'view': 'documents:document_page_navigation_previous', 'args': 'page.pk', 'famfam': 'resultset_previous', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'conditional_disable': is_first_page, 'keep_query': True}
|
||||
link_document_page_navigation_first = Link(text=_('First page'), 'class': 'no-parent-history', 'view': 'documents:document_page_navigation_first', 'args': 'page.pk', 'famfam': 'resultset_first', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'conditional_disable': is_first_page, 'keep_query': True}
|
||||
link_document_page_navigation_last = Link(text=_('Last page'), 'class': 'no-parent-history', 'view': 'documents:document_page_navigation_last', 'args': 'page.pk', 'famfam': 'resultset_last', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'conditional_disable': is_last_page, 'keep_query': True}
|
||||
link_document_page_zoom_in = Link(text=_('Zoom in'), 'class': 'no-parent-history', 'view': 'documents:document_page_zoom_in', 'args': 'page.pk', 'famfam': 'zoom_in', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'conditional_disable': is_max_zoom}
|
||||
link_document_page_zoom_out = Link(text=_('Zoom out'), 'class': 'no-parent-history', 'view': 'documents:document_page_zoom_out', 'args': 'page.pk', 'famfam': 'zoom_out', 'permissions': [PERMISSION_DOCUMENT_VIEW], 'conditional_disable': is_min_zoom}
|
||||
link_document_page_rotate_right = Link(text=_('Rotate right'), 'class': 'no-parent-history', 'view': 'documents:document_page_rotate_right', 'args': 'page.pk', 'famfam': 'arrow_turn_right', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
|
||||
link_document_page_rotate_left = Link(text=_('Rotate left'), 'class': 'no-parent-history', 'view': 'documents:document_page_rotate_left', 'args': 'page.pk', 'famfam': 'arrow_turn_left', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
|
||||
link_document_page_view_reset = Link(text=_('Reset view'), 'class': 'no-parent-history', 'view': 'documents:document_page_view_reset', 'args': 'page.pk', 'famfam': 'page_white', 'permissions': [PERMISSION_DOCUMENT_VIEW]}
|
||||
link_document_page_transformation_list = Link(args='page.pk', klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text=_('Page transformations'), view='documents:document_page_transformation_list')
|
||||
link_document_page_transformation_create = Link(args='page.pk', klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text= _('Create new transformation'), view='documents:document_page_transformation_create')
|
||||
link_document_page_transformation_edit = Link(args='transformation.pk', klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text=_('Edit'), view='documents:document_page_transformation_edit')
|
||||
link_document_page_transformation_delete = Link(args='transformation.pk', klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_TRANSFORM], text=_('Delete'), view='documents:document_page_transformation_delete')
|
||||
link_document_page_view = Link(args='page.pk', klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Page image'), view='documents:document_page_view')
|
||||
link_document_page_text = Link(args='page.pk', klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Page text'), view='documents:document_page_text')
|
||||
link_document_page_edit = Link(klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_EDIT], text=_('Edit page text'), view='documents:document_page_edit', args='page.pk')
|
||||
link_document_page_navigation_next = Link(conditional_disable=is_last_page, keep_query=True, klass='no-parent-history', text=_('Next page'), permissions=[PERMISSION_DOCUMENT_VIEW], view='documents:document_page_navigation_next', args='page.pk')
|
||||
link_document_page_navigation_previous = Link(conditional_disable=is_first_page, keep_query=True, klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Previous page'), view='documents:document_page_navigation_previous', args='page.pk')
|
||||
link_document_page_navigation_first = Link(conditional_disable=is_first_page, keep_query=True, klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('First page'), view='documents:document_page_navigation_first', args='page.pk')
|
||||
link_document_page_navigation_last = Link(conditional_disable=is_last_page, keep_query=True, text=_('Last page'), klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], view='documents:document_page_navigation_last', args='page.pk')
|
||||
link_document_page_zoom_in = Link(conditional_disable=is_max_zoom, klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Zoom in'), view='documents:document_page_zoom_in', args='page.pk')
|
||||
link_document_page_zoom_out = Link(conditional_disable=is_min_zoom, klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Zoom out'), view='documents:document_page_zoom_out', args='page.pk')
|
||||
link_document_page_rotate_right = Link(klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Rotate right'), view='documents:document_page_rotate_right', args='page.pk')
|
||||
link_document_page_rotate_left = Link(klass='no-parent-history', permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Rotate left'), view='documents:document_page_rotate_left', args='page.pk')
|
||||
link_document_page_view_reset = Link(permissions=[PERMISSION_DOCUMENT_VIEW], klass='no-parent-history', text=_('Reset view'), view='documents:document_page_view_reset', args='page.pk')
|
||||
|
||||
# Document versions
|
||||
document_version_revert = {'text': _('Revert'), 'view': 'documents:document_version_revert', 'args': 'object.pk', 'famfam': 'page_refresh', 'permissions': [PERMISSION_DOCUMENT_VERSION_REVERT], 'conditional_disable': is_current_version}
|
||||
link_document_version_revert = Link(conditional_disable=is_current_version, permissions=[PERMISSION_DOCUMENT_VERSION_REVERT], text=_('Revert'), view='documents:document_version_revert', args='object.pk')
|
||||
|
||||
# Document type related links
|
||||
document_type_list = {'text': _('Document types'), 'view': 'documents:document_type_list', 'famfam': 'layout', 'permissions': [PERMISSION_DOCUMENT_TYPE_VIEW]}
|
||||
link_document_type_list = Link(permissions=[PERMISSION_DOCUMENT_TYPE_VIEW], text=_('Document types'), view='documents:document_type_list')
|
||||
link_document_type_setup = Link(icon='fa fa-file', permissions=[PERMISSION_DOCUMENT_TYPE_VIEW], text=_('Document types'), view='documents:document_type_list')
|
||||
document_type_edit = {'text': _('Edit'), 'view': 'documents:document_type_edit', 'args': 'document_type.id', 'famfam': 'layout_edit', 'permissions': [PERMISSION_DOCUMENT_TYPE_EDIT]}
|
||||
document_type_delete = {'text': _('Delete'), 'view': 'documents:document_type_delete', 'args': 'document_type.id', 'famfam': 'layout_delete', 'permissions': [PERMISSION_DOCUMENT_TYPE_DELETE]}
|
||||
document_type_create = {'text': _('Create document type'), 'view': 'documents:document_type_create', 'famfam': 'layout_add', 'permissions': [PERMISSION_DOCUMENT_TYPE_CREATE]}
|
||||
link_document_type_edit = Link(permissions=[PERMISSION_DOCUMENT_TYPE_EDIT], text=_('Edit'), view='documents:document_type_edit', args='document_type.id')
|
||||
link_document_type_delete = Link(permissions=[PERMISSION_DOCUMENT_TYPE_DELETE], text=_('Delete'), view='documents:document_type_delete', args='document_type.id')
|
||||
link_document_type_create = Link(permissions=[PERMISSION_DOCUMENT_TYPE_CREATE], text=_('Create document type'), view='documents:document_type_create')
|
||||
|
||||
document_type_filename_list = {'text': _('Filenames'), 'view': 'documents:document_type_filename_list', 'args': 'document_type.id', 'famfam': 'database', 'permissions': [PERMISSION_DOCUMENT_TYPE_VIEW]}
|
||||
document_type_filename_create = {'text': _('Add filename to document type'), 'view': 'documents:document_type_filename_create', 'args': 'document_type.id', 'famfam': 'database_add', 'permissions': [PERMISSION_DOCUMENT_TYPE_EDIT]}
|
||||
document_type_filename_edit = {'text': _('Edit'), 'view': 'documents:document_type_filename_edit', 'args': 'filename.id', 'famfam': 'database_edit', 'permissions': [PERMISSION_DOCUMENT_TYPE_EDIT]}
|
||||
document_type_filename_delete = {'text': _('Delete'), 'view': 'documents:document_type_filename_delete', 'args': 'filename.id', 'famfam': 'database_delete', 'permissions': [PERMISSION_DOCUMENT_TYPE_EDIT]}
|
||||
link_document_type_filename_list = Link(permissions=[PERMISSION_DOCUMENT_TYPE_VIEW], text=_('Filenames'), view='documents:document_type_filename_list', args='document_type.id')
|
||||
link_document_type_filename_create = Link(permissions=[PERMISSION_DOCUMENT_TYPE_EDIT], text=_('Add filename to document type'), view='documents:document_type_filename_create', args='document_type.id')
|
||||
link_document_type_filename_edit = Link(permissions=[PERMISSION_DOCUMENT_TYPE_EDIT], text=_('Edit'), view='documents:document_type_filename_edit', args='filename.id')
|
||||
link_document_type_filename_delete = Link(permissions=[PERMISSION_DOCUMENT_TYPE_EDIT], text=_('Delete'), view='documents:document_type_filename_delete', args='filename.id')
|
||||
|
||||
@@ -585,7 +585,7 @@ def document_page_view(request, document_page_id):
|
||||
return render_to_response('appearance/generic_detail.html', {
|
||||
'page': document_page,
|
||||
'access_object': document_page.document,
|
||||
'navigation_object_name': 'page',
|
||||
'navigation_object_list': [{'object': 'page'}],
|
||||
'web_theme_hide_menus': True,
|
||||
'form': document_page_form,
|
||||
'title': ' '.join([base_title, zoom_text]),
|
||||
@@ -609,7 +609,7 @@ def document_page_text(request, document_page_id):
|
||||
|
||||
return render_to_response('appearance/generic_detail.html', {
|
||||
'page': document_page,
|
||||
'navigation_object_name': 'page',
|
||||
'navigation_object_list': [{'object': 'page'}],
|
||||
'web_theme_hide_menus': True,
|
||||
'form': document_page_form,
|
||||
'title': _('Details for: %s') % document_page,
|
||||
@@ -639,7 +639,7 @@ def document_page_edit(request, document_page_id):
|
||||
return render_to_response('appearance/generic_form.html', {
|
||||
'form': form,
|
||||
'page': document_page,
|
||||
'navigation_object_name': 'page',
|
||||
'navigation_object_list': [{'object': 'page'}],
|
||||
'title': _('Edit: %s') % document_page,
|
||||
'web_theme_hide_menus': True,
|
||||
'access_object': document_page.document,
|
||||
@@ -889,7 +889,7 @@ def document_type_edit(request, document_type_id):
|
||||
return render_to_response('appearance/generic_form.html', {
|
||||
'title': _('Edit document type: %s') % document_type,
|
||||
'form': form,
|
||||
'navigation_object_name': 'document_type',
|
||||
'navigation_object_list': [{'object': 'document_type'}],
|
||||
'document_type': document_type,
|
||||
'next': next
|
||||
}, context_instance=RequestContext(request))
|
||||
@@ -917,7 +917,7 @@ def document_type_delete(request, document_type_id):
|
||||
context = {
|
||||
'document_type': document_type,
|
||||
'delete_view': True,
|
||||
'navigation_object_name': 'document_type',
|
||||
'navigation_object_list': [{'object': 'document_type'}],
|
||||
'next': next,
|
||||
'previous': previous,
|
||||
'title': _('Are you sure you wish to delete the document type: %s?') % document_type,
|
||||
@@ -957,7 +957,7 @@ def document_type_filename_list(request, document_type_id):
|
||||
context = {
|
||||
'object_list': document_type.filenames.all(),
|
||||
'title': _('Filenames for document type: %s') % document_type,
|
||||
'navigation_object_name': 'document_type',
|
||||
'navigation_object_list': [{'object': 'document_type'}],
|
||||
'document_type': document_type,
|
||||
'list_object_variable_name': 'filename',
|
||||
'hide_link': True,
|
||||
@@ -1002,8 +1002,8 @@ def document_type_filename_edit(request, document_type_filename_id):
|
||||
'filename': document_type_filename,
|
||||
'document_type': document_type_filename.document_type,
|
||||
'navigation_object_list': [
|
||||
{'object': 'document_type', 'name': _('Document type')},
|
||||
{'object': 'filename', 'name': _('Document type filename')}
|
||||
{'object': 'document_type'},
|
||||
{'object': 'filename'}
|
||||
],
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
@@ -1034,8 +1034,8 @@ def document_type_filename_delete(request, document_type_filename_id):
|
||||
'filename': document_type_filename,
|
||||
'document_type': document_type_filename.document_type,
|
||||
'navigation_object_list': [
|
||||
{'object': 'document_type', 'name': _('Document type')},
|
||||
{'object': 'filename', 'name': _('Document type filename')}
|
||||
{'object': 'document_type'},
|
||||
{'object': 'filename'}
|
||||
],
|
||||
'title': _('Are you sure you wish to delete the filename: %(filename)s, from document type "%(document_type)s"?') % {
|
||||
'document_type': document_type_filename.document_type, 'filename': document_type_filename
|
||||
@@ -1074,7 +1074,7 @@ def document_type_filename_create(request, document_type_id):
|
||||
'form': form,
|
||||
'document_type': document_type,
|
||||
'navigation_object_list': [
|
||||
{'object': 'document_type', 'name': _('Document type')},
|
||||
{'object': 'document_type'},
|
||||
],
|
||||
}, context_instance=RequestContext(request))
|
||||
|
||||
|
||||
@@ -14,7 +14,7 @@ class DynamicSearchApp(apps.AppConfig):
|
||||
verbose_name = _('Dynamic search')
|
||||
|
||||
def ready(self):
|
||||
APIEndPoint('search', app_name='dynamic_search')
|
||||
|
||||
menu_facet.bind_links(links=[link_search, link_search_advanced], sources=['search:search', 'search:search_advanced', 'search:results'])
|
||||
menu_sidebar.bind_links(links=[link_search_again], sources=['search:results'])
|
||||
|
||||
APIEndPoint('search', app_name='dynamic_search')
|
||||
|
||||
@@ -12,16 +12,13 @@ from .permissions import (
|
||||
PERMISSION_FOLDER_REMOVE_DOCUMENT
|
||||
)
|
||||
|
||||
link_folder_create = Link(permissions=[PERMISSION_FOLDER_CREATE], text=_('Create folder'), view='folders:folder_create')
|
||||
link_folder_list = Link(icon='fa fa-folder', text=_('Folders'), view='folders:folder_list')
|
||||
|
||||
link_folder_edit = Link(permissions=[PERMISSION_FOLDER_EDIT], text=_('Edit'), view='folders:folder_edit', args='object.pk')
|
||||
link_folder_delete = Link(permissions=[PERMISSION_FOLDER_DELETE], text=_('Delete'), view='folders:folder_delete', args='object.pk')
|
||||
link_folder_view = Link(permissions=[PERMISSION_FOLDER_VIEW], text=_('Documents'), view='folders:folder_view', args='object.pk')
|
||||
link_folder_acl_list = Link(permissions=[ACLS_VIEW_ACL], text=_('ACLs'), view='folders:folder_acl_list', args='object.pk')
|
||||
|
||||
link_folder_document_multiple_remove = Link(permissions=[PERMISSION_FOLDER_REMOVE_DOCUMENT], text=_('Remove from folder'), view='folders:folder_document_multiple_remove', args='object.pk')
|
||||
link_folder_add_document = Link(permissions=[PERMISSION_FOLDER_ADD_DOCUMENT], text=_('Add to a folder'), view='folders:folder_add_document', args='object.pk')
|
||||
link_folder_add_multiple_documents = Link(text=_('Add to folder'), view='folders:folder_add_multiple_documents')
|
||||
link_folder_create = Link(permissions=[PERMISSION_FOLDER_CREATE], text=_('Create folder'), view='folders:folder_create')
|
||||
link_folder_delete = Link(permissions=[PERMISSION_FOLDER_DELETE], text=_('Delete'), view='folders:folder_delete', args='object.pk')
|
||||
link_folder_document_multiple_remove = Link(permissions=[PERMISSION_FOLDER_REMOVE_DOCUMENT], text=_('Remove from folder'), view='folders:folder_document_multiple_remove', args='object.pk')
|
||||
link_folder_edit = Link(permissions=[PERMISSION_FOLDER_EDIT], text=_('Edit'), view='folders:folder_edit', args='object.pk')
|
||||
link_folder_list = Link(icon='fa fa-folder', text=_('Folders'), view='folders:folder_list')
|
||||
link_folder_view = Link(permissions=[PERMISSION_FOLDER_VIEW], text=_('Documents'), view='folders:folder_view', args='object.pk')
|
||||
link_document_folder_list = Link(permissions=[PERMISSION_DOCUMENT_VIEW], text=_('Folders'), view='folders:document_folder_list', args='object.pk')
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ from __future__ import unicode_literals
|
||||
from django import apps
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common import menu_tools
|
||||
from common import menu_tools, menu_object, menu_secondary
|
||||
from common.utils import encapsulate
|
||||
from navigation.api import register_model_list_columns
|
||||
|
||||
@@ -16,6 +16,20 @@ class InstallationApp(apps.AppConfig):
|
||||
verbose_name = _('Installation')
|
||||
|
||||
def ready(self):
|
||||
menu_object.bind_links(links=[link_namespace_details], sources=[PropertyNamespace])
|
||||
menu_secondary.bind_links(links=[link_namespace_list], sources=['installation:namespace_list', PropertyNamespace])
|
||||
menu_tools.bind_links(links=[link_menu_link])
|
||||
|
||||
# Virtualenv
|
||||
namespace = PropertyNamespace('venv', _('VirtualEnv'))
|
||||
try:
|
||||
venv = VirtualEnv()
|
||||
except PIPNotFound:
|
||||
namespace.add_property('pip', 'pip', _('pip not found.'), report=True)
|
||||
else:
|
||||
for item, version, result in venv.get_results():
|
||||
namespace.add_property(item, '%s (%s)' % (item, version), result, report=True)
|
||||
|
||||
register_model_list_columns(PropertyNamespace, [
|
||||
{
|
||||
'name': _('Label'),
|
||||
@@ -37,18 +51,3 @@ class InstallationApp(apps.AppConfig):
|
||||
'attribute': 'value'
|
||||
}
|
||||
])
|
||||
|
||||
# TODO: convert
|
||||
#register_links(PropertyNamespace, [link_namespace_details])
|
||||
#register_links(['installation:namespace_list', PropertyNamespace], [link_namespace_list], menu_name='secondary_menu')
|
||||
menu_tools.bind_links(links=[link_menu_link])
|
||||
|
||||
# Virtualenv
|
||||
namespace = PropertyNamespace('venv', _('VirtualEnv'))
|
||||
try:
|
||||
venv = VirtualEnv()
|
||||
except PIPNotFound:
|
||||
namespace.add_property('pip', 'pip', _('pip not found.'), report=True)
|
||||
else:
|
||||
for item, version, result in venv.get_results():
|
||||
namespace.add_property(item, '%s (%s)' % (item, version), result, report=True)
|
||||
|
||||
@@ -7,5 +7,5 @@ from navigation import Link
|
||||
from .permissions import PERMISSION_INSTALLATION_DETAILS
|
||||
|
||||
link_menu_link = Link(icon='fa fa-flag', permissions=[PERMISSION_INSTALLATION_DETAILS], text=_('Installation details'), view='installation:namespace_list')
|
||||
link_namespace_list = {'text': _('Installation property namespaces'), 'view': 'installation:namespace_list', 'famfam': 'layout', 'permissions': [PERMISSION_INSTALLATION_DETAILS]}
|
||||
link_namespace_details = {'text': _('Details'), 'view': 'installation:namespace_details', 'args': 'object.id', 'famfam': 'layout_link', 'permissions': [PERMISSION_INSTALLATION_DETAILS]}
|
||||
link_namespace_details = Link(permissions=[PERMISSION_INSTALLATION_DETAILS], text=_('Details'), view='installation:namespace_details', args='object.id')
|
||||
link_namespace_list = Link(permissions=[PERMISSION_INSTALLATION_DETAILS], text=_('Installation property namespaces'), view='installation:namespace_list')
|
||||
|
||||
@@ -18,8 +18,8 @@ class MailerApp(apps.AppConfig):
|
||||
verbose_name = _('Mailer')
|
||||
|
||||
def ready(self):
|
||||
menu_object.bind_links(links=[link_send_document_link, link_send_document], sources=[Document])
|
||||
|
||||
class_permissions(Document, [
|
||||
PERMISSION_MAILING_LINK, PERMISSION_MAILING_SEND_DOCUMENT
|
||||
])
|
||||
|
||||
menu_object.bind_links(links=[link_send_document_link, link_send_document], sources=[Document])
|
||||
|
||||
@@ -6,5 +6,5 @@ from navigation import Link
|
||||
|
||||
from .permissions import PERMISSION_MAILING_LINK, PERMISSION_MAILING_SEND_DOCUMENT
|
||||
|
||||
link_send_document_link = Link(permissions=[PERMISSION_MAILING_LINK], text=_('Email link'), view='mailer:send_document_link', args='object.pk')
|
||||
link_send_document = Link(permissions=[PERMISSION_MAILING_SEND_DOCUMENT], text=_('Email document'), view='mailer:send_document', args='object.pk')
|
||||
link_send_document_link = Link(permissions=[PERMISSION_MAILING_LINK], text=_('Email link'), view='mailer:send_document_link', args='object.pk')
|
||||
|
||||
@@ -1 +1 @@
|
||||
from .classes import FrontPageButton, MissingItem # NOQA
|
||||
from .classes import MissingItem # NOQA
|
||||
|
||||
@@ -1,15 +1,3 @@
|
||||
class FrontPageButton(object):
|
||||
_registry = []
|
||||
|
||||
@classmethod
|
||||
def get_all(cls):
|
||||
return cls._registry
|
||||
|
||||
def __init__(self, link):
|
||||
self.link = link
|
||||
self.__class__._registry.append(link)
|
||||
|
||||
|
||||
class MissingItem(object):
|
||||
_registry = []
|
||||
|
||||
|
||||
@@ -10,14 +10,13 @@ from dynamic_search.classes import SearchModel
|
||||
from permissions.models import Permission
|
||||
|
||||
from .api import diagnostics, tools
|
||||
from .classes import FrontPageButton, MissingItem
|
||||
from .classes import MissingItem
|
||||
|
||||
|
||||
def home(request):
|
||||
document_search = SearchModel.get('documents.Document')
|
||||
|
||||
context = {
|
||||
'object_navigation_links': FrontPageButton.get_all(),
|
||||
'query_string': request.GET,
|
||||
'hide_links': True,
|
||||
'search_results_limit': 100,
|
||||
|
||||
@@ -185,6 +185,11 @@ class Link(object):
|
||||
current_path = request.META['PATH_INFO']
|
||||
current_view = resolve(current_path).view_name
|
||||
|
||||
# Preserve unicode data in URL query
|
||||
previous_path = smart_unicode(urllib.unquote_plus(smart_str(request.get_full_path()) or smart_str(request.META.get('HTTP_REFERER', reverse('main:home')))))
|
||||
query_string = urlparse.urlparse(previous_path).query
|
||||
parsed_query_string = urlparse.parse_qs(query_string)
|
||||
|
||||
if self.permissions:
|
||||
try:
|
||||
Permission.objects.check_permissions(request.user, self.permissions)
|
||||
|
||||
@@ -3,10 +3,10 @@ from __future__ import absolute_import, unicode_literals
|
||||
from django import apps
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from common import menu_setup
|
||||
from common import menu_front_page, menu_setup
|
||||
from common.utils import encapsulate
|
||||
from documents.models import Document
|
||||
from main import FrontPageButton, MissingItem
|
||||
from main import MissingItem
|
||||
from navigation.api import register_model_list_columns
|
||||
from rest_api.classes import APIEndPoint
|
||||
|
||||
@@ -32,6 +32,9 @@ class SourcesApp(apps.AppConfig):
|
||||
verbose_name = _('Sources')
|
||||
|
||||
def ready(self):
|
||||
APIEndPoint('sources')
|
||||
MissingItem(label=_('Create a document source'), description=_('Document sources are the way in which new documents are feed to Mayan EDMS, create at least a web form source to be able to upload documents from a browser.'), condition=lambda: not Source.objects.exists(), view='sources:setup_source_list')
|
||||
|
||||
register_model_list_columns(StagingFile, [
|
||||
{
|
||||
'name': _('Thumbnail'), 'attribute':
|
||||
@@ -50,8 +53,5 @@ class SourcesApp(apps.AppConfig):
|
||||
|
||||
menu_setup.bind_links(links=[link_setup_sources])
|
||||
|
||||
APIEndPoint('sources')
|
||||
menu_front_page.bind_links(links=[link_document_create_multiple])
|
||||
|
||||
FrontPageButton(link=link_document_create_multiple)
|
||||
|
||||
MissingItem(label=_('Create a document source'), description=_('Document sources are the way in which new documents are feed to Mayan EDMS, create at least a web form source to be able to upload documents from a browser.'), condition=lambda: not Source.objects.exists(), view='sources:setup_source_list')
|
||||
|
||||
@@ -6,7 +6,7 @@ from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from actstream import registry
|
||||
|
||||
from common import menu_setup
|
||||
from common import menu_multi_item, menu_object, menu_secondary, menu_setup
|
||||
from rest_api.classes import APIEndPoint
|
||||
|
||||
from .links import (
|
||||
@@ -23,17 +23,15 @@ class UserManagementApp(apps.AppConfig):
|
||||
verbose_name = _('User management')
|
||||
|
||||
def ready(self):
|
||||
# TODO: convert
|
||||
#register_links(User, [user_edit, user_set_password, user_groups, user_delete])
|
||||
#register_links([User, 'user_management:user_multiple_set_password', 'user_management:user_multiple_delete', 'user_management:user_list', 'user_management:user_add'], [user_list, user_add], menu_name='secondary_menu')
|
||||
#register_links(['user_management:user_list'], [user_multiple_set_password, user_multiple_delete], menu_name='multi_item_links')
|
||||
#register_links(Group, [group_edit, group_members, group_delete])
|
||||
#register_links(['user_management:group_multiple_delete', 'user_management:group_delete', 'user_management:group_edit', 'user_management:group_list', 'user_management:group_add', 'user_management:group_members'], [group_list, group_add], menu_name='secondary_menu')
|
||||
#register_links(['user_management:group_list'], [group_multiple_delete], menu_name='multi_item_links')
|
||||
|
||||
menu_setup.bind_links(links=[link_user_setup, link_group_setup])
|
||||
|
||||
APIEndPoint('users', app_name='user_management')
|
||||
|
||||
registry.register(User)
|
||||
menu_multi_item.bind_links(links=[link_group_multiple_delete], sources=['user_management:group_list'])
|
||||
menu_multi_item.bind_links(links=[link_user_multiple_set_password, link_user_multiple_delete], sources=['user_management:user_list'])
|
||||
menu_object.bind_links(links=[link_group_edit, link_group_members, link_group_delete], sources=[Group])
|
||||
menu_object.bind_links(links=[link_user_edit, link_user_set_password, link_user_groups, link_user_delete], sources=[User])
|
||||
menu_secondary.bind_links(links=[link_group_list, link_group_add], sources=['user_management:group_multiple_delete', 'user_management:group_delete', 'user_management:group_edit', 'user_management:group_list', 'user_management:group_add', 'user_management:group_members'])
|
||||
menu_secondary.bind_links(links=[link_user_list, link_user_add], sources=[User, 'user_management:user_multiple_set_password', 'user_management:user_multiple_delete', 'user_management:user_list', 'user_management:user_add'])
|
||||
menu_setup.bind_links(links=[link_user_setup, link_group_setup])
|
||||
|
||||
registry.register(Group)
|
||||
registry.register(User)
|
||||
|
||||
Reference in New Issue
Block a user