Example #1
0
 def canonical(self):
     """ Get canonical
     """
     if not IDontInheritConfiguration.providedBy(self.context):
         if self._canonical == '<NOT SET>':
             canonical = getattr(self.context, 'getCanonical', None)
             if callable(canonical):
                 canonical = canonical()
             self._canonical = canonical
     return self._canonical
 def canonical(self):
     """ Get canonical
     """
     if not IDontInheritConfiguration.providedBy(self.context):
         if self._canonical == '<NOT SET>':
             canonical = getattr(self.context, 'getCanonical', None)
             if callable(canonical):
                 canonical = canonical()
             self._canonical = canonical
     return self._canonical
Example #3
0
 def toggle_inherit_config(self, **kwargs):
     """ Enable/Disable 'inheriting configuration'
     """
     if IDontInheritConfiguration.providedBy(self.context):
         noLongerProvides(self.context, IDontInheritConfiguration)
         return self._redirect(
             _('Inheriting configuration if is now enabled'))
     else:
         alsoProvides(self.context, IDontInheritConfiguration)
         return self._redirect(
             _('Inheriting configuration is now disabled'))
Example #4
0
 def toggle_inherit_config(self, **kwargs):
     """ Enable/Disable 'inheriting configuration'
     """
     if IDontInheritConfiguration.providedBy(self.context):
         noLongerProvides(self.context, IDontInheritConfiguration)
         return self._redirect(
             _('Inheriting configuration if is now enabled'))
     else:
         alsoProvides(self.context, IDontInheritConfiguration)
         return self._redirect(
             _('Inheriting configuration is now disabled'))
 def __init__(self, context):
     """ Handle criteria
     """
     # LinguaPlone support
     if IDontInheritConfiguration.providedBy(context):
         self.context = context
     else:
         canonical = getattr(context, 'getCanonical', None)
         if canonical:
             self.context = canonical()
         else:
             self.context = context
     self.criteria = self._criteria()
Example #6
0
 def __init__(self, context):
     """ Handle criteria
     """
     # LinguaPlone support
     if IDontInheritConfiguration.providedBy(context):
         self.context = context
     else:
         canonical = getattr(context, 'getCanonical', None)
         if canonical:
             self.context = canonical()
         else:
             self.context = context
     self.criteria = self._criteria()
Example #7
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
Example #8
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