Merge branch 'master' of github.com:RolePlayGateway/etherpad-lite

This commit is contained in:
Eric Martindale 2011-10-15 01:35:48 +00:00
commit 85d54ee5c3
5 changed files with 44 additions and 10 deletions

View file

@ -51,7 +51,7 @@ Here is the **[FAQ](https://github.com/Pita/etherpad-lite/wiki/FAQ)**
**As root:** **As root:**
<ol> <ol>
<li>Install the dependencies. We need the gzip, git, curl, libssl develop libraries and python <br><code>apt-get install gzip git-core curl python libssl-dev</code></li><br> <li>Install the dependencies. We need the gzip, git, curl, libssl develop libraries and python <br><code>apt-get install gzip git-core curl python libssl-dev build-essential</code></li><br>
<li>Install node.js <li>Install node.js
<ol type="a"> <ol type="a">
<li>Download the latest <b>0.4.x</b> node.js release from <a href="http://nodejs.org/#download">http://nodejs.org/#download</a></li> <li>Download the latest <b>0.4.x</b> node.js release from <a href="http://nodejs.org/#download">http://nodejs.org/#download</a></li>

View file

@ -22,9 +22,19 @@ require("../db/Pad");
var db = require("./DB").db; 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 * 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 //return pad if its already loaded
if(pad != null) if(pad != null)
@ -86,7 +96,7 @@ exports.getPad = function(id, text, callback)
} }
else else
{ {
globalPads[id] = pad; globalPads.set(id, pad);
callback(null, pad); callback(null, pad);
} }
}); });
@ -110,6 +120,6 @@ exports.isValidPadId = function(padId)
//removes a pad from the array //removes a pad from the array
exports.unloadPad = function(padId) exports.unloadPad = function(padId)
{ {
if(globalPads[padId]) if(globalPads.get(padId))
delete globalPads[padId]; globalPads.remove(padId);
} }

View file

@ -99,7 +99,8 @@ async.waterfall([
app.get('/static/*', function(req, res) app.get('/static/*', function(req, res)
{ {
res.header("Server", serverName); 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 }); res.sendfile(filePath, { maxAge: exports.maxAge });
}); });

View file

@ -18,6 +18,7 @@
var socket; var socket;
var LineNumbersDisabled = false; var LineNumbersDisabled = false;
var noColors = false;
var useMonospaceFontGlobal = false; var useMonospaceFontGlobal = false;
var globalUserName = false; var globalUserName = false;
@ -80,9 +81,18 @@ function getParams()
{ {
var showControls = getUrlVars()["showControls"]; var showControls = getUrlVars()["showControls"];
var showChat = getUrlVars()["showChat"]; var showChat = getUrlVars()["showChat"];
var userName = getUrlVars()["userName"]; var userName = unescape(getUrlVars()["userName"]);
var showLineNumbers = getUrlVars()["showLineNumbers"]; var showLineNumbers = getUrlVars()["showLineNumbers"];
var useMonospaceFont = getUrlVars()["useMonospaceFont"]; var useMonospaceFont = getUrlVars()["useMonospaceFont"];
var IsnoColors = getUrlVars()["noColors"];
if(IsnoColors)
{
if(IsnoColors == "true")
{
noColors = true;
}
}
if(showControls) if(showControls)
{ {
if(showControls == "false") if(showControls == "false")
@ -236,6 +246,13 @@ function handshake()
{ {
pad.changeViewOption('showLineNumbers', false); 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 the Monospacefont value is set to true then change it to monospace.
if (useMonospaceFontGlobal == true) if (useMonospaceFontGlobal == true)
{ {
@ -245,6 +262,7 @@ function handshake()
if (globalUserName !== false) if (globalUserName !== false)
{ {
pad.notifyChangeName(globalUserName); // Notifies the server pad.notifyChangeName(globalUserName); // Notifies the server
pad.myUserInfo.name = globalUserName;
$('#myusernameedit').attr({"value":globalUserName}); // Updates the current users UI $('#myusernameedit').attr({"value":globalUserName}); // Updates the current users UI
} }
} }

View file

@ -61,6 +61,8 @@ var padeditor = (function()
{ {
pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace'); pad.changeViewOption('useMonospaceFont', $("#viewfontmenu").val() == 'monospace');
}); });
noColors = !noColors; // Inversed so we can pass it to showauthorcolors
}, },
setViewOptions: function(newOptions) setViewOptions: function(newOptions)
{ {
@ -84,6 +86,9 @@ var padeditor = (function()
v = getOption('useMonospaceFont', false); v = getOption('useMonospaceFont', false);
self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif")); self.ace.setProperty("textface", (v ? "monospace" : "Arial, sans-serif"));
$("#viewfontmenu").val(v ? "monospace" : "normal"); $("#viewfontmenu").val(v ? "monospace" : "normal");
self.ace.setProperty("showsauthorcolors", noColors);
}, },
initViewZoom: function() initViewZoom: function()
{ {