Пример #1
0
def render_report_group(group, request, css_class=''):
    """Produce the HTML for a report group on a section index page"""
    if not (IPeopleSectionColumn.providedBy(group) or
            IPeopleReportGroup.providedBy(group)):
        return ''
    result = []
    title = getattr(group, 'title', '')
    if title:
        result.append('<h3>%s</h3>' % escape(group.title))
    if css_class:
        result.append('<ul class=%s>' % quoteattr(css_class))
    else:
        result.append('<ul>')
    for obj in group.values():
        if IPeopleReport.providedBy(obj):
            url = resource_url(obj, request)
            result.append('<li><a href=%s class=%s>%s</a></li>' % (
                quoteattr(url),
                quoteattr(obj.css_class),
                escape(obj.link_title)))
        elif IPeopleReportGroup.providedBy(obj):
            html = render_report_group(obj, request)
            result.append('<li>')
            result.append(html)
            result.append('</li>')
    result.append('</ul>')
    return '\n'.join(result)
Пример #2
0
def render_report_group(group, request, css_class=''):
    """Produce the HTML for a report group on a section index page"""
    if not (IPeopleSectionColumn.providedBy(group)
            or IPeopleReportGroup.providedBy(group)):
        return ''
    result = []
    title = getattr(group, 'title', '')
    if title:
        result.append('<h3>%s</h3>' % escape(group.title))
    if css_class:
        result.append('<ul class=%s>' % quoteattr(css_class))
    else:
        result.append('<ul>')
    for obj in group.values():
        if IPeopleReport.providedBy(obj):
            url = resource_url(obj, request)
            result.append('<li><a href=%s class=%s>%s</a></li>' %
                          (quoteattr(url), quoteattr(
                              obj.css_class), escape(obj.link_title)))
        elif IPeopleReportGroup.providedBy(obj):
            html = render_report_group(obj, request)
            result.append('<li>')
            result.append(html)
            result.append('</li>')
    result.append('</ul>')
    return '\n'.join(result)
Пример #3
0
def dump_peopledir(peopledir):
    old_style = getattr(peopledir, "categories", None) is not None
    template = PageTemplate(body=_DUMP_XML)
    if old_style:
        categories = peopledir.categories
    else:
        categories = peopledir["categories"]
    return template(
        peopledir=peopledir,
        categories=categories,
        sections=[(x, peopledir[x]) for x in peopledir.order],
        is_column=lambda x: IPeopleSectionColumn.providedBy(x),
        is_group=lambda x: IPeopleReportGroup.providedBy(x),
        is_report=lambda x: IPeopleReport.providedBy(x),
        is_redirector=lambda x: IPeopleRedirector.providedBy(x),
        category_items=_category_items,
        acl_info=_acl_info,
        column_info=_column_info,
        report_items=_report_items,
        report_filter_items=_report_filter_items,
    )
Пример #4
0
def dump_peopledir(peopledir):
    old_style = getattr(peopledir, 'categories', None) is not None
    template = PageTemplate(body=_DUMP_XML)
    if old_style:
        categories = peopledir.categories
    else:
        categories = peopledir['categories']
    return template(
        peopledir=peopledir,
        categories=categories,
        sections=[(x, peopledir[x]) for x in peopledir.order],
        is_column=lambda x: IPeopleSectionColumn.providedBy(x),
        is_group=lambda x: IPeopleReportGroup.providedBy(x),
        is_report=lambda x: IPeopleReport.providedBy(x),
        is_redirector=lambda x: IPeopleRedirector.providedBy(x),
        category_items=_category_items,
        acl_info=_acl_info,
        column_info=_column_info,
        report_items=_report_items,
        report_filter_items=_report_filter_items,
    )