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

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

Forbid style and script elements in html fields.

See r13235.

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