summaryrefslogtreecommitdiff
path: root/src/node/hooks
diff options
context:
space:
mode:
authorjohnyma22 <john@mclear.co.uk>2012-11-02 13:16:15 +0000
committerjohnyma22 <john@mclear.co.uk>2012-11-02 13:16:15 +0000
commit89e38ed4c240d826e32eddc9f2b5794731b804ea (patch)
treed57d3ee95794c1f7589418ee8ad46dbdeaad5e69 /src/node/hooks
parent1da39d3d1a0cd29e72d42b9a7207afeea6ee41b2 (diff)
downloadetherpad-lite-89e38ed4c240d826e32eddc9f2b5794731b804ea.zip
Start putting file system together for admin settings, no where near complete
Diffstat (limited to 'src/node/hooks')
-rw-r--r--src/node/hooks/express/adminsettings.js63
1 files changed, 63 insertions, 0 deletions
diff --git a/src/node/hooks/express/adminsettings.js b/src/node/hooks/express/adminsettings.js
new file mode 100644
index 00000000..4290a27f
--- /dev/null
+++ b/src/node/hooks/express/adminsettings.js
@@ -0,0 +1,63 @@
+var path = require('path');
+var eejs = require('ep_etherpad-lite/node/eejs');
+var installer = require('ep_etherpad-lite/static/js/pluginfw/installer');
+var fs = require('fs');
+
+exports.expressCreateServer = function (hook_name, args, cb) {
+ args.app.get('/admin/settings', function(req, res) {
+
+ var render_args = {
+ settings: "",
+ search_results: {},
+ errors: []
+ };
+
+ res.send( eejs.require("ep_etherpad-lite/templates/admin/settings.html", render_args) );
+
+ });
+}
+
+exports.socketio = function (hook_name, args, cb) {
+ var io = args.io.of("/settings");
+ io.on('connection', function (socket) {
+ if (!socket.handshake.session.user || !socket.handshake.session.user.is_admin) return;
+
+ socket.on("load", function (query) {
+// socket.emit("installed-results", {results: plugins.plugins});
+ fs.readFile('settings.json', 'utf8', function (err,data) {
+ if (err) {
+ return console.log(err);
+ }
+ else
+ {
+ socket.emit("settings", {results: data});
+ }
+ });
+ });
+
+/*
+ socket.on("search", function (query) {
+ socket.emit("progress", {progress:0, message:'Fetching results...'});
+ installer.search(query, true, function (progress) {
+ if (progress.results)
+ socket.emit("search-result", progress);
+ socket.emit("progress", progress);
+ });
+ });
+
+ socket.on("install", function (plugin_name) {
+ socket.emit("progress", {progress:0, message:'Downloading and installing ' + plugin_name + "..."});
+ installer.install(plugin_name, function (progress) {
+ socket.emit("progress", progress);
+ });
+ });
+
+ socket.on("uninstall", function (plugin_name) {
+ socket.emit("progress", {progress:0, message:'Uninstalling ' + plugin_name + "..."});
+ installer.uninstall(plugin_name, function (progress) {
+ socket.emit("progress", progress);
+ });
+ });
+*/
+ });
+}