contao / core

Contao 3 → see contao/contao for Contao 4
GNU Lesser General Public License v3.0
490 stars 214 forks source link

DCA sorting evaluation key for file tree widget #4072

Closed xchs closed 10 years ago

xchs commented 12 years ago

It would be nice to have in the FileTree class another DCA evaluation key to sort the file tree (of "singleSRC" or "multiSRC" fields) by certain criteria, e.g. "ascending", "descending", etc. (cf. the existing DCA "flag" evaluation key)

Currently, we have the following (special) evaluation keys to configure the behavior of the file tree widget: "fieldType", "files", "filesOnly", "extensions", "path"

leofeyer commented 12 years ago

Isn't a file tree always sorted alphabetically?

xchs commented 12 years ago

Well, in my operating system's default file manager I have many choices to sort (ascending or descending) the file and folder tree view by different details ("name", "file size", "file extension/type", "date modified", etc.) Indeed, this is actually what I miss in the current file tree widget. For instance, if someone organized files in a date-based folder structure it would be nice to sort the entries in a descending sort order to have the latest entries always on top:

File tree descending

instead of

File tree ascending

leofeyer commented 12 years ago

Implemented (at least ascending/descending) in 71ac3a0a784b0f8c91e39a90ed923ec55c958e09.

xchs commented 12 years ago

Great, thanks a lot! It works perfectly well. Your support is much appreciated.

BTW: The "Apply" button in the Simple Modal Window does not seem to work in Firefox 11.0. However, it works just fine in Chrome.

xchs commented 10 years ago

Does this feature still work in Contao 3.3.3? I just tried to set e.g.

$GLOBALS['TL_DCA']['tl_content']['fields']['singleSRC']['flag'] = 2;

in my local DCA configuration but the file sorting has not changed.

leofeyer commented 10 years ago

It does not. The feature has been removed in 01acdd20d1911ed3dc64c225b8f911561f34b930, after we have discussed and decided to show the file system and not the DB entries in the file picker. If you re-upload the broken images above, I'll see if the behavior can be accomplished on PHP level.

xchs commented 10 years ago

The feature has been removed in 01acdd2

Oh, I see. Thanks.

If you re-upload the broken images above

Done.

I'll see if the behavior can be accomplished on PHP level.

Many thanks in advance.

leofeyer commented 10 years ago

Implemented in 9d6686d3e615e327a37e81d6a55e390f8cd7bbd1. However, I had to move the flag to the eval section, so now the syntax is:

$GLOBALS['TL_DCA']['tl_content']['fields']['singleSRC']['eval']['sort'] = 'desc';

I decided to go for a sort flag, which could be extended with other sorting modes such as "by extension" or "by file size" in the future.

aschempp commented 10 years ago

Can’t we use the existing „flag“ attribute?=

leofeyer commented 10 years ago

Nope, the "flag" attribute is not available as widget attribute. And it does not do the same thing, e.g. it has six different settings for "ascending" and six for "descending", because it also modifies the way the listing is rendered.

aschempp commented 10 years ago

You’re right, and we would not want the list sorting to affect the widget sorting.=