source: main/waeup.kofa/trunk/src/waeup/kofa/documents/viewlets.py @ 12891

Last change on this file since 12891 was 12438, checked in by Henrik Bettermann, 10 years ago

Propset svn:keywords "Id"

  • Property svn:keywords set to Id
File size: 2.8 KB
Line 
1## $Id: viewlets.py 12438 2015-01-11 08:27:37Z henrik $
2##
3## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
4## This program is free software; you can redistribute it and/or modify
5## it under the terms of the GNU General Public License as published by
6## the Free Software Foundation; either version 2 of the License, or
7## (at your option) any later version.
8##
9## This program is distributed in the hope that it will be useful,
10## but WITHOUT ANY WARRANTY; without even the implied warranty of
11## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12## GNU General Public License for more details.
13##
14## You should have received a copy of the GNU General Public License
15## along with this program; if not, write to the Free Software
16## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17##
18"""Viewlet components for documents offered for download by the company.
19"""
20
21import grok
22from waeup.kofa.browser.viewlets import (
23    PrimaryNavTab, ManageActionButton, AddActionButton)
24from waeup.kofa.interfaces import IKofaObject
25from waeup.kofa.interfaces import MessageFactory as _
26from waeup.kofa.browser.viewlets import PrimaryNavTab
27
28from waeup.kofa.documents.interfaces import (
29    IDocumentsContainer, IPublicDocument)
30from waeup.kofa.documents.browser import (
31    DocumentsContainerManageFormPage, DocumentsContainerPage,
32    DocumentManageFormPage, DocumentDisplayFormPage)
33
34
35grok.context(IKofaObject)  # Make IKofaObject the default context
36grok.templatedir('browser_templates')
37
38
39class DocumentsTab(PrimaryNavTab):
40    """Documents tab in primary navigation.
41    """
42
43    grok.context(IKofaObject)
44    grok.order(10)
45    grok.require('waeup.viewDocuments')
46    grok.name('documentstab')
47
48    pnav = 2
49    tab_title = _(u'Documents')
50
51    @property
52    def link_target(self):
53        return self.view.application_url('documents')
54
55class DocumentsContainerManageActionButton(ManageActionButton):
56    grok.order(1)
57    grok.context(IDocumentsContainer)
58    grok.view(DocumentsContainerPage)
59    grok.require('waeup.manageDocuments')
60    text = _('Manage')
61    target = 'manage'
62
63
64class DocumentViewActionButton(ManageActionButton):
65    grok.order(1)
66    grok.context(IPublicDocument)
67    grok.view(DocumentManageFormPage)
68    grok.require('waeup.manageDocuments')
69    text = _('View')
70    target = 'index'
71    icon = 'actionicon_view.png'
72
73
74class DocumentManageActionButton(ManageActionButton):
75    grok.order(1)
76    grok.context(IPublicDocument)
77    grok.view(DocumentDisplayFormPage)
78    grok.require('waeup.manageDocuments')
79    text = _('Manage')
80    target = 'manage'
81
82
83class DocumentTrigTransActionButton(ManageActionButton):
84    grok.order(2)
85    grok.context(IPublicDocument)
86    grok.view(DocumentDisplayFormPage)
87    grok.require('waeup.manageDocuments')
88    icon = 'actionicon_trigtrans.png'
89    text = _(u'Transition')
90    target = 'trigtrans'
91
92
Note: See TracBrowser for help on using the repository browser.