Ignorar:
Timestamp:
29/02/2012 15:05:13 (8 anos atrás)
Autor:
lucasaquino
Mensagem:

Registra tile related

Arquivo:
1 editado

Legenda:

Não Modificado
Adicionado
Removido
  • PortalInterlegis/produtos/il.portal.theme/trunk/il/portal/theme/browser/tile.py

    r6072 r6079  
    11from zope.interface import Interface
    2 
     2from z3c.form import form, field
     3from plone.z3cform import layout
    34from plone import tiles
    45from zope.schema import Text
     
    67from plone.app.textfield.interfaces import ITransformer
    78
     9from z3c.relationfield.schema import RelationChoice, RelationList
     10
     11from plone.formwidget.autocomplete.widget import (
     12    AutocompleteMultiFieldWidget,
     13    )
     14from plone.formwidget.contenttree import (
     15    ContentTreeFieldWidget,
     16    ObjPathSourceBinder,
     17    )
     18
    819
    920class IRichTextTileData(Interface):
    10 
     21   
    1122    text = RichText(title=u'Text')
    12 
    1323
    1424class RichTextTile(tiles.PersistentTile):
     
    2131                text = transformer(self.data['text'], 'text/x-html-safe')
    2232        return '<html><body>%s</body></html>' % text
    23        
    24        
     33
    2534class IPlainTextTileData(Interface):
    2635   
     
    3443            text = self.data['text']
    3544        return '<html><body>%s</body></html>' % text
     45
     46class IRelatedItensTileData(Interface):
     47   
     48    related_itens = RelationChoice(title=u"Escolha o item relacionado",
     49                       required=False,
     50                       source=ObjPathSourceBinder())
     51   
     52    #import pdb;pdb.set_trace()
     53   
     54class RelatedForm(form.EditForm):
     55    fields = field.Fields(IRelatedItensTileData)
     56    fields['related_itens'].widgetFactory = ContentTreeFieldWidget
     57   
     58RelatedView = layout.wrap_form(RelatedForm)
     59
     60class RelatedItensTile(tiles.PersistentTile):
     61
     62    def __call__(self):
     63        relateditens = ''
     64        if self.data['related_itens']:
     65            relateditens = self.data['related_itens']
     66        return '<html><body>%s</body></html>' % relateditens
     67   
Note: Veja TracChangeset para ajuda no uso do visualizador de conjunto de mudanças.
 

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