7940 Posts in 1543 Topics by 946 members
|Go to End||Next >|
16 January 2010 at 5:49am Last edited: 16 January 2010 5:57am
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.
16 January 2010 at 7:00am
New great features, well explained with clear examplesâ€¦ just thanks!
16 January 2010 at 9:36am
multiple sortable many_many relations: a feature i've been missing in many projects by now. strike.
thanks again unclecheese!
16 January 2010 at 12:12pm
Is there any way to sort out objects within the popup. so for example say I want to create a new menu which would bring up the popup. From within the popup(instance of menu) I add food items(another dataobject) then what if I want to change the sort order? Is this possible?
19 January 2010 at 6:25am
The ManyMany sortable function is broken in 2.3.4. I was foolishly testing in 2.3.3, thinking it wasn't much different, but Silverstripe updated the load_extra_statics() method in DataObjectDecorator, and I need to confer with them to figure out a reconciliation. Thanks for your patience!
23 January 2010 at 9:46am
Just wondering if these new features fix the following bug http://www.silverstripe.org/all-other-modules/show/270194#post270194
To try and figure out this re-setting problem, I have un-installed most modules and now have userforms, mollom and blog installed.
Several times a week the userform pagetype and blog entry pagetype re-set back to std pagetype.
The problem is happening much more regularly these days - 2 to 3 times a week now. I can't keep doing a dev/build to fix!
When I do a dev/build and re-select the userform pagetype the userform formatting returns. However, when I re-select the blog entry pagetype the formatting does not return and I literally have to re-enter my blog entries again. Not ideal
Any ideas / suggsetions?
23 January 2010 at 10:49am
Is this a bug with userforms or DataObjectManager?
|Go to Top||Next >|