1.1 --- a/ImprovedTableParser.py Mon Feb 20 21:59:32 2012 +0100
1.2 +++ b/ImprovedTableParser.py Tue Feb 21 00:05:55 2012 +0100
1.3 @@ -426,17 +426,25 @@
1.4
1.5 return 0
1.6
1.7 -def write_sort_control(request, columnnumber, fmt, write, sort_columns, column_types, columns, table_name, start=0):
1.8 +def write_sort_control(request, columnnumber, columns, sort_columns, column_types, table_name, start=0):
1.9
1.10 """
1.11 - Write a sort control in a pop-up element which provides a list of links
1.12 - corresponding to modified sort criteria.
1.13 + Using the 'request', write a sort control for the given 'columnnumber' in
1.14 + the collection of 'columns', using the existing 'sort_columns' and
1.15 + 'column_types' to construct labels and links that modify the sort criteria,
1.16 + and using the given 'table_name' to parameterise the links.
1.17 """
1.18
1.19 + fmt = request.formatter
1.20 + write = request.write
1.21 _ = request.getText
1.22
1.23 write(fmt.div(1, css_class="sortcolumns"))
1.24
1.25 + write(fmt.paragraph(1))
1.26 + write(fmt.text(_("Sort by columns...")))
1.27 + write(fmt.paragraph(0))
1.28 +
1.29 # Start with the existing criteria without this column being involved.
1.30
1.31 revised_sort_columns = [(column, fn, ascending)
1.32 @@ -509,9 +517,9 @@
1.33 sortcolumns_revised = get_sort_column_output(revised_sort_columns)
1.34 write_sort_link(write, request, fmt, table_name, sortcolumns_revised, u"%s %s" % (label, arrow), "removecolumn")
1.35
1.36 - # Alternative sort direction.
1.37 + # Alternative sort direction.
1.38
1.39 - write_sort_link(write, request, fmt, table_name, sortcolumns_reverse, arrow_reverse, "altdirection")
1.40 + write_sort_link(write, request, fmt, table_name, sortcolumns_reverse, arrow_reverse, "altdirection")
1.41
1.42 write(fmt.listitem(0))
1.43
1.44 @@ -653,7 +661,7 @@
1.45 # Add sorting controls, if appropriate.
1.46
1.47 if sortable:
1.48 - write_sort_control(request, columnnumber, fmt, write, sort_columns, column_types, columns, table_name)
1.49 + write_sort_control(request, columnnumber, columns, sort_columns, column_types, table_name)
1.50 write(fmt.div(0))
1.51
1.52 write(fmt.table_cell(0))