Item Order alternative for 2.0?

I'm a new user so I'm probably missing something, but I've tried the Item Order plug-in and the plug in screen it says it's not a valid plug in. I note it is not included in the 2.0 plugins list.

I can't be the only person who needs to reorder items in a collection. The default order of upload date/time seems pretty useless to me. Anybody have an idea of a better way?

I'm kinda of stuck because it seems to order them by when you put them in, so if I'm working on a big project I have to have them all done in order before I begin uploading.

I had the same reaction when I saw the order of items when I first started using Omeka. It was a struggle to get items to display in an order that matched my plans.

Here's my take on sorting items for someone getting started. It's what I would have liked to have read when I first ran into the issue, first to stop putting hope on the Item Ordering plugin as a good solution, and second to see how the item browse request works at the URL level because it is a key part of Omeka's engine.

The Item Order plugin allows you to re-arrange the set of items to be displayed in an arbitrary order set by the rearrange activity. This is not a great solution if your items have a natural order based on an attribute.

Why have a workflow that needs a manual operation to set the order of items?

If your items have a natural ordering based on an attribute such as Title or Creator (called element texts or element values in Omeka) then it is possible to tell Omeka to use the attribute's value for sorting.

Also, it is easy to extend the set of attributes for an item to include something like a Display Sequence value that can be used to control display order. Add it as a new Item Type Metadata element. Set its value for each item when loading an Item's data into Omeka.

The default Omeka product doesn't know which item attribute to sort by so it picks one to use. It uses the time of insert in descending order (last in, first out).

Omeka imposes this default sort policy inside the core PHP code so it is not obvious what is going on when looking at theme scripts.

If sort order were set in the standard themes as part of the basic functionality, then it would be simpler to see where a sort order policy was set and how to change it.

Unfortunately, there are no examples in the standard themes of setting the sort order. It requires digging a bit to find the technique for setting sort order in a theme script.

The codex on sorting has an answer that is correct but not that helpful until you are an experienced code changer that can understand the clues.

All things related to changing the sort order require that you already have mastered the basic concepts of customizing a theme.

There are set of PHP script files that are used implicitly to produce the HTML for the web site.
You may have your own version of those files that you can modify easily and safely.
When you copy the initial standard set of files into a new location in "themes" that you control and can edit, you have created a custom theme.
Editing the script files to have minor changes can be done by following patterns and doing simple replacement.
Editing the script files to become very different requires having some skill at PHP and HTML and CSS.
URLs that tie together the pages have well defined rules that can be used for control. The rules are not well documented.

The codex on sorting says this on how to change the sort order using the URL.

For example, to sort items by Dublin Core Title on the items browse page,
you want to set the sort_field parameter to Dublin Core,Title.
To generate this link you could use the link_to_browse_items helper:

<?php
echo link_to_browse_items('Sorted by Title',
array('sort_field' => 'Dublin Core,Title'));
?>

In the basic product, a request to view a page of items in a collection is triggered by clicking on a link URL in a collection page to items/browse.php.
If that link is changed to have URL parameters that include sort control values, then the displayed item will be sorted.

In the menu of a standard theme, the menu choice "Browse Items" is a link URL to items/browse.php that does not have any sort control If that URL is changed to have sort control parameters, then the resulting page will display Items in the designated sort order.

Here's the example the codex uses, having more specific detail, but with the same missing steps in the explanation (nothing said about the many ways that the second array parameter is used; nothing said about the special format of the sort field value string).

If you establish a custom theme and look at the scripts in the collections folder, you will notice that both "browse.php" and "show.php" emit a link to view items in the collection by way of making a call to link_to_items_browse(). When a visitor clicks on the created link, they are taken to a page browsing the items in that collection.

In collections/browse.php

<p class="view-items-link"><?php echo link_to_items_browse(
    __('View the items in %s',
         metadata('collection',
             array('Dublin Core', 'Title'))),
    array('collection' =>
                metadata('collection', 'id'))); ?></p>

In collections/show.php

<h2><?php echo link_to_items_browse(
        __('Items in the %s Collection',
             $collectionTitle),
        array('collection' =>
              metadata('collection', 'id')));
        ?></h2>

If you modify the lines like below, you will add a request into the URL to sort the items in the resulting Item browse page by the Dublin Core Title attribute in ascending order.

In collections/browse.php

<p class="view-items-link"><?php echo link_to_items_browse(
    __('View the items in %s',
           metadata('collection',
                 array('Dublin Core', 'Title'))),
    array('collection' =>
                  metadata('collection', 'id'),
          'sort_field' => 'Dublin Core,Title',
          'sort_dir' => 'a',
         )); ?></p>

In collections/show.php

<h2><?php echo link_to_items_browse(
        __('Items in the %s Collection',
                 $collectionTitle),
        array('collection' =>
                    metadata('collection', 'id'),
              'sort_field' => 'Dublin Core,Title',
              'sort_dir' => 'a',
             )); ?></h2>

If you modify the lines like below, you will add a request into the URL to sort the items in the resulting Item browse page by the Item Type Metadata Interviewer attribute in descending order.

In collections/browse.php

<p class="view-items-link"><?php echo link_to_items_browse(
    __('View the items in %s',
            metadata('collection',
                array('Dublin Core', 'Title'))),
    array('collection' =>
                  metadata('collection', 'id')
          'sort_field' =>
               'Item Type Metadata,Interviewer',
          'sort_dir' => 'd',
         )); ?></p>

In collections/show.php

<h2><?php echo link_to_items_browse(
        __('Items in the %s Collection',
                      $collectionTitle),
        array('collection' =>
                    metadata('collection', 'id'),
              'sort_field' =>
                 'Item Type Metadata,Interviewer',
              'sort_dir' => 'd',
             )); ?></h2>

These examples show specific changes to existing script lines, giving a pattern to notice and replace with changes so your item pages are sorted how you want them. The changes must be made in each place where a link to browse items is created. There may be more than one place in a given file. Don't forget header.php and footer.php where the menu choice is set.

===

Sorry. This answer is only a little better than the codex. It does not give a full and complete answer to all concerns related to sorting. But it does cover the first steps toward full control and shows examples in existing code for creating a items/browse.php URL that sorts items how you want them sorted.

The topic of how to control sort order is a big one that can involve both design and coding changes. Having only URL control over item display order does not cover every case. For instance, the standard collections/show.php displays items within the shown collection in an order that is not controlled by the URL.

Removing the code that shows the items on the collections/show.php page is one way around that. Another is to create the set of items to display within the show.php with code changes inside show.php that requests items to show, and use sort control when getting the items. Another is to build a simple plugin that contains a hook for the "item_browse_sql" event which resets the default sort order to use another item attribute field rather than the default 'added' descending.

Those suggestions for getting around cases that are not handled by changing a URL are very high level pointers to ways to modify Omeka to give more control on sorting. In a few weeks, read them again and see if they make better sense.

The Item Order plugin, with a need to manually sort items into the order you want to view them, should only be chosen when the preferred item sort order is not related to any natural item attribute and there is no way to define an added attribute such as Display Sequence and set it at the time of adding the item information.

In your situation, do the items have a natural sort order based on an item attribute?

Bob,

First, thank you -this is the kind of answer I really appreciate that allows me to head off in a fruitful direction.

I chose Omeka because I found it to be most like "the Wordpress of Digital Library apps". I believe that archiving collections is something many people and organizations want to do -people who do not work for libraries or museums and who don't write code.

I have a tinkerer's familiarity with php, CSS and MySQL but, like many, I prefer to use canned features. I can do modifications if I know what files to modify in and I understand from your reply that there are a few ways to accomplish what I want. Yes, I have (and/or can create an item attribute that would be a natural sort order so I'll give it a whirl and let you know!

Sorting is a fundamental tool to any large collection. Some ability for the user to sort also helps aid in finding what you want from a large body of data. The My SQL database lends itself to this and I would hope the development team looks at including a robust that allows sorting by any item field -at both the user and admin level -perhaps a "sort by" checkbox next to the metadata field in Dublin Core.

Wow.. I have just read this entire post and I still dont know how to frikin filter a collection by a metadata value... I agree with Uncle Geo, a year ago, a collection CMS should really consider sorting, filtering AND RELATING items a foundamental aspect of art collections. PLease help HOW do I filter a collection by a metadata number??

Could you tell more about what, exactly, you are aiming for? I'm not sure what 'metadata number' you are thinking of, and whether this is about displaying collections or items within those collections.

This might also work better as a new thread, specific to what you need to have happen.

Thanks for replying so quickly!
What I (and probably anyone reading this) want is the ability to reorder collections AND items in collections however we want. (Preferably by drag and drop)
The solution I was trying was to create a special metadata called ItemOrder so that we could sort by that field. Im pretty sure this is possible, we just need to be pointed in the right direction.
I also need to understand how to sort collections. This time i just need to reverse the default order the system uses.
Thanks again for the support

There are really two aspects here, admin and user sorting, but both are related.

In a nutshell I would like admins to be able to sort on any field for the default presentation of items to the user This is a very common feature in many MySQL databases/web front ends but is not implemented in Omeka (except by code rewrite).

Users should also be able to re-sort from my default using any field they choose (or better -only fields I've allowed them to see)

For a visual, think of a spreadsheet table on an HTML page where you click the column heading to sort by your chosen column. Doesn't have to <i>look,/i> this way, but should function like that. If you want to get fancy you could allow sorting first by metadata field A and again by B, etc and add the little caret that lets you have ascending or descending. I would think this would have tremendous utility to researchers.

Also, as an admin, I might like to set defaults that default sort one collection by date (because I have that info) and another by sequence number (because I don't have a date). As it is, if I hardcode a sort, as Bob's great explanation above shows, it applies to all displays of items across all collections.

And, if this gets on to the programmers, a related and IMHO weird sorting issue(and maybe just in the Seasons theme) is that when you click on the name of a collection to browse, Omeka's default is to make a seemingly random choice of only a small subset of the collection to display. It took me a while to figure out that this was what was going on and it was in no way intuitive to my users who kept saying “I thought you uploaded everything”.

After clicking the name of the collection, the user has to know to click on "View the items in [collection]" to actually see them all. It's an extra step, an odd thing to default to and should be optional (or deleted!). In another thread someone showed me how to change the code to fix this, (and I've yet to change all the CSS to make it look pretty), but this really ought to be a choice during initial setup and/or from admin and not a default of Omeka or any theme.

One option for showing all items instead of a subset is to link to an advanced item search instead of collections/show and display the collection information above the search results if there's a collection value in the query. I've done this like so:


<?php parse_str($_SERVER['QUERY_STRING'], $queryarray); ?>

<?php if (array_key_exists('collection',$queryarray) && $queryarray['collection'] != ''): ?>

    <?php
       $db = get_db();
       $collection = $db->getTable('Collection')->find($queryarray['collection']);
       $collectionTitle = strip_formatting(metadata($collection, array('Dublin Core', 'Title')));
       if ($collectionTitle == '') {
          $collectionTitle = __('[Untitled]');
      }
      ?>

     <h1><?php echo $collectionTitle; ?></h1>
     <?php echo all_element_texts($collection); ?>

<?php endif; ?>

If you don't want to print all elements, you can call them individually, instead.

The advantage of doing it like this is that you could also specify the sort_field in the query string in the link when a user clicks on a collection title. You would then use a Simple Page in place of Browse, and custom links in the Appearance/Navigation interface.

That might be cleaner than the changes I've made -thanks!

I guess my point is that showing a subset as the <i>default</i> display is rather odd and from a user standpoint it's in the way. It's not apparent why a subset would be the default, especially without verbiage explaining the situation to users (or admins!);>)

This, however, is not as big of an issue as sorting, because admins who need to can can make that single code change and the subset goes away for all time.(Still would be better as a setup/admin checkbox)

But for sorting; that's an expansion of Omeka functionality that is a very logical and much needed next step for a database centric application.

And FWIW, I should say that Omeka is a great program and I appreciate the people who give their time to making it work. For anyone who wants to create a digital library -especially for people who want the simplicity and power of a Worpress-like open source program -Omeka's the only way to go.

To me, it makes sense, because if you have hundreds of items in a collection, you certainly don't want to display them all on one page! But I've had similar complaints from users that it's not obvious that clicking on "Items in the Collection" will show them all items. For sites which don't use the custom browse page, I mitigated it by adding a "View all items in the collection." link to the top and bottom of the item list in collections/show.php.

I've just realized that you could also sort items by getting rid of the existing items code in collections/show.php and replacing it with a shortcode, which is much easier than rewriting the item list code. e.g.


<?php
	$collItems="[items collection=" . metadata('collection','id') . " num=5 sort=\"Dublin Core,Date\"]";
	echo $this->shortcodes($collItems);
?>

It's not so much that clicking on "view all items" is not obvious; it's the click you do <i>before</i> that to get to the collection in the first place, after which you'd obviously expect to see "the collection". A dialog that says "here's a sampling, click here to see e'm all" would work, but there's a very common and more intuitive solution.

Usually the problem of too many items on one page is handled with a choice 1)in admin to choose <i>n</i> number of items to display per page and 2)for users, a set of page numbers at bottom with "previous" 1,2,3,4,5 and "next" buttons with the numbers giving some approximation of how many pages there might be with the page number you are on highlighted.

On sorting, I see that it is possible to change code to get the sorting results I might like as an admin, but it doesn't really get at the larger issue that it has to be coded and therefore you only get that one choice.

A more robust sorting that allows real time sorting choices without writing code helps admins when setting up default collections and helps users find info in large collections that matche their criteria.

I know this functionality is fairly common in PHP/MySQL driven websites -most notably shopping sites. Ex: Show me: car type: sportscar, color: red, size: large, price: under $40,000). That narrows umpteen thousands of items down to a manageable number of more appropriate items. And again, if that result exceeds the defined number of items per page, it adds the page navigation, as above.

I wish I was a real coder, not just some production house guy. I'd happily help!

I should say that a level of sort does not need to be multilevel as my example above. A sort (admin default page display, changeable by user) by even one data field would help immeasurably.

There are a lot of kind of unrelated requests, suggestions, and complaints roaming around in this thread (and very few of them seem to have much to do with the Item Order plugin or plugins in general), so it's a little hard to get a handle on.

The most recent stuff I'm seeing is about the collections/show. What that page is designed to do is show the metadata about the collection. The items shown on that page are basically just a "preview." There's a reasonable argument to be made that for a lot of sites the collection metadata is much less important than the items that are in the collection, but that's where we stand. Omeka draws a line between viewing "the collection" on collections/show and viewing the "items in the collection." Like other browse pages, the "items in the collection" view already has the pagination and results-limiting functionality I've seen mentioned here.

Another repeated question is about sorting. The option of just hardcoding an initial sorting parameter into the navigation seems to have been already covered, and the discussion moved to user-directed sorting. Maybe I'm misunderstanding the question, but Omeka already puts sorting links on the public theme (and the admin, in the table headings). By default, the links are for sorting by the Title metadata element, the Creator, and the date the item was added to the database. By editing the theme, you can add more of those links to give users options for sorting by any metadata field.

Finally, there seems to be something about filtering. I'm not quite sure what the request is there beyond what the advanced search already does in terms of allowing filtering by metadata fields.