From a2d2b610b28bf7c75e65933872ee0655f83da9cf Mon Sep 17 00:00:00 2001 From: Egil Moeller Date: Mon, 5 Apr 2010 16:23:32 +0200 Subject: Updated the plugin manager to use the admin auth system --- etherpad/src/etherpad/control/admincontrol.js | 17 ++++++++++++++--- etherpad/src/main.js | 2 -- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/etherpad/src/etherpad/control/admincontrol.js b/etherpad/src/etherpad/control/admincontrol.js index 02f6428..ec48824 100644 --- a/etherpad/src/etherpad/control/admincontrol.js +++ b/etherpad/src/etherpad/control/admincontrol.js @@ -51,6 +51,8 @@ import("etherpad.collab.collab_server"); import("etherpad.pro.pro_accounts"); import("etherpad.pro.pro_utils"); import("etherpad.pro.domains"); +import("etherpad.admin.plugins"); +import("etherpad.control.admin.pluginmanager"); jimport("java.lang.System.out.println"); @@ -87,7 +89,8 @@ var _mainLinks = [ ['reload-blog-db', 'Reload blog DB'], ['pro-domain-accounts', 'Pro Domain Accounts'], ['beta-valve', 'Beta Valve'], - ['reset-subscription', "Reset Subscription"] + ['reset-subscription', "Reset Subscription"], + ['pluginmanager/', "Plugin manager"] ]; function onRequest(name) { @@ -100,7 +103,11 @@ function onRequest(name) { } var disp = new Dispatcher(); + + disp.addLocations(plugins.callHook("handleAdminPath")); + disp.addLocations([ + [PrefixMatcher('/ep/admin/pluginmanager/'), forward(pluginmanager)], [PrefixMatcher('/ep/admin/usagestats/'), forward(statscontrol)] ]); @@ -152,9 +159,13 @@ function render_main() { div.push(A({href: "/"}, html("«"), " home")); div.push(H1("Admin")); - _mainLinks.forEach(function(l) { + function addMenuItem(l) { div.push(DIV(A({href: l[0]}, l[1]))); - }); + } + + plugins.callHook("adminMenu").forEach(addMenuItem); + _mainLinks.forEach(addMenuItem); + if (sessions.isAnEtherpadAdmin()) { div.push(P(A({href: "/ep/admin/setadminmode?v=false"}, "Exit Admin Mode"))); diff --git a/etherpad/src/main.js b/etherpad/src/main.js index 9035f2d..2d92a1a 100644 --- a/etherpad/src/main.js +++ b/etherpad/src/main.js @@ -34,7 +34,6 @@ import("etherpad.importexport.importexport"); import("etherpad.legacy_urls"); import("etherpad.control.aboutcontrol"); -import("etherpad.control.admin.pluginmanager"); import("etherpad.control.admincontrol"); import("etherpad.control.blogcontrol"); import("etherpad.control.connection_diagnostics_control"); @@ -387,7 +386,6 @@ function handlePath() { [DirMatcher('/ep/beta-account/'), forward(pro_beta_control)], [DirMatcher('/ep/pro-signup/'), forward(pro_signup_control)], [DirMatcher('/ep/about/'), forward(aboutcontrol)], - [DirMatcher('/ep/admin/pluginmanager'), forward(pluginmanager)], [DirMatcher('/ep/admin/'), forward(admincontrol)], [DirMatcher('/ep/blog/posts/'), blogcontrol.render_post], [DirMatcher('/ep/blog/'), forward(blogcontrol)], -- cgit v1.2.3-1-g7c22