5407 Posts in 1647 Topics by 1187 members
|Go to End|
22 April 2012 at 12:30pm
I'm currently working on a front end editing form
Members can create "Stories" (extends Page) and save through a front end form.
If the member is not marked as "CanPlublishStory" he can not publish but only write to stage (an admin has to publish after reviewing the Story).
The members can upload images that are attached to the Story (Story has_many Images).
When a member (that can not publish) edits a Story the admin can review the TEXT before publishing the changes.
If the member uploads new images (has_many) they are attached immediately. The admin can't review these changed images before they will be public.
How can i have "versioned relations"? (not versioned images/dataobjects).
25 April 2012 at 1:23pm Last edited: 25 April 2012 3:02pm
I happen to be dealing with this issue too, although I haven't found a complete solution yet. You'll find some help in this thread. However, this might not be a complete solution.
I'm uncertain about the following:
- If I view an older version, will the has_many relation automatically pick up the old set of has_many objects belonging to that version? Or is special handling required? I'm guessing that it might just pick up the latest published set.
- If I unpublish a page, will the has_many relation revert to the old set of has_many objects? Or will that also require special handling?
- How do I get the page to be marked as "modified" (i.e., get shown in green for unpublished changes) if the has_many relation has changed (e.g., an object is modified, added or deleted)
EDIT: The questions above assume that you want the objects in has_many to be completely owned by the page. Whether that's what is needed or not, it would still be good to know how this would be achieved (and conversely, how to avoid it).
25 April 2012 at 4:08pm
Replying to myself, if you want all of the objects in the has_many relationship to be completely owned and versioned based on the page, then you'll have to go through and implement the onBefore####()/onAfter####() methods for everything associated with versioning. These methods would have to perform the same action on the sub-objects. You might also need to take precautions in order to keep the version numbering the same across all objects (i.e., version n of all has_many objects correspond to version n of the page).
25 April 2012 at 6:26pm
I'm currently trying simpler and maybe less clean:
My Problem is that the Information about the one-to-many-relationship is saved on the (non-versioned DataObject) Image, not the versioned Page.
I thought the simplest solution would be to have the relation info saved on the page.
So on the Page i created a DBField Text.
In an onBeforeWrite function i collect the currently related Imaged, get the IDs and save them comma-separated into this field.
Displaying the images on the fronted: a special function VersionedImages() gets the mentioned textfield, collects the Images by the saved ID list and returns a dataobject set.
I have to see/test if it will be irritating for authors that on the backend the ImageDOM/HasManyDOM is showing something different than the frontend... we'll see...
|Go to Top|