diff --git a/README.md b/README.md index e075d8212..785a0835e 100644 --- a/README.md +++ b/README.md @@ -51,7 +51,7 @@ Here is the **[FAQ](https://github.com/Pita/etherpad-lite/wiki/FAQ)** **As root:**
    -
  1. Install the dependencies. We need the gzip, git, curl, libssl develop libraries and python
    apt-get install gzip git-core curl python libssl-dev

  2. +
  3. Install the dependencies. We need the gzip, git, curl, libssl develop libraries and python
    apt-get install gzip git-core curl python libssl-dev build-essential

  4. Install node.js
    1. Download the latest 0.4.x node.js release from http://nodejs.org/#download
    2. diff --git a/node/db/PadManager.js b/node/db/PadManager.js index 8af299ccc..4e16c7c45 100644 --- a/node/db/PadManager.js +++ b/node/db/PadManager.js @@ -21,10 +21,20 @@ require("../db/Pad"); var db = require("./DB").db; -/** - * A Array with all known Pads +/** + * An Object containing all known Pads. Provides "get" and "set" functions, + * which should be used instead of indexing with brackets. These prepend a + * colon to the key, to avoid conflicting with built-in Object methods or with + * these functions themselves. + * + * If this is needed in other places, it would be wise to make this a prototype + * that's defined somewhere more sensible. */ -globalPads = []; +globalPads = { + get: function (name) { return this[':'+name]; }, + set: function (name, value) { this[':'+name] = value; }, + remove: function (name) { delete this[':'+name]; } +}; /** * Returns a Pad Object with the callback @@ -65,7 +75,7 @@ exports.getPad = function(id, text, callback) } } - var pad = globalPads[id]; + var pad = globalPads.get(id); //return pad if its already loaded if(pad != null) @@ -86,7 +96,7 @@ exports.getPad = function(id, text, callback) } else { - globalPads[id] = pad; + globalPads.set(id, pad); callback(null, pad); } }); @@ -110,6 +120,6 @@ exports.isValidPadId = function(padId) //removes a pad from the array exports.unloadPad = function(padId) { - if(globalPads[padId]) - delete globalPads[padId]; + if(globalPads.get(padId)) + globalPads.remove(padId); } diff --git a/node/server.js b/node/server.js index 944e73703..2bebe6a24 100644 --- a/node/server.js +++ b/node/server.js @@ -99,7 +99,8 @@ async.waterfall([ app.get('/static/*', function(req, res) { res.header("Server", serverName); - var filePath = path.normalize(__dirname + "/.." + req.url.split("?")[0]); + var filePath = path.normalize(__dirname + "/.." + + req.url.replace(/\.\./g, '').split("?")[0]); res.sendfile(filePath, { maxAge: exports.maxAge }); }); diff --git a/static/js/pad2.js b/static/js/pad2.js index b79ff8b97..9df57ae8f 100644 --- a/static/js/pad2.js +++ b/static/js/pad2.js @@ -18,6 +18,7 @@ var socket; var LineNumbersDisabled = false; +var noColors = false; var useMonospaceFontGlobal = false; var globalUserName = false; @@ -80,9 +81,18 @@ function getParams() { var showControls = getUrlVars()["showControls"]; var showChat = getUrlVars()["showChat"]; - var userName = getUrlVars()["userName"]; + var userName = unescape(getUrlVars()["userName"]); var showLineNumbers = getUrlVars()["showLineNumbers"]; var useMonospaceFont = getUrlVars()["useMonospaceFont"]; + var IsnoColors = getUrlVars()["noColors"]; + + if(IsnoColors) + { + if(IsnoColors == "true") + { + noColors = true; + } + } if(showControls) { if(showControls == "false") @@ -236,6 +246,13 @@ function handshake() { pad.changeViewOption('showLineNumbers', false); } + + // If the noColors value is set to true then we need to hide the backround colors on the ace spans + if (noColors == true) + { + pad.changeViewOption('noColors', true); + } + // If the Monospacefont value is set to true then change it to monospace. if (useMonospaceFontGlobal == true) { @@ -245,6 +262,7 @@ function handshake() if (globalUserName !== false) { pad.notifyChangeName(globalUserName); // Notifies the server + pad.myUserInfo.name = globalUserName; $('#myusernameedit').attr({"value":globalUserName}); // Updates the current users UI } } diff --git a/static/js/pad_editor.js b/static/js/pad_editor.js index 93ef36295..e98252cff 100644 --- a/static/js/pad_editor.js +++ b/static/js/pad_editor.js @@ -61,6 +61,8 @@ var padeditor = (function() { pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace'); }); + + noColors = !noColors; // Inversed so we can pass it to showauthorcolors }, setViewOptions: function(newOptions) { @@ -84,6 +86,9 @@ var padeditor = (function() v = getOption('useMonospaceFont', false); self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif")); $("#viewfontmenu").val(v ? "monospace" : "normal"); + + self.ace.setProperty("showsauthorcolors", noColors); + }, initViewZoom: function() {