Beispiel #1
0
    def render_group(self, ctx, data):

        # Get a reference to the group, for simpler code.
        group = self.group

        # Build the CSS class string
        cssClass = ['group']
        if group.cssClass is not None:
            cssClass.append(group.cssClass)
        cssClass = ' '.join(cssClass)

        # Fill the slots
        tag = ctx.tag
        tag.fillSlots('id', util.render_cssid(group.key))
        tag.fillSlots('cssClass', cssClass)
        tag.fillSlots('label', group.label)
        tag.fillSlots('description', group.description or '')
        slots = []
        for item in group.items:
            if (type(item) == list or type(item) == stan.Tag):
                slots.append(item)
            else:
                slots.append(inevow.IRenderer(item))
        tag.fillSlots('items', slots)

        return ctx.tag
Beispiel #2
0
    def fragments(self, req, tag):
        """
        Render our preference collection, any child preference
        collections we discover by looking at self.tab.children,
        and any fragments returned by its C{getSections} method.

        Subtabs and C{getSections} fragments are rendered as fieldsets
        inside the parent preference collection's tab.
        """
        f = self._collectionToLiveform()
        if f is not None:
            yield tags.fieldset[tags.legend[self.tab.name], f]

        for t in self.tab.children:
            f = inevow.IRenderer(self.collection.store.getItemByID(t.storeID))
            f.tab = t
            if hasattr(f, 'setFragmentParent'):
                f.setFragmentParent(self)
            yield f

        for f in self.collection.getSections() or ():
            f = ixmantissa.INavigableFragment(f)
            f.setFragmentParent(self)
            f.docFactory = getLoader(f.fragmentName)
            yield tags.fieldset[tags.legend[f.title], f]
Beispiel #3
0
 def _renderItems(self, ctx, data):
     if self.original.items is None:
         yield ''
         return
     for item in self.original.items:
         if type(item) != stan.Tag:
             yield inevow.IRenderer(item)
         else:
             yield item
Beispiel #4
0
    def render_group(self, ctx, data):
        group = self.group

        # Build the CSS class string
        cssClass = ['group', 'submit-group']
        if group.cssClass is not None:
            cssClass.append(group.cssClass)
        cssClass = ' '.join(cssClass)

        # Fill the slots
        ctx.tag.fillSlots('id', util.render_cssid(group.key))
        ctx.tag.fillSlots('cssClass', cssClass)
        items = [inevow.IRenderer(item) for item in group.items]
        items.append(T.span(_class='submit-group-clear'))
        ctx.tag.fillSlots('items', items)

        return ctx.tag
Beispiel #5
0
    def tabbedPane(self, req, tag):
        """
        Render a tabbed pane tab for each top-level
        L{xmantissa.ixmantissa.IPreferenceCollection} tab
        """
        navigation = webnav.getTabs(self.aggregator.getPreferenceCollections())
        pages = list()
        for tab in navigation:
            f = inevow.IRenderer(self.aggregator.store.getItemByID(
                tab.storeID))
            f.tab = tab
            if hasattr(f, 'setFragmentParent'):
                f.setFragmentParent(self)
            pages.append((tab.name, f))

        f = tabbedPane.TabbedPaneFragment(pages, name='preference-editor')
        f.setFragmentParent(self)
        return f
Beispiel #6
0
        def _processForm(form, ctx, name):
            # Remember the form
            ctx.remember(form, iformal.IForm)

            # Create a keyed tag that will render the form when flattened.
            tag = T.invisible(key=name)[inevow.IRenderer(form)]

            # Create a new context, referencing the above tag, so that we don't
            # pollute the current context with anything the form needs during
            # rendering.
            ctx = context.WovenContext(parent=ctx, tag=tag)

            # Find errors for *this* form and remember things on the context
            if form.errors:
                ctx.remember(form.errors.data, iformal.IFormData)
            else:
                ctx.remember(form.data or {}, iformal.IFormData)

            return ctx
Beispiel #7
0
    def render_group(self, ctx, data):

        # Get a reference to the group, for simpler code.
        group = self.group

        # Build the CSS class string
        cssClass = ['group']
        if group.cssClass is not None:
            cssClass.append(group.cssClass)
        cssClass = ' '.join(cssClass)

        # Fill the slots
        ctx.tag.fillSlots('id', util.render_cssid(group.key))
        ctx.tag.fillSlots('cssClass', cssClass)
        ctx.tag.fillSlots('label', group.label)
        ctx.tag.fillSlots('description', group.description or '')
        ctx.tag.fillSlots('items', [inevow.IRenderer(item) for item in
                group.items])
        return ctx.tag
Beispiel #8
0
    def render_group(self, ctx, data):
        group = self.group

        # Build the CSS class string
        cssClass = ['group']
        if self.group.collapsible:
            cssClass.append('collapsible-group')
        if group.cssClass is not None:
            cssClass.append(group.cssClass)
        cssClass = ' '.join(cssClass)

        # Fill the slots
        ctx.tag.fillSlots('id', util.render_cssid(group.key))
        ctx.tag.fillSlots('cssClass', cssClass)
        ctx.tag.fillSlots('label', group.label)
        ctx.tag.fillSlots('description', group.description or '')
        if self.group.summary is not None:
            ctx.tag.fillSlots('summary', self.group.summary)
        else:
            ctx.tag.fillSlots('summary', _default_summary_clicktoexpand)
        ctx.tag.fillSlots('items', [inevow.IRenderer(item) for item in
                group.items])
        return ctx.tag
Beispiel #9
0
 def render_item(self, ctx, data):
     return inevow.IRenderer(data)
Beispiel #10
0
 def _renderItems(self, ctx, data):
     if self.original.items is None:
         yield ''
         return
     for item in self.original.items:
         yield inevow.IRenderer(item)