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
RevLine 
[12373]1## $Id: fileviewlets.py 12403 2015-01-05 15:34:09Z 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
51
[12384]52class JPGScanEditUpload(JPGScanManageUpload):
[12355]53    """Scan upload viewlet for customer.
54    """
55    grok.view(DocumentEditFormPage)
56    grok.require('waeup.handleCustomer')
57
58
[12384]59class JPGScanDisplay(FileDisplay):
[12355]60    """Scan display viewlet.
61    """
62    grok.order(1)
[12384]63    grok.context(PCNCustomerJPGDocument)
[12355]64    grok.require('waeup.viewCustomer')
65    grok.view(DocumentDisplayFormPage)
66    label = _(u'Sample Scan')
67    title = _(u'Sample Scan')
[12384]68    download_name = u'scan.jpg'
[12355]69
70
[12384]71class JPGScanImage(Image):
[12355]72    """Scan document.
73    """
[12384]74    grok.name('scan.jpg')
75    grok.context(PCNCustomerJPGDocument)
[12355]76    grok.require('waeup.viewCustomer')
[12384]77    download_name = u'scan.jpg'
[12355]78
[12384]79class JPGScanPDFSlip(JPGScanDisplay):
[12355]80    grok.view(PDFDocumentSlipPage)
81
82
83class PDFScanManageUpload(FileUpload):
84    """Scan upload viewlet for officers.
85    """
86    grok.view(DocumentManageFormPage)
[12384]87    grok.context(PCNCustomerPDFDocument)
[12355]88    grok.require('waeup.manageCustomer')
89    label = _(u'PDF File')
90    title = _(u'PDF File')
[12403]91    mus = 1024 * 1000
[12384]92    download_name = u'scan.pdf'
[12355]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)
[12384]107    grok.context(PCNCustomerPDFDocument)
[12355]108    grok.require('waeup.viewCustomer')
109    grok.view(DocumentDisplayFormPage)
110    label = _(u'PDF Scan')
111    title = _(u'PDF Scan')
[12384]112    download_name = u'scan.pdf'
[12355]113
114
115class PDFScanImage(Image):
116    """Scan document.
117    """
[12384]118    grok.name('scan.pdf')
119    grok.context(PCNCustomerPDFDocument)
[12355]120    grok.require('waeup.viewCustomer')
[12384]121    download_name = u'scan.pdf'
[12355]122
123class PDFScanSlip(PDFScanDisplay):
124    grok.view(PDFDocumentSlipPage)
Note: See TracBrowser for help on using the repository browser.