source: main/waeup.kofa/branches/henrik-transcript-workflow/src/waeup/kofa/documents/interfaces.py @ 17397

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

Forbid style and script elements.

  • Property svn:keywords set to Id
File size: 3.2 KB
Line 
1## $Id: interfaces.py 13235 2015-08-28 07:49:07Z 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.kofa.interfaces import (
21    IKofaObject, validate_id, validate_html,
22    ContextualDictSourceFactoryBase)
23from waeup.kofa.interfaces import MessageFactory as _
24
25
26class IDocumentsContainer(IKofaObject):
27    """A container for all kind of document objects.
28    """
29
30    def addDocument(document):
31        """Add a document.
32        """
33
34
35class IDocument(IKofaObject):
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    class_name = Attribute('Name of the document class')
41    local_roles = Attribute('List of local role names')
42    translated_class_name = Attribute('Translatable class name of a document')
43    translated_state = Attribute('Translatable workflow state of a document')
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')
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
60class IPublicDocument(IDocument):
61    """A base representation of public documents.
62    """
63
64    def writeLogMessage(view, message):
65        """Add an INFO message to main.log.
66        """
67
68class IPDFDocument(IPublicDocument):
69    """A base representation of PDF documents.
70    """
71
72    filenames = Attribute('Tuple of filenames; only one filename recommended')
73
74class IHTMLDocument(IPublicDocument):
75    """A base representation of HTML documents.
76    """
77
78    html_dict = Attribute(
79        'Content as language dictionary with values in HTML format')
80
81    html_multilingual = schema.Text(
82        title = _(u'Multilingual content in HTML format'),
83        required = False,
84        constraint=validate_html,
85        )
86
87class IRESTDocument(IPublicDocument):
88    """A base representation of REST documents.
89    """
90
91    html_dict = Attribute(
92        'Content as language dictionary with values in HTML format')
93
94    rest_multilingual = schema.Text(
95        title = _(u'Multilingual content in REST (reStructuredText) format'),
96        required = False,
97        )
98
99
100class IDocumentsUtils(Interface):
101    """A collection of methods which are subject to customization.
102    """
103
Note: See TracBrowser for help on using the repository browser.