From 2aaf80c8809a0a91a87f56e3f217869071dc8d68 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Wed, 14 Nov 2012 09:27:21 -0800 Subject: [PATCH 01/31] Initial commit --- README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 00000000..33021bd7 --- /dev/null +++ b/README.md @@ -0,0 +1,4 @@ +etherpad-lite +============= + +Etherpad Lite \ No newline at end of file From a5c4fb154f7414cd5dca9e50c3f2ad00e42672f5 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Wed, 14 Nov 2012 09:29:49 -0800 Subject: [PATCH 02/31] Update README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 33021bd7..95dfee26 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -etherpad-lite +We moved! ============= -Etherpad Lite \ No newline at end of file +You can now find Etherpad Lite under [github.com/ether/etherpad-lite](https://github.com/ether/etherpad-lite) \ No newline at end of file From d0a17d547168a0bcb8e35a7f63ba37ad2d360f5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Fri, 23 Nov 2012 18:18:03 +0100 Subject: [PATCH 03/31] test import converting to html instead to txt by default --- src/node/handler/ImportHandler.js | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 788706ce..b6cd5029 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -27,17 +27,22 @@ var settings = require('../utils/Settings'); var formidable = require('formidable'); var os = require("os"); +// TESTING importing in HTML +var importHtml = require("../utils/ImportHtml"); + //load abiword only if its enabled if(settings.abiword != null) var abiword = require("../utils/Abiword"); -var tempDirectory = "/tmp/"; +//Patched in formidable since v1.0.4: +// The dafault temp directory is well detected in order to OS +//var tempDirectory = "/tmp/"; //tempDirectory changes if the operating system is windows -if(os.type().indexOf("Windows") > -1) +/*if(os.type().indexOf("Windows") > -1) { tempDirectory = process.env.TEMP; -} +}*/ /** * do a requested import @@ -58,7 +63,7 @@ exports.doImport = function(req, res, padId) { var form = new formidable.IncomingForm(); form.keepExtensions = true; - form.uploadDir = tempDirectory; + //form.uploadDir = tempDirectory; form.parse(req, function(err, fields, files) { @@ -105,6 +110,7 @@ exports.doImport = function(req, res, padId) { var oldSrcFile = srcFile; srcFile = srcFile.split(".")[0] + ".txt"; + //srcFile = srcFile.split(".")[0] + ".htm"; fs.rename(oldSrcFile, srcFile, callback); } @@ -114,8 +120,11 @@ exports.doImport = function(req, res, padId) function(callback) { var randNum = Math.floor(Math.random()*0xFFFFFFFF); - destFile = tempDirectory + "eplite_import_" + randNum + ".txt"; - abiword.convertFile(srcFile, destFile, "txt", function(err){ + //destFile = tempDirectory + "eplite_import_" + randNum + ".txt"; + //destFile = tempDirectory + "eplite_import_" + randNum + ".htm"; + destFile = os.tmpDir() + "/eplite_import_" + randNum + ".htm"; + //abiword.convertFile(srcFile, destFile, "txt", function(err){ + abiword.convertFile(srcFile, destFile, "htm", function(err){ //catch convert errors if(err){ console.warn("Converting Error:", err); @@ -164,7 +173,9 @@ exports.doImport = function(req, res, padId) //change text of the pad and broadcast the changeset function(callback) { - pad.setText(text); + //pad.setText(text); + //prueba + importHtml.setPadHTML(pad, text); padMessageHandler.updatePadClients(pad, callback); }, @@ -196,6 +207,7 @@ exports.doImport = function(req, res, padId) ERR(err); //close the connection + res.send("", 200); }); } From ef3231efd27a5fde80a6d94b559117e9a028e641 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Fri, 23 Nov 2012 19:06:18 +0100 Subject: [PATCH 04/31] cleaning --- src/node/handler/ImportHandler.js | 121 ++++++++++-------------------- 1 file changed, 39 insertions(+), 82 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index b6cd5029..f6b381a7 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -18,31 +18,19 @@ * limitations under the License. */ -var ERR = require("async-stacktrace"); -var padManager = require("../db/PadManager"); -var padMessageHandler = require("./PadMessageHandler"); -var async = require("async"); -var fs = require("fs"); -var settings = require('../utils/Settings'); -var formidable = require('formidable'); -var os = require("os"); - -// TESTING importing in HTML -var importHtml = require("../utils/ImportHtml"); +var ERR = require("async-stacktrace") + , padManager = require("../db/PadManager") + , padMessageHandler = require("./PadMessageHandler") + , async = require("async") + , fs = require("fs") + , settings = require('../utils/Settings') + , formidable = require('formidable') + , os = require("os") + , importHtml = require("../utils/ImportHtml"); //load abiword only if its enabled if(settings.abiword != null) var abiword = require("../utils/Abiword"); - -//Patched in formidable since v1.0.4: -// The dafault temp directory is well detected in order to OS -//var tempDirectory = "/tmp/"; - -//tempDirectory changes if the operating system is windows -/*if(os.type().indexOf("Windows") > -1) -{ - tempDirectory = process.env.TEMP; -}*/ /** * do a requested import @@ -50,32 +38,27 @@ if(settings.abiword != null) exports.doImport = function(req, res, padId) { //pipe to a file - //convert file to text via abiword - //set text in the pad + //convert file to html via abiword + //set html in the pad - var srcFile, destFile; - var pad; - var text; + var srcFile, destFile + , pad; + , text; async.series([ //save the uploaded file to /tmp - function(callback) - { + function(callback) { var form = new formidable.IncomingForm(); form.keepExtensions = true; - //form.uploadDir = tempDirectory; - form.parse(req, function(err, fields, files) - { + form.parse(req, function(err, fields, files) { //the upload failed, stop at this point - if(err || files.file === undefined) - { + if(err || files.file === undefined) { console.warn("Uploading Error: " + err.stack); callback("uploadFailed"); } //everything ok, continue - else - { + else { //save the path of the uploaded file srcFile = files.file.path; callback(); @@ -85,48 +68,38 @@ exports.doImport = function(req, res, padId) //ensure this is a file ending we know, else we change the file ending to .txt //this allows us to accept source code files like .c or .java - function(callback) - { + function(callback) { var fileEnding = (srcFile.split(".")[1] || "").toLowerCase(); var knownFileEndings = ["txt", "doc", "docx", "pdf", "odt", "html", "htm"]; //find out if this is a known file ending var fileEndingKnown = false; - for(var i in knownFileEndings) - { - if(fileEnding == knownFileEndings[i]) - { + for(var i in knownFileEndings) { + if(fileEnding == knownFileEndings[i]){ fileEndingKnown = true; } } //if the file ending is known, continue as normal - if(fileEndingKnown) - { + if(fileEndingKnown) { callback(); } //we need to rename this file with a .txt ending - else - { + else { var oldSrcFile = srcFile; srcFile = srcFile.split(".")[0] + ".txt"; - //srcFile = srcFile.split(".")[0] + ".htm"; fs.rename(oldSrcFile, srcFile, callback); } }, //convert file to text - function(callback) - { + function(callback) { var randNum = Math.floor(Math.random()*0xFFFFFFFF); - //destFile = tempDirectory + "eplite_import_" + randNum + ".txt"; - //destFile = tempDirectory + "eplite_import_" + randNum + ".htm"; destFile = os.tmpDir() + "/eplite_import_" + randNum + ".htm"; - //abiword.convertFile(srcFile, destFile, "txt", function(err){ - abiword.convertFile(srcFile, destFile, "htm", function(err){ + abiword.convertFile(srcFile, destFile, "htm", function(err) { //catch convert errors - if(err){ + if(err) { console.warn("Converting Error:", err); return callback("convertFailed"); } else { @@ -136,10 +109,8 @@ exports.doImport = function(req, res, padId) }, //get the pad object - function(callback) - { - padManager.getPad(padId, function(err, _pad) - { + function(callback) { + padManager.getPad(padId, function(err, _pad){ if(ERR(err, callback)) return; pad = _pad; callback(); @@ -147,54 +118,40 @@ exports.doImport = function(req, res, padId) }, //read the text - function(callback) - { - fs.readFile(destFile, "utf8", function(err, _text) - { + function(callback) { + fs.readFile(destFile, "utf8", function(err, _text){ if(ERR(err, callback)) return; text = _text; //node on windows has a delay on releasing of the file lock. //We add a 100ms delay to work around this - if(os.type().indexOf("Windows") > -1) - { - setTimeout(function() - { - callback(); - }, 100); - } - else - { + if(os.type().indexOf("Windows") > -1){ + setTimeout(function(){callback();}, 100); + } else { callback(); } }); }, //change text of the pad and broadcast the changeset - function(callback) - { - //pad.setText(text); - //prueba + function(callback) { importHtml.setPadHTML(pad, text); padMessageHandler.updatePadClients(pad, callback); }, //clean up temporary files - function(callback) - { + function(callback) { async.parallel([ - function(callback) - { + function(callback){ fs.unlink(srcFile, callback); }, - function(callback) - { + function(callback){ fs.unlink(destFile, callback); } ], callback); } - ], function(err) - { + ], function(err) { + var status = "ok"; //check for known errors and replace the status From cc60b82a6ef3dda7a8c89dc8083bd5204bb99f48 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Fri, 23 Nov 2012 22:55:25 +0100 Subject: [PATCH 05/31] Import html by default and allow basic import/export features without abiword --- src/node/handler/ImportHandler.js | 70 ++++++++++++++------------ src/node/hooks/express/importexport.js | 6 --- src/static/js/pad_impexp.js | 4 +- 3 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index f6b381a7..93fd3db5 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -23,6 +23,7 @@ var ERR = require("async-stacktrace") , padMessageHandler = require("./PadMessageHandler") , async = require("async") , fs = require("fs") + , path = require("path") , settings = require('../utils/Settings') , formidable = require('formidable') , os = require("os") @@ -42,7 +43,7 @@ exports.doImport = function(req, res, padId) //set html in the pad var srcFile, destFile - , pad; + , pad , text; async.series([ @@ -69,16 +70,9 @@ exports.doImport = function(req, res, padId) //ensure this is a file ending we know, else we change the file ending to .txt //this allows us to accept source code files like .c or .java function(callback) { - var fileEnding = (srcFile.split(".")[1] || "").toLowerCase(); - var knownFileEndings = ["txt", "doc", "docx", "pdf", "odt", "html", "htm"]; - - //find out if this is a known file ending - var fileEndingKnown = false; - for(var i in knownFileEndings) { - if(fileEnding == knownFileEndings[i]){ - fileEndingKnown = true; - } - } + var fileEnding = path.extname(srcFile).toLowerCase() + , knownFileEndings = [".txt", ".doc", ".docx", ".pdf", ".odt", ".html", ".htm"] + , fileEndingKnown = (knownFileEndings.indexOf(fileEnding) > -1); //if the file ending is known, continue as normal if(fileEndingKnown) { @@ -87,25 +81,31 @@ exports.doImport = function(req, res, padId) //we need to rename this file with a .txt ending else { var oldSrcFile = srcFile; - srcFile = srcFile.split(".")[0] + ".txt"; + srcFile = path.join(path.dirname(srcFile),path.basename(srcFile, fileEnding)+".txt"); fs.rename(oldSrcFile, srcFile, callback); } }, - //convert file to text + //convert file to html function(callback) { var randNum = Math.floor(Math.random()*0xFFFFFFFF); - destFile = os.tmpDir() + "/eplite_import_" + randNum + ".htm"; - abiword.convertFile(srcFile, destFile, "htm", function(err) { - //catch convert errors - if(err) { - console.warn("Converting Error:", err); - return callback("convertFailed"); - } else { - callback(); - } - }); + destFile = path.join(os.tmpDir(), "eplite_import_" + randNum + ".htm"); + + if (abiword) { + abiword.convertFile(srcFile, destFile, "htm", function(err) { + //catch convert errors + if(err) { + console.warn("Converting Error:", err); + return callback("convertFailed"); + } else { + callback(); + } + }); + } else { + // if no abiword only rename + fs.rename(srcFile, destFile, callback); + } }, //get the pad object @@ -125,28 +125,35 @@ exports.doImport = function(req, res, padId) //node on windows has a delay on releasing of the file lock. //We add a 100ms delay to work around this - if(os.type().indexOf("Windows") > -1){ - setTimeout(function(){callback();}, 100); - } else { - callback(); - } + if(os.type().indexOf("Windows") > -1){ + setTimeout(function() {callback();}, 100); + } else { + callback(); + } }); }, //change text of the pad and broadcast the changeset function(callback) { - importHtml.setPadHTML(pad, text); + var fileEnding = path.extname(srcFile).toLowerCase(); + if (abiword || fileEnding == ".htm" || fileEnding == ".html") { + importHtml.setPadHTML(pad, text); + } else { + pad.setText(text); + } padMessageHandler.updatePadClients(pad, callback); }, //clean up temporary files function(callback) { + //for node < 0.7 compatible + var fileExists = fs.exists || path.exists; async.parallel([ function(callback){ - fs.unlink(srcFile, callback); + fileExists (srcFile, function(exist) { (exist)? fs.unlink(srcFile, callback): callback(); }); }, function(callback){ - fs.unlink(destFile, callback); + fileExists (destFile, function(exist) { (exist)? fs.unlink(destFile, callback): callback(); }); } ], callback); } @@ -164,7 +171,6 @@ exports.doImport = function(req, res, padId) ERR(err); //close the connection - res.send("", 200); }); } diff --git a/src/node/hooks/express/importexport.js b/src/node/hooks/express/importexport.js index 9e78f34d..9754ffa6 100644 --- a/src/node/hooks/express/importexport.js +++ b/src/node/hooks/express/importexport.js @@ -28,12 +28,6 @@ exports.expressCreateServer = function (hook_name, args, cb) { //handle import requests args.app.post('/p/:pad/import', function(req, res, next) { - //if abiword is disabled, skip handling this request - if(settings.abiword == null) { - next(); - return; - } - hasPadAccess(req, res, function() { importHandler.doImport(req, res, req.params.pad); }); diff --git a/src/static/js/pad_impexp.js b/src/static/js/pad_impexp.js index 08dd4293..70d27d40 100644 --- a/src/static/js/pad_impexp.js +++ b/src/static/js/pad_impexp.js @@ -225,8 +225,8 @@ var padimpexp = (function() $("#exportworda").remove(); $("#exportpdfa").remove(); $("#exportopena").remove(); - $(".importformdiv").remove(); - $("#import").html("Import is not available. To enable import please install abiword"); + + $("#importform").attr('action', pad_root_url + "/import"); } else if(clientVars.abiwordAvailable == "withoutPDF") { From d7cca602dfb2e87497e404d21083c2e8b2cf6689 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Mon, 26 Nov 2012 03:18:47 +0100 Subject: [PATCH 06/31] Added message translatable about features importing without abiword --- settings.json.template | 2 +- src/locales/en.ini | 3 ++- src/locales/es.ini | 1 + src/static/css/pad.css | 19 ++++++++++++------- src/static/js/pad_impexp.js | 9 ++++----- src/templates/pad.html | 3 ++- 6 files changed, 22 insertions(+), 15 deletions(-) diff --git a/settings.json.template b/settings.json.template index 4894f897..f6f3e5b8 100644 --- a/settings.json.template +++ b/settings.json.template @@ -65,7 +65,7 @@ "maxAge" : 21600, // 60 * 60 * 6 = 6 hours /* This is the path to the Abiword executable. Setting it to null, disables abiword. - Abiword is needed to enable the import/export of pads*/ + Abiword is needed to advanced import/export features of pads*/ "abiword" : null, /* This setting is used if you require authentication of all users. diff --git a/src/locales/en.ini b/src/locales/en.ini index a110583e..32980b51 100644 --- a/src/locales/en.ini +++ b/src/locales/en.ini @@ -41,6 +41,7 @@ pad.importExport.exportword = Microsoft Word pad.importExport.exportpdf = PDF pad.importExport.exportopen = ODF (Open Document Format) pad.importExport.exportdokuwiki = DokuWiki +pad.importExport.abiword.innerHTML = You only can import from plain text or html formats. For more advanced import features please install abiword. pad.modals.connected = Connected. pad.modals.reconnecting = Reconnecting to your pad.. pad.modals.forcereconnect = Force reconnect @@ -74,4 +75,4 @@ timeslider.pageTitle = {{appTitle}} Timeslider timeslider.toolbar.returnbutton = Return to pad timeslider.toolbar.authors = Authors: timeslider.toolbar.authorsList = No Authors -timeslider.exportCurrent = Export current version as: \ No newline at end of file +timeslider.exportCurrent = Export current version as: diff --git a/src/locales/es.ini b/src/locales/es.ini index dd2c0d14..538d9495 100644 --- a/src/locales/es.ini +++ b/src/locales/es.ini @@ -44,6 +44,7 @@ pad.importExport.exportword = Microsoft Word pad.importExport.exportpdf = PDF pad.importExport.exportopen = ODF (Open Document Format) pad.importExport.exportdokuwiki = DokuWiki +pad.importExport.abiword.innerHTML = Sólo puede importar formatos de texto plano o html. Para funciones más avanzadas instale abiword. pad.modals.connected = Conectado. pad.modals.reconnecting = Reconectando a tu pad.. pad.modals.forcereconnect = Reconexión forzosa diff --git a/src/static/css/pad.css b/src/static/css/pad.css index 64f9f0d4..c3deebc1 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -571,15 +571,20 @@ table#otheruserstable { #exportdokuwiki { background-position: 0px -459px } -#importstatusball { - display: none + +/* hidden element */ +#importstatusball, +#importarrow, +#importmessagesuccess, +#importmessageabiword { + display: none; } -#importarrow { - display: none -} -#importmessagesuccess { - display: none + +#importmessageabiword { + color: #900; + font-size: small; } + #importsubmitinput { height: 25px; width: 85px; diff --git a/src/static/js/pad_impexp.js b/src/static/js/pad_impexp.js index 70d27d40..4b4733a5 100644 --- a/src/static/js/pad_impexp.js +++ b/src/static/js/pad_impexp.js @@ -218,6 +218,9 @@ var padimpexp = (function() $("#exporthtmla").attr("href", pad_root_path + "/export/html"); $("#exportplaina").attr("href", pad_root_path + "/export/txt"); $("#exportdokuwikia").attr("href", pad_root_path + "/export/dokuwiki"); + + // activate action to import in the form + $("#importform").attr('action', pad_root_url + "/import"); //hide stuff thats not avaible if abiword is disabled if(clientVars.abiwordAvailable == "no") @@ -226,7 +229,7 @@ var padimpexp = (function() $("#exportpdfa").remove(); $("#exportopena").remove(); - $("#importform").attr('action', pad_root_url + "/import"); + $("#importmessageabiword").show(); } else if(clientVars.abiwordAvailable == "withoutPDF") { @@ -237,16 +240,12 @@ var padimpexp = (function() $("#importexport").css({"height":"142px"}); $("#importexportline").css({"height":"142px"}); - - $("#importform").attr('action', pad_root_url + "/import"); } else { $("#exportworda").attr("href", pad_root_path + "/export/doc"); $("#exportpdfa").attr("href", pad_root_path + "/export/pdf"); $("#exportopena").attr("href", pad_root_path + "/export/odt"); - - $("#importform").attr('action', pad_root_path + "/import"); } $("#impexp-close").click(function() diff --git a/src/templates/pad.html b/src/templates/pad.html index 3f3eee4f..a2b153d3 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -246,7 +246,8 @@

<% e.begin_block("importColumn"); %> -


+

+

From 6239c66e3639bfed8345dabf304c4f4578dd67ed Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 26 Nov 2012 20:19:27 +0000 Subject: [PATCH 07/31] remove alert on line wrap as it doesnt mean anything --- src/static/js/ace2_inner.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 661ea011..b3bc91a9 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -333,14 +333,6 @@ function Ace2Inner(){ return colorutils.triple2css(color); } - function doAlert(str) - { - scheduler.setTimeout(function() - { - alert(str); - }, 0); - } - editorInfo.ace_getRep = function() { return rep; @@ -1624,7 +1616,7 @@ function Ace2Inner(){ if (linesWrapped > 0) { - doAlert("Editor warning: " + linesWrapped + " long line" + (linesWrapped == 1 ? " was" : "s were") + " hard-wrapped into " + ccData.numLinesAfter + " lines."); + // console.log("Editor warning: " + linesWrapped + " long line" + (linesWrapped == 1 ? " was" : "s were") + " hard-wrapped into " + ccData.numLinesAfter + " lines."); } if (ss[0] >= 0) selStart = [ss[0] + a + netNumLinesChangeSoFar, ss[1]]; From fddca354b33eb2f855178657b775a4008e8da8d5 Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 26 Nov 2012 20:52:10 +0000 Subject: [PATCH 08/31] proper fix for focus and some styling of the form and allows for pressing enter on form so generally a better fix --- src/static/js/pad.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/static/js/pad.js b/src/static/js/pad.js index 34f2a287..936298ab 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -305,14 +305,22 @@ function handshake() else if(obj.accessStatus == "needPassword") { $("#editorloadingbox").html("You need a password to access this pad
" + - ""+ - ""); + ""+ + "
"); + $("#passwordinput").focus(); + $(".passForm").submit(function(){ + $('.passForm button').click(); + }); } else if(obj.accessStatus == "wrongPassword") { $("#editorloadingbox").html("Your password was wrong
" + - ""+ - ""); + ""+ + "
"); + $("#passwordinput").focus(); + $(".passForm").submit(function(){ + $('.passForm button').click(); + }); } } From f880473360e26f683df73700366f36b7dc757bdb Mon Sep 17 00:00:00 2001 From: John McLear Date: Mon, 26 Nov 2012 20:54:28 +0000 Subject: [PATCH 09/31] remember the styling for the pasword prompt --- src/static/css/pad.css | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/static/css/pad.css b/src/static/css/pad.css index 64f9f0d4..01a19514 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -190,6 +190,19 @@ a img { height: 30px; z-index: 100; } + +#editorloadingbox passForm{ + padding:10px; +} + +#editorloadingbox input{ + padding:10px; +} + +#editorloadingbox button{ + padding:10px; +} + #editorcontainerbox { position: absolute; bottom: 0; From 97d77ea089c75fc64fef94b9259674d738a930cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Eixarch?= Date: Tue, 27 Nov 2012 00:11:45 +0100 Subject: [PATCH 10/31] added my name in header --- src/node/handler/ImportHandler.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/node/handler/ImportHandler.js b/src/node/handler/ImportHandler.js index 93fd3db5..815e5357 100644 --- a/src/node/handler/ImportHandler.js +++ b/src/node/handler/ImportHandler.js @@ -4,6 +4,7 @@ /* * 2011 Peter 'Pita' Martischka (Primary Technology Ltd) + * 2012 Iván Eixarch * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. From bf26f60bac93b104cef2986a45ac51b000674b64 Mon Sep 17 00:00:00 2001 From: Manuel Knitza Date: Tue, 27 Nov 2012 09:59:47 +0100 Subject: [PATCH 11/31] Update doc/api/http_api.md As EPL moved from "Pita" to "ether" the edited link had to be changed. --- doc/api/http_api.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/http_api.md b/doc/api/http_api.md index 990d1b49..7ace1b0b 100644 --- a/doc/api/http_api.md +++ b/doc/api/http_api.md @@ -9,7 +9,7 @@ The API gives another web application control of the pads. The basic functions a The API is designed in a way, so you can reuse your existing user system with their permissions, and map it to etherpad lite. Means: Your web application still has to do authentication, but you can tell etherpad lite via the api, which visitors should get which permissions. This allows etherpad lite to fit into any web application and extend it with real-time functionality. You can embed the pads via an iframe into your website. -Take a look at [HTTP API client libraries](https://github.com/Pita/etherpad-lite/wiki/HTTP-API-client-libraries) to see if a library in your favorite language. +Take a look at [HTTP API client libraries](https://github.com/ether/etherpad-lite/wiki/HTTP-API-client-libraries) to see if a library in your favorite language. ## Examples From c445197e7fc03572aa31511e35f9193a47332c20 Mon Sep 17 00:00:00 2001 From: John McLear Date: Tue, 27 Nov 2012 15:10:36 +0000 Subject: [PATCH 12/31] Update src/static/css/pad.css --- src/static/css/pad.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/css/pad.css b/src/static/css/pad.css index 01a19514..a2540614 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -191,7 +191,7 @@ a img { z-index: 100; } -#editorloadingbox passForm{ +#editorloadingbox .passForm{ padding:10px; } From 8c7939ec9f18da05bb58da0b43d805948c9cc9b9 Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 28 Nov 2012 17:17:35 +0000 Subject: [PATCH 13/31] catch control S and send an event to save a revision --- src/static/js/ace2_inner.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index b3bc91a9..9290fd56 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3537,7 +3537,7 @@ function Ace2Inner(){ var keyCode = evt.keyCode; var which = evt.which; - // prevent ESC key + // prevent ESC key and Control S if (keyCode == 27) { evt.preventDefault(); @@ -3562,7 +3562,7 @@ function Ace2Inner(){ inCallStackIfNecessary("handleKeyEvent", function() { - if (type == "keypress" || (isTypeForSpecialKey && keyCode == 13 /*return*/ )) + if (type == "keypress" || (isTypeForSpecialKey && keyCode == 13 || keyCode == 83 /*return*/ )) { // in IE, special keys don't send keypress, the keydown does the action if (!outsideKeyPress(evt)) @@ -3575,7 +3575,6 @@ function Ace2Inner(){ { outsideKeyDown(evt); } - if (!stopped) { var specialHandledInHook = hooks.callAll('aceKeyEvent', { @@ -3614,6 +3613,12 @@ function Ace2Inner(){ }, 0); specialHandled = true; } + if ((!specialHandled) && isTypeForSpecialKey && keyCode == 83) + { + evt.preventDefault(); + parent.parent.pad.collabClient.sendMessage({"type":"SAVE_REVISION"}); /* The parent.parent part of this is BAD and I feel bad.. It may break something */ + specialHandled = true; + } if ((!specialHandled) && isTypeForSpecialKey && keyCode == 9 && !(evt.metaKey || evt.ctrlKey)) { // tab From 93e9d7c852be597b3793106069ef8adc5d80734c Mon Sep 17 00:00:00 2001 From: John McLear Date: Wed, 28 Nov 2012 17:20:58 +0000 Subject: [PATCH 14/31] remove control S comment --- src/static/js/ace2_inner.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/static/js/ace2_inner.js b/src/static/js/ace2_inner.js index 9290fd56..da646b7e 100644 --- a/src/static/js/ace2_inner.js +++ b/src/static/js/ace2_inner.js @@ -3537,7 +3537,7 @@ function Ace2Inner(){ var keyCode = evt.keyCode; var which = evt.which; - // prevent ESC key and Control S + // prevent ESC key if (keyCode == 27) { evt.preventDefault(); From 719fb7e04508f74b64bd0c4ed9bf8119f35686bf Mon Sep 17 00:00:00 2001 From: Marcel Klehr Date: Thu, 29 Nov 2012 13:42:37 +0100 Subject: [PATCH 15/31] Let socket.io decide which transport is best for the browser --- src/node/hooks/express/socketio.js | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/node/hooks/express/socketio.js b/src/node/hooks/express/socketio.js index 546ba2af..c2b9ff6c 100644 --- a/src/node/hooks/express/socketio.js +++ b/src/node/hooks/express/socketio.js @@ -36,13 +36,10 @@ exports.expressCreateServer = function (hook_name, args, cb) { }); }); - // the following has been successfully tested with the following browsers - // works also behind reverse proxy - // Firefox 14.0.1 - // IE8 with Native XMLHTTP support - // IE8 without Native XMLHTTP support - // Chrome 21.0.1180.79 - io.set('transports', ['jsonp-polling']); + // there shouldn#t be a browser that isn't compatible to all + // transports in this list at once + // e.g. XHR is disabled in IE by default, so in IE it should use jsonp-polling + io.set('transports', ['xhr-polling', 'jsonp-polling', 'htmlfile']); var socketIOLogger = log4js.getLogger("socket.io"); io.set('logger', { From d76100358840e24079a523b7b9c8d135370878ef Mon Sep 17 00:00:00 2001 From: John McLear Date: Fri, 30 Nov 2012 22:50:54 +0000 Subject: [PATCH 16/31] fix path to favicon resolves #1236 --- src/node/utils/Settings.js | 2 ++ src/templates/pad.html | 2 +- src/templates/timeslider.html | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index 9caa2b0b..fb2a592c 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -38,6 +38,8 @@ exports.title = "Etherpad Lite"; * The app favicon fully specified url, visible e.g. in the browser window */ exports.favicon = "favicon.ico"; +exports.faviconPad = "../" + exports.favicon; +exports.faviconTimeslider = "../../" + exports.favicon; /** * The IP ep-lite should listen to diff --git a/src/templates/pad.html b/src/templates/pad.html index 3f3eee4f..c1300d5e 100644 --- a/src/templates/pad.html +++ b/src/templates/pad.html @@ -32,7 +32,7 @@ - +