Exemplo n.º 1
0
class AttachmentPlugin(BasePlugin):

    slug = settings.SLUG
    urlpatterns = {
        'article': [url('', include('wiki.plugins.attachments.urls'))]
    }

    article_tab = (_('Attachments'), "fa fa-file")
    article_view = views.AttachmentView().dispatch

    # List of notifications to construct signal handlers for. This
    # is handled inside the notifications plugin.
    notifications = [{
        'model': models.AttachmentRevision,
        'message': lambda obj: (
            _("A file was changed: %s")
            if not obj.deleted
            else
            _("A file was deleted: %s")
        ) % truncate_title(obj.get_filename()),
        'key': ARTICLE_EDIT,
        'created': True,
        'get_article': lambda obj: obj.attachment.article}
    ]

    markdown_extensions = [AttachmentExtension()]

    def __init__(self):
        # print "I WAS LOADED!"
        pass
Exemplo n.º 2
0
class AttachmentPlugin(BasePlugin):

    slug = settings.SLUG
    urlpatterns = {
        "article": [re_path("", include("wiki.plugins.attachments.urls"))]
    }

    article_tab = (_("Attachments"), "fa fa-file")
    article_view = views.AttachmentView().dispatch

    # List of notifications to construct signal handlers for. This
    # is handled inside the notifications plugin.
    notifications = [{
        "model":
        models.AttachmentRevision,
        "message":
        lambda obj: (_("A file was changed: %s") if not obj.deleted else _(
            "A file was deleted: %s")) % truncate_title(obj.get_filename()),
        "key":
        ARTICLE_EDIT,
        "created":
        True,
        "get_article":
        lambda obj: obj.attachment.article,
    }]

    markdown_extensions = [AttachmentExtension()]
Exemplo n.º 3
0
class ImagePlugin(BasePlugin):

    slug = settings.SLUG
    sidebar = {
        'headline': _('Images'),
        'icon_class': 'fa-picture-o',
        'template': 'wiki/plugins/images/sidebar.html',
        'form_class': forms.SidebarForm,
        'get_form_kwargs': (lambda a: {'instance': models.Image(article=a)})
    }

    # List of notifications to construct signal handlers for. This
    # is handled inside the notifications plugin.
    notifications = [
        {'model': models.ImageRevision,
         'message': lambda obj: _("An image was added: %s") % truncate_title(obj.get_filename()),
         'key': ARTICLE_EDIT,
         'created': False,
         # Ignore if there is a previous revision... the image isn't new
         'ignore': lambda revision: bool(revision.previous_revision),
         'get_article': lambda obj: obj.article}
    ]

    class RenderMedia:
        js = [
            'wiki/colorbox/jquery.colorbox-min.js',
            'wiki/js/images.js',
        ]

        css = {
            'screen': 'wiki/colorbox/example1/colorbox.css'
        }

    urlpatterns = {'article': [
        url('^$',
            views.ImageView.as_view(),
            name='images_index'),
        url('^delete/(?P<image_id>\d+)/$',
            views.DeleteView.as_view(),
            name='images_delete'),
        url('^restore/(?P<image_id>\d+)/$',
            views.DeleteView.as_view(),
            name='images_restore',
            kwargs={'restore': True}),
        url('^purge/(?P<image_id>\d+)/$',
            views.PurgeView.as_view(),
            name='images_purge'),
        url('^(?P<image_id>\d+)/revision/change/(?P<rev_id>\d+)/$',
            views.RevisionChangeView.as_view(),
            name='images_set_revision'),
        url('^(?P<image_id>\d+)/revision/add/$',
            views.RevisionAddView.as_view(),
            name='images_add_revision'),
    ]}

    markdown_extensions = [ImageExtension()]

    def __init__(self):
        # print "I WAS LOADED!"
        pass
Exemplo n.º 4
0
class AttachmentPlugin(BasePlugin):

    #settings_form = 'wiki.plugins.notifications.forms.SubscriptionForm'

    slug = settings.SLUG
    urlpatterns = patterns(
        '',
        url(r'^$', views.AttachmentView.as_view(), name='attachments_index'),
        url(r'^search/$',
            views.AttachmentSearchView.as_view(),
            name='attachments_search'),
        url(r'^add/(?P<attachment_id>\d+)/$',
            views.AttachmentAddView.as_view(),
            name='attachments_add'),
        url(r'^replace/(?P<attachment_id>\d+)/$',
            views.AttachmentReplaceView.as_view(),
            name='attachments_replace'),
        url(r'^history/(?P<attachment_id>\d+)/$',
            views.AttachmentHistoryView.as_view(),
            name='attachments_history'),
        url(r'^download/(?P<attachment_id>\d+)/$',
            views.AttachmentDownloadView.as_view(),
            name='attachments_download'),
        url(r'^delete/(?P<attachment_id>\d+)/$',
            views.AttachmentDeleteView.as_view(),
            name='attachments_delete'),
        url(r'^download/(?P<attachment_id>\d+)/revision/(?P<revision_id>\d+)/$',
            views.AttachmentDownloadView.as_view(),
            name='attachments_download'),
        url(r'^change/(?P<attachment_id>\d+)/revision/(?P<revision_id>\d+)/$',
            views.AttachmentChangeRevisionView.as_view(),
            name='attachments_revision_change'),
    )

    article_tab = (_(u'Attachments'), "icon-file")
    article_view = views.AttachmentView().dispatch

    # List of notifications to construct signal handlers for. This
    # is handled inside the notifications plugin.
    notifications = [{
        'model':
        models.AttachmentRevision,
        'message':
        lambda obj: (_(u"A file was changed: %s") if not obj.deleted else _(
            u"A file was deleted: %s")) % truncate_title(obj.get_filename()),
        'key':
        ARTICLE_EDIT,
        'created':
        True,
        'get_article':
        lambda obj: obj.attachment.article
    }]

    markdown_extensions = [AttachmentExtension()]

    def __init__(self):
        #print "I WAS LOADED!"
        pass
Exemplo n.º 5
0
class ImagePlugin(BasePlugin):

    slug = settings.SLUG
    sidebar = {
        "headline": _("Images"),
        "icon_class": "fa-image",
        "template": "wiki/plugins/images/sidebar.html",
        "form_class": forms.SidebarForm,
        "get_form_kwargs": (lambda a: {
            "instance": models.Image(article=a)
        }),
    }

    # List of notifications to construct signal handlers for. This
    # is handled inside the notifications plugin.
    notifications = [{
        "model":
        models.ImageRevision,
        "message":
        lambda obj: _("An image was added: %s") % truncate_title(
            obj.get_filename()),
        "key":
        ARTICLE_EDIT,
        "created":
        False,
        # Ignore if there is a previous revision... the image isn't new
        "ignore":
        lambda revision: bool(revision.previous_revision),
        "get_article":
        lambda obj: obj.article,
    }]

    class RenderMedia:
        js = [
            "wiki/colorbox/jquery.colorbox-min.js",
            "wiki/js/images.js",
        ]

        css = {"screen": "wiki/colorbox/example1/colorbox.css"}

    urlpatterns = {
        "article": [
            re_path("^$", views.ImageView.as_view(), name="images_index"),
            re_path(
                "^delete/(?P<image_id>[0-9]+)/$",
                views.DeleteView.as_view(),
                name="images_delete",
            ),
            re_path(
                "^restore/(?P<image_id>[0-9]+)/$",
                views.DeleteView.as_view(),
                name="images_restore",
                kwargs={"restore": True},
            ),
            re_path(
                "^purge/(?P<image_id>[0-9]+)/$",
                views.PurgeView.as_view(),
                name="images_purge",
            ),
            re_path(
                "^(?P<image_id>[0-9]+)/revision/change/(?P<rev_id>[0-9]+)/$",
                views.RevisionChangeView.as_view(),
                name="images_set_revision",
            ),
            re_path(
                "^(?P<image_id>[0-9]+)/revision/add/$",
                views.RevisionAddView.as_view(),
                name="images_add_revision",
            ),
        ]
    }

    markdown_extensions = [ImageExtension()]