internal package
Foswiki::Plugins::TagsPlugin
initPlugin($topic, $web, $user, $installWeb) -> $boolean
-
$topic
- the name of the topic in the current CGI query
-
$web
- the name of the web in the current CGI query
-
$user
- the login name of the user
-
$installWeb
- the name of the web the plugin is installed in
afterSaveHandler($text, $topic, $web, $error, $meta )
-
$text
- the text of the topic excluding meta-data tags (see beforeSaveHandler)
-
$topic
- the name of the topic in the current CGI query
-
$web
- the name of the web in the current CGI query
-
$error
- any error string returned by the save.
-
$meta
- the metadata of the saved topic, represented by a Foswiki::Meta object
Makes sure any newly created topics get the 'Web' tag
tagCall($session) -> $text
Add new tag: (aparently SELECT then INSERT is faster than REPLACE)
- if 'item' not in Items table
- INSERT INTO Items (item_name, item_type) VALUES ("$web.$name", 'topic');
- $item_id = SELECT item_id FROM Items WHERE item_name = "$web.$name" AND item_type = 'topic';
- if 'tag' not in Tags table
- INSERT INTO Tags (t.item_name) VALUES ($tag);
- $tag_id = SELECT tag_id FROM Tags WHERE t.item_name = $tag;
- INSERT INTO UserItemTag (user_id, item_id, tag_id) VALUES($user_id, $item_id, $tag_id);
- increment counters
- UPDATE TagStat SET num_items=num_items+1 WHERE tag_id = $tag_id
- UPDATE UserTagStat SET num_items=num_items+1 WHERE tag_id = $tag_id AND user_id = $user_id
--+++ updateTopicTags($item_type, $web, $topic, $user_id)
update the tags for this topic
#TODO: remove formname tags if the form is changed..
#TODO: remove category tags if they are removed from topic text..