Ejemplo n.º 1
0
def reportLinkDirective(_context,
                        name,
                        permission,
                        for_=Interface,
                        layer=IDefaultBrowserLayer,
                        view=IBrowserView,
                        manager=IReportLinkViewletManager,
                        class_=ReportLinkViewlet,
                        template=None,
                        group=u'',
                        title=u'',
                        description='',
                        link='',
                        file_type='',
                        **kwargs):

    flourish.zcml.viewlet(_context,
                          name,
                          permission,
                          for_=for_,
                          layer=layer,
                          view=view,
                          manager=manager,
                          class_=class_,
                          template=template,
                          group=group,
                          title=title,
                          description=description,
                          link=link,
                          file_type=file_type,
                          **kwargs)

    # Register the report for reference
    utility = getReportRegistrationUtility()
    utility.registerReport(group, title, description, file_type, name, layer)
Ejemplo n.º 2
0
def reportLinkDirective(_context, name, permission, for_=Interface,
    layer=IDefaultBrowserLayer, view=IBrowserView,
    manager=IReportLinkViewletManager,
    class_=ReportLinkViewlet, template=None, group=u'', title=u'',
    description='', link='', file_type='', **kwargs):

    flourish.zcml.viewlet(
        _context, name, permission,
        for_=for_, layer=layer, view=view,
        manager=manager,
        class_=class_, template=template,
        group=group, title=title, description=description, link=link,
        file_type=file_type, **kwargs)

    # Register the report for reference
    utility = getReportRegistrationUtility()
    utility.registerReport(group, title, description, file_type, name, layer)
Ejemplo n.º 3
0
    def rows(self):
        collator = ICollator(self.request.locale)
        utility = getReportRegistrationUtility()
        app = self.context

        rows = []
        for group_key, group_reports in utility.reports_by_group.items():
            reference_url = reportLinksURL(app, self.request, name=group_key)
            for report in group_reports:
                row = {
                    'url': reference_url,
                    'group': report['group'],
                    'title': report['title'],
                    'description': report['description'],
                    }
                rows.append([collator.key(report['group']),
                             collator.key(report['title']),
                             row])

        return [row for group, title, row in sorted(rows)]
Ejemplo n.º 4
0
 def rows(self):
     self.collator = ICollator(self.request.locale)
     utility = getReportRegistrationUtility()
     app = self.context
     rows = {}
     for group_key, group_reports in utility.reports_by_group.items():
         reference_url = reportLinksURL(app, self.request, name=group_key)
         for report in group_reports:
             group = report['group']
             name = report['name']
             row = {
                 'url': reference_url,
                 'group': group,
                 'title': report['title'],
                 'file_type': report['file_type'].upper(),
                 'description': report['description'],
             }
             # XXX: this check is needed to override old skin
             #      report links with flourish ones
             if (group, name) not in rows or \
                report['layer'] is IFlourishLayer:
                 rows[group, name] = row
     return sorted(rows.values(), key=self.sortKey)
Ejemplo n.º 5
0
 def rows(self):
     self.collator = ICollator(self.request.locale)
     utility = getReportRegistrationUtility()
     app = self.context
     rows = {}
     for group_key, group_reports in utility.reports_by_group.items():
         reference_url = reportLinksURL(app, self.request, name=group_key)
         for report in group_reports:
             group = report['group']
             name = report['name']
             row = {
                 'url': reference_url,
                 'group': group,
                 'title': report['title'],
                 'file_type': report['file_type'].upper(),
                 'description': report['description'],
                 }
             # XXX: this check is needed to override old skin
             #      report links with flourish ones
             if (group, name) not in rows or \
                report['layer'] is IFlourishLayer:
                 rows[group, name] = row
     return sorted(rows.values(), key=self.sortKey)