Skip to content

Commit 4d3d9ec

Browse files
smg6511opengeek
andauthored
Fix Media Browser Sorting by Modification Date (#16734)
### What does it do? Adds raw, unformatted date data into store for use in sorting. ### Why is it needed? Some custom formatted date strings can break proper sorting. ### How to test Open Media Browser and select a folder with several files. When choosing to sort by Last Modified, files should show in descending order (you can only check this by selecting each file and taking note of the date in the right details panel). ### Related issue(s)/PR(s) Resolves #16731 --------- Co-authored-by: Jason Coward <[email protected]>
1 parent ba4e3d4 commit 4d3d9ec

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

core/src/Revolution/Processors/Browser/Directory/GetFiles.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public function process()
5353
/** @var modManagerDateFormatter $formatter */
5454
$formatter = $this->modx->services->get(modManagerDateFormatter::class);
5555
foreach ($list as $i => $file) {
56+
$list[$i]['lastmod_raw'] = $file['lastmod'];
5657
$list[$i]['lastmod'] = $formatter->formatDateTime($file['lastmod']);
5758
}
5859

manager/assets/modext/modx.jsgrps-min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

manager/assets/modext/widgets/media/modx.browser.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ MODx.browser.View = function(config) {
4444
,'cls','url','relativeUrl','fullRelativeUrl','image','original_width','original_height','image_width','image_height','thumb','thumb_width','thumb_height','pathname','pathRelative','ext','disabled','preview'
4545
,{name: 'size', type: 'float'}
4646
,'lastmod'
47+
,'lastmod_raw'
4748
,'menu', 'visibility'
4849
]
4950
,baseParams: {
@@ -802,7 +803,7 @@ Ext.extend(MODx.browser.Window,Ext.Window,{
802803
data : [
803804
['name', _('name')]
804805
,['size', _('file_size')]
805-
,['lastmod', _('last_modified')]
806+
,['lastmod_raw', _('last_modified')]
806807
]
807808
})
808809
,listeners: {
@@ -1207,7 +1208,7 @@ Ext.extend(MODx.Media, Ext.Container, {
12071208
data : [
12081209
['name', _('name')]
12091210
,['size', _('file_size')]
1210-
,['lastmod', _('last_modified')]
1211+
,['lastmod_raw', _('last_modified')]
12111212
]
12121213
})
12131214
,listeners: {
@@ -1580,7 +1581,7 @@ Ext.extend(MODx.browser.RTE,Ext.Viewport,{
15801581
data : [
15811582
['name', _('name')]
15821583
,['size', _('file_size')]
1583-
,['lastmod', _('last_modified')]
1584+
,['lastmod_raw', _('last_modified')]
15841585
]
15851586
})
15861587
,listeners: {

0 commit comments

Comments
 (0)