7921 Posts in 1359 Topics by 933 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Bug Reports
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: | 38531 Views |
-
Re: Bug Reports

9 November 2010 at 4:10am
Thank you!!
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: Bug Reports

16 November 2010 at 3:18am
DataObjectManager->setSourceId() has no effect since the sourceID() function never checks for or returns the value.
Change the sourceID() function fromfunction sourceID() {
if($this->isNested)
return $this->controller->ID;
$idField = $this->form->dataFieldByName('ID');
return ($idField && is_numeric($idField->Value())) ? $idField->Value() : (isset($_REQUEST['ctf']['ID']) ? $_REQUEST['ctf']['ID'] : null);
}to
function sourceID() {
if (isset($this->sourceID) && is_numeric($this->sourceID)) {
return $this->sourceID;
}
if($this->isNested)
return $this->controller->ID;
$idField = $this->form->dataFieldByName('ID');
return ($idField && is_numeric($idField->Value())) ? $idField->Value() : (isset($_REQUEST['ctf']['ID']) ? $_REQUEST['ctf']['ID'] : null);
}This way the custom source ID will be returned if it's been set.
-
Re: Bug Reports

19 November 2010 at 2:57am
I notice this when I tried to use the Has One DOM....
casted summary fields throw a SQL error...
public static $summary_fields = array (
'CastedText'=>'NewTitle',
);static $casting = array( "CastedText" => "Text" );
public function CastedText() {
return $this->NormalDBField.' - text';
} -
Re: Bug Reports

21 November 2010 at 1:58am
I then, you'd change in DataObjectManager.php line 500, this code:
Before:
new LabelField('show', _t('DataObjectManager.PERPAGESHOW','Show').' '),
new DropdownField('PerPage','',$map, $value),
new LabelField('results', ' '._t('DataObjectManager.PERPAGERESULTS','results per page'))After:
new LabelField('show', _t('DataObjectManager.PERPAGESHOW','Show').' ',null,true),
new DropdownField('PerPage','',$map, $value),
new LabelField('results', ' '._t('DataObjectManager.PERPAGERESULTS','results per page'),null,true)Reason: I sent translation fo cs_CZ and sk_SK. After changes I see string correctly. I cannot send files (images) to be more see-able.
-
Re: Bug Reports

25 November 2010 at 12:56am
I'm using Uploadify/DOM 521 and I'm running into an issue with using the same image for multiple purposes. It could be this is a limitation of the SS file system rather than Uploadify/DOM.
My setup: I've added a Thumbnail Image to the page class, and I'm using DOM + Uploadify to add a list of files (Downloads) to an Example. Multiple examples are displayed on a single page using the Examples page type. The Downloads / Example classes are based on the code provided on the Uploadify documentation page.
The issue I have is on adding an image as the thumbnail of a page, and then adding the same image as an Example download the Thumbnail disappears from the page. I believe this is due to the fact that the ClassName in the File table is changed from Image to Download.
Is there a way that allows multiple uses of the same file still using DOM+Uploadify?
I've included trimmed down test code below.
mysite/code/Page.php
<?php
class Page extends SiteTree {
public static $has_one = array(
'Thumbnail' => 'Image',
);function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Thumbnail", new FileUploadField('Thumbnail', 'Thumbnail'));
return $fields;
}}
class Page_Controller extends ContentController {
}
mysite/code/Examples.php
<?php
class Examples extends Page {
static $has_many = array (
'Examples' => 'Example'
);public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Examples", new DataObjectManager(
$this,
'Examples',
'Example',
array('Title' => 'Title', 'Description' => 'Description'),
'getCMSFields_forPopup'
));return $fields;
}
}class Examples_Controller extends Page_Controller {
}
mysite/code/Example.php
<?php
class Example extends DataObject {
static $db = array (
'Title' => 'Text',
'Description' => 'HTMLText'
);
static $has_one = array (
'ExamplesPage' => 'Examples',
'Thumbnail' => 'Image'
);
static $has_many = array (
'Downloads' => 'Download'
);public function getCMSFields() {
$fields = parent::getCMSFields();
$fields->addFieldToTab("Root.Content.Downloads", new MultipleFileUploadField('Downloads','Select downloads'));
return $fields;
}public function getCMSFields_forPopup() {
$fields = new FieldSet(
new TextField('Title','Title'),
new SimpleHTMLEditorField('Description','Description'),
new ImageUploadField('Thumbnail','Thumbnail'),
new MultipleFileUploadField('Downloads','Select download files')
);
return $fields;
}}
mysite/code/Download.php
<?php
class Download extends File {
static $has_one = array(
'Example' => 'Example'
);
} -
Re: Bug Reports

25 November 2010 at 8:41am
You're using the "choose existing" tab to do that? I think that's going to give you trouble because the classnames are different. You're going to have to upload the same file twice..
---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com -
Re: Bug Reports

25 November 2010 at 10:09am
That's what I feared, as I suggested uploading the same file twice as a workaround to the user, but I do feel that's a bit counter intuitive. Is there a way to use the same file? Or alternatively limit the assets sub folder that can be selected (to force the user to upload the file again...)
-
Re: Bug Reports

25 November 2010 at 10:25am
Well, what you're describing doesn't make a whole lot of sense. I know for the user it's weird, but if you think about it, you're asking that a single file have two different ClassName fields simultaneously. That's just not going to work.
Is the thumbnail always the same as the other upload? You could just get rid of that field all together and assign the ThumbnailID on write..
---------------
Silverstripe tips, tutorials, screencasts, and more. http://www.leftandmain.com
| 38531 Views | ||
| Go to Top | Next > |




