Just Checked In:
Many, many, many_many new features!
Happy new year, DOM users. We'll start off 2010 with several additions to the many_many features of DOM.
1) Sortable many_many relations
Drag-and-drop reordering is great, but because the sort is stored on the object itself, you can't have unique sorts for each many_many relationship. Now, with SortableDataObject, you can do this. By taking advantage of the many_many_extraFields property, and a complete overhaul to the query builder, you can now create a sortable many_many relationship like this:
Let's look at this a bit further. Often times on my pages, I have a "Callouts" tab that manages content blocks for the sidebar. With a ManyManyDataObjectManager, I can syndicate these across all of my pages easily. In this case, I add:
Now, the same three callouts that are syndicated to one page, can be on another, with an entirely different sort order!
Keep in mind that the parameters are the owner class first, and the relationship name second. It is not two class names or two relation names.
2) Show only associated records
A lot of times, a many_many relationship is handled elsewhere and we only want to see those records that have been associated with our page. Or, you may have a long list want to filter them down by only the records that are checked off. There is a new permission for ManyManyDataObjectManager named "only_related". This permission is ON by default and will give you a checkbox for showing only the related records.
This is also important for sorting, because in order to sort a many_many relationship you need to have a view of only the related records. Therefore, when drag-and-drop is enabled on a ManyManyDataObjectManager, the only_related checkbox will be sympathetically checked.
Here's a use case -- I have hundreds of Testimonials objects that are managed in ModelAdmin and paired with pages there using a MultiSelectField. But in CMSMain, I want to be able to view a given page and see which Testimonials are on that page. I also want the ability to sort them.
Page.php (getCMSFields function);
$f->addFieldToTab("Root.Content.Testimonials", $testimonials = new ManyManyDataObjectManager($this, 'Testimonials', 'Testimonial'));
This way, users can only edit and sort the records. They cannot change the relationship or add any Testimonials here, because the workflow dictates that such is done through ModelAdmin. Of course, you're welcome to open up the permissions if it suits you. This is just a use case that worked really well for my client.
3) Bug Fix: ImageDataObjectManager sort issues
There was a strange and fairly rare bug that would occur when an ImageDOM and any other DOM were present in the same fieldset. The effect of the bug disabled sorting in the ImageDOM. That has been fixed.
4) Bug Fix: Checkboxes not saving in DOM popups
When records were added through a DOM popup with checkbox sets, it wasn't until after the record was created that they actually saved. This bug has been resolved.
5) Improvement: Clicking a row executes the first action (usually edit)
I had a lot of feedback saying that it was annoying to click the tiny "edit" button on DOM, so I have now given the row a click function that will execute the first action of your actions column. Most of the time this is "edit".
6) Wide popup available for all DOM instances
NestedDOM had the requirement of a wider popup window, so I have opened that up as an option on all DOM instances now. You can use setWideMode(true); on any DOM object.
On the way:
Thanks, everyone, for your continued support of DataObjectManager. As we approach the one-year anniversary of the module, I encourage you to stay tuned for a complete makeover of the UI and a thorough refactoring of the code. That should be well underway by spring.