class ProfsAccompagnateursField(ExtensionField, TextField):
    """
    """
    TextField(
        name='profsAccompagnateurs',
        required=False,
        searchable=True,
        widget=TextAreaWidget(description='',
                              label=u'Professeurs accompagnateurs',
                              cols=40))
示例#2
0
        newId = str(self.getNextUniqueId())
        self.log.info('the next value for xppm sequence: %s', newId)
        self.setId(self.xppm_id_prefix + newId)


# the base class for all document base content in XPoint Project Management
XPPMDocBaseSchema = ATCTContent.schema.copy() + Schema(
    (

        # the details description for a use case.
        TextField(
            'xppm_text',
            searchable=True,
            required=True,
            default_output_type='text/x-html-safe',
            widget=RichWidget(
                label=u'Text Area Label',
                description=u'The details description Here.',
                rows=25,
            ),
        ),

        # the status for this issue.
        StringField(
            'xppm_status',
            searchable=False,
            required=False,
            default='',
            # this the default vocabulary, we can change for each one.
            vocabulary='vocabulary_status',
            widget=SelectionWidget(
示例#3
0
__version__ = open(os.path.join(COREBLOG2_DIR,'version.txt')).read().strip()
__product_version__ = "COREBlog2 " + __version__

__author__  = 'Atsushi Shibata <*****@*****.**>'
__docformat__ = 'plaintext'

COREBlog2Schema = ATBTreeFolder.schema.copy() +  Schema((

    #Basic settings
    TextField('long_description',
        searchable=1,
        default='',
        allowable_content_types = ('text/plain', ),
        widget=TextAreaWidget(label='Long description',
                    description='',
                    label_msgid='label_long_description',
                    description_msgid='help_long_description',
                    i18n_domain='plone',
                    cols=60,rows=5),
        ),

    #Entry listing
    IntegerField('top_entry_count_setting',
        searchable=0,
        default=1,
        widget=SelectionWidget(label='Entries per page',
                    description='',
                    label_msgid='label_top_entry_count_setting',
                    description_msgid='help_top_entry_count_setting',
                    i18n_domain='plone',
            checkbox_bound=0,
            label=_("Task type", "Type"),
        ),
    ),
    RecordsField(
        "ScheduleCriteria",
        required=1,
        type="schedulecriteria",
        widget=ScheduleInputWidget(label=_("Criteria"), ),
    ),
    TextField(
        "Considerations",
        default_content_type="text/plain",
        allowed_content_types=("text/plain", ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            label=_("Considerations"),
            description=_("Remarks to take into account before performing the "
                          "task"),
        ),
    ),
))

IdField = schema['id']
schema['description'].required = False
schema['description'].widget.visible = True
schema['description'].schemata = 'default'
schema.moveField('description', before='Considerations')

# Title is not needed to be unique
schema['title'].validators = ()
示例#5
0
from iscorpio.plonepm.interfaces import IPPMStory

__author__ = 'Sean Chen'
__email__ = '*****@*****.**'

# the schema for story.
PPMStorySchema = ATFolderSchema.copy() + Schema(
    (

        # scope details
        TextField(
            'xppm_text',
            searchable=True,
            required=True,
            default_output_type='text/x-html-safe',
            widget=RichWidget(
                label='Details',
                description='Details description for this story',
                rows=18,
            ),
        ),

        # iteration plan
        StringField(
            'xppm_iteration',
            searchable=False,
            required=True,
            vocabulary='vocabulary_iterations',
            widget=SelectionWidget(
                label=u'Iteration Plan',
                description=u'Select the iteration plan for this story',
示例#6
0
from Products.ATContentTypes.content.schemata import finalizeATCTSchema
from Products.ATContentTypes.content.base import ATCTContent
from Products.ATContentTypes.lib.historyaware import HistoryAwareMixin
from Products.ATContentTypes.configuration import zconf

from Products.CMFCore.permissions import View

# the XPointDocument Schema.
XPointDocumentSchema = ATCTContent.schema.copy() + Schema((

        # The body of the build journal.
        TextField(
            'xpproject_text',
            searchable = True,
            required = True,
            default_output_type = 'text/x-html-safe',
            widget = RichWidget(
                label = u'Body Text',
                rows = 22
                ),
            ),

        # the status for this issue.
        StringField(
            'xpproject_document_status',
            searchable = False,
            required = False,
            index = "FieldIndex:schema",
            default = '',
            vocabulary = 'vocabulary_documentStatus',
            widget = SelectionWidget(
                label = 'Document Status',
示例#7
0
        widget=StringWidget(
            visible={
                "view": "visible",
                "edit": "visible"
            },
            label=_("Method ID"),
            description=_("Define an identifier code for the method. "
                          "It must be unique."),
        ),
    ),
    TextField(
        "Instructions",
        default_content_type="text/plain",
        allowed_content_types=("text/plain", ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            label=_("Instructions"),
            description=_("Technical description and instructions "
                          "intended for analysts"),
        ),
    ),
    BlobFileField(
        "MethodDocument",  # XXX Multiple Method documents please
        widget=FileWidget(
            label=_("Method Document"),
            description=_("Load documents describing the method here"),
        )),

    # The instruments linked to this method. Don't use this
    # method, use getInstrumentUIDs() or getInstruments() instead
    LinesField(
示例#8
0
from Products.Archetypes.public import TextField
from Products.Archetypes.public import registerType
from zope.interface import implements

from bika.lims import bikaMessageFactory as _
from bika.lims.config import PROJECTNAME
from bika.lims.content.organisation import Organisation
from bika.lims.interfaces import IDeactivable
from bika.lims.interfaces import ISupplier

schema = Organisation.schema.copy() + ManagedSchema((

    TextField(
        "Remarks",
        allowable_content_types=("text/plain",),
        widget=TextAreaWidget(
            label=_("Remarks"),
        )
    ),

    StringField(
        "Website",
        searchable=1,
        required=0,
        widget=StringWidget(
            visible={"view": "visible", "edit": "visible"},
            label=_("Website."),
        ),
    ),

    StringField(
示例#9
0
文件: task.py 项目: seanchen/plonexp
from Products.CMFCore.utils import getToolByName

# the configruation info for this project.
from iscorpio.plonepm.config import PROJECTNAME

# the schema for XPointTask.
XPointTaskSchema = ATFolderSchema.copy() + Schema(
    (

        # text field for details description for this task.
        TextField(
            'xptask_text',
            searchable=True,
            required=True,
            default_output_type='text/x-html-safe',
            widget=RichWidget(
                label='Task description',
                rows=25,
            ),
        ),

        # planned completed date, 90% finish deadline
        DateTimeField(
            'xptask_completion_date',
            index='DateIndex:schema',
            searchable=False,
            required=True,
            widget=CalendarWidget(
                label='90% Completion Deadline',
                description=
                'Specify the date when this task should be completed at less 90%',
class NewsletterReference(BaseContent, PropertyManager):

    portal_type = meta_type = 'NewsletterReference'
    archetype_name = 'Newsletter Reference'   #this name appears in the 'add' box

    security = ClassSecurityInfo()

    schema=BaseSchema  + Schema((
        TextField('description',
                  default='',
                  searchable=1,
                  isMetadata=1,
                  accessor="Description",
                  widget=TextAreaWidget(label='Description',
                                        description='An administrative summary of the content',
                                        label_msgid='label_description',
                                        description_msgid='help_description',
                                        i18n_domain="plone")
                  ),
    ReferenceField('references',
                    languageIndependent=1,
                    required=0,
                    allowed_types=(),
                    multiValued=1,
                    relationship='references',
                    widget=ReferenceBrowserWidget(label='References',
                                                  description='Select one or more remote objects',
                                                  label_msgid='label_references',
                                                  description_msgid='help_references',
                                                  i18n_domain='plonegazette',
                                                  allow_search=1,
                                                  allow_browse=1,
                                                  show_indexes=0,
                                                  ),
                ),
    ))

    # Make sure we get title-to-id generation when an object is created
    _at_rename_after_creation = True

    security.declarePublic('getObjects')
    def getObjects(self):
        """
        """
        return self.getReferences()

    # uncommant lines below when you need
    factory_type_information={
        'allowed_content_types':[],
        'global_allow' : 0,
        'content_icon':'NewsletterReference.gif',
        'immediate_view':'newsletterreference_view',
        'filter_content_types' : 0
        }

    actions=({
        'id' : 'view',
        'name' : 'View',
        'category' : 'object',
        'action' : 'string:${object_url}/NewsletterReference_view',
        'permissions' : ('View',)
        },)
示例#11
0
from Products.Archetypes.public import BaseSchema, Schema
from Products.Archetypes.public import TextField
from Products.Archetypes.public import RichWidget
from Products.Archetypes.public import BaseContent, registerType
from Products.Archetypes.Marshall import PrimaryFieldMarshaller
from Products.CMFCore import CMFCorePermissions
from config import PROJECT_NAME

schema = BaseSchema + Schema(
    (TextField(
        'body',
        searchable=1,
        required=1,
        primary=1,
        default_output_type='text/html',
        allowable_content_types=('application/msword', ),
        widget=RichWidget(label='Body'),
    ), ),
    marshall=PrimaryFieldMarshaller(),
)


class WordExample(BaseContent):
    """This is a sample article, it has an overridden view for show,
    but this is purely optional
    """
    content_icon = "word_icon.gif"
    schema = schema


registerType(WordExample, PROJECT_NAME)
     multiValued=False,
     widget=ReferenceBrowserWidget(
         description="",
         description_msgid="help_event_location",
         label="Event Location",
         label_msgid="label_event_location",
         i18n_domain="plone",
     ),
 ),
 TextField(
     'text',
     required=False,
     searchable=True,
     widget=RichWidget(
         description="",
         description_msgid="help_event_announcement",
         label="Event Announcement",
         label_msgid="label_event_announcement",
         rows=25,
         i18n_domain="plone",
         allow_file_upload=zconf.ATDocument.allow_document_upload,
     ),
 ),
 LinesField(
     'eventType',
     required=True,
     searchable=True,
     write_permission=ChangeEvents,
     vocabulary='getEventTypes',
     languageIndependent=True,
     widget=MultiSelectionWidget(
         size=6,
示例#13
0
class ECQExtendedTextQuestion(ECQPointsQuestion):
    """A question that allows the candidate to write a text answer."""

    schema = ECQPointsQuestion.schema.copy() + Schema((
        TextField(
            'answerTemplate', # See 'description' property
                              # of the widget.
            searchable=True,
            required=False,
            allowable_content_types=('text/plain',
                                     #'text/structured',
                                     #'text/restructured',
                                     #'text/html',
                                     ),
            default_output_type='text/plain',
            widget=TextAreaWidget(
                label='Answer Template',
                label_msgid='answer_template_label',
                description="You can provide a template for the "
                "candidate's answer.",
                description_msgid='answer_template_tool_tip',
                i18n_domain=I18N_DOMAIN,
                rows=10,
                ),
            validators=('isXML',),
            read_permission=PERMISSION_STUDENT,
            ),
        
        IntegerField('expectedLength',
                required=False,
                default=50,
                validators=('isPositiveInt',),
                widget=IntegerWidget(
                    label='Expected Length',
                    label_msgid='expected_length_label',
                    description="You can set the number of words you "
                    "expect the candidate's answer to have.",
                    description_msgid='expected_length_tool_tip',
                    i18n_domain=I18N_DOMAIN),
                read_permission=PERMISSION_STUDENT,
            ),
        ),)
    # This type of question is always tutor-graded
    schema.delField('tutorGraded')
    # Make "points" appear *after* the "answerTemplate"
    schema.moveField('points', 1)
    schema.moveField('points', 1)
        
    allowed_content_types = ()
    filter_content_types = True # Otherwise allowed_content_types == ()
                                # means 'allow everything'
    
    meta_type = 'ECQExtendedTextQuestion'     # zope type name
    portal_type = meta_type                   # plone type name
    archetype_name = 'Extended Text Question' # friendly type name

    # Use the portal_factory for this type.  The portal_factory tool
    # allows users to initiate the creation objects in a such a way
    # that if they do not complete an edit form, no object is created
    # in the ZODB.
    #
    # This attribute is evaluated by the Extensions/Install.py script.
    use_portal_factory = True

    typeDescription = "A question that allows the candidate to write " \
                      "a text answer."
    typeDescMsgId = 'description_edit_extextquestion'

    security = ClassSecurityInfo()

    security.declarePublic('isTutorGraded')
    def isTutorGraded(self, *args, **kwargs):
        return True
示例#14
0
            required=True,
            vocabulary='vocabulary_allSenders',
            widget=SelectionWidget(
                label=u'Sender',
                description='Set the sender for this email message',
                format='select',
            ),
        ),

        # memo for this contact.
        TextField(
            'xpcm_emessage_body',
            searchable=True,
            required=False,
            default_output_type='text/x-html-safe',
            widget=RichWidget(
                label=u'Email Body',
                description=u'Please edit your email message here!',
                rows=22,
            ),
        ),

        # the file attachement.
        FileField(
            'xpcm_emessage_attachment',
            required=False,
            searchable=False,
            storage=AnnotationStorage(migrate=True),
            widget=FileWidget(
                label='Attachment',
                description='You may add one attachment into you email.',
示例#15
0
fieldcount = 0
for field in FIELDS:
    fieldcount += 1
    if FTYPES[fieldcount - 1] == 'string':
        schema = schema + Schema(
            (StringField(name=num2field(fieldcount),
                         required=(fieldcount == 1),
                         searchable=1,
                         widget=StringWidget(label=field, size=60)), ))
    else:
        schema = schema + Schema((TextField(
            name=num2field(fieldcount),
            required=(fieldcount == 1),
            searchable=1,
            storage=AnnotationStorage(migrate=True),
            validators=('isTidyHtmlWithCleanup', ),
            default_output_type='text/x-html-safe',
            default_content_type=zconf.ATDocument.default_content_type,
            allowable_content_types=zconf.ATDocument.allowed_content_types,
            widget=RichWidget(label=field, cols=40, rows=10)), ))


class Vee(ATCTContent, HistoryAwareMixin):
    implements(IVee)

    schema = schema

    actions = ({
        'id': 'view',
        'name': 'View',
        'action': 'string:${object_url}/vee_view',
示例#16
0
                                        SelectionWidget)

from eea.soer.content.interfaces import ISOERReport
from eea.soer.content.interfaces import ISoerFigure, ISoerDataFile

schema = Schema((
    TextField(
        'keyMessage',
        required=False,
        searchable=True,
        primary=False,
        storage=AnnotationStorage(migrate=True),
        validators=('isTidyHtmlWithCleanup', ),
        default_content_type=zconf.ATNewsItem.default_content_type,
        default_output_type='text/x-html-safe',
        allowable_content_types=('text/html', ),
        widget=RichWidget(
            description="Optional",
            description_msgid="help_body_text",
            label="Key message",
            label_msgid="label_body_text",
            rows=5,
            i18n_domain="plone",
            allow_file_upload=False,
        ),
    ),
    TextField(
        'text',
        required=True,
        searchable=True,
        primary=True,
        storage=AnnotationStorage(migrate=True),
示例#17
0
文件: user.py 项目: seanchen/plonexp
     widget=StringWidget(label="Full Name",
                         description="User's Full name."),
 ),
 StringField(
     'email',
     languageIndependent=1,
     required=True,
     user_property=True,
     widget=StringWidget(label="Email Address",
                         description="User's Email Address."),
 ),
 TextField(
     'description',
     user_property=True,
     widget=TextAreaWidget(
         label="Biography",
         description=
         "A short overview of who you are and what you do. Will be displayed on the your author page, linked from the items you create."
     ),
 ),
 StringField(
     'location',
     languageIndependent=1,
     user_property=True,
     widget=StringWidget(label="Location", description="User's Location."),
 ),
 LinesField(
     'sites',
     languageIndependent=1,
     user_property=True,
     widget=LinesWidget(
示例#18
0
from Products.Archetypes.public import BaseSchema
from Products.Archetypes.public import Schema
from Products.Archetypes.public import TextAreaWidget
from Products.Archetypes.public import TextField
from Products.Archetypes.public import registerType
from Products.OrderableReferenceField import OrderableReferenceField
from Products.PloneGazette.config import PROJECTNAME
from archetypes.referencebrowserwidget import ReferenceBrowserWidget

NewsletterReferenceSchema = BaseSchema.copy() + Schema((
    TextField('description',
              default='',
              searchable=1,
              isMetadata=1,
              accessor="Description",
              widget=TextAreaWidget(
                  description='An administrative summary of the content',
                  description_msgid='help_description',
                  i18n_domain="plone",
                  label='Description',
                  label_msgid='label_description',
              )),
    OrderableReferenceField(
        'references',
        languageIndependent=1,
        required=0,
        allowed_types=(),
        multiValued=1,
        relationship='references',
        widget=ReferenceBrowserWidget(
            allow_browse=1,
            allow_search=1,
示例#19
0
            description_msgid="help_file",
            label="File",
            label_msgid="label_file",
            i18n_domain="plone",
            show_content_type=False,
        )),
    ImageField('image',
               required=False,
               sizes={
                   'mini': (40, 40),
                   'thumb': (80, 80),
               },
               storage=FileSystemStorage(),
               widget=ImageWidget()),
    TextField('text',
              required=False,
              storage=FileSystemStorage(),
              widget=TextAreaWidget()),
),
                       marshall=PrimaryFieldMarshaller())

FSSItemSchema = BaseSchema.copy() + BaseItemShema.copy()
ATFSSItemSchema = ATContentTypeSchema.copy() + BaseItemShema.copy()


class FSSItem(BaseContent):
    """A simple item using FileSystemStorage"""
    archetypes_name = portal_type = meta_type = 'FSSItem'
    schema = FSSItemSchema
    _at_rename_after_creation = True

from Products.Ploneboard.interfaces import IPloneboard
from Products.Ploneboard.permissions import AddForum
from Products.Ploneboard.permissions import ManageBoard
from Products.Ploneboard.permissions import SearchBoard
from Products.Ploneboard.permissions import ViewBoard
from Products.Archetypes.atapi import AnnotationStorage


schema = ATBTreeFolderSchema + Schema((
    TextField('description',
        searchable=1,
        default_content_type='text/html',
        default_output_type='text/plain',
        widget=TextAreaWidget(
                description="Enter a brief description of the board.",
                description_msgid="help_description_board",
                i18n_domain="ploneboard",
                label="Description",
                label_msgid="label_description_board",
                rows=5
                )
            ),
    TextField('text',
              required=False,
              searchable=True,
              storage=AnnotationStorage(),
              validators=('isTidyHtmlWithCleanup',),
              default_output_type='text/x-html-safe',
              widget=RichWidget(
                        i18n_domain="ploneboard",
                        label="Text",
示例#21
0
 RecordsField(
     "SendLog",
     type="sendlog",
     subfields=(
         "actor",
         "actor_fullname",
         "email_send_date",
         "email_recipients",
         "email_responsibles",
         "email_subject",
         "email_body",
         "email_attachments",
     ),
 ),
 TextField(
     "Html"
 ),
 BlobField(
     "Pdf",
     default_content_type="application/pdf",
 ),
 RecordsField(
     "Recipients",
     type="recipients",
     subfields=(
         "UID",
         "Username",
         "Fullname",
         "EmailAddress",
         "PublicationModes"
     ),
示例#22
0
from Products.CMFCore.utils import getToolByName

# the configruation info for this project.
from Products.XPointProjectManagement.config import *

# the XPointBuildJournal Schema.
XPointBuildJournalSchema = ATCTContent.schema.copy() + Schema(
    (

        # The body of the build journal.
        TextField(
            'buildJournalBody',
            searchable=True,
            required=True,
            allowable_content_types=(
                'text/plain',
                'text/structured',
                'text/html',
            ),
            default_output_type='text/x-html-safe',
            widget=RichWidget(label='Build Journal Body', rows=28),
        ), ), )

# Decide to use the build in plone keywording as the projects selection.
# Plone Keywording field is defined as subject in class
# Archetypes.ExtensibleMetadata.ExtensibleMetadata
# by default this LinesField is located in propertie tab (metadata),
# we need move it to the default tab and set it to required.
XPointBuildJournalSchema['subject'].schemata = 'default'  # used to 'metadata'
XPointBuildJournalSchema['subject'].required = True
XPointBuildJournalSchema['subject'].widget.label = 'Projects'
XPointBuildJournalSchema['subject'].widget.size = 6
from zope.interface import providedBy


PBConversationBaseBTreeFolderSchema = BaseBTreeFolderSchema.copy()
PBConversationBaseBTreeFolderSchema['title'].read_permission = ViewBoard
PBConversationBaseBTreeFolderSchema['title'].write_permission = EditComment

schema = PBConversationBaseBTreeFolderSchema + Schema((
    TextField(
            'description',
            searchable=1,
            read_permission=ViewBoard,
            write_permission=EditComment,
            default_content_type='text/plain',
            default_output_type='text/plain',
            widget=TextAreaWidget(
                description="Enter a brief description of the conversation.",
                description_msgid="help_description_conversation",
                label="Description",
                label_msgid="label_description_conversation",
                i18n_domain="ploneboard",
                rows=5)
        ),
    ))
utils.finalizeSchema(schema)


class PloneboardConversation(BrowserDefaultMixin, BaseBTreeFolder):
    """Conversation contains comments."""

    implements(IConversation, INonStructuralFolder)
AttachmentSizes = IntDisplayList((
        (10, _(u'10 kilobyte')),
        (100, _(u'100 kilobyte')),
        (1000, _(u'1 megabyte')),
        (10000, _(u'10 megabyte')),
        (-1, _(u'unlimited')),
   ))

schema = BaseBTreeFolderSchema + Schema((
    TextField('description',
        searchable=1,
        default_content_type='text/html',
        default_output_type='text/plain',
        widget=TextAreaWidget(
            description="Brief description of the forum topic.",
            description_msgid="help_description_forum",
            label="Description",
            label_msgid="label_description_forum",
            i18n_domain="ploneboard",
            rows=5
        )
    ),
    LinesField('category',
         write_permission=ManageForum,
         vocabulary='getCategories',
         widget=MultiSelectionWidget(
            description="Select which category the forum should be listed "
                        "under. A forum can exist in multiple categories, "
                        "although using only one category is recommended.",
            description_msgid="help_category",
            condition="object/getCategories",
示例#25
0
from Products.Archetypes.public import TextField
from Products.Archetypes.public import registerType
from Products.CMFCore.permissions import View
from Products.OrderableReferenceField import OrderableReferenceField
from Products.PloneGazette.config import PROJECTNAME
from archetypes.referencebrowserwidget import ReferenceBrowserWidget


NewsletterRichReferenceSchema = BaseSchema.copy() + Schema((
    TextField(
        'text',
        default='',
        searchable=1,
        required=1,
        default_output_type='text/x-html-safe',
        widget=RichWidget(
            description='',
            description_msgid='help_text',
            i18n_domain="plone",
            label='Text',
            label_msgid='label_text',
        )
    ),
    ImageField(
        name='image',
        widget=ImageWidget(
            description="This image is used as preview for the referenced objects.",
            description_msgid="help_image",
            i18n_domain='plonegazette',
            label='Preview image',
            label_msgid="label_preview_image",
        ),
示例#26
0
#    if config.CREATE_TOPIC_IMAGES_FOLDERS and not has_topic_images:
#        weblog.invokeFactory('Folder', id='topic_images', title='Topic Images')

WeblogSchema = BaseFolderSchema.copy() + Schema(
    (

        # This is sort of cheating.  We are stealing the Dublin Core 'description'
        # field for our purposes, but then I don't seen any reason to duplicate the
        # information.
        TextField(
            'description',
            searchable=1,
            accessor='Description',
            widget=TextAreaWidget(
                label=_('label_weblog_description', default='Description'),
                description=_(
                    'help_weblog_description',
                    default=
                    'A brief description of this weblog. This text will be displayed at the top of the page before any weblog entries.'
                ),
            ),
        ), ),
    marshall=PrimaryFieldMarshaller(),
)

# The subject is not language-specific
WeblogSchema['subject'].languageIndependent = True


def createSpecialFolders(blog, event):
    """Create folders for uploads and topic images. Supposed to be triggered
示例#27
0
        "AccreditationBodyLogo",
        schemata="Accreditation",
        widget=ImageWidget(
            label=_("Accreditation Logo"),
            description=_(
                "Please upload the logo you are authorised to use on your "
                "website and results reports by your accreditation body. "
                "Maximum size is 175 x 175 pixels.")),
    ),
    TextField(
        "AccreditationPageHeader",
        schemata="Accreditation",
        default=DEFAULT_ACCREDITATION_PAGE_HEADER,
        widget=TextAreaWidget(
            label=_("Accreditation page header"),
            description=_(
                "Enter the details of your lab's service accreditations here. "
                "The following fields are available:  lab_is_accredited, "
                "lab_name, lab_country, confidence, accreditation_body_name, "
                "accreditation_standard, accreditation_reference<br/>"),
            rows=10),
    ),
))

IdField = schema["id"]
IdField.widget.visible = {"edit": "hidden", "view": "invisible"}

schema["Name"].validators = ()
# Update the validation layer after change the validator in runtime
schema["Name"]._validationLayer()
from zope import event
from zope.interface import implementer

PBCommentBaseBTreeFolderSchema = BaseBTreeFolderSchema.copy()
PBCommentBaseBTreeFolderSchema['title'].read_permission = ViewBoard
PBCommentBaseBTreeFolderSchema['title'].write_permission = EditComment

schema = PBCommentBaseBTreeFolderSchema + Schema((
    TextField('text',
              searchable=1,
              default_content_type='text/html',
              default_output_type='text/x-html-safe',
              allowable_content_types=('text/html', 'text/plain'),
              accessor='getText',
              read_permission=ViewBoard,
              write_permission=EditComment,
              widget=RichWidget(description="Enter comment body.",
                                description_msgid="help_text",
                                label="Text",
                                label_msgid="label_text",
                                i18n_domain='ploneboard',
                                rows=5,
                                helper_css=('ploneboard.css', ))),
    ReferenceField(
        name='reply_to',
        accessor='inReplyTo',  # Suboptimal accessor naming here...
        edit_accessor='inReplyToUID',
        mutator='setInReplyTo',
        relationship=REPLY_RELATIONSHIP,
        widget=ReferenceWidget(visible=False),
    ),
 StringField('occupation',
             widget=StringWidget(
                 label="Occupation",
                 description="What is your occupation?",
             )),
 StringField('referrer',
             vocabulary=REFERRERS,
             widget=SelectionWidget(
                 label="Referrer",
                 description="How did you hear about Connexions?",
             )),
 TextField(
     'description',
     required=1,
     default_content_type='text/html',
     default_output_type='text/html',
     widget=TextAreaWidget(
         label="Comment",
         description='Your feedback about Connexions (html is allowed)',
     )),
 ImageField(
     'portrait',
     widget=ImageWidget(
         label="Portrait",
         description='Feel free to include a small portrait of yourself',
     )),
 BooleanField(
     'quote_permission',
     default=1,
     widget=BooleanWidget(
         label=
示例#30
0
class NewsletterRichReference(BaseContent, PropertyManager):

    portal_type = meta_type = 'NewsletterRichReference'
    archetype_name = 'Newsletter RichReference'  #this name appears in the 'add' box

    security = ClassSecurityInfo()

    schema = BaseSchema + Schema((
        TextField('text',
                  default='',
                  searchable=1,
                  required=1,
                  default_output_type='text/x-html-safe',
                  widget=RichWidget(label='Text',
                                    description='',
                                    label_msgid='label_text',
                                    description_msgid='help_text',
                                    i18n_domain="plone")),
        ImageField(
            name='image',
            widget=ImageWidget(
                label_msgid="label_preview_image",
                description=
                "This image is used as preview for the referenced objects.",
                description_msgid="help_image",
                label='Preview image',
                i18n_domain='plonegazette',
            ),
            storage=AttributeStorage(),
            sizes={
                'normal': (200, 130),
            }),
        ReferenceField(
            'references',
            languageIndependent=1,
            required=0,
            allowed_types=(),
            multiValued=1,
            relationship='references',
            widget=ReferenceBrowserWidget(
                label='References',
                description='Select one or more remote objects',
                label_msgid='label_references',
                description_msgid='help_references',
                i18n_domain='plonegazette',
                allow_search=1,
                allow_browse=1,
                show_indexes=0,
            ),
        ),
    ))

    # Make sure we get title-to-id generation when an object is created
    _at_rename_after_creation = True

    security.declarePublic('getObjects')

    def getObjects(self):
        """
        """
        return self.getReferences()

    security.declareProtected(View, 'imagetag')

    def imagetag(self, **kwargs):
        """Generate image tag using the api of the ImageField
        
        this method is needed because one must not access
        ImageField.tag in pagetemplates
        """
        if 'title' not in kwargs:
            kwargs['title'] = self.Title()
        return self.getField('image').tag(self, **kwargs)

    # uncommant lines below when you need
    factory_type_information = {
        'allowed_content_types': [],
        'global_allow': 0,
        'content_icon': 'NewsletterReference.gif',
        'immediate_view': 'newsletterreference_view',
        'filter_content_types': 0
    }

    actions = ({
        'id': 'view',
        'name': 'View',
        'category': 'object',
        'action': 'string:${object_url}/NewsletterRichReference_view',
        'permissions': ('View', )
    }, )