diff options
author | Egil Moeller <egil.moller@freecode.no> | 2010-03-22 00:23:01 +0100 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2010-03-22 00:23:01 +0100 |
commit | f0050f45b67b0ca6539e03b23848e977f47c0905 (patch) | |
tree | 87f9168b0174b59b82fc5a116f6f24e5876f9c0b /etherpad/src/plugins | |
parent | fc00cfedd6c25d1634a1e0d28a7b7bc5f42e1cd7 (diff) | |
download | etherpad-f0050f45b67b0ca6539e03b23848e977f47c0905.tar.gz etherpad-f0050f45b67b0ca6539e03b23848e977f47c0905.tar.bz2 etherpad-f0050f45b67b0ca6539e03b23848e977f47c0905.zip |
Updated changes to adhere to new directory layout
Diffstat (limited to 'etherpad/src/plugins')
-rw-r--r-- | etherpad/src/plugins/kafoo/main.js | 16 | ||||
-rw-r--r-- | etherpad/src/plugins/testplugin/controllers/testplugin.js | 57 | ||||
-rw-r--r-- | etherpad/src/plugins/testplugin/hooks.js | 15 | ||||
-rw-r--r-- | etherpad/src/plugins/testplugin/main.js | 23 | ||||
-rw-r--r-- | etherpad/src/plugins/testplugin/static/js/main.js | 11 | ||||
-rw-r--r-- | etherpad/src/plugins/testplugin/static/js/test.js | 1 | ||||
-rw-r--r-- | etherpad/src/plugins/testplugin/templates/testplugin.ejs | 29 |
7 files changed, 152 insertions, 0 deletions
diff --git a/etherpad/src/plugins/kafoo/main.js b/etherpad/src/plugins/kafoo/main.js new file mode 100644 index 0000000..f645576 --- /dev/null +++ b/etherpad/src/plugins/kafoo/main.js @@ -0,0 +1,16 @@ +import("etherpad.log"); + +function init() { + this.hooks = []; + this.description = 'KaBar plugin'; + this.install = install; + this.uninstall = uninstall; +} + +function install() { + log.info("Installing testplugin"); +} + +function uninstall() { + log.info("Uninstalling testplugin"); +} diff --git a/etherpad/src/plugins/testplugin/controllers/testplugin.js b/etherpad/src/plugins/testplugin/controllers/testplugin.js new file mode 100644 index 0000000..0c79e06 --- /dev/null +++ b/etherpad/src/plugins/testplugin/controllers/testplugin.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("testplugin.ejs", + { + isPro: isPro, + isProAccountHolder: isProUser, + account: getSessionProAccount(), // may be falsy + }, 'testplugin'); + return true; +} diff --git a/etherpad/src/plugins/testplugin/hooks.js b/etherpad/src/plugins/testplugin/hooks.js new file mode 100644 index 0000000..493a2c2 --- /dev/null +++ b/etherpad/src/plugins/testplugin/hooks.js @@ -0,0 +1,15 @@ +import("etherpad.log"); +import("dispatch.{Dispatcher,PrefixMatcher,forward}"); +import("plugins.testplugin.controllers.testplugin"); + +function serverStartup() { + log.info("Server startup for testplugin"); +} + +function serverShutdown() { + log.info("Server shutdown for testplugin"); +} + +function handlePath() { + return [[PrefixMatcher('/ep/testplugin/'), forward(testplugin)]]; +} diff --git a/etherpad/src/plugins/testplugin/main.js b/etherpad/src/plugins/testplugin/main.js new file mode 100644 index 0000000..49b447c --- /dev/null +++ b/etherpad/src/plugins/testplugin/main.js @@ -0,0 +1,23 @@ +import("etherpad.log"); +import("plugins.testplugin.hooks"); +import("plugins.testplugin.static.js.main"); + +function init() { + this.hooks = ['serverStartup', 'serverShutdown', 'handlePath']; + this.client = new main.init(); + this.description = 'Test Plugin'; + this.serverStartup = hooks.serverStartup; + this.serverShutdown = hooks.serverShutdown; + this.handlePath = hooks.handlePath; + this.install = install; + this.uninstall = uninstall; +} + +function install() { + log.info("Installing testplugin"); +} + +function uninstall() { + log.info("Uninstalling testplugin"); +} + diff --git a/etherpad/src/plugins/testplugin/static/js/main.js b/etherpad/src/plugins/testplugin/static/js/main.js new file mode 100644 index 0000000..f08b8f7 --- /dev/null +++ b/etherpad/src/plugins/testplugin/static/js/main.js @@ -0,0 +1,11 @@ +function init() { + this.hooks = ['kafoo']; + this.kafoo = kafoo; +} + +function kafoo() { + alert('hej'); +} + +/* used on the client side only */ +testplugin = new init(); diff --git a/etherpad/src/plugins/testplugin/static/js/test.js b/etherpad/src/plugins/testplugin/static/js/test.js new file mode 100644 index 0000000..0f30cd9 --- /dev/null +++ b/etherpad/src/plugins/testplugin/static/js/test.js @@ -0,0 +1 @@ +callHook("kafoo"); diff --git a/etherpad/src/plugins/testplugin/templates/testplugin.ejs b/etherpad/src/plugins/testplugin/templates/testplugin.ejs new file mode 100644 index 0000000..f70ca8d --- /dev/null +++ b/etherpad/src/plugins/testplugin/templates/testplugin.ejs @@ -0,0 +1,29 @@ +<% /* 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.includeJs("plugins/testplugin/test.js"); + helpers.addToHead('\n<style type="text/css" title="dynamicsyntax"></style>\n'); +%> + +<div id="padpage"> + Welcome to the test plugin +</div> |