Ejemplo n.º 1
0
class RatingRemover(object):
    """An adapter that adds the rating removal field"""
    adapts(IATDocument)
    implements(ISchemaExtender)

    fields = [
        ReverseInterfaceField(
            "allow_ratings",
            default=True,
            widget=BooleanWidget(
                label=_(u"Enable Ratings"),
                description=_(
                    'allow_ratings_help',
                    default=(u"Check this box to add ratings to this "
                             u"item. Use the control panel to select "
                             u"the ratings shown on each content type."))),
            schemata="settings"),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        """If the product is installed, return our custom field"""
        if queryUtility(IRatingCategoryAssignment) is not None:
            return self.fields
        else:
            return []
Ejemplo n.º 2
0
class ContentTypeExtender(object):
    """Adapter that adds custom metadata."""
    adapts(IATContentType)

    implements(ISchemaExtender)

    _fields = [
        InterfaceMarkerField(
            "flaggedobject",
            schemata="settings",
            interfaces=(IFlaggableObject, ),
            languageIndependent=True,
            widget=BooleanWidget(
                label=_(u"label_flaggedobject_title",
                        default=u"Special object"),
                description=_(u"help_flaggedobject",
                              default=u"Mark this object as special."),
            ),
        ),
    ]

    def __init__(self, contentType):
        pass

    def getFields(self):
        return self._fields
Ejemplo n.º 3
0
class SearchExtender(object):
    """Adapter that adds search metadata."""

    implements(ISchemaExtender)

    _fields = [
        extender.ExtensionBooleanField(
            'showinsearch',
            languageIndependent=True,
            schemata='settings',
            default=True,
            write_permission='ftw.solr: Edit search settings',
            widget=BooleanWidget(
                label=_(u'label_showinsearch', default=u'Show in search'),
                visible={
                    "edit": "visible",
                    "view": "invisible"
                },
                description="",
            )),
        extender.ExtentionTextField(
            'searchwords',
            searchable=False,
            schemata='settings',
            languageIndependent=False,
            write_permission='ftw.solr: Edit search settings',
            allowable_content_types='text/plain',
            widget=TextAreaWidget(
                label=_(u'label_searchwords', default=u'Search words'),
                description=_(
                    u'help_searchwords',
                    default=u'Specify words for which this item will show up '
                    'as the first search result. Multiple words can be '
                    'specified on new lines.'),
                visible={
                    "edit": "visible",
                    "view": "invisible"
                },
            )),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self._fields
Ejemplo n.º 4
0
class SearchExtender(object):
    """Adapter that adds search metadata."""

    implements(ISchemaExtender, IBrowserLayerAwareExtender)
    layer = IThemeSpecific

    _fields = [
        ExtensionBooleanField('showinsearch',
                              languageIndependent=True,
                              schemata='settings',
                              default=True,
                              widget=BooleanWidget(
                                  label=_('label_showinsearch',
                                          default=u"Show in search"),
                                  visible={
                                      "edit": "visible",
                                      "view": "invisible"
                                  },
                                  description="",
                              )),
        ExtentionTextField(
            'searchwords',
            searchable=True,
            schemata='settings',
            languageIndependent=False,
            widget=TextAreaWidget(
                label=_('label_searchwords', default=u"Search words"),
                description=_(
                    'help_searchwords',
                    u"Specify words for which this item will show up "
                    u"as the first search result. Multiple words can be "
                    u"specified on new lines."),
                visible={
                    "edit": "visible",
                    "view": "invisible"
                },
            )),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self._fields
class FolderTypeExtender(object):
    """Adapter that adds custom data used for image size."""
    adapts(IATFolder)
    implements(ISchemaExtender, IBrowserLayerAwareExtender)
    layer = IFolderObject

    _fields = [
        _StringExtensionField(
            "folderimagesize",
            schemata="settings",
            default_method=default_folder_settings,
            vocabulary_factory='medialog.newsitemview.ImageSizeVocabulary',
            interfaces=(INewsitemObject, ),
            widget=SelectionWidget(
                label=_(u"label_folderimagesize",
                        default=u"Size for image in summary view"),
                description=_(u"help_folderimagesize", default=u"Choose Size"),
            ),
        ),
        _BooleanExtensionField(
            "hide_images",
            schemata="settings",
            interfaces=(INewsitemObject, ),
            default_method=default_hideimages_settings,
            widget=BooleanWidget(
                label=_(u"label_hide_images",
                        default=u"Hide Images in the summary view"),
                description=_(u"help_hide_images",
                              default=u"Hide images from the folder view"),
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self._fields
Ejemplo n.º 6
0
    def formatted_value(self, value):
        """ Format value from temporal widget
        """
        try:
            return "\n".join(grouped_coverage(value))
        except ValueError:
            return "\n".join(value)


PRODUCT_SCHEMA = Schema((
    # DEFAULT =================================================================
    BooleanField(
        name='isValidatedDataset',
        schemata="default",
        widget=BooleanWidget(
            label=("Is Validated Dataset"),
            description=("Check this only if dataset is validated.")
        ),
    ),
    StringField(
        name='notValidatedCustomText',
        widget=StringWidget(
            label="Custom text for not validated",
            description=(
                "If this dataset is not validated you can set a "
                "custom label text here."),
            i18n_domain='eea',
        ),
        default="",
        searchable=False,
        schemata="default",
    ),
Ejemplo n.º 7
0
     'AutoLogOff',
     schemata="Security",
     required=1,
     default=0,
     widget=IntegerWidget(
         label=_("Automatic log-off"),
         description=_(
             "The number of minutes before a user is automatically logged off. "
             "0 disables automatic log-off"),
     )),
 BooleanField(
     'RestrictWorksheetUsersAccess',
     schemata="Security",
     default=True,
     widget=BooleanWidget(
         label=_("Allow access to worksheets only to assigned analysts"),
         description=_(
             "If unchecked, analysts will have access to all worksheets."))
 ),
 BooleanField(
     'AllowToSubmitNotAssigned',
     schemata="Security",
     default=True,
     widget=BooleanWidget(
         label=_("Allow to submit results for unassigned analyses or for "
                 "analyses assigned to others"),
         description=_(
             "If unchecked, users will only be able to submit results "
             "for the analyses they are assigned to, and the submission of "
             "results for unassigned analyses won't be permitted. This "
             "setting does not apply to users with role Lab Manager"))),
 BooleanField(
     required=1,
     default=0,
     read_permission="SignupSheet: View Registration Info",
     validators=('isInt',),
     widget=StringWidget(
         visible={'edit': 'visible', 'view': 'invisible'},
         size=6,
         label=_('field_waitlist_size',
                 default=u'Size of wait list',),
         )
     ),
 BooleanField('display_size_left',
     default=False,
     widget=BooleanWidget(
         visible={'edit': 'visible', 'view': 'invisible'},
         label=_('field_display_size_left', default=u'Display seats left'),
         description=_('fieldhelp_display_size_left',
                       default=u"Choose to show in the subscription page the number of seats left",)
         )
     ),
 DateTimeField('startDate',
     required=False,
     searchable=False,
     accessor='start',
     write_permission=ModifyPortalContent,
     languageIndependent=True,
     widget=CalendarWidget(
         description='',
         label=_E(u'label_event_start', default=u'Event Starts')
         )
     ),
 DateTimeField('endDate',
Ejemplo n.º 9
0
from Products.ATContentTypes.criteria import registerCriterion
from Products.ATContentTypes.criteria import SORT_INDICES
from Products.ATContentTypes.interfaces import IATTopicSortCriterion
from Products.ATContentTypes.permission import ChangeTopics
from Products.ATContentTypes.criteria.base import ATBaseCriterion
from Products.ATContentTypes.criteria.schemata import ATBaseCriterionSchema

from Products.ATContentTypes import ATCTMessageFactory as _

ATSortCriterionSchema = ATBaseCriterionSchema + Schema((BooleanField(
    'reversed',
    required=0,
    mode="rw",
    write_permission=ChangeTopics,
    default=0,
    widget=BooleanWidget(label=_(u'Reverse')),
), ))


class ATSortCriterion(ATBaseCriterion):
    """A sort criterion"""

    implements(IATTopicSortCriterion)
    security = ClassSecurityInfo()
    schema = ATSortCriterionSchema
    meta_type = 'ATSortCriterion'
    archetype_name = 'Sort Criterion'
    shortDesc = 'Sort'

    security.declareProtected(View, 'getCriteriaItems')
Ejemplo n.º 10
0
 TextField(name='sparql_query',
           default_content_type='text/plain',
           allowable_content_types=('text/plain', ),
           widget=TextAreaWidget(
               macro="sparql_textfield_with_preview",
               helper_js=("sparql_textfield_with_preview.js", ),
               helper_css=("sparql_textfield_with_preview.css", ),
               label="Query",
           ),
           required=1,
           validators=('isSparqlOverLimit', )),
 BooleanField(name='sparql_static',
              widget=BooleanWidget(
                  label='Static query',
                  description='The data will be fetched only once',
                  visible={
                      'edit': 'invisible',
                      'view': 'invisible'
                  }),
              default=False,
              required=0),
 TextField(
     name='sparql_results',
     widget=TextAreaWidget(label="Results",
                           visible={
                               'edit': 'invisible',
                               'view': 'invisible'
                           }),
     required=0,
 ),
 BlobField(
Ejemplo n.º 11
0
                   allowed_types=('Instrument', ),
                   relationship='InstrumentCertificationInstrument',
                   widget=StringWidget(visible=False, )),
    ComputedField(
        'InstrumentUID',
        expression=
        'context.getInstrument() and context.getInstrument().UID() or None',
        widget=ComputedWidget(visible=False, ),
    ),

    # Set the Certificate as Internal
    # When selected, the 'Agency' field is hidden
    BooleanField('Internal',
                 default=False,
                 widget=BooleanWidget(
                     label=_("Internal Certificate"),
                     description=_(
                         "Select if is an in-house calibration certificate"))),
    StringField(
        'Agency',
        widget=StringWidget(
            label=_("Agency"),
            description=
            _("Organization responsible of granting the calibration certificate"
              )),
    ),
    DateTimeField(
        'Date',
        widget=DateTimeWidget(
            label=_("Date"),
            description=_("Date when the calibration certificate was granted"),
        ),
Ejemplo n.º 12
0
        allowed_types=('Method', ),
        relationship='InstrumentMethods',
        required=0,
        multiValued=1,
        widget=PicklistWidget(
            size=10,
            label=_("Methods"),
        ),
    ),
    BooleanField(
        'DisposeUntilNextCalibrationTest',
        default=False,
        widget=BooleanWidget(
            label=_("De-activate until next calibration test"),
            description=
            _("If checked, the instrument will be unavailable until the next valid "
              "calibration was performed. This checkbox will automatically be unchecked."
              ),
        ),
    ),

    # Procedures
    TextField(
        'InlabCalibrationProcedure',
        schemata='Procedures',
        default_content_type='text/plain',
        allowed_content_types=('text/plain', ),
        default_output_type="text/plain",
        widget=TextAreaWidget(
            label=_("In-lab calibration procedure"),
            description=
Ejemplo n.º 13
0
                       label=_(u'label_path_criteria_value',
                               default=u'Folders'),
                       description=_(u'help_path_criteria_value',
                                     default=u'Folders to search in.'),
                       base_query={'is_folderish': True},
                       restrict_browse=True,
                       startup_directory='../')),
    BooleanField(
        'recurse',
        mode="rw",
        write_permission=ChangeTopics,
        accessor="Recurse",
        default=False,
        widget=BooleanWidget(
            label=_(u'label_path_criteria_recurse',
                    default=u'Search Sub-Folders'),
            description='',
        ),
    ),
))


class ATPathCriterion(ATBaseCriterion):
    """A path criterion"""

    implements(IATTopicSearchCriterion)

    security = ClassSecurityInfo()
    schema = ATPathCriterionSchema
    meta_type = 'ATPathCriterion'
    archetype_name = 'Path Criterion'
Ejemplo n.º 14
0
# for ATContentTypes we want to have the description in the edit view
# just like CMF
ATContentTypeSchema = BaseSchema.copy() + MetadataSchema(
    (
        BooleanField(
            'excludeFromNav',
            required=False,
            languageIndependent=True,
            schemata='metadata',  # moved to 'default' for folders
            widget=BooleanWidget(
                description=_(
                    u'help_exclude_from_nav',
                    default=
                    u'If selected, this item will not appear in the navigation tree'
                ),
                label=_(u'label_exclude_from_nav',
                        default=u'Exclude from navigation'),
                visible={
                    'view': 'hidden',
                    'edit': 'visible'
                },
            ),
        ), ), )

ATContentTypeSchema['id'].searchable = True
ATContentTypeSchema['id'].validators = ('isValidId', )

# Update the validation layer after change the validator in runtime
ATContentTypeSchema['id']._validationLayer()

ATContentTypeSchema['description'].schemata = 'default'
Ejemplo n.º 15
0
class TimelineExtender(object):
    adapts(IBaseContent)
    implements(ISchemaExtender)

    fields = [
        ExtensionBooleanField(
            'use_pub_date',
            schemata='Timeline Config',
            widget=BooleanWidget(
                label=_(u'Use Publication Date(s)'),
                visible={'view': 'invisible'},
            ),
        ),
        ExtensionDateTimeField(
            'timeline_date',
            schemata='Timeline Config',
            widget=StringWidget(
                label=_(u'Custom Timeline Date'),
                description=
                _(u'Must be entered as "YYYY-MM-DD" or a standalone year (e.g. "0525-02-23" or "25" for year 25)'
                  ),
                visible={'view': 'invisible'},
            )),
        ExtensionDateTimeField(
            'timeline_end',
            schemata='Timeline Config',
            widget=StringWidget(
                label=_(u'Timeline End Date'),
                description=
                _(u'Must be entered as "YYYY-MM-DD" or a standalone year (e.g. "0525-02-23" or "25" for year 25)'
                  ),
                visible={'view': 'invisible'},
            )),
        ExtensionBooleanField(
            'bce_year',
            schemata='Timeline Config',
            widget=BooleanWidget(
                label=_(u'Year is BCE'),
                visible={'view': 'invisible'},
            ),
        ),
        ExtensionBooleanField(
            'year_only',
            schemata='Timeline Config',
            widget=BooleanWidget(
                label=_(u'Display year only on timeline'),
                visible={'view': 'invisible'},
            ),
        ),
        ExtensionBooleanField(
            'show_tag',
            schemata='Timeline Config',
            default=False,
            widget=BooleanWidget(
                label=_(u'Show first tag in timeline'),
                visible={'view': 'invisible'},
            ),
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        # Don't add fields for events
        if IATEvent.providedBy(self.context):
            return []
        return self.fields
Ejemplo n.º 16
0
         description=_(
             "help_exit_url",
             default=u'This is the URL that the user will be directed to '
             u'on completion of the survey.\n'
             u'Use "http://site.to.go.to/page" or "route/to/page" '
             u'for this portal'),
     ),
 ),
 BooleanField(
     'confidential',
     searchable=0,
     required=0,
     widget=BooleanWidget(
         label=_(u"label_confidential", default=u"Confidential"),
         description=_(
             "help_confidential",
             default=u"Prevent respondents usernames from appearing in "
             u"results"),
     ),
 ),
 BooleanField(
     'allowAnonymous',
     searchable=0,
     required=0,
     widget=BooleanWidget(
         label=_('label_allow_anonymous', default=u"Allow Anonymous"),
         description=_(
             'help_allow_anonymous',
             default=u"Anonymous user will be able to fill the survey"),
     ),
 ),
Ejemplo n.º 17
0
from Acquisition import aq_base

from directory import ReflectoDirectoryBase, ReflectoNullResource

ReflectoSchema = ATContentTypeSchema.copy() + Schema((
    InterfaceField("life",
        write_permission = AddReflectorFolder,
        required = False,
        default = False,
        interface = ILifeProxy,
        widget = BooleanWidget(
            label = "Show live data",
            label_msgid = "life_label",
            description = "If this flag is set the live contents of the "
                          "filesystem will be shown. This makes Reflecto "
                          "a lot slower and prevents indexing of files. "
                          "Please note that due to browser caching and "
                          "proxy servers users may still see cached older "
                          "data.",
            description_msgid = "life_help",
            i18n_domain = "plone"),
        ),

    StringField("relativePath",
        write_permission = AddReflectorFolder,
        required = True,
        validators = ( "isValidFilesystemPath", ),
        widget = StringWidget(
            label = "Filesystem path",
            label_msgid = "reflex_path_label",
            description = "Please specify the directory which should be "
Ejemplo n.º 18
0
            description=_("Select the preferred instrument"),
        ),
    ),
    ComputedField('InstrumentTitle',
        expression = "context.getInstrument() and context.getInstrument().Title() or ''",
        widget = ComputedWidget(
            visible = False,
        ),
    ),
    BooleanField(
        'EnableMultipleUseOfInstrument',
        default=True,
        schemata="Description",
        widget=BooleanWidget(
            label=_("Enable Multiple Use of Instrument in Worksheets."),
            description=_("If unchecked, \
                          Lab Managers won't be able to assign the same Instrument more than one Analyses while \
                          creating a Worksheet.")
        )
    ),
))

schema['title'].schemata = 'Description'
schema['title'].widget.visible = True

schema['description'].schemata = 'Description'
schema['description'].widget.visible = True


class WorksheetTemplate(BaseContent):
    security = ClassSecurityInfo()
    displayContentsTab = False
Ejemplo n.º 19
0
def update_item_schema(baseSchema):
    specificSchema = Schema((
        StringField(
            name='refdoc',
            default_method="getDocReference",
            widget=StringWidget(
                size=100,
                label='Refdoc',
                label_msgid='MeetingAndenne_label_refDoc',
                i18n_domain='PloneMeeting',
            ),
            searchable=True,
        ),
        StringField(
            name='verifUser',
            default_method="Creator",
            widget=StringWidget(
                visible=False,
                format="select",
                label='Verifuser',
                label_msgid='MeetingAndenne_label_verifUser',
                i18n_domain='PloneMeeting',
            ),
            searchable=True,
        ),
        StringField(name='yourrefdoc',
                    widget=StringWidget(
                        size=100,
                        label='yourRefdoc',
                        label_msgid='MeetingAndenne_label_yourrefDoc',
                        i18n_domain='PloneMeeting',
                    ),
                    searchable=True),
        StringField(
            name='treatUser',
            default_method="Creator",
            widget=SelectionWidget(
                format="select",
                label='Treatuser',
                label_msgid='MeetingAndenne_label_treatUser',
                i18n_domain='PloneMeeting',
            ),
            vocabulary='listTreatUsers',
            searchable=True,
        ),
        TextField(name='projetpv',
                  widget=RichWidget(
                      rows=15,
                      label='Projetpv',
                      label_msgid='MeetingAndenne_label_projetpv',
                      i18n_domain='PloneMeeting',
                  ),
                  read_permission="PloneMeeting: Read decision",
                  default_content_type="text/html",
                  searchable=True,
                  write_permission="PloneMeeting: Write decision",
                  allowable_content_types=('text/html', ),
                  default_output_type="text/html"),
        TextField(name='pv',
                  widget=RichWidget(
                      rows=15,
                      label='Pv',
                      label_msgid='MeetingAndenne_label_pv',
                      i18n_domain='PloneMeeting',
                  ),
                  read_permission="MeetingAndenne: Read pv",
                  default_content_type="text/html",
                  searchable=True,
                  write_permission="MeetingAndenne: Write pv",
                  allowable_content_types=('text/html', ),
                  default_output_type="text/html"),
        TextField(name='textpv',
                  widget=RichWidget(
                      rows=15,
                      label='Textpv',
                      label_msgid='MeetingAndenne_label_textpv',
                      i18n_domain='PloneMeeting',
                  ),
                  read_permission="MeetingAndenne: Read pv",
                  default_content_type="text/html",
                  searchable=True,
                  write_permission="MeetingAndenne: Write pv",
                  allowable_content_types=('text/html', ),
                  default_output_type="text/html"),
        BooleanField(name='isconfidential',
                     widget=BooleanWidget(
                         label='IsConfidential',
                         label_msgid='MeetingAndenne_label_isConfidential',
                         i18n_domain='PloneMeeting',
                     ),
                     searchable=True,
                     default=False),
        LinesField(
            name='itemPresents',
            widget=MultiSelectionWidget(
                visible=False,
                format="checkbox",
                label='Itempresents',
                label_msgid='MeetingAndenne_label_itemPresents',
                i18n_domain='PloneMeeting',
            ),
            multiValued=1,
        ),
    ), )

    completeItemSchema = baseSchema + specificSchema.copy()
    completeItemSchema[
        'title'].widget.condition = "python: not hasattr(here, 'template') or not here.queryState()=='itemcreated' or here.portal_membership.getAuthenticatedMember().has_role('Manager')"

    completeItemSchema[
        'copyGroups'].write_permission = "MeetingAndenne: Write copygroup"
    completeItemSchema[
        'description'].widget.label_method = 'getLabelForDescription'
    completeItemSchema['budgetInfos'].widget.rows = 12
    completeItemSchema['itemSignatories'].optional = True
    completeItemSchema[
        'proposingGroup'].default_method = "getDefaultProposingGroup"
    completeItemSchema[
        'notes'].read_permission = "PloneMeeting: Read item observations"
    completeItemSchema[
        'notes'].write_permission = "PloneMeeting: Write item observations"
    completeItemSchema['votesAreSecret'].default = True

    completeItemSchema['category'].widget = DynatreeWidget(
        condition="python: here.showCategory()",
        description="Category",
        description_msgid="item_category_descr",
        label='Category',
        label_msgid='PloneMeeting_label_category',
        i18n_domain='PloneMeeting',
        leafsOnly=True,
        rootVisible=True,
        selectMode=1,
        sparse=False,
    )
    completeItemSchema['category'].vocabulary = SubCategoriesVocabulary()

    completeItemSchema.moveField('refdoc', pos='top')
    completeItemSchema.moveField('yourrefdoc', pos=2)
    completeItemSchema.moveField('treatUser', pos=8)
    completeItemSchema.moveField('projetpv', pos=25)
    completeItemSchema.moveField('pv', pos=25)
    completeItemSchema.moveField('textpv', pos=24)
    completeItemSchema.moveField('isconfidential', pos='top')

    return completeItemSchema
Ejemplo n.º 20
0
              #validators=('isTidyHtml',),
              default_output_type='text/x-html-safe',
              widget=RichWidget(
                        description='',
                        label=_(u'label_body_text', default=u'Body Text'),
                        rows=25,
                        allow_file_upload=zconf.ATDocument.allow_document_upload),
    ),

    BooleanField('presentation',
        required=False,
        languageIndependent=True,
        widget=BooleanWidget(
            label=_(
                u'help_enable_presentation',
                default=u'Presentation mode'),
            description=_(
                u'help_enable_presentation_description',
                default=u'If selected, this will give users the ability to view the contents as presentation slides.')
            ),
    ),

    BooleanField('tableContents',
        required=False,
        languageIndependent=True,
        widget=BooleanWidget(
            label=_(
                u'help_enable_table_of_contents',
                default=u'Table of contents'),
            description=_(
                u'help_enable_table_of_contents_description',
                default=u'If selected, this will show a table of contents at the top of the page.')
Ejemplo n.º 21
0
     schemata="Security",
     required=1,
     default=0,
     widget=IntegerWidget(
         label=_("Automatic log-off"),
         description=_(
             "The number of minutes before a user is automatically logged off. "
             "0 disables automatic log-off"),
     )
 ),
 BooleanField(
     'AllowClerksToEditClients',
     schemata="Security",
     default=False,
     widget=BooleanWidget(
         label=_("Allow Lab Clerks to create and edit clients"),
     )
 ),
 BooleanField(
     'RestrictWorksheetUsersAccess',
     schemata="Security",
     default=True,
     widget=BooleanWidget(
         label=_("Allow access to worksheets only to assigned analysts"),
         description=_("If unchecked, analysts will have access to all worksheets.")
     )
 ),
 BooleanField(
     'RestrictWorksheetManagement',
     schemata="Security",
     default=True,
Ejemplo n.º 22
0
            description_msgid="help_relativepath_criteria_customrelativepath",
            i18n_domain="plone",
            description=u"Enter a relative path e.g.: <br /> '..' for the "
            u"parent folder <br /> '../..' for the parent's parent <br />"
            u"'../somefolder' for a sibling folder")
    ),

    BooleanField(
        'recurse',
        mode="rw",
        write_permission=ChangeTopics,
        accessor="Recurse",
        default=False,
        widget=BooleanWidget(
            label="Search Sub-Folders",
            label_msgid="label_path_criteria_recurse",
            description="",
            description_msgid="help_path_criteria_recurse",
            i18n_domain="plone"),
    ),
))


@implementer(IATTopicSearchCriterion)
class ATRelativePathCriterion(ATBaseCriterion):
    """A path criterion"""

    security = ClassSecurityInfo()
    schema = ATRelativePathCriterionSchema
    meta_type = 'ATRelativePathCriterion'
    archetype_name = 'Relative Path Criterion'
    shortDesc = 'Location in site relative to the current location'
Ejemplo n.º 23
0
from Products.CMFCore.permissions import View

from Products.ATContentTypes.content.base import ATCTOrderedFolder
from Products.ATContentTypes.content.document import finalizeATCTSchema

from Products.ATContentTypes.lib.constraintypes import ConstrainTypesMixinSchema

schema = ATCTOrderedFolder.schema.copy() + ConstrainTypesMixinSchema + Schema((
    StringField('description',
                isMetadata=1,
                accessor='Description',
                searchable=1,                
                widget=TextAreaWidget(label='Description', description='Give a short description for this template.'),),
    BooleanField('showUsage',
                 default = False,
                 widget=BooleanWidget(label='Show template description and instructions', 
                                      description='When checked, a page with instructions for this template will be displayed before the actual template items are created.')),                
    TextField('usage',
                searchable=1,
                required=0,
                primary=1,
                default_output_type = 'text/x-html-safe',
                allowable_content_types=('text/html',),
                widget=RichWidget(allow_file_upload=0, label='Instructions for the user', 
                                  allow_format_edit=0,
                                  description="")),
        ))

finalizeATCTSchema(schema)

class Template(ATCTOrderedFolder):
    """A Template is a container that can hold any kind of content. After
Ejemplo n.º 24
0
        default='sortable_title',
        widget=StringWidget(
            label=_(u'Sort the collection on this index'),
            description='',
            visible=False,
        ),
    ),

    BooleanField(
        name='sort_reversed',
        required=False,
        mode='rw',
        default=False,
        widget=BooleanWidget(
            label=_(u'Sort the results in reversed order'),
            description='',
            visible=False,
        ),
    ),

    IntegerField(
        name='limit',
        required=False,
        mode='rw',
        default=1000,
        widget=IntegerWidget(
            label=_(u'Limit Search Results'),
            description=_(u"Specify the maximum number of items to show.")
        ),
    ),
Ejemplo n.º 25
0
            # validators=('isTidyHtml',),
            default_output_type='text/x-html-safe',
            widget=TinyMCEWidget(
                description='',
                label=_(u'label_body_text', default=u'Body Text'),
                rows=25,
                allow_file_upload=zconf.ATDocument.allow_document_upload),
        ),
        BooleanField(
            'tableContents',
            required=False,
            languageIndependent=True,
            widget=BooleanWidget(
                label=_(u'help_enable_table_of_contents',
                        default=u'Table of contents'),
                description=_(
                    u'help_enable_table_of_contents_description',
                    default=u'If selected, this will show a table of contents '
                    u'at the top of the page.')),
        )),
    marshall=RFC822Marshaller())

ATDocumentSchema['description'].widget.label = \
    _(u'label_summary', default=u'Summary')

finalizeATCTSchema(ATDocumentSchema)
# moved schema setting after finalizeATCTSchema, so the order of the fieldsets
# is preserved
ATDocumentSchema.changeSchemataForField('tableContents', 'settings')

class SlideshowExtender(object):
    adapts(IATDocument)
    implements(ISchemaExtender, IBrowserLayerAwareExtender)

    layer = IUOLImagesThemeLayer

    fields = [
        ExReferenceField('slideshow_gallery',
            schemata='slideshow',
            relationship='relatesToGallery',
            multiValued=True,
            write_permission=ModifyPortalContent,
            allowed_types=("Gallery", ),
            keepReferencesOnCopy=True,
            storage=AnnotationStorage(),
            widget=ReferenceBrowserWidget(
                allow_search=True,
                allow_browse=True,
                show_indexes=False,
                force_close_on_insert=True,
                label=u'Slideshow gallery',
            )
        ),

        ExIntegerField('image_count',
            schemata='slideshow',
            required=True,
            default=0,
            write_permission = ModifyPortalContent,
            languageIndependent=True,
            storage=AnnotationStorage(),
            widget=StringWidget(
                description='Enter 0 for all images',
                label=u'Number of images to show'
            )
        ),

        ExBooleanField('show_captions',
            default=True,
            schemata='slideshow',
            widget = BooleanWidget(
                label="Show image captions"
            )
        ),

        ExIntegerField('time_delay',
            schemata='slideshow',
            required=True,
            default=2,
            write_permission = ModifyPortalContent,
            languageIndependent=True,
            storage=AnnotationStorage(),
            widget=StringWidget(
                description='',
                label=u'Time delay in seconds'
            )
        ),

        ExStringField('scale',
            schemata='slideshow',
            required=True,
            default='preview',
            write_permission = ModifyPortalContent,
            languageIndependent=True,
            vocabulary_factory="uniofleicester.jsimages.imagesscalevocabulary",
            enforceVocabulary=1,
            storage=AnnotationStorage(),
            widget=SelectionWidget(
                description='',
                label=u'Image scale to display'
            )
        ),
    ]

    def __init__(self, context):
        self.context = context

    def getFields(self):
        return self.fields
Ejemplo n.º 27
0
                    i18n_domain='EEAEnquiry',
                )),
    StringField(name='region',
                widget=StringWidget(
                    description="Please enter your state or region.",
                    label='Region',
                    label_msgid='EEAEnquiry_label_region',
                    description_msgid='EEAEnquiry_help_region',
                    i18n_domain='EEAEnquiry',
                )),
    BooleanField(
        name='subscribed',
        default=True,
        widget=BooleanWidget(
            label=("I would like to receive email notifications on free to "
                   "download reports and other products published by EEA"),
            label_msgid='EEAEnquiry_label_subscribed',
            i18n_domain='EEAEnquiry',
        )),
    ReferenceField(name='enquiries',
                   widget=ReferenceWidget(
                       label='Enquiries',
                       label_msgid='EEAEnquiry_label_enquiries',
                       i18n_domain='EEAEnquiry',
                   ),
                   allowed_types=('Enquiry', ),
                   multiValued=1,
                   relationship='enquiries'),
), )

schema['enquiries'].widget.visible = {'edit': 'invisible'}
Ejemplo n.º 28
0
        validators = (validators.POSITIVE_NUMBER_VALIDATOR_NAME, ),
        widget = IntegerWidget(
            label = "Maximum number of attempts",
            label_msgid = "label_max_tries",
            description = "Maximum number of attempts, 0 means unlimited",
            description_msgid = "help_max_tries",
            i18n_domain = config.I18N_DOMAIN,
        ),
    ),

    BooleanField('wrapAnswer',
        default=True,
        widget=BooleanWidget(
            label="Enable word wrap in the Answer text area",
            description="If selected, text entered in the Answer field will be word-wrapped.  Disable word wrap if students are supposed to enter program code or similar notations.",
            label_msgid='label_wrapAnswer',
            description_msgid='help_wrapAnswer',
            i18n_domain=config.I18N_DOMAIN,
        ),
    ),

    BooleanField('sendNotificationEmail',
        default=False,
        widget=BooleanWidget(
            label="Send notification e-mail messages",
            description="If selected, the owner of this assignment box will receive an e-mail message each time an assignment is submitted.",
            label_msgid='label_sendNotificationEmail',
            description_msgid='help_sendNotificationEmail',
            i18n_domain=config.I18N_DOMAIN,
        ),
    ),
Ejemplo n.º 29
0
from Products.ATContentTypes.criteria import registerCriterion
from Products.ATContentTypes.criteria.base import ATBaseCriterion
from Products.ATContentTypes.criteria.schemata import ATBaseCriterionSchema
from Products.ATContentTypes.interfaces import IATTopicSearchCriterion
from Products.ATContentTypes.permission import ChangeTopics
from Products.CMFCore.permissions import View
from zope.interface import implements

ATBooleanCriterionSchema = ATBaseCriterionSchema + Schema((BooleanField(
    'bool',
    required=1,
    mode="rw",
    write_permission=ChangeTopics,
    default=None,
    widget=BooleanWidget(label=_(u'label_boolean_criteria_bool',
                                 default=u'Value'),
                         description=_(u'help_boolean_criteria_bool',
                                       default=u'True or false')),
), ))


class ATBooleanCriterion(ATBaseCriterion):
    """A boolean criterion"""

    implements(IATTopicSearchCriterion)

    security = ClassSecurityInfo()
    schema = ATBooleanCriterionSchema
    meta_type = 'ATBooleanCriterion'
    archetype_name = 'Boolean Criterion'
    shortDesc = 'Boolean (True/False)'
Ejemplo n.º 30
0
         description='',
         label=_(u'label_body_text', default=u'Body Text'),
         rows=25,
         allow_file_upload=zconf.ATDocument.allow_document_upload),
 ),
 BooleanField(
     'acquireCriteria',
     required=False,
     mode="rw",
     default=False,
     write_permission=ChangeTopics,
     widget=BooleanWidget(
         label=_(u'label_inherit_criteria', default=u'Inherit Criteria'),
         description=_(
             u'help_inherit_collection_criteria',
             default=
             u"Narrow down the search results from the parent Collection(s) "
             "by using the criteria from this Collection."),
         # Only show when the parent object is a Topic also,
         condition="python:object.aq_parent.portal_type == 'Topic'"),
 ),
 BooleanField(
     'limitNumber',
     required=False,
     mode="rw",
     default=False,
     write_permission=ChangeTopics,
     widget=BooleanWidget(
         label=_(u'label_limit_number', default=u'Limit Search Results'),
         description=_(u'help_limit_number',
                       default=u"If selected, only the 'Number of Items' "