Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » ImageDataObjectManager Stage/Live and versions

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1
Go to End
Author Topic: 716 Views
  • T-Muns
    Avatar
    Community Member
    8 Posts

    ImageDataObjectManager Stage/Live and versions Link to this post

    I'm creating a site where the home page has rotating billboard images in the main area. I'm using the ImageDataObjectManager with this type of approach: http://silverstripe.org/customising-the-cms/show/10890#post279361

    So it creates a tab for the rotating images where the user can select from the Files & Images section or upload directly.

    It's working well but when you save, it takes it live right away. It also doesn't insert into the page history so you can't tell (from the cms) that a change was made and/or who made the change.

    I am new to SS but am learning. Can anyone point me in the right direction to get this working? Thanks!

  • T-Muns
    Avatar
    Community Member
    8 Posts

    Re: ImageDataObjectManager Stage/Live and versions Link to this post

    I don't know if this is a good idea, but I'm considering storing blocks of dynamic content data in text columns of the table. For example, if I have a class that inherits Page and have custom fields. It seems like I could just create a custom DataObject that would json_encode/decode an object/array, etc and store it in the text field. I don't foresee any efficiency issues with this. Possibly a little extra cpu overhead in the encode/decode process but static pages would reduce this considerably.

    In this case with the ImageDataObjectManager, could I basically leave it as-is and just add the logic to serialize the data into a normal text column so it would work with versions and history? In essence, you would be redundantly storing the data in a packaged format. Otherwise, I guess you could modify the DOM to be able to have the option to store data like this, which is probably a better idea.

    The idea is that you click a version in the typical page history and it loads the main content and any other custom tabs that contain dynamic data.

    Seems like a shortcut, but it would utilize the stage/live versions and history that is already in place. Versions and history on a lot of dynamic data seems like a lot to manage if you have to write version logic for every piece. I don't think I would want a Diff for this so I'd probably disable it.

    Any thoughts appreciated

  • UncleCheese
    Avatar
    4085 Posts

    Re: ImageDataObjectManager Stage/Live and versions Link to this post

    Only SiteTree objects get the Versioned decorator by default. You can apply the decorator manually to your DataObject subclasses, but it's up to you to create the UI to browse the history, apply rollbacks, etc.

    There's a good example in the UserForms module of managing published state of DataObjects from within the holder page. You basically just use the doPublish(), doDeleteFromStage(), etc. hooks to alter the versions of your DataObjects.

    https://github.com/silverstripe/silverstripe-userforms/blob/master/code/UserDefinedForm.php

    --------------------
    SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com

  • T-Muns
    Avatar
    Community Member
    8 Posts

    Re: ImageDataObjectManager Stage/Live and versions Link to this post

    Thanks for the response. I eventually found another one of your posts showing the UserForms example. Instead of a separate UI to browse history, etc, why not use the Page Version History UI that is already there? Couldn't I just have it save versions of the DataObjects anytime the main content is saved and vice versa? Same with loading previous versions...load the dynamic data as well?

    716 Views
Page: 1
Go to Top

Want to know more about the company that brought you SilverStripe? Then check out SilverStripe.com

Comments on this website? Please give feedback.