source: publico/PortalInterlegis/produtos/il.portal.theme/trunk/il/portal/theme/browser/tile.py @ 6104

Última Alteração nesse arquivo desde 6104 foi 6104, incluída por davilima6, 8 anos atrás

pep8

File size: 2.0 KB
Linha 
1# -*- coding: utf-8 -*-
2from zope.interface import Interface
3from zope.schema import Text, Choice, List
4from z3c.form import form, field
5
6from plone.z3cform import layout
7from plone import tiles
8
9from z3c.relationfield.schema import RelationChoice
10from z3c.relationfield.schema import RelationList
11
12from plone.app.textfield import RichText
13from plone.app.textfield.interfaces import ITransformer
14
15from plone.formwidget.autocomplete.widget import AutocompleteMultiFieldWidget
16from plone.formwidget.contenttree import ContentTreeFieldWidget, ObjPathSourceBinder
17from plone.formwidget.contenttree import PathSourceBinder
18
19
20class IRichTextTileData(Interface):
21    text = RichText(title=u'Text')
22
23
24class RichTextTile(tiles.PersistentTile):
25
26    def __call__(self):
27        text = ''
28        if self.data['text']:
29            transformer = ITransformer(self.context, None)
30            if transformer is not None:
31                text = transformer(self.data['text'], 'text/x-html-safe')
32        return '<html><body>%s</body></html>' % text
33
34
35class IPlainTextTileData(Interface):
36
37    text = Text(title=u"Text")
38
39
40class PlainTextTile(tiles.PersistentTile):
41
42    def __call__(self):
43        text = ''
44        if self.data['text']:
45            text = self.data['text']
46        return '<html><body>%s</body></html>' % text
47
48
49class IRelatedItensTileData(Interface):
50
51    related_itens = RelationChoice(title=u"Escolha o item relacionado",
52                       required=False,
53                       source=ObjPathSourceBinder())
54
55    #import pdb;pdb.set_trace()
56
57
58class RelatedForm(form.EditForm):
59    fields = field.Fields(IRelatedItensTileData)
60    fields['related_itens'].widgetFactory = ContentTreeFieldWidget
61
62RelatedView = layout.wrap_form(RelatedForm)
63
64
65class RelatedItensTile(tiles.PersistentTile):
66
67    def __call__(self):
68        relateditens = ''
69        if self.data['related_itens']:
70            relateditens = self.data['related_itens']
71        return '<html><body>%s</body></html>' % relateditens
Note: Veja TracBrowser para ajuda no uso do navegador do trac.
 

The contents and data of this website are published under license:
Creative Commons 4.0 Brasil - Atribuir Fonte - Compartilhar Igual.