{# Copyright (C) 2006-2023 Edgewall Software This software is licensed as described in the file COPYING, which you should have received as part of this distribution. The terms are also available at https://trac.edgewall.org/wiki/TracLicense. This software consists of voluntary contributions made by many individuals. For the exact contribution history, see the revision history and logs, available at https://trac.edgewall.org/. #} {# Generate table containing ticket query results. Arguments: - groups - a dict, where: key - is the value shared by all results in this group value - is the list of corresponding tickets - headers - a sequence of header structure: .name - field name for this header .label - what to display for this header - fields - dict of field name to field structure: .label - field label - query - the actual Query instance used to perform the query #}
# if paginator.has_more_pages: # set numresults (${paginator.displayed_items()}) # endset

${tag_("Results %(num)s", num=numresults)}

# endif # include 'page_index.html' if paginator.show_index # macro group_heading(groupname, results) # if groupname is not none:

# with # set grouplabel = fields[query.group].label # set groupname = (authorinfo(groupname) if query.group in ('owner', 'reporter') else (groupname or _('None'))) # set count (${ngettext('%(num)s match', '%(num)s matches', len(results))}) # endset # trans grouplabel, groupname, count ${grouplabel}: ${groupname} ${count} # endtrans # endwith

# endif # endmacro # if len(groups) > 0: # endif # macro column_headers() # for header in headers: # endfor # endmacro ${column_headers()} # with num_cols = len(headers) # for groupname, results in groups: # if not loop.first: # if groupname is not none: # endif ${column_headers()} # endif # if not results: # endif # for result in results: # set ticket_context = context.child('ticket', result.id) # if 'TICKET_VIEW' in perm(ticket_context.resource): # for header in headers: # set name = header.name # set value = result[name] # set wikitext = (header.field.type == 'text' and header.field.format == 'wiki') # set wikitextarea = (header.field.type == 'textarea' and header.field.format == 'wiki') # if name == 'id': # else: # endif # endfor # if ticket_context.resource in context: # else: # for r in row if result[r]: # set field = fields.get(r) # set value = result[r] # endfor # endif # endif # endfor # if loop.last and last_group_is_partial: # endif # endfor
${group_heading(*groups[0])}
# with asc = _('(ascending)'), desc = _('(descending)') ${header.label} # endwith
${group_heading(groupname, results)}
${_("No tickets found")}
#${result.id} # if name == 'summary': ${value} # elif header.field.type == 'time': ${pretty_dateinfo(value, header.field.format, dateonly=True)} # elif header.field.type == 'checkbox': ${_("yes") if value else _("no")} # elif name == 'reporter': ${authorinfo(value)} # elif name == 'cc': ${format_emails(ticket_context, value)} # elif name == 'owner' and value: ${authorinfo(value)} # elif name == 'milestone' and value: ${resource_link(context, Resource('milestone', value), 'compact')} # elif wikitext: ${wiki_to_oneliner(ticket_context, value)} # elif wikitextarea: ${wiki_to_html(ticket_context, value)} # elif header.field.type == 'textarea': # for line in (value.splitlines() if value else []): # if loop.index > 1:
# endif ${line} # endfor # else: ${value} # endif

${_("(this ticket)")}

${field.label if field else (r or 'none')} # if field.format == 'wiki': ## FIXME what to do with xml:space="preserve"? ${wiki_to_html(ticket_context, value)} # else: # for line in (value.splitlines() if value else []): # if loop.index > 1:
# endif ${line} # endfor # endif
${_("(more results for this group on next page)")}
# endwith # include 'page_index.html' if paginator.show_index