diff --git a/CHANGELOG.md b/CHANGELOG.md index 80a6148fb..7e471f004 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# 1.2.5 + * Create timeslider EEJS blocks for plugins + * Allow for "more messages" to be loaded in chat + * Introduce better logging + * API endpoint for "listAllPads" + * Fix: Stop highlight of timeslider when dragging mouse + * Fix: Time Delta on Timeslider make date update properly + * Fix: Prevent empty chat messages from being sent + * Fix: checkPad script + * Fix: IE onLoad listener for i18n + # 1.2.4 * Fix IE console issue created in 1.2.3 * Allow CI Tests to pass by ignoring timeslider test diff --git a/README.md b/README.md index 90831a0fa..e254b81d3 100644 --- a/README.md +++ b/README.md @@ -115,9 +115,9 @@ Join the [mailinglist](http://groups.google.com/group/etherpad-lite-dev) and mak # Modules created for this project -* [ueberDB](https://github.com/ether/ueberDB) "transforms every database into a object key value store" - manages all database access -* [channels](https://github.com/ether/channels) "Event channels in node.js" - ensures that ueberDB operations are atomic and in series for each key -* [async-stacktrace](https://github.com/ether/async-stacktrace) "Improves node.js stacktraces and makes it easier to handle errors" +* [ueberDB](https://github.com/Pita/ueberDB) "transforms every database into a object key value store" - manages all database access +* [channels](https://github.com/Pita/channels) "Event channels in node.js" - ensures that ueberDB operations are atomic and in series for each key +* [async-stacktrace](https://github.com/Pita/async-stacktrace) "Improves node.js stacktraces and makes it easier to handle errors" # Donate! * [Flattr] (http://flattr.com/thing/71378/Etherpad-Foundation) diff --git a/bin/checkPad.js b/bin/checkPad.js index a46c18140..a9b7e8bce 100644 --- a/bin/checkPad.js +++ b/bin/checkPad.js @@ -10,19 +10,26 @@ if(process.argv.length != 3) //get the padID var padId = process.argv[2]; -//initalize the database -var log4js = require("../src/node_modules/log4js"); -log4js.setGlobalLogLevel("INFO"); +//initalize the variables +var db, settings, padManager; +var npm = require("../src/node_modules/npm"); var async = require("../src/node_modules/async"); -var db = require('../src/node/db/DB'); var Changeset = require("ep_etherpad-lite/static/js/Changeset"); -var padManager; async.series([ - //intallize the database - function (callback) - { + //load npm + function(callback) { + npm.load({}, function(er) { + callback(er); + }) + }, + //load modules + function(callback) { + settings = require('../src/node/utils/Settings'); + db = require('../src/node/db/DB'); + + //intallize the database db.init(callback); }, //get the pad diff --git a/bin/extractPadData.js b/bin/extractPadData.js index f79b964af..ea00f953a 100644 --- a/bin/extractPadData.js +++ b/bin/extractPadData.js @@ -10,13 +10,11 @@ if(process.argv.length != 3) //get the padID var padId = process.argv[2]; -var db, dirty, padManager, pad; +var db, dirty, padManager, pad, settings; var neededDBValues = ["pad:"+padId]; var npm = require("../src/node_modules/npm"); var async = require("../src/node_modules/async"); -var log4js = require("../src/node_modules/log4js"); -log4js.setGlobalLogLevel("INFO"); async.series([ // load npm @@ -35,6 +33,7 @@ async.series([ }, // load modules function(callback) { + settings = require('../src/node/utils/Settings'); db = require('../src/node/db/DB'); dirty = require("../src/node_modules/ueberDB/node_modules/dirty")(padId + ".db"); }, diff --git a/bin/migrateDirtyDBtoMySQL.js b/bin/migrateDirtyDBtoMySQL.js index d0273de0d..b4913e762 100644 --- a/bin/migrateDirtyDBtoMySQL.js +++ b/bin/migrateDirtyDBtoMySQL.js @@ -2,6 +2,7 @@ require("ep_etherpad-lite/node_modules/npm").load({}, function(er,npm) { process.chdir(npm.root+'/..') + var settings = require("ep_etherpad-lite/node/utils/Settings"); var dirty = require("ep_etherpad-lite/node_modules/ueberDB/node_modules/dirty")('var/dirty.db'); var db = require("ep_etherpad-lite/node/db/DB"); diff --git a/bin/run.sh b/bin/run.sh index 82e89a946..41a8090d2 100755 --- a/bin/run.sh +++ b/bin/run.sh @@ -8,10 +8,18 @@ if [ -d "../bin" ]; then cd "../" fi +ignoreRoot=0 +for ARG in $* +do + if [ $ARG == '--root' ]; then + ignoreRoot=1 + fi +done + #Stop the script if its started as root -if [ "$(id -u)" -eq 0 ]; then +if [ "$(id -u)" -eq 0 ] && [ $ignoreRoot -eq 0 ]; then echo "You shouldn't start Etherpad-Lite as root!" - echo "Please type 'Etherpad Lite rocks my socks' if you still want to start it as root" + echo "Please type 'Etherpad Lite rocks my socks' or supply the '--root' argument if you still want to start it as root" read rocks if [ ! $rocks = "Etherpad Lite rocks my socks" ] then diff --git a/doc/api/hooks_server-side.md b/doc/api/hooks_server-side.md index c60d810e8..0486f7d3c 100644 --- a/doc/api/hooks_server-side.md +++ b/doc/api/hooks_server-side.md @@ -175,6 +175,27 @@ function handleMessage ( hook, context, callback ) { }; ``` +## clientVars +Called from: src/node/handler/PadMessageHandler.js + +Things in context: + +1. clientVars - the basic `clientVars` built by the core +2. pad - the pad this session is about + +This hook will be called once a client connects and the `clientVars` are being sent. Plugins can use this hook to give the client a initial configuriation, like the tracking-id of an external analytics-tool that is used on the client-side. You can also overwrite values from the original `clientVars`. + +Example: + +``` +exports.clientVars = function(hook, context, callback) +{ + // tell the client which year we are in + return callback({ "currentYear": new Date().getFullYear() }); +}; +``` + +This can be accessed on the client-side using `clientVars.currentYear`. ## getLineHTMLForExport Called from: src/node/utils/ExportHtml.js diff --git a/doc/api/http_api.md b/doc/api/http_api.md index b9b5fedbb..0d2cc3756 100644 --- a/doc/api/http_api.md +++ b/doc/api/http_api.md @@ -419,3 +419,13 @@ returns ok when the current api token is valid *Example returns:* * `{"code":0,"message":"ok","data":null}` * `{"code":4,"message":"no or wrong API Key","data":null}` + +### Pads + +#### listAllPads() + * API >= 1.2.1 + +lists all pads on this epl instance + +*Example returns:* + * `{code: 0, message:"ok", data: ["testPad", "thePadsOfTheOthers"]}` diff --git a/settings.json.template b/settings.json.template index e37bc4509..04c097517 100644 --- a/settings.json.template +++ b/settings.json.template @@ -47,6 +47,13 @@ }, */ + //Logging configuration. See log4js documentation for further information + // https://github.com/nomiddlename/log4js-node + "logconfig" : + { "appenders": [ + { "type": "console" } + ] }, + //the default text of a pad "defaultPadText" : "Welcome to Etherpad Lite!\n\nThis pad text is synchronized as you type, so that everyone viewing this page sees the same text. This allows you to collaborate seamlessly on documents!\n\nGet involved with Etherpad at http:\/\/etherpad.org\n", diff --git a/src/locales/ast.json b/src/locales/ast.json index 5d2882475..1437d8698 100644 --- a/src/locales/ast.json +++ b/src/locales/ast.json @@ -53,6 +53,7 @@ "pad.modals.connected": "Coneut\u00e1u.", "pad.modals.reconnecting": "Reconeutando col to bloc...", "pad.modals.forcereconnect": "Forzar la reconex\u00f3n", + "pad.modals.userdup": "Abiertu n'otra ventana", "pad.modals.userdup.explanation": "Esti bloc paez que ta abiertu en m\u00e1s d'una ventana del navegador d'esti ordenador.", "pad.modals.userdup.advice": "Reconeutar pa usar esta ventana.", "pad.modals.unauth": "Non autoriz\u00e1u.", @@ -81,6 +82,7 @@ "timeslider.toolbar.returnbutton": "Tornar al bloc", "timeslider.toolbar.authors": "Autores:", "timeslider.toolbar.authorsList": "Nun hai autores", + "timeslider.toolbar.exportlink.title": "Esportar", "timeslider.exportCurrent": "Esportar la versi\u00f3n actual como:", "timeslider.version": "Versi\u00f3n {{version}}", "timeslider.saved": "Guard\u00e1u el {{day}} de {{month}} de {{year}}", diff --git a/src/locales/az.json b/src/locales/az.json index dd95f733a..1e6439fdc 100644 --- a/src/locales/az.json +++ b/src/locales/az.json @@ -1,6 +1,7 @@ { "@metadata": { "authors": [ + "AZISS", "Khan27" ] }, @@ -36,6 +37,7 @@ "pad.settings.linenocheck": "S\u0259tir n\u00f6mr\u0259l\u0259ri", "pad.settings.fontType": "\u015eriftin tipi:", "pad.settings.fontType.normal": "Normal", + "pad.settings.fontType.monospaced": "Monobo\u015fluq", "pad.settings.globalView": "\u00dcmumi g\u00f6r\u00fcn\u00fc\u015f", "pad.settings.language": "Dil:", "pad.importExport.import_export": "\u0130dxal\/\u0130xrac", @@ -51,9 +53,12 @@ "pad.modals.connected": "Ba\u011fland\u0131.", "pad.modals.reconnecting": "Sizin pad yenid\u0259n qo\u015fulur..", "pad.modals.forcereconnect": "M\u0259cbur t\u0259krar\u0259n ba\u011flan", + "pad.modals.userdup": "Ba\u015fqa p\u0259nc\u0259r\u0259d\u0259 art\u0131q a\u00e7\u0131qd\u0131r", "pad.modals.userdup.advice": "Bu p\u0259nc\u0259r\u0259d\u0259n istifad\u0259yl\u0259 yenid\u0259n qo\u015fulun.", "pad.modals.unauth": "\u0130caz\u0259li deyil", + "pad.modals.unauth.explanation": "Bu s\u0259hif\u0259y\u0259 baxd\u0131\u011f\u0131n\u0131z vaxt sizin icaz\u0259niz d\u0259yi\u015filib. B\u0259rpa etm\u0259k \u00fc\u015f\u00fcn yenid\u0259n c\u0259hd edin.", "pad.modals.looping": "\u018flaq\u0259 k\u0259sildi.", + "pad.modals.looping.explanation": "Sinxronla\u015fd\u0131rma serveri il\u0259 kommunikasiya x\u0259tas\u0131 var.", "pad.modals.initsocketfail": "Server \u0259l\u00e7atmazd\u0131r.", "pad.modals.initsocketfail.explanation": "Sinxronla\u015fd\u0131rma serverin\u0259 qo\u015fulma m\u00fcmk\u00fcns\u00fczd\u00fcr.", "pad.modals.slowcommit": "\u018flaq\u0259 k\u0259sildi.", @@ -74,6 +79,7 @@ "timeslider.toolbar.returnbutton": "Pad-a qay\u0131t", "timeslider.toolbar.authors": "M\u00fc\u0259llifl\u0259r:", "timeslider.toolbar.authorsList": "M\u00fc\u0259llif yoxdur", + "timeslider.toolbar.exportlink.title": "\u0130xrac", "timeslider.exportCurrent": "Cari versiyan\u0131 ixrac etm\u0259k kimi:", "timeslider.version": "Versiya {{version}}", "timeslider.saved": "Saxlan\u0131ld\u0131 {{day}} {{month}}, {{year}}", diff --git a/src/locales/ca.json b/src/locales/ca.json index b809d8695..3eb840207 100644 --- a/src/locales/ca.json +++ b/src/locales/ca.json @@ -16,6 +16,7 @@ "pad.colorpicker.save": "Desa", "pad.colorpicker.cancel": "Cancel\u00b7la", "pad.loading": "S'est\u00e0 carregant...", + "pad.settings.linenocheck": "N\u00fameros de l\u00ednia", "pad.settings.fontType": "Tipus de lletra:", "pad.settings.fontType.normal": "Normal", "pad.settings.language": "Llengua:", diff --git a/src/locales/de.json b/src/locales/de.json index 5ede40f08..1bdbdaf3d 100644 --- a/src/locales/de.json +++ b/src/locales/de.json @@ -81,6 +81,7 @@ "pad.share.emebdcode": "In Webseite einbetten", "pad.chat": "Chat", "pad.chat.title": "Den Chat dieses Pads \u00f6ffnen", + "pad.chat.loadmessages": "Weitere Nachrichten laden", "timeslider.pageTitle": "{{appTitle}} Pad-Versionsgeschichte", "timeslider.toolbar.returnbutton": "Zur\u00fcck zum Pad", "timeslider.toolbar.authors": "Autoren:", diff --git a/src/locales/en.json b/src/locales/en.json index c3ab8c583..37e07a154 100644 --- a/src/locales/en.json +++ b/src/locales/en.json @@ -1 +1 @@ -{"index.newPad":"New Pad","index.createOpenPad":"or create/open a Pad with the name:","pad.toolbar.bold.title":"Bold (Ctrl-B)","pad.toolbar.italic.title":"Italic (Ctrl-I)","pad.toolbar.underline.title":"Underline (Ctrl-U)","pad.toolbar.strikethrough.title":"Strikethrough","pad.toolbar.ol.title":"Ordered list","pad.toolbar.ul.title":"Unordered List","pad.toolbar.indent.title":"Indent","pad.toolbar.unindent.title":"Outdent","pad.toolbar.undo.title":"Undo (Ctrl-Z)","pad.toolbar.redo.title":"Redo (Ctrl-Y)","pad.toolbar.clearAuthorship.title":"Clear Authorship Colors","pad.toolbar.import_export.title":"Import/Export from/to different file formats","pad.toolbar.timeslider.title":"Timeslider","pad.toolbar.savedRevision.title":"Saved Revisions","pad.toolbar.settings.title":"Settings","pad.toolbar.embed.title":"Embed this pad","pad.toolbar.showusers.title":"Show the users on this pad","pad.colorpicker.save":"Save","pad.colorpicker.cancel":"Cancel","pad.loading":"Loading...","pad.passwordRequired":"You need a password to access this pad","pad.permissionDenied":"You do not have permission to access this pad","pad.wrongPassword":"Your password was wrong","pad.settings.padSettings":"Pad Settings","pad.settings.myView":"My View","pad.settings.stickychat":"Chat always on screen","pad.settings.colorcheck":"Authorship colors","pad.settings.linenocheck":"Line numbers","pad.settings.fontType":"Font type:","pad.settings.fontType.normal":"Normal","pad.settings.fontType.monospaced":"Monospace","pad.settings.globalView":"Global View","pad.settings.language":"Language:","pad.importExport.import_export":"Import/Export","pad.importExport.import":"Upload any text file or document","pad.importExport.importSuccessful":"Successful!","pad.importExport.export":"Export current pad as:","pad.importExport.exporthtml":"HTML","pad.importExport.exportplain":"Plain text","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","pad.modals.userdup":"Opened in another window","pad.modals.userdup.explanation":"This pad seems to be opened in more than one browser window on this computer.","pad.modals.userdup.advice":"Reconnect to use this window instead.","pad.modals.unauth":"Not authorized","pad.modals.unauth.explanation":"Your permissions have changed while viewing this page. Try to reconnect.","pad.modals.looping":"Disconnected.","pad.modals.looping.explanation":"There are communication problems with the synchronization server.","pad.modals.looping.cause":"Perhaps you connected through an incompatible firewall or proxy.","pad.modals.initsocketfail":"Server is unreachable.","pad.modals.initsocketfail.explanation":"Couldn't connect to the synchronization server.","pad.modals.initsocketfail.cause":"This is probably due to a problem with your browser or your internet connection.","pad.modals.slowcommit":"Disconnected.","pad.modals.slowcommit.explanation":"The server is not responding.","pad.modals.slowcommit.cause":"This could be due to problems with network connectivity.","pad.modals.deleted":"Deleted.","pad.modals.deleted.explanation":"This pad has been removed.","pad.modals.disconnected":"You have been disconnected.","pad.modals.disconnected.explanation":"The connection to the server was lost","pad.modals.disconnected.cause":"The server may be unavailable. Please notify us if this continues to happen.","pad.share":"Share this pad","pad.share.readonly":"Read only","pad.share.link":"Link","pad.share.emebdcode":"Embed URL","pad.chat":"Chat","pad.chat.title":"Open the chat for this pad.","timeslider.pageTitle":"{{appTitle}} Timeslider","timeslider.toolbar.returnbutton":"Return to pad","timeslider.toolbar.authors":"Authors:","timeslider.toolbar.authorsList":"No Authors","timeslider.toolbar.exportlink.title":"Export","timeslider.exportCurrent":"Export current version as:","timeslider.version":"Version {{version}}","timeslider.saved":"Saved {{month}} {{day}}, {{year}}","timeslider.dateformat":"{{month}}/{{day}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}","timeslider.month.january":"January","timeslider.month.february":"February","timeslider.month.march":"March","timeslider.month.april":"April","timeslider.month.may":"May","timeslider.month.june":"June","timeslider.month.july":"July","timeslider.month.august":"August","timeslider.month.september":"September","timeslider.month.october":"October","timeslider.month.november":"November","timeslider.month.december":"December","pad.savedrevs.marked":"This revision is now marked as a saved revision","pad.userlist.entername":"Enter your name","pad.userlist.unnamed":"unnamed","pad.userlist.guest":"Guest","pad.userlist.deny":"Deny","pad.userlist.approve":"Approve","pad.editbar.clearcolors":"Clear authorship colors on entire document?","pad.impexp.importbutton":"Import Now","pad.impexp.importing":"Importing...","pad.impexp.confirmimport":"Importing a file will overwrite the current text of the pad. Are you sure you want to proceed?","pad.impexp.convertFailed":"We were not able to import this file. Please use a different document format or copy paste manually","pad.impexp.uploadFailed":"The upload failed, please try again","pad.impexp.importfailed":"Import failed","pad.impexp.copypaste":"Please copy paste","pad.impexp.exportdisabled":"Exporting as {{type}} format is disabled. Please contact your system administrator for details."} \ No newline at end of file +{"index.newPad":"New Pad","index.createOpenPad":"or create/open a Pad with the name:","pad.toolbar.bold.title":"Bold (Ctrl-B)","pad.toolbar.italic.title":"Italic (Ctrl-I)","pad.toolbar.underline.title":"Underline (Ctrl-U)","pad.toolbar.strikethrough.title":"Strikethrough","pad.toolbar.ol.title":"Ordered list","pad.toolbar.ul.title":"Unordered List","pad.toolbar.indent.title":"Indent","pad.toolbar.unindent.title":"Outdent","pad.toolbar.undo.title":"Undo (Ctrl-Z)","pad.toolbar.redo.title":"Redo (Ctrl-Y)","pad.toolbar.clearAuthorship.title":"Clear Authorship Colors","pad.toolbar.import_export.title":"Import/Export from/to different file formats","pad.toolbar.timeslider.title":"Timeslider","pad.toolbar.savedRevision.title":"Saved Revisions","pad.toolbar.settings.title":"Settings","pad.toolbar.embed.title":"Embed this pad","pad.toolbar.showusers.title":"Show the users on this pad","pad.colorpicker.save":"Save","pad.colorpicker.cancel":"Cancel","pad.loading":"Loading...","pad.passwordRequired":"You need a password to access this pad","pad.permissionDenied":"You do not have permission to access this pad","pad.wrongPassword":"Your password was wrong","pad.settings.padSettings":"Pad Settings","pad.settings.myView":"My View","pad.settings.stickychat":"Chat always on screen","pad.settings.colorcheck":"Authorship colors","pad.settings.linenocheck":"Line numbers","pad.settings.fontType":"Font type:","pad.settings.fontType.normal":"Normal","pad.settings.fontType.monospaced":"Monospace","pad.settings.globalView":"Global View","pad.settings.language":"Language:","pad.importExport.import_export":"Import/Export","pad.importExport.import":"Upload any text file or document","pad.importExport.importSuccessful":"Successful!","pad.importExport.export":"Export current pad as:","pad.importExport.exporthtml":"HTML","pad.importExport.exportplain":"Plain text","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","pad.modals.userdup":"Opened in another window","pad.modals.userdup.explanation":"This pad seems to be opened in more than one browser window on this computer.","pad.modals.userdup.advice":"Reconnect to use this window instead.","pad.modals.unauth":"Not authorized","pad.modals.unauth.explanation":"Your permissions have changed while viewing this page. Try to reconnect.","pad.modals.looping":"Disconnected.","pad.modals.looping.explanation":"There are communication problems with the synchronization server.","pad.modals.looping.cause":"Perhaps you connected through an incompatible firewall or proxy.","pad.modals.initsocketfail":"Server is unreachable.","pad.modals.initsocketfail.explanation":"Couldn't connect to the synchronization server.","pad.modals.initsocketfail.cause":"This is probably due to a problem with your browser or your internet connection.","pad.modals.slowcommit":"Disconnected.","pad.modals.slowcommit.explanation":"The server is not responding.","pad.modals.slowcommit.cause":"This could be due to problems with network connectivity.","pad.modals.deleted":"Deleted.","pad.modals.deleted.explanation":"This pad has been removed.","pad.modals.disconnected":"You have been disconnected.","pad.modals.disconnected.explanation":"The connection to the server was lost","pad.modals.disconnected.cause":"The server may be unavailable. Please notify us if this continues to happen.","pad.share":"Share this pad","pad.share.readonly":"Read only","pad.share.link":"Link","pad.share.emebdcode":"Embed URL","pad.chat":"Chat","pad.chat.title":"Open the chat for this pad.","pad.chat.loadmessages": "Load more messages","timeslider.pageTitle":"{{appTitle}} Timeslider","timeslider.toolbar.returnbutton":"Return to pad","timeslider.toolbar.authors":"Authors:","timeslider.toolbar.authorsList":"No Authors","timeslider.toolbar.exportlink.title":"Export","timeslider.exportCurrent":"Export current version as:","timeslider.version":"Version {{version}}","timeslider.saved":"Saved {{month}} {{day}}, {{year}}","timeslider.dateformat":"{{month}}/{{day}}/{{year}} {{hours}}:{{minutes}}:{{seconds}}","timeslider.month.january":"January","timeslider.month.february":"February","timeslider.month.march":"March","timeslider.month.april":"April","timeslider.month.may":"May","timeslider.month.june":"June","timeslider.month.july":"July","timeslider.month.august":"August","timeslider.month.september":"September","timeslider.month.october":"October","timeslider.month.november":"November","timeslider.month.december":"December","pad.savedrevs.marked":"This revision is now marked as a saved revision","pad.userlist.entername":"Enter your name","pad.userlist.unnamed":"unnamed","pad.userlist.guest":"Guest","pad.userlist.deny":"Deny","pad.userlist.approve":"Approve","pad.editbar.clearcolors":"Clear authorship colors on entire document?","pad.impexp.importbutton":"Import Now","pad.impexp.importing":"Importing...","pad.impexp.confirmimport":"Importing a file will overwrite the current text of the pad. Are you sure you want to proceed?","pad.impexp.convertFailed":"We were not able to import this file. Please use a different document format or copy paste manually","pad.impexp.uploadFailed":"The upload failed, please try again","pad.impexp.importfailed":"Import failed","pad.impexp.copypaste":"Please copy paste","pad.impexp.exportdisabled":"Exporting as {{type}} format is disabled. Please contact your system administrator for details."} \ No newline at end of file diff --git a/src/locales/he.json b/src/locales/he.json index fb3e590a5..2a265791b 100644 --- a/src/locales/he.json +++ b/src/locales/he.json @@ -1,7 +1,8 @@ { "@metadata": { "authors": [ - "Amire80" + "Amire80", + "Ofrahod" ] }, "index.newPad": "\u05e4\u05e0\u05e7\u05e1 \u05d7\u05d3\u05e9", @@ -80,6 +81,7 @@ "timeslider.toolbar.returnbutton": "\u05d7\u05d6\u05e8\u05d4 \u05d0\u05dc \u05d4\u05e4\u05e0\u05e7\u05e1", "timeslider.toolbar.authors": "\u05db\u05d5\u05ea\u05d1\u05d9\u05dd:", "timeslider.toolbar.authorsList": "\u05d0\u05d9\u05df \u05db\u05d5\u05ea\u05d1\u05d9\u05dd", + "timeslider.toolbar.exportlink.title": "\u05d9\u05e6\u05d5\u05d0", "timeslider.exportCurrent": "\u05d9\u05d9\u05e6\u05d5\u05d0 \u05d4\u05db\u05e8\u05e1\u05d4 \u05d4\u05e0\u05d5\u05db\u05d7\u05d9\u05ea \u05d1\u05ea\u05d5\u05e8:", "timeslider.version": "\u05d2\u05e8\u05e1\u05d4 {{version}}", "timeslider.saved": "\u05e0\u05e9\u05de\u05e8\u05d4 \u05d1\u05be{{day}} \u05d1{{month}} {{year}}", @@ -95,5 +97,10 @@ "timeslider.month.september": "\u05e1\u05e4\u05d8\u05de\u05d1\u05e8", "timeslider.month.october": "\u05d0\u05d5\u05e7\u05d8\u05d5\u05d1\u05e8", "timeslider.month.november": "\u05e0\u05d5\u05d1\u05de\u05d1\u05e8", - "timeslider.month.december": "\u05d3\u05e6\u05de\u05d1\u05e8" + "timeslider.month.december": "\u05d3\u05e6\u05de\u05d1\u05e8", + "pad.savedrevs.marked": "\u05d2\u05e8\u05e1\u05d4 \u05d6\u05d5 \u05de\u05e1\u05d5\u05de\u05e0\u05ea \u05db\u05d2\u05e8\u05e1\u05d4 \u05e9\u05de\u05d5\u05e8\u05d4", + "pad.userlist.unnamed": "\u05dc\u05dc\u05d0 \u05e9\u05dd", + "pad.userlist.guest": "\u05d0\u05d5\u05e8\u05d7", + "pad.impexp.importbutton": "\u05dc\u05d9\u05d9\u05d1\u05d0 \u05db\u05e2\u05ea", + "pad.impexp.confirmimport": "\u05d9\u05d1\u05d5\u05d0 \u05e9\u05dc \u05e7\u05d5\u05d1\u05e5 \u05d9\u05d1\u05d8\u05dc \u05d0\u05ea \u05d4\u05d8\u05e7\u05e1\u05d8 \u05d4\u05e0\u05d5\u05db\u05d7\u05d9 \u05d1\u05e4\u05e0\u05e7\u05e1. \u05d4\u05d0\u05dd \u05d0\u05ea\u05dd \u05d1\u05d8\u05d5\u05d7\u05d9\u05dd \u05e9\u05d1\u05e8\u05e6\u05d5\u05e0\u05db\u05dd \u05dc\u05d4\u05de\u05e9\u05d9\u05da?" } \ No newline at end of file diff --git a/src/locales/ko.json b/src/locales/ko.json index 3a54e927c..f9e696955 100644 --- a/src/locales/ko.json +++ b/src/locales/ko.json @@ -21,7 +21,7 @@ "pad.toolbar.timeslider.title": "\uc2dc\uac04\uc2ac\ub77c\uc774\ub354", "pad.toolbar.savedRevision.title": "\uc800\uc7a5\ud55c \ud310", "pad.toolbar.settings.title": "\uc124\uc815", - "pad.toolbar.embed.title": "\uc774 \ud328\ub4dc \ud3ec\ud568", + "pad.toolbar.embed.title": "\uc774 \ud328\ub4dc \ud3ec\ud568\ud558\uae30", "pad.toolbar.showusers.title": "\uc774 \ud328\ub4dc\uc5d0 \uc0ac\uc6a9\uc790 \ubcf4\uae30", "pad.colorpicker.save": "\uc800\uc7a5", "pad.colorpicker.cancel": "\ucde8\uc18c", diff --git a/src/locales/os.json b/src/locales/os.json new file mode 100644 index 000000000..c2a289bd4 --- /dev/null +++ b/src/locales/os.json @@ -0,0 +1,95 @@ +{ + "index.newPad": "\u041d\u043e\u0433", + "index.createOpenPad": "\u043a\u04d5\u043d\u04d5 \u0441\u0430\u0440\u0430\u0437\/\u0431\u0430\u043a\u04d5\u043d \u043d\u043e\u0433 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0430\u0445\u04d5\u043c \u043d\u043e\u043c\u0438\u043c\u04d5:", + "pad.toolbar.bold.title": "\u0411\u04d5\u0437\u0434\u0436\u044b\u043d (Ctrl-B)", + "pad.toolbar.italic.title": "\u041a\u044a\u04d5\u0434\u0437 (Ctrl-I)", + "pad.toolbar.underline.title": "\u0411\u044b\u043d\u044b\u043b\u0445\u0430\u0445\u0445 (Ctrl-U)", + "pad.toolbar.strikethrough.title": "\u0425\u0430\u0445\u0445", + "pad.toolbar.ol.title": "\u041d\u044b\u043c\u0430\u0434 \u043d\u043e\u043c\u0445\u044b\u0433\u044a\u0434", + "pad.toolbar.ul.title": "\u04d4\u043d\u04d5\u043d\u044b\u043c\u0430\u0434 \u043d\u043e\u043c\u0445\u044b\u0433\u044a\u0434", + "pad.toolbar.indent.title": "\u0425\u0430\u0441\u0442", + "pad.toolbar.unindent.title": "\u04d4\u0442\u0442\u04d5\u043c\u04d5\u0445\u0430\u0441\u0442", + "pad.toolbar.undo.title": "\u0420\u0430\u0437\u0434\u04d5\u0445\u044b\u043d (Ctrl-Z)", + "pad.toolbar.redo.title": "\u0420\u0430\u0446\u0430\u0440\u0430\u0437\u044b\u043d (Ctrl-Y)", + "pad.toolbar.clearAuthorship.title": "\u0424\u044b\u0441\u0441\u04d5\u0434\u0436\u044b \u043d\u044b\u0441\u04d5\u043d\u0442\u0442\u04d5 \u0430\u0439\u0441\u044b\u043d\u04d5\u043d", + "pad.toolbar.import_export.title": "\u0418\u043c\u043f\u043e\u0440\u0442\/\u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u04d5\u043d\u0434\u04d5\u0440 \u0444\u0430\u0439\u043b\u044b \u0444\u043e\u0440\u043c\u0430\u0442\u0442\u04d5\u0439\/\u0444\u043e\u0440\u043c\u0430\u0442\u0442\u04d5\u043c", + "pad.toolbar.timeslider.title": "\u0420\u04d5\u0441\u0442\u04d5\u0434\u0436\u044b \u0445\u0430\u0445\u0445", + "pad.toolbar.savedRevision.title": "\u04d4\u0432\u04d5\u0440\u0434 \u0444\u04d5\u043b\u0442\u04d5\u0440\u0442\u04d5", + "pad.toolbar.settings.title": "\u0423\u0430\u0433\u04d5\u0432\u04d5\u0440\u0434\u0442\u04d5", + "pad.toolbar.embed.title": "\u0410\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0431\u0430\u0444\u0442\u0430\u0443\u044b\u043d", + "pad.toolbar.showusers.title": "\u0410\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0430\u0440\u0445\u0430\u0439\u0434\u0436\u044b\u0442\u044b \u0440\u0430\u0432\u0434\u0438\u0441\u044b\u043d", + "pad.colorpicker.save": "\u041d\u044b\u0432\u00e6\u0440\u044b\u043d", + "pad.colorpicker.cancel": "\u041d\u044b\u0443\u0443\u0430\u0434\u0437\u044b\u043d", + "pad.loading": "\u00c6\u0432\u0433\u00e6\u0434 \u0446\u00e6\u0443\u044b...", + "pad.passwordRequired": "\u0410\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043c\u04d5 \u0440\u044b\u0432\u043d\u0430\u043b\u044b\u043d\u04d5\u043d \u0434\u04d5 \u0445\u044a\u04d5\u0443\u044b \u043f\u0430\u0440\u043e\u043b\u044c", + "pad.permissionDenied": "\u0414\u04d5\u0443\u04d5\u043d \u043d\u04d5\u0439 \u0431\u0430\u0440 \u0430\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043c\u04d5 \u0440\u044b\u0432\u043d\u0430\u043b\u044b\u043d", + "pad.wrongPassword": "\u0414\u04d5 \u043f\u0430\u0440\u043e\u043b\u044c \u0440\u0430\u0441\u0442 \u043d\u04d5\u0443", + "pad.settings.padSettings": "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u044b \u0443\u0430\u0433\u04d5\u0432\u04d5\u0440\u0434\u0442\u044b\u0442\u04d5", + "pad.settings.myView": "\u041c\u04d5 \u0443\u044b\u043d\u0434", + "pad.settings.stickychat": "\u041d\u044b\u0445\u0430\u0441 \u0430\u043b\u043a\u0443\u044b\u0434\u04d5\u0440 \u04d5\u0432\u0434\u0438\u0441\u044b\u043d", + "pad.settings.colorcheck": "\u0424\u044b\u0441\u0441\u04d5\u0434\u0436\u044b \u0445\u0443\u044b\u0437\u0442\u04d5", + "pad.settings.linenocheck": "\u0420\u04d5\u043d\u0445\u044a\u044b\u0442\u044b \u043d\u043e\u043c\u044b\u0440\u0442\u04d5", + "pad.settings.fontType": "\u0428\u0440\u0438\u0444\u0442\u044b \u0445\u0443\u044b\u0437:", + "pad.settings.fontType.normal": "\u0425\u0443\u044b\u043c\u04d5\u0442\u04d5\u0433", + "pad.settings.fontType.monospaced": "\u04d4\u043c\u0443\u04d5\u0440\u04d5\u0445", + "pad.settings.globalView": "\u0418\u0443\u0443\u044b\u043b\u044b \u0443\u044b\u043d\u0434", + "pad.settings.language": "\u00c6\u0432\u0437\u0430\u0433:", + "pad.importExport.import_export": "\u0418\u043c\u043f\u043e\u0440\u0442\/\u044d\u043a\u0441\u043f\u043e\u0440\u0442", + "pad.importExport.import": "\u0418\u0441\u0442\u044b \u0442\u0435\u043a\u0441\u0442 \u0444\u0430\u0439\u043b \u043a\u04d5\u043d\u04d5 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0431\u0430\u0432\u0433\u04d5\u043d\u044b\u043d", + "pad.importExport.importSuccessful": "\u04d4\u043d\u0442\u044b\u0441\u0442!", + "pad.importExport.export": "\u041d\u044b\u0440\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441\u044d\u043a\u043f\u043e\u0440\u0442 \u043a\u04d5\u043d\u044b\u043d \u043a\u0443\u044b\u0434:", + "pad.importExport.exporthtml": "HTML", + "pad.importExport.exportplain": "\u0425\u0443\u044b\u043c\u00e6\u0442\u00e6\u0433 \u0442\u0435\u043a\u0441\u0442", + "pad.importExport.exportword": "Microsoft Word", + "pad.importExport.exportpdf": "PDF", + "pad.importExport.exportopen": "ODF (Open Document Format)", + "pad.importExport.exportdokuwiki": "DokuWiki", + "pad.modals.connected": "\u0418\u0443\u0433\u043e\u043d\u0434.", + "pad.modals.reconnecting": "\u0414\u04d5 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043c\u04d5 \u043d\u043e\u0433\u04d5\u0439 \u0438\u0443\u0433\u043e\u043d\u0434 \u0446\u04d5\u0443\u044b..", + "pad.modals.forcereconnect": "\u0422\u044b\u0445\u0445\u04d5\u0439 \u0431\u0430\u0438\u0443 \u043a\u04d5\u043d\u044b\u043d", + "pad.modals.userdup": "\u041d\u043e\u0433 \u0440\u0443\u0434\u0437\u044b\u043d\u0434\u0436\u044b \u0431\u0430\u043a\u04d5\u043d\u044b\u043d", + "pad.modals.userdup.explanation": "\u0410\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u04d5\u0432\u04d5\u0446\u0446\u04d5\u0433\u04d5\u043d \u0430\u0446\u044b \u043a\u043e\u043c\u043f\u044c\u044e\u0442\u0435\u0440\u044b \u0438\u0443\u04d5\u0439 \u0444\u044b\u043b\u0434\u04d5\u0440 \u0440\u0443\u0434\u0437\u044b\u043d\u0434\u0436\u044b \u0443 \u0433\u043e\u043c.", + "pad.modals.userdup.advice": "\u041d\u043e\u0433\u04d5\u0439 \u0431\u0430\u0438\u0443 \u0443\u044b\u043d, \u0430\u0446\u044b \u0440\u0443\u0434\u0437\u044b\u043d\u0433\u04d5\u0439 \u0430\u0440\u0445\u0430\u0439\u044b\u043d\u044b \u0431\u04d5\u0441\u0442\u044b.", + "pad.modals.unauth.explanation": "\u0414\u04d5 \u0431\u0430\u0440\u0442\u04d5 \u0444\u04d5\u0438\u0432\u0442\u043e\u0439, \u0446\u0430\u043b\u044b\u043d\u043c\u04d5 \u0434\u044b \u0430\u0446\u044b \u0444\u0430\u0440\u0441 \u043a\u0430\u0441\u0442\u04d5. \u0411\u0430\u0444\u04d5\u043b\u0432\u0430\u0440 \u043d\u043e\u0433\u04d5\u0439 \u0431\u0430\u0438\u0443 \u0443\u044b\u043d.", + "pad.modals.looping": "\u0425\u0438\u0446\u04d5\u043d.", + "pad.modals.deleted": "\u0425\u0430\u0444\u0442.", + "pad.share.readonly": "\u04d4\u0440\u043c\u04d5\u0441\u0442 \u0444\u04d5\u0440\u0441\u044b\u043d\u04d5\u043d", + "pad.share.link": "\u04d4\u0440\u0432\u0438\u0442\u04d5\u043d", + "pad.share.emebdcode": "URL \u0431\u0430\u0432\u04d5\u0440\u044b\u043d", + "pad.chat": "\u041d\u044b\u0445\u0430\u0441", + "pad.chat.title": "\u041e\u0446\u044b \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u04d5\u043d \u0447\u0430\u0442 \u0431\u0430\u043a\u04d5\u043d.", + "timeslider.pageTitle": "{{appTitle}}-\u044b \u0440\u04d5\u0442\u04d5\u0434\u0436\u044b \u0445\u0430\u0445\u0445", + "timeslider.toolbar.returnbutton": "\u0424\u04d5\u0441\u0442\u04d5\u043c\u04d5, \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u043c\u04d5", + "timeslider.toolbar.authors": "\u0424\u044b\u0441\u0441\u04d5\u0434\u0436\u044b\u0442\u04d5:", + "timeslider.toolbar.authorsList": "\u0424\u044b\u0441\u0441\u04d5\u0434\u0436\u044b\u0442\u04d5 \u043d\u04d5\u0439", + "timeslider.toolbar.exportlink.title": "\u042d\u043a\u0441\u043f\u043e\u0440\u0442", + "timeslider.exportCurrent": "\u0421\u044d\u043a\u0441\u043f\u043e\u0440\u0442 \u043a\u04d5\u043d\u044b\u043d \u043d\u044b\u0440\u044b \u0444\u04d5\u043b\u0442\u04d5\u0440 \u043a\u0443\u044b\u0434:", + "timeslider.version": "\u0412\u0435\u0440\u0441\u0438 {{version}}", + "timeslider.saved": "\u04d4\u0432\u04d5\u0440\u0434 \u04d5\u0440\u0446\u044b\u0434 {{year}}-\u04d5\u043c \u0430\u0437\u044b, {{day}}-\u04d5\u043c {{month}}-\u044b", + "timeslider.dateformat": "{{day}}.{{month}}.{{year}} {{hours}}:{{minutes}}:{{seconds}}", + "timeslider.month.january": "\u044f\u043d\u0432\u0430\u0440\u044c", + "timeslider.month.february": "\u0444\u0435\u0432\u0440\u0430\u043b\u044c", + "timeslider.month.march": "\u043c\u0430\u0440\u0442\u044a\u0438", + "timeslider.month.april": "\u0430\u043f\u0440\u0435\u043b\u044c", + "timeslider.month.may": "\u043c\u0430\u0439", + "timeslider.month.june": "\u0438\u044e\u043d\u044c", + "timeslider.month.july": "\u0438\u044e\u043b\u044c", + "timeslider.month.august": "\u0430\u0432\u0433\u0443\u0441\u0442", + "timeslider.month.september": "\u0441\u0435\u043d\u0442\u044f\u0431\u0440\u044c", + "timeslider.month.october": "\u043e\u043a\u0442\u044f\u0431\u0440\u044c", + "timeslider.month.november": "\u043d\u043e\u044f\u0431\u0440\u044c", + "timeslider.month.december": "\u0434\u0435\u043a\u0430\u0431\u0440\u044c", + "pad.savedrevs.marked": "\u0410\u0446\u044b \u0444\u04d5\u043b\u0442\u04d5\u0440 \u043d\u044b\u0440 \u043a\u0443\u044b\u0434 \u04d5\u0432\u04d5\u0440\u0434 \u0444\u04d5\u043b\u0442\u04d5\u0440 \u043d\u044b\u0441\u0430\u043d\u0433\u043e\u043d\u0434 \u04d5\u0440\u0446\u044b\u0434", + "pad.userlist.entername": "\u0414\u04d5 \u043d\u043e\u043c \u0431\u0430\u0444\u044b\u0441\u0441", + "pad.userlist.unnamed": "\u04d5\u043d\u04d5\u043d\u043e\u043c", + "pad.userlist.guest": "\u0423\u0430\u0437\u04d5\u0433", + "pad.userlist.approve": "\u0421\u0431\u04d5\u043b\u0432\u044b\u0440\u0434 \u043a\u04d5\u043d\u044b\u043d", + "pad.editbar.clearcolors": "\u04d4\u043d\u04d5\u0445\u044a\u04d5\u043d \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u04d5\u0439 \u0445\u044a\u04d5\u0443\u044b \u0430\u0439\u0441\u044b\u043d \u0444\u044b\u0441\u0441\u04d5\u0434\u0436\u044b\u0442\u044b \u043d\u044b\u0441\u04d5\u043d\u0442\u0442\u04d5?", + "pad.impexp.importbutton": "\u0415\u043d\u044b\u0440 \u0441\u0438\u043c\u043f\u043e\u0440\u0442 \u043a\u04d5\u043d\u044b\u043d", + "pad.impexp.importing": "\u0418\u043c\u043f\u043e\u0440\u0442 \u0446\u04d5\u0443\u044b...", + "@metadata": { + "authors": [ + "Bouron" + ] + } +} \ No newline at end of file diff --git a/src/locales/pt-br.json b/src/locales/pt-br.json new file mode 100644 index 000000000..a7df38fa8 --- /dev/null +++ b/src/locales/pt-br.json @@ -0,0 +1,117 @@ +{ + "index.newPad": "Nova Nota", + "index.createOpenPad": "ou criar-abrir uma Nota com o nome:", + "pad.toolbar.bold.title": "Negrito (Ctrl-B)", + "pad.toolbar.italic.title": "It\u00e1lico (Ctrl-I)", + "pad.toolbar.underline.title": "Sublinhar (Ctrl-U)", + "pad.toolbar.strikethrough.title": "Tachado", + "pad.toolbar.ol.title": "Lista ordenada", + "pad.toolbar.ul.title": "Lista n\u00e3o ordenada", + "pad.toolbar.indent.title": "Aumentar Recuo", + "pad.toolbar.unindent.title": "Diminuir Recuo", + "pad.toolbar.undo.title": "Desfazer (Ctrl-Z)", + "pad.toolbar.redo.title": "Refazer (Ctrl-Y)", + "pad.toolbar.clearAuthorship.title": "Limpar as cores de identifica\u00e7\u00e3o de autoria", + "pad.toolbar.import_export.title": "Importar\/Exportar de\/para diferentes formatos de arquivo", + "pad.toolbar.timeslider.title": "Linha do tempo", + "pad.toolbar.savedRevision.title": "Revis\u00f5es Salvas", + "pad.toolbar.settings.title": "Configura\u00e7\u00f5es", + "pad.toolbar.embed.title": "Incorporar esta Nota", + "pad.toolbar.showusers.title": "Mostrar os usuarios nesta Nota", + "pad.colorpicker.save": "Salvar", + "pad.colorpicker.cancel": "Cancelar", + "pad.loading": "Carregando...", + "pad.passwordRequired": "Voc\u00ea precisa de uma senha para acessar esta Nota", + "pad.permissionDenied": "Voc\u00ea n\u00e3o tem permiss\u00e3o para acessar esta nota", + "pad.wrongPassword": "Senha incorreta", + "pad.settings.padSettings": "Configura\u00e7\u00f5es da Nota", + "pad.settings.myView": "Minha Vis\u00e3o", + "pad.settings.stickychat": "Conversa sempre vis\u00edvel", + "pad.settings.colorcheck": "Cores de autoria", + "pad.settings.linenocheck": "N\u00fameros de linha", + "pad.settings.fontType": "Tipo de fonte:", + "pad.settings.fontType.normal": "Normal", + "pad.settings.fontType.monospaced": "Monoespa\u00e7ada", + "pad.settings.globalView": "Vis\u00e3o global", + "pad.settings.language": "Idioma:", + "pad.importExport.import_export": "Importar\/Exportar", + "pad.importExport.import": "Enviar um arquivo texto ou documento", + "pad.importExport.importSuccessful": "Completo!", + "pad.importExport.export": "Exportar a presente nota como:", + "pad.importExport.exporthtml": "HTML", + "pad.importExport.exportplain": "Texto puro", + "pad.importExport.exportword": "Microsoft Word", + "pad.importExport.exportpdf": "PDF", + "pad.importExport.exportopen": "ODF (Open Document Format)", + "pad.importExport.exportdokuwiki": "DokuWiki", + "pad.importExport.abiword.innerHTML": "Voc\u00ea s\u00f3 pode importar de formatos de texto puro ou html. Para recursos de importa\u00e7\u00e3o mais avan\u00e7ados instale o abiword<\/a>.", + "pad.modals.connected": "Conectado.", + "pad.modals.reconnecting": "Reconectando \u00e0 sua nota...", + "pad.modals.forcereconnect": "For\u00e7ar reconex\u00e3o", + "pad.modals.userdup": "Aberto noutra janela", + "pad.modals.userdup.explanation": "Esta nota parece estar aberta em mais de uma janela de navegador deste computador.", + "pad.modals.userdup.advice": "Reconectar para usar esta janela.", + "pad.modals.unauth": "N\u00e3o autorizado", + "pad.modals.unauth.explanation": "Suas permiss\u00f5es foram mudadas enquanto visualizava esta p\u00e1gina. Tente reconectar.", + "pad.modals.looping": "Reconectado.", + "pad.modals.looping.explanation": "H\u00e1 problemas de comunica\u00e7\u00e3o com o servidor de sincroniza\u00e7\u00e3o.", + "pad.modals.looping.cause": "Talvez voc\u00ea tenha conectado por um firewall ou proxy incompat\u00edvel.", + "pad.modals.initsocketfail": "Servidor \u00e9 inalcan\u00e7\u00e1vel.", + "pad.modals.initsocketfail.explanation": "N\u00e3o foi poss\u00edvel conectar com o servidor de sincroniza\u00e7\u00e3o.", + "pad.modals.initsocketfail.cause": "Isto provavelmente ocorreu por um problema em seu navegador ou conex\u00e3o.", + "pad.modals.slowcommit": "Desconectado.", + "pad.modals.slowcommit.explanation": "O servidor n\u00e3o responde.", + "pad.modals.slowcommit.cause": "Isto pode ser por problemas com a conex\u00e3o de rede.", + "pad.modals.deleted": "Exclu\u00eddo", + "pad.modals.deleted.explanation": "Esta nota foi removida.", + "pad.modals.disconnected": "Voc\u00ea foi desconectado.", + "pad.modals.disconnected.explanation": "A conex\u00e3o com o servidor foi perdida", + "pad.modals.disconnected.cause": "O servidor pode estar indispon\u00edvel. Comunique-nos caso isso continue.", + "pad.share": "Compartilhar esta nota", + "pad.share.readonly": "Somente leitura", + "pad.share.link": "Liga\u00e7\u00e3o", + "pad.share.emebdcode": "Incorporar o URL", + "pad.chat": "Bate-papo", + "pad.chat.title": "Abrir o bate-papo desta nota.", + "timeslider.pageTitle": "Linha do tempo de {{appTitle}}", + "timeslider.toolbar.returnbutton": "Retornar para a nota", + "timeslider.toolbar.authors": "Autores:", + "timeslider.toolbar.authorsList": "Sem autores", + "timeslider.toolbar.exportlink.title": "Exportar", + "timeslider.exportCurrent": "Exportar a vers\u00e3o atual em formato:", + "timeslider.version": "Vers\u00e3o {{version}}", + "timeslider.saved": "Salvo em {{day}} de {{month}} de {{year}}", + "timeslider.dateformat": "{{day}}\/{{month}}\/{{year}} {{hours}}:{{minutes}}:{{seconds}}", + "timeslider.month.january": "Janeiro", + "timeslider.month.february": "Fevereiro", + "timeslider.month.march": "Mar\u00e7o", + "timeslider.month.april": "Abril", + "timeslider.month.may": "Maio", + "timeslider.month.june": "Junho", + "timeslider.month.july": "Julho", + "timeslider.month.august": "Agosto", + "timeslider.month.september": "Setembro", + "timeslider.month.october": "Outubro", + "timeslider.month.november": "Novembro", + "timeslider.month.december": "Dezembro", + "pad.savedrevs.marked": "Esta revis\u00e3o foi marcada como salva", + "pad.userlist.entername": "Insira o seu nome", + "pad.userlist.unnamed": "Sem t\u00edtulo", + "pad.userlist.guest": "Convidado", + "pad.userlist.deny": "Negar", + "pad.userlist.approve": "Aprovar", + "pad.editbar.clearcolors": "Deseja limpar cores de autoria em todo o documento?", + "pad.impexp.importbutton": "Importar agora", + "pad.impexp.importing": "Importando...", + "pad.impexp.confirmimport": "Importar um arquivo sobrescrever\u00e1 o atual texto da nota. Tem certeza de que deseja prosseguir?", + "pad.impexp.convertFailed": "N\u00e3o foi poss\u00edvel importar este arquivo. Use outro formato ou copie e cole manualmente", + "pad.impexp.uploadFailed": "O envio falhou. Tente outra vez", + "pad.impexp.importfailed": "A importa\u00e7\u00e3o falhou", + "pad.impexp.copypaste": "Copie e cole", + "pad.impexp.exportdisabled": "A exposta\u00e7\u00e3o em formato {{type}} est\u00e1 desativada. Comunique-se com o administrador do sistema para detalhes.", + "@metadata": { + "authors": [ + "Tuliouel" + ] + } +} \ No newline at end of file diff --git a/src/locales/ru.json b/src/locales/ru.json index 06a0502e3..7eb34c97e 100644 --- a/src/locales/ru.json +++ b/src/locales/ru.json @@ -1,6 +1,7 @@ { "@metadata": { "authors": [ + "Amire80", "Eleferen", "Volkov" ] @@ -9,8 +10,8 @@ "index.createOpenPad": "\u0438\u043b\u0438 \u0441\u043e\u0437\u0434\u0430\u0442\u044c\/\u043e\u0442\u043a\u0440\u044b\u0442\u044c \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442 \u0441 \u0438\u043c\u0435\u043d\u0435\u043c:", "pad.toolbar.bold.title": "\u043f\u043e\u043b\u0443\u0436\u0438\u0440\u043d\u044b\u0439 (Ctrl-B)", "pad.toolbar.italic.title": "\u043a\u0443\u0440\u0441\u0438\u0432 (Ctrl-I)", - "pad.toolbar.underline.title": "\u043f\u043e\u0434\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435 (Ctrl-U)", - "pad.toolbar.strikethrough.title": "\u0437\u0430\u0447\u0435\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435", + "pad.toolbar.underline.title": "\u043f\u043e\u0434\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435 (Ctrl-U)", + "pad.toolbar.strikethrough.title": "\u0437\u0430\u0447\u0451\u0440\u043a\u0438\u0432\u0430\u043d\u0438\u0435", "pad.toolbar.ol.title": "\u0423\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a", "pad.toolbar.ul.title": "\u041d\u0435\u0443\u043f\u043e\u0440\u044f\u0434\u043e\u0447\u0435\u043d\u043d\u044b\u0439 \u0441\u043f\u0438\u0441\u043e\u043a", "pad.toolbar.indent.title": "\u041e\u0442\u0441\u0442\u0443\u043f", @@ -82,6 +83,11 @@ "timeslider.exportCurrent": "\u042d\u043a\u0441\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0443\u044e \u0432\u0435\u0440\u0441\u0438\u044e \u043a\u0430\u043a:", "timeslider.version": "\u0412\u0435\u0440\u0441\u0438\u044f {{version}}", "timeslider.saved": "\u0421\u043e\u0445\u0440\u0430\u043d\u0435\u043d\u043e {{day}}.{{month}}.{{year}}", + "timeslider.month.january": "\u044f\u043d\u0432\u0430\u0440\u044c", + "timeslider.month.february": "\u0444\u0435\u0432\u0440\u0430\u043b\u044c", + "timeslider.month.march": "\u043c\u0430\u0440\u0442", + "timeslider.month.april": "\u0430\u043f\u0440\u0435\u043b\u044c", + "timeslider.month.may": "\u043c\u0430\u0439", "pad.userlist.entername": "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0432\u0430\u0448\u0435 \u0438\u043c\u044f", "pad.userlist.guest": "\u0413\u043e\u0441\u0442\u044c", "pad.impexp.importbutton": "\u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0435\u0439\u0447\u0430\u0441", diff --git a/src/locales/sl.json b/src/locales/sl.json new file mode 100644 index 000000000..9cec99f71 --- /dev/null +++ b/src/locales/sl.json @@ -0,0 +1,117 @@ +{ + "index.newPad": "Nov dokument", + "index.createOpenPad": "ali pa odpri dokument z imenom:", + "pad.toolbar.bold.title": "Krepko (Ctrl-B)", + "pad.toolbar.italic.title": "Le\u017ee\u010de (Ctrl-I)", + "pad.toolbar.underline.title": "Pod\u010drtano (Ctrl-U)", + "pad.toolbar.strikethrough.title": "Pre\u010drtano", + "pad.toolbar.ol.title": "O\u0161tevil\u010den seznam", + "pad.toolbar.ul.title": "Vrsti\u010dni seznam", + "pad.toolbar.indent.title": "Zamik desno", + "pad.toolbar.unindent.title": "Zamik levo", + "pad.toolbar.undo.title": "Razveljavi (Ctrl-Z)", + "pad.toolbar.redo.title": "Ponovno uveljavi (Ctrl-Y)", + "pad.toolbar.clearAuthorship.title": "Po\u010disti barvo avtorstva", + "pad.toolbar.import_export.title": "Izvozi\/Uvozi razli\u010dne oblike zapisov", + "pad.toolbar.timeslider.title": "Drsnik zgodovine", + "pad.toolbar.savedRevision.title": "Shranjene predelave", + "pad.toolbar.settings.title": "Nastavitve", + "pad.toolbar.embed.title": "Vstavi dokument", + "pad.toolbar.showusers.title": "Poka\u017ei uporabnike dokumenta", + "pad.colorpicker.save": "Shrani", + "pad.colorpicker.cancel": "Prekli\u010di", + "pad.loading": "Nalaganje ...", + "pad.passwordRequired": "Za dostop do dokumenta je zahtevano geslo.", + "pad.permissionDenied": "Za dostop do dokumenta so zahtevana posebna dovoljenja.", + "pad.wrongPassword": "Vpisano geslo je napa\u010dno.", + "pad.settings.padSettings": "Nastavitve dokumenta", + "pad.settings.myView": "Pogled", + "pad.settings.stickychat": "Vsebina klepeta je vedno na zaslonu.", + "pad.settings.colorcheck": "Barve avtorstva", + "pad.settings.linenocheck": "\u0160tevilke vrstic", + "pad.settings.fontType": "Vrsta pisave:", + "pad.settings.fontType.normal": "Obi\u010dajno", + "pad.settings.fontType.monospaced": "Monospace", + "pad.settings.globalView": "Splo\u0161ni pogled", + "pad.settings.language": "Jezik:", + "pad.importExport.import_export": "Uvoz\/Izvoz", + "pad.importExport.import": "Nalo\u017ei katerokoli besedilno datoteko ali dokument.", + "pad.importExport.importSuccessful": "Opravilo je uspe\u0161no kon\u010dano!", + "pad.importExport.export": "Izvozi trenutni dokument kot:", + "pad.importExport.exporthtml": "HTML (oblikovano besedilo)", + "pad.importExport.exportplain": "TXT (neoblikovano besedilo)", + "pad.importExport.exportword": "DOC (zapis Microsoft Word)", + "pad.importExport.exportpdf": "PDF (zapis Acrobat PDF)", + "pad.importExport.exportopen": "ODF (zapis Open Document)", + "pad.importExport.exportdokuwiki": "DokuWiki (zapis DokuWiki)", + "pad.importExport.abiword.innerHTML": "Uvoziti je mogo\u010de le obi\u010dajno neoblikovano besedilo in zapise HTML. Za naprednej\u0161e zmo\u017enosti namestite program Abiword<\/a>.", + "pad.modals.connected": "Povezano.", + "pad.modals.reconnecting": "Poteka povezovanje z dokumentom ...", + "pad.modals.forcereconnect": "Vsili ponovno povezavo.", + "pad.modals.userdup": "Dokument je \u017ee odprt v v drugem oknu.", + "pad.modals.userdup.explanation": "Videti je, da je ta dokument odprt v ve\u010d kot enem oknu brskalnika na tem ra\u010dunalniku.", + "pad.modals.userdup.advice": "Ponovno vzpostavite povezavo in uporabljajte to okno.", + "pad.modals.unauth": "Nepoobla\u0161\u010den dostop", + "pad.modals.unauth.explanation": "Med pregledovanjem te strani so se dovoljenja za ogled spremenila. Treba se bo znova povezati.", + "pad.modals.looping": "Prekinjena povezava.", + "pad.modals.looping.explanation": "Zaznane so te\u017eave s povezavo za usklajevanje s stre\u017enikom.", + "pad.modals.looping.cause": "Morda je vzpostavljena povezava preko neustrezno nastavljenega po\u017earnega zidu ali posredni\u0161kega stre\u017enika.", + "pad.modals.initsocketfail": "Dostop do stre\u017enika ni mogo\u010d.", + "pad.modals.initsocketfail.explanation": "Povezava s stre\u017enikom za usklajevanje ni mogo\u010da.", + "pad.modals.initsocketfail.cause": "Najverjetneje je te\u017eava v brskalniku, ali pa so te\u017eave z internetno povezavo.", + "pad.modals.slowcommit": "Prekinjena povezava.", + "pad.modals.slowcommit.explanation": "Stre\u017enik se ne odziva.", + "pad.modals.slowcommit.cause": "Najverjetneje je pri\u0161lo do napake med vzpostavitvijo povezave.", + "pad.modals.deleted": "Izbrisano.", + "pad.modals.deleted.explanation": "Dokument je odstranjen.", + "pad.modals.disconnected": "Povezava je prekinjena.", + "pad.modals.disconnected.explanation": "Povezava s stre\u017enikom je bila prekinjena.", + "pad.modals.disconnected.cause": "Stre\u017enik je najverjetneje nedosegljiv. Po\u0161ljite poro\u010dilo, \u010de s napaka ve\u010dkrat pojavi.", + "pad.share": "Dolo\u010di souporabo dokumenta", + "pad.share.readonly": "Le za branje", + "pad.share.link": "Povezava", + "pad.share.emebdcode": "Vstavi naslov URL", + "pad.chat": "Klepet", + "pad.chat.title": "Odpri klepetalno okno dokumenta.", + "timeslider.pageTitle": "Zgodovina dokumenta {{appTitle}}", + "timeslider.toolbar.returnbutton": "Vrni se na dokument", + "timeslider.toolbar.authors": "Autorji:", + "timeslider.toolbar.authorsList": "Ni dolo\u010denih avtorjev", + "timeslider.toolbar.exportlink.title": "Izvozi", + "timeslider.exportCurrent": "Izvozi trenutno razli\u010dico kot:", + "timeslider.version": "Razli\u010dica {{version}}", + "timeslider.saved": "Shranjeno {{day}}.{{month}}.{{year}}", + "timeslider.dateformat": "{{day}}.{{month}}.{{year}} {{hours}}:{{minutes}}:{{seconds}}", + "timeslider.month.january": "Januar", + "timeslider.month.february": "Februar", + "timeslider.month.march": "Marec", + "timeslider.month.april": "April", + "timeslider.month.may": "Maj", + "timeslider.month.june": "Junij", + "timeslider.month.july": "Julij", + "timeslider.month.august": "August", + "timeslider.month.september": "September", + "timeslider.month.october": "Oktober", + "timeslider.month.november": "November", + "timeslider.month.december": "December", + "pad.savedrevs.marked": "Ta predelava je ozna\u010dena kot shranjena predelava.", + "pad.userlist.entername": "Vpi\u0161ite ime", + "pad.userlist.unnamed": "neimenovana oseba", + "pad.userlist.guest": "Gost", + "pad.userlist.deny": "Zavrni", + "pad.userlist.approve": "Odobri", + "pad.editbar.clearcolors": "Ali naj se po\u010distijo barve avtorstva v celotnem dokumentu?", + "pad.impexp.importbutton": "Uvozi takoj", + "pad.impexp.importing": "Poteka uva\u017eanje ...", + "pad.impexp.confirmimport": "Uvoz datoteke prepi\u0161e obstoje\u010de besedilo dokumenta. Ali ste prepri\u010dani, da \u017eelite nadaljevati?", + "pad.impexp.convertFailed": "Datoteke ni mogo\u010de uvoziti. Uporabiti je treba enega izmed podprtih zapisov dokumentov ali pa vsebino prilepiti ro\u010dno.", + "pad.impexp.uploadFailed": "Nalaganje je spodletelo, poskusite znova.", + "pad.impexp.importfailed": "Uvoz je spodletel.", + "pad.impexp.copypaste": "Vsebino kopirajte in prilepite.", + "pad.impexp.exportdisabled": "Izvoz v zapis {{type}} je onemogo\u010den. Za ve\u010d podrobnosti stopite v stik s skrbnikom.", + "@metadata": { + "authors": [ + "Mateju" + ] + } +} \ No newline at end of file diff --git a/src/locales/uk.json b/src/locales/uk.json index a8a58eb98..af035c651 100644 --- a/src/locales/uk.json +++ b/src/locales/uk.json @@ -2,7 +2,8 @@ "@metadata": { "authors": { "0": "Base", - "2": "Steve.rusyn" + "1": "Olvin", + "3": "Steve.rusyn" } }, "index.newPad": "\u0421\u0442\u0432\u043e\u0440\u0438\u0442\u0438", @@ -54,7 +55,7 @@ "pad.modals.connected": "\u0417'\u0454\u0434\u043d\u0430\u043d\u043e.", "pad.modals.reconnecting": "\u041f\u0435\u0440\u0435\u043f\u0456\u0434\u043b\u044e\u0447\u0435\u043d\u043d\u044f \u0434\u043e \u0412\u0430\u0448\u043e\u0433\u043e \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0443..", "pad.modals.forcereconnect": "\u041f\u0440\u0438\u043c\u0443\u0441\u043e\u0432\u0435 \u043f\u0435\u0440\u0435\u043f\u0456\u0434\u043a\u043b\u044e\u0447\u0435\u043d\u043d\u044f", - "pad.modals.userdup": "\u0412\u0456\u0434\u043a\u0440\u0438\u0442\u043e \u0443 \u0456\u043d\u0448\u043e\u043c\u0443 \u0432\u0456\u043a\u043d\u0456", + "pad.modals.userdup": "\u0412\u0456\u0434\u043a\u0440\u0438\u0442\u043e \u0432 \u0456\u043d\u0448\u043e\u043c\u0443 \u0432\u0456\u043a\u043d\u0456", "pad.modals.userdup.explanation": "\u0414\u043e\u043a\u0443\u043c\u0435\u043d\u0442, \u043c\u043e\u0436\u043b\u0438\u0432\u043e, \u0432\u0456\u0434\u043a\u0440\u0438\u0442\u043e \u0431\u0456\u043b\u044c\u0448 \u043d\u0456\u0436 \u0432 \u043e\u0434\u043d\u043e\u043c\u0443 \u0432\u0456\u043a\u043d\u0456 \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430 \u043d\u0430 \u0446\u044c\u043e\u043c\u0443 \u043a\u043e\u043c\u043f'\u044e\u0442\u0435\u0440\u0456.", "pad.modals.userdup.advice": "\u041f\u0435\u0440\u0435\u043f\u0456\u0434\u043a\u043b\u044e\u0447\u0438\u0442\u0438\u0441\u044c \u0432\u0438\u043a\u043e\u0440\u0438\u0441\u0442\u043e\u0432\u0443\u044e\u0447\u0438 \u0446\u0435 \u0432\u0456\u043a\u043d\u043e.", "pad.modals.unauth": "\u041d\u0435 \u0430\u0432\u0442\u043e\u0440\u0438\u0437\u043e\u0432\u0430\u043d\u043e", diff --git a/src/locales/zh-hant.json b/src/locales/zh-hant.json index 4692ed43b..c91e2fe37 100644 --- a/src/locales/zh-hant.json +++ b/src/locales/zh-hant.json @@ -53,6 +53,7 @@ "pad.modals.connected": "\u5df2\u9023\u7dda\u3002", "pad.modals.reconnecting": "\u91cd\u65b0\u9023\u63a5\u5230\u60a8\u7684pad...", "pad.modals.forcereconnect": "\u5f37\u5236\u91cd\u65b0\u9023\u7dda", + "pad.modals.userdup": "\u5728\u53e6\u4e00\u500b\u8996\u7a97\u4e2d\u958b\u555f", "pad.modals.userdup.explanation": "\u6b64pad\u4f3c\u4e4e\u5728\u6b64\u96fb\u8166\u4e0a\u7684\u591a\u500b\u700f\u89bd\u5668\u8996\u7a97\u4e2d\u958b\u555f\u3002", "pad.modals.userdup.advice": "\u91cd\u65b0\u9023\u63a5\u5230\u6b64\u8996\u7a97\u3002", "pad.modals.unauth": "\u672a\u6388\u6b0a", @@ -81,6 +82,7 @@ "timeslider.toolbar.returnbutton": "\u8fd4\u56de\u5230pad", "timeslider.toolbar.authors": "\u4f5c\u8005\uff1a", "timeslider.toolbar.authorsList": "\u7121\u4f5c\u8005", + "timeslider.toolbar.exportlink.title": "\u532f\u51fa", "timeslider.exportCurrent": "\u532f\u51fa\u7576\u524d\u7248\u672c\u70ba\uff1a", "timeslider.version": "\u7248\u672c{{version}}", "timeslider.saved": "{{year}}{{month}}{{day}}\u4fdd\u5b58", diff --git a/src/node/db/API.js b/src/node/db/API.js index a26055a79..ee12d1d98 100644 --- a/src/node/db/API.js +++ b/src/node/db/API.js @@ -42,6 +42,12 @@ exports.deleteGroup = groupManager.deleteGroup; exports.listPads = groupManager.listPads; exports.createGroupPad = groupManager.createGroupPad; +/**********************/ +/**PADLIST FUNCTION****/ +/**********************/ + +exports.listAllPads = padManager.getPads; + /**********************/ /**AUTHOR FUNCTIONS****/ /**********************/ diff --git a/src/node/db/Pad.js b/src/node/db/Pad.js index dba791fd2..da1ce9e16 100644 --- a/src/node/db/Pad.js +++ b/src/node/db/Pad.js @@ -281,27 +281,7 @@ Pad.prototype.getChatMessage = function getChatMessage(entryNum, callback) { }); }; -Pad.prototype.getLastChatMessages = function getLastChatMessages(count, callback) { - //return an empty array if there are no chat messages - if(this.chatHead == -1) - { - callback(null, []); - return; - } - - var _this = this; - - //works only if we decrement the amount, for some reason - count--; - - //set the startpoint - var start = this.chatHead-count; - if(start < 0) - start = 0; - - //set the endpoint - var end = this.chatHead; - +Pad.prototype.getChatMessages = function getChatMessages(start, end, callback) { //collect the numbers of chat entries and in which order we need them var neededEntries = []; var order = 0; @@ -310,7 +290,9 @@ Pad.prototype.getLastChatMessages = function getLastChatMessages(count, callback neededEntries.push({entryNum:i, order: order}); order++; } - + + var _this = this; + //get all entries out of the database var entries = []; async.forEach(neededEntries, function(entryObject, callback) @@ -473,8 +455,7 @@ Pad.prototype.remove = function remove(callback) { //delete the pad entry and delete pad from padManager function(callback) { - db.remove("pad:"+padID); - padManager.unloadPad(padID); + padManager.removePad(padID); hooks.callAll("padRemove", {'padID':padID}); callback(); } diff --git a/src/node/db/PadManager.js b/src/node/db/PadManager.js index 5f08b1b1b..8cd69a83e 100644 --- a/src/node/db/PadManager.js +++ b/src/node/db/PadManager.js @@ -34,10 +34,59 @@ var db = require("./DB").db; */ var globalPads = { get: function (name) { return this[':'+name]; }, - set: function (name, value) { this[':'+name] = value; }, + set: function (name, value) + { + this[':'+name] = value; + padList.addPad(name); + }, remove: function (name) { delete this[':'+name]; } }; +var padList = { + list: [], + sorted : false, + init: function() + { + db.findKeys("pad:*", "*:*:*", function(err, dbData) + { + if(ERR(err)) return; + if(dbData != null){ + dbData.forEach(function(val){ + padList.addPad(val.replace(/pad:/,""),false); + }); + } + }); + return this; + }, + /** + * Returns all pads in alphabetical order as array. + */ + getPads: function(){ + if(!this.sorted){ + this.list=this.list.sort(); + this.sorted=true; + } + return this.list; + }, + addPad: function(name) + { + if(this.list.indexOf(name) == -1){ + this.list.push(name); + this.sorted=false; + } + }, + removePad: function(name) + { + var index=this.list.indexOf(name); + if(index>-1){ + this.list.splice(index,1); + this.sorted=false; + } + } +}; +//initialises the allknowing data structure +padList.init(); + /** * An array of padId transformations. These represent changes in pad name policy over * time, and allow us to "play back" these changes so legacy padIds can be found. @@ -109,6 +158,15 @@ exports.getPad = function(id, text, callback) } } +exports.getPads = function(callback) +{ + if(callback != null){ + callback(null,padList.getPads()); + }else{ + return padList.getPads(); + } +} + //checks if a pad exists exports.doesPadExists = function(padId, callback) { @@ -163,6 +221,15 @@ exports.isValidPadId = function(padId) return /^(g.[a-zA-Z0-9]{16}\$)?[^$]{1,50}$/.test(padId); } +/** + * Removes the pad from database and unloads it. + */ +exports.removePad = function(padId){ + db.remove("pad:"+padId); + exports.unloadPad(padId); + padList.removePad(padId); +} + //removes a pad from the array exports.unloadPad = function(padId) { diff --git a/src/node/handler/APIHandler.js b/src/node/handler/APIHandler.js index 0bcd5f0c9..ae93e933f 100644 --- a/src/node/handler/APIHandler.js +++ b/src/node/handler/APIHandler.js @@ -138,6 +138,42 @@ var version = , "listAllGroups" : [] , "checkToken" : [] } +, "1.2.1": + { "createGroup" : [] + , "createGroupIfNotExistsFor" : ["groupMapper"] + , "deleteGroup" : ["groupID"] + , "listPads" : ["groupID"] + , "listAllPads" : [] + , "createPad" : ["padID", "text"] + , "createGroupPad" : ["groupID", "padName", "text"] + , "createAuthor" : ["name"] + , "createAuthorIfNotExistsFor": ["authorMapper" , "name"] + , "listPadsOfAuthor" : ["authorID"] + , "createSession" : ["groupID", "authorID", "validUntil"] + , "deleteSession" : ["sessionID"] + , "getSessionInfo" : ["sessionID"] + , "listSessionsOfGroup" : ["groupID"] + , "listSessionsOfAuthor" : ["authorID"] + , "getText" : ["padID", "rev"] + , "setText" : ["padID", "text"] + , "getHTML" : ["padID", "rev"] + , "setHTML" : ["padID", "html"] + , "getRevisionsCount" : ["padID"] + , "getLastEdited" : ["padID"] + , "deletePad" : ["padID"] + , "getReadOnlyID" : ["padID"] + , "setPublicStatus" : ["padID", "publicStatus"] + , "getPublicStatus" : ["padID"] + , "setPassword" : ["padID", "password"] + , "isPasswordProtected" : ["padID"] + , "listAuthorsOfPad" : ["padID"] + , "padUsersCount" : ["padID"] + , "getAuthorName" : ["authorID"] + , "padUsers" : ["padID"] + , "sendClientsMessage" : ["padID", "msg"] + , "listAllGroups" : [] + , "checkToken" : [] + } }; /** diff --git a/src/node/handler/PadMessageHandler.js b/src/node/handler/PadMessageHandler.js index a0bccfc51..434c25ad6 100644 --- a/src/node/handler/PadMessageHandler.js +++ b/src/node/handler/PadMessageHandler.js @@ -205,6 +205,8 @@ exports.handleMessage = function(client, message) handleUserInfoUpdate(client, message); } else if (message.data.type == "CHAT_MESSAGE") { handleChatMessage(client, message); + } else if (message.data.type == "GET_CHAT_MESSAGES") { + handleGetChatMessages(client, message); } else if (message.data.type == "SAVE_REVISION") { handleSaveRevisionMessage(client, message); } else if (message.data.type == "CLIENT_MESSAGE" && @@ -362,6 +364,74 @@ function handleChatMessage(client, message) }); } +/** + * Handles the clients request for more chat-messages + * @param client the client that send this message + * @param message the message from the client + */ +function handleGetChatMessages(client, message) +{ + if(message.data.start == null) + { + messageLogger.warn("Dropped message, GetChatMessages Message has no start!"); + return; + } + if(message.data.end == null) + { + messageLogger.warn("Dropped message, GetChatMessages Message has no start!"); + return; + } + + var start = message.data.start; + var end = message.data.end; + var count = start - count; + + if(count < 0 && count > 100) + { + messageLogger.warn("Dropped message, GetChatMessages Message, client requested invalid amout of messages!"); + return; + } + + var padId = sessioninfos[client.id].padId; + var pad; + + async.series([ + //get the pad + function(callback) + { + padManager.getPad(padId, function(err, _pad) + { + if(ERR(err, callback)) return; + pad = _pad; + callback(); + }); + }, + function(callback) + { + pad.getChatMessages(start, end, function(err, chatMessages) + { + if(ERR(err, callback)) return; + + var infoMsg = { + type: "COLLABROOM", + data: { + type: "CHAT_MESSAGES", + messages: chatMessages + } + }; + + // send the messages back to the client + for(var i in pad2sessions[padId]) + { + if(pad2sessions[padId][i] == client.id) + { + socketio.sockets.sockets[pad2sessions[padId][i]].json.send(infoMsg); + break; + } + } + }); + }]); +} /** * Handles a handleSuggestUserName, that means a user have suggest a userName for a other user @@ -778,19 +848,18 @@ function handleClientReady(client, message) var pad; var historicalAuthorData = {}; var currentTime; - var chatMessages; var padIds; async.series([ - // Get ro/rw id:s - function (callback) { + //Get ro/rw id:s + function (callback) + { readOnlyManager.getIds(message.padId, function(err, value) { if(ERR(err, callback)) return; padIds = value; callback(); }); }, - //check permissions function(callback) { @@ -816,7 +885,7 @@ function handleClientReady(client, message) } }); }, - //get all authordata of this new user + //get all authordata of this new user, and load the pad-object from the database function(callback) { async.parallel([ @@ -840,6 +909,7 @@ function handleClientReady(client, message) callback(); }); }, + //get pad function(callback) { padManager.getPad(padIds.padId, function(err, value) @@ -851,7 +921,7 @@ function handleClientReady(client, message) } ], callback); }, - //these db requests all need the pad object + //these db requests all need the pad object (timestamp of latest revission, author data) function(callback) { var authors = pad.getAllAuthors(); @@ -880,20 +950,11 @@ function handleClientReady(client, message) callback(); }); }, callback); - }, - //get the latest chat messages - function(callback) - { - pad.getLastChatMessages(100, function(err, _chatMessages) - { - if(ERR(err, callback)) return; - chatMessages = _chatMessages; - callback(); - }); } ], callback); }, + //glue the clientVars together, send them and tell the other clients that a new one is there function(callback) { //Check that the client is still here. It might have disconnected between callbacks. @@ -929,70 +990,7 @@ function handleClientReady(client, message) //Saves in pad2sessions that this session belongs to this pad pad2sessions[padIds.padId].push(client.id); - - //prepare all values for the wire - var atext = Changeset.cloneAText(pad.atext); - var attribsForWire = Changeset.prepareForWire(atext.attribs, pad.pool); - var apool = attribsForWire.pool.toJsonable(); - atext.attribs = attribsForWire.translated; - - // Warning: never ever send padIds.padId to the client. If the - // client is read only you would open a security hole 1 swedish - // mile wide... - var clientVars = { - "accountPrivs": { - "maxRevisions": 100 - }, - "initialRevisionList": [], - "initialOptions": { - "guestPolicy": "deny" - }, - "savedRevisions": pad.getSavedRevisions(), - "collab_client_vars": { - "initialAttributedText": atext, - "clientIp": "127.0.0.1", - //"clientAgent": "Anonymous Agent", - "padId": message.padId, - "historicalAuthorData": historicalAuthorData, - "apool": apool, - "rev": pad.getHeadRevisionNumber(), - "globalPadId": message.padId, - "time": currentTime, - }, - "colorPalette": ["#ffc7c7", "#fff1c7", "#e3ffc7", "#c7ffd5", "#c7ffff", "#c7d5ff", "#e3c7ff", "#ffc7f1", "#ff8f8f", "#ffe38f", "#c7ff8f", "#8fffab", "#8fffff", "#8fabff", "#c78fff", "#ff8fe3", "#d97979", "#d9c179", "#a9d979", "#79d991", "#79d9d9", "#7991d9", "#a979d9", "#d979c1", "#d9a9a9", "#d9cda9", "#c1d9a9", "#a9d9b5", "#a9d9d9", "#a9b5d9", "#c1a9d9", "#d9a9cd", "#4c9c82", "#12d1ad", "#2d8e80", "#7485c3", "#a091c7", "#3185ab", "#6818b4", "#e6e76d", "#a42c64", "#f386e5", "#4ecc0c", "#c0c236", "#693224", "#b5de6a", "#9b88fd", "#358f9b", "#496d2f", "#e267fe", "#d23056", "#1a1a64", "#5aa335", "#d722bb", "#86dc6c", "#b5a714", "#955b6a", "#9f2985", "#4b81c8", "#3d6a5b", "#434e16", "#d16084", "#af6a0e", "#8c8bd8"], - "clientIp": "127.0.0.1", - "userIsGuest": true, - "userColor": authorColorId, - "padId": message.padId, - "initialTitle": "Pad: " + message.padId, - "opts": {}, - "chatHistory": chatMessages, - "numConnectedUsers": pad2sessions[padIds.padId].length, - "isProPad": false, - "readOnlyId": padIds.readOnlyPadId, - "readonly": padIds.readonly, - "serverTimestamp": new Date().getTime(), - "globalPadId": message.padId, - "userId": author, - "cookiePrefsToSet": { - "fullWidth": false, - "hideSidebar": false - }, - "abiwordAvailable": settings.abiwordAvailable(), - "plugins": { - "plugins": plugins.plugins, - "parts": plugins.parts, - }, - "initialChangesets": [] // FIXME: REMOVE THIS SHIT - - } - - //Add a username to the clientVars if one avaiable - if(authorName != null) - { - clientVars.userName = authorName; - } - + //If this is a reconnect, we don't have to send the client the ClientVars again if(message.reconnect == true) { @@ -1002,10 +1000,85 @@ function handleClientReady(client, message) //This is a normal first connect else { - //Send the clientVars to the Client - client.json.send({type: "CLIENT_VARS", data: clientVars}); - //Save the current revision in sessioninfos, should be the same as in clientVars - sessioninfos[client.id].rev = pad.getHeadRevisionNumber(); + //prepare all values for the wire + var atext = Changeset.cloneAText(pad.atext); + var attribsForWire = Changeset.prepareForWire(atext.attribs, pad.pool); + var apool = attribsForWire.pool.toJsonable(); + atext.attribs = attribsForWire.translated; + + // Warning: never ever send padIds.padId to the client. If the + // client is read only you would open a security hole 1 swedish + // mile wide... + var clientVars = { + "accountPrivs": { + "maxRevisions": 100 + }, + "initialRevisionList": [], + "initialOptions": { + "guestPolicy": "deny" + }, + "savedRevisions": pad.getSavedRevisions(), + "collab_client_vars": { + "initialAttributedText": atext, + "clientIp": "127.0.0.1", + "padId": message.padId, + "historicalAuthorData": historicalAuthorData, + "apool": apool, + "rev": pad.getHeadRevisionNumber(), + "globalPadId": message.padId, + "time": currentTime, + }, + "colorPalette": ["#ffc7c7", "#fff1c7", "#e3ffc7", "#c7ffd5", "#c7ffff", "#c7d5ff", "#e3c7ff", "#ffc7f1", "#ff8f8f", "#ffe38f", "#c7ff8f", "#8fffab", "#8fffff", "#8fabff", "#c78fff", "#ff8fe3", "#d97979", "#d9c179", "#a9d979", "#79d991", "#79d9d9", "#7991d9", "#a979d9", "#d979c1", "#d9a9a9", "#d9cda9", "#c1d9a9", "#a9d9b5", "#a9d9d9", "#a9b5d9", "#c1a9d9", "#d9a9cd", "#4c9c82", "#12d1ad", "#2d8e80", "#7485c3", "#a091c7", "#3185ab", "#6818b4", "#e6e76d", "#a42c64", "#f386e5", "#4ecc0c", "#c0c236", "#693224", "#b5de6a", "#9b88fd", "#358f9b", "#496d2f", "#e267fe", "#d23056", "#1a1a64", "#5aa335", "#d722bb", "#86dc6c", "#b5a714", "#955b6a", "#9f2985", "#4b81c8", "#3d6a5b", "#434e16", "#d16084", "#af6a0e", "#8c8bd8"], + "clientIp": "127.0.0.1", + "userIsGuest": true, + "userColor": authorColorId, + "padId": message.padId, + "initialTitle": "Pad: " + message.padId, + "opts": {}, + // tell the client the number of the latest chat-message, which will be + // used to request the latest 100 chat-messages later (GET_CHAT_MESSAGES) + "chatHead": pad.chatHead, + "numConnectedUsers": pad2sessions[padIds.padId].length, + "isProPad": false, + "readOnlyId": padIds.readOnlyPadId, + "readonly": padIds.readonly, + "serverTimestamp": new Date().getTime(), + "globalPadId": message.padId, + "userId": author, + "cookiePrefsToSet": { + "fullWidth": false, + "hideSidebar": false + }, + "abiwordAvailable": settings.abiwordAvailable(), + "plugins": { + "plugins": plugins.plugins, + "parts": plugins.parts, + }, + "initialChangesets": [] // FIXME: REMOVE THIS SHIT + } + + //Add a username to the clientVars if one avaiable + if(authorName != null) + { + clientVars.userName = authorName; + } + + //call the clientVars-hook so plugins can modify them before they get sent to the client + hooks.aCallAll("clientVars", { clientVars: clientVars, pad: pad }, function ( err, messages ) { + if(ERR(err, callback)) return; + + _.each(messages, function(newVars) { + //combine our old object with the new attributes from the hook + for(var attr in newVars) { + clientVars[attr] = newVars[attr]; + } + }); + + //Send the clientVars to the Client + client.json.send({type: "CLIENT_VARS", data: clientVars}); + //Save the current revision in sessioninfos, should be the same as in clientVars + sessioninfos[client.id].rev = pad.getHeadRevisionNumber(); + }); } sessioninfos[client.id].author = author; diff --git a/src/node/server.js b/src/node/server.js index 327fa166f..db75d7e37 100755 --- a/src/node/server.js +++ b/src/node/server.js @@ -25,7 +25,6 @@ var log4js = require('log4js') , async = require('async') ; -// set up logger log4js.replaceConsole(); var settings @@ -50,8 +49,6 @@ async.waterfall([ hooks = require("ep_etherpad-lite/static/js/pluginfw/hooks"); hooks.plugins = plugins; - //set loglevel - log4js.setGlobalLogLevel(settings.loglevel); callback(); }, diff --git a/src/node/utils/Settings.js b/src/node/utils/Settings.js index bed5a9a07..8435ab2c2 100644 --- a/src/node/utils/Settings.js +++ b/src/node/utils/Settings.js @@ -25,6 +25,7 @@ var path = require('path'); var argv = require('./Cli').argv; var npm = require("npm/lib/npm.js"); var vm = require('vm'); +var log4js = require("log4js"); /* Root path of the installation */ exports.root = path.normalize(path.join(npm.dir, "..")); @@ -106,6 +107,11 @@ exports.abiword = null; */ exports.loglevel = "INFO"; +/* +* log4js appender configuration +*/ +exports.logconfig = { appenders: [{ type: "console" }]}; + /* This setting is used if you need authentication and/or * authorization. Note: /admin always requires authentication, and * either authorization by a module, or a user with is_admin set */ @@ -173,6 +179,10 @@ exports.reloadSettings = function reloadSettings() { console.warn("Unknown Setting: '" + i + "'. This setting doesn't exist or it was removed"); } } + + log4js.configure(exports.logconfig);//Configure the logging appenders + log4js.setGlobalLogLevel(exports.loglevel);//set loglevel + log4js.replaceConsole(); if(exports.dbType === "dirty"){ console.warn("DirtyDB is used. This is fine for testing but not recommended for production.") diff --git a/src/package.json b/src/package.json index 826db97b2..81e6ff164 100644 --- a/src/package.json +++ b/src/package.json @@ -16,7 +16,7 @@ "require-kernel" : "1.0.5", "resolve" : "0.2.x", "socket.io" : "0.9.x", - "ueberDB" : "0.1.8", + "ueberDB" : "0.1.x", "async" : "0.1.x", "express" : "3.x", "connect" : "2.4.x", @@ -46,5 +46,5 @@ "engines" : { "node" : ">=0.6.0", "npm" : ">=1.0" }, - "version" : "1.2.4" + "version" : "1.2.5" } diff --git a/src/static/css/pad.css b/src/static/css/pad.css index bb8da99b6..bbbadbc18 100644 --- a/src/static/css/pad.css +++ b/src/static/css/pad.css @@ -488,6 +488,22 @@ table#otheruserstable { -ms-overflow-x: hidden; overflow-x: hidden; } +.chatloadmessages +{ + margin-bottom: 5px; + margin-top: 5px; + margin-left: auto; + margin-right: auto; + display: block; +} +#chatloadmessagesbutton +{ + line-height: 1.8em; +} +#chatloadmessagesball +{ + display: none; +} #chatinputbox { padding: 3px 2px; position: absolute; diff --git a/src/static/css/timeslider.css b/src/static/css/timeslider.css index d786d89ba..b3c201847 100644 --- a/src/static/css/timeslider.css +++ b/src/static/css/timeslider.css @@ -32,6 +32,12 @@ background-image: url(../../static/img/timeslider_background.png); height: 63px; margin: 0 9px; + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; } #timeslider #timeslider-slider { height: 61px; @@ -140,6 +146,14 @@ #padmain { top: 0px !important } +#editbar{ + -webkit-touch-callout: none; + -webkit-user-select: none; + -khtml-user-select: none; + -moz-user-select: none; + -ms-user-select: none; + user-select: none; +} #editbarright { float: right } diff --git a/src/static/js/broadcast.js b/src/static/js/broadcast.js index 05e4c1742..6bd135bd2 100644 --- a/src/static/js/broadcast.js +++ b/src/static/js/broadcast.js @@ -244,14 +244,14 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro if (broadcasting) applyChangeset(changesetForward, revision + 1, false, timeDelta); } -/* + /* At this point, we must be certain that the changeset really does map from the current revision to the specified revision. Any mistakes here will cause the whole slider to get out of sync. */ function applyChangeset(changeset, revision, preventSliderMovement, timeDelta) - { + { // disable the next 'gotorevision' call handled by a timeslider update if (!preventSliderMovement) { @@ -271,7 +271,8 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro Changeset.mutateTextLines(changeset, padContents); padContents.currentRevision = revision; - padContents.currentTime += timeDelta; + padContents.currentTime += timeDelta * 1000; + debugLog('Time Delta: ', timeDelta) updateTimer(); @@ -293,8 +294,6 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro return str; } - - var date = new Date(padContents.currentTime); var dateFormat = function() { @@ -319,7 +318,6 @@ function loadBroadcastJS(socket, sendSocketMsg, fireWhenAllScriptsAreLoaded, Bro $('#timer').html(dateFormat()); - var revisionDate = html10n.get("timeslider.saved", { "day": date.getDate(), "month": [ diff --git a/src/static/js/chat.js b/src/static/js/chat.js index 79224e80c..205294a85 100644 --- a/src/static/js/chat.js +++ b/src/static/js/chat.js @@ -28,6 +28,8 @@ var Tinycon = require('tinycon/tinycon'); var chat = (function() { var isStuck = false; + var gotInitialMessages = false; + var historyPointer = 0; var chatMentions = 0; var self = { show: function () @@ -73,10 +75,12 @@ var chat = (function() send: function() { var text = $("#chatinput").val(); + if(text.replace(/\s+/,'').length == 0) + return; this._pad.collabClient.sendMessage({"type": "CHAT_MESSAGE", "text": text}); $("#chatinput").val(""); }, - addMessage: function(msg, increment) + addMessage: function(msg, increment, isHistoryAdd) { //correct the time msg.time += this._pad.clientTimeOffset; @@ -112,7 +116,10 @@ var chat = (function() var authorName = msg.userName == null ? _('pad.userlist.unnamed') : padutils.escapeHtml(msg.userName); var html = "

" + authorName + ":" + timeStr + " " + text + "

"; - $("#chattext").append(html); + if(isHistoryAdd) + $(html).insertAfter('#chatloadmessagesbutton'); + else + $("#chattext").append(html); //should we increment the counter?? if(increment) @@ -125,7 +132,7 @@ var chat = (function() $("#chatcounter").text(count); // chat throb stuff -- Just make it throw for twice as long - if(wasMentioned && !alreadyFocused) + if(wasMentioned && !alreadyFocused && !isHistoryAdd) { // If the user was mentioned show for twice as long and flash the browser window $('#chatthrob').html(""+authorName+"" + ": " + text).show().delay(4000).hide(400); chatMentions++; @@ -141,8 +148,8 @@ var chat = (function() chatMentions = 0; Tinycon.setBubble(0); }); - self.scrollDown(); - + if(!isHistoryAdd) + self.scrollDown(); }, init: function(pad) { @@ -157,12 +164,23 @@ var chat = (function() } }); - var that = this; - $.each(clientVars.chatHistory, function(i, o){ - that.addMessage(o, false); - }) + // initial messages are loaded in pad.js' _afterHandshake + + $("#chatcounter").text(0); + $("#chatloadmessagesbutton").click(function() + { + var start = Math.max(self.historyPointer - 20, 0); + var end = self.historyPointer; - $("#chatcounter").text(clientVars.chatHistory.length); + if(start == end) // nothing to load + return; + + $("#chatloadmessagesbutton").css("display", "none"); + $("#chatloadmessagesball").css("display", "block"); + + pad.collabClient.sendMessage({"type": "GET_CHAT_MESSAGES", "start": start, "end": end}); + self.historyPointer = start; + }); } } diff --git a/src/static/js/collab_client.js b/src/static/js/collab_client.js index b700fc490..7df0b7114 100644 --- a/src/static/js/collab_client.js +++ b/src/static/js/collab_client.js @@ -400,7 +400,29 @@ function getCollabClient(ace2editor, serverVars, initialUserInfo, options, _pad) } else if (msg.type == "CHAT_MESSAGE") { - chat.addMessage(msg, true); + chat.addMessage(msg, true, false); + } + else if (msg.type == "CHAT_MESSAGES") + { + for(var i = msg.messages.length - 1; i >= 0; i--) + { + chat.addMessage(msg.messages[i], true, true); + } + if(!chat.gotInitalMessages) + { + chat.scrollDown(); + chat.gotInitalMessages = true; + chat.historyPointer = clientVars.chatHead - msg.messages.length; + } + + // messages are loaded, so hide the loading-ball + $("#chatloadmessagesball").css("display", "none"); + + // there are less than 100 messages or we reached the top + if(chat.historyPointer <= 0) + $("#chatloadmessagesbutton").css("display", "none"); + else // there are still more messages, re-show the load-button + $("#chatloadmessagesbutton").css("display", "block"); } else if (msg.type == "SERVER_MESSAGE") { diff --git a/src/static/js/html10n.js b/src/static/js/html10n.js index c45f4b31b..b2c4e6195 100644 --- a/src/static/js/html10n.js +++ b/src/static/js/html10n.js @@ -883,7 +883,7 @@ window.html10n = (function(window, document, undefined) { html10n.index() }, false) else if (window.attachEvent) - document.attachEvent('onload', function() { + window.attachEvent('onload', function() { html10n.index() }, false) diff --git a/src/static/js/pad.js b/src/static/js/pad.js index a02d7abbc..64d8b42b8 100644 --- a/src/static/js/pad.js +++ b/src/static/js/pad.js @@ -555,6 +555,18 @@ var pad = { pad.collabClient.setOnChannelStateChange(pad.handleChannelStateChange); pad.collabClient.setOnInternalAction(pad.handleCollabAction); + // load initial chat-messages + if(clientVars.chatHead != -1) + { + var chatHead = clientVars.chatHead; + var start = Math.max(chatHead - 100, 0); + pad.collabClient.sendMessage({"type": "GET_CHAT_MESSAGES", "start": start, "end": chatHead}); + } + else // there are no messages + { + $("#chatloadmessagesbutton").css("display", "none"); + } + function postAceInit() { padeditbar.init(); diff --git a/src/templates/index.html b/src/templates/index.html index 668b7abe2..f0e1beb3f 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -33,9 +33,9 @@ - - - + + + + <% e.end_block(); %> +<% e.begin_block("timesliderBody"); %>
+ <% e.begin_block("timesliderTop"); %>
@@ -221,6 +227,7 @@ }); })(); +<% e.end_block(); %> diff --git a/tests/frontend/helper.js b/tests/frontend/helper.js index ee57c8690..bf5df5082 100644 --- a/tests/frontend/helper.js +++ b/tests/frontend/helper.js @@ -56,13 +56,13 @@ var helper = {}; window.document.cookie = ""; } - helper.newPad = function(){ + helper.newPad = function(cb, padName){ //build opts object var opts = {clearCookies: true} - if(typeof arguments[0] === 'function'){ - opts.cb = arguments[0] + if(typeof cb === 'function'){ + opts.cb = cb } else { - opts = _.defaults(arguments[0], opts); + opts = _.defaults(cb, opts); } //clear cookies @@ -70,7 +70,8 @@ var helper = {}; helper.clearCookies(); } - var padName = "FRONTEND_TEST_" + helper.randomString(20); + if(!padName) + padName = "FRONTEND_TEST_" + helper.randomString(20); $iframe = $(""); //clean up inner iframe references diff --git a/tests/frontend/specs/chat_load_messages.js b/tests/frontend/specs/chat_load_messages.js new file mode 100644 index 000000000..7b09b47e1 --- /dev/null +++ b/tests/frontend/specs/chat_load_messages.js @@ -0,0 +1,88 @@ +describe("chat-load-messages", function(){ + var padName; + + it("creates a pad", function(done) { + padName = helper.newPad(done); + this.timeout(60000); + }); + + it("adds a lot of messages", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + var chatButton = chrome$("#chaticon"); + chatButton.click(); + var chatInput = chrome$("#chatinput"); + var chatText = chrome$("#chattext"); + + this.timeout(60000); + + var messages = 140; + for(var i=1; i <= messages; i++) { + var num = ''+i; + if(num.length == 1) + num = '00'+num; + if(num.length == 2) + num = '0'+num; + chatInput.sendkeys('msg' + num); + chatInput.sendkeys('{enter}'); + } + helper.waitFor(function(){ + return chatText.children("p").length == messages; + }, 60000).always(function(){ + expect(chatText.children("p").length).to.be(messages); + helper.newPad(done, padName); + }); + }); + + it("checks initial message count", function(done) { + var chatText; + var expectedCount = 101; + var chrome$ = helper.padChrome$; + helper.waitFor(function(){ + var chatButton = chrome$("#chaticon"); + chatButton.click(); + chatText = chrome$("#chattext"); + return chatText.children("p").length == expectedCount; + }).always(function(){ + expect(chatText.children("p").length).to.be(expectedCount); + done(); + }); + }); + + it("loads more messages", function(done) { + var expectedCount = 122; + var chrome$ = helper.padChrome$; + var chatButton = chrome$("#chaticon"); + chatButton.click(); + var chatText = chrome$("#chattext"); + var loadMsgBtn = chrome$("#chatloadmessagesbutton"); + + loadMsgBtn.click(); + helper.waitFor(function(){ + return chatText.children("p").length == expectedCount; + }).always(function(){ + expect(chatText.children("p").length).to.be(expectedCount); + done(); + }); + }); + + it("checks for button vanishing", function(done) { + var expectedDisplay = 'none'; + var chrome$ = helper.padChrome$; + var chatButton = chrome$("#chaticon"); + chatButton.click(); + var chatText = chrome$("#chattext"); + var loadMsgBtn = chrome$("#chatloadmessagesbutton"); + var loadMsgBall = chrome$("#chatloadmessagesball"); + + loadMsgBtn.click(); + helper.waitFor(function(){ + return loadMsgBtn.css('display') == expectedDisplay && + loadMsgBall.css('display') == expectedDisplay; + }).always(function(){ + expect(loadMsgBtn.css('display')).to.be(expectedDisplay); + expect(loadMsgBall.css('display')).to.be(expectedDisplay); + done(); + }); + }); +}); diff --git a/tests/frontend/specs/keystroke_chat.js b/tests/frontend/specs/keystroke_chat.js index d6a7d2fd4..060c5aa2f 100644 --- a/tests/frontend/specs/keystroke_chat.js +++ b/tests/frontend/specs/keystroke_chat.js @@ -36,4 +36,31 @@ describe("send chat message", function(){ }); }); + + it("makes sure that an empty message can't be sent", function(done) { + var inner$ = helper.padInner$; + var chrome$ = helper.padChrome$; + + //click on the chat button to make chat visible + var $chatButton = chrome$("#chaticon"); + $chatButton.click(); + var $chatInput = chrome$("#chatinput"); + $chatInput.sendkeys('{enter}'); // simulate a keypress of enter (to send an empty message) + $chatInput.sendkeys('mluto'); // simulate a keypress of typing mluto + $chatInput.sendkeys('{enter}'); // simulate a keypress of enter (to send 'mluto') + + //check if chat shows up + helper.waitFor(function(){ + return chrome$("#chattext").children("p").length !== 0; // wait until the chat message shows up + }).done(function(){ + // check that the empty message is not there + expect(chrome$("#chattext").children("p").length).to.be(1); + // check that the received message is not the empty one + var $firstChatMessage = chrome$("#chattext").children("p"); + var containsMessage = $firstChatMessage.text().indexOf("mluto") !== -1; + expect(containsMessage).to.be(true); + done(); + }); + + }); });