Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php |
— | — | @@ -396,9 +396,11 @@ |
397 | 397 | $tmp = array(); |
398 | 398 | foreach ( $records as $r ) { |
399 | 399 | $v0 = $r[$groupby[0]]; |
| 400 | + unset( $r[$groupby[0]] ); |
400 | 401 | if ( !isset( $tmp[$v0] ) || !is_array( $tmp[$v0] ) ) $tmp[$v0] = array(); |
401 | 402 | if ( isset( $groupby[1] ) ) { |
402 | 403 | $v1 = $r[$groupby[1]]; |
| 404 | + unset( $r[$groupby[1]] ); |
403 | 405 | if ( !isset( $tmp[$v0][$v1] ) || !is_array( $tmp[$v0][$v1] ) ) $tmp[$v0][$v1] = array(); |
404 | 406 | $tmp[$v0][$v1][] = $r; |
405 | 407 | } else $tmp[$v0][] = $r; |
— | — | @@ -455,6 +457,7 @@ |
456 | 458 | function renderRecords( $records, $cols = false, $sortable = true, $template = false, $name = 'wpSelect', $export = true, $groupby = false ) { |
457 | 459 | global $wgParser, $wgTitle, $wgRequest; |
458 | 460 | if ( count( $records ) < 1 ) return wfMsg( 'recordadmin-nomatch' ); |
| 461 | + if ( $groupby ) $groupby = preg_split( '/\s*,\s*/', $groupby ); |
459 | 462 | |
460 | 463 | $special = Title::makeTitle( NS_SPECIAL, 'RecordAdmin' ); |
461 | 464 | $type = $this->type; |
— | — | @@ -474,17 +477,21 @@ |
475 | 478 | $class = 'col' . preg_replace( '|\W|', '-', $col ); |
476 | 479 | $th[$col] = "<th class='$class'>$col$br</th>"; |
477 | 480 | } |
478 | | - $ncol = 0; |
479 | | - foreach ( $cols ? $cols : array_keys( $th ) as $col ) { |
480 | | - $html = isset( $th[$col] ) ? $th[$col] : "<th>$col</th>"; |
481 | | - $table .= "$html\n"; |
482 | | - $ncol++; |
| 481 | + $tmp = array(); |
| 482 | + $cols = $cols ? $cols : array_keys( $th ); |
| 483 | + foreach ( $cols as $col ) { |
| 484 | + if ( $groupby === false || !in_array( $col, $groupby ) ) { |
| 485 | + $html = isset( $th[$col] ) ? $th[$col] : "<th>$col</th>"; |
| 486 | + $table .= "$html\n"; |
| 487 | + $tmp[] = $col; |
| 488 | + } |
483 | 489 | } |
| 490 | + $cols = $tmp; |
| 491 | + $ncol = count( $cols ); |
484 | 492 | $table .= "</tr>\n"; |
485 | 493 | |
486 | 494 | # If using grouping, reconstruct the record tree as a list including headings |
487 | 495 | if ( $groupby ) { |
488 | | - $groupby = preg_split( '/\s*,\s*/', $groupby ); |
489 | 496 | $td = "<td colspan=\"$ncol\">"; |
490 | 497 | $tmp = array(); |
491 | 498 | foreach( $records as $k1 => $v1 ) { |
— | — | @@ -539,7 +546,7 @@ |
540 | 547 | 'created' => "<td class='col2 col-created'>$tsc</td>\n", |
541 | 548 | 'modified' => "<td class='col3 col-modified'>$tsm</td>\n", |
542 | 549 | ); |
543 | | - foreach ( $cols ? $cols : array_keys( $th ) as $col ) { |
| 550 | + foreach ( $cols as $col ) { |
544 | 551 | if ( !isset( $row[$col] ) ) { |
545 | 552 | $v = isset( $r[$col] ) ? $wgParser->parse( $r[$col], $wgTitle, $wgParser->mOptions, true, false )->getText() : ' '; |
546 | 553 | $class = 'col' . preg_replace( '|\W|', '-', $col ); |
Index: trunk/extensions/RecordAdmin/RecordAdmin.php |
— | — | @@ -11,7 +11,7 @@ |
12 | 12 | * @licence GNU General Public Licence 2.0 or later |
13 | 13 | */ |
14 | 14 | |
15 | | -define( 'RECORDADMIN_VERSION', '0.10.1, 2010-01-19' ); |
| 15 | +define( 'RECORDADMIN_VERSION', '0.10.2, 2010-01-19' ); |
16 | 16 | |
17 | 17 | $wgRecordAdminUseNamespaces = false; # Whether record articles should be in a namespace of the same name as their type |
18 | 18 | $wgRecordAdminCategory = 'Records'; # Category containing record types |