r94879 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r94878‎ | r94879 | r94880 >
Date:09:52, 18 August 2011
Author:nad
Status:deferred
Tags:
Comment:
more solid way to handle sortable parameter
Modified paths:
  • /trunk/extensions/RecordAdmin/RecordAdmin_body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/RecordAdmin/RecordAdmin_body.php
@@ -307,7 +307,7 @@
308308 if( $groupby ) $groupby = self::split( $groupby, ',' );
309309
310310 $type = $this->type;
311 - $id = strlen($sortable) > 5 ? " id=\"$sortable\"" : "";
 311+ $id = ( $sortable && $sortable != 1 ) ? " id=\"$sortable\"" : "";
312312 $sortable = $sortable ? " sortable" : "";
313313 $br = $sortable ? "<br />" : "";
314314 $format = $wgRequest->getText( 'export' );
@@ -957,7 +957,11 @@
958958 elseif( $k == 'groupby' ) $groupby = $v;
959959 elseif( $k == 'format' ) $format = $v;
960960 elseif( $k == 'cols' ) $cols = self::split( $v, ',' );
961 - elseif( $k == 'sortable' ) $sortable = !empty( $v );
 961+ elseif( $k == 'sortable' ) {
 962+ $sortable = strtolower( $v );
 963+ if( $sortable == 'yes' || $sortable == 'true' ) $sortable = 1;
 964+ if( $sortable == 'no' || $sortable == 'false' ) $sortable = false;
 965+ }
962966 elseif( $k == 'template' ) $template = $v;
963967 elseif( $k == 'count' ) $count = $v;
964968 elseif( $k == 'export' ) $export = $v;

Status & tagging log