## -*- 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.case.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)
# Extend fields with default fields in overview
fields.extend([(_('Updated'), "zugriff", "table_name", ["cm", "admin"],
lambda case: h.format_date(case.state.getAccessTime())),
])
%>
<%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
${_('Status')}
${_('Actions')}
%def>
<%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):
% if case.getState().getState() != 5: