fixed merge conflicts

This commit is contained in:
Peter 'Pita' Martischka 2011-07-26 19:30:39 +01:00
commit 6b43d2252b
10 changed files with 65 additions and 57 deletions

View file

@ -3,7 +3,7 @@
hash node-inspector > /dev/null 2>&1 || { hash node-inspector > /dev/null 2>&1 || {
echo "You need to install node-inspector to run the tests!" >&2 echo "You need to install node-inspector to run the tests!" >&2
echo "You can install it with npm" >&2 echo "You can install it with npm" >&2
echo "Run: npm install node-inspector" >&2 echo "Run: npm install -g node-inspector" >&2
exit 1 exit 1
} }

View file

@ -1,14 +0,0 @@
#!/bin/sh
hash nodeunit > /dev/null 2>&1 || {
echo "You need to install Nodeunit to run the tests!" >&2
echo "You can install it with npm" >&2
echo "Run: npm install nodeunit" >&2
exit 1
}
if [ -d "../bin" ]; then
cd "../"
fi
nodeunit tests

View file

@ -24,6 +24,7 @@ var Changeset = require("./Changeset");
var AttributePoolFactory = require("./AttributePoolFactory"); var AttributePoolFactory = require("./AttributePoolFactory");
var authorManager = require("./AuthorManager"); var authorManager = require("./AuthorManager");
var readOnlyManager = require("./ReadOnlyManager"); var readOnlyManager = require("./ReadOnlyManager");
var settings = require('./settings');
/** /**
* A associative array that translates a session to a pad * A associative array that translates a session to a pad
@ -731,6 +732,7 @@ function handleClientReady(client, message)
"fullWidth": false, "fullWidth": false,
"hideSidebar": false "hideSidebar": false
}, },
"abiwordAvailable": settings.abiword != null,
"hooks": {} "hooks": {}
} }

View file

@ -30,16 +30,32 @@ var Buffer = require('buffer').Buffer;
var gzip = require('gzip'); var gzip = require('gzip');
var server = require('./server'); var server = require('./server');
var padJS = ["jquery.min.js", "pad_utils.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js", "jquery-ui.js", "chat.js"];
var timesliderJS = ["jquery.min.js", "plugins.js", "undo-xpopup.js", "json2.js", "colorutils.js", "draggable.js", "pad_utils.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "easysync2_client.js", "domline_client.js", "linestylefilter_client.js", "cssmanager_client.js", "broadcast.js", "broadcast_slider.js", "broadcast_revisions.js"];
/** /**
* Answers a http request for the pad javascript * creates the minifed javascript for the given minified name
* @param req the Express request * @param req the Express request
* @param res the Express response * @param res the Express response
*/ */
exports.padJS = function(req, res) exports.minifyJS = function(req, res, jsFilename)
{ {
res.header("Content-Type","text/javascript"); res.header("Content-Type","text/javascript");
var jsFiles = ["jquery.min.js", "pad_utils.js", "plugins.js", "undo-xpopup.js", "json2.js", "pad_cookie.js", "pad_editor.js", "pad_editbar.js", "pad_docbar.js", "pad_modals.js", "ace.js", "collab_client.js", "pad_userlist.js", "pad_impexp.js", "pad_savedrevs.js", "pad_connectionstatus.js", "pad2.js", "jquery-ui.js", "chat.js"]; //choose the js files we need
if(jsFilename == "pad.js")
{
jsFiles = padJS;
}
else if(jsFilename == "timeslider.js")
{
jsFiles = timesliderJS;
}
else
{
throw new Error("there is no profile for creating " + name);
}
//minifying is enabled //minifying is enabled
if(settings.minify) if(settings.minify)
@ -91,7 +107,7 @@ exports.padJS = function(req, res)
function(callback) function(callback)
{ {
//check the modification time of the minified js //check the modification time of the minified js
fs.stat("../var/minified_pad.js", function(err, stats) fs.stat("../var/minified_" + jsFilename, function(err, stats)
{ {
if(err && err.code != "ENOENT") callback(err); if(err && err.code != "ENOENT") callback(err);
@ -122,6 +138,13 @@ exports.padJS = function(req, res)
//find all includes in ace.js and embed them //find all includes in ace.js and embed them
function(callback) function(callback)
{ {
//if this is not the creation of pad.js, skip this part
if(jsFilename != "pad.js")
{
callback();
return;
}
var founds = fileValues["ace.js"].match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"]+\)/gi); var founds = fileValues["ace.js"].match(/\$\$INCLUDE_[a-zA-Z_]+\([a-zA-Z0-9.\/_"]+\)/gi);
//go trough all includes //go trough all includes
@ -194,7 +217,7 @@ exports.padJS = function(req, res)
//write the results plain in a file //write the results plain in a file
function(callback) function(callback)
{ {
fs.writeFile("../var/minified_pad.js", result, "utf8", callback); fs.writeFile("../var/minified_" + jsFilename, result, "utf8", callback);
}, },
//write the results compressed in a file //write the results compressed in a file
function(callback) function(callback)
@ -202,7 +225,7 @@ exports.padJS = function(req, res)
gzip(result, 9, function(err, compressedResult){ gzip(result, 9, function(err, compressedResult){
if(err) {callback(err); return} if(err) {callback(err); return}
fs.writeFile("../var/minified_pad.js.gz", compressedResult, callback); fs.writeFile("../var/minified_" + jsFilename + ".gz", compressedResult, callback);
}); });
} }
],callback); ],callback);
@ -217,12 +240,12 @@ exports.padJS = function(req, res)
var pathStr; var pathStr;
if(gzipSupport) if(gzipSupport)
{ {
pathStr = path.normalize(__dirname + "/../var/minified_pad.js.gz"); pathStr = path.normalize(__dirname + "/../var/minified_" + jsFilename + ".gz");
res.header('Content-Encoding', 'gzip'); res.header('Content-Encoding', 'gzip');
} }
else else
{ {
pathStr = path.normalize(__dirname + "/../var/minified_pad.js"); pathStr = path.normalize(__dirname + "/../var/minified_" + jsFilename );
} }
res.sendfile(pathStr, { maxAge: server.maxAge }); res.sendfile(pathStr, { maxAge: server.maxAge });

View file

@ -87,19 +87,19 @@ async.waterfall([
}); });
//serve minified files //serve minified files
app.get('/minified/:id', function(req, res) app.get('/minified/:id', function(req, res, next)
{ {
res.header("Server", serverName); res.header("Server", serverName);
var id = req.params.id; var id = req.params.id;
if(id == "pad.js") if(id == "pad.js" || id == "timeslider.js")
{ {
minify.padJS(req,res); minify.minifyJS(req,res,id);
} }
else else
{ {
res.send('404 - Not Found', 404); next();
} }
}); });

View file

@ -85,7 +85,7 @@
<div id="button" onclick="go2Random()">New Pad</div> <div id="button" onclick="go2Random()">New Pad</div>
<br> <br>
<div class="label">or create/open a Pad with the name</div> <div class="label">or create/open a Pad with the name</div>
<form action="" onsubmit="go2Name();return false;"> <form action="#" onsubmit="go2Name();return false;">
<input type="text" id="padname" autofocus> <input type="text" id="padname" autofocus>
<input type="submit" value="OK"> <input type="submit" value="OK">
</form> </form>

View file

@ -233,12 +233,26 @@ var padimpexp = (function()
// build the export links // build the export links
$("#exporthtmla").attr("href", document.location.href + "/export/html"); $("#exporthtmla").attr("href", document.location.href + "/export/html");
$("#exportplaina").attr("href", document.location.href + "/export/txt"); $("#exportplaina").attr("href", document.location.href + "/export/txt");
$("#exportworda").attr("href", document.location.href + "/export/doc");
$("#exportpdfa").attr("href", document.location.href + "/export/pdf");
$("#exportopena").attr("href", document.location.href + "/export/odt");
$("#exportwordlea").attr("href", document.location.href + "/export/wordle"); $("#exportwordlea").attr("href", document.location.href + "/export/wordle");
$("#importform").get(0).setAttribute('action', document.location.href + "/import"); //hide stuff thats not avaible if abiword is disabled
if(!clientVars.abiwordAvailable)
{
$("#exportworda").remove();
$("#exportpdfa").remove();
$("#exportopena").remove();
$("#importexport").css({"height":"95px"});
$("#importexportline").css({"height":"95px"});
$("#import").html("Import is not available");
}
else
{
$("#exportworda").attr("href", document.location.href + "/export/doc");
$("#exportpdfa").attr("href", document.location.href + "/export/pdf");
$("#exportopena").attr("href", document.location.href + "/export/odt");
$("#importform").get(0).setAttribute('action', document.location.href + "/import");
}
$("#impexp-close").click(function() $("#impexp-close").click(function()
{ {

View file

@ -225,7 +225,7 @@ We removed this feature cause its not worth the space it needs in the editbar
<a id="exportworda" target="_blank" class="exportlink"><div class="exporttype" id="exportword">Microsoft Word</div></a> <a id="exportworda" target="_blank" class="exportlink"><div class="exporttype" id="exportword">Microsoft Word</div></a>
<a id="exportpdfa" target="_blank" class="exportlink"><div class="exporttype" id="exportpdf">PDF</div></a> <a id="exportpdfa" target="_blank" class="exportlink"><div class="exporttype" id="exportpdf">PDF</div></a>
<a id="exportopena" target="_blank" class="exportlink"><div class="exporttype" id="exportopen">OpenDocument</div></a> <a id="exportopena" target="_blank" class="exportlink"><div class="exporttype" id="exportopen">OpenDocument</div></a>
<a id="exportwordlea" target="_blank" onClick="loadCont();return false;" class="exportlink"><div class="exporttype" id="exportwordle">Wordle</div></a> <a id="exportwordlea" target="_blank" onClick="padimpexp.export2Wordle();return false;" class="exportlink"><div class="exporttype" id="exportwordle">Wordle</div></a>
<form id="wordlepost" name="wall" action="http://wordle.net/advanced" method="POST" style="margin-left:0px;"> <form id="wordlepost" name="wall" action="http://wordle.net/advanced" method="POST" style="margin-left:0px;">
<div id="hidetext" style=""><textarea id="text" name="text" id="text" style="display:none;">Coming soon!</textarea></div> <div id="hidetext" style=""><textarea id="text" name="text" id="text" style="display:none;">Coming soon!</textarea></div>
</form> </form>
@ -260,7 +260,7 @@ Use this link to share a read-only version of your pad:<input id="readonlyInput"
</div> </div>
<div id="chatbox"> <div id="chatbox">
<div id="titlebar"><span id ="titlelabel">Chat</span><a id="titlecross" href="javascript:chat.hide();">x&nbsp;</a></div> <div id="titlebar"><span id ="titlelabel">Chat</span><a id="titlecross" onClick="chat.hide();return false;">x&nbsp;</a></div>
<div id="chattext" class="authorColors"></div> <div id="chattext" class="authorColors"></div>
<div id="chatinputbox"> <div id="chatinputbox">
<form> <form>

View file

@ -8,7 +8,10 @@
<link rel="stylesheet" href="../../static/css/pad.css"> <link rel="stylesheet" href="../../static/css/pad.css">
<link rel="stylesheet" href="../../static/css/timeslider.css"> <link rel="stylesheet" href="../../static/css/timeslider.css">
<style type="text/css" title="dynamicsyntax"></style> <style type="text/css" title="dynamicsyntax"></style>
<script src="../../static/js/jquery.min.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../minified/timeslider.js"></script>
<script> <script>
// <![CDATA[ // <![CDATA[
var clientVars = {}; var clientVars = {};
@ -133,26 +136,6 @@
// ]]> // ]]>
</script> </script>
<script type="text/javascript" src="../../static/js/plugins.js"></script>
<script type="text/javascript" src="../../static/js/undo-xpopup.js"></script>
<script type="text/javascript" src="../../socket.io/socket.io.js"></script>
<script type="text/javascript" src="../../static/js/json2.js"></script>
<script type="text/javascript" src="../../static/js/colorutils.js"></script>
<script type="text/javascript" src="../../static/js/draggable.js"></script>
<script type="text/javascript" src="../../static/js/pad_utils.js"></script>
<script type="text/javascript" src="../../static/js/pad_cookie.js"></script>
<script type="text/javascript" src="../../static/js/pad_editor.js"></script>
<script type="text/javascript" src="../../static/js/pad_editbar.js"></script>
<script type="text/javascript" src="../../static/js/pad_docbar.js"></script>
<script type="text/javascript" src="../../static/js/pad_modals.js"></script>
<script type="text/javascript" src="../../static/js/easysync2_client.js"></script>
<script type="text/javascript" src="../../static/js/domline_client.js"></script>
<script type="text/javascript" src="../../static/js/linestylefilter_client.js"></script>
<script type="text/javascript" src="../../static/js/cssmanager_client.js"></script>
<script type="text/javascript" src="../../static/js/broadcast.js"></script>
<script type="text/javascript" src="../../static/js/broadcast_slider.js"></script>
<script type="text/javascript" src="../../static/js/broadcast_revisions.js">
</script>
</head> </head>
<body id="padbody" class="timeslider limwidth nonpropad nonprouser"> <body id="padbody" class="timeslider limwidth nonpropad nonprouser">