source: main/waeup.ikoba/trunk/src/waeup/ikoba/documents/fileviewlets.py @ 12227

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

Add file viewlets to documents.

  • Property svn:keywords set to Id
File size: 1.9 KB
RevLine 
[12225]1## $Id: fileviewlets.py 12225 2014-12-14 09:45:35Z 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
19import grok
20from waeup.ikoba.interfaces import MessageFactory as _
21
22from waeup.ikoba.browser.fileviewlets import (
23    FileDisplay, FileUpload, Image)
24
25from waeup.ikoba.documents.document import PDFDocument
26from waeup.ikoba.documents.browser import (
27    DocumentManageFormPage, DocumentDisplayFormPage)
28
29
30# File viewlets for documents
31
32class PDFScanManageUpload(FileUpload):
33    """Scan upload viewlet for officers.
34    """
35    grok.view(DocumentManageFormPage)
36    grok.context(PDFDocument)
37    grok.require('waeup.manageDocuments')
38    label = _(u'PDF File')
39    title = _(u'PDF File')
40    mus = 1024 * 200
41    download_name = u'sample.pdf'
42    tab_redirect = '#tab2'
43
44
45class PDFScanDisplay(FileDisplay):
46    """Scan display viewlet.
47    """
48    grok.order(1)
49    grok.context(PDFDocument)
50    grok.require('waeup.viewDocuments')
51    grok.view(DocumentDisplayFormPage)
52    label = _(u'PDF Scan')
53    title = _(u'PDF Scan')
54    download_name = u'sample.pdf'
55
56
57class PDFScanImage(Image):
58    """Scan document.
59    """
60    ##: Needs to be protected if not published
61    grok.name('sample.pdf')
62    grok.context(PDFDocument)
63    grok.require('waeup.Public')
64    download_name = u'sample.pdf'
65
Note: See TracBrowser for help on using the repository browser.