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

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

Increase size of upload files.

  • Property svn:keywords set to Id
File size: 3.4 KB
Line 
1## $Id: fileviewlets.py 12403 2015-01-05 15:34:09Z 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 ikobacustom.pcn.customers.documents import (
26    PCNCustomerJPGDocument, PCNCustomerPDFDocument)
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
38class JPGScanManageUpload(FileUpload):
39    """Scan upload viewlet for officers.
40    """
41    grok.order(1)
42    grok.context(PCNCustomerJPGDocument)
43    grok.view(DocumentManageFormPage)
44    grok.require('waeup.manageCustomer')
45    label = _(u'Sample Scan')
46    title = _(u'Sample Scan')
47    mus = 1024 * 200
48    download_name = u'scan.jpg'
49    tab_redirect = '#tab2'
50
51
52class JPGScanEditUpload(JPGScanManageUpload):
53    """Scan upload viewlet for customer.
54    """
55    grok.view(DocumentEditFormPage)
56    grok.require('waeup.handleCustomer')
57
58
59class JPGScanDisplay(FileDisplay):
60    """Scan display viewlet.
61    """
62    grok.order(1)
63    grok.context(PCNCustomerJPGDocument)
64    grok.require('waeup.viewCustomer')
65    grok.view(DocumentDisplayFormPage)
66    label = _(u'Sample Scan')
67    title = _(u'Sample Scan')
68    download_name = u'scan.jpg'
69
70
71class JPGScanImage(Image):
72    """Scan document.
73    """
74    grok.name('scan.jpg')
75    grok.context(PCNCustomerJPGDocument)
76    grok.require('waeup.viewCustomer')
77    download_name = u'scan.jpg'
78
79class JPGScanPDFSlip(JPGScanDisplay):
80    grok.view(PDFDocumentSlipPage)
81
82
83class PDFScanManageUpload(FileUpload):
84    """Scan upload viewlet for officers.
85    """
86    grok.view(DocumentManageFormPage)
87    grok.context(PCNCustomerPDFDocument)
88    grok.require('waeup.manageCustomer')
89    label = _(u'PDF File')
90    title = _(u'PDF File')
91    mus = 1024 * 1000
92    download_name = u'scan.pdf'
93    tab_redirect = '#tab2'
94
95
96class PDFScanEditUpload(PDFScanManageUpload):
97    """Scan upload viewlet for customer.
98    """
99    grok.view(DocumentEditFormPage)
100    grok.require('waeup.handleCustomer')
101
102
103class PDFScanDisplay(FileDisplay):
104    """Scan display viewlet.
105    """
106    grok.order(1)
107    grok.context(PCNCustomerPDFDocument)
108    grok.require('waeup.viewCustomer')
109    grok.view(DocumentDisplayFormPage)
110    label = _(u'PDF Scan')
111    title = _(u'PDF Scan')
112    download_name = u'scan.pdf'
113
114
115class PDFScanImage(Image):
116    """Scan document.
117    """
118    grok.name('scan.pdf')
119    grok.context(PCNCustomerPDFDocument)
120    grok.require('waeup.viewCustomer')
121    download_name = u'scan.pdf'
122
123class PDFScanSlip(PDFScanDisplay):
124    grok.view(PDFDocumentSlipPage)
Note: See TracBrowser for help on using the repository browser.