class AddForm(base.NullAddForm): form_fields = form.Fields(IFaleConoscoPortlet) label = _(u"Adicionar o portlet do Fale Conosco") description = _(u"") def create(self): return Assignment()
def render(self, **kwargs): self.update() hash = self.request.get('h', None) self.portal = api.portal.get() try: fale = self.portal['fale-conosco'] except KeyError: fale = create_folder_fale(self.portal) annotation = IAnnotations(self.portal) self.fale = annotation[KEY_CONFIRMA] dados = [m for m in self.fale if hash == m['hash']] if dados: conteudo = dados[0]['conteudo'] nome = conteudo['nome'] email = conteudo['email'] assunto = conteudo['assunto'] mensagem = conteudo['mensagem'] responsavel = conteudo['responsavel'] id = idnormalizer.normalize(nome) + '-' + str(datetime.now().microsecond) # tool para criacao do conteudo pt = getToolByName(self.context, 'portal_types') type_info = pt.getTypeInfo('FaleConosco') fconosco = type_info._constructInstance(fale, id) fconosco.setTitle(nome) fconosco.setNome(nome) fconosco.setEmail(email) fconosco.setAssunto(assunto) fconosco.setMensagem(mensagem) fconosco.setResponsavel(responsavel) fconosco.reindexObject() self.fale.remove(dados[0]) annotation[KEY_CONFIRMA] = self.fale IStatusMessage(self.request).addStatusMessage( _(u"Sua confirmação foi realizada com sucesso!"), type='info') else: IStatusMessage(self.request).addStatusMessage( _(u"Não existe nenhuma mensagem para ser confirmada"), type='error') return self.request.response.redirect(self.portal.absolute_url())
from mpdg.govbr.faleconosco.config import PROJECTNAME from mpdg.govbr.faleconosco.interfaces import IMensagem from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from Products.ATContentTypes.content.base import ATContentTypeSchema from Products.ATContentTypes.content.base import ATCTContent from zope.interface import implements MensagemSchema = ATContentTypeSchema.copy() + atapi.Schema(( atapi.StringField( name='nome', required=True, widget=atapi.StringWidget( label=_(u'Nome'), description=_(u'') ), ), atapi.StringField( name='assunto', required=True, widget=atapi.StringWidget( label=_(u'Assunto'), description=_(u'') ), ), atapi.StringField( name='email',
from Products.ATContentTypes.content.base import ATContentTypeSchema, ATCTContent from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from mpdg.govbr.faleconosco.interfaces import IMensagem from mpdg.govbr.faleconosco.config import PROJECTNAME from mpdg.govbr.faleconosco import MessageFactory as _ MensagemSchema = ATContentTypeSchema.copy() + atapi.Schema(( atapi.StringField( name='nome', required=True, widget=atapi.StringWidget( label=_(u"Nome"), description=_(u"") ), ), atapi.StringField( name='assunto', required=True, widget=atapi.StringWidget( label=_(u"Assunto"), description=_(u"") ), ), atapi.StringField( name='email',
from DateTime.DateTime import DateTime from mpdg.govbr.faleconosco import MessageFactory as _ from mpdg.govbr.faleconosco.config import PROJECTNAME from mpdg.govbr.faleconosco.interfaces import IHistorico from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from Products.ATContentTypes.content.base import ATContentTypeSchema from Products.ATContentTypes.content.base import ATCTContent from zope.interface import implements HistoricoSchema = ATContentTypeSchema.copy() + atapi.Schema(( atapi.StringField( name='nome', required=True, widget=atapi.StringWidget(label=_(u'Nome:'), description=_(u'')), ), atapi.TextField( name='observacao', required=True, storage=atapi.AnnotationStorage(migrate=True), widget=atapi.TextAreaWidget( label=_(u'Observação:'), description=_(u''), rows=5, ), ), atapi.StringField( name='estado', required=True, # default=False,
from Products.ATContentTypes.content.base import ATContentTypeSchema, ATCTContent from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from mpdg.govbr.faleconosco.interfaces import IHistorico from DateTime.DateTime import DateTime from mpdg.govbr.faleconosco.config import PROJECTNAME from mpdg.govbr.faleconosco import MessageFactory as _ HistoricoSchema = ATContentTypeSchema.copy() + atapi.Schema(( atapi.StringField( name='nome', required=True, widget=atapi.StringWidget(label=_(u"Nome:"), description=_(u"")), ), atapi.TextField( name='observacao', required=True, storage=atapi.AnnotationStorage(migrate=True), widget=atapi.TextAreaWidget( label=_(u"Observação:"), description=_(u""), rows=5, ), ), atapi.StringField( name='estado', required=True, # default=False,
# -*- coding: utf-8 -*- from mpdg.govbr.faleconosco import MessageFactory as _ from mpdg.govbr.faleconosco.config import PROJECTNAME from mpdg.govbr.faleconosco.interfaces import IFaleConosco from plone.app.folder.folder import ATFolder from plone.app.folder.folder import ATFolderSchema from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from zope.interface import implements FaleConoscoSchema = ATFolderSchema.copy() + atapi.Schema(( atapi.StringField( name='nome', required=True, widget=atapi.StringWidget(label=_(u'Nome'), description=_(u'')), ), atapi.StringField( name='assunto', required=True, widget=atapi.StringWidget(label=_(u'Assunto'), description=_(u'')), ), atapi.StringField( name='email', required=True, widget=atapi.StringWidget(label=_(u'E-mail'), description=_(u'')), ), atapi.StringField( name='responsavel', required=False, searchable=True, widget=atapi.StringWidget(label=_(u'Responsavel'), description=_(u'')),