def __init__(self, context, request):
        # print "custom plone layout view", context

        if hasattr(context, 'aq_parent'):
            return LayoutPolicy.__init__(self, context.aq_parent, request)
        else:
            return super(PloneLayout, self).__init__(context, request)
    def bodyClass(self, template, view):
        """Returns the CSS class to be used on the body tag.
        """
        body_class = LayoutPolicyOriginal.bodyClass(self, template, view)

        columns = []
        if self.have_portlets('plone.leftcolumn', view):
            columns.append('-one')
        if self.have_portlets('plone.rightcolumn', view):
            columns.append('-two')
        
        column_class = columns and ' has-columns%s' % ''.join(columns) or ' has-no-columns'
        body_class += column_class
        
        context = aq_inner(self.context)

        context_state = getMultiAdapter(
            (self.context, self.request), name=u'plone_context_state')

        if context_state.is_default_page():
            is_nav_root = INavigationRoot.providedBy(aq_base(aq_parent(context)))
        else:
            is_nav_root = INavigationRoot.providedBy(context)
        
        if is_nav_root:
            body_class += ' navigation-root'

        portal_state = getMultiAdapter(
            (context, self.request), name=u'plone_portal_state')

        if portal_state.anonymous():
            body_class += ' is-anonymous'

        # add classes from the registry
        # we have global classes (redomino.css3theme.classes)
        # and user defined classes (cookies)
        registry = getUtility(IRegistry)

        classes = set(registry.get('redomino.css3theme.classes', []))

        userclasses = str2set(self.request.cookies.get('redomino.css3theme.userclasses', None))

        useraddableclasses = set(registry.get('redomino.css3theme.useraddableclasses', []))

        userclasses = userclasses & useraddableclasses

        classes = classes | userclasses

        if classes:
            body_class += ' %s' % ' '.join(classes)


        # add contextual classes
        contextual_classes = context.css3theme_get_contextual_classes()

        if contextual_classes:
            body_class += " %s" % contextual_classes

        return body_class
Exemple #3
0
    def bodyClass(self, template, view):
        """Returns the CSS class to be used on the body tag.
        """

        body_class = LayoutPolicy.bodyClass(self, template, view)

        additional_classes = ['seantis-directory-all']

        if IDirectoryBase.providedBy(self.context):
            additional_classes.append('seantis-directory-results')

        if IDirectoryItemBase.providedBy(self.context):
            additional_classes.append('seantis-directory-item')

        return '{} {}'.format(body_class, ' '.join(additional_classes))
Exemple #4
0
    def bodyClass(self, template, view):
        """Returns the CSS class to be used on the body tag.
        """

        body_class = LayoutPolicy.bodyClass(self, template, view)

        additional_classes = ['seantis-reservation-view']

        if hasattr(view, 'body_classes'):
            view_body_classes = view.body_classes

            if view_body_classes:
                additional_classes.extend(view.body_classes)

        return '{} {}'.format(body_class, ' '.join(additional_classes))
Exemple #5
0
    def bodyClass(self, template, view):
        """Returns the CSS class to be used on the body tag.
        """

        body_class = LayoutPolicy.bodyClass(self, template, view)

        additional_classes = ['seantis-directory-all']

        if IDirectoryBase.providedBy(self.context):
            additional_classes.append('seantis-directory-results')

        if IDirectoryItemBase.providedBy(self.context):
            additional_classes.append('seantis-directory-item')

        return '{} {}'.format(body_class, ' '.join(additional_classes))
    def bodyClass(self, template, view):
        """Returns the CSS class to be used on the body tag.
        """
        if IList.providedBy(self.context):
            used_type = self.context.used_type()
        else:
            used_type = None

        body_class = LayoutPolicy.bodyClass(self, template, view)

        if used_type is not None:
            # e.g. seantis.people.standard becomes seantis-people-standard-list
            type_class = '{}-list'.format(used_type.id.replace('.', '-'))
            return ' '.join((body_class, type_class))
        else:
            return body_class
Exemple #7
0
    def bodyClass(self, template, view):
        """Returns the CSS class to be used on the body tag.
        """

        body_class = LayoutPolicy.bodyClass(self, template, view)

        additional_classes = [
            'seantis-reservation-view'
        ]

        if hasattr(view, 'body_classes'):
            view_body_classes = view.body_classes

            if view_body_classes:
                additional_classes.extend(view.body_classes)

        return '{} {}'.format(body_class, ' '.join(additional_classes))
 def __init__(self, context, request):
     #print "custom plone layout view", context
     if hasattr(context, 'aq_parent'):
         return LayoutPolicy.__init__(self, context.aq_parent, request)
     else:
         return super(PloneLayout, self).__init__(context, request)