Пример #1
0
    def getMenuItems(self, context, request):
        """ Return menu items
        """
        url = context.absolute_url()
        action = url + '/@@faceted_settings/%s'

        left_hidden = IHidePloneLeftColumn.providedBy(context)
        right_hidden = IHidePloneRightColumn.providedBy(context)
        smart_hidden = IDisableSmartFacets.providedBy(context)

        menu = [
            {
                'title': (_('Enable left portlets') if left_hidden
                     else _('Disable left portlets')),
                'description': '',
                'action': action % 'toggle_left_column',
                'selected': not left_hidden,
                'icon': ('++resource++faceted_images/show.png' if left_hidden
                    else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_left_column',
                    'separator': None,
                    'class': ''
                    },
                'submenu': None,
            },
            {
                'title': (_('Enable right portlets') if right_hidden
                     else _('Disable right portlets')),
                'description': '',
                'action': action % 'toggle_right_column',
                'selected': not right_hidden,
                'icon': ('++resource++faceted_images/show.png' if right_hidden
                    else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_right_column',
                    'separator': None,
                    'class': ''
                    },
                'submenu': None,
            },
            {
                'title': (_('Enable smart facets hiding') if smart_hidden
                     else _('Disable smart facets hiding')),
                'description': '',
                'action': action % 'toggle_smart_facets',
                'selected': not smart_hidden,
                'icon': ('++resource++faceted_images/show.png' if smart_hidden
                    else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'disable_smart_facets',
                    'separator': None,
                    'class': ''
                    },
                'submenu': None,
            },
        ]

        return menu
Пример #2
0
 def toggle_smart_facets(self, **kwargs):
     """ Enable/Disable 'smart facets hiding'
     """
     if IDisableSmartFacets.providedBy(self.context):
         noLongerProvides(self.context, IDisableSmartFacets)
         return self._redirect(_('Smart facets hiding is now enabled'))
     else:
         alsoProvides(self.context, IDisableSmartFacets)
         return self._redirect(_('Smart facets hiding is now disabled'))
Пример #3
0
 def toggle_smart_facets(self, **kwargs):
     """ Enable/Disable 'smart facets hiding'
     """
     if IDisableSmartFacets.providedBy(self.context):
         noLongerProvides(self.context, IDisableSmartFacets)
         return self._redirect(_('Smart facets hiding is now enabled'))
     else:
         alsoProvides(self.context, IDisableSmartFacets)
         return self._redirect(_('Smart facets hiding is now disabled'))
Пример #4
0
def on_create(obj, event):
    notify(FacetedWillBeEnabledEvent(obj))
    alsoProvides(obj, IClassificationFacetedNavigable)
    if not IDisableSmartFacets.providedBy(obj):
        alsoProvides(obj, IDisableSmartFacets)
    if not IHidePloneRightColumn.providedBy(obj):
        alsoProvides(obj, IHidePloneRightColumn)
    notify(FacetedEnabledEvent(obj))

    if HAS_QUERYNEXTPREV:
        from collective.querynextprev.interfaces import INextPrevNotNavigable

        alsoProvides(obj, INextPrevNotNavigable)

    IFacetedLayout(obj).update_layout("folder-listing-view")

    # We use a method to allow override by subfolder
    obj._increment_internal_reference()
Пример #5
0
    def getMenuItems(self, context, request):
        """ Return menu items
        """
        url = context.absolute_url()
        # use format to avoid messing with url with "%" in them like
        # 'http://foo/stones-1/foo%20bar%20moo/@@faceted_settings/%s'
        action = url + '/@@faceted_settings/{0}'

        left_hidden = IHidePloneLeftColumn.providedBy(context)
        right_hidden = IHidePloneRightColumn.providedBy(context)
        smart_hidden = IDisableSmartFacets.providedBy(context)

        menu = [
            {
                'title': (_('Enable left portlets') if left_hidden
                     else _('Disable left portlets')),
                'description': '',
                'action': action.format('toggle_left_column'),
                'selected': not left_hidden,
                'icon': ('++resource++faceted_images/show.png' if left_hidden
                    else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_left_column',
                    'separator': None,
                    'class': ''
                    },
                'submenu': None,
            },
            {
                'title': (_('Enable right portlets') if right_hidden
                     else _('Disable right portlets')),
                'description': '',
                'action': action.format('toggle_right_column'),
                'selected': not right_hidden,
                'icon': ('++resource++faceted_images/show.png' if right_hidden
                    else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_right_column',
                    'separator': None,
                    'class': ''
                    },
                'submenu': None,
            },
            {
                'title': (_('Enable smart facets hiding') if smart_hidden
                     else _('Disable smart facets hiding')),
                'description': '',
                'action': action.format('toggle_smart_facets'),
                'selected': not smart_hidden,
                'icon': ('++resource++faceted_images/show.png' if smart_hidden
                    else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'disable_smart_facets',
                    'separator': None,
                    'class': ''
                    },
                'submenu': None,
            },
        ]
        iscanonical = getattr(context, 'isCanonical', None)
        if callable(iscanonical) and not iscanonical():
            inherit_config = not IDontInheritConfiguration.providedBy(context)
            menu.append({
                'title': (_('Disable inheriting configuration')
                          if inherit_config
                          else _('Enable inheriting configuration ')),
                'description': '',
                'action': action.format('toggle_inherit_config'),
                'selected': not inherit_config,
                'icon': None,
                'extra': {
                    'id': 'toggle_inherit_config',
                    'separator': None,
                    'class': ''
                    },
                'submenu': None,
            })

        return menu
Пример #6
0
    def getMenuItems(self, context, request):
        """ Return menu items
        """
        url = context.absolute_url()
        # use format to avoid messing with url with "%" in them like
        # 'http://foo/stones-1/foo%20bar%20moo/@@faceted_settings/%s'
        action = url + '/@@faceted_settings/{0}'

        left_hidden = IHidePloneLeftColumn.providedBy(context)
        right_hidden = IHidePloneRightColumn.providedBy(context)
        smart_hidden = IDisableSmartFacets.providedBy(context)

        menu = [
            {
                'title': (_('Enable left portlets')
                          if left_hidden else _('Disable left portlets')),
                'description':
                '',
                'action':
                action.format('toggle_left_column'),
                'selected':
                not left_hidden,
                'icon': ('++resource++faceted_images/show.png' if left_hidden
                         else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_left_column',
                    'separator': None,
                    'class': ''
                },
                'submenu':
                None,
            },
            {
                'title': (_('Enable right portlets')
                          if right_hidden else _('Disable right portlets')),
                'description':
                '',
                'action':
                action.format('toggle_right_column'),
                'selected':
                not right_hidden,
                'icon': ('++resource++faceted_images/show.png' if right_hidden
                         else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_right_column',
                    'separator': None,
                    'class': ''
                },
                'submenu':
                None,
            },
            {
                'title': (_('Enable smart facets hiding') if smart_hidden else
                          _('Disable smart facets hiding')),
                'description':
                '',
                'action':
                action.format('toggle_smart_facets'),
                'selected':
                not smart_hidden,
                'icon': ('++resource++faceted_images/show.png' if smart_hidden
                         else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'disable_smart_facets',
                    'separator': None,
                    'class': ''
                },
                'submenu':
                None,
            },
        ]
        iscanonical = getattr(context, 'isCanonical', None)
        if callable(iscanonical) and not iscanonical():
            inherit_config = not IDontInheritConfiguration.providedBy(context)
            menu.append({
                'title':
                (_('Disable inheriting configuration')
                 if inherit_config else _('Enable inheriting configuration ')),
                'description':
                '',
                'action':
                action.format('toggle_inherit_config'),
                'selected':
                not inherit_config,
                'icon':
                None,
                'extra': {
                    'id': 'toggle_inherit_config',
                    'separator': None,
                    'class': ''
                },
                'submenu':
                None,
            })

        return menu
Пример #7
0
    def getMenuItems(self, context, request):
        """ Return menu items
        """
        url = context.absolute_url()
        action = url + '/@@faceted_settings/%s'

        left_hidden = IHidePloneLeftColumn.providedBy(context)
        right_hidden = IHidePloneRightColumn.providedBy(context)
        smart_hidden = IDisableSmartFacets.providedBy(context)

        menu = [
            {
                'title': (_('Enable left portlets')
                          if left_hidden else _('Disable left portlets')),
                'description':
                '',
                'action':
                action % 'toggle_left_column',
                'selected':
                not left_hidden,
                'icon': ('++resource++faceted_images/show.png' if left_hidden
                         else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_left_column',
                    'separator': None,
                    'class': ''
                },
                'submenu':
                None,
            },
            {
                'title': (_('Enable right portlets')
                          if right_hidden else _('Disable right portlets')),
                'description':
                '',
                'action':
                action % 'toggle_right_column',
                'selected':
                not right_hidden,
                'icon': ('++resource++faceted_images/show.png' if right_hidden
                         else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'toggle_right_column',
                    'separator': None,
                    'class': ''
                },
                'submenu':
                None,
            },
            {
                'title': (_('Enable smart facets hiding') if smart_hidden else
                          _('Disable smart facets hiding')),
                'description':
                '',
                'action':
                action % 'toggle_smart_facets',
                'selected':
                not smart_hidden,
                'icon': ('++resource++faceted_images/show.png' if smart_hidden
                         else '++resource++faceted_images/hide.png'),
                'extra': {
                    'id': 'disable_smart_facets',
                    'separator': None,
                    'class': ''
                },
                'submenu':
                None,
            },
        ]

        return menu