Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php |
— | — | @@ -232,20 +232,22 @@ |
233 | 233 | /** |
234 | 234 | * Render a set of records returned by getRecords() as an HTML table |
235 | 235 | */ |
236 | | - function renderRecords($records, $orderby = false, $cols = false) { |
| 236 | + function renderRecords($records, $orderby = false, $cols = false, $sortable = true) { |
237 | 237 | if (count($records) < 1) return wfMsg( 'recordadmin-nomatch' ); |
238 | 238 | |
239 | 239 | $special = Title::makeTitle( NS_SPECIAL, 'RecordAdmin' ); |
240 | 240 | $type = $this->type; |
| 241 | + $sortable = $sortable ? ' sortable' : ''; |
| 242 | + $br = $sortable ? '<br />' : ''; |
241 | 243 | |
242 | 244 | # Table header |
243 | | - $table = "<table class='sortable recordadmin $type-record'>\n<tr>"; |
| 245 | + $table = "<table class='recordadmin$sortable $type-record'>\n<tr>"; |
244 | 246 | $th = array( |
245 | | - 'title' => "<th class='col0'>" . wfMsg( 'recordadmin-title', $type ) . "<br></th>", |
246 | | - 'actions' => "<th class='col1'>" . wfMsg( 'recordadmin-actions' ) . "<br></th>", |
247 | | - 'created' => "<th class='col2'>" . wfMsg( 'recordadmin-created' ) . "<br></th>" |
| 247 | + 'title' => "<th class='col0'>" . wfMsg( 'recordadmin-title', $type ) . "$br</th>", |
| 248 | + 'actions' => "<th class='col1'>" . wfMsg( 'recordadmin-actions' ) . "$br</th>", |
| 249 | + 'created' => "<th class='col2'>" . wfMsg( 'recordadmin-created' ) . "$br</th>" |
248 | 250 | ); |
249 | | - foreach ( array_keys($this->types) as $col ) $th[$col] = "<th class='col$col'>$col<br></th>"; |
| 251 | + foreach ( array_keys($this->types) as $col ) $th[$col] = "<th class='col$col'>$col$br</th>"; |
250 | 252 | foreach ( $cols ? $cols : array_keys($th) as $col ) $table .= $th[$col]."\n"; |
251 | 253 | $table .= "</tr>\n"; |
252 | 254 | |
— | — | @@ -448,25 +450,27 @@ |
449 | 451 | */ |
450 | 452 | function expandMagic(&$parser, $type) { |
451 | 453 | $parser->mOutput->mCacheTime = -1; |
452 | | - $filter = array(); |
453 | | - $title = ''; |
454 | | - $invert = false; |
455 | | - $orderby = false; |
456 | | - $cols = false; |
| 454 | + $filter = array(); |
| 455 | + $title = ''; |
| 456 | + $invert = false; |
| 457 | + $orderby = false; |
| 458 | + $cols = false; |
| 459 | + $sortable = true; |
457 | 460 | foreach (func_get_args() as $arg) if (!is_object($arg)) { |
458 | 461 | if (preg_match("/^(.+?)\\s*=\\s*(.+)$/", $arg, $match)) { |
459 | 462 | list(, $k, $v) = $match; |
460 | 463 | if ($k == 'title') $title = $v; |
461 | | - elseif ($k == 'invert') $invert = $v; |
462 | | - elseif ($k == 'orderby') $orderby = $v; |
463 | | - elseif ($k == 'cols') $cols = preg_split('/\s*,\s*/', $v); |
| 464 | + elseif ($k == 'invert') $invert = $v; |
| 465 | + elseif ($k == 'orderby') $orderby = $v; |
| 466 | + elseif ($k == 'cols') $cols = preg_split('/\s*,\s*/', $v); |
| 467 | + elseif ($k == 'sortable') $sortabke = $v; |
464 | 468 | else $filter[$match[1]] = $match[2]; |
465 | 469 | } |
466 | 470 | } |
467 | 471 | $this->preProcessForm($type); |
468 | 472 | $this->examineForm(); |
469 | 473 | $records = $this->getRecords($type, $filter, $title, $invert); |
470 | | - $table = $this->renderRecords($records, $orderby, $cols); |
| 474 | + $table = $this->renderRecords($records, $orderby, $cols, $sortable); |
471 | 475 | return array( |
472 | 476 | $table, |
473 | 477 | 'noparse' => true, |