comparison doc/customizing.txt @ 3696:790363e96852

Sorting/grouping by multiple properties. - Implement sorting/grouping by multiple properties for the web interface. I'm now using @sort0/@sortdir0,@sort1/@sortdir1,... and @group0/@groupdir0,... when generating URLs from a search template. These are converted to a list internally. When saving URLs (e.g. when storing queries) I'm using @sort=prop1,prop2,... and @group=... with optional '-' prepended to individual props. This means saved URLs are backward compatible with existing trackers (and yes, this was a design goal). I need the clumsy version with @sort0,@sort1 etc, because I'm currently using several selectors and checkboxes (as the classic template does, too). I don't think there is a way around that in HTML? - Updated (hopefully all) documentation to reflect the new URL format and the consequences in the web-interface. - I've set the number of sort/group properties in the classic template to two -- this can easily be reverted by changing n_sort to 1. Richard, would you look over these changes? I've set a tag before and (will set) after commit, so that it would be easy to merge out. Don't be too scared about the size of the change, most is documentation, the guts are in cgi/templating.py and small changes in the classic template.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Wed, 30 Aug 2006 20:28:26 +0000
parents 722ab52d47fc
children af6eeba3a3f3
comparison
equal deleted inserted replaced
3695:01ea89743311 3696:790363e96852
1 =================== 1 ===================
2 Customising Roundup 2 Customising Roundup
3 =================== 3 ===================
4 4
5 :Version: $Revision: 1.205 $ 5 :Version: $Revision: 1.206 $
6 6
7 .. This document borrows from the ZopeBook section on ZPT. The original is at: 7 .. This document borrows from the ZopeBook section on ZPT. The original is at:
8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx 8 http://www.zope.org/Documentation/Books/ZopeBook/current/ZPT.stx
9 9
10 .. contents:: 10 .. contents::
1863 options are avaible for sorting: 1863 options are avaible for sorting:
1864 1864
1865 1. by the current *request* filterspec/filter/sort/group args 1865 1. by the current *request* filterspec/filter/sort/group args
1866 2. by the "filterspec", "sort" and "group" keyword args. 1866 2. by the "filterspec", "sort" and "group" keyword args.
1867 "filterspec" is ``{propname: value(s)}``. "sort" and 1867 "filterspec" is ``{propname: value(s)}``. "sort" and
1868 "group" are ``(dir, prop)`` where dir is '+', '-' or None 1868 "group" are an optionally empty list ``[(dir, prop)]``
1869 where dir is '+', '-' or None
1869 and prop is a prop name or None. 1870 and prop is a prop name or None.
1870 1871
1871 eg. ``issue.filter(filterspec={"priority": "1"}, 1872 eg. ``issue.filter(filterspec={"priority": "1"},
1872 sort=('activity', '+'))`` 1873 sort=('activity', '+'))``
1873 1874
2193 Variable Holds 2194 Variable Holds
2194 =========== ============================================================ 2195 =========== ============================================================
2195 columns dictionary of the columns to display in an index page 2196 columns dictionary of the columns to display in an index page
2196 show a convenience access to columns - request/show/colname will 2197 show a convenience access to columns - request/show/colname will
2197 be true if the columns should be displayed, false otherwise 2198 be true if the columns should be displayed, false otherwise
2198 sort index sort column (direction, column name) 2199 sort index sort columns [(direction, column name)]
2199 group index grouping property (direction, column name) 2200 group index grouping properties [(direction, column name)]
2200 filter properties to filter the index on 2201 filter properties to filter the index on
2201 filterspec values to filter the index on 2202 filterspec values to filter the index on
2202 search_text text to perform a full-text search on for an index 2203 search_text text to perform a full-text search on for an index
2203 =========== ============================================================ 2204 =========== ============================================================
2204 2205
2430 An index view specifier (URL fragment) looks like this (whitespace has 2431 An index view specifier (URL fragment) looks like this (whitespace has
2431 been added for clarity):: 2432 been added for clarity)::
2432 2433
2433 /issue?status=unread,in-progress,resolved& 2434 /issue?status=unread,in-progress,resolved&
2434 topic=security,ui& 2435 topic=security,ui&
2435 @group=priority& 2436 @group=priority,-status&
2436 @sort=-activity& 2437 @sort=-activity&
2437 @filters=status,topic& 2438 @filters=status,topic&
2438 @columns=title,status,fixer 2439 @columns=title,status,fixer
2439 2440
2440 The index view is determined by two parts of the specifier: the layout 2441 The index view is determined by two parts of the specifier: the layout
2452 of items with values matching any specified Multilink properties. 2453 of items with values matching any specified Multilink properties.
2453 2454
2454 The example specifies an index of "issue" items. Only items with a 2455 The example specifies an index of "issue" items. Only items with a
2455 "status" of either "unread" or "in-progress" or "resolved" are 2456 "status" of either "unread" or "in-progress" or "resolved" are
2456 displayed, and only items with "topic" values including both "security" 2457 displayed, and only items with "topic" values including both "security"
2457 and "ui" are displayed. The items are grouped by priority, arranged in 2458 and "ui" are displayed. The items are grouped by priority arranged in
2458 ascending order; and within groups, sorted by activity, arranged in 2459 ascending order and in descending order by status; and within
2459 descending order. The filter section shows filters for the "status" and 2460 groups, sorted by activity, arranged in descending order. The filter
2460 "topic" properties, and the table includes columns for the "title", 2461 section shows filters for the "status" and "topic" properties, and the
2461 "status", and "fixer" properties. 2462 table includes columns for the "title", "status", and "fixer"
2463 properties.
2462 2464
2463 ============ ============================================================= 2465 ============ =============================================================
2464 Argument Description 2466 Argument Description
2465 ============ ============================================================= 2467 ============ =============================================================
2466 @sort sort by prop name, optionally preceeded with '-' to give 2468 @sort sort by prop name, optionally preceeded with '-' to give
2467 descending or nothing for ascending sorting. 2469 descending or nothing for ascending sorting. Several
2470 properties can be specified delimited with comma.
2471 Internally a search-page using several sort properties may
2472 use @sort0, @sort1 etc. with option @sortdir0, @sortdir1
2473 etc. for the direction of sorting (a non-empty value of
2474 sortdir0 specifies reverse order).
2468 @group group by prop name, optionally preceeded with '-' or to sort 2475 @group group by prop name, optionally preceeded with '-' or to sort
2469 in descending or nothing for ascending order. 2476 in descending or nothing for ascending order. Several
2477 properties can be specified delimited with comma.
2478 Internally a search-page using several grouping properties may
2479 use @group0, @group1 etc. with option @groupdir0, @groupdir1
2480 etc. for the direction of grouping (a non-empty value of
2481 groupdir0 specifies reverse order).
2470 @columns selects the columns that should be displayed. Default is 2482 @columns selects the columns that should be displayed. Default is
2471 all. 2483 all.
2472 @filter indicates which properties are being used in filtering. 2484 @filter indicates which properties are being used in filtering.
2473 Default is none. 2485 Default is none.
2474 propname selects the values the item properties given by propname must 2486 propname selects the values the item properties given by propname must
3246 <option value="2">chaco</option> 3258 <option value="2">chaco</option>
3247 <option value="3">weave</option> 3259 <option value="3">weave</option>
3248 </select> 3260 </select>
3249 </td> 3261 </td>
3250 <td><input type="checkbox" name=":columns" value="category"></td> 3262 <td><input type="checkbox" name=":columns" value="category"></td>
3251 <td><input type="radio" name=":sort" value="category"></td> 3263 <td><input type="radio" name=":sort0" value="category"></td>
3252 <td><input type="radio" name=":group" value="category"></td> 3264 <td><input type="radio" name=":group0" value="category"></td>
3253 </tr> 3265 </tr>
3254 3266
3255 Adding category to the default view 3267 Adding category to the default view
3256 ::::::::::::::::::::::::::::::::::: 3268 :::::::::::::::::::::::::::::::::::
3257 3269

Roundup Issue Tracker: http://roundup-tracker.org/