summaryrefslogtreecommitdiffstats
path: root/etherpad/src/plugins
diff options
context:
space:
mode:
authorEgil Moeller <egil.moller@freecode.no>2010-03-25 18:21:35 +0100
committerEgil Moeller <egil.moller@freecode.no>2010-03-25 18:21:35 +0100
commitf7dd3aa34cad8a59ad00172339c565731ad80fbb (patch)
tree89bace287097a264736fa361ec0898bba420c0f8 /etherpad/src/plugins
parente411a43b1b217e3d3f893bcbc0c23c6fd4ec0b6d (diff)
downloadetherpad-f7dd3aa34cad8a59ad00172339c565731ad80fbb.tar.gz
etherpad-f7dd3aa34cad8a59ad00172339c565731ad80fbb.tar.bz2
etherpad-f7dd3aa34cad8a59ad00172339c565731ad80fbb.zip
Generalized linestylefilter.getURLFilter to a linestylefilter.getRegexpFilter
Diffstat (limited to 'etherpad/src/plugins')
-rw-r--r--etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js57
-rw-r--r--etherpad/src/plugins/twitterStyleTags/hooks.js12
-rw-r--r--etherpad/src/plugins/twitterStyleTags/main.js23
-rw-r--r--etherpad/src/plugins/twitterStyleTags/static/js/main.js11
-rw-r--r--etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs28
5 files changed, 131 insertions, 0 deletions
diff --git a/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js b/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js
new file mode 100644
index 0000000..bf7c5b7
--- /dev/null
+++ b/etherpad/src/plugins/twitterStyleTags/controllers/tagBrowser.js
@@ -0,0 +1,57 @@
+/**
+ * Copyright 2009 RedHog, Egil Möller <egil.moller@piratpartiet.se>
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS-IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import("faststatic");
+import("dispatch.{Dispatcher,PrefixMatcher,forward}");
+
+import("etherpad.utils.*");
+import("etherpad.collab.server_utils");
+import("etherpad.globals.*");
+import("etherpad.log");
+import("etherpad.pad.padusers");
+import("etherpad.pro.pro_utils");
+import("etherpad.helpers");
+import("etherpad.pro.pro_accounts.getSessionProAccount");
+import("sqlbase.sqlbase");
+import("sqlbase.sqlcommon");
+import("sqlbase.sqlobj");
+
+
+function onRequest() {
+ var isPro = pro_utils.isProDomainRequest();
+ var userId = padusers.getUserId();
+
+ helpers.addClientVars({
+ userAgent: request.headers["User-Agent"],
+ debugEnabled: request.params.djs,
+ clientIp: request.clientAddr,
+ colorPalette: COLOR_PALETTE,
+ serverTimestamp: +(new Date),
+ isProPad: isPro,
+ userIsGuest: padusers.isGuest(userId),
+ userId: userId,
+ });
+
+ var isProUser = (isPro && ! padusers.isGuest(userId));
+
+ renderHtml("tagBrowser.ejs",
+ {
+ isPro: isPro,
+ isProAccountHolder: isProUser,
+ account: getSessionProAccount(), // may be falsy
+ }, 'twitterStyleTags');
+ return true;
+}
diff --git a/etherpad/src/plugins/twitterStyleTags/hooks.js b/etherpad/src/plugins/twitterStyleTags/hooks.js
new file mode 100644
index 0000000..65aef83
--- /dev/null
+++ b/etherpad/src/plugins/twitterStyleTags/hooks.js
@@ -0,0 +1,12 @@
+import("etherpad.log");
+import("dispatch.{Dispatcher,PrefixMatcher,forward}");
+import("plugins.twitterStyleTags.controllers.tagBrowser");
+
+function aceGetFilterStack() {
+ log.info("aceGetFilterStack");
+ return [];
+}
+
+function handlePath() {
+ return [[PrefixMatcher('/ep/tags/'), forward(tagBrowser)]];
+}
diff --git a/etherpad/src/plugins/twitterStyleTags/main.js b/etherpad/src/plugins/twitterStyleTags/main.js
new file mode 100644
index 0000000..686c863
--- /dev/null
+++ b/etherpad/src/plugins/twitterStyleTags/main.js
@@ -0,0 +1,23 @@
+import("etherpad.log");
+import("plugins.twitterStyleTags.hooks");
+import("plugins.twitterStyleTags.static.js.main");
+
+function init() {
+ this.hooks = ['handlePath'];
+ this.client = new main.init();
+ this.description = 'Twitter-style tags';
+ this.handlePath = hooks.handlePath;
+ this.aceGetFilterStack = hooks.aceGetFilterStack;
+
+ this.install = install;
+ this.uninstall = uninstall;
+}
+
+function install() {
+ log.info("Installing Twitter-style tags");
+}
+
+function uninstall() {
+ log.info("Uninstalling Twitter-style tags");
+}
+
diff --git a/etherpad/src/plugins/twitterStyleTags/static/js/main.js b/etherpad/src/plugins/twitterStyleTags/static/js/main.js
new file mode 100644
index 0000000..96be013
--- /dev/null
+++ b/etherpad/src/plugins/twitterStyleTags/static/js/main.js
@@ -0,0 +1,11 @@
+function init() {
+ this.hooks = ['aceGetFilterStack'];
+ this.aceGetFilterStack = aceGetFilterStack;
+}
+
+function aceGetFilterStack() {
+ console.log('aceGetFilterStack');
+}
+
+/* used on the client side only */
+twitterStyleTags = new init();
diff --git a/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs b/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs
new file mode 100644
index 0000000..aed5d9b
--- /dev/null
+++ b/etherpad/src/plugins/twitterStyleTags/templates/tagBrowser.ejs
@@ -0,0 +1,28 @@
+<% /* Copyright 2009 Google Inc.
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS-IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License. */ %>
+<%
+ helpers.setHtmlTitle("Test plugin");
+ helpers.setBodyId("padbody");
+ helpers.addBodyClass("limwidth nonpropad nonprouser");
+ helpers.includeCss("pad2_ejs.css");
+ helpers.setRobotsPolicy({index: false, follow: false})
+ helpers.includeJQuery();
+ helpers.includeCometJs();
+ helpers.includeJs("json2.js");
+ helpers.addToHead('\n<style type="text/css" title="dynamicsyntax"></style>\n');
+%>
+
+<div id="padpage">
+ Welcome to the tag browser plugin
+</div>