I have been trying to figure this out for 2 days.
How do we tell Lightroom that the photo cannot be deleted from the server, thus
disallow the delete action by the user?
Also how to I reset the photo back to published if I need to, even if the user tried to delete it.
Third, How is the user supposed to cancel the delete, like if he pressed delete on the wrong image. Other than undo, because we loose that when Lightroom is closed.
The re-publish status of a photo can be manipulated through an LrPublishedPhoto instance. (Though, there appears to be a bug in that the effect is the opposite of what the documentation says. A bug has already been filed on that.)
LrPublishedPhoto instances can be obtained from LrPublishedCollection objects. If you have an LrPhoto object, you can find which LrPublishedCollection instances contain it via the 'getContainedPublishedCollections' call.
If you need to allow the user to explicitly change the re-publish status of a photo, perhaps a menu item which operates on the target photo is one way? (I haven't actually tried this, but it seems like it should be possible.)
Dear Hagen and Dravik,
I have made a few discoveries after careful observation of the deletePhotosFromPublishedCollection method:
1. The method will not be called after you remove a photo from a publishedCollection. The photo will be merely placed under the Photos to remove section of the publishedCollection. The actual invocation of the method will occur after you pressed the publish button. apparently Publish button will do: (1) Remove any photo mark for removal; (2) Publish any photo marked for publication.
2. After you mistakenly mark a published photos for removal, there is no way to change the status back to published or at least republish. which I think the desired behavior. At least here you should be able to take a last look at the photo and decide your final action as what to do to the photo. I am guessing that this is the buggy behavior Dravik was talking about. Because of the bug, you have to remove the photo from publication and add them again after the whole process ended. If you have a lot of photos and slow Internet, I suggest you decide before you press remove.
3. Within the method deletePhotosFromPublishedCollection you only have limited information to work with as follows...
- a. publishSettings
- (table) The settings for this publish service, as specified by the user in the Publish Manager dialog. Any changes that you make in this table do not persist beyond the scope of this function call.
- b. arrayOfPhotoIds
- (table) The remote photo IDs that were declared by this plug-in when they were published.
- c. deletedCallback
- (function) This function must be called for each photo ID as soon as the deletion is confirmed by the remote service. It takes a single argument: the photo ID from the arrayOfPhotoIds array.
I for one would love to know the publishedCollection this function if refering to. It is common sense I guess. A more comprehensive parameters like in the processRenderedPhotos would be more beneficial and give better control to the plugin developer to control plugin behavior during deletion or removal of photos. Especially for cleaning up plugin specific metadata. I have look at numerous plugin that leave their custom metadata uncleaned. Even after I totally remove their plugin from my system.
That is all for now..
Just to add... Funny... guess what.. if you mark a photo for removal in published collection.. you can press Ctrl+Z or Menu "Edit"->"Undo" you can reset the remove from collection action... : which the context menu cannot do...hope this help...