Beispiel #1
0
                         defaults={'object_type': object_type})
        _bp.add_url_rule(prefix + '/attachments/<int:folder_id>/',
                         'delete_folder',
                         _dispatch(RHDeleteEventFolder,
                                   RHDeleteCategoryFolder),
                         methods=('DELETE', ),
                         defaults={'object_type': object_type})
        _bp.add_url_rule(
            prefix + '/attachments/<int:folder_id>/<int:attachment_id>/',
            'delete_attachment',
            _dispatch(RHDeleteEventAttachment, RHDeleteCategoryAttachment),
            methods=('DELETE', ),
            defaults={'object_type': object_type})

# Display/download
items = itertools.chain(event_object_url_prefixes.items(),
                        [('category', [''])])
for object_type, prefixes in items:
    for prefix in prefixes:
        if object_type == 'category':
            prefix = '/category/<category_id>' + prefix
        else:
            prefix = '/event/<int:event_id>' + prefix
        _bp.add_url_rule(
            prefix +
            '/attachments/<int:folder_id>/<int:attachment_id>/<filename>',
            'download',
            _dispatch(RHDownloadEventAttachment, RHDownloadCategoryAttachment),
            defaults={'object_type': object_type})

        # attachments folders cannot be consulted in categories
Beispiel #2
0
from indico.modules.events.notes.controllers import RHCompileNotes, RHDeleteNote, RHEditNote, RHGotoNote, RHViewNote
from indico.web.flask.wrappers import IndicoBlueprint

_bp = IndicoBlueprint('event_notes',
                      __name__,
                      template_folder='templates',
                      virtual_template_folder='events/notes',
                      url_prefix='/event/<int:event_id>')

_bp.add_url_rule('/note/compile',
                 'compile',
                 RHCompileNotes,
                 methods=('GET', 'POST'),
                 defaults={'object_type': 'event'})

for object_type, prefixes in event_object_url_prefixes.items():
    for prefix in prefixes:
        _bp.add_url_rule(prefix + '/note/',
                         'view',
                         RHViewNote,
                         defaults={'object_type': object_type})
        _bp.add_url_rule(prefix + '/note/edit',
                         'edit',
                         RHEditNote,
                         methods=('GET', 'POST'),
                         defaults={'object_type': object_type})
        _bp.add_url_rule(prefix + '/note/delete',
                         'delete',
                         RHDeleteNote,
                         methods=('POST', ),
                         defaults={'object_type': object_type})
Beispiel #3
0
                         methods=('GET', 'POST'), defaults={'object_type': object_type})
        _bp.add_url_rule(prefix + '/attachments/create-folder', 'create_folder',
                         _dispatch(RHCreateEventFolder, RHCreateCategoryFolder),
                         methods=('GET', 'POST'), defaults={'object_type': object_type})
        _bp.add_url_rule(prefix + '/attachments/<int:folder_id>/', 'edit_folder',
                         _dispatch(RHEditEventFolder, RHEditCategoryFolder),
                         methods=('GET', 'POST'), defaults={'object_type': object_type})
        _bp.add_url_rule(prefix + '/attachments/<int:folder_id>/', 'delete_folder',
                         _dispatch(RHDeleteEventFolder, RHDeleteCategoryFolder),
                         methods=('DELETE',), defaults={'object_type': object_type})
        _bp.add_url_rule(prefix + '/attachments/<int:folder_id>/<int:attachment_id>/', 'delete_attachment',
                         _dispatch(RHDeleteEventAttachment, RHDeleteCategoryAttachment),
                         methods=('DELETE',), defaults={'object_type': object_type})

# Display/download
items = itertools.chain(event_object_url_prefixes.items(), [('category', [''])])
for object_type, prefixes in items:
    for prefix in prefixes:
        if object_type == 'category':
            prefix = '/category/<category_id>' + prefix
        else:
            prefix = '/event/<int:event_id>' + prefix
        _bp.add_url_rule(prefix + '/attachments/<int:folder_id>/<int:attachment_id>/<filename>', 'download',
                         _dispatch(RHDownloadEventAttachment, RHDownloadCategoryAttachment),
                         defaults={'object_type': object_type})

        # attachments folders cannot be consulted in categories
        if object_type != 'category':
            _bp.add_url_rule(prefix + '/attachments/<int:folder_id>/', 'list_folder',
                             RHListEventAttachmentFolder,
                             defaults={'object_type': object_type})