7912 Posts in 1355 Topics by 930 members
DataObjectManager Module
SilverStripe Forums » DataObjectManager Module » Uploadify: features not working with FileDOM, working with DOM
Discuss the DataObjectManager module, and the related ImageGallery module.
Moderators: martimiz, UncleCheese, Howard, Sean, Ryan M., biapar, Willr, Ingo, swaiba, simon_w
|
Page:
1
|
Go to End | |
| Author | Topic: | 753 Views |
-
Uploadify: features not working with FileDOM, working with DOM

20 October 2010 at 6:00am
Been using uploadify with DOM and it is great! However, some of the more fine grained features are not working for me when I'm using uploadify with a FileDOM. I cannot get the allowFolderSelection, setuploadFolder, or setFileTypes settings to work with a fileDOM. Also the button text doesn't change with the FileDOM.
DOM example field definition:
$imageUploadField = new ImageUploadField(
'Photo',
'Upload a Photo',
array(
'buttonText' => 'Upload an Image'
)
);$imageUploadField->setuploadFolder('Images/UsedEquipment');
$imageUploadField->allowFolderSelection = false;
DOM definition:{
$fields = parent::getCMSFields();
$datamanager = new DataObjectManager(
$this, // Controller
'UsedEquips', // Source name
'UsedEquip', // Source class
array(
'Name' => 'Name',
'Overview' => 'Overview',
'Description' => 'Description',
'Material' => 'Material',
'Tanks' => 'Tanks',
'MaterialHandling' => 'MaterialHandling',
'Thumbnail' => 'Photo',
'URLSegment' => 'URLSegment'
), // Headings
'getCMSFields_forPopup'// Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);
$datamanager->setPopupWidth('675');$fields->addFieldToTab("Root.Content.Equipment",$datamanager);
return $fields;
}FileDOM example field definition:
$resourceUploadField = new FileUploadField(
'Attachment',
'Upload a File',
array(
'buttonText' => 'Upload a PDF'
)
);$resourceUploadField->setuploadFolder('PDFs/MSDS');
$resourceUploadField->setFileTypes(array('pdf'));
$resourceUploadField->allowFolderSelection = false;
File DOM definition:{
$fields = parent::getCMSFields();
$manager = new FileDataObjectManager(
$this, // Controller
'Resources', // Source name
'Resource', // Source class
'Attachment', // File name on DataObject
array(
'Name' => 'Name',
), // Headings
'getCMSFields_forPopup' // Detail fields (function name or FieldSet object)
// Filter clause
// Sort clause
// Join clause
);$manager->setuploadFolder('PDFs/MSDS'); //This actually works in Uploadify when put here, the other settings dont
$fields->addFieldToTab("Root.Content.Resources",$manager);
return $fields;
}Thanks in advance!
-
Re: Uploadify: features not working with FileDOM, working with DOM

20 October 2010 at 8:26am
I think the only to properties that FileDOM will forward to the Uploadify fields are the upload folder and the allowed file types. It looks like you want "allowFolderSelection" to also be one of those properties?
--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: Uploadify: features not working with FileDOM, working with DOM

20 October 2010 at 8:48am
Exactly. I want to specify the upload folder and then make it so that it cannot be changed. Also, I want to only allow the user to upload pdf files. I think I could still do this at the fileDom level instead of at the uploadify field level... I was just trying to follow the UsedEquip DOM as an example for consistency. Are these things possible?
-
Re: Uploadify: features not working with FileDOM, working with DOM

20 October 2010 at 9:34am
You have to update it in two places..
$manager->setUploadFolder()
$manager->setAllowedFileTypes()Will affect the upload interface on the "add" action.
In the getCMSFields() function for your DataObject, you'll need to update the Uploadify fields for the "edit" action:
$uploader->setUploadFolder()
$uploader->setAllowedFileTypes();--------------------
SilverStripe tips, tutorials, screencasts and more: http://www.leftandmain.com -
Re: Uploadify: features not working with FileDOM, working with DOM

21 October 2010 at 1:40am
OK, the allowed types and setting the upload folder is working now but the "allowFolderSelection" even when set to false in both places still lets you change the folder both when updating and adding.
| 753 Views | ||
|
Page:
1
|
Go to Top |

