I'm writing a Media Module that leverages DOM and Uploadify. The module has a MediaAlbumPage which calls a ManyManyFileDataObjectManager in its getCMSFields routine to manage videos. For simplicities sake; The ManyManyFileDataObjectManager is set to display all Videos and the checkbox to show "Related Only" is left unchecked.
When I upload a video through the add button at top of the DOM field, the video is shown in the list upon completion, but the checkbox relating it to the current MediaAlbumPage is left empty.
Is there a simple solution to auto-relate files through the ManyManyFileDataObjectManager (e.g. auto-check the box in the DOM to relate the asset)?
I see there's a trick in the ImageGallery Module that handles this by calling a class extending FileDataObjectManager instead of FileDataObjectManager itself, and injecting the ID of the parent gallery through the getUploadifyFields and getUploadFields method -- but was wondering if there's a different way to go w/o having to write a custom DOM class.
Below is a proposed patch to FileDataObjectManager to handle this automatically if you set the autoRelateUploads property on your ManyManyFileDataObjectManager or HasManyFileDataObjectMany to boolean: true or string: name of relation.