Beispiel #1
0
    def _render_body(self, items):
        out = []
        _ = self._request.translate
        item_label = escape(get_item_modul(self._request,
                                           self._item).get_label())
        mapping = {'action': escape(_(self._action.capitalize()).lower()),
                   'item': item_label,
                   'Action': escape(_(self._action.capitalize()))}
        out.append(_("Do you really want to ${action}"
                     " the following ${item} items?",
                     mapping=mapping))
        out.append(HTML.tag("br", _closed=False))
        out.append(HTML.tag("ol", _closed=False))
        for item in items:
            out.append(HTML.tag("li", _closed=False))
            out.append(escape(unicode(item)))
            out.append(HTML.tag("/li", _closed=False))
        out.append(HTML.tag("/ol", _closed=False))
        out.append(_('Please press "${Action}" to ${action} the item.'
                     ' Press "Cancel" to cancel the action.',
                     mapping=mapping))

        return literal("").join(out)
Beispiel #2
0
    def _render_body(self, items):
        out = []
        _ = self._request.translate
        item_label = escape(get_item_modul(self._request,
                                           self._item).get_label())
        mapping = {'action': escape(_(self._action.capitalize()).lower()),
                   'item': item_label,
                   'Action': escape(_(self._action.capitalize()))}
        out.append(_("Do you really want to ${action}"
                     " the following ${item} items?",
                     mapping=mapping))
        out.append(HTML.tag("br", _closed=False))
        out.append(HTML.tag("ol", _closed=False))
        for item in items:
            out.append(HTML.tag("li", _closed=False))
            out.append(escape(unicode(item)))
            out.append(HTML.tag("/li", _closed=False))
        out.append(HTML.tag("/ol", _closed=False))
        out.append(_('Please press "${Action}" to ${action} the item.'
                     ' Press "Cancel" to cancel the action.',
                     mapping=mapping))

        return literal("").join(out)
Beispiel #3
0
    def render_link(self):
        html = []
        items = []
        try:
            item = getattr(self._field._form._item, self._field.name)
        except AttributeError:
            log.warning("Missing %s attribute in %s"
                        % (self._field.name, self._field._form._item))
            return literal("").join(html)

        if not isinstance(item, list):
            items.append(item)
        else:
            items = item
        for item in items:
            url = get_link_url(item, self._field._form._request)
            if url:
                html.append(HTML.tag("a", href=("%s" % url), _closed=False))
                html.append(escape(unicode(item)))
                html.append(HTML.tag("/a", _closed=False))
        return literal("").join(html)
Beispiel #4
0
    def render_link(self):
        html = []
        items = []
        try:
            item = getattr(self._field._form._item, self._field.name)
        except AttributeError:
            log.warning("Missing %s attribute in %s" %
                        (self._field.name, self._field._form._item))
            return literal("").join(html)

        if not isinstance(item, list):
            items.append(item)
        else:
            items = item
        for item in items:
            url = get_link_url(item, self._field._form._request)
            if url:
                html.append(HTML.tag("a", href=("%s" % url), _closed=False))
                html.append(escape(unicode(item)))
                html.append(HTML.tag("/a", _closed=False))
        return literal("").join(html)