Edgewall Software

Ticket #9125: 9125.patch

File 9125.patch, 2.1 KB (added by Carsten Klein <carsten.klein@…>, 2 years ago)

revised patch to report.py

  • trac/ticket/report.py

    old new  
    436436                header_groups.append([]) 
    437437            header_group.append(header) 
    438438 
     439        maxcols = 0  
     440        for header_group in header_groups: 
     441            numhidden = 0 
     442            numcols = 0 
     443            for header in header_group: 
     444                if header['hidden']: 
     445                    numhidden += 1 
     446                else: 
     447                    numcols += 1 
     448            maxcols = numcols > maxcols and numcols or maxcols 
     449            i = 1 
     450            for header in header_group: 
     451                header['numhidden'] = numhidden 
     452                header['grpindex'] = i 
     453                i += 1 
     454 
    439455        # Structure the rows and cells: 
    440456        #  - group rows according to __group__ value, if defined 
    441457        #  - group cells the same way headers are grouped 
     
    467483                               '__fgcolor__', '__bgcolor__', 
    468484                               '__grouplink__'): 
    469485                        row[col] = value 
    470                     if col in ('report', 'ticket', 'id', '_id'): 
     486                    col = col.strip('_') 
     487                    if col in ('report', 'ticket', 'id'): 
    471488                        row['id'] = value 
    472489                    # Special casing based on column name 
    473                     col = col.strip('_') 
    474490                    if col in ('reporter', 'cc', 'owner'): 
    475491                        email_cells.append(cell) 
    476492                    elif col == 'realm': 
     
    505521        data.update({'header_groups': header_groups, 
    506522                     'row_groups': row_groups, 
    507523                     'numrows': numrows, 
     524                     'maxcols': maxcols, 
    508525                     'sorting_enabled': len(row_groups)==1, 
    509526                     'email_map': email_map}) 
    510527 
     
    765782        report, args, fragment = formatter.split_link(target) 
    766783        return tag.a(label, href=formatter.href.report(report) + args, 
    767784                     class_='report') 
     785