sminnee / silverstripe-staticsiteconnector

Connector plugin for the SilverStripe External Content module that uses web scraping to import content.
8 stars 12 forks source link

Asset import #22

Closed stojg closed 11 years ago

stojg commented 11 years ago

The result of this work is that Images and Assets are importable into the SilverStripes Files section.

It's still a bit clunky to import images since a File or Image schema has to be defined with proper mimetypes and the "Folder to import into" dropdown on the Import tab doesnt actually work.

I would highly recommend that someone tries this branch against other targets before merging.

phptek commented 11 years ago

Re: the manual input of mime-types: Both @stojg and I advocated for a pre-populated multi-select, checkboxsetfield or other field to replace the manually inputted mimes on a Schema.

One idea is to map a SilverStripe class to an array of mimes, so users needn't have to lookup mimes on IANA (!!) before inputting them e.g. File, Image, SiteTree where File => array('application/pdf', 'application/msword', etc);

See MimeTypeProcessor#get_mime_for_ss_type()

Another idea might be a similar multi-selection field populated with all the permissible Mimes mapped to the more familiar file-types (.doc, .xls, .pdf etc). This might be populated by a cross-referencing of framework/_config/mimetypes.yml and File::appCategories['doc'] and File::appategories['image'] in a new static method on MimeTypeProcessor called get_mimes_for_permissible_app_categories().

The reason we don't want to return everything from the mimetypes YML file is obviously that not all of them are permissible as far as File and Upload are concerned.

stojg commented 11 years ago

I'm closing this PR due to bugs found in the code and me and @phptek will issue a new one when we confirment that things are working properly.