| 1 | # Copyright (c) 2010 by Yaco Sistemas |
|---|
| 2 | # |
|---|
| 3 | # This file is part of Merengue. |
|---|
| 4 | # |
|---|
| 5 | # Merengue is free software: you can redistribute it and/or modify |
|---|
| 6 | # it under the terms of the GNU Lesser General Public License as published by |
|---|
| 7 | # the Free Software Foundation, either version 3 of the License, or |
|---|
| 8 | # (at your option) any later version. |
|---|
| 9 | # |
|---|
| 10 | # Merengue is distributed in the hope that it will be useful, |
|---|
| 11 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | # GNU Lesser General Public License for more details. |
|---|
| 14 | # |
|---|
| 15 | # You should have received a copy of the GNU Lesser General Public License |
|---|
| 16 | # along with Merengue. If not, see <http://www.gnu.org/licenses/>. |
|---|
| 17 | |
|---|
| 18 | from django.conf import settings |
|---|
| 19 | from django.core.urlresolvers import reverse |
|---|
| 20 | from django.utils.translation import ugettext_lazy as _ |
|---|
| 21 | |
|---|
| 22 | from merengue.pluggable import Plugin |
|---|
| 23 | from merengue.registry import params |
|---|
| 24 | from merengue.multimedia.admin import PhotoAdmin, VideoAdmin, AudioAdmin |
|---|
| 25 | from merengue.multimedia.models import Photo, Video, Audio |
|---|
| 26 | from merengue.section.admin import DocumentRelatedModelAdmin, DocumentAdmin |
|---|
| 27 | from merengue.section.models import Document |
|---|
| 28 | |
|---|
| 29 | from plugins.core.actions import AdminAction, LoginAction, LogoutAction, PrintAction, HotLinkAction |
|---|
| 30 | from plugins.core.blocks import (CoreMenuBlock, NavigationBlock, |
|---|
| 31 | PortalMenuBlock, ContactInfoBlock, |
|---|
| 32 | AnnouncementsBlock, PortalLinksBlock) |
|---|
| 33 | from plugins.core.panels import (InplaceEditPanel, InlineTransPanel, VersionPanel, |
|---|
| 34 | InvalidateCachePanel, AddBlockPanel) |
|---|
| 35 | |
|---|
| 36 | |
|---|
| 37 | class PluginConfig(Plugin): |
|---|
| 38 | name = 'Core' |
|---|
| 39 | description = 'Core plugin' |
|---|
| 40 | version = '0.0.1a' |
|---|
| 41 | |
|---|
| 42 | url_prefixes = ( |
|---|
| 43 | ('core', 'plugins.core.urls'), |
|---|
| 44 | ) |
|---|
| 45 | |
|---|
| 46 | config_params = [ |
|---|
| 47 | params.Content(name='home_initial_content', |
|---|
| 48 | label=_('home initial content'), default=1), |
|---|
| 49 | params.Single(name='login_url', |
|---|
| 50 | label=_('Login URL'), default=settings.LOGIN_URL)] |
|---|
| 51 | |
|---|
| 52 | def get_actions(self): |
|---|
| 53 | return [AdminAction, LoginAction, LogoutAction, PrintAction, HotLinkAction] |
|---|
| 54 | |
|---|
| 55 | def get_blocks(self): |
|---|
| 56 | return [CoreMenuBlock, NavigationBlock, PortalMenuBlock, |
|---|
| 57 | ContactInfoBlock, AnnouncementsBlock, PortalLinksBlock] |
|---|
| 58 | |
|---|
| 59 | def get_toolbar_panels(self): |
|---|
| 60 | return [InplaceEditPanel, InlineTransPanel, AddBlockPanel, |
|---|
| 61 | InvalidateCachePanel, VersionPanel, ] |
|---|
| 62 | |
|---|
| 63 | def models(self): |
|---|
| 64 | return [ |
|---|
| 65 | (Document, DocumentAdmin), |
|---|
| 66 | (Photo, PhotoAdmin), |
|---|
| 67 | (Video, VideoAdmin), |
|---|
| 68 | (Audio, AudioAdmin), |
|---|
| 69 | ] |
|---|
| 70 | |
|---|
| 71 | def section_models(self): |
|---|
| 72 | return [(Document, DocumentRelatedModelAdmin)] |
|---|
| 73 | |
|---|
| 74 | def get_perms(self): |
|---|
| 75 | return () |
|---|
| 76 | |
|---|
| 77 | def get_section_prefixes(self): |
|---|
| 78 | return (reverse('section_index'), ) |
|---|