1

Topic: Category Deletion?

If you make a mistake in setting up the categories, how do you fix it? I was hoping to redelete and then re-create, but I cannot seem to find a feature that would let me do such a thing. Thanks in advance!

2

Re: Category Deletion?

Category deletion gets kinda hairy- there's no built-in way at the moment. The problem being what to do with the images that are assigned to a category that you are deleting.

If you are just getting started, though, and you don't have any images in a category, then you can simply enter the following SQL command using which ever SQL backend's client you are using:

delete from categories where abbr='something';

If you don't have command-line client access, you can upload a file such as below (name "deletecat.php", for example) to the ochiba directory and then load it in a browser:

<?php
require_once("conf.php");
$db = DB::connect(DB);
$sql = "delete from categories where abbr='something'";
$result = $db->query($sql);
?>

3

Re: Category Deletion?

Heh, yeah, I kinda forgot about SQL backend possibility.

My recommendation about category delete and the images accompanying it? Delete them, too. At least for the time being.

Of course, say if you added a delete hyperlink just after "Edit" hyperlink on the categories page, using the edit/pop-up window as a template, turn the background red (instead of white) and have in big, bold capital? white? lettering:

BY USING THIS DELETE OPTION YOU WILL BE ALSO DELETING ALL ACCOMPANYING IMAGES RELATED TO THIS CATEGORY. Do you want to continue? yes/no buttons.

The other option would be to say, create a special category (eg. 0 - this of course assumes that categories use integers as ids, begining @ 1) and, when a image category is 0, the image becomes "unattached" to any category, and thus could be assigned one. Unfortunately, this would require a whole new interface tool that would likely include thumbnail browsing capabilities with category pulldown selection lists beneith each thumbnail (at least, that is how I would envision it). Which, in turn, would take alot more work.

Of course, this isn't my project - so don't let me tell you what to do!

Cheers!
PS: Keep up the good work!

4

Re: Category Deletion?

Deleting images wouldn't be a problem. The other idea I had was not allowing deletion until all images within a category were first deleted (more work for user).

The hard bit is that an image/thread can be in multiple categories, so in those cases, I'd like not to delete them but to just remove the category assignment. Unfortunately, the way I structured the database, this isn't so easy (I didn't use a join table between images and categories).

My debate is whether to do one of the above, or just go for a proper join table in ochiba 2...

Thanks for your feedback!