diff options
author | Egil Moeller <egil.moller@freecode.no> | 2012-03-15 18:25:06 +0100 |
---|---|---|
committer | Egil Moeller <egil.moller@freecode.no> | 2012-03-15 18:25:06 +0100 |
commit | 51cae02e9dd20f483c2b71c07865561ea50eaf8b (patch) | |
tree | ba776320a05019f63669e3b3ff79927ae362a1d7 /src/node/hooks/express/adminplugins.js | |
parent | dbdc53307e6b5a2b64910a4e68149bc17b30be43 (diff) | |
download | etherpad-lite-51cae02e9dd20f483c2b71c07865561ea50eaf8b.zip |
Show installed plugins and search new ones
Diffstat (limited to 'src/node/hooks/express/adminplugins.js')
-rw-r--r-- | src/node/hooks/express/adminplugins.js | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/node/hooks/express/adminplugins.js b/src/node/hooks/express/adminplugins.js new file mode 100644 index 00000000..a3fbc2af --- /dev/null +++ b/src/node/hooks/express/adminplugins.js @@ -0,0 +1,34 @@ +var path = require('path'); +var eejs = require('ep_etherpad-lite/node/eejs'); +var installer = require('ep_etherpad-lite/static/js/pluginfw/installer'); + +exports.expressCreateServer = function (hook_name, args, cb) { + args.app.get('/admin/plugins', function(req, res) { + var plugins = require("ep_etherpad-lite/static/js/pluginfw/plugins"); + var render_args = { + plugins: plugins.plugins, + query: req.query, + search_results: {}, + errors: [], + }; + + var render = function () { + res.send(eejs.require( + "ep_etherpad-lite/templates/admin/plugins.html", + render_args), {}); + }; + + if (req.query.search && req.query.search != "") { + installer.search(req.query.search, function (er, data) { + if (er) { + render_args.errors.push(er); + return render(); + } + render_args.search_results = data; + render(); + }); + } else { + render(); + } + }); +}
\ No newline at end of file |