The "Upload to new gallery" workflow currently adds an empty gallery while rendering the page. The Gallery should only be created if an image is actually uploaded.

Comments

scroogie’s picture

StatusFileSize
new7.21 KB

With this patch, the gallery is created on the first upload. It uses a synchronous page request to set the nid of the created gallery. The patch also changes the newly created galleries to be unpublished, because otherwise visitors will see a partial gallery if they visit during the upload. Instead of an empty title, the galleries are called "Unnamed gallery", because the administrative interface relies on the title to display links to the nodes.
The only problem I see with this patch is that it uses drupal_set_message to display the help text, but I couldn't get a help text to work on this URL.

scroogie’s picture

Status: Active » Needs review

As always.

justintime’s picture

Patch passed the eyeball test, but ran out of time before I could apply it and test it. I should get time to do so tomorrow.

justintime’s picture

One quick note, I think we should drupal_set_message() the user about the fact that the gallery needs a title and that it's currently unpublished. Thoughts?

scroogie’s picture

Excerpt of the patch:

+  drupal_set_message(t('Using this wizard, a gallery will be created automatically during upload. Please remember to enter a title and to publish the Gallery on the next screen.'));

But I do this on the form currently.

justintime’s picture

Status: Needs review » Needs work

Close, but not quite. As UID 1, all worked as it should.

However, as a user whom can create galleries and images, when I use the "wizard", it get a js popup alert stating "Failed to create gallery".

I don't know if it's related or not (quite possibly it is), but marking the gallery as unpublished is probably something we don't want to do. Only users with 'administer nodes' permissions can change the publish status IIRC.

scroogie’s picture

StatusFileSize
new7.52 KB

Ah, true. I always use additional access control modules, thats why I didn't think about that. Now that you mentioned it, I remember. Unfortunately I think it didn't even make it into D7. :/

I let the status untouched now. The real cause of your error was a typo in the page callback (using array('type', $gallery_type) instead of array('type' => $gallery_type)). I really need to start testing with custom users. I used this additional revision to refine the error handling a bit.

scroogie’s picture

Status: Needs work » Needs review

Time for another review.

scroogie’s picture

StatusFileSize
new7.52 KB

Missed one place when refactoring the error message. This one is really for review.

justintime’s picture

Status: Needs review » Reviewed & tested by the community

This last one does work for me. I think this patch is a great opportunity to become your first official commit to the project. Before you do, point the coder module at your patch (it found two minor issues), and then commit the result. Welcome to the project (officially)!

scroogie’s picture

Status: Reviewed & tested by the community » Fixed

Commited to dev. Yay \o/. I hope I didn't break anything. ;)

oxford-dev’s picture

Im getting 'Failed to create Gallery: Request failed' with the latest patch and the latest dev.

scroogie’s picture

oxford-dev: Please open a new issue including detailed browser information.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.