Personal tools
You are here: Home Products Plone Roadmap #160: Overhaul FileUpload Widget
Document Actions

#160: Overhaul FileUpload Widget

Contents
  1. Definitions
  2. Motivation
  3. Assumptions
  4. Proposal
  5. Implementation
  6. Deliverables
  7. Risks
  8. Progress log
  9. Participants
by Alan Runyan last modified September 10, 2007 - 04:08
Our current widget implementation for uploading Binary Large Objects (BLOBs) is less than optimal. There are historical reasons why the existing FileUpload Widget works the way it does. But we need to revamp it and make it UploadReferenceWidget. This means that when a BLOB is uploaded it will not be directly in the content data but will be outside of the content and we will use reference's to link the BLOB to the content object.
Proposed by
Alan Runyan
Seconded by
Dorneles Treméa
Proposal type
User interface
Repository branch
UploadReferenceWidget
State
draft

Definitions

 

Motivation

Today in Zope/Plone File-oriented assets are *embedded* into the content object.  This makes a variety of problems more difficult to solve than should be:

  • Re-using file assets that are embedded into a content object.  There is no way to 'browse' to these file assets. 
  • These file assets may not be first class content citizens therefore they may not have UIDs.  Meaning you can not easily reference them.
  • Content import/export would be easier if they were decoupled and represented as relationships instead of attributes of the content object.

Plone does very little about directing users on how to store and handle file oriented assets. As side effect of this proposal is to suggest a central place to put file oriented assets.  This has numerous benefits itself:

  • Gives users a central folder where file oriented assets should be placed (reduces end users thinking process)
  • Enables us in the future to incorporate components such as 'Image Repository' since we know where all the file oriented assets should be residing in a default Plone installation
  • We could mount this Folder as a separate Database in which we can have a finer grain control over memory usage and performance characteristics

Tomorrow we will need this decoupling.

  • Sophisticated deployment techniques such as Entransit Content Deployment or CMFDeployment find it very hard to represent and maintain these 'asset relationships'.  These are solvable problems but as the deployment techniques become more complex we will be unnecessarily carrying baggage.
  • Content import/export will be much easier to implement especially if content has 2 or more file asset properties in a content type.
  • Users expect to be able to re-use *all* content.  If I upload a logo into a News Item last month and want to reuse that logo this month.  I should be able to do that easily and efficiently. 

Assumptions

 

Proposal

This would introduce a backwards incompatibility issue.  The client code would have to be changed anytime Field specific calls are being made.  For instance the 'scaling' properties of the ImageFiled would not apply.

Development

  • The UploadReferenceWidget development will be moved from Enfold System's public subversion, located at https://svn.enfoldsystems.com/public/UploadReferenceWidget to Archetypes SVN repository into the MoreFieldsAndWidgets folder, located at https://svn.plone.org/svn/archetypes/MoreFieldsAndWidgets/
  • The User Interface of the UploadReferenceWidget should be reviewed, some questions:
    • Should the 'Reference List' be visible when uploading Files?
    • Should you be able to remove the target object from the Widget?
  • Determine what a sensible default would be for location of Uploaded assets.  Currently the assets are contained in the content object.  This widget ensures the assets are uploaded as first-class content objects in the Plone CMS.  Where do we put those?
    • One suggestion create a BTreeFolder called 'files-and-images' in the root of each Plone site.
    • In the future this 'files-and-images' folder could be converted to a 'Image Repository' product from PSOL.
  • Identify all of Upload Widget(s) used in Content Types outside of File/Image.  The list of affected default content types:
    • News Item
  • Assign Copyright to the Plone Foundation

Evaluation

  1. The introduction of this widget should add ZERO conceptual overhead for a end user.
  2. The software should be bundled into a software release on plone.org and available to the public [DONE]
  3. A 'demo' of the Widget should be provided (This comes along with the source code) [DONE]
  4. Identify and set a default policy for 'files-and-images' to be used.

Packaging

This widget would be packaged like ATReferenceBrowserWidget, as a Product or egg.  However its superclass is packaged. 

Migration

This is going to be the largest chunk of work.  Here is a plan of attack:

  1. Identify the location for uploaded assets to be placed instead of inside of content objects, i.e. 'files-and-images' location
    1. Create this folder in new versions of Plone
    2. Figure out the structure (if any) for this Folder, files-and-images
  2. Change the affected content types from using FileField or ImageField to using ReferenceField
    1. ATContentTypes.content.newsitem.ATNewsItem would need to change from using ImageField
    2. This means that there needs to be compatibility or a break in compatibility since ImageField supports a different API than ReferenceField.
  3. Write migration script that yanks out the Image/File data from content types and creates new content instances in files-and-images location
    which will then be referenced in the source content types such as News Item.
  4. Wire the migration script into the Plone migration routines
  5. Bundle the UploadReferenceWidget with the Plone distribution

Integration

This widget is 100% compatible with ReferenceBrowserWidget(s) and ReferenceField.

 

Implementation

Download UploadReferenceWidget: http://plone.org/products/upload-reference-widget

A specialization of the ATReferenceBrowserWidget.  It is a new Widget not a new Field.

 

Deliverables

A new ReferencableUpload Widget would be implemented [DONE]

ATCT NewsItem would use the ReferencableUpload so that BLOBs can be shared between News Items

Migration Script

Release Copyright to Plone Foundation

Risks

Introducing a new Widget is minimum risk.

Implementing it for ATNewsItems, by default, requires migration.

 

Progress log

The initial code has been released and is being used in production. 

Participants

  • Dorneles Treméa
  • Alan Runyan

 

MIgrations would also have to be added

Posted by Alexander Limi at August 22, 2006 - 04:52
If this is supposed to be the general policy for assets, there needs to be a way to turn already existing files into standalone objects.

Identified

Posted by Alan Runyan at September 6, 2007 - 12:29
I have identified this and said it would be done. It will also raise problems with API's. For instance today in ZPT's they do things, such as News listing page, content/getImage/image_thumbnail which returns the image object scaled to thumbnail. This may no longer work if we make it a reference widget. The API will have changed. Moving from a ImageField to a ReferenceField will cause some backwards compatibility issues. But its all in the name of progress!

plip comments

Posted by Wichert Akkerman at September 19, 2006 - 18:16
There are several problems with this PLIP:

* there is nobody implementing it
* since this does not require any changes in plone it can be done as a seperate product and considered for inclusion into plone core if it is succesfull
* the proposal is missing essential details such as where to store the uploaded file

This has been addressed

Posted by Alan Runyan at September 5, 2007 - 13:47
Enfold Systems has implemented it and you can find the source code in the SVN link. We will be moving this to the collective before the Plone Confernece.

It does not require any changes to Plone but I would like for it to be considered the DEFAULT way for uploading 'attachments' or files/images into a content type.

The proposal is still missing detail but this detail is in the product's overview. Also the tests and README is extensive. Will load that back into the proposal.

release BlobFile?

Posted by Nate Aune at September 20, 2006 - 04:58
Alan - do you think it would be possible to move BlobFile to the collective and make a release of BlobFile? I think that would greatly improve the accessibility of this product so that others can start using it and enhancing it. -Nate

This is done

Posted by Alan Runyan at September 5, 2007 - 14:13
Nate, believe BlobFile has been moved to collective. If not let me know. We are working with CT to ensure Blob in ZODB 3.8 is rock solid. I believe ZODB Blob is the only way forward.

not necessary

Posted by Yuri at September 5, 2007 - 07:12
i.e. Again using ATNewsItem from ATCT that ships with Plone 2.1.x and above - what if you have a logo that is shared across News Items (ala Slashdot). The system requires you to upload the image each time.
==============

just use a reference widget for the news items instead of image one.

Generally speaking, the best it to make easy the modifying of an existing content type, so you can solve this issue in the proper way.

Must work the way the user works

Posted by Alan Runyan at September 5, 2007 - 13:55
You can not 'just use a reference widget'. Because that requires you to:

- Know you are going to use a Image *before* adding the News Item.
- Make a decision on *where* to add the Image
- Upload the image to your decided location
- Go back to where you were going to add the News Item
- Click the 'Reference' button and browse/search for the widget
- Save the reference (hopefully you select the right one!)

Plone is the 'Apple of Content Management'. The above 'user interaction' is miserable. And is certainly not obvious. Being the 'Apple of CMS' we must provide a sleeker implementation. UploadReferenceWidget provides this implementation. The user simply uploads a File, like they normally do and the File/Image is put into a computed location based on the customizers programming. Try it, http://plone.org/products/upload-reference-widget

With regards to "Generally speaking, the best it to make easy the modifying of an existing content type, so you can solve this issue in the proper way." This is what Archetypes or ATSchemaEditorNG is about. This is the 'easy modifying existing content type'.

Re: Must work the way the user works

Posted by Yuri at September 5, 2007 - 14:46
you can upload an image from the reference widget and automatically reference it, as fckeditor does.

ATSchemaEditorNG is easy to use, to modify the news content type to use a different widget or field to upload the image?

BTW, I don't disagree using something that does it all, I'm a fan of it :)

Must not understand

Posted by Alan Runyan at September 6, 2007 - 12:24
I believe we might be talking past each other. I understand FCKEditor and/or Kupu can upload content inside of its WYSIWYG editor. And it can create a reference inside of the HTML for a Field, say Body field for Page content type.

Let me give you another example. This time from plone.org.

Each Product content type on plone.org allows you to upload a 'logo'. If you are looking at the Upload Reference Widget you will see Enfold System's logo. Right? So today Enfold System's has about 10-15 product releases on plone.org. Each product release carries a *copy* of our logo. There is ZERO re-use between each of the 10-15 product releases. Let's say I want to change my logo that is being used by these 10-15 product releases. I have to visit each release and upload a new image. That sucks.

I agree

Posted by Yuri at September 6, 2007 - 12:38
I agree, we are telling the same thing :)

note: FCKEditor (not kupu) can upload an Image as a Image object, and reference it "at the same time", using the "insert an image" button. It uploads the image if needed, and put his url as reference to the image. The image is not embedded in the object, but it is another object.


For any issues with the web site functionality, please file a ticket.

Please consult the policy on plone.org content if you want your content published on this site.

Servers and hosting by