示例#1
0
class ICustomRegisterSchema(Interface):

    legal_conditions = schema.Bool(
        title=_(u'I Accept Legal terms and conditions'),
        description=_(u''),
        required=True,
    )
示例#2
0
class IGDPRSubscribe(Interface):

    legal_conditions = schema.Bool(
        title=_(u'I Accept Legal terms and conditions'),
        description=_(u''),
        required=True,
    )
示例#3
0
class IRelatedContacts(model.Schema):

    form.order_before(location='IRichText.text')
    location = ContactChoice(
        title=_(u'Location'),
        source=ContactSourceBinder(portal_type=('organization', ), ),
        required=False,
    )

    form.order_after(organizer='IRelatedContacts.location')
    organizer = ContactChoice(
        title=_(u'Organizer'),
        source=ContactSourceBinder(portal_type=('person', 'organization'), ),
        required=False,
    )

    form.order_after(contact='IRelatedContacts.organizer')
    contact = ContactChoice(
        title=_(u'Contact'),
        source=ContactSourceBinder(portal_type=('person', 'organization'), ),
        required=False,
    )

    form.order_after(partners='IRelatedContacts.contact')
    partners = ContactList(
        title=_(u'Partners'),
        value_type=ContactChoice(title=_(u'Partner'),
                                 source=ContactSourceBinder(
                                     portal_type=('person',
                                                  'organization'), )),
        required=False,
    )
示例#4
0
class ConfigurationsSubMenuItem(BrowserSubMenuItem):
    implements(IConfigurationsSubMenuItem)

    title = _(u'label_cpskin_configurations_menu', default=u'Configurations')
    description = _(
        u'title_cpskin_actions_menu',
        default=u'Configurations for the current content item')
    submenuId = 'plone_contentmenu_cpskin_configurations'

    order = 15
    extra = {'id': 'plone-contentmenu-cpskin-configurations'}

    @property
    def action(self):
        return self.context.absolute_url()

    @memoize
    def available(self):
        actions_tool = getToolByName(self.context, 'portal_actions')
        actions = actions_tool.listActionInfos(
            object=self.context,
            categories=('cpskin_configurations',), max=1)
        return len(actions) > 0

    def selected(self):
        return False
示例#5
0
class IAdditionalSearchableText(model.Schema):
    model.fieldset(
        'categorization',
        label=_(u'label_schema_categorization', default=u'Categorization'),
        fields=('additional_searchable_text', ),
    )
    dexteritytextindexer.searchable('additional_searchable_text')
    additional_searchable_text = schema.Text(
        title=_(u'Additional searchable text'), required=False)
示例#6
0
class ConsentFormWithPolicy(ConsentForm):

    label = _(u"Cookies choice")
    id = "cookies-form"

    def update(self):
        super(ConsentFormWithPolicy, self).update()
        root = api.portal.get_navigation_root(self.context)
        current_lang = api.portal.get_current_language()[:2]
        policy_url = u"{}/@@cookies-view".format(root.absolute_url())
        description = _(
            u"Choose to opt in or out of cookies use.<br/>"
            u'Our <a href="${policy_url}">cookies policy</a> can help you choose.',
            mapping={u"policy_url": policy_url},
        )
        self.description = translate(description, target_language=current_lang)

    def _redirect(self):
        if "ajax_load" in self.request.form:
            # the form was loaded via an overlay, we need to redirect to
            # an existing page to close it
            portal = api.portal.get()
            self.request.response.redirect("{}/@@ok".format(
                portal.absolute_url()))
            return ""

    @button.buttonAndHandler(_(u"Save my choices"))
    def handleApply(self, action):
        data, errors = self.extractData()
        if errors:
            self.status = self.formErrorsMessage
            return

        privacy_tool = self.context.portal_privacy
        for topic, answer in data.items():
            answer = answer == "Allowed"
            if answer:
                privacy_tool.consentToProcessing(topic)
            else:
                privacy_tool.objectToProcessing(topic)
        self.status = _(u"Your preferences have been saved.")
        self._redirect()

    @button.buttonAndHandler(_(u"Accept all"))
    def handleAcceptAll(self, action):
        privacy_tool = api.portal.get_tool("portal_privacy")
        for reason in get_all_consent_reasons(privacy_tool):
            privacy_tool.consentToProcessing(reason.__name__)
        self._redirect()

    @button.buttonAndHandler(_(u"Refuse all"))
    def handleRefuseAll(self, action):
        privacy_tool = api.portal.get_tool("portal_privacy")
        for reason in get_all_consent_reasons(privacy_tool):
            privacy_tool.objectToProcessing(reason.__name__)
        self._redirect()
示例#7
0
class INewDreamSettings(Interface):
    """
    Settings for New Dream
    """
    breadcrumbs_below_title = schema.Bool(
        title=_(u'Breadcrumbs below title'),
        description=_(u'Show breadcrumbs below page title?'),
        required=False,
        default=False
    )
示例#8
0
def addLoadPageMenuToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.load_page_menu' in records:
        return

    logger.info("Adding cpskin.core.interfaces.ICPSkinSettings.load_page_menu to registry")
    record = Record(field.Bool(title=_(u"Load page menu"),
                               description=_(u"Is level 1 menu load page at click?"),
                               required=False,
                               default=False),
                    value=False)
    records['cpskin.core.interfaces.ICPSkinSettings.load_page_menu'] = record
示例#9
0
def addAutoPlaySliderToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.auto_play_slider' in records:
        return

    logger.info("Adding cpskin.core.interfaces.ICPSkinSettings.auto_play_slider to registry")
    record = Record(field.Bool(title=_(u"Auto play slider"),
                               description=_(u"Is the front page slider automatically play?"),
                               required=False,
                               default=True),
                    value=True)
    records['cpskin.core.interfaces.ICPSkinSettings.auto_play_slider'] = record
示例#10
0
def addSliderTimerToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.slider_timer' in records:
        return

    logger.info("Adding cpskin.core.interfaces.ICPSkinSettings.slider_timer to registry")
    record = Record(field.Bool(title=_(u"Slider timer"),
                               description=_(u"Number of seconds between each transition."),
                               required=False,
                               default=5000),
                    value=5000)
    records['cpskin.core.interfaces.ICPSkinSettings.slider_timer'] = record
示例#11
0
 def __call__(self, context, query=None):
     items = [
         ('no_booking', _(u'No booking')),
         ('mandatory', _(u'Mandatory booking')),
         ('optional', _(u'Optional booking')),
     ]
     terms = [
         SimpleTerm(
             value=pair[0],
             token=pair[0],
             title=pair[1],
         ) for pair in items
     ]
     return SimpleVocabulary(terms)
示例#12
0
 def __call__(self, context, query=None):
     items = [
         ('no_booking', _(u'No booking')),
         ('mandatory', _(u'Mandatory booking')),
         ('optional', _(u'Optional booking')),
     ]
     terms = [
         SimpleTerm(
             value=pair[0],
             token=pair[0],
             title=pair[1],
         ) for pair in items
     ]
     return SimpleVocabulary(terms)
示例#13
0
def addSubMenuPersistenceToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.sub_menu_persistence' in records:  # noqa
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.sub_menu_persistence to registry')  # noqa
    record = Record(field.Bool(title=_(u'Sub menu persistence'),
                               description=_(u'Is level 2 menu persist?'),
                               required=False,
                               default=True),
                    value=True)
    records['cpskin.core.interfaces.ICPSkinSettings.sub_menu_persistence'] = record  # noqa
示例#14
0
def addTopMenuContentsToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.contents_in_action_menu' in records:  # noqa
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.contents_in_action_menu to registry')  # noqa
    record = Record(field.Tuple(title=_(u'Content to show in special action menu (top)'),
                                description=_(u'Please select which contents should be taken to this menu.'),  # noqa
                                value_type=field.TextLine(title=u"Value"),
                                required=False),
                    )
    records['cpskin.core.interfaces.ICPSkinSettings.contents_in_action_menu'] = record  # noqa
示例#15
0
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
示例#16
0
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
示例#17
0
def addFooterSitemapToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records

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

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.show_footer_sitemap to registry')  # noqa
    record = Record(field.Bool(title=_(u'Show footer sitemap'),
                               description=_(u'Automatically generate sitemap footer'),
                               required=False,
                               default=True),
                    value=True)
    records['cpskin.core.interfaces.ICPSkinSettings.show_footer_sitemap'] = record  # noqa
示例#18
0
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
示例#19
0
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
示例#20
0
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
示例#21
0
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
示例#22
0
 def removeContent(self):
     """Unmark content to remove it from folder view"""
     context = self._get_real_context()
     noLongerProvides(context, IFolderViewSelectedContent)
     catalog = api.portal.get_tool("portal_catalog")
     catalog.reindexObject(context)
     self._redirect(_(u"Contenu retiré de la vue index."))
示例#23
0
class Widget(BaseWidget, L10nDatepicker):
    """
    Date range Widget specific to events
    """
    widget_type = 'daterange'
    widget_label = _('Date range for events')

    def query(self, form):
        """
        Execute special treatment on basic widget query() result to handle
        search based on 2 indexes
        """
        query = super(Widget, self).query(form)
        if not query:
            return query
        index, params = query.popitem()
        start = params['query'][0]
        end = params['query'][1]

        startDate = start.asdatetime().date()
        # Faceted use previous day at 23:59:59 for its query
        startDate = startDate + timedelta(days=1)
        endDate = end.asdatetime().date()

        query = {}
        query['event_dates'] = {'query': (startDate, endDate), 'range': 'min:max'}
        return query
示例#24
0
 def addContent(self):
     """Mark content to add it to folder view"""
     context = self._get_real_context()
     alsoProvides(context, IFolderViewSelectedContent)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Contenu ajouté à la vue index.'))
示例#25
0
文件: pages.py 项目: IMIO/cpskin.core
 def get_info(self):
     if not getattr(self.real_context, 'contact', None):
         return False
     obj = self.get_relation_field('contact')
     info = []
     title = getattr(obj, 'title', None)
     if title:
         info.append(title)
     phone = getattr(obj, 'phone', None)
     if not phone:
         obj = self.get_relation_field('organizer')
         phone = getattr(obj, 'phone', None)
     if phone:
         if isinstance(phone, list):
             phone = u' '.join([format_phone(p)['formated'] for p in phone])
             # hack for namur
             phone = phone.replace('+32 (0) ', '0')
             info.append(phone)
         else:
             phone = format_phone(phone)['formated']
             # hack for namur
             phone = phone.replace('+32 (0) ', '0')
             info.append(phone)
     website = getattr(obj, 'website', None)
     if website:
         info.append(website)
     if len(info) >= 1:
         infomsg = _(u'Info :')
         return u'{0} {1}'.format(infomsg, ' - '.join(info))
     else:
         return ''
示例#26
0
 def enable_local_banner(self):
     """ Enable the banner """
     context = self._get_real_context()
     alsoProvides(context, ILocalBannerActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Banner enabled on content'))
示例#27
0
 def useBigImages(self):
     """Use big images for first elements on folder view"""
     context = self._get_real_context()
     alsoProvides(context, IFolderViewWithBigImages)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Big images are now used on this folder view.'))
示例#28
0
 def disable_banner(self):
     """ Disable the banner """
     context = self._get_real_context()
     noLongerProvides(context, IBannerActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Banner disabled for content and sub-contents'))
示例#29
0
class Widget(AbstractWidget, L10nDatepicker):
    """
    Simple date Widget specific to events
    """
    widget_type = 'simpledate'
    widget_label = _('Simple date for events')
    view_js = '++resource++cpskin.agenda.widgets.simpledate.view.js'
    edit_js = '++resource++cpskin.agenda.widgets.simpledate.edit.js'
    view_css = '++resource++cpskin.agenda.widgets.simpledate.view.css'
    edit_css = '++resource++cpskin.agenda.widgets.simpledate.edit.css'

    index = ViewPageTemplateFile('widget.pt')
    edit_schema = AbstractWidget.edit_schema.copy()

    @property
    def default(self):
        """Return default value"""
        default = self.data.get('default', '')
        if not default:
            return ''
        default = default.strip()
        try:
            default = DateTime(
                datetime.strptime(default, self.python_date_format))
            default = default.strftime(self.python_date_format)
        except Exception, err:
            logger.exception('%s => Date: %s', err, default)
            default = ''
        return default
示例#30
0
def addLoadPageMenuToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.load_page_menu' in records:
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.load_page_menu to registry'
    )  # noqa
    record = Record(field.Bool(
        title=_(u'Load page menu'),
        description=_(u'Is level 1 menu load page at click?'),
        required=False,
        default=False),
                    value=False)
    records['cpskin.core.interfaces.ICPSkinSettings.load_page_menu'] = record
示例#31
0
def addSliderTypeToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.slider_type' in records:
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.slider_type to registry'
    )  # noqa
    record = Record(field.TextLine(
        title=_(u'Slider type'),
        description=_(u'Choose an horizontal or vertical slider.'),
        required=True,
        default=u'slider_view'),
                    value=u'slider_view')
    records['cpskin.core.interfaces.ICPSkinSettings.slider_type'] = record
示例#32
0
 def useBigImages(self):
     """Use big images for first elements on folder view"""
     context = self._get_real_context()
     alsoProvides(context, IFolderViewWithBigImages)
     catalog = api.portal.get_tool("portal_catalog")
     catalog.reindexObject(context)
     self._redirect(_(u"Big images are now used on this folder view."))
示例#33
0
def addAutoPlaySliderToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.auto_play_slider' in records:
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.auto_play_slider to registry'
    )  # noqa
    record = Record(field.Bool(
        title=_(u'Auto play slider'),
        description=_(u'Is the front page slider automatically play?'),
        required=False,
        default=True),
                    value=True)
    records['cpskin.core.interfaces.ICPSkinSettings.auto_play_slider'] = record
示例#34
0
 def removeContent(self):
     """Unmark content to remove it from folder view"""
     context = self._get_real_context()
     noLongerProvides(context, IFolderViewSelectedContent)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Contenu retiré de la vue index.'))
示例#35
0
def addSliderTimerToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.slider_timer' in records:
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.slider_timer to registry'
    )  # noqa
    record = Record(field.Int(
        title=_(u'Slider timer'),
        description=_(u'Number of seconds between each transition.'),
        required=False,
        default=5000),
                    value=5000)
    records['cpskin.core.interfaces.ICPSkinSettings.slider_timer'] = record
示例#36
0
def addSliderTypeToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.slider_type' in records:
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.slider_type to registry')  # noqa
    record = Record(
        field.TextLine(
            title=_(u'Slider type'),
            description=_(u'Choose an horizontal or vertical slider.'),
            required=True,
            default=u'slider_view'),
        value=u'slider_view')
    records['cpskin.core.interfaces.ICPSkinSettings.slider_type'] = record
示例#37
0
def addSubMenuPersistenceToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.sub_menu_persistence' in records:  # noqa
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.sub_menu_persistence to registry'
    )  # noqa
    record = Record(field.Bool(title=_(u'Sub menu persistence'),
                               description=_(u'Is level 2 menu persist?'),
                               required=False,
                               default=True),
                    value=True)
    records[
        'cpskin.core.interfaces.ICPSkinSettings.sub_menu_persistence'] = record  # noqa
示例#38
0
 def addContent(self):
     """Mark content to add it to folder view"""
     context = self._get_real_context()
     alsoProvides(context, IFolderViewSelectedContent)
     catalog = api.portal.get_tool("portal_catalog")
     catalog.reindexObject(context)
     self._redirect(_(u"Contenu ajouté à la vue index."))
示例#39
0
 def disable_local_banner(self):
     """ Disable the banner """
     context = self._get_real_context()
     noLongerProvides(context, ILocalBannerActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Banner disabled for content'))
示例#40
0
 def enable_local_banner(self):
     """ Enable the banner """
     context = self._get_real_context()
     alsoProvides(context, ILocalBannerActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Banner enabled on content'))
示例#41
0
def upgrade_search_position(context):
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.search_position' in records:
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.search_position to registry')  # noqa
    record = Record(
        field.TextLine(
            title=_(u'Search position'),
            description=_(u'Search box position in eligible themes.'),
            required=True,
            default=u'default_position'),
        value=u'default_position')
    records['cpskin.core.interfaces.ICPSkinSettings.search_position'] = record
示例#42
0
class Widget(AbstractWidget):
    """ Widget
    """
    # Widget properties
    widget_type = 'layout'
    widget_label = _('Layout selection')
    view_js = '++resource++cpskin.faceted.widgets.layout.view.js'
    edit_js = '++resource++cpskin.faceted.widgets.layout.edit.js'
    view_css = '++resource++cpskin.faceted.widgets.layout.view.css'
    edit_css = '++resource++cpskin.faceted.widgets.layout.edit.css'

    index = ZopeTwoPageTemplateFile('layout.pt', globals())
    edit_schema = AbstractWidget.edit_schema.copy() + EditSchema
    edit_schema['title'].default = 'Layout'

    def __init__(self, *args, **kwargs):
        super(Widget, self).__init__(*args, **kwargs)
        self.voc = getUtility(
            IVocabularyFactory,
            name='cpskin.vocabularies.faceted_layout',
        )(self.context)

    @property
    def values(self):
        return [self.voc.getTerm(v) for v in self.data.get('values', [])]
示例#43
0
 def get_info(self):
     if not getattr(self.real_context, 'contact', None):
         return False
     obj = self.get_relation_field('contact')
     info = []
     title = getattr(obj, 'title', None)
     if title:
         info.append(title)
     phone = getattr(obj, 'phone', None)
     if not phone:
         obj = self.get_relation_field('organizer')
         phone = getattr(obj, 'phone', None)
     if phone:
         if isinstance(phone, list):
             phone = u' '.join([format_phone(p)['formated'] for p in phone])
             # hack for namur
             phone = phone.replace('+32 (0) ', '0')
             info.append(phone)
         else:
             phone = format_phone(phone)['formated']
             # hack for namur
             phone = phone.replace('+32 (0) ', '0')
             info.append(phone)
     website = getattr(obj, 'website', None)
     if website:
         info.append(website)
     if len(info) >= 1:
         infomsg = _(u'Info :')
         return u'{0} {1}'.format(infomsg, ' - '.join(info))
     else:
         return ''
示例#44
0
 def more_occurrences_text(self):
     msgid = _(
         u'msg_num_more_occurrences',
         default=u'Il y a ${results} occurrence(s) en plus.',
         mapping={u'results': self.num_more_occurrences}
     )
     return self.context.translate(msgid)
示例#45
0
 def disable_media(self):
     """Disable the media"""
     context = self._get_real_context()
     noLongerProvides(context, IMediaActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Multimedia viewlet disabled for content'))
示例#46
0
文件: media.py 项目: IMIO/cpskin.core
 def disable_media(self):
     """Disable the media"""
     context = self._get_real_context()
     noLongerProvides(context, IMediaActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Multimedia viewlet disabled for content'))
示例#47
0
 def disable_direct_access(self):
     """ Disable the direct access """
     context = self._get_real_context()
     noLongerProvides(context, IDirectAccess)
     catalog = getToolByName(context, 'portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Content removed from direct access menu'))
     invalidate_menu(context)
示例#48
0
 def enable_direct_access(self):
     """ Enable the direct access """
     context = self._get_real_context()
     alsoProvides(context, IDirectAccess)
     catalog = getToolByName(context, 'portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Content added to direct access menu'))
     invalidate_menu(context)
示例#49
0
 def stopBigImagesUse(self):
     """Use using big images for first elements on folder view"""
     context = self._get_real_context()
     noLongerProvides(context, IFolderViewWithBigImages)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(
         _(u'Big images are not used anymore on this folder view.'))
示例#50
0
 def stopBigImagesUse(self):
     """Use using big images for first elements on folder view"""
     context = self._get_real_context()
     noLongerProvides(context, IFolderViewWithBigImages)
     catalog = api.portal.get_tool("portal_catalog")
     catalog.reindexObject(context)
     self._redirect(
         _(u"Big images are not used anymore on this folder view."))
示例#51
0
 def enable_media(self):
     """Enable the media"""
     context = self._get_real_context()
     alsoProvides(context, IMediaActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Multimedia viewlet enabled on content'))
     create_collections(context)
示例#52
0
文件: media.py 项目: IMIO/cpskin.core
 def enable_media(self):
     """Enable the media"""
     context = self._get_real_context()
     alsoProvides(context, IMediaActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     self._redirect(_(u'Multimedia viewlet enabled on content'))
     create_collections(context)
示例#53
0
class ICpskinDirectoryViewSettings(model.Schema):
    model.fieldset(
        'directoryview',
        label=_(u'Directory view'),
        fields=(
            'taxonomy_category',
            'show_organization_images',
            'organization_image_scale',
        ),
    )

    taxonomy_category = schema.TextLine(
        title=_(u'Which taxonomy id should be use to display category'),
        description=_(u'Please write which taxonomy id should be used.'),
        default=u'',
        required=False,
    )

    show_organization_images = schema.Bool(
        title=_(u'Show organizations images'),
        description=
        _(u'Do you want to show images for organizations preview in directory ?'
          ),  # noqa
        required=False,
        default=False,
    )

    organization_image_scale = schema.Choice(
        title=_(
            u'Which image scale use for organizations preview in directory ?'
        ),  # noqa
        description=_(u'Please select the scale.'),
        required=False,
        default='mini',
        vocabulary=u'plone.app.vocabularies.ImagesScales')
示例#54
0
def addFooterSitemapToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records

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

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.show_footer_sitemap to registry'
    )  # noqa
    record = Record(field.Bool(
        title=_(u'Show footer sitemap'),
        description=_(u'Automatically generate sitemap footer.'),
        required=False,
        default=True),
                    value=True)
    records[
        'cpskin.core.interfaces.ICPSkinSettings.show_footer_sitemap'] = record  # noqa
示例#55
0
def to_65_use_slick(context):
    registry = getUtility(IRegistry)
    records = registry.records

    if "cpskin.core.interfaces.ICPSkinSettings.use_slick" in records:
        return

    logger.info("Adding cpskin.core.interfaces.ICPSkinSettings.use_slick to registry")
    record = Record(
        field.Bool(
            title=_(u"Use slick for slider"),
            description=_(u"Do you want to use slick instead of flexslider ?"),
            required=False,
            default=False,
        ),
        value=False,
    )
    records["cpskin.core.interfaces.ICPSkinSettings.use_slick"] = record
示例#56
0
 def disable_media(self):
     """ Disable the media """
     context = self._get_real_context()
     noLongerProvides(context, IMediaActivated)
     catalog = api.portal.get_tool('portal_catalog')
     catalog.reindexObject(context)
     if 'visible_albums' in self.context.propertyIds():
         self.context.manage_delProperties([u'visible_albums'])
     self._redirect(_(u'Multimedia viewlet disabled for content'))
示例#57
0
class IISearchTags(model.Schema):
    model.fieldset(
        'categorization',
        label=_(u'label_schema_categorization', default=u'Categorization'),
        fields=('isearchTags', ),
    )

    form.widget(
        isearchTags='collective.z3cform.keywordwidget.widget.KeywordFieldWidget'
    )  # noqa
    isearchTags = Keywords(
        title=_(u'label_isearch_tags', default=u'I Search Tags'),
        description=_(u'help_isearch_tags',
                      default=u'I Search Tags are used for webmaster '
                      u'organization of content.'),
        required=False,
        index_name='isearchTags',
    )
示例#58
0
def addCityNameToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.city_name' in records:
        return

    logger.info(
        'Adding cpskin.core.interfaces.ICPSkinSettings.city_name to registry')
    portal = api.portal.get()
    site_id = portal.getId()
    city_name = unicode(site_id.capitalize())
    record = Record(field.TextLine(
        title=_(u'City name'),
        description=_(u'City name variable used in some template.'),
        required=True,
        default=u'City name'),
                    value=city_name)
    records['cpskin.core.interfaces.ICPSkinSettings.city_name'] = record
示例#59
0
def addCityNameToRegistry():
    registry = getUtility(IRegistry)
    records = registry.records
    if 'cpskin.core.interfaces.ICPSkinSettings.city_name' in records:
        return

    logger.info("Adding cpskin.core.interfaces.ICPSkinSettings.city_name to registry")
    portal = api.portal.get()
    site_id = portal.getId()
    city_name = unicode(site_id.capitalize())
    record = Record(
        field.TextLine(
            title=_(u"City name"),
            description=_(u"City name variable used in some template."),
            required=True,
            default=u'City name'),
        value=city_name)
    records['cpskin.core.interfaces.ICPSkinSettings.city_name'] = record
示例#60
0
文件: pages.py 项目: IMIO/cpskin.core
    def get_formatted_date(self):
        date_formated = u''
        event = self.real_context
        date_spel_start = date_speller(event, self.dates.get('start_iso'))
        date_spel_end = date_speller(event, self.dates.get('end_iso'))
        # day and month
        if self.dates.get('same_day'):
            date_formated = u'{0} {1} {2}'.format(
                date_spel_start.get('day'),
                date_spel_start.get('month'),
                date_spel_start.get('year'))
        elif self.is_same_month(date_spel_start, date_spel_end):
            date_formated = u'{0} au {1} {2} {3}'.format(
                date_spel_start.get('day'),
                date_spel_end.get('day'),
                date_spel_start.get('month'),
                date_spel_start.get('year'))
        else:
            date_formated += u'{0} {1} {2} au {3} {4} {5}'.format(
                date_spel_start.get('day'),
                date_spel_start.get('month'),
                date_spel_start.get('year'),
                date_spel_end.get('day'),
                date_spel_end.get('month'),
                date_spel_start.get('year'))

        # hour
        if not self.dates.get('whole_day'):
            if self.dates.get('open_end'):
                date_formated += _(u' à ')
                date_formated += u'{0}:{1}'.format(
                    date_spel_start.get('hour'),
                    date_spel_start.get('minute2'))
            else:
                date_formated += _(u' de ')
                date_formated += u'{0}:{1}'.format(
                    date_spel_start.get('hour'),
                    date_spel_start.get('minute2'))
                date_formated += _(u' à ')
                date_formated += u'{0}:{1}'.format(
                    date_spel_end.get('hour'),
                    date_spel_end.get('minute2')
                )
        return date_formated