I'd like to make a module which moves items with a given tag from the current album to another chosen album.
Ideally, it'd have the option to copy in addition to moving. More complicated selection (and and or tags) would be a further feature.
I don't see any similar modules; what would be a good starting point for this? Would it be better to hack the organizer module popup, or start from scratch?
Posts: 7994
On the server side it's pretty easy to move the instances. The code would look something like this (off the top of my head):
For a simple UI to get started, you'd need an album picker of some kind.. can't think if we have one of those offhand, but you could bastardize one of the album tree modules to get that. And you'd need a tag autocomplete box, which you can crib from the tag sidebar block. Combine those into a dialog and put it in the context menu for your current album and you're good to go.
This is an N^2 walk in PHP so it's slow, but for small data sets it'll be plenty fast enough. For a more efficient solution you'd want to do a single query that joins the item and the items tags tables to find just the items you care about.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!
Posts: 7994
PS: while investigating this, I found a bug in organize (https://sourceforge.net/apps/trac/gallery/ticket/1914) - thanks for the prod.
---
Problems? Check gallery3/var/logs
file a bug/feature ticket | upgrade to the latest code! | hacking G3? join us on IRC!