Omeka icon indicating copy to clipboard operation
Omeka copied to clipboard

Pluggable admin/items/browse

Open jeremyboggs opened this issue 8 years ago • 4 comments

Have had requests on a couple of separate projects to be able to sort items in the admin by different fields, including:

  • Date Modified
  • DC:Publisher
  • User

There doesn't seem to be a way now to modify the output of the admin's items/browse with a plugin. So, for the latter two, I've just suggested using the advanced search form, but Date Modified would be a pretty useful column to have. For this, I've suggested adding the string `?sort_field=modified&sort_dir=d' to the end of the items/browse URL, and this works fine for actually sorting the items by date modified, but the date itself is not displayed in the table. (This date is actually never displayed anywhere as far as I can tell.)

Would think it useful to be able to modify items view in the admin panel, so projects could add or modify columns to satisfy their workflow desires.

jeremyboggs avatar Aug 26 '16 14:08 jeremyboggs

Hi,

I subscribe.

We should be able to choose the list of columns to display in this view, even the first (but it may be complex for it). This view is one of the most important in the backend.

Sincerely,

Daniel Berthereau Infodoc & Knowledge management

Daniel-KM avatar Aug 26 '16 14:08 Daniel-KM

One way we were considering making this pluggable (long ago) was building the list of columns and then the contents for each row first as arrays of data, rather than directly. Then that array could get filtered which would allow for reordering or adding columns, then we'd only after filtering walk through the row data to display it.

The contents of that array could either be the actual data or could be something like an argument that we'd pass to metadata.

zerocrates avatar Aug 26 '16 15:08 zerocrates

@Daniel-KM came up with pull request #733 for custom admin themes, so custom views are no longer an issue, aren't they? Anyway, I started a plugin for this together with multiple column sorting. It's long from being perfect or presentable as an official plugin, but the reason I'm sharing my thoughts are the next stages to consider. I used similar trick as Omeka has for adding elements into item types with sortable UI, with checkbox if the column may be used for sorting. For standard elements and values works metadata() just fine, but for custom formats or DB fields I had to prepare config with closures for getter and formatter of the values, that I use for rendering of each table row. As soon as user is able to change freely the tables, we need to offer column resizer, because of "unknown" column width - this is possible with jQuery UI Resizable, so still good. Responsive table with horizontal scrolling is also a must. But then tough request - sort certain columns in natural order. This feature seems to be for users as important as custom fields in the listing. There is no good straightforward way to do so in MySQL, and the only way I see is to add new field into element_texts table, with generated sort keys from the text value. Formatting texts during SELECT for this purpose is 1 minute job for 100k items... I hope it helps with planning of this feature, if it should be part of core.

luku avatar Aug 26 '16 19:08 luku

Hi,

Just a note about #733. This is a quick hack, it doesn't work like public themes: the default theme views are not used when a specific file like my_theme/items/browse.php or another one is missing.

Sincerely,

Daniel Berthereau Infodoc & Knowledge management

Daniel-KM avatar Aug 29 '16 06:08 Daniel-KM