Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We've moved the forum!

Please use forum.silverstripe.org for any new questions (announcement).
The forum archive will stick around, but will be read only.

You can also use our Slack channel or StackOverflow to ask for help.
Check out our community overview for more options to contribute.

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

on popup open / close


Go to End


2 Posts   1200 Views

Avatar
k0m0r

Community Member, 39 Posts

3 May 2011 at 6:50pm

Uncle Cheese,

I bumped into following issue - I'm using DOM to manage collection of objects. And I have a cron script operating on the same collection every hour. I'm looking for a way to temporarily 'block' an object that the user is currently editing, so that cron will not change the object before user saves changes.
The easiest way would be to set a flag on object when user opens a popup in DOM, and reset it when the popup is closed. I tried to do it in getCMSFields_forPopup() and then in onBeforeWrite() but it doesn't solve my problem, as DOM *reloads* the popup after saving, not closes it.
Is there a way to commit an action each time user opens or closes a popup in DOM (with edited object as a param)?
If not, what is the best way to mark currently edited object as 'being edited'?

Thx for help.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

4 May 2011 at 3:56am

The only thing I can think of is to set the flag on getCMSFields() and unset it in an onAfterWrite() handler by introspecting the getChangedFields() function. Basically you'd want to unset it provided anything other than the locking field has changed.