[12372] | 1 | ## $Id: fileviewlets.py 14310 2016-12-05 09:14:32Z 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 | |
---|
[14310] | 25 | from ikobacustom.aaue.customers.documents import AAUECustomerDocument |
---|
[12355] | 26 | |
---|
| 27 | from waeup.ikoba.customers.browser import ( |
---|
| 28 | DocumentDisplayFormPage, |
---|
| 29 | DocumentManageFormPage, |
---|
| 30 | DocumentEditFormPage, |
---|
[13067] | 31 | PDFDocumentSlip,) |
---|
[12355] | 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) |
---|
[14310] | 41 | grok.context(AAUECustomerDocument) |
---|
[12355] | 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' |
---|
[12459] | 48 | download_filename = download_name |
---|
[12355] | 49 | tab_redirect = '#tab2' |
---|
| 50 | |
---|
| 51 | |
---|
| 52 | class SampleScanEditUpload(SampleScanManageUpload): |
---|
| 53 | """Scan upload viewlet for customer. |
---|
| 54 | """ |
---|
| 55 | grok.view(DocumentEditFormPage) |
---|
| 56 | grok.require('waeup.handleCustomer') |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | class SampleScanDisplay(FileDisplay): |
---|
| 60 | """Scan display viewlet. |
---|
| 61 | """ |
---|
| 62 | grok.order(1) |
---|
[14310] | 63 | grok.context(AAUECustomerDocument) |
---|
[12355] | 64 | grok.require('waeup.viewCustomer') |
---|
| 65 | grok.view(DocumentDisplayFormPage) |
---|
| 66 | label = _(u'Sample Scan') |
---|
| 67 | title = _(u'Sample Scan') |
---|
| 68 | download_name = u'sample' |
---|
[12459] | 69 | download_filename = download_name |
---|
[12355] | 70 | |
---|
| 71 | |
---|
| 72 | class SampleScanImage(Image): |
---|
| 73 | """Scan document. |
---|
| 74 | """ |
---|
| 75 | grok.name('sample') |
---|
[14310] | 76 | grok.context(AAUECustomerDocument) |
---|
[12355] | 77 | grok.require('waeup.viewCustomer') |
---|
| 78 | download_name = u'sample' |
---|
[12459] | 79 | download_filename = download_name |
---|
[12355] | 80 | |
---|
[12459] | 81 | |
---|
[12355] | 82 | class SampleScanPDFSlip(SampleScanDisplay): |
---|
[13067] | 83 | grok.view(PDFDocumentSlip) |
---|
[12355] | 84 | |
---|