Add "material package" to the attachment module
[cds-indico.git] / indico / modules / attachments / views.py
blobca183662203cbc7b6428d4ad8991fc426aeb2f70
1 # This file is part of Indico.
2 # Copyright (C) 2002 - 2015 European Organization for Nuclear Research (CERN).
4 # Indico is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License as
6 # published by the Free Software Foundation; either version 3 of the
7 # License, or (at your option) any later version.
9 # Indico is distributed in the hope that it will be useful, but
10 # WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 # General Public License for more details.
14 # You should have received a copy of the GNU General Public License
15 # along with Indico; if not, see <http://www.gnu.org/licenses/>.
17 from __future__ import unicode_literals
19 from MaKaC.webinterface.meeting import WPMeetingDisplay
20 from MaKaC.webinterface.pages.base import WPJinjaMixin
21 from MaKaC.webinterface.pages.category import WPCategoryModifBase
22 from MaKaC.webinterface.pages.conferences import (WPConferenceModifBase, WPConfModifToolsBase,
23 WPConferenceDefaultDisplayBase)
24 from MaKaC.webinterface.pages.sessions import WPSessionModifBase
25 from MaKaC.webinterface.pages.contributions import WPContributionModifBase
26 from MaKaC.webinterface.pages.subContributions import WPSubContributionModifBase
29 class AttachmentsMixin(WPJinjaMixin):
30 template_prefix = 'attachments/'
31 base_wp = None
33 def _getPageContent(self, params):
34 return WPJinjaMixin._getPageContent(self, params)
37 class EventObjectAttachmentsMixin(AttachmentsMixin):
38 def _getPageContent(self, params):
39 return self.base_wp._getPageContent(self, params)
41 def _getTabContent(self, params):
42 return AttachmentsMixin._getPageContent(self, params)
44 def _setActiveTab(self):
45 self._tab_attachments.setActive()
48 class WPCategoryAttachments(AttachmentsMixin, WPCategoryModifBase):
49 base_wp = WPCategoryModifBase
51 def _setActiveSideMenuItem(self):
52 self.extra_menu_items['attachments'].setActive()
55 class WPEventAttachments(AttachmentsMixin, WPConferenceModifBase):
56 base_wp = WPConferenceModifBase
58 def _setActiveSideMenuItem(self):
59 self.extra_menu_items['attachments'].setActive()
62 class WPSessionAttachments(EventObjectAttachmentsMixin, WPSessionModifBase):
63 base_wp = WPSessionModifBase
66 class WPContributionAttachments(EventObjectAttachmentsMixin, WPContributionModifBase):
67 base_wp = WPContributionModifBase
70 class WPSubContributionAttachments(EventObjectAttachmentsMixin, WPSubContributionModifBase):
71 base_wp = WPSubContributionModifBase
74 class WPEventFolderDisplay(WPMeetingDisplay, WPJinjaMixin):
75 template_prefix = 'attachments/'
77 def _getBody(self, params):
78 return WPJinjaMixin._getPageContent(self, params)
81 class WPMaterialsPackage(WPConfModifToolsBase, WPJinjaMixin):
82 template_prefix = 'attachments/'
84 def _setActiveTab(self):
85 self._tabMatPackage.setActive()
87 def _getTabContent(self, params):
88 return WPJinjaMixin._getPageContent(self, params)
91 class WPEventMaterialsDownloadDisplay(WPConferenceDefaultDisplayBase, WPJinjaMixin):
92 template_prefix = 'attachments/'
94 def _getBody(self, params):
95 return WPJinjaMixin._getPageContent(self, params)
98 class WPSimpleMaterialsDownloadDisplay(WPMeetingDisplay, WPJinjaMixin):
99 template_prefix = 'attachments/'
101 def _getBody(self, params):
102 return WPJinjaMixin._getPageContent(self, params)