## -*- coding: utf-8 -*- <%! from pylons import app_globals as g import mpulsweb.lib.helper.filters as F import mpulsweb.lib.helpers as h from mpulsweb.lib.translation import _ all_roles = ['admin', 'cm'] ## Fields to show in the case list. Each entry is a tuple of the form ## (TITLE, FIELDNAME, STYLE, ROLES, FORMATTER) ## Here, TITLE is the title of the field, FIELDNAME is the field name ## used in the search URL that's built for each column, STYLE is a CSS ## class name to use in the style attribute of the HTML TH-element, ## ROLES is a list with the names of the roles for which the field ## should be shown. Finally, FORMATTER is a python callable that is ## called with the case object as argument and which should return the ## formatted value for the column. fields = [] for d in g.agency.get_overview_fields(): f = d.name fn = d.overview_label fs = d.overview_style field = (fn,f,fs, all_roles, lambda case, d=d: h.shorten(h.format_object(case.get_value(d.name)), d.overview_length)) fields.append(field) %> <%def name="build_list_headers()"> % if g.mpuls_config.is_enabled('case-module', 'casebundle'):   % endif % for title, urlpart, style, roles, get_value in fields: % if h.hasRole(roles): ${title} ${_( ${_( % endif % endfor <%def name="build_list_row(case)"> % if g.mpuls_config.is_enabled('case-module', 'casebundle'): % endif % for title, urlpart, style, roles, get_value in fields: % if h.hasRole(roles): ${get_value(case) | F.NA} % endif % endfor ${build_list_headers()} % for num, case in enumerate(c.cases.getDatasets()): ${build_list_row(case)} % endfor % if len(c.cases.getDatasets()) <= 0: % endif
${_('No data found.')}