Beispiel #1
0
#register_links(['setup_web_form_list', 'setup_staging_folder_list', 'setup_watch_folder_list', 'setup_source_create'], [setup_web_form_list, setup_staging_folder_list, setup_watch_folder_list], menu_name='form_header')
register_links(['setup_web_form_list', 'setup_staging_folder_list', 'setup_watch_folder_list', 'setup_source_create'], [setup_web_form_list, setup_staging_folder_list], menu_name='form_header')

#register_links(WebForm, [setup_web_form_list, setup_staging_folder_list, setup_watch_folder_list], menu_name='form_header')
register_links(WebForm, [setup_web_form_list, setup_staging_folder_list], menu_name='form_header')
register_links(WebForm, [setup_source_transformation_list, setup_source_edit, setup_source_delete])

register_links(['setup_web_form_list', 'setup_staging_folder_list', 'setup_watch_folder_list', 'setup_source_edit', 'setup_source_delete', 'setup_source_create'], [setup_sources, setup_source_create], menu_name='sidebar')

#register_links(StagingFolder, [setup_web_form_list, setup_staging_folder_list, setup_watch_folder_list], menu_name='form_header')
register_links(StagingFolder, [setup_web_form_list, setup_staging_folder_list], menu_name='form_header')
register_links(StagingFolder, [setup_source_transformation_list, setup_source_edit, setup_source_delete])

register_links(WatchFolder, [setup_web_form_list, setup_staging_folder_list, setup_watch_folder_list], menu_name='form_header')
register_links(WatchFolder, [setup_source_transformation_list, setup_source_edit, setup_source_delete])

# Document version
register_links(['document_version_list', 'upload_version', 'document_version_revert'], [upload_version], menu_name='sidebar')

register_links(['setup_source_transformation_create', 'setup_source_transformation_edit', 'setup_source_transformation_delete', 'setup_source_transformation_list'], [setup_source_transformation_create], menu_name='sidebar')

source_views = ['setup_web_form_list', 'setup_staging_folder_list', 'setup_watch_folder_list', 'setup_source_edit', 'setup_source_delete', 'setup_source_create', 'setup_source_transformation_list', 'setup_source_transformation_edit', 'setup_source_transformation_delete', 'setup_source_transformation_create']

register_model_list_columns(StagingFile, [
        {'name':_(u'thumbnail'), 'attribute':
            encapsulate(lambda x: staging_file_thumbnail(x))
        },
    ])

register_setup(setup_sources)
Beispiel #2
0
    if instance.document.document_type.ocr:
        instance.submit_for_ocr()


Document.add_to_class('submit_for_ocr', document_ocr_submit)
DocumentVersion.add_to_class('submit_for_ocr', document_version_ocr_submit)

class_permissions(Document, [PERMISSION_OCR_DOCUMENT])

register_tool(link_entry_list)

APIEndPoint('ocr')

register_model_list_columns(DocumentVersionOCRError, [
    {
        'name':
        _('Document'),
        'attribute':
        encapsulate(
            lambda entry: document_link(entry.document_version.document))
    },
    {
        'name': _('Added'),
        'attribute': 'datetime_submitted'
    },
    {
        'name': _('Result'),
        'attribute': 'result'
    },
])
from .widgets import get_tags_inline_widget_simple, single_tag_widget

class_permissions(Document, [
    PERMISSION_TAG_ATTACH, PERMISSION_TAG_REMOVE,
])
class_permissions(Tag, [
    PERMISSION_TAG_DELETE, PERMISSION_TAG_EDIT, PERMISSION_TAG_VIEW,
])

APIEndPoint('tags')

register_model_list_columns(Tag, [
    {
        'name': _('Preview'),
        'attribute': encapsulate(lambda x: single_tag_widget(x))
    },
    {
        'name': _('Tagged items'),
        'attribute': encapsulate(lambda x: x.documents.count())
    }
])

register_model_list_columns(Document, [
    {
        'name': _('Tags'), 'attribute':
        encapsulate(lambda x: get_tags_inline_widget_simple(x))
    },
])

register_top_menu('tags', link={'text': _('Tags'), 'view': 'tags:tag_list', 'famfam': 'tag_blue'})

register_links(Tag, [tag_tagged_item_list, tag_edit, tag_acl_list, tag_delete])
Beispiel #4
0
Link.bind_links([Project], [link_project_view_basic, link_project_info_view, link_project_budget_view, link_project_details_view, link_project_opportunities_view, link_project_file_list, link_project_workflow_instance_list, link_project_reports_view], menu_name='form_header')

Link.bind_links([ProjectInfo], [link_project_info_edit, link_project_info_delete])
Link.bind_links([ProjectBudget], [link_project_budget_edit, link_project_budget_delete])
Link.bind_links([ProjectDetails], [link_project_details_edit, link_project_details_delete])
Link.bind_links([ProjectOpportunities], [link_project_opportunities_edit, link_project_opportunities_delete])
Link.bind_links([ProjectFile, 'project_file_upload', 'project_file_list'], [link_project_file_upload], menu_name='secondary_menu')
Link.bind_links([ProjectFile], [link_project_file_download, link_project_file_delete])

Link.bind_links([WorkflowInstance], [link_project_workflow_instance_history_list, link_project_workflow_instance_action_submit])
#p = ProgressBar()

register_model_list_columns(Project, [
    {'name': _(u'name'), 'attribute': 'label'},
#    {'name': _(u'completion (%)'), 'attribute': encapsulate(lambda x: x.get_completion())},
#    {'name': _(u'fiscal year'), 'attribute': 'fiscal_year'},
#    {'name': _(u'purpose'), 'attribute': 'purpose'},
#    {'name': _(u'classification'), 'attribute': 'classification'},
])

register_model_list_columns(ProjectFile, [
    {'name': _(u'label'), 'attribute': 'label'},
    {'name': _(u'file'), 'attribute': 'get_base_filename'},
])

#AgencyElement(link_agency_project_list)

class_permissions(Agency, [
        PERMISSION_PROJECT_EDIT, PERMISSION_PROJECT_DELETE,
        PERMISSION_PROJECT_VIEW, PERMISSION_PROJECT_CREATE
    ]
Beispiel #5
0
from .classes import Property, PropertyNamespace
from .links import link_menu_link, link_namespace_details, link_namespace_list
from .models import Installation


@receiver(post_migrate, dispatch_uid='create_installation_instance')
def create_installation_instance(sender, **kwargs):
    if kwargs['app'] == 'installation':
        Installation.objects.get_or_create()


register_model_list_columns(PropertyNamespace, [
    {
        'name': _('Label'),
        'attribute': 'label'
    },
    {
        'name': _('Items'),
        'attribute': encapsulate(lambda entry: len(entry.get_properties()))
    }
])

register_model_list_columns(Property, [
    {
        'name': _('Label'),
        'attribute': 'label'
    },
    {
        'name': _('Value'),
        'attribute': 'value'
    }
])
Beispiel #6
0
register_links(['metadata_add', 'metadata_edit', 'metadata_remove', 'metadata_view'], [metadata_add, metadata_edit, metadata_remove], menu_name='sidebar')
register_links(Document, [metadata_view], menu_name='form_header')
register_multi_item_links(['document_find_duplicates', 'folder_view', 'index_instance_node_view', 'document_type_document_list', 'search', 'results', 'document_group_view', 'document_list', 'document_list_recent', 'tag_tagged_item_list'], [metadata_multiple_add, metadata_multiple_edit, metadata_multiple_remove])

register_links(MetadataType, [setup_metadata_type_edit, setup_metadata_type_delete])
register_links([MetadataType, 'setup_metadata_type_list', 'setup_metadata_type_create'], [setup_metadata_type_list, setup_metadata_type_create], menu_name='secondary_menu')

register_links(MetadataSet, [setup_metadata_set_edit, setup_metadata_set_members, setup_metadata_set_delete])
register_links([MetadataSet, 'setup_metadata_set_list', 'setup_metadata_set_create'], [setup_metadata_set_list, setup_metadata_set_create], menu_name='secondary_menu')

register_links(DocumentType, [setup_document_type_metadata])

register_sidebar_template(['setup_metadata_type_list'], 'metadata_type_help.html')
register_sidebar_template(['setup_metadata_set_list'], 'metadata_set_help.html')

register_setup(setup_metadata_type_list)
register_setup(setup_metadata_set_list)

class_permissions(Document, [
    PERMISSION_METADATA_DOCUMENT_EDIT,
    PERMISSION_METADATA_DOCUMENT_ADD,
    PERMISSION_METADATA_DOCUMENT_REMOVE,
    PERMISSION_METADATA_DOCUMENT_VIEW,
])

register_model_list_columns(Document, [
        {'name': _(u'metadata'), 'attribute':
            encapsulate(lambda x: get_metadata_string(x))
        },
    ])
Beispiel #7
0
    link_agency_details,
    link_agency_view,
    link_agency_acl_details,
)
from .models import Agency
from .permissions import PERMISSION_AGENCY_VIEW, PERMISSION_AGENCY_EDIT


Link.bind_links([Agency, "agency_list"], [link_agency_list], menu_name="secondary_menu")
# Link.bind_links([Agency], [link_agency_details, link_agency_view, link_agency_edit, link_agency_delete])
Link.bind_links([Agency], [link_agency_acl_details])  # , link_agency_view, link_agency_edit])#, link_agency_delete])

register_model_list_columns(
    Agency,
    [
        # {'name': _(u'registration'), 'attribute': 'registration'},
        {"name": _(u"name"), "attribute": "name"}
    ],
)

register_top_menu("agencies", link=link_agencies, position=1)

class_permissions(Agency, [PERMISSION_AGENCY_VIEW, PERMISSION_AGENCY_EDIT, ACLS_VIEW_ACL, ACLS_EDIT_ACL])

# agency_search = SearchModel('agencies', 'Agency')

# agency_search.add_model_field('prifas', label=_(u'Prifas number'))
# agency_search.add_model_field('registration', label=_(u'Registration'))
# agency_search.add_model_field('name', label=_(u'Name'))
# agency_search.add_model_field('director', label=_(u'Director'))
# agency_search.add_model_field('physical_address', label=_(u'Physical address'))
    link_setup_workflow_transition_delete, link_setup_workflow_transition_edit,
    link_workflow_instance_detail, link_workflow_instance_transition
)


@receiver(post_save, dispatch_uid='launch_workflow', sender=Document)
def launch_workflow(sender, instance, created, **kwargs):
    if created:
        Workflow.objects.launch_for(instance)


register_setup(link_setup_workflow_list)

register_model_list_columns(Workflow, [
    {
        'name': _('Initial state'),
        'attribute': encapsulate(lambda workflow: workflow.get_initial_state() or _('None'))
    },
])

register_model_list_columns(WorkflowState, [
    {
        'name': _('Is initial state?'),
        'attribute': 'initial'
    },
])

register_model_list_columns(WorkflowInstance, [
    {
        'name': _('Current state'),
        'attribute': 'get_current_state'
    },
Beispiel #9
0
    link_agency_edit, link_agency_delete, link_position_add, link_position_delete,
    link_position_edit, link_position_list, link_department_add, link_department_delete,
    link_department_edit, link_department_list)
from .models import Agency, AgencyPosition, AgencyDepartment

Link.bind_links([Agency], [link_agency_edit, link_agency_delete, link_position_list, link_department_list])
Link.bind_links([Agency, 'agency_list', 'agency_add'], [link_agency_list, link_agency_add], menu_name=u'secondary_menu')

Link.bind_links([AgencyPosition, 'position_add', 'position_list'], [link_position_add], menu_name=u'sidebar')
Link.bind_links([AgencyPosition], [link_position_edit, link_position_delete])

Link.bind_links([AgencyDepartment, 'department_add', 'department_list'], [link_department_add], menu_name=u'sidebar')
Link.bind_links([AgencyDepartment], [link_department_edit, link_department_delete])

register_top_menu('agencies_menu', link=link_agencies_menu, position=2)

register_model_list_columns(AgencyDepartment, [
    {
        'name': _(u'main department?'),
        'attribute': encapsulate(lambda x: two_state_template(x.main_department).display_small())
    },
    {
        'name': _(u'creation date'),
        'attribute': 'start_date',
    },
    {
        'name': _(u'date disbanding'),
        'attribute': 'end_date',
    },
])
Beispiel #10
0
    link_setup_workflow_transition_delete, link_setup_workflow_transition_edit,
    link_workflow_instance_detail, link_workflow_instance_transition
)


@receiver(post_save, dispatch_uid='launch_workflow', sender=Document)
def launch_workflow(sender, instance, created, **kwargs):
    if created:
        Workflow.objects.launch_for(instance)


register_setup(link_setup_workflow_list)

register_model_list_columns(Workflow, [
    {
        'name': _('Initial state'),
        'attribute': encapsulate(lambda workflow: workflow.get_initial_state() or _('None'))
    },
])

register_model_list_columns(WorkflowState, [
    {
        'name': _('Is initial state?'),
        'attribute': 'initial'
    },
])

register_model_list_columns(WorkflowInstance, [
    {
        'name': _('Current state'),
        'attribute': 'get_current_state'
    },
Beispiel #11
0
    title=_(u"documents"),
)

# def document_exists(document):
#    try:
#        if document.exists():
#            return u'<span class="famfam active famfam-tick"></span>'
#        else:
#            return u'<span class="famfam active famfam-cross"></span>'
#    except Exception, exc:
#        return exc

register_model_list_columns(
    Document,
    [
        {"name": _(u"thumbnail"), "attribute": encapsulate(lambda x: document_thumbnail(x))},
        {"name": _(u"tags"), "attribute": encapsulate(lambda x: get_tags_inline_widget_simple(x))},
        {"name": _(u"metadata"), "attribute": encapsulate(lambda x: get_metadata_string(x))},
    ],
)

register_top_menu(
    "documents",
    link={"famfam": "page", "text": _(u"documents"), "view": "document_list_recent"},
    children_path_regex=[
        r"^documents/[^t]",
        r"^metadata/[^s]",
        r"comments",
        r"tags/document",
        r"grouping/[^s]",
        r"history/list/for_object/documents",
    ],
Beispiel #12
0
from .classes import StagingFile
from .links import (
    document_create_multiple, document_create_siblings, setup_sources,
    setup_source_create_imap_email, setup_source_create_pop3_email,
    setup_source_create_watch_folder, setup_source_create_webform,
    setup_source_create_staging_folder, setup_source_delete, setup_source_edit,
    setup_source_transformation_create, setup_source_transformation_delete,
    setup_source_transformation_edit, setup_source_transformation_list,
    staging_file_delete, upload_version
)
from .models import Source, SourceTransformation
from .widgets import staging_file_thumbnail

register_model_list_columns(StagingFile, [
    {
        'name': _('Thumbnail'), 'attribute':
        encapsulate(lambda x: staging_file_thumbnail(x, gallery_name='sources:staging_list', title=x.filename, size='100'))
    },
])

register_links([StagingFile], [staging_file_delete])
register_links([Source, 'sources:setup_source_list', 'sources:setup_source_create'], [setup_sources, setup_source_create_webform, setup_source_create_staging_folder, setup_source_create_pop3_email, setup_source_create_imap_email, setup_source_create_watch_folder], menu_name='secondary_menu')
register_links([Source], [setup_source_edit, setup_source_transformation_list, setup_source_delete])
register_links(SourceTransformation, [setup_source_transformation_edit, setup_source_transformation_delete])
register_links([SourceTransformation, 'sources:setup_source_transformation_create', 'sources:setup_source_transformation_list'], [setup_source_transformation_create], menu_name='sidebar')
register_links(['documents:document_version_list', 'documents:upload_version', 'documents:document_version_revert'], [upload_version], menu_name='sidebar')
register_links([Document, 'documents:document_list_recent', 'documents:document_list', 'sources:document_create', 'sources:document_create_multiple', 'sources:upload_interactive', 'sources:staging_file_delete'], [document_create_multiple], menu_name='secondary_menu')
register_links(Document, [document_create_siblings])
register_links(['sources:document_create', 'sources:document_create_multiple', 'sources:upload_interactive', 'sources:staging_file_delete'], [document_list_recent, document_list], menu_name='secondary_menu')

register_setup(setup_sources)
Beispiel #13
0
PERMISSION_COMMENT_VIEW = {'namespace': 'comments', 'name': 'comment_view', 'label': _(u'View comments')}

set_namespace_title('comments', _(u'Comments'))
register_permission(PERMISSION_COMMENT_CREATE)
register_permission(PERMISSION_COMMENT_DELETE)
register_permission(PERMISSION_COMMENT_EDIT)
register_permission(PERMISSION_COMMENT_VIEW)

comment_delete = {'text': _('delete'), 'view': 'comment_delete', 'args': 'object.id', 'famfam': 'comment_delete', 'permissions': [PERMISSION_COMMENT_DELETE]}
comment_multiple_delete = {'text': _('delete'), 'view': 'comment_multiple_delete', 'args': 'object.id', 'famfam': 'comments_delete', 'permissions': [PERMISSION_COMMENT_DELETE]}
comment_add = {'text': _('add comment'), 'view': 'comment_add', 'args': 'object.id', 'famfam': 'comment_add', 'permissions': [PERMISSION_COMMENT_CREATE]}
comments_for_object = {'text': _('comments'), 'view': 'comments_for_object', 'args': 'object.id', 'famfam': 'comments', 'permissions': [PERMISSION_COMMENT_VIEW]}

register_model_list_columns(Comment, [
    {
        'name': _(u'date'),
        'attribute': 'submit_date'
    },
    {
        'name': _(u'user'),
        'attribute': lambda x: x.user.get_full_name() if x.user.get_full_name() else x.user
    },
    {
        'name': _(u'comment'),
        'attribute': 'comment'
    }
])

register_links(['comments_for_object'], [comment_add], menu_name='sidebar')
register_links(Comment, [comment_delete])
Beispiel #14
0
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _

from common.utils import encapsulate
from navigation.api import register_model_list_columns

from .models import WorkflowInstance, WorkflowInstanceHistory, WorkflowTypeRelation

register_model_list_columns(WorkflowInstance, [
    {
        'name': _(u'type'),
        'attribute': 'workflow_type'
    },
    {
        'name': _(u'latest action'),
        'attribute': 'get_latest_action'
    },
    {
        'name': _(u'lastest state'),
        'attribute': 'get_latest_state'
    },
])

register_model_list_columns(WorkflowInstanceHistory, [
    {
        'name': _(u'date and time'),
        'attribute': 'datetime_created'
    },
    {
        'name': _(u'action'),
        'attribute': 'workflow_type_action'
Beispiel #15
0
def document_exists(document):
    try:
        if document.exists():
            return u'<span class="famfam active famfam-tick"></span>'
        else:
            return u'<span class="famfam active famfam-cross"></span>'
    except Exception, exc:
        return exc

register_model_list_columns(Document, [
        {'name':_(u'thumbnail'), 'attribute':
            lambda x: document_thumbnail(x)
        },
        {'name':_(u'tags'), 'attribute':
            lambda x: get_tags_inline_widget_simple(x)
        },
        {'name':_(u'metadata'), 'attribute':
            lambda x: get_metadata_string(x)
        },
    ])

register_top_menu(
    'documents', 
    link={'famfam': 'page', 'text': _(u'documents'), 'view': 'document_list_recent'}, 
    children_path_regex=[
        r'^documents/[^t]', r'^metadata/[^s]', r'comments', r'tags/document', r'grouping/[^s]', r'history/list/for_object/documents'
    ],
    position=0
)
Beispiel #16
0
Link.bind_links([AgencyPosition, 'position_add', 'position_list'],
                [link_position_add],
                menu_name=u'sidebar')
Link.bind_links([AgencyPosition], [link_position_edit, link_position_delete])

Link.bind_links([AgencyDepartment, 'department_add', 'department_list'],
                [link_department_add],
                menu_name=u'sidebar')
Link.bind_links([AgencyDepartment],
                [link_department_edit, link_department_delete])

register_top_menu('agencies_menu', link=link_agencies_menu, position=2)

register_model_list_columns(AgencyDepartment, [
    {
        'name':
        _(u'main department?'),
        'attribute':
        encapsulate(
            lambda x: two_state_template(x.main_department).display_small())
    },
    {
        'name': _(u'creation date'),
        'attribute': 'start_date',
    },
    {
        'name': _(u'date disbanding'),
        'attribute': 'end_date',
    },
])
Beispiel #17
0
from django.contrib.contenttypes.models import ContentType
from django.db import transaction, DatabaseError
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.utils.translation import ugettext_lazy as _

from common.utils import encapsulate
from navigation.api import register_model_list_columns

from .models import WorkflowInstance, WorkflowInstanceHistory, WorkflowTypeRelation


register_model_list_columns(WorkflowInstance, [
    {'name': _(u'type'), 'attribute': 'workflow_type'},
    {'name': _(u'latest action'), 'attribute': 'get_latest_action'},
    {'name': _(u'lastest state'), 'attribute': 'get_latest_state'},
])

register_model_list_columns(WorkflowInstanceHistory, [
    {'name': _(u'date and time'), 'attribute': 'datetime_created'},
    {'name': _(u'action'), 'attribute': 'workflow_type_action'},
    {'name': _(u'user'), 'attribute': encapsulate(lambda x: x.user or '')},
    {'name': _(u'assignee group'), 'attribute': encapsulate(lambda x: x.assignee_group or '')},
    {'name': _(u'assignee user'), 'attribute': encapsulate(lambda x: x.assignee_user or '')},
    {'name': _(u'comments'), 'attribute': 'comments'},
])

@receiver(post_save, dispatch_uid='launch_workflow_on_create')
def launch_workflow_on_create(sender, **kwargs):
    if kwargs['created'] and not kwargs['raw']:
Beispiel #18
0
    'view': 'tag_tagged_item_list',
    'args': 'object.id',
    'famfam': 'page'
}
tag_multiple_delete = {
    'text': _(u'delete'),
    'view': 'tag_multiple_delete',
    'famfam': 'tag_blue_delete',
    'permissions': [PERMISSION_TAG_DELETE]
}

register_model_list_columns(
    Tag, [{
        'name': _(u'color'),
        'attribute': encapsulate(lambda x: tag_color_block(x))
    }, {
        'name':
        _(u'color name'),
        'attribute':
        encapsulate(lambda x: x.tagproperties_set.get().get_color_display()),
    }])

register_links(Tag, [tag_tagged_item_list, tag_edit, tag_delete])

register_multi_item_links(['tag_list'], [tag_multiple_delete])

register_links([
    'tag_list', 'tag_delete', 'tag_edit', 'tag_tagged_item_list',
    'tag_multiple_delete', 'tag_create'
], [tag_list, tag_create],
               menu_name='secondary_menu')
Beispiel #19
0
    generic.GenericRelation(Comment,
                            content_type_field='content_type',
                            object_id_field='object_pk'))

class_permissions(Document, [
    PERMISSION_COMMENT_CREATE, PERMISSION_COMMENT_DELETE,
    PERMISSION_COMMENT_VIEW
])

register_model_list_columns(Comment, [{
    'name': _('Date'),
    'attribute': 'submit_date'
}, {
    'name':
    _('User'),
    'attribute':
    encapsulate(lambda x: x.user.get_full_name()
                if x.user.get_full_name() else x.user)
}, {
    'name': _('Comment'),
    'attribute': 'comment'
}])

register_links([
    'comments:comments_for_document', 'comments:comment_add',
    'comments:comment_delete', 'comments:comment_multiple_delete'
], [comment_add],
               menu_name='sidebar')
register_links(Comment, [comment_delete])
register_links(Document, [comments_for_document], menu_name='form_header')
Beispiel #20
0
from acls.api import class_permissions
#from agencies.classes import AgencyElement
from agencies.models import Agency
from common.utils import encapsulate
from navigation.api import register_top_menu, register_model_list_columns
from navigation.classes import Link

from .links import (link_agency_software_list, link_agency_software_create,
    link_agency_software_delete, link_agency_software_edit, link_agency_software_view)
from .models import Agency, AgencySoftware
from .permissions import (PERMISSION_AGENCY_SOFTWARE_CREATE, PERMISSION_AGENCY_SOFTWARE_DELETE,
    PERMISSION_AGENCY_SOFTWARE_EDIT, PERMISSION_AGENCY_SOFTWARE_VIEW)

Link.bind_links(['agency_software_list', 'data_create', AgencySoftware], [link_agency_software_create], menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_software_list])
Link.bind_links([AgencySoftware], [link_agency_software_view, link_agency_software_edit, link_agency_software_delete])

register_model_list_columns(AgencySoftware, [
    {'name': _(u'type'), 'attribute': 'software.software_type'},
    {'name': _(u'label'), 'attribute': 'software.label'},
    {'name': _(u'amount'), 'attribute': 'amount'},
])

#AgencyElement(link_agency_tools_profile_list)
class_permissions(Agency, [
        PERMISSION_AGENCY_SOFTWARE_CREATE, PERMISSION_AGENCY_SOFTWARE_DELETE,
        PERMISSION_AGENCY_SOFTWARE_EDIT, PERMISSION_AGENCY_SOFTWARE_VIEW
    ]
)
Beispiel #21
0
                          PERMISSION_DATA_EDIT, PERMISSION_DATA_VIEW)

#Link.bind_links(['data_list'], [link_data_list], menu_name='secondary_menu')
Link.bind_links(['agency_data_list', 'data_create', AgencyData],
                [link_data_create],
                menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_data_list])
Link.bind_links([AgencyData],
                [link_data_view, link_data_edit, link_data_delete])

register_model_list_columns(AgencyData, [
    {
        'name': _(u'name'),
        'attribute': 'label'
    },
    {
        'name': _(u'data type'),
        'attribute': 'data_type'
    },
    {
        'name': _(u'description'),
        'attribute': 'description'
    },
])

#AgencyElement(link_agency_data_list)
class_permissions(Agency, [
    PERMISSION_DATA_CREATE, PERMISSION_DATA_DELETE, PERMISSION_DATA_EDIT,
    PERMISSION_DATA_VIEW
])
Beispiel #22
0
    [setup_source_transformation_list, setup_source_edit, setup_source_delete])

# Document version
register_links(
    ['document_version_list', 'upload_version', 'document_version_revert'],
    [upload_version],
    menu_name='sidebar')

register_links([
    'setup_source_transformation_create', 'setup_source_transformation_edit',
    'setup_source_transformation_delete', 'setup_source_transformation_list'
], [setup_source_transformation_create],
               menu_name='sidebar')

source_views = [
    'setup_web_form_list', 'setup_staging_folder_list',
    'setup_watch_folder_list', 'setup_source_edit', 'setup_source_delete',
    'setup_source_create', 'setup_source_transformation_list',
    'setup_source_transformation_edit', 'setup_source_transformation_delete',
    'setup_source_transformation_create'
]

register_model_list_columns(StagingFile, [
    {
        'name': _(u'thumbnail'),
        'attribute': encapsulate(lambda x: staging_file_thumbnail(x))
    },
])

register_setup(setup_sources)
Beispiel #23
0
], menu_name='related')

register_links(['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('document_page_transformation_list', [document_page_transformation_create], menu_name='sidebar')
register_links('document_page_transformation_create', [document_page_transformation_create], menu_name='sidebar')
register_links(['document_page_transformation_edit', 'document_page_transformation_delete'], [document_page_transformation_create], menu_name='sidebar')

register_diagnostic('documents', _(u'Documents'), document_missing_list)

register_maintenance_links([document_find_all_duplicates, document_update_page_count, document_clear_image_cache], namespace='documents', title=_(u'documents'))

register_model_list_columns(Document, [
    {'name': _(u'thumbnail'), 'attribute':
        encapsulate(lambda x: document_thumbnail(x, gallery_name='document_list', title=x.filename, size=THUMBNAIL_SIZE))
    },
])

register_top_menu(
    'documents',
    link={'famfam': 'page', 'text': _(u'documents'), 'view': 'document_list_recent'},
    children_path_regex=[
        r'^documents/[^t]', r'^metadata/[^s]', r'comments', r'tags/document', r'grouping/[^s]', r'history/list/for_object/documents',
    ],
    children_view_regex=[r'document_acl', r'smart_link_instance'],
    children_views=['document_folder_list', 'folder_add_document', 'document_index_list', 'upload_version', ],
    position=1
)

register_sidebar_template(['document_list_recent'], 'recent_document_list_help.html')
Beispiel #24
0
from django.utils.translation import ugettext_lazy as _

from acls.api import class_permissions
#from agencies.classes import AgencyElement
from agencies.models import Agency
from common.utils import encapsulate
from navigation.api import register_top_menu, register_model_list_columns
from navigation.classes import Link

from .links import (link_agency_tools_profile_list, link_tools_profile_create,
    link_tools_profile_delete, link_tools_profile_edit, link_tools_profile_view)
from .models import ToolsProfile
from .permissions import (PERMISSION_TOOLS_PROFILE_CREATE, PERMISSION_TOOLS_PROFILE_DELETE,
    PERMISSION_TOOLS_PROFILE_EDIT, PERMISSION_TOOLS_PROFILE_VIEW)

Link.bind_links([ToolsProfile, 'agency_tools_profile_list', 'tools_profile_create'], [link_tools_profile_create], menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_tools_profile_list])

Link.bind_links([ToolsProfile], [link_tools_profile_view, link_tools_profile_edit, link_tools_profile_delete])

register_model_list_columns(ToolsProfile, [
    {'name': _(u'creation date and time'), 'attribute': encapsulate(lambda x: x.datetime_created)},
])

#AgencyElement(link_agency_tools_profile_list)
class_permissions(Agency, [
        PERMISSION_TOOLS_PROFILE_CREATE, PERMISSION_TOOLS_PROFILE_DELETE,
        PERMISSION_TOOLS_PROFILE_EDIT, PERMISSION_TOOLS_PROFILE_VIEW
    ]
)
Beispiel #25
0
    "setup_watch_folder_list",
    "setup_source_edit",
    "setup_source_delete",
    "setup_source_create",
    "setup_source_transformation_list",
    "setup_source_transformation_edit",
    "setup_source_transformation_delete",
    "setup_source_transformation_create",
]

register_model_list_columns(
    StagingFile,
    [
        {
            "name": _(u"thumbnail"),
            "attribute": encapsulate(
                lambda x: staging_file_thumbnail(x, gallery_name="staging_list", title=x.filename, size="100")
            ),
        }
    ],
)

register_setup(setup_sources)

register_links(
    [
        Document,
        "document_list_recent",
        "document_list",
        "document_create",
        "document_create_multiple",
Beispiel #26
0
from __future__ import absolute_import

from django.utils.translation import ugettext_lazy as _

from project_tools.api import register_tool
from navigation.api import register_model_list_columns, register_links
from common.utils import encapsulate

from .models import History
from .widgets import history_entry_type_link
from .links import history_list, history_details

register_tool(history_list)

register_model_list_columns(History, [
    {
        'name': _(u'date and time'),
        'attribute': 'datetime'
    },
    {
        'name': _(u'type'),
        'attribute': encapsulate(lambda entry: history_entry_type_link(entry))
    },
    {
        'name': _(u'summary'),
        'attribute': encapsulate(lambda entry: unicode(entry.get_processed_summary()))
    }
])

register_links(History, [history_details])
Beispiel #27
0
register_setup(user_setup)
register_setup(group_setup)

register_model_list_columns(User, [
    {
        'name': _(u'full name'),
        'attribute': 'get_full_name'
    },
    {
        'name': _(u'email'),
        'attribute': 'email'
    },
    {
        'name':
        _(u'active'),
        'attribute':
        encapsulate(lambda x: two_state_template(x.is_active).display_small()),
    },
    {
        'name':
        _(u'has usable password?'),
        'attribute':
        encapsulate(lambda x: two_state_template(x.has_usable_password()).
                    display_small()),
    },
])

register_model_list_columns(Group, [
    {
        'name': _(u'members'),
Beispiel #28
0
    "user_add",
    "user_delete",
    "user_multiple_delete",
    "user_set_password",
    "user_multiple_set_password",
    "group_list",
    "group_edit",
    "group_add",
    "group_delete",
    "group_multiple_delete",
    "group_members",
]

register_setup(user_setup)
register_setup(group_setup)

register_model_list_columns(
    User,
    [
        {"name": _(u"full name"), "attribute": "get_full_name"},
        {"name": _(u"email"), "attribute": "email"},
        {"name": _(u"active"), "attribute": encapsulate(lambda x: two_state_template(x.is_active).display_small())},
        {
            "name": _(u"has usable password?"),
            "attribute": encapsulate(lambda x: two_state_template(x.has_usable_password()).display_small()),
        },
    ],
)

register_model_list_columns(Group, [{"name": _(u"members"), "attribute": "user_set.count"}])
Beispiel #29
0
               menu_name="sidebar")
register_links(Document, [document_folder_list], menu_name='form_header')
register_links([Document], [
    folder_add_multiple_documents, folder_document_multiple_remove, link_spacer
],
               menu_name='multi_item_links')

register_top_menu(name='folders', link=folders_main_menu_link)

class_permissions(Folder, [
    ACLS_EDIT_ACL, ACLS_VIEW_ACL, PERMISSION_FOLDER_DELETE,
    PERMISSION_FOLDER_EDIT, PERMISSION_FOLDER_VIEW
])

class_permissions(
    Document,
    [PERMISSION_FOLDER_ADD_DOCUMENT, PERMISSION_FOLDER_REMOVE_DOCUMENT])

register_model_list_columns(Folder, [
    {
        'name': _('Created'),
        'attribute': 'datetime_created'
    },
    {
        'name': _('Documents'),
        'attribute': encapsulate(lambda x: x.documents.count())
    },
])

APIEndPoint('folders')
Beispiel #30
0
                      'famfam': 'hourglass',
                      'text': _(u'reminders'),
                      'view': 'reminder_list'
                  },
                  children_path_regex=[r'^reminders', r'comments'],
                  position=0)

register_model_list_columns(
    Reminder,
    [{
        'name': _(u'created'),
        'attribute': lambda x: x.datetime_created
    }, {
        'name': _(u'expires'),
        'attribute': lambda x: x.datetime_expire
    }, {
        'name': _('days'),
        'attribute': lambda x: (x.datetime_expire - x.datetime_created).days
    }, {
        'name':
        _('expired?'),
        'attribute':
        lambda x: two_state_template(
            (x.datetime_expire < datetime.datetime.now().date()), states=1)
    }])

register_model_list_columns(
    Participant, [{
        'name':
        _(u'name'),
        'attribute':
        lambda x: x.user.get_full_name() if x.user.get_full_name() else x.user
Beispiel #31
0
register_top_menu('reminders',
    link={'famfam': 'hourglass', 'text': _(u'reminders'), 'view': 'reminder_list'},
    children_path_regex=[r'^reminders', r'comments'], position=0
)

register_model_list_columns(Reminder, [
        {
            'name': _(u'created'),
            'attribute': lambda x: x.datetime_created
        },
        {
            'name': _(u'expires'),
            'attribute': lambda x: x.datetime_expire
        },
        {
            'name': _('days'),
            'attribute': lambda x: (x.datetime_expire - x.datetime_created).days
        },
        {
            'name': _('expired?'),
            'attribute': lambda x: two_state_template((x.datetime_expire < datetime.datetime.now().date()), states=1)
        }
    ]
)

register_model_list_columns(Participant, [
        {
            'name': _(u'name'),
            'attribute': lambda x: x.user.get_full_name() if x.user.get_full_name() else x.user
        },
Beispiel #32
0
Link.bind_links(['agency_software_list', 'data_create', AgencySoftware],
                [link_agency_software_create],
                menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_software_list])
Link.bind_links([AgencySoftware], [
    link_agency_software_view, link_agency_software_edit,
    link_agency_software_delete
])

register_model_list_columns(AgencySoftware, [
    {
        'name': _(u'type'),
        'attribute': 'software.software_type'
    },
    {
        'name': _(u'label'),
        'attribute': 'software.label'
    },
    {
        'name': _(u'amount'),
        'attribute': 'amount'
    },
])

#AgencyElement(link_agency_tools_profile_list)
class_permissions(Agency, [
    PERMISSION_AGENCY_SOFTWARE_CREATE, PERMISSION_AGENCY_SOFTWARE_DELETE,
    PERMISSION_AGENCY_SOFTWARE_EDIT, PERMISSION_AGENCY_SOFTWARE_VIEW
])
Beispiel #33
0
class_permissions(Document, [
    PERMISSION_TAG_ATTACH,
    PERMISSION_TAG_REMOVE,
])
class_permissions(Tag, [
    PERMISSION_TAG_DELETE,
    PERMISSION_TAG_EDIT,
    PERMISSION_TAG_VIEW,
])

APIEndPoint('tags')

register_model_list_columns(
    Tag, [{
        'name': _('Preview'),
        'attribute': encapsulate(lambda x: single_tag_widget(x))
    }, {
        'name': _('Tagged items'),
        'attribute': encapsulate(lambda x: x.documents.count())
    }])

register_model_list_columns(Document, [
    {
        'name': _('Tags'),
        'attribute': encapsulate(lambda x: get_tags_inline_widget_simple(x))
    },
])

register_top_menu('tags',
                  link={
                      'text': _('Tags'),
                      'view': 'tags:tag_list',
Beispiel #34
0
from .classes import Event
from .widgets import event_type_link


@python_2_unicode_compatible
class EventType(models.Model):
    name = models.CharField(max_length=64, unique=True, verbose_name=_('Name'))

    def __str__(self):
        return unicode(Event.get_label(self.name))

    class Meta:
        verbose_name = _('Event type')
        verbose_name_plural = _('Event types')


register_model_list_columns(Action, [
    {
        'name': _('Timestamp'),
        'attribute': 'timestamp'
    },
    {
        'name': _('Actor'),
        'attribute': 'actor',
    },
    {
        'name': _('Verb'),
        'attribute': encapsulate(lambda entry: event_type_link(entry))
    },
])
Beispiel #35
0
], menu_name='related')

register_links(['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('document_page_transformation_list', [document_page_transformation_create], menu_name='sidebar')
register_links('document_page_transformation_create', [document_page_transformation_create], menu_name='sidebar')
register_links(['document_page_transformation_edit', 'document_page_transformation_delete'], [document_page_transformation_create], menu_name='sidebar')

register_diagnostic('documents', _(u'Documents'), document_missing_list)

register_maintenance_links([document_find_all_duplicates, document_update_page_count, document_clear_image_cache], namespace='documents', title=_(u'documents'))

register_model_list_columns(Document, [
        {'name': _(u'thumbnail'), 'attribute':
            encapsulate(lambda x: document_thumbnail(x))
        },
    ])

register_top_menu(
    'documents',
    link={'famfam': 'page', 'text': _(u'documents'), 'view': 'document_list_recent'},
    children_path_regex=[
        r'^documents/[^t]', r'^metadata/[^s]', r'comments', r'tags/document', r'grouping/[^s]', r'history/list/for_object/documents',
    ],
    children_view_regex=[r'document_acl', r'smart_link_instance'],
    children_views=['document_folder_list', 'folder_add_document', 'document_index_list', 'upload_version', ],
    position=1
)

register_sidebar_template(['document_list_recent'], 'recent_document_list_help.html')
Beispiel #36
0
    document_create_multiple, document_create_siblings, setup_sources,
    setup_source_create_imap_email, setup_source_create_pop3_email,
    setup_source_create_watch_folder, setup_source_create_webform,
    setup_source_create_staging_folder, setup_source_delete, setup_source_edit,
    setup_source_transformation_create, setup_source_transformation_delete,
    setup_source_transformation_edit, setup_source_transformation_list,
    staging_file_delete, upload_version)
from .models import Source, SourceTransformation
from .widgets import staging_file_thumbnail

register_model_list_columns(StagingFile, [
    {
        'name':
        _('Thumbnail'),
        'attribute':
        encapsulate(lambda x: staging_file_thumbnail(x,
                                                     gallery_name=
                                                     'sources:staging_list',
                                                     title=x.filename,
                                                     size='100'))
    },
])

register_links([StagingFile], [staging_file_delete])
register_links(
    [Source, 'sources:setup_source_list', 'sources:setup_source_create'], [
        setup_sources, setup_source_create_webform,
        setup_source_create_staging_folder, setup_source_create_pop3_email,
        setup_source_create_imap_email, setup_source_create_watch_folder
    ],
    menu_name='secondary_menu')
register_links(
Beispiel #37
0
    'document_page_transformation_edit', 'document_page_transformation_delete'
], [document_page_transformation_create],
               menu_name='sidebar')

register_diagnostic('documents', _(u'Documents'), document_missing_list)

register_maintenance_links([
    document_find_all_duplicates, document_update_page_count,
    document_clear_image_cache
],
                           namespace='documents',
                           title=_(u'documents'))

register_model_list_columns(Document, [
    {
        'name': _(u'thumbnail'),
        'attribute': encapsulate(lambda x: document_thumbnail(x))
    },
])

register_top_menu(
    'documents',
    link={
        'famfam': 'page',
        'text': _(u'documents'),
        'view': 'document_list_recent'
    },
    children_path_regex=[
        r'^documents/[^t]',
        r'^metadata/[^s]',
        r'comments',
        r'tags/document',
Beispiel #38
0
def check_first_run():
    try:
        details = Installation.objects.get()
    except DatabaseError:
        # Avoid database errors when the app tables haven't been created yet
        transaction.rollback()        
    else:
        if details.is_first_run:
            details.submit()


register_model_list_columns(PropertyNamespace, [
    {
        'name': _(u'label'),
        'attribute': 'label'
    },
    {
        'name': _(u'items'),
        'attribute': encapsulate(lambda entry: len(entry.get_properties()))
    }    
])

register_model_list_columns(Property, [
    {
        'name': _(u'label'),
        'attribute': 'label'
    },
    {
        'name': _(u'value'),
        'attribute': 'value'
    }    
])
Beispiel #39
0
Link.bind_links([Project, 'agency_infrastructure_project_list', 'infrastructure_project_create'], [link_project_create], menu_name='secondary_menu')
Link.bind_links([Project], [link_project_view, link_project_edit, link_project_delete])
#Link.bind_links([Project], [link_project_info_view, link_project_budget_view, link_project_details_view, link_project_opportunities_view, link_project_file_list, link_project_workflow_instance_list], menu_name='form_header')
Link.bind_links([Project], [link_project_view, link_project_file_list], menu_name='form_header')

#Link.bind_links([ProjectInfo], [link_project_info_edit, link_project_info_delete])
#Link.bind_links([ProjectBudget], [link_project_budget_edit, link_project_budget_delete])
#Link.bind_links([ProjectDetails], [link_project_details_edit, link_project_details_delete])
Link.bind_links([ProjectFile, 'infrastructure_project_file_upload', 'infrastructure_project_file_list'], [link_project_file_upload], menu_name='secondary_menu')
Link.bind_links([ProjectFile], [link_project_file_download, link_project_file_delete])

register_model_list_columns(Project, [
    {'name': _(u'name'), 'attribute': 'label'},
#    {'name': _(u'completion (%)'), 'attribute': encapsulate(lambda x: x.get_completion())},
#    {'name': _(u'fiscal year'), 'attribute': 'fiscal_year'},
#    {'name': _(u'purpose'), 'attribute': 'purpose'},
#    {'name': _(u'classification'), 'attribute': 'classification'},
])

register_model_list_columns(ProjectFile, [
    {'name': _(u'label'), 'attribute': 'label'},
    {'name': _(u'file'), 'attribute': 'get_base_filename'},
])

class_permissions(Agency, [
        PERMISSION_PROJECT_EDIT, PERMISSION_PROJECT_DELETE,
        PERMISSION_PROJECT_VIEW, PERMISSION_PROJECT_CREATE
    ]
)
'''
Beispiel #40
0
#def document_exists(document):
#    try:
#        if document.exists():
#            return u'<span class="famfam active famfam-tick"></span>'
#        else:
#            return u'<span class="famfam active famfam-cross"></span>'
#    except Exception, exc:
#        return exc

register_model_list_columns(Document, [
    {
        'name': _(u'thumbnail'),
        'attribute': encapsulate(lambda x: document_thumbnail(x))
    },
    {
        'name': _(u'tags'),
        'attribute': encapsulate(lambda x: get_tags_inline_widget_simple(x))
    },
    {
        'name': _(u'metadata'),
        'attribute': encapsulate(lambda x: get_metadata_string(x))
    },
])

register_top_menu(
    'documents',
    link={
        'famfam': 'page',
        'text': _(u'documents'),
        'view': 'document_list_recent'
    },
    children_path_regex=[
Beispiel #41
0
from .permissions import (PERMISSION_COMMENT_CREATE,
    PERMISSION_COMMENT_DELETE, PERMISSION_COMMENT_VIEW)

comment_delete = {'text': _('delete'), 'view': 'comment_delete', 'args': 'object.pk', 'famfam': 'comment_delete', 'permissions': [PERMISSION_COMMENT_DELETE]}
comment_multiple_delete = {'text': _('delete'), 'view': 'comment_multiple_delete', 'args': 'object.pk', 'famfam': 'comments_delete', 'permissions': [PERMISSION_COMMENT_DELETE]}
comment_add = {'text': _('add comment'), 'view': 'comment_add', 'args': 'object.pk', 'famfam': 'comment_add', 'permissions': [PERMISSION_COMMENT_CREATE]}
comments_for_document = {'text': _('comments'), 'view': 'comments_for_document', 'args': 'object.pk', 'famfam': 'comments', 'permissions': [PERMISSION_COMMENT_VIEW], 'children_view_regex': ['comment']}

register_model_list_columns(Comment, [
    {
        'name': _(u'date'),
        'attribute': 'submit_date'
    },
    {
        'name': _(u'user'),
        'attribute': encapsulate(lambda x: x.user.get_full_name() if x.user.get_full_name() else x.user)
    },
    {
        'name': _(u'comment'),
        'attribute': 'comment'
    }
])

register_links(['comments_for_document', 'comment_add', 'comment_delete', 'comment_multiple_delete'], [comment_add], menu_name='sidebar')
register_links(Comment, [comment_delete])
register_links(Document, [comments_for_document], menu_name='form_header')

Document.add_to_class(
    'comments',
    generic.GenericRelation(
        Comment,
Beispiel #42
0
tag_list = {'text': _(u'tag list'), 'view': 'tag_list', 'famfam': 'tag_blue'}
tag_add_attach = {'text': _(u'attach tag'), 'view': 'tag_add_attach', 'args': 'object.pk', 'famfam': 'tag_blue_add', 'permission': [PERMISSION_TAG_CREATE, PERMISSION_TAG_ATTACH]}
tag_document_remove = {'text': _(u'remove'), 'view': 'tag_remove', 'args': ['object.id', 'document.id'], 'famfam': 'tag_blue_delete', 'permissions': [PERMISSION_TAG_REMOVE]}
tag_document_remove_multiple = {'text': _(u'remove'), 'view': 'tag_multiple_remove', 'args': 'document.id', 'famfam': 'tag_blue_delete', 'permissions': [PERMISSION_TAG_REMOVE]}
tag_document_list = {'text': _(u'tags'), 'view': 'document_tags', 'args': 'object.pk', 'famfam': 'tag_blue', 'permissions': [PERMISSION_TAG_REMOVE]}
tag_delete = {'text': _(u'delete'), 'view': 'tag_delete', 'args': 'object.id', 'famfam': 'tag_blue_delete', 'permissions': [PERMISSION_TAG_DELETE]}
tag_edit = {'text': _(u'edit'), 'view': 'tag_edit', 'args': 'object.id', 'famfam': 'tag_blue_edit', 'permissions': [PERMISSION_TAG_EDIT]}
tag_tagged_item_list = {'text': _(u'tagged documents'), 'view': 'tag_tagged_item_list', 'args': 'object.id', 'famfam': 'page'}
tag_multiple_delete = {'text': _(u'delete'), 'view': 'tag_multiple_delete', 'famfam': 'tag_blue_delete', 'permissions': [PERMISSION_TAG_DELETE]}

register_model_list_columns(Tag, [
    {
        'name': _(u'color'),
        'attribute': lambda x: tag_color_block(x)
    },
    {
        'name': _(u'color name'),
        'attribute': lambda x: x.tagproperties_set.get().get_color_display(),
    }
])

register_links(Tag, [tag_tagged_item_list, tag_edit, tag_delete])

register_multi_item_links(['tag_list'], [tag_multiple_delete])

register_links(['tag_list', 'tag_delete', 'tag_edit', 'tag_tagged_item_list', 'tag_multiple_delete'], [tag_list], menu_name='secondary_menu')

#register_sidebar_template(['document_tags'], 'tags_sidebar_template.html')

register_top_menu('tags', link={'text': _(u'tags'), 'view': 'tag_list', 'famfam': 'tag_blue'}, children_path_regex=[r'^tags/[^d]'])
Beispiel #43
0
                    link_tools_profile_delete, link_tools_profile_edit,
                    link_tools_profile_view)
from .models import ToolsProfile
from .permissions import (PERMISSION_TOOLS_PROFILE_CREATE,
                          PERMISSION_TOOLS_PROFILE_DELETE,
                          PERMISSION_TOOLS_PROFILE_EDIT,
                          PERMISSION_TOOLS_PROFILE_VIEW)

Link.bind_links(
    [ToolsProfile, 'agency_tools_profile_list', 'tools_profile_create'],
    [link_tools_profile_create],
    menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_tools_profile_list])

Link.bind_links([ToolsProfile], [
    link_tools_profile_view, link_tools_profile_edit, link_tools_profile_delete
])

register_model_list_columns(ToolsProfile, [
    {
        'name': _(u'creation date and time'),
        'attribute': encapsulate(lambda x: x.datetime_created)
    },
])

#AgencyElement(link_agency_tools_profile_list)
class_permissions(Agency, [
    PERMISSION_TOOLS_PROFILE_CREATE, PERMISSION_TOOLS_PROFILE_DELETE,
    PERMISSION_TOOLS_PROFILE_EDIT, PERMISSION_TOOLS_PROFILE_VIEW
])
Beispiel #44
0
    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')
register_links(['documents:document_page_transformation_edit', 'documents:document_page_transformation_delete'], [document_page_transformation_create], menu_name='sidebar')

register_maintenance_links([document_clear_image_cache], namespace='documents', title=_('Documents'))
register_model_list_columns(Document, [
    {
        'name': _('Thumbnail'), 'attribute':
        encapsulate(lambda x: document_thumbnail(x, gallery_name='documents:document_list', title=getattr(x, 'filename', None), size=THUMBNAIL_SIZE))
    },
    {
        'name': _('Type'), 'attribute': 'document_type'
    }
])

if (not validate_path(document_settings.CACHE_PATH)) or (not document_settings.CACHE_PATH):
    setattr(document_settings, 'CACHE_PATH', tempfile.mkdtemp())

register_setup(document_type_setup)

class_permissions(Document, [
    ACLS_EDIT_ACL, ACLS_VIEW_ACL, PERMISSION_DOCUMENT_DELETE,
    PERMISSION_DOCUMENT_DOWNLOAD, PERMISSION_DOCUMENT_EDIT,
    PERMISSION_DOCUMENT_NEW_VERSION, PERMISSION_DOCUMENT_PROPERTIES_EDIT,
    PERMISSION_DOCUMENT_TRANSFORM, PERMISSION_DOCUMENT_VERSION_REVERT,
Beispiel #45
0
register_diagnostic('documents', _(u'Documents'), document_missing_list)

register_maintenance_links([
    document_find_all_duplicates, document_update_page_count,
    document_clear_image_cache
],
                           namespace='documents',
                           title=_(u'documents'))

register_model_list_columns(Document, [
    {
        'name':
        _(u'thumbnail'),
        'attribute':
        encapsulate(
            lambda x: document_thumbnail(x,
                                         gallery_name='document_list',
                                         title=getattr(x, 'filename', None),
                                         size=THUMBNAIL_SIZE))
    },
])

register_top_menu(
    'documents',
    link={
        'famfam': 'page',
        'text': _(u'documents'),
        'view': 'document_list_recent'
    },
    children_path_regex=[
        r'^documents/[^t]',
Beispiel #46
0
], [setup_metadata_type_list, setup_metadata_type_create],
               menu_name='secondary_menu')

register_setup(setup_metadata_type_list)
register_tool(link_documents_missing_required_metadata)

class_permissions(Document, [
    PERMISSION_METADATA_DOCUMENT_ADD,
    PERMISSION_METADATA_DOCUMENT_EDIT,
    PERMISSION_METADATA_DOCUMENT_REMOVE,
    PERMISSION_METADATA_DOCUMENT_VIEW,
])

register_model_list_columns(Document, [
    {
        'name': _('Metadata'),
        'attribute': encapsulate(lambda x: get_metadata_string(x))
    },
])

APIEndPoint('metadata')
ModelAttribute(Document,
               'metadata__metadata_type__name',
               label=_('Metadata type name'),
               type_name='query')
ModelAttribute(Document,
               'metadata__value',
               label=_('Metadata type value'),
               type_name='query')
ModelAttribute(
    Document,
    'metadata',
Beispiel #47
0
from acls.api import class_permissions
#from agencies.classes import AgencyElement
from agencies.models import Agency
from common.utils import encapsulate
from navigation.api import register_top_menu, register_model_list_columns
from navigation.classes import Link

from .links import (link_data_create, link_data_delete, link_data_edit,
    link_data_view, link_agency_data_list)
from .models import AgencyData
from .permissions import (PERMISSION_DATA_CREATE, PERMISSION_DATA_DELETE,
    PERMISSION_DATA_EDIT, PERMISSION_DATA_VIEW)

#Link.bind_links(['data_list'], [link_data_list], menu_name='secondary_menu')
Link.bind_links(['agency_data_list', 'data_create', AgencyData], [link_data_create], menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_data_list])
Link.bind_links([AgencyData], [link_data_view, link_data_edit, link_data_delete])

register_model_list_columns(AgencyData, [
    {'name': _(u'name'), 'attribute': 'label'},
    {'name': _(u'data type'), 'attribute': 'data_type'},
    {'name': _(u'description'), 'attribute': 'description'},
])

#AgencyElement(link_agency_data_list)
class_permissions(Agency, [
        PERMISSION_DATA_CREATE, PERMISSION_DATA_DELETE,
        PERMISSION_DATA_EDIT, PERMISSION_DATA_VIEW
    ]
)
Beispiel #48
0
from .models import Folder
from .permissions import (
    PERMISSION_FOLDER_ADD_DOCUMENT, PERMISSION_FOLDER_DELETE,
    PERMISSION_FOLDER_EDIT, PERMISSION_FOLDER_REMOVE_DOCUMENT,
    PERMISSION_FOLDER_VIEW
)

register_links(Folder, [folder_view, folder_edit, folder_acl_list, folder_delete])
register_links([Folder, 'folders:folder_list', 'folders:folder_create'], [folder_list, folder_create], menu_name='secondary_menu')
register_links(['folders:document_folder_list', 'folders:folder_add_document'], [folder_add_document], menu_name="sidebar")
register_links(Document, [document_folder_list], menu_name='form_header')
register_links([Document], [folder_add_multiple_documents, folder_document_multiple_remove, link_spacer], menu_name='multi_item_links')

register_top_menu(name='folders', link=folders_main_menu_link)

class_permissions(Folder, [
    ACLS_EDIT_ACL, ACLS_VIEW_ACL, PERMISSION_FOLDER_DELETE,
    PERMISSION_FOLDER_EDIT, PERMISSION_FOLDER_VIEW
])

class_permissions(Document, [
    PERMISSION_FOLDER_ADD_DOCUMENT, PERMISSION_FOLDER_REMOVE_DOCUMENT
])

register_model_list_columns(Folder, [
    {'name': _('Created'), 'attribute': 'datetime_created'},
    {'name': _('Documents'), 'attribute': encapsulate(lambda x: x.documents.count())},
])

APIEndPoint('folders')
Beispiel #49
0
from .models import Agency
from .permissions import PERMISSION_AGENCY_VIEW, PERMISSION_AGENCY_EDIT

Link.bind_links([Agency, 'agency_list'], [link_agency_list],
                menu_name='secondary_menu')
#Link.bind_links([Agency], [link_agency_details, link_agency_view, link_agency_edit, link_agency_delete])
Link.bind_links(
    [Agency],
    [link_agency_acl_details
     ])  #, link_agency_view, link_agency_edit])#, link_agency_delete])

register_model_list_columns(
    Agency,
    [
        #{'name': _(u'registration'), 'attribute': 'registration'},
        {
            'name': _(u'name'),
            'attribute': 'name'
        },
    ])

register_top_menu('agencies', link=link_agencies, position=1)

class_permissions(Agency, [
    PERMISSION_AGENCY_VIEW,
    PERMISSION_AGENCY_EDIT,
    ACLS_VIEW_ACL,
    ACLS_EDIT_ACL,
])

#agency_search = SearchModel('agencies', 'Agency')
Beispiel #50
0
from .models import Circuit, Equipment
from .permissions import (PERMISSION_CIRCUIT_CREATE, PERMISSION_CIRCUIT_DELETE,
    PERMISSION_CIRCUIT_EDIT, PERMISSION_CIRCUIT_VIEW, PERMISSION_EQUIPMENT_CREATE,
    PERMISSION_EQUIPMENT_DELETE, PERMISSION_EQUIPMENT_EDIT, PERMISSION_EQUIPMENT_VIEW)

#Link.bind_links(['equipment_list'], [link_equipment_list], menu_name='secondary_menu')
Link.bind_links(['agency_equipment_list', 'equipment_create', Equipment], [link_equipment_create], menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_equipment_list])
Link.bind_links([Equipment], [link_equipment_view, link_equipment_edit, link_equipment_delete])

Link.bind_links(['agency_circuit_list', 'circuit_create', Circuit], [link_circuit_create], menu_name='secondary_menu')
Link.bind_links([Agency], [link_agency_circuit_list])
Link.bind_links([Circuit], [link_circuit_view, link_circuit_edit, link_circuit_delete])

register_model_list_columns(Equipment, [
    {'name': _(u'name'), 'attribute': 'label'},
])

register_model_list_columns(Circuit, [
    {'name': _(u'purpose'), 'attribute': 'purpose'},
    {'name': _(u'provider'), 'attribute': 'provider'},
    {'name': _(u'technology'), 'attribute': 'technology'},
    {'name': _(u'bandwidth'), 'attribute': encapsulate(lambda x: x.get_bandwidth_display())},
])

#AgencyElement(link_agency_equipment_list)

class_permissions(Agency, [
        PERMISSION_EQUIPMENT_CREATE, PERMISSION_EQUIPMENT_DELETE,
        PERMISSION_EQUIPMENT_EDIT, PERMISSION_EQUIPMENT_VIEW
    ]
Beispiel #51
0

@receiver(post_version_upload, dispatch_uid='post_version_upload_ocr', sender=DocumentVersion)
def post_version_upload_ocr(sender, instance, **kwargs):
    logger.debug('received post_version_upload')
    logger.debug('instance pk: %s', instance.pk)
    if instance.document.document_type.ocr:
        instance.submit_for_ocr()


Document.add_to_class('submit_for_ocr', document_ocr_submit)
DocumentVersion.add_to_class('submit_for_ocr', document_version_ocr_submit)

class_permissions(Document, [PERMISSION_OCR_DOCUMENT])

register_tool(link_entry_list)

APIEndPoint('ocr')

register_model_list_columns(DocumentVersionOCRError, [
    {
        'name': _('Document'), 'attribute': encapsulate(lambda entry: document_link(entry.document_version.document))
    },
    {
        'name': _('Added'), 'attribute': 'datetime_submitted'
    },
    {
        'name': _('Result'), 'attribute': 'result'
    },
])
Beispiel #52
0
register_links(
    [
        "setup_source_transformation_create",
        "setup_source_transformation_edit",
        "setup_source_transformation_delete",
        "setup_source_transformation_list",
    ],
    [setup_source_transformation_create],
    menu_name="sidebar",
)

source_views = [
    "setup_web_form_list",
    "setup_scanweb_form_list",
    "setup_staging_folder_list",
    "setup_watch_folder_list",
    "setup_source_edit",
    "setup_source_delete",
    "setup_source_create",
    "setup_source_transformation_list",
    "setup_source_transformation_edit",
    "setup_source_transformation_delete",
    "setup_source_transformation_create",
]

register_model_list_columns(
    StagingFile, [{"name": _(u"thumbnail"), "attribute": encapsulate(lambda x: staging_file_thumbnail(x))}]
)

register_setup(setup_sources)