[12372] | 1 | ## $Id: fileviewlets.py 12405 2015-01-05 16:29:07Z 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 | |
---|
| 19 | import grok |
---|
| 20 | from waeup.ikoba.interfaces import MessageFactory as _ |
---|
| 21 | |
---|
| 22 | from waeup.ikoba.browser.fileviewlets import ( |
---|
| 23 | FileDisplay, FileUpload, Image) |
---|
| 24 | |
---|
| 25 | from ikobacustom.skeleton.customers.documents import SkeletonCustomerDocument |
---|
| 26 | |
---|
| 27 | from waeup.ikoba.customers.browser import ( |
---|
| 28 | DocumentDisplayFormPage, |
---|
| 29 | DocumentManageFormPage, |
---|
| 30 | DocumentEditFormPage, |
---|
| 31 | PDFDocumentSlipPage,) |
---|
| 32 | |
---|
| 33 | grok.templatedir('browser_templates') |
---|
| 34 | |
---|
| 35 | # File viewlets for customer documents |
---|
| 36 | |
---|
| 37 | class SampleScanManageUpload(FileUpload): |
---|
| 38 | """Scan upload viewlet for officers. |
---|
| 39 | """ |
---|
| 40 | grok.order(1) |
---|
| 41 | grok.context(SkeletonCustomerDocument) |
---|
| 42 | grok.view(DocumentManageFormPage) |
---|
| 43 | grok.require('waeup.manageCustomer') |
---|
| 44 | label = _(u'Sample Scan') |
---|
| 45 | title = _(u'Sample Scan') |
---|
[12405] | 46 | mus = 1024 * 200 |
---|
[12355] | 47 | download_name = u'sample' |
---|
| 48 | tab_redirect = '#tab2' |
---|
| 49 | |
---|
| 50 | |
---|
| 51 | class SampleScanEditUpload(SampleScanManageUpload): |
---|
| 52 | """Scan upload viewlet for customer. |
---|
| 53 | """ |
---|
| 54 | grok.view(DocumentEditFormPage) |
---|
| 55 | grok.require('waeup.handleCustomer') |
---|
| 56 | |
---|
| 57 | |
---|
| 58 | class SampleScanDisplay(FileDisplay): |
---|
| 59 | """Scan display viewlet. |
---|
| 60 | """ |
---|
| 61 | grok.order(1) |
---|
| 62 | grok.context(SkeletonCustomerDocument) |
---|
| 63 | grok.require('waeup.viewCustomer') |
---|
| 64 | grok.view(DocumentDisplayFormPage) |
---|
| 65 | label = _(u'Sample Scan') |
---|
| 66 | title = _(u'Sample Scan') |
---|
| 67 | download_name = u'sample' |
---|
| 68 | |
---|
| 69 | |
---|
| 70 | class SampleScanImage(Image): |
---|
| 71 | """Scan document. |
---|
| 72 | """ |
---|
| 73 | grok.name('sample') |
---|
| 74 | grok.context(SkeletonCustomerDocument) |
---|
| 75 | grok.require('waeup.viewCustomer') |
---|
| 76 | download_name = u'sample' |
---|
| 77 | |
---|
| 78 | class SampleScanPDFSlip(SampleScanDisplay): |
---|
| 79 | grok.view(PDFDocumentSlipPage) |
---|
| 80 | |
---|