diff options
-rw-r--r-- | etherpad/src/etherpad/admin/plugins.js | 7 | ||||
-rw-r--r-- | etherpad/src/etherpad/control/admincontrol.js | 17 | ||||
-rw-r--r-- | etherpad/src/main.js | 2 | ||||
-rw-r--r-- | etherpad/src/templates/admin/pluginmanager.ejs | 60 | ||||
-rw-r--r-- | infrastructure/framework-src/modules/faststatic.js | 26 |
5 files changed, 77 insertions, 35 deletions
diff --git a/etherpad/src/etherpad/admin/plugins.js b/etherpad/src/etherpad/admin/plugins.js index 384817f..385e2ca 100644 --- a/etherpad/src/etherpad/admin/plugins.js +++ b/etherpad/src/etherpad/admin/plugins.js @@ -228,12 +228,13 @@ function callHook(hookName, args) { if (hooks[hookName] === undefined) return []; var res = []; - for (i = 0; i < hooks[hookName].length; i++) { + + for (var i = 0; i < hooks[hookName].length; i++) { var plugin = hooks[hookName][i]; var pluginRes = pluginModules[plugin.plugin][plugin.original || hookName](args); if (pluginRes != undefined && pluginRes != null) - for (var i = 0; i < pluginRes.length; i++) - res.push(pluginRes[i]); /* Don't use Array.concat as it flatterns arrays within the array */ + for (var j = 0; j < pluginRes.length; j++) + res.push(pluginRes[j]); /* Don't use Array.concat as it flatterns arrays within the array */ } return res; } 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)], diff --git a/etherpad/src/templates/admin/pluginmanager.ejs b/etherpad/src/templates/admin/pluginmanager.ejs index 33b04bf..8a3d0bf 100644 --- a/etherpad/src/templates/admin/pluginmanager.ejs +++ b/etherpad/src/templates/admin/pluginmanager.ejs @@ -12,15 +12,35 @@ 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("Browse tags"); + helpers.setHtmlTitle("EtherPad: Manage plugins"); +/* + helpers.includeCss("plugins/twitterStyleTags/tagBrowser.css"); + helpers.includeCss("plugins/twitterStyleTags/pad.css"); */ helpers.setBodyId("padbody"); helpers.addBodyClass("limwidth nonpropad nonprouser"); helpers.includeCss("pad2_ejs.css"); - helpers.setRobotsPolicy({index: false, follow: false}) - helpers.includeJQuery(); + helpers.includeJs("undo-xpopup.js"); helpers.includeCometJs(); + helpers.includeJQuery(); helpers.includeJs("json2.js"); - helpers.addToHead('\n<style type="text/css" title="dynamicsyntax"></style>\n'); + helpers.includeJs("colorutils.js"); + helpers.includeJs("ace.js"); + helpers.includeJs("collab_client.js"); + helpers.includeJs("draggable.js"); + helpers.includeJs("pad_utils.js"); + helpers.includeJs("pad_cookie.js"); + helpers.includeJs("pad_editor.js"); + helpers.includeJs("pad_userlist.js"); + helpers.includeJs("pad_editbar.js"); + helpers.includeJs("pad_chat.js"); + helpers.includeJs("pad_docbar.js"); + helpers.includeJs("pad_impexp.js"); + helpers.includeJs("pad_savedrevs.js"); + helpers.includeJs("pad_connectionstatus.js"); + helpers.includeJs("pad_modals.js"); + helpers.includeJs("pad2.js"); + helpers.suppressGA(); + helpers.setRobotsPolicy({index: false, follow: false}); function inArray(item, arr) { for (var i = 0; i < arr.length; i++) @@ -34,18 +54,17 @@ limitations under the License. */ %> <div id="padtop"> <div id="topbar" style="margin: 7px; margin-top: 0px;"> <div id="topbarleft"><!-- --></div> - <div id="topbarright"><!-- --></div> - <div id="topbarcenter"><a href="/" id="topbaretherpad">EtherPad</a></div> - <% if (isProAccountHolder) { %> - <div id="accountnav"><%= toHTML(account.email) %><a href="/ep/account/sign-out">(sign out)</a></div> - <% } else if (isPro) { %> - <div id="accountnav"><a href="<%= signinUrl %>">sign in</a></div> - <% } %> - </div> + <div id="topbarright"><!-- --></div> + <div id="topbarcenter"><a href="/" id="topbaretherpad">EtherPad</a></div> + <% if (isProAccountHolder) { %> + <div id="accountnav"><%= toHTML(account.email) %><a href="/ep/account/sign-out">(sign out)</a></div> + <% } else if (isPro) { %> + <div id="accountnav"><a href="<%= signinUrl %>">sign in</a></div> + <% } %> </div> <div id="docbar" class="docbar-public"> <div id="docbarleft"><!-- --></div> - <div title="Browse pads by tag" id="docbarpadtitle"><span>Browse tags</span></div> + <div title="Manage plugins" id="docbarpadtitle"><span>Manage plugins</span></div> <div id="docbaroptions-outer"><a href="javascript:void(0)" id="docbaroptions">Pad Options</a></div> <div id="docbarsavedrevs-outer"><a href="javascript:void(0)" id="docbarsavedrevs">Saved revisions</a></div> @@ -71,21 +90,10 @@ limitations under the License. */ %> <div id="editbarright"><!-- --></div> <div id="editbarinner"> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('bold'));" class="editbarbutton bold" title="Bold (ctrl-B)"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('italic'));" class="editbarbutton italic" title="Italics (ctrl-I)"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('underline'));" class="editbarbutton underline" title="Underline (ctrl-U)"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('strikethrough'));" class="editbarbutton strikethrough" title="Strikethrough"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('clearauthorship'));" class="editbarbutton clearauthorship" title="Clear Authorship Colors"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('undo'));" class="editbarbutton undo" title="Undo (ctrl-Z)"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('redo'));" class="editbarbutton redo" title="Redo (ctrl-Y)"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('insertunorderedlist'));" class="editbarbutton insertunorderedlist" title="Toggle Bullet List"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('indent'));" class="editbarbutton indent" title="Indent List"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('outdent'));" class="editbarbutton outdent" title="Unindent List"> </a> - <a unselectable="on" href="javascript:void (window.pad&&pad.editbarClick('save'));" class="editbarbutton save" title="Save Revision"> </a> </div> </div> - <div style="height: 268px;" id="editorcontainerbox"> - <div id="editorcontainer" style="padding:5pt; height: 600pt;"> + <div id="editorcontainerbox"> + <div id="editorcontainer"> <h1>Plugin manager</h1> <table> <tr> diff --git a/infrastructure/framework-src/modules/faststatic.js b/infrastructure/framework-src/modules/faststatic.js index 5cca676..920be8c 100644 --- a/infrastructure/framework-src/modules/faststatic.js +++ b/infrastructure/framework-src/modules/faststatic.js @@ -104,11 +104,35 @@ function _getMTime(f) { } } +function manglePluginPath(localFile, fileType) { + var prefix = '/static/' + fileType + '/plugins/'; + if (localFile.substring(0, prefix.length) != prefix) + return localFile; + var suffix = localFile.substring(prefix.length); + var plugin = suffix.split('/', 1)[0]; + suffix = suffix.substring(plugin.length + 1); + return '/plugins/' + plugin + '/static/' + fileType + '/' + suffix; +} + +function manglePluginPaths(localFile) { + return manglePluginPath( + manglePluginPath( + manglePluginPath( + manglePluginPath( + manglePluginPath( + localFile, + 'js'), + 'css'), + 'swf'), + 'html'), + 'zip'); +} + function _wrapFile(localFile) { return { getPath: function() { return localFile; }, getMTime: function() { return _getMTime(localFile); }, - getContents: function() { return _readFileAndProcess(localFile, 'string'); } + getContents: function() { return _readFileAndProcess(manglePluginPaths(localFile), 'string'); } }; } |