One of the goals for Habari 0.7 is to change tags over to use the vocabulary and term classes. Over the weekend I created a branch to work on this. It's located at
http://svn.habariproject.org/habari/branches/tags_as_terms. At the moment tags functionality appears to be working. The interface is basically the same as what we are used to with the current tag/tags interface, with one exception. Since the Term class implements a get() method, Tag::get() has to have the same interface, so it is now Tag::get($vocab_id, $term_id) rather than Tag::get($tag). $vocab_id is the id of the Vocabulary from which you are getting the tag. 'tags' is the name of the vocabulary in the current code. $term_id is the id of the tag you are trying to get. The Tag class is implemented by extending the Term class. Term::objects () and Term::associate() were fleshed out to be able to add tags to the object_terms table. A Term::remove_association() method was created to facilitate remove associations from the object_terms table, and Utils::object_type_id() was added to the Utils class to facilitate getting the id of an object type. Tags are working on site, including being able to use 'tag' and 'tag_text' and 'slug' and 'tag_slug' as we currently do. The tagtray plugin still works. The Post class has been updated to use the new tag class, and the install handler has code to transfer one's tags to the terms table, add the 'tags' vocabulary to the vocabulary table, and move the contents of tag2post to the object_terms table. Current issues include: 1. Tags::get() will be very slow when the site has hundreds of tags. Is there a better way to cast the member of an array from one class to another than one-by-one in a loop? 2. The string literal 'post' (the object type with which tags are associated) is scattered through the code. 3. The tags and tag2post tables aren't dropped when upgrading the database, and the two tables continue to be known to Habari. This may not be the code we end up with, but it's a start. The code needs used, in order to spot any bugs, cleaned up, updated to fix the issues noted above, or thrown away to start over if it's a bad design. Rick --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to habari-dev@googlegroups.com To unsubscribe from this group, send email to habari-dev-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/habari-dev -~----------~----~----~----~------~----~------~--~---