source: main/ikobacustom.pcn/trunk/src/ikobacustom/pcn/customers/fileviewlets.py @ 12529

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

Adjust to base package.

  • Property svn:keywords set to Id
File size: 4.0 KB
RevLine 
[12373]1## $Id: fileviewlets.py 12460 2015-01-13 08:18:16Z henrik $
[12355]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
[12384]25from ikobacustom.pcn.customers.documents import (
26    PCNCustomerJPGDocument, PCNCustomerPDFDocument)
[12355]27
28from waeup.ikoba.customers.browser import (
29    DocumentDisplayFormPage,
30    DocumentManageFormPage,
31    DocumentEditFormPage,
32    PDFDocumentSlipPage,)
33
34grok.templatedir('browser_templates')
35
36# File viewlets for customer documents
37
[12384]38class JPGScanManageUpload(FileUpload):
[12355]39    """Scan upload viewlet for officers.
40    """
41    grok.order(1)
[12384]42    grok.context(PCNCustomerJPGDocument)
[12355]43    grok.view(DocumentManageFormPage)
44    grok.require('waeup.manageCustomer')
45    label = _(u'Sample Scan')
46    title = _(u'Sample Scan')
[12403]47    mus = 1024 * 200
[12384]48    download_name = u'scan.jpg'
[12355]49    tab_redirect = '#tab2'
50
[12460]51    @property
52    def download_filename(self):
53        return u"%s.jpg" % self.context.document_id[:9]
[12355]54
[12460]55
[12384]56class JPGScanEditUpload(JPGScanManageUpload):
[12355]57    """Scan upload viewlet for customer.
58    """
59    grok.view(DocumentEditFormPage)
60    grok.require('waeup.handleCustomer')
61
62
[12384]63class JPGScanDisplay(FileDisplay):
[12355]64    """Scan display viewlet.
65    """
66    grok.order(1)
[12384]67    grok.context(PCNCustomerJPGDocument)
[12355]68    grok.require('waeup.viewCustomer')
69    grok.view(DocumentDisplayFormPage)
70    label = _(u'Sample Scan')
71    title = _(u'Sample Scan')
[12384]72    download_name = u'scan.jpg'
[12355]73
[12460]74    @property
75    def download_filename(self):
76        return u"%s.jpg" % self.context.document_id[:9]
[12355]77
[12460]78
[12384]79class JPGScanImage(Image):
[12355]80    """Scan document.
81    """
[12384]82    grok.name('scan.jpg')
83    grok.context(PCNCustomerJPGDocument)
[12355]84    grok.require('waeup.viewCustomer')
[12384]85    download_name = u'scan.jpg'
[12355]86
[12460]87    @property
88    def download_filename(self):
89        return u"%s.jpg" % self.context.document_id[:9]
90
[12384]91class JPGScanPDFSlip(JPGScanDisplay):
[12355]92    grok.view(PDFDocumentSlipPage)
93
94
95class PDFScanManageUpload(FileUpload):
96    """Scan upload viewlet for officers.
97    """
98    grok.view(DocumentManageFormPage)
[12384]99    grok.context(PCNCustomerPDFDocument)
[12355]100    grok.require('waeup.manageCustomer')
101    label = _(u'PDF File')
102    title = _(u'PDF File')
[12403]103    mus = 1024 * 1000
[12384]104    download_name = u'scan.pdf'
[12355]105    tab_redirect = '#tab2'
106
[12460]107    @property
108    def download_filename(self):
109        return u"%s.pdf" % self.context.document_id[:9]
[12355]110
[12460]111
[12355]112class PDFScanEditUpload(PDFScanManageUpload):
113    """Scan upload viewlet for customer.
114    """
115    grok.view(DocumentEditFormPage)
116    grok.require('waeup.handleCustomer')
117
118
119class PDFScanDisplay(FileDisplay):
120    """Scan display viewlet.
121    """
122    grok.order(1)
[12384]123    grok.context(PCNCustomerPDFDocument)
[12355]124    grok.require('waeup.viewCustomer')
125    grok.view(DocumentDisplayFormPage)
126    label = _(u'PDF Scan')
127    title = _(u'PDF Scan')
[12384]128    download_name = u'scan.pdf'
[12355]129
[12460]130    @property
131    def download_filename(self):
132        return u"%s.pdf" % self.context.document_id[:9]
[12355]133
[12460]134
[12355]135class PDFScanImage(Image):
136    """Scan document.
137    """
[12384]138    grok.name('scan.pdf')
139    grok.context(PCNCustomerPDFDocument)
[12355]140    grok.require('waeup.viewCustomer')
[12384]141    download_name = u'scan.pdf'
[12355]142
[12460]143    @property
144    def download_filename(self):
145        return u"%s" % self.context.document_id[:9]
146
[12355]147class PDFScanSlip(PDFScanDisplay):
148    grok.view(PDFDocumentSlipPage)
Note: See TracBrowser for help on using the repository browser.