7911 Posts in 1354 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » attn uncle cheese - dataObjectManager bug?
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
| Go to End | Next > | |
| Author | Topic: | 3740 Views |
-
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 2:45am
Okay, now we're getting somewhere. Post your code for that entire page.. I don't need the dataobjects.. just the getCMSFields for your page.
-
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 3:29am
class DesignDetailsPage extends Page {
...
public function getCMSFields() {
$fields = parent::getCMSFields();$fields->addFieldToTab("Root.Content.Main", new DropdownField(
'ResponsibleOffice',
'Responsible office',
singleton('DesignDetailsPage')->dbObject('ResponsibleOffice')->enumValues()
),'Content');$manager2 = new DataObjectManager(
$this, // Controller
'Characteristics', // Source name
'Characteristic', // Source class
array(
'Label' => 'Label',
'Value' => 'Value'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);$fields->addFieldToTab('Root.Content.Characteristics', $manager2);
$fields->addFieldToTab("Root.Content.Factsheet", new FileIFrameField('Download1','Factsheet'));
$fields->addFieldToTab("Root.Content.Design drawing", new FileIFrameField('Download2','Design drawing'));$manager3 = new DataObjectManager(
$this, // Controller
'References', // Source name
'Reference', // Source class
array(
'Name' => 'Name',
'Website' => 'Website',
'Category' => 'Category'
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);$fields->addFieldToTab('Root.Content.References', $manager3);
return $fields;
}AND this code from page.php (I have set up one ImageDOM in page.php that I use on alle pages). As I'm writing this... this solution might be a trouble maker...
class Page extends SiteTree {
...
public function getCMSFields() {
$fields = parent::getCMSFields();if(!Member::currentUser()->isAdmin()) {
$fields->removeByName("Behaviour");
$fields->removeByName("To-do");
$fields->removeByName("Reports");
$fields->removeByName("Google Sitemap");
$fields->removeByName("Navigation label");
}$manager = new ImageDataObjectManager(
$this, // Controller
'Photos', // Source name
'Photo', // Source class
'Image',
array(), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);$fields->addFieldToTab('Root.Content.Images', $manager);
$metadataTab = $fields->findOrMakeTab('Root.Content.Metadata');
$fields->removeByName('Metadata');
$fields->addFieldToTab('Root.Content', $metadataTab);return $fields;
} -
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 3:53am
Can you check if activating drag-and-drop on the one that doesn't work actually enables drag-and-drop on one of the other two DOMs on the page?
-
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 4:04am
Selecting checkboxe drag'n'drop on Characteristics and/or References doesn't change anything. Cursor changes into a hand, but when trying to drag only text is selected. The ImageDOM drag'n'drop works fine after acitvating drag'n'drop. I can't see any cross-tab behaviour.
-
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 4:12am
Does it work when you remove the ImageDOM?
BTW, you're going to want a ->setParentClass('Page') on the ImageDOM if it's cascading down to subclasses. Otherwise it will barf when you pass it $this as a controller.
-
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 7:20am
Yes! When I comment out the ImageDOM in page.php, drag'n'drop works again for Characteristics and References!
-
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 7:53am
Alright, I'll try setting up concurrent instances of ImageDOM and DOM and see what happens.
-
Re: attn uncle cheese - dataObjectManager bug?

8 July 2009 at 10:07pm
Hi, I've the similar problem when I click on "Add Image" ( see this old post: http://www.silverstripe.org/archive/show/212710#post212710 ) , I've on PopUp Windows this error: "I can't handle sub-URLs of a CMSMain object."
class ImageAttachment extends DataObject {
static $db = array(
'Name' => 'Text'
);
static $has_one = array(
'Image' => 'Resize_Image',
'Product' => 'Product'
);static $field_names = array('Name' => 'Name');
function getCMSFields_forPopup() {
$fields = new FieldSet();
$fields->push(new TextField('Name', 'Name'));
$fields->push(new ImageField('Image', 'Image'));return $fields;
}}
....
$imagetable = new ComplexTableField(
$this,
'ImageAttachments', // relation name
'ImageAttachment', // object class
ImageAttachment::$field_names, // fields to show in table
ImageAttachment::getCMSFields_forPopup(), // form that pops up for edit
"ProductID = {$this->ID}", // a filter to only display item associated with this page
"Name ASC" // Sort by name
);$fields->addFieldToTab('Root.Content.Additional Images', $imagetable);
| 3740 Views | ||
| Go to Top | Next > |

