source: main/waeup.ikoba/trunk/src/waeup/ikoba/documents/interfaces.py @ 13264

Last change on this file since 13264 was 13135, checked in by Henrik Bettermann, 9 years ago

Extend interfaces (for future documentation).

  • Property svn:keywords set to Id
File size: 3.6 KB
Line 
1## $Id: interfaces.py 13135 2015-07-03 10:24:13Z 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##
18from zope.interface import Attribute, Interface
19from zope import schema
20from waeup.ikoba.interfaces import (
21    IIkobaObject, validate_id,
22    ContextualDictSourceFactoryBase)
23from waeup.ikoba.interfaces import MessageFactory as _
24
25
26class IDocumentsContainer(IIkobaObject):
27    """A container for all kind of document objects.
28    """
29
30    def addDocument(document):
31        """Add a document.
32        """
33
34
35class IDocument(IIkobaObject):
36    """A base representation of documents.
37    """
38    history = Attribute('Object history, a list of messages')
39    state = Attribute('Workflow state of a document')
40    translated_state = Attribute('Translatable workflow state of a document')
41    class_name = Attribute('Name of the document class')
42    translated_class_name = Attribute('Translatable class name of a document')
43    formatted_transition_date = Attribute(
44        'Last transition formatted date string')
45    form_fields_interface = Attribute(
46        'Interface which is used in forms for grok.AutoFields')
47    local_roles = Attribute('List of local role names')
48    user_id = Attribute('Id of a user')
49    connected_files = Attribute('Names of files connected to a document')
50    is_verifiable = Attribute('True if contract verifiable by officer')
51
52    document_id = schema.TextLine(
53        title = _(u'Document Id'),
54        required = True,
55        constraint=validate_id,
56        )
57
58    title = schema.TextLine(
59        title = _(u'Document Title'),
60        required = True,
61        )
62
63    def setMD5():
64        """Determine md5 checksum of selected files and store checksums as
65        document attributes.
66        """
67
68class IPublicDocument(IDocument):
69    """A base representation of public documents.
70    """
71
72    def writeLogMessage(view, message):
73        """Write a view specific log message into main.log.
74
75        """
76
77    description = schema.Text(
78        title = _(u'Description'),
79        required = False,
80        )
81
82
83class IPDFDocument(IPublicDocument):
84    """A base representation of PDF documents.
85    """
86
87    filenames = Attribute('Tuple of filenames; only one filename recommended')
88
89class IHTMLDocument(IPublicDocument):
90    """A base representation of HTML documents.
91
92    """
93
94    html_dict = Attribute(
95        'Content as language dictionary with values in HTML format')
96
97    html_multilingual = schema.Text(
98        title = _(u'Multilingual content in HTML format'),
99        required = False,
100        )
101
102class IRESTDocument(IPublicDocument):
103    """A base representation of REST documents.
104    """
105
106    html_dict = Attribute(
107        'Content as language dictionary with values in HTML format')
108
109    rest_multilingual = schema.Text(
110        title = _(u'Multilingual content in REST (reStructuredText) format'),
111        required = False,
112        )
113
114
115class IDocumentsUtils(Interface):
116    """A collection of methods which are subject to customization.
117    """
118
Note: See TracBrowser for help on using the repository browser.