[12438] | 1 | ## $Id: interfaces.py 13167 2015-07-13 08:37:27Z henrik $ |
---|
[12437] | 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 | from zope.interface import Attribute, Interface |
---|
| 19 | from zope import schema |
---|
| 20 | from waeup.kofa.interfaces import ( |
---|
| 21 | IKofaObject, validate_id, |
---|
| 22 | ContextualDictSourceFactoryBase) |
---|
| 23 | from waeup.kofa.interfaces import MessageFactory as _ |
---|
| 24 | |
---|
| 25 | |
---|
| 26 | class IDocumentsContainer(IKofaObject): |
---|
| 27 | """A container for all kind of document objects. |
---|
| 28 | """ |
---|
| 29 | |
---|
| 30 | def addDocument(document): |
---|
| 31 | """Add a document. |
---|
| 32 | """ |
---|
| 33 | |
---|
| 34 | |
---|
| 35 | class IDocument(IKofaObject): |
---|
| 36 | """A base representation of documents. |
---|
| 37 | """ |
---|
| 38 | history = Attribute('Object history, a list of messages') |
---|
[13134] | 39 | state = Attribute('Workflow state of a document') |
---|
[12437] | 40 | class_name = Attribute('Name of the document class') |
---|
[13144] | 41 | local_roles = Attribute('List of local role names') |
---|
[13134] | 42 | translated_class_name = Attribute('Translatable class name of a document') |
---|
[13144] | 43 | translated_state = Attribute('Translatable workflow state of a document') |
---|
[13134] | 44 | formatted_transition_date = Attribute( |
---|
| 45 | 'Last transition formatted date string') |
---|
| 46 | form_fields_interface = Attribute( |
---|
| 47 | 'Interface which is used in forms for grok.AutoFields') |
---|
[12437] | 48 | |
---|
| 49 | document_id = schema.TextLine( |
---|
| 50 | title = _(u'Document Id'), |
---|
| 51 | required = True, |
---|
| 52 | constraint=validate_id, |
---|
| 53 | ) |
---|
| 54 | |
---|
| 55 | title = schema.TextLine( |
---|
| 56 | title = _(u'Document Title'), |
---|
| 57 | required = True, |
---|
| 58 | ) |
---|
| 59 | |
---|
| 60 | class IPublicDocument(IDocument): |
---|
| 61 | """A base representation of public documents. |
---|
| 62 | """ |
---|
| 63 | |
---|
| 64 | def writeLogMessage(view, message): |
---|
[13167] | 65 | """Add an INFO message to main.log. |
---|
[12437] | 66 | """ |
---|
| 67 | |
---|
| 68 | class IPDFDocument(IPublicDocument): |
---|
| 69 | """A base representation of PDF documents. |
---|
| 70 | """ |
---|
| 71 | |
---|
[13134] | 72 | filenames = Attribute('Tuple of filenames; only one filename recommended') |
---|
[12437] | 73 | |
---|
| 74 | class IHTMLDocument(IPublicDocument): |
---|
| 75 | """A base representation of HTML documents. |
---|
| 76 | """ |
---|
| 77 | |
---|
[13134] | 78 | html_dict = Attribute( |
---|
| 79 | 'Content as language dictionary with values in HTML format') |
---|
[12437] | 80 | |
---|
| 81 | html_multilingual = schema.Text( |
---|
| 82 | title = _(u'Multilingual content in HTML format'), |
---|
| 83 | required = False, |
---|
| 84 | ) |
---|
| 85 | |
---|
| 86 | class IRESTDocument(IPublicDocument): |
---|
| 87 | """A base representation of REST documents. |
---|
| 88 | """ |
---|
| 89 | |
---|
| 90 | html_dict = Attribute( |
---|
| 91 | 'Content as language dictionary with values in HTML format') |
---|
| 92 | |
---|
| 93 | rest_multilingual = schema.Text( |
---|
| 94 | title = _(u'Multilingual content in REST (reStructuredText) format'), |
---|
| 95 | required = False, |
---|
| 96 | ) |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | class IDocumentsUtils(Interface): |
---|
| 100 | """A collection of methods which are subject to customization. |
---|
| 101 | """ |
---|
| 102 | |
---|