Jump to:

7939 Posts in 1472 Topics by 944 members

DataObjectManager Module

SilverStripe Forums » DataObjectManager Module » Does anybody have a working example of DOM in the front-end?

Discuss the DataObjectManager module, and the related ImageGallery module.

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

Page: 1 2
Go to End
Author Topic: 1230 Views
  • jmariani
    Avatar
    Community Member
    6 Posts

    Does anybody have a working example of DOM in the front-end? Link to this post

    Hi.

    I'm giving SS a try, and I'm near to give up.

    I couldn't find ONE example of having a DOM rendered in the front end, capable of listing records in a table and provide CRUD, just like it shows in the CMS.

    Also, I couldn't find ONE example on how to give a CMS user access to the page WITHOUT the Main, Metadata, Behaviour, to-do, etc. tabs. The idea is to give the user access only to the "Testimonials" tab, for example.

    Can anybody help me, please?

    Thank you in advance.

  • UncleCheese
    Avatar
    4085 Posts

    Re: Does anybody have a working example of DOM in the front-end? Link to this post

    I don't know anyone who has implemented DOM on the front end, but people are always talking about it, so poke around in the forum and you might find something.

    As far as hiding tabs, there are many ways to do that. The easiest being to edit your getCMSFields() function in Page.php and remove the tabs after evaluating the current user's permissions.

    You might also look at the Simplify module, which gives granular permissions for each group. You can select a given tab or even drill down to each specific field.

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

  • jmariani
    Avatar
    Community Member
    6 Posts

    Re: Does anybody have a working example of DOM in the front-end? Link to this post

    Hi, UncleCheese.

    I'm really very frustrated with SS, because it looks like a hell of a platform, and I couldn't find a simple example on how to render a table in the frontend.
    What I want to do is really simple: I want my users to browse a table and be able to do CRUD on it. Like, for example, any ERP (SAP, Oracle, PeopleSoft, etc).

    Your module seems to be the natural choice, but I failed on find an example.

    All the examples I see, show your module as a new tab in the "Pages" section. But, how can I give that interface to the user, if it has also the Behaviour, To Do, Main, Metadata, etc? A regular user will go nuts if I show them an interface like that. I've tried also the ModelAdmin interface and it really looks very primitive. It reminds me to good 'ole MS Access screens.

    It's a pity. I've tried Drupal, and I liked the easy way it has to show data (through Views module). I really liked the ORM and inheritance schema SS has, but maybe I'm missing the point and it's not the right tool to develop an ERP-like system.

    Regards!

  • Juanitou
    Avatar
    Community Member
    322 Posts

    Re: Does anybody have a working example of DOM in the front-end? Link to this post

    Hi!

    No help for DOM, but for hiding tabs and fields look at this example:

       function getCMSFields() {
          $fields = parent::getCMSFields();

          /*
           * Remove some tabs and fields to simplify the interface for content authors.
           * ATTENTION : some happens here, but also: CustomSiteConfig,
           * CustomLeftAndMain and mysite/css/cms_custom
           */
          if (!Permission::check("ADMIN")) {
             $fields->removeByName('Metadata');
             $fields->removeByName('GoogleSitemap');
             $fields->removeByName('Access');
             $fields->removeByName('Dependent');
             $fields->removeByName('Behaviour');
             $fields->removeByName('ParentType');
             $fields->removeByName('ParentID');
             $fields->removeByName('ShowInMenus');
             $fields->removeByName('ShowInSearch');
             $fields->removeByName('HomepageForDomain');
             
          }
          return $fields;
       }

    There are a lot of recipes out there for rebranding the CMS, Google is your friend.

    For getCMSFields-related methods : FieldSet

    Hope it helps,
    Juan

  • jmariani
    Avatar
    Community Member
    6 Posts

    Re: Does anybody have a working example of DOM in the front-end? Link to this post

    Hi, Juanitou.

    Thank you for your advice.
    After some research, I concluded that SS is not the right tool for what I want, so I'm evaluating Yii now.

    Regards!

  • hammuh
    Avatar
    Community Member
    15 Posts

    Re: Does anybody have a working example of DOM in the front-end? Link to this post

    For DOM in frontend use this:

    public function myClays() {
          
       $tableField = new DataObjectManager(
          $controller = $this,
       $name = 'tablename',
       $sourceClass = 'yoursourceclass',
             $fieldList = array(
                'column' => 'name'
           ),
       $callThisFunctionForPopupFields = 'getPopupFields',
             $sourceFilter = '',
             $sort = ''
       );
       $tableField->setParentClass(false);

       $fields = new FieldSet(
          new HiddenField('ID', ''),
           $tableField
       );   
       $actions = new FieldSet(
       );
          
       return new Form($this, 'myClays', $fields,$actions);   
    }

    For me it works in several sites

  • cumquat
    Avatar
    Community Member
    189 Posts

    Re: Does anybody have a working example of DOM in the front-end? Link to this post

    Hi guys,

    I'm just playing around with this and have it working sort of but i cant get the records to open up in a pop up they end up just opening another page, i'm guessing i'm missing some sort of include or something.

    Any pointers greatly appreciated.

    Regards

    Mick

  • hammuh
    Avatar
    Community Member
    15 Posts

    Re: Does anybody have a working example of DOM in the front-end? Link to this post

    Hi Mick,

    It could be a javascript conflict. The DOM includes a few javascript files and they may be conflicting with some of the jQuery plugins if you use those. If so, you can fix it with :

    $.noConflict();
    $(document).ready(
       function(){
          //code here
    }
    );

    1230 Views
Page: 1 2
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.