summaryrefslogtreecommitdiffstats
path: root/etherpad/src/plugins/twitterStyleTags/main.js
blob: 34d5d852e4a039601b3b8244327cee5da2d208a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
import("etherpad.log");
import("plugins.twitterStyleTags.hooks");
import("plugins.twitterStyleTags.static.js.main");
import("sqlbase.sqlobj");
import("sqlbase.sqlcommon");

function init() {
 this.hooks = ['handlePath', 'aceGetFilterStack', 'aceCreateDomLine', 'padModelWriteToDB'];
 this.client = new main.init();
 this.description = 'Twitter-style tags allows the user to tag pads by writing #tagname anywhere in the pad text. Tags are automatically linked to searches for that tag in other pads. This plugin also provides an alternative home-page for Etherpad with a display of the last changed public pads as well as that information available as an RSS stream.';
 this.handlePath = hooks.handlePath;
 this.aceGetFilterStack = main.aceGetFilterStack;
 this.aceCreateDomLine = main.aceCreateDomLine;
 this.padModelWriteToDB = hooks.padModelWriteToDB;

 this.install = install;
 this.uninstall = uninstall;
}

function install() {
 log.info("Installing Twitter-style tags");

 sqlobj.createTable('TAG', {
   ID: 'int not null '+sqlcommon.autoIncrementClause()+' primary key',
   NAME: 'varchar(128) character set utf8 collate utf8_bin not null',
  });

 sqlobj.createTable('PAD_TAG', {
   PAD_ID: 'varchar(128) character set utf8 collate utf8_bin not null references PAD_META(ID)',
   TAG_ID: 'int default NULL references TAG(ID)',
  });

 sqlobj.createTable('PAD_TAG_CACHE', {
   PAD_ID: 'varchar(128) character set utf8 collate utf8_bin unique not null references PAD_META(ID)',
   TAGS: 'varchar(1024) collate utf8_bin not null',
  });

}

function uninstall() {
 log.info("Uninstalling Twitter-style tags");
}