[Phpmyadmin-devel] 3 patch suggestions for master

Tyron Madlener tyronx at gmail.com
Tue Jun 7 20:59:53 CEST 2011


One more suggestion, I'm still not happy with PMA_formatNumber() ;)

While replacing pChart in the profiling info I also wanted to format
the numbers in the table a bit nicer, however that is with the current
version of PMA_formatNumber not really possible, as it returns numbers
like '0.003 m' which are much harder to read than '30 µ'
And its general behavior seems kinda odd to me. My rewrite is a lot
shorter and simpler too.

Comparison with the supplied example parameters, old:
 * echo PMA_formatNumber(123456789, 6);     // 123,457 k
 * echo PMA_formatNumber(-123456789, 4, 2); //    -123.46 M
 * echo PMA_formatNumber(-0.003, 6);        //      -3 m
 * echo PMA_formatNumber(0.003, 3, 3);      //       0.003
 * echo PMA_formatNumber(0.00003, 3, 2);    //       0.03 m
 * echo PMA_formatNumber(0, 6);             //       0

And with my new code:
123,457 k
-123.46 M
-3,000 µ
3m
30 µ
0

I've also changed the parameters slightly

Old:
function PMA_formatNumber($value, $length = 3, $comma = 0, $only_down = false);

New:
function PMA_formatNumber($value, $digits_left = 3, $digits_right = 0,
$only_down = false, $noTrailingZero = true);

digits_left,digits_right behave the same as length,comma
noTrailingZero removes zeros right of the comma, e.g. 3.4000 => 3.4 -
this will be helpful if a bunch of numbers should be formatted all the
same.

Commit id is 86323a781560b4526b5f5010a1c93adeb410ba51 on my repos. And
e913dcc6e115a52b2a3305e53cc74fcc3d4d1a46 replaces the tabs with
spaces.

> On Sat, May 28, 2011 at 12:05 AM, Tyron Madlener <tyronx at gmail.com> wrote:
> Since I always have a love for details, here's 3 small suggestions
> that maybe can be merged into the master branch. They are all pushed
> to my fork (http://repo.or.cz/w/phpmyadmin/tyronm.git):
>
> - Commit a0302c666c1bf9f9715364a6301238b474aedac1
> Removes timepicker.js. It is already included with the jquery ui. The
> file was included only in tbl_change.php and tbl_select.php
>
> - Commit b161f43ec9089e0d2d5fb8a619056e6f9577a380
> When reloading (flushing) privileges on the privileges tab you get a 5
> second long success message. This commit omits the success message and
> removes the loading message as soon as the ajax request is done. This
> behavior seems more consistent with my patch in April that removes
> messages once the ajax request is completed.
>
> - Commit 99775c9bad552aac8b904996d673f1023821ab13
> Removes the initials table on the privileges tab if there is 20 or
> less privileges to show. With 1-20 privileges you can easily see all
> host names and don't need any filtering by initials imo. I would even
> increase that limit to 30 or so.
>




More information about the Developers mailing list