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))
2.1 --- a/css/improvedtableparser.css Mon Feb 20 21:59:32 2012 +0100
2.2 +++ b/css/improvedtableparser.css Tue Feb 21 00:05:55 2012 +0100
2.3 @@ -33,6 +33,10 @@
2.4
2.5 /* Column listings. */
2.6
2.7 +.sortcolumns p {
2.8 + padding: 0.5em 0.5em 0 0.5em;
2.9 +}
2.10 +
2.11 .sortcolumns ol {
2.12 margin: 0.5em;
2.13 padding: 0.25em 1.5em 0.25em 1.5em;
2.14 @@ -90,10 +94,19 @@
2.15 display: block;
2.16 }
2.17
2.18 +a.altdirection,
2.19 +.newsortcolumn {
2.20 + color: #000;
2.21 + padding: 0.5em;
2.22 +}
2.23 +
2.24 +a.altdirection {
2.25 + background-color: #fcc;
2.26 +}
2.27 +
2.28 +a.altdirection:hover,
2.29 .newsortcolumn {
2.30 background-color: #f66;
2.31 - color: #000;
2.32 - padding: 0.5em;
2.33 }
2.34
2.35 .appendcolumn {