Monday, June 23, 2008

Officially Started my Winter of Code

The past Saturday the winter started here, so my summer of code changed to a cold winter of code in the south hemisphere.

A summary of my progress can be read on the docs/HISTORY.txt file on the product itself, but here I'll paste last changes.
  • Outlined BatchEditorForm, so far only showing a list of contents to edit, but not editable yet.
  • Added Empty Interface and Adapter for BatchEditable contents.
  • Created uninstall profile that removes all created actions.
  • Created first tests: tests_setup.py and base.py inside tests module.
  • User search parameters and items selection stored on content annotations.
  • Re done BatchSelectorForm for displaying search results and select items to edit using plone.z3cform.crud.
  • Added Interface and Adapter for BatchSelectable contents.
Although what we have is still not even an alpha release, I invite you people to checkout the code and try it (on a sandbox instance please). I also encourage you to file anything you find odd here.

Also, I want to thank Daniel Nouri for his great work on plone.z3cform.crud.

Here, an screen shot of the selector user interface. As you can see, needs some ui love yet.

About things for next week, I must say that is the same list than for the previous one:
  • display Archetypes schema fields on plone.z3cforms.crud
  • create the batch edit action for saving changes (shouldn't be hard using crud).
  • add more tests.

Tuesday, June 17, 2008

Handle errors

Here I have a question for which I don't have a clear answer yet, and is what to do when trying to submit a batch-edition and the values provided for some of the fields is not valid. Can be an empty required field, or any other kind of validation error.

What I think we should be doing is:
  • not save changes for any object on the form
  • display the form with the given values on each input field, and the errors displayed
  • allow the user to disable the re-submit of problematic objects with a check box next to each.
  • A global disable all problematic objects check box for JavaScript enabled browsers.
This way, if the user have dozens of objects with correct data, and only a couple are failing, he can save the correct ones, and later care about the problematic ones.

Previously, Martin suggested to put the disable check box at the beggining, which I also think it's good idea.

Again, your comments will be very appreciated.

Edit heterogeneous content

Martin Aspeli asked how us will be handling the batch-edition (yes, I invented that verb) of several objects of different content types. Moreover, what fields let the user select to edit, and what to do if the user selected to edit a field that does not exist for any of the objects to edit.

My first though was report that request as an error. Wasn't very powerful, nor useful, but was the first though. After a week of thinking, I prefer another more user friendly option: when displaying the batch-edit-form, for each content object that does not have the field to edit, just inform the user that fact, but not report any error, and also display in the form all input fields for objects that do have the field to edit.

With this in mind, I think that shouldn't be hard to let the user actually select more than one field to edit for the set of content objects.

I'll be glad to read your thoughts.

plone.app.batch

New name, new code, new ideas, new functionality.

We still not have the real batch-edit functionality in place, but we are building the pieces to finally have it.

In this past weekend, I progressed in three different paths.

In first place, after a couple of recommendations, I decided to take a deep look to the z3cform package and it was a nice and enlightened reading. Although I didn't put z3cform forms in my package yet, it's for sure that I'm gonna do it.

In the second path, I cleaned and re-though a couple of ideas. Following Martin Aspeli advices (or should I write Martín?) I separated in interfaces and adapters what things will be able to be batch-editable, how will that be done, etc. In this way, I added a setup configuration page to the plone setup area to select which content types can be batch-editable. This work took me more than what I expected, but I think that real timer-consumer thing was the gain-experience-in-the-process thing. Anyways, my past in PloneGetPaid helped :-D. Here above in the right is a scree-shoot of that page.
Another thing I did in the cleanup was: simplify batch search form, and prettify the batch results page, which I was thinking on name batch-selector (Is the form where you have the content objects you want to modify, and you select what to do with them).

Finally I created an entry on plone.org/products and I'm waiting the approval. If you got a Log In page instead, means that was not approved yet. After approval, I want to add an issue tracker there and invite you my dear reader to test what I have, and file issues, or request. Probably I wont be able to add much functionality things to the project during the summer of code period, but I plan to continue later, so do be shy.
I also added my code to the plone collective, so if you want to take a look:
svn co https://svn.plone.org/svn/collective/plone.app.batch

I was going to add Alex Limi and Martin Aspeli as owners of the product too, when I realized that they already have that role inherited because it seems that they are plone.org administrators. My assigned and not assigned tutors rocks :). I added Jon Sthal (the owner of the idea) and Matthew Wilkes (the guy that's coordinating this summer of code from plone) as owners in case they want to do things there.

The plan for next week:
  • study Alloy Analyzer: I have an exam next Friday.
  • buy gifts (or better, make them): my girlfriend birthday is this Thursday.
  • code and code for SoC:
    • start work to display Archetypes schema fields on z3c forms.
    • create the batch_edit form using the previous work.
    • add some tests (shame on me)
A little request: if you have things to say, I'll appreciate if you can add comments here in my blog. It's much easier for organize information than searching emails.

Sunday, June 08, 2008

Plone Batch Plan

After the first two weeks of lot of plone3 studying, and first lines of code, here I'm trying to have a first plan for this exciting summer of code project.

I'm very excited after writing the first pieces of this project cause things are looking fine, and I'm enjoying the pretty plone3 style :-D.

The plan

I think that the entire project can be contained on a single plone theme product, which I was thinking to call plone.batch. I'm very original, don't you think :-)? Yes, like in all other things in this post (and in this project) I'm open to accept better ideas.

The separated pieces that glued together will eventually make the plone.batch that I think are:

  1. Generic setup profiles for install/uninstall the product
  2. zope3 browser form, very similar to the current "advanced search form", accessible as an object action for any folderish content.
  3. zope3 browser view/form that displays search results, but in a new form that allows the user to select which objects to edit, and what operation to do. So far, the operations that I have in mind will be:
    • edit a field (with a drop-down of available fields)
    • enable / disable comments
    • transform (with a drop-down of transformations)
  4. zope3 browser form for real batch editing content fields (finally!). Should be a listing with a widget for editing the selected field and a save button for each selected object . For non-javascript users a global save button will be available.
  5. Server side logic for kss
  6. Set of basic, default transformations. I think that this will be done with a set of adapters.
  7. Tests, tests and tests. I was thinking on making unit tests for the back-end, functional tests for the basic user interface, and selenium tests for the ajax interface.
  8. I would also like to have time to include some i18n work, and a Spanish translation.

Bureaucracy

I have a couple of bureaucratic things that I need to get done for making communication easy:
  • Include my code in the svn.plone.org/collective. So far I worked on a local svn repo, which let me have versions, but not allow people to see my work nor prevent me for accidents if anything happens to my laptop.
  • Create bug-issue tracker (in plone.org?)

What did I do so far?


  • I created a very basic install profile that adds the "batch" action to folderish contents
  • I created the zope3 search form based on the default plone advanced form, putting all the python calculations on the view code instead of the template, and trying to eliminate as much as possible the old plone things that template was carring (like doing here.portal_something, or use of isAnon, etc)

Here are a couple of screen shots of this initial work: