New Module [in progress]: Batch Tagging!

mikeage
mikeage's picture

Joined: 2005-01-23
Posts: 138
Posted: Thu, 2007-01-04 11:28

I have some code available that supports batch tagging of images. Instead of adding keywords by choosing "Edit Captions," you can select "Batch Tag."

This will show a screen with 20 items, a checkbox for each, and their titles and the current keywords. On the left side, there's a position:fixed; div that has all the keywords defined in the keyword cloud with a + and - on the side. Clicking on + will insert that tag into any checked item, and - will remove it. The code is intelligent enough to prevent duplicate tags, and to handle multiword tags correctly (don't remove foo from foo bar

Everything works well, but there's a few problems, which I'd be grateful for some help in solving:

1. It's not a proper module. Worse, it's integrated into the core, and depends on keyalbum.
2. It's hardcoded to only use semicolons as delimiters.
3. The keyword cloud is only updated every 24 hours. This is an issue with keyalbum, not this module, per se.
4. The GUI is horrendous (but it was done as a proof of concept, not as an ideal interface)
5. I changes module.inc (on line 183 -- see below) from $link= to $links[$itemId][], and I don't exactly understand why I did that. Anyone?

I'm sure there's other things, but we can start with these problems.

That said, it's quite useful, especially if you have many pictures and only a few tags. Check it out and help improve it!

To install, unzip the zip file into your gallery directory, and read modules/core/changes-to-module-inc.txt . Alternatively, open module.inc (in modules/core) and change lines 183-7 from:

		$link = array('text' => $this->_translate('Edit Captions'),
			      'params' => array('view' => 'core.ItemAdmin',
						'subView' => 'core.ItemEditCaptions',
						'itemId' => $itemId,
						'return' => 1));

to

		$links[$itemId][] = array('text' => $this->_translate('Edit Captions'),
			      'params' => array('view' => 'core.ItemAdmin',
						'subView' => 'core.ItemEditCaptions',
						'itemId' => $itemId,
						'return' => 1));
		$links[$itemId][] = array('text' => $this->_translate('Batch Tag'),
			      'params' => array('view' => 'core.ItemAdmin',
						'subView' => 'core.ItemBatchTags',
						'itemId' => $itemId,
						'return' => 1));

On line 380 (line 385 after the above change), add:

		$views[] = array('name' => $this->_translate('Batch Tag'),
				 'view' => 'core.ItemBatchTags');

after:

		$views[] = array('name' => $this->_translate('Edit Captions'),
				 'view' => 'core.ItemEditCaptions');
AttachmentSize
batch_tag.zip5.41 KB