[GH-ISSUE #197] Sorting by size and time is wrong. #140

Closed
opened 2026-03-02 15:56:08 +03:00 by kerem · 3 comments
Owner

Originally created by @EV-soft on GitHub (Jul 23, 2019).
Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/197

Version 2.3.8:
Column size looks cluttered with left adjustment, and is wrong, when numbers are converted by units.
Column time is wrong, when year is located in the middle of the text string.

Originally created by @EV-soft on GitHub (Jul 23, 2019). Original GitHub issue: https://github.com/prasathmani/tinyfilemanager/issues/197 Version 2.3.8: Column size looks cluttered with left adjustment, and is wrong, when numbers are converted by units. Column time is wrong, when year is located in the middle of the text string.
kerem 2026-03-02 15:56:08 +03:00
Author
Owner

@EV-soft commented on GitHub (Jul 23, 2019):

One solution to fix sorting, is add a hidden prefix to TD-output:

Line 1764 - Change:
$modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));
To:

$ftime = filemtime($path . '/' . $f);
$modif = date(FM_DATETIME_FORMAT, $ftime);

Line 1786- Change:

                    <td><?php if ($calc_folder) { echo fm_get_directorysize($path . '/' . $f); } else { echo "Folder"; } ?></td>
                    <td><?php echo $modif ?></td>

To:

                    <td><?php if ($calc_folder) { $foldsize = fm_get_directorysize($path . '/' . $f); echo '<span style="display:none;">'.str_pad($foldsize, 18, "0", STR_PAD_LEFT).' </span>'.fm_get_filesize($foldsize); } else { echo "Folder"; } ?></td>
                    <td><?php echo '<span style="display:none;">'.$ftime.'</span>'.$modif ?></td>

Line 1809- Change:
$modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));

To:

               $ftime = filemtime($path . '/' . $f); //  Sort criteria
                $modif = date(FM_DATETIME_FORMAT, $ftime);

Line 1836- Change:
<?php echo $filesize; ?>
To:
<?php echo '<span style="display:none;">'.str_pad($filesize_raw, 18, "0", STR_PAD_LEFT).'</span>'.$filesize; ?>

Line 1838- Change:
<td><?php echo $modif ?></td>
To:
<td><?php echo '<span style="display:none;">'.$ftime.'</span>'.$modif ?></td>

Another defect
For Table: Zebra-background on rows to display:
Line 3142- add:
.table-bordered tr:nth-child(even) { background: #f8f8f8; }

<!-- gh-comment-id:514353581 --> @EV-soft commented on GitHub (Jul 23, 2019): One solution to fix sorting, is add a hidden prefix to TD-output: Line 1764 - Change: ` $modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));` To: ``` $ftime = filemtime($path . '/' . $f); $modif = date(FM_DATETIME_FORMAT, $ftime); ``` Line 1786- Change: ``` <td><?php if ($calc_folder) { echo fm_get_directorysize($path . '/' . $f); } else { echo "Folder"; } ?></td> <td><?php echo $modif ?></td> ``` To: ``` <td><?php if ($calc_folder) { $foldsize = fm_get_directorysize($path . '/' . $f); echo '<span style="display:none;">'.str_pad($foldsize, 18, "0", STR_PAD_LEFT).' </span>'.fm_get_filesize($foldsize); } else { echo "Folder"; } ?></td> <td><?php echo '<span style="display:none;">'.$ftime.'</span>'.$modif ?></td> ``` Line 1809- Change: ` $modif = date(FM_DATETIME_FORMAT, filemtime($path . '/' . $f));` To: ``` $ftime = filemtime($path . '/' . $f); // Sort criteria $modif = date(FM_DATETIME_FORMAT, $ftime); ``` Line 1836- Change: ` <?php echo $filesize; ?>` To: ` <?php echo '<span style="display:none;">'.str_pad($filesize_raw, 18, "0", STR_PAD_LEFT).'</span>'.$filesize; ?>` Line 1838- Change: ` <td><?php echo $modif ?></td>` To: ` <td><?php echo '<span style="display:none;">'.$ftime.'</span>'.$modif ?></td>` **Another defect** For Table: Zebra-background on rows to display: Line 3142- add: ` .table-bordered tr:nth-child(even) { background: #f8f8f8; } `
Author
Owner

@EV-soft commented on GitHub (Aug 3, 2019):

I have worked on other improvements, as well as those already mentioned.
View source documents in ZIP file
Watch the demo here: DEMO
Comments have been added to all corrections. (Search: Translate / EV-soft / more... )
Of particular note is the routine for the maintenance of language translations. (See Settings)
Complete Danish language is included i translation.json

<!-- gh-comment-id:517914729 --> @EV-soft commented on GitHub (Aug 3, 2019): I have worked on other improvements, as well as those already mentioned. View source documents in [ZIP file](https://www.sky-box.dk/tinyFM/TFM-2.3.8-EV.zip) Watch the demo here: [DEMO](https://www.sky-box.dk/tinyFM/TFM-v2.3.8.php?p=) Comments have been added to all corrections. (Search: Translate / EV-soft / more... ) Of particular note is the routine for the maintenance of language translations. (See Settings) Complete Danish language is included i translation.json
Author
Owner

@Huseriato commented on GitHub (May 8, 2020):

We're also interested to see this bug done.

<!-- gh-comment-id:625718210 --> @Huseriato commented on GitHub (May 8, 2020): We're also interested to see this bug done.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/tinyfilemanager#140
No description provided.