def addMediaViewletVideosToRegistry(value): registry = getUtility(IRegistry) records = registry.records if 'cpskin.core.interfaces.ICPSkinSettings.media_viewlet_visible_videos' in records: return logger.info( 'Adding cpskin.core.interfaces.ICPSkinSettings.media_viewlet_visible_videos to registry' ) # noqa record = Record( field.Bool( title=_(u'Viewlet media : Visible videos'), description=_( u'Number of visible videos on media viewlet.'), # noqa required=False, default=1), value=value) records[ 'cpskin.core.interfaces.ICPSkinSettings.media_viewlet_visible_videos'] = record # noqa
def add_breadcrumbs_below_title_option(context): registry = getUtility(IRegistry) records = registry.records logger.info( "Adding cpskin.diazotheme.newDream.interfaces.INewDreamSettings.breadcrumbs_below_title to registry" ) # noqa record = Record( field.Bool( title=_(u"Breadcrumbs below title"), description=_(u"Show breadcrumbs below page title?"), required=False, default=False, ), value=False, ) records[ "cpskin.diazotheme.newDream.interfaces.INewDreamSettings.breadcrumbs_below_title"] = record # noqa add_theme_parameter_expression('is_breadcrumbs_below_title', 'context/@@is_breadcrumbs_below_title')
def addCollapseMinisiteMenuToRegistry(): registry = getUtility(IRegistry) records = registry.records if 'cpskin.core.interfaces.ICPSkinSettings.collapse_minisite_menu' in records: # noqa return logger.info( 'Adding cpskin.core.interfaces.ICPSkinSettings.collapse_minisite_menu to registry' ) # noqa record = Record( field.Bool( title=_(u'Collapse menu on minisites'), description=_( u'Automatically collapse portal main menu on minisites.' ), # noqa required=False, default=False), value=False) records[ 'cpskin.core.interfaces.ICPSkinSettings.collapse_minisite_menu'] = record # noqa
def addDescriptionOnThemesOptionToRegistry(): registry = getUtility(IRegistry) records = registry.records if 'cpskin.core.interfaces.ICPSkinSettings.show_description_on_themes' in records: # noqa return logger.info( 'Adding cpskin.core.interfaces.ICPSkinSettings.show_description_on_themes to registry' ) # noqa record = Record( field.Bool( title=_(u'Show description on themes'), description=_( u'Add content description after every portal tab menu title.' ), # noqa required=False, default=False), value=False) records[ 'cpskin.core.interfaces.ICPSkinSettings.show_description_on_themes'] = record # noqa
def addShowSloganToRegistry(): registry = getUtility(IRegistry) records = registry.records if 'cpskin.core.interfaces.ICPSkinSettings.show_slogan' in records: return logger.info( 'Adding cpskin.core.interfaces.ICPSkinSettings.show_slogan to registry' ) # noqa record = Record( field.Bool( title=_(u'Show slogan with banner'), description=_( u'Show banner title and description as homepage slogan.' ), # noqa required=False, default=False), value=False) records[ 'cpskin.core.interfaces.ICPSkinSettings.show_slogan'] = record # noqa
def addPersonContactCoreFallbackToRegistry(): registry = getUtility(IRegistry) records = registry.records if 'cpskin.core.interfaces.ICPSkinSettings.person_contact_core_fallback' in records: # noqa return logger.info( 'Adding cpskin.core.interfaces.ICPSkinSettings.person_contact_core_fallback to registry' ) # noqa record = Record( field.Bool( title=_(u'Contact properties fallback?'), description= _(u'Do you want than contact properties fallback? Sample :If no tel on a person, so we get phone thanks to person\'f function.' ), # noqa required=False, default=False), value=False) records[ 'cpskin.core.interfaces.ICPSkinSettings.person_contact_core_fallback'] = record # noqa
def addTopMenuLeadImageToRegistry(): registry = getUtility(IRegistry) records = registry.records if 'cpskin.core.interfaces.ICPSkinSettings.show_leadimage_in_action_menu' in records: # noqa return logger.info( 'Adding cpskin.core.interfaces.ICPSkinSettings.show_leadimage_in_action_menu to registry' ) # noqa record = Record( field.Bool( title=_(u'Show leadimage in action menu'), description= _(u'Show leadimage (if any) in the top action menu with content selected in the field before.' ), # noqa required=False, default=False), value=False) records[ 'cpskin.core.interfaces.ICPSkinSettings.show_leadimage_in_action_menu'] = record # noqa
def addPortletsInRightActionsToRegistry(): registry = getUtility(IRegistry) records = registry.records if 'cpskin.core.interfaces.ICPSkinSettings.show_portlets_in_right_actions_panel' in records: # noqa return logger.info( 'Adding cpskin.core.interfaces.ICPSkinSettings.show_portlets_in_right_actions_panel to registry' ) # noqa record = Record( field.Bool( title=_(u'Show (right) portlets in right actions panel'), description= _(u'Show (right) portlets (if any) in right actions panel after related contents.' ), # noqa required=False, default=False), value=False) records[ 'cpskin.core.interfaces.ICPSkinSettings.show_portlets_in_right_actions_panel'] = record # noqa
def test_show_on_folder_contents_when_root_only_disabled(self): registry = getUtility(IRegistry) registry.records['ftw.subsite.banner_root_only'] = \ Record(field.Bool(title=u"dummy", default=True), value=False) bannerfolder = self._setup_bannerfolder(self.portal) subfolder = bannerfolder.get( bannerfolder.invokeFactory('Folder', 'subfolder')) subfolder.invokeFactory('Image', 'image1') viewlet = self._get_viewlet(self.portal) self.assertTrue( viewlet[0].available, 'Expected viewlet to be available on default view') folder_contents = self.portal.restrictedTraverse('folder_contents') viewlet = self._get_viewlet(self.portal, view=folder_contents) self.assertTrue( viewlet[0].available, 'Expected viewlet to be available on folder_contents,' ' since root_only is disabled.')
def test_available_everywhere(self): bannerfolder = self._setup_bannerfolder(self.portal) file_ = open("%s/blue.png" % os.path.split(__file__)[0], 'r') image = bannerfolder.get(bannerfolder.invokeFactory('Image', 'image1', image=file_)) image.processForm() registry = getUtility(IRegistry) registry.records['ftw.subsite.banner_root_only'] = \ Record(field.Bool(title=u"dummy", default=True), value=False) viewlet = self._get_viewlet(self.portal) # On nav root self.assertTrue(viewlet[0].available) folder = self.portal.get(self.portal.invokeFactory('Folder', 'folder')) # On sub content viewlet = self._get_viewlet(folder) self.assertTrue(viewlet[0].available)
def upgrade(context, logger=None): setup = getToolByName(context, 'portal_setup') setup.runAllImportStepsFromProfile(PROFILE_ID) registry = getUtility(IRegistry) try: auth_step_timeout = api.portal.get_registry_record(name='plone.auth_step_timeout', default=None) except api.exc.InvalidParameterError: auth_step_timeout = None if not auth_step_timeout: auth_timeout_field = field.Int(title=u"(Seconds) This amount of inactivity \ will reset the login process", description=u"Between each step, the allowed \ time is reset to this amount", default=120) auth_timeout_record = Record(auth_timeout_field) registry._records['plone.auth_step_timeout'] = auth_timeout_record try: disclaimer = api.portal.get_registry_record(name='castle.show_disclaimer', default=None) except api.exc.InvalidParameterError: disclaimer = None if not disclaimer: show_disclaimer_field = field.Bool( title=u'Show disclaimer for first time a user visits a site. ' u'To comply with ePrivacy Directive, use this feature to notify about cookie use.', default=False, required=False) site_disclaimer_field = field.Text( title=u"Disclaimer", default=u'<p><strong>Disclaimer</strong> ' u'<em>You are seeing this because this is your first time visiting the site.</em></p>', required=False) show_disclaimer_record = Record(show_disclaimer_field) site_disclaimer_record = Record(site_disclaimer_field) registry._records['castle.show_disclaimer'] = show_disclaimer_record registry._records['castle.site_disclaimer'] = site_disclaimer_record update_password_expiry(api.portal.get()) for id in context.objectIds(): context[id].reindexObject(idxs=['has_private_parents']) try: scrub_site_identity = api.portal.get_registry_record(name='plone.scrub_title_logo_to_backend_login', default=None) except api.exc.InvalidParameterError: scrub_site_identity = None if not scrub_site_identity: scrub_identity_field = field.Bool( title=u'Do not show identifying customizations (logo/text) at backend login view', description=u'If set, backend visitors will see a generic login view.', default=False, required=False) scrub_identity_record = Record(scrub_identity_field) registry._records['plone.scrub_title_logo_to_backend_login'] = scrub_identity_record try: login_footer_message = api.portal.get_registry_record(name='plone.scrub_title_logo_to_backend_login', default=None) except api.exc.InvalidParameterError: login_footer_message = None if not login_footer_message: login_footer_message_field = field.TextLine( title=u'Login Footer Message', description=u'Display a message or warning below the secure login form', required=False) login_footer_message_record = Record(login_footer_message_field) registry._records['plone.login_footer_message'] = login_footer_message_record