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

Does anybody have a working example of DOM in the front-end?


Go to End


9 Posts   4209 Views

Avatar
jmariani

Community Member, 6 Posts

12 January 2012 at 5:41am

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.

Avatar
UncleCheese

Forum Moderator, 4102 Posts

12 January 2012 at 11:19am

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

Avatar
jmariani

Community Member, 6 Posts

12 January 2012 at 12:06pm

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!

Avatar
Juanitou

Community Member, 323 Posts

13 January 2012 at 1:59pm

Edited: 13/01/2012 2:00pm

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

Avatar
jmariani

Community Member, 6 Posts

13 January 2012 at 5:12pm

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!

Avatar
hammuh

Community Member, 15 Posts

21 February 2012 at 3:22am

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

Avatar
cumquat

Community Member, 201 Posts

16 March 2012 at 11:43pm

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

Avatar
hammuh

Community Member, 15 Posts

16 March 2012 at 11:49pm

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
        }
);

Go to Top