예제 #1
0
파일: views.py 프로젝트: mabroor/mayan
def queue_document_list(request, queue_name='default'):
    check_permissions(request.user, [PERMISSION_OCR_DOCUMENT])

    document_queue = get_object_or_404(DocumentQueue, name=queue_name)

    return object_list(
        request,
        queryset=document_queue.queuedocument_set.all(),
        template_name='generic_list.html',
        extra_context={
            'title': _(u'documents in queue: %s') % document_queue,
            'hide_object': True,
            'queue': document_queue,
            'object_name': _(u'document queue'),
            'navigation_object_name': 'queue',
            'list_object_variable_name': 'queue_document',
            'extra_columns': [
                {'name': 'document', 'attribute': encapsulate(lambda x: document_link(x.document) if hasattr(x, 'document') else _(u'Missing document.'))},
                {'name': _(u'thumbnail'), 'attribute': encapsulate(lambda x: document_thumbnail(x.document))},
                {'name': 'submitted', 'attribute': encapsulate(lambda x: unicode(x.datetime_submitted).split('.')[0]), 'keep_together':True},
                {'name': 'delay', 'attribute': 'delay'},
                {'name': 'state', 'attribute': encapsulate(lambda x: x.get_state_display())},
                {'name': 'node', 'attribute': 'node_name'},
                {'name': 'result', 'attribute': 'result'},
            ],
            'multi_select_as_buttons': True,
            'sidebar_subtemplates_list': [
                {
                    'name': 'generic_subtemplate.html',
                    'context': {
                        'side_bar': True,
                        'title': _(u'document queue properties'),
                        'content': _(u'Current state: %s') % document_queue.get_state_display(),
                    }
                }
            ]
        },
    )
예제 #2
0
파일: __init__.py 프로젝트: mrcrabby/mayan
register_tool(document_find_all_duplicates, namespace='documents', 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':
            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'
    ],
예제 #3
0
파일: views.py 프로젝트: rkpob/mayan-edms
def queue_document_list(request, queue_name='default'):
    Permission.objects.check_permissions(request.user,
                                         [PERMISSION_OCR_DOCUMENT])

    document_queue = get_object_or_404(DocumentQueue, name=queue_name)

    context = {
        'object_list':
        document_queue.queuedocument_set.all(),
        'title':
        _(u'documents in queue: %s') % document_queue,
        'hide_object':
        True,
        'queue':
        document_queue,
        'object_name':
        _(u'document queue'),
        'navigation_object_name':
        'queue',
        'list_object_variable_name':
        'queue_document',
        'extra_columns': [
            {
                'name':
                'document',
                'attribute':
                encapsulate(lambda x: document_link(x.document) if hasattr(
                    x, 'document') else _(u'Missing document.'))
            },
            {
                'name': _(u'thumbnail'),
                'attribute':
                encapsulate(lambda x: document_thumbnail(x.document))
            },
            {
                'name':
                'submitted',
                'attribute':
                encapsulate(
                    lambda x: unicode(x.datetime_submitted).split('.')[0]),
                'keep_together':
                True
            },
            {
                'name': 'delay',
                'attribute': 'delay'
            },
            {
                'name': 'state',
                'attribute': encapsulate(lambda x: x.get_state_display())
            },
            {
                'name': 'node',
                'attribute': 'node_name'
            },
            {
                'name': 'result',
                'attribute': 'result'
            },
        ],
        'multi_select_as_buttons':
        True,
        'sidebar_subtemplates_list': [{
            'name': 'generic_subtemplate.html',
            'context': {
                'side_bar':
                True,
                'title':
                _(u'document queue properties'),
                'content':
                _(u'Current state: %s') % document_queue.get_state_display(),
            }
        }]
    }

    return render_to_response('generic_list.html',
                              context,
                              context_instance=RequestContext(request))
예제 #4
0
파일: __init__.py 프로젝트: spacedman/mayan
                           namespace='documents',
                           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',
예제 #5
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",