internal package Foswiki::Plugins::TagsPlugin

See PublishedAPI for packages intended to be used by Plugin and Contrib authors, or browse all packages.
See also Developing plugins, Developer's Bible, Technical Overview

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)
  1. if 'item' not in Items table
    • INSERT INTO Items (item_name, item_type) VALUES ("$web.$name", 'topic');
  2. $item_id = SELECT item_id FROM Items WHERE item_name = "$web.$name" AND item_type = 'topic';
  3. if 'tag' not in Tags table
    • INSERT INTO Tags (t.item_name) VALUES ($tag);
  4. $tag_id = SELECT tag_id FROM Tags WHERE t.item_name = $tag;
  5. INSERT INTO UserItemTag (user_id, item_id, tag_id) VALUES($user_id, $item_id, $tag_id);
  6. 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..

This site is powered by FoswikiCopyright © by the contributing authors. All material on this site is the property of the contributing authors.
Ideas, requests, problems regarding AustLII Communities? Send feedback
This website is using cookies. More info. That's Fine