예제 #1
0
파일: install.py 프로젝트: styiannis/plumi
def plumi4to41(context, logger=None):
    # add html5 field to transcode.star registry
    registry = getUtility(IRegistry)
    html5_field = Field.Choice(title = u'Choose video embed method',
                               description=u"Choose if you would like to use just the HTML5 video tag, or Flash (Flowplayer) or if you would like to use HTML5 with Flowplayer as failback for browsers that don't support the HTML5 video tag",
                               values = ['HTML5 video tag', 'HTML5 Flash fallback', 'Flash - Flowplayer'],
                               default = "HTML5 Flash fallback",
                              )
    html5_record = Record(html5_field)
    registry.records['collective.transcode.star.interfaces.ITranscodeSettings.html5'] = html5_record

    #update user favorite folders
    users = context.acl_users.getUsers()
    pm = context.portal_membership
    addable_types = ['Link']
    for user in users:
        mf =  pm.getHomeFolder(user.getId())
        try:
            favs = mf.Favorites
            if base_hasattr(favs, 'setConstrainTypesMode'):
                favs.setConstrainTypesMode(1)
                favs.setImmediatelyAddableTypes(addable_types)
                favs.setLocallyAllowedTypes(addable_types)
        except:
            pass
예제 #2
0
    def run(self):
        logger.info("Migrating to collective.documentgenerator 11 ...")

        registry = getUtility(IRegistry)
        records = registry.records
        key = "collective.documentgenerator.browser.controlpanel.IDocumentGeneratorControlPanelSchema.use_stream"

        current_record = api.portal.get_registry_record(key)
        value = True
        if current_record is False:
            value = u"auto"

        record = Record(
            field.Choice(
                title=
                u"Force communication via in/out stream with LibreOffice.",
                description=
                (u"If enabled, this will force using stream to communicate witth LibreOffice server. "
                 u"This must be true if the LO server is not on localhost or is in a docker container."
                 ),
                vocabulary="collective.documentgenerator.ConfigStream",
            ),
            value=value,
        )
        records[key] = record
        api.portal.set_registry_record(key, value)

        self.finish()
예제 #3
0
class IFilterSchema(Interface):
    column_name = field.Choice(
        title=_(u'Column Name'),
        description=_(u'Enter the name of a catalog metadata column'),
        vocabulary='collective.isotope.vocabularies.friendly_columns',
        required=False,
        missing_value=u'')
    label = field.TextLine(
        title=_(u'Label'),
        description=_(
            u'If desired, enter the human-readable label for this column'),
        required=False,
        missing_value=u'')
def upgrade_registry_for_banner_scale(context):
    key_id = 'collective.behavior.banner.browser.controlpanel.IBannerSettingsSchema.banner_scale'  # noqa: E501
    registry = getUtility(IRegistry)
    records = registry.records
    if key_id in records:
        return

    record = Record(field.Choice(
        title=_(u'Banner scale'),
        description=_(u'Scale at which banner images are displayed'),
        required=True,
        vocabulary='collective.behavior.banner.all_sizes',
        default='preview'),
                    value='preview')
    records[key_id] = record
예제 #5
0
    def test_export_with_choice(self):

        xml = """\
<registry>
  <record name="test.export.choice">
    <field type="plone.registry.field.Choice">
      <title>Simple record</title>
      <vocabulary>dummy.vocab</vocabulary>
    </field>
    <value />
  </record>
</registry>"""

        self.registry.records['test.export.choice'] = Record(
            field.Choice(title=u"Simple record", vocabulary=u"dummy.vocab"))

        context = DummyExportContext(self.site)
        exportRegistry(context)

        self.assertEquals('registry.xml', context._wrote[0][0])
        self.assertXmlEquals(xml, context._wrote[0][1])
예제 #6
0
def addContentClassesToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records

    if 'cpskin.core.interfaces.ICPSkinSettings.header_class' in records:  # noqa
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.header_class to registry'
    )  # noqa
    record = Record(
        field.Choice(
            title=_(u'Header related class'),
            description=_(
                u'CSS header class that will be applied to body.'),  # noqa
            required=False,
            values=[
                u'header-1',
                u'header-2',
                u'header-3',
                u'header-4',
            ],
            default=None),
        value=None)
    records['cpskin.core.interfaces.ICPSkinSettings.header_class'] = record

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.columns_class to registry'
    )  # noqa
    record = Record(
        field.Choice(
            title=_(u'Content columns related class'),
            description=_(
                u'CSS content columns class that will be applied to body.'
            ),  # noqa
            required=False,
            values=[
                u'content-1',
                u'content-2',
                u'content-3',
                u'content-4',
            ],
            default=None),
        value=None)
    records['cpskin.core.interfaces.ICPSkinSettings.columns_class'] = record

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.navigation_class to registry'
    )  # noqa
    record = Record(
        field.Choice(
            title=_(u'Navigation related class'),
            description=_(
                u'CSS navigation class that will be applied to body.'),  # noqa
            required=False,
            values=[
                u'navigation-1',
                u'navigation-2',
                u'navigation-3',
                u'navigation-4',
            ],
            default=None),
        value=None)
    records['cpskin.core.interfaces.ICPSkinSettings.navigation_class'] = record

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.footer_class to registry'
    )  # noqa
    record = Record(
        field.Choice(
            title=_(u'Footer related class'),
            description=_(
                u'CSS footer class that will be applied to body.'),  # noqa
            required=False,
            values=[
                u'footer-1',
                u'footer-2',
                u'footer-3',
                u'footer-4',
            ],
            default=None),
        value=None)
    records['cpskin.core.interfaces.ICPSkinSettings.footer_class'] = record