def test_checkinObjectLinkedInParentsRichTextField(self): """Checnking-in an object that is linked in it's parent's rich text field. See: https://dev.plone.org/ticket/13462 """ # register a folderish content type with a rich text field from plone.app.folder.folder import ATFolder, ATFolderSchema from Products.ATContentTypes.content.base import registerATCT from Products.Archetypes import atapi rich_text_folder_type = type('RichFolder', (ATFolder,), {}) rich_text_folder_type.schema = ATFolderSchema.copy() + atapi.Schema(( atapi.TextField('text', default_output_type = 'text/x-html-safe', widget = atapi.RichWidget(), ), ), ) registerATCT(rich_text_folder_type, 'plone.app.iterate') # create a folderish object with a rich text field self.portal.invokeFactory('Folder', 'rich_text_folder') rich_text_folder = self.portal.rich_text_folder # create the subobject rich_text_folder.invokeFactory('Document', 'subobject') subobject = rich_text_folder.subobject subobject_uid = subobject.UID() # link (by uid) the subobject in it's parent's rich text field link_html = '<a class="internal-link" href="resolveuid/%s">Link to subobject</a>' rich_text_folder.setText(link_html % subobject_uid) # try to checkout and checkin the subobject wc = ICheckinCheckoutPolicy(subobject).checkout(rich_text_folder) ICheckinCheckoutPolicy(wc).checkin("updated") # everything went right and the working copy is checked in self.assertEqual(subobject_uid, wc.UID())
from zope.interface import implements from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from plone.app.folder.folder import ATFolder, ATFolderSchema from vindula.services import MessageFactory as _ from vindula.services.config import PROJECTNAME from vindula.services.interfaces import IServicosCategory from archetypes.referencebrowserwidget.widget import ReferenceBrowserWidget from vindula.controlpanel.browser.at.widget import VindulaReferenceSelectionWidget ServicosCategorySchema = ATFolderSchema.copy() + atapi.Schema(( atapi.ReferenceField('imageCategory', multiValued=0, allowed_types=('Image'), label=_(u"Icone da categoria"), relationship='Imagem', widget=VindulaReferenceSelectionWidget( label=_(u"Imagem"), description='Imagem que vai aparecer ao lado da listagem de categorias.') ), atapi.BooleanField('is_open_aba', default=False, widget=atapi.BooleanWidget(
from plone.app.folder.folder import ATFolderSchema from Products.Archetypes.atapi import Schema IntranetFolderSchema = ATFolderSchema.copy() + Schema(( ))
### BBB for < Plone 4 from Products.ATContentTypes.content.folder import ATFolderSchema, ATFolder from Products.ATContentTypes.content.schemata import finalizeATCTSchema from Products.ATContentTypes.content.base import registerATCT from Products.PloneFormGen.config import * from Products.PloneFormGen.widgets import \ FieldsetStartWidget, FieldsetEndWidget from Products.PloneFormGen.interfaces import IPloneFormGenFieldset from Products.PloneFormGen import PloneFormGenMessageFactory as _ import zope.i18n FieldsetFolderSchema = ATFolderSchema.copy() + Schema(( BooleanField('useLegend', required=0, searchable=0, default='1', widget=BooleanWidget(label='Show Title as Legend', label_msgid = "label_showlegend_text", description_msgid = "help_showlegend_text", i18n_domain = "ploneformgen", ), ), )) FieldsetFolderSchema['description'].widget.label = 'Fieldset Help' FieldsetFolderSchema['description'].widget.i18n_domain = 'ploneformgen' FieldsetFolderSchema['description'].widget.label_msgid = 'label_fieldsethelp_text'
from Products.Archetypes.atapi import AnnotationStorage from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import LinesField from Products.Archetypes.atapi import LinesWidget from Products.Archetypes.atapi import MultiSelectionWidget from Products.Archetypes.atapi import RichWidget from Products.Archetypes.atapi import SelectionWidget from Products.Archetypes.atapi import StringField from Products.Archetypes.atapi import StringWidget from Products.Archetypes.atapi import TextField from Products.ATContentTypes.content.schemata import ATContentTypeSchema from Products.ATContentTypes.content.schemata import finalizeATCTSchema from Products.ATContentTypes.content.image import ATImageSchema SectionFolderSchema = ATFolderSchema.copy() + Schema(( )) SectionImageFolderSchema = ATFolderSchema.copy() + Schema(( )) BannerImageSchema = ATImageSchema.copy() + Schema(( )) BannerImageSchema['image'].widget.description = """The image must be 930 pixels wide and 180 pixels tall, otherwise the image will be stretched.""" finalizeATCTSchema(BannerImageSchema)
'columns': ['Title', 'Description']}, ] def before_render(self): """Before template render hook """ super(DrugProhibitionsView, self).before_render() # Don't allow any context actions on Drug Prohibitions folder self.request.set("disable_border", 1) def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) return items schema = ATFolderSchema.copy() class DrugProhibitions(ATFolder): implements(IDrugProhibitions) displayContentsTab = False schema = schema schemata.finalizeATCTSchema(schema, folderish = True, moveDiscussion = False) atapi.registerType(DrugProhibitions, PROJECTNAME)
# -*- coding: utf-8 -*- from plone.app.folder.folder import ATFolder, ATFolderSchema from Products.ATContentTypes.content.base import registerATCT from Products.Archetypes import atapi RichFolderSchema = ATFolderSchema.copy() + atapi.Schema(( atapi.TextField('text', default_output_type='text/x-html-safe', widget=atapi.RichWidget(), ), )) class RichFolder(ATFolder): """ sample content type for testing purposes """ schema = RichFolderSchema portal_type = 'RichFolder' registerATCT(RichFolder, 'plone.app.iterate') def addRichFolder(container, id, **kwargs): """ at-constructor copied from ClassGen.py """ obj = RichFolder(id) container._setObject(id, obj, suppress_events=True) obj = container._getOb(id) obj.manage_afterAdd(obj, container) obj.initializeArchetype(**kwargs) return obj.getId()
from Acquisition import aq_base from zope.interface import implements from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from plone.app.folder.folder import ATFolder, ATFolderSchema from vindula.services import MessageFactory as _ from vindula.services.config import PROJECTNAME from vindula.services.interfaces import IServicosFolder from vindula.controlpanel.browser.at.widget import VindulaReferenceSelectionWidget ServicosFolderSchema = ATFolderSchema.copy() + atapi.Schema(( atapi.ReferenceField('destaques', multiValued=1, allowed_types=('Servico'), label=_(u"Destaques"), relationship='destaques', widget=VindulaReferenceSelectionWidget( label=_(u"Destaques"), description='Selecione os Serviços em destaque.' ), ), ))
from Products.PloneFormGen import implementedOrProvidedBy try: import plone.protect HAS_PLONE_PROTECT = True except ImportError: HAS_PLONE_PROTECT = False from types import StringTypes import zope.i18n logger = logging.getLogger("PloneFormGen") FormFolderSchema = ATFolderSchema.copy() + Schema(( StringField('submitLabel', required=0, searchable=0, default="Submit", widget=StringWidget( label="Submit Button Label", label_msgid = "label_submitlabel_text", description_msgid = "help_submitlabel_text", i18n_domain = "ploneformgen", ), ), BooleanField('useCancelButton', required=0, searchable=0, default='0',
from zope.interface import implements from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from Products.CMFCore.utils import getToolByName from plone.app.folder.folder import ATFolder, ATFolderSchema from vindula.clipping.interfaces import IVindulaClipping from vindula.clipping.config import PROJECTNAME from vindula.clipping import MessageFactory as _ #TODO: criar validator para as URLs inseridas VindulaClippingSchema = ATFolderSchema.copy() + atapi.Schema(( atapi.LinesField( name='feeds', widget=atapi.LinesWidget( label=_(u"Feeds"), description=_(u"Informe os enderecos dos Feeds, um por linha.") ) ), )) schemata.finalizeATCTSchema(VindulaClippingSchema, folderish=True, moveDiscussion=False) class VindulaClipping(ATFolder): """
from plone.app.folder.folder import ATFolderSchema from Products.Archetypes.atapi import BooleanField from Products.Archetypes.atapi import BooleanWidget from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import StringField from Products.Archetypes.atapi import StringWidget from Products.ATContentTypes.content.schemata import ATContentTypeSchema from Products.ATContentTypes.content.schemata import finalizeATCTSchema AuthorFolderSchema = ATFolderSchema.copy() + Schema(( )) AuthorSchema = ATContentTypeSchema.copy() + Schema(( StringField('personalNames', required = False, searchable = False, widget = StringWidget( label='Personal Names', format='checkbox', ) ), StringField('familyName', required = False, searchable = False, widget = StringWidget( label='Family Name',
from Products.DataGridField.FixedColumn import FixedColumn from Products.DataGridField.SelectColumn import SelectColumn from rg.prenotazioni import prenotazioniMessageFactory as _ from rg.prenotazioni.config import PROJECTNAME from rg.prenotazioni.interfaces import IPrenotazioniFolder from zope.interface import implements try: from plone.app.folder.folder import ATFolder as BaseFolder from plone.app.folder.folder import ATFolderSchema as BaseFolderSchema except ImportError: from Products.ATContentTypes.content.folder import ATBTreeFolder as BaseFolder from Products.ATContentTypes.content.folder import ATBTreeFolderSchema as BaseFolderSchema PrenotazioniFolderSchema = BaseFolderSchema.copy() + atapi.Schema(( # -*- Your Archetypes field definitions here ... -*- atapi.TextField( 'descriptionAgenda', required=False, searchable=True, storage=atapi.AnnotationStorage(migrate=True), validators=('isTidyHtmlWithCleanup',), default_output_type='text/x-html-safe', widget=atapi.RichWidget( description=("Inserire il testo di presentazione " "dell'agenda corrente"), label=_(u'Descrizione Agenda', default=u''), rows=10,
# -*- coding: utf-8 -*- from zope.interface import implements from plone.app.folder.folder import ATFolder, ATFolderSchema from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from mpdg.govbr.observatorio.content.interfaces import IComentario from mpdg.govbr.observatorio.config import PROJECTNAME from mpdg.govbr.observatorio import MessageFactory as _ from DateTime.DateTime import DateTime ComentarioSchema = ATFolderSchema.copy() + atapi.Schema( (atapi.StringField( name='nome', required=True, widget=atapi.StringWidget(label=_(u"Nome"), description=_(u"")), ), atapi.StringField( name='email', required=True, widget=atapi.StringWidget(label=_(u"E-mail"), description=_(u"")), ), atapi.TextField( name='comentario', required=False, searchable=True, storage=atapi.AnnotationStorage(migrate=True), widget=atapi.TextAreaWidget( label=_(u"Comentário"), description=_(u""), rows=5, ),
# -*- 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'')),
from Products.Archetypes.atapi import SelectionWidget from Products.Archetypes.atapi import StringField from Products.Archetypes.atapi import StringWidget from Products.Archetypes.atapi import TextField from Products.Archetypes.atapi import RichWidget from Products.ATContentTypes.content.schemata import ATContentTypeSchema from Products.ATContentTypes.content.schemata import finalizeATCTSchema from younglives.research.types.config import RESEARCH_THEME, \ RESEARCH_METHODOLOGY, \ RESEARCH_COUNTRY, \ RESEARCH_OUTPUT, \ PAPER_ORIGIN ResearchDatabaseSchema = ATFolderSchema.copy() + Schema(( StringField('paperManagerGroup', searchable = 0, required = 0, vocabulary = 'getPortalGroupsVocab', widget = SelectionWidget( label = 'Paper managers', description = 'Please choose which user group contains the users for the paper managers.', ), ), )) ResearchSchema = ATContentTypeSchema.copy() + Schema((
from plone.app.folder.folder import ATFolderSchema from Products.Archetypes.atapi import AnnotationStorage from Products.Archetypes.atapi import RichWidget from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import TextField from Products.ATContentTypes.content.schemata import finalizeATCTSchema HomePageSchema = ATFolderSchema.copy() + Schema(( TextField( name='text', required=True, searchable=True, storage=AnnotationStorage(), validators=('isTidyHtml',), default_output_type='text/html', allowable_content_types=('text/plain', 'text/structured', 'text/html', 'application/msword',), widget=RichWidget( label='Home Page Main Text', label_msgid='oxford.homepage_label_mainText', description='Text that appears in the main content area on the home page', description_msgid='oxford.homepage_help_mainText', i18n_domain='oxford.homepage', rows=25, allow_file_upload=False, ), ), ))
# -*- coding: utf-8 -*- from zope.interface import implements from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata from plone.app.folder.folder import ATFolder, ATFolderSchema from museudigital.conteudos.config import PROJECTNAME from museudigital.conteudos.interfaces import ILivro LivroSchema = ATFolderSchema.copy() schemata.finalizeATCTSchema(LivroSchema, folderish=True, moveDiscussion=False) class Livro(ATFolder): """ """ implements(ILivro) meta_type = "Livro" schema = LivroSchema _at_rename_after_creation = True atapi.registerType(Livro, PROJECTNAME)
from Products.DataGridField.DataGridField import FixedRow from Products.DataGridField.FixedColumn import FixedColumn from Products.DataGridField.SelectColumn import SelectColumn from rg.prenotazioni import prenotazioniMessageFactory as _ from rg.prenotazioni.config import PROJECTNAME from rg.prenotazioni.interfaces import IPrenotazioniFolder from zope.interface import implements try: from plone.app.folder.folder import ATFolder as BaseFolder from plone.app.folder.folder import ATFolderSchema as BaseFolderSchema except ImportError: from Products.ATContentTypes.content.folder import ATBTreeFolder as BaseFolder from Products.ATContentTypes.content.folder import ATBTreeFolderSchema as BaseFolderSchema PrenotazioniFolderSchema = BaseFolderSchema.copy() + atapi.Schema(( # -*- Your Archetypes field definitions here ... -*- atapi.TextField( 'descriptionAgenda', required=False, searchable=True, storage=atapi.AnnotationStorage(migrate=True), validators=('isTidyHtmlWithCleanup', ), default_output_type='text/x-html-safe', widget=atapi.RichWidget( description=("Inserire il testo di presentazione " "dell'agenda corrente"), label=_(u'Descrizione Agenda', default=u''), rows=10, allow_file_upload=zconf.ATDocument.allow_document_upload),
# from AccessControl import ClassSecurityInfo from Products.Archetypes.utils import DisplayList from Products.Archetypes import atapi from Products.ATContentTypes.content import schemata, folder from Products.DataGridField import DataGridField, DataGridWidget from Products.DataGridField.Column import Column from zope.component import getUtility from zope.interface import implements from plone.app.blob.field import FileField from zope.schema.interfaces import IVocabularyFactory from plone.app.folder.folder import ATFolder, ATFolderSchema from mpdg.govbr.observatorio import MessageFactory as _ from mpdg.govbr.observatorio.config import PROJECTNAME from mpdg.govbr.observatorio.content.interfaces import IBoaPratica BoaPratica_schema = ATFolderSchema.copy() + atapi.Schema(( atapi.StringField( name='esfera', default=u'federal', widget=atapi.SelectionWidget(label=_(u"Essa prática é esfera"), ), required=True, vocabulary='vocEsfera', ), atapi.StringField( name='uf', title=u'UF', widget=atapi.SelectionWidget(label=_(u"UF"), ), required=False, vocabulary="vocBrasilEstados", ), atapi.StringField(
from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import LinesField from Products.Archetypes.atapi import LinesWidget from Products.Archetypes.atapi import MultiSelectionWidget from Products.Archetypes.atapi import RichWidget from Products.Archetypes.atapi import SelectionWidget from Products.Archetypes.atapi import StringField from Products.Archetypes.atapi import StringWidget from Products.Archetypes.atapi import TextField from Products.ATContentTypes.content.schemata import ATContentTypeSchema from Products.ATContentTypes.content.schemata import finalizeATCTSchema from cmrs.course.config import COURSE_TYPE, SUBJECT_CREDIT CourseFolderSchema = ATFolderSchema.copy() + Schema(( LinesField('courseSemesters', required = True, searchable = False, storage = AnnotationStorage(), widget = LinesWidget( label='Course Semesters', description = """Add each course date on a seperate line in the format "season year" these will be used wherever the course dates are requried""", ) ), TextField('text', required = False, searchable = True,
from plone.app.folder.folder import ATFolderSchema, ATFolder from Products.ATContentTypes.content.schemata import finalizeATCTSchema from Products.ATContentTypes.content.base import registerATCT from Products.PloneFormGen.config import * from Products.PloneFormGen.widgets import \ FieldsetStartWidget, FieldsetEndWidget from Products.PloneFormGen.interfaces import IPloneFormGenFieldset from Products.PloneFormGen import PloneFormGenMessageFactory as _ import zope.i18n FieldsetFolderSchema = ATFolderSchema.copy() + Schema((BooleanField( 'useLegend', required=0, searchable=0, default='1', widget=BooleanWidget( label=_(u'label_showlegend_text', default=u'Show Title as Legend'), description=_(u'help_showlegend_text', default=u''), ), ), )) FieldsetFolderSchema['description'].widget.label = _( u'label_fieldsethelp_text', default=u'Fieldset Help') FieldsetFolderSchema['description'].widget.description = None FieldsetFolderSchema.moveField('description', after='useLegend')
from plone.app.folder.folder import ATFolder, ATFolderSchema from Products.ATContentTypes.content.base import registerATCT from Products.Archetypes import atapi RichFolderSchema = ATFolderSchema.copy() + atapi.Schema((atapi.TextField( 'text', default_output_type='text/x-html-safe', widget=atapi.RichWidget(), ), )) class RichFolder(ATFolder): """ sample content type for testing purposes """ schema = RichFolderSchema portal_type = 'RichFolder' registerATCT(RichFolder, 'plone.app.iterate') def addRichFolder(container, id, **kwargs): """ at-constructor copied from ClassGen.py """ obj = RichFolder(id) container._setObject(id, obj, suppress_events=True) obj = container._getOb(id) obj.manage_afterAdd(obj, container) obj.initializeArchetype(**kwargs) return obj.getId()
def before_render(self): """Before template render hook """ super(CaseSyndromicClassificationsView, self).before_render() # Don't allow any context actions on Syndromic classifications folder self.request.set("disable_border", 1) def folderitems(self): items = BikaListingView.folderitems(self) for x in range(len(items)): if not items[x].has_key('obj'): continue obj = items[x]['obj'] items[x]['Description'] = obj.Description() items[x]['replace']['Title'] = "<a href='%s'>%s</a>" % \ (items[x]['url'], items[x]['Title']) return items schema = ATFolderSchema.copy() class CaseSyndromicClassifications(ATFolder): implements(ICaseSyndromicClassifications) displayContentsTab = False schema = schema schemata.finalizeATCTSchema(schema, folderish=True, moveDiscussion=False) atapi.registerType(CaseSyndromicClassifications, PROJECTNAME)
from Products.Archetypes.atapi import LinesWidget from Products.Archetypes.atapi import RichWidget from Products.Archetypes.atapi import SelectionWidget from Products.Archetypes.atapi import StringField from Products.Archetypes.atapi import StringWidget from Products.Archetypes.atapi import Schema from Products.Archetypes.atapi import TextField from Products.ATContentTypes import ATCTMessageFactory as _ from Products.ATContentTypes.configuration import zconf from Products.ATContentTypes.content.schemata import ATContentTypeSchema from Products.ATContentTypes.content.schemata import finalizeATCTSchema from Products.validation import V_REQUIRED from cmrs.academic.config import PRE_NOMINAL AcademicFolderSchema = ATFolderSchema.copy() + Schema(( TextField('text', required = False, searchable = True, primary = True, storage = AnnotationStorage(migrate=True), validators = ('isTidyHtmlWithCleanup',), default_output_type = 'text/x-html-safe', widget = RichWidget( label = 'Introduction', rows = 25,) ), ))