From f7b46f6e69b5c47c37d045ce98570c9bbb31e821 Mon Sep 17 00:00:00 2001 From: Peter 'Pita' Martischka Date: Mon, 30 May 2011 15:53:11 +0100 Subject: [PATCH] Documentation --- doc/jsdoc/AttributePoolFactory.md | 34 +-- doc/jsdoc/AuthorManager.md | 64 ++--- doc/jsdoc/Changeset.md | 381 ++++++++++++++---------------- doc/jsdoc/MessageHandler.md | 36 +-- doc/jsdoc/Models/Pad.md | 15 +- doc/jsdoc/PadManager.md | 32 +-- doc/jsdoc/db.md | 25 +- doc/jsdoc/easysync_tests.md | 19 +- doc/jsdoc/minify.md | 35 +-- doc/jsdoc/server.md | 19 +- doc/jsdoc/settings.md | 40 ++-- node/AttributePoolFactory.js | 8 + node/AuthorManager.js | 21 +- node/Changeset.js | 7 +- node/MessageHandler.js | 4 + node/Models/Pad.js | 6 +- node/PadManager.js | 13 +- node/db.js | 13 +- node/easysync_tests.js | 6 + node/minify.js | 7 + node/server.js | 6 + node/settings.js | 24 +- 22 files changed, 368 insertions(+), 447 deletions(-) diff --git a/doc/jsdoc/AttributePoolFactory.md b/doc/jsdoc/AttributePoolFactory.md index 0fd3cdfa0..29fee091f 100644 --- a/doc/jsdoc/AttributePoolFactory.md +++ b/doc/jsdoc/AttributePoolFactory.md @@ -1,32 +1,14 @@ -#AttributePoolFactory +# AttributePoolFactory `require("./AttributePoolFactory");` -Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This code represents the Attribute Pool Object of the original Etherpad. +90% of the code is still like in the original Etherpad +Look at https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2.js +You can find a explanation what a attribute pool is here: +https://github.com/Pita/etherpad-lite/blob/master/doc/easysync/easysync-notes.txt -##Functions +## Functions -###createAttributePool () -Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +### createAttributePool () -* **** - -##Variables diff --git a/doc/jsdoc/AuthorManager.md b/doc/jsdoc/AuthorManager.md index 9b2bdbbe4..6cfdf27c8 100644 --- a/doc/jsdoc/AuthorManager.md +++ b/doc/jsdoc/AuthorManager.md @@ -1,59 +1,41 @@ -#AuthorManager +# AuthorManager `require("./AuthorManager");` -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The AuthorManager controlls all information about the Pad authors -##Functions +## Functions -###getAuthor4Token (token, callback) -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +### getAuthor4Token (token, callback) +Returns the Author Id for a token. If the token is unkown, +it creates a author for the token -* **token** The token -* **callback** +* **token** *(String)* The token +* **callback** *(Function)* callback (err, author) +The callback function that is called when the result is here -###getAuthorColorId (author, callback) +### getAuthorColorId (author, callback) Returns the color Id of the author -* **author** -* **callback** +* **author** *(String)* The id of the author +* **callback** *(Function)* callback(err, colorId) -###getAuthorName (author, callback) +### getAuthorName (author, callback) Returns the name of the author -* **author** -* **callback** +* **author** *(String)* The id of the author +* **callback** *(Function)* callback(err, name) -###setAuthorColorId (author, colorId, callback) +### setAuthorColorId (author, colorId, callback) Sets the color Id of the author -* **author** -* **colorId** -* **callback** +* **author** *(String)* The id of the author +* **colorId** *No description* +* **callback** *(Function)* (optional) -###setAuthorName (author, name, callback) +### setAuthorName (author, name, callback) Sets the name of the author -* **author** -* **name** -* **callback** - -##Variables +* **author** *(String)* The id of the author +* **name** *No description* +* **callback** *(Function)* (optional) diff --git a/doc/jsdoc/Changeset.md b/doc/jsdoc/Changeset.md index 3fb2e8be7..e2e07e68c 100644 --- a/doc/jsdoc/Changeset.md +++ b/doc/jsdoc/Changeset.md @@ -1,328 +1,303 @@ -#Changeset +# Changeset `require("./Changeset");` -Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +## Functions -##Functions +### _slicerZipperFunc (attOp, csOp, opOut, pool) -###_slicerZipperFunc (attOp, csOp, opOut, pool) +* **attOp** *No description* +* **csOp** *No description* +* **opOut** *No description* +* **pool** *No description* -* **attOp** -* **csOp** -* **opOut** -* **pool** +### appendATextToAssembler (atext, assem) -###appendATextToAssembler (atext, assem) +* **atext** *No description* +* **assem** *No description* -* **atext** -* **assem** +### applyToAText (cs, atext, pool) -###applyToAText (cs, atext, pool) +* **cs** *No description* +* **atext** *No description* +* **pool** *No description* -* **cs** -* **atext** -* **pool** +### applyToAttribution (cs, astr, pool) -###applyToAttribution (cs, astr, pool) +* **cs** *No description* +* **astr** *No description* +* **pool** *No description* -* **cs** -* **astr** -* **pool** +### applyToText (cs, str) -###applyToText (cs, str) +* **cs** *No description* +* **str** *No description* -* **cs** -* **str** +### applyZip (in1, idx1, in2, idx2, func) -###applyZip (in1, idx1, in2, idx2, func) +* **in1** *No description* +* **idx1** *No description* +* **in2** *No description* +* **idx2** *No description* +* **func** *No description* -* **in1** -* **idx1** -* **in2** -* **idx2** -* **func** +### attribsAttributeValue (attribs, key, pool) -###attribsAttributeValue (attribs, key, pool) +* **attribs** *No description* +* **key** *No description* +* **pool** *No description* -* **attribs** -* **key** -* **pool** +### attributeTester (attribPair, pool) -###attributeTester (attribPair, pool) +* **attribPair** *No description* +* **pool** *No description* -* **attribPair** -* **pool** +### builder (oldLen) -###builder (oldLen) +* **oldLen** *No description* -* **oldLen** +### characterRangeFollow (cs, startChar, endChar, insertionsAfter) -###characterRangeFollow (cs, startChar, endChar, insertionsAfter) +* **cs** *No description* +* **startChar** *No description* +* **endChar** *No description* +* **insertionsAfter** *No description* -* **cs** -* **startChar** -* **endChar** -* **insertionsAfter** +### checkRep (cs) -###checkRep (cs) +* **cs** *No description* -* **cs** +### clearOp (op) -###clearOp (op) +* **op** *No description* -* **op** +### cloneAText (atext) -###cloneAText (atext) +* **atext** *No description* -* **atext** +### cloneOp (op) -###cloneOp (op) +* **op** *No description* -* **op** +### compose (cs1, cs2, pool) -###compose (cs1, cs2, pool) +* **cs1** *No description* +* **cs2** *No description* +* **pool** *No description* -* **cs1** -* **cs2** -* **pool** +### composeAttributes (att1, att2, resultIsMutation, pool) -###composeAttributes (att1, att2, resultIsMutation, pool) +* **att1** *No description* +* **att2** *No description* +* **resultIsMutation** *No description* +* **pool** *No description* -* **att1** -* **att2** -* **resultIsMutation** -* **pool** +### copyAText (atext1, atext2) -###copyAText (atext1, atext2) +* **atext1** *No description* +* **atext2** *No description* -* **atext1** -* **atext2** +### copyOp (op1, op2) -###copyOp (op1, op2) +* **op1** *No description* +* **op2** *No description* -* **op1** -* **op2** +### eachAttribNumber (cs, func) -###eachAttribNumber (cs, func) +* **cs** *No description* +* **func** *No description* -* **cs** -* **func** +### filterAttribNumbers (cs, filter) -###filterAttribNumbers (cs, filter) +* **cs** *No description* +* **filter** *No description* -* **cs** -* **filter** +### follow (cs1, cs2, reverseInsertOrder, pool) -###follow (cs1, cs2, reverseInsertOrder, pool) +* **cs1** *No description* +* **cs2** *No description* +* **reverseInsertOrder** *No description* +* **pool** *No description* -* **cs1** -* **cs2** -* **reverseInsertOrder** -* **pool** +### followAttributes (att1, att2, pool) -###followAttributes (att1, att2, pool) +* **att1** *No description* +* **att2** *No description* +* **pool** *No description* -* **att1** -* **att2** -* **pool** +### identity (N) -###identity (N) +* **N** *No description* -* **N** +### inverse (cs, lines, alines, pool) -###inverse (cs, lines, alines, pool) +* **cs** *No description* +* **lines** *No description* +* **alines** *No description* +* **pool** *No description* -* **cs** -* **lines** -* **alines** -* **pool** +### isIdentity (cs) -###isIdentity (cs) +* **cs** *No description* -* **cs** +### joinAttributionLines (theAlines) -###joinAttributionLines (theAlines) +* **theAlines** *No description* -* **theAlines** +### makeAText (text, attribs) -###makeAText (text, attribs) +* **text** *No description* +* **attribs** *No description* -* **text** -* **attribs** +### makeAttribsString (opcode, attribs, pool) -###makeAttribsString (opcode, attribs, pool) +* **opcode** *No description* +* **attribs** *No description* +* **pool** *No description* -* **opcode** -* **attribs** -* **pool** +### makeAttribution (text) -###makeAttribution (text) +* **text** *No description* -* **text** +### makeSplice (oldFullText, spliceStart, numRemoved, newText, optNewTextAPairs, pool) -###makeSplice (oldFullText, spliceStart, numRemoved, newText, optNewTextAPairs, pool) +* **oldFullText** *No description* +* **spliceStart** *No description* +* **numRemoved** *No description* +* **newText** *No description* +* **optNewTextAPairs** *No description* +* **pool** *No description* -* **oldFullText** -* **spliceStart** -* **numRemoved** -* **newText** -* **optNewTextAPairs** -* **pool** +### mapAttribNumbers (cs, func) -###mapAttribNumbers (cs, func) +* **cs** *No description* +* **func** *No description* -* **cs** -* **func** +### mergingOpAssembler () -###mergingOpAssembler () -* **** +### moveOpsToNewPool (cs, oldPool, newPool) -###moveOpsToNewPool (cs, oldPool, newPool) +* **cs** *No description* +* **oldPool** *No description* +* **newPool** *No description* -* **cs** -* **oldPool** -* **newPool** +### mutateAttributionLines (cs, lines, pool) -###mutateAttributionLines (cs, lines, pool) -Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +* **cs** *No description* +* **lines** *No description* +* **pool** *No description* -* **cs** -* **lines** -* **pool** +### mutateTextLines (cs, lines) -###mutateTextLines (cs, lines) +* **cs** *No description* +* **lines** *No description* -* **cs** -* **lines** +### newLen (cs) -###newLen (cs) +* **cs** *No description* -* **cs** +### newOp (optOpcode) -###newOp (optOpcode) +* **optOpcode** *No description* -* **optOpcode** +### numToString (num) -###numToString (num) +* **num** *No description* -* **num** +### oldLen (cs) -###oldLen (cs) +* **cs** *No description* -* **cs** +### oneInsertedLineAtATimeOpIterator (opsStr, optStartIndex, charBank) -###oneInsertedLineAtATimeOpIterator (opsStr, optStartIndex, charBank) +* **opsStr** *No description* +* **optStartIndex** *No description* +* **charBank** *No description* -* **opsStr** -* **optStartIndex** -* **charBank** +### opAssembler () -###opAssembler () -* **** +### opAttributeValue (op, key, pool) -###opAttributeValue (op, key, pool) +* **op** *No description* +* **key** *No description* +* **pool** *No description* -* **op** -* **key** -* **pool** +### opIterator (opsStr, optStartIndex) -###opIterator (opsStr, optStartIndex) +* **opsStr** *No description* +* **optStartIndex** *No description* -* **opsStr** -* **optStartIndex** +### opString (op) -###opString (op) +* **op** *No description* -* **op** +### pack (oldLen, newLen, opsStr, bank) -###pack (oldLen, newLen, opsStr, bank) +* **oldLen** *No description* +* **newLen** *No description* +* **opsStr** *No description* +* **bank** *No description* -* **oldLen** -* **newLen** -* **opsStr** -* **bank** +### parseNum (str) -###parseNum (str) +* **str** *No description* -* **str** +### prepareForWire (cs, pool) -###prepareForWire (cs, pool) +* **cs** *No description* +* **pool** *No description* -* **cs** -* **pool** +### smartOpAssembler () -###smartOpAssembler () -* **** +### splitAttributionLines (attrOps, text) -###splitAttributionLines (attrOps, text) +* **attrOps** *No description* +* **text** *No description* -* **attrOps** -* **text** +### splitTextLines (text) -###splitTextLines (text) +* **text** *No description* -* **text** +### stringAssembler () -###stringAssembler () -* **** +### stringIterator (str) -###stringIterator (str) +* **str** *No description* -* **str** +### stringOp (str) -###stringOp (str) +* **str** *No description* -* **str** +### subattribution (astr, start, optEnd) -###subattribution (astr, start, optEnd) +* **astr** *No description* +* **start** *No description* +* **optEnd** *No description* -* **astr** -* **start** -* **optEnd** +### textLinesMutator (lines) -###textLinesMutator (lines) +* **lines** *No description* -* **lines** +### toBaseTen (cs) -###toBaseTen (cs) +* **cs** *No description* -* **cs** +### toSplices (cs) -###toSplices (cs) +* **cs** *No description* -* **cs** +### unpack (cs) -###unpack (cs) - -* **cs** +* **cs** *No description* ##Variables -###assert +### assert -###error +### error diff --git a/doc/jsdoc/MessageHandler.md b/doc/jsdoc/MessageHandler.md index 0b93994b4..1aa7ecd57 100644 --- a/doc/jsdoc/MessageHandler.md +++ b/doc/jsdoc/MessageHandler.md @@ -1,48 +1,28 @@ -#MessageHandler +# MessageHandler `require("./MessageHandler");` -Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The MessageHandler handles all Messages that comes from Socket.IO and controls the sessions -##Functions +## Functions -###handleConnect (client) +### handleConnect (client) Handles the connection of a new user * **client** the new client -###handleDisconnect (client) +### handleDisconnect (client) Handles the disconnection of a user * **client** the client that leaves -###handleMessage (client, message) +### handleMessage (client, message) Handles a message from a user * **client** the client that send this message * **message** the message from the client -###setSocketIO (socket_io) -Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +### setSocketIO (socket_io) +A associative array that translates a session to a pad * **socket_io** The Socket -##Variables - diff --git a/doc/jsdoc/Models/Pad.md b/doc/jsdoc/Models/Pad.md index e9d53d1e4..3ef7b0d9d 100644 --- a/doc/jsdoc/Models/Pad.md +++ b/doc/jsdoc/Models/Pad.md @@ -1,15 +1,12 @@ -#Mod +# Mod `require("./Models/Pad");` -Copied from the Etherpad source code, don't know what its good for -@param txt +The pad object, defined with joose -##Functions +## Functions -###cleanText (txt) -Copied from the Etherpad source code, don't know what its good for +### cleanText (txt) +Copied from the Etherpad source code. It converts Windows line breaks to Unix line breaks and convert Tabs to spaces -* **txt** - -##Variables +* **txt** *No description* diff --git a/doc/jsdoc/PadManager.md b/doc/jsdoc/PadManager.md index 1e21b03d2..fd2aaf5be 100644 --- a/doc/jsdoc/PadManager.md +++ b/doc/jsdoc/PadManager.md @@ -1,33 +1,13 @@ -#PadManager +# PadManager `require("./PadManager");` -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The Pad Manager is a Factory for pad Objects -##Functions +## Functions -###getPad (id, callback) -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +### getPad (id, callback) +A Array with all known Pads * **id** A String with the id of the pad -* **callback** - -##Variables +* **callback** *(Function)* *No description* diff --git a/doc/jsdoc/db.md b/doc/jsdoc/db.md index 45f55c5c9..0e835e7bc 100644 --- a/doc/jsdoc/db.md +++ b/doc/jsdoc/db.md @@ -1,25 +1,18 @@ -#db +# db `require("./db");` -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +The DB Module provides a database initalized with the settings +provided by the settings module -##Functions +## Functions -###init (callback) +### init (callback) +Initalizes the database with the settings provided by the settings module -* **callback** +* **callback** *(Function)* *No description* ##Variables -###db - +### db +The UeberDB Object that provides the database functions diff --git a/doc/jsdoc/easysync_tests.md b/doc/jsdoc/easysync_tests.md index 089548bb5..0a9a7b448 100644 --- a/doc/jsdoc/easysync_tests.md +++ b/doc/jsdoc/easysync_tests.md @@ -1,18 +1,7 @@ -#easysync_tests +# easysync_tests `require("./easysync_tests");` -Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -##Functions - -##Variables +I found this tests in the old Etherpad and used it to test if the Changeset library can be run on node.js. +It has no use for ep-lite, but I thought I keep it cause it may help someone to understand the Changeset library +https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2_tests.js diff --git a/doc/jsdoc/minify.md b/doc/jsdoc/minify.md index 39c0ba621..d5a0c890d 100644 --- a/doc/jsdoc/minify.md +++ b/doc/jsdoc/minify.md @@ -1,33 +1,14 @@ -#minify +# minify `require("./minify");` -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +This Module manages all /minified/* requests. It controls the +minification && compression of Javascript and CSS. -##Functions +## Functions -###padJS (req, res) -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. +### padJS (req, res) +Answers a http request for the pad javascript -* **req** -* **res** - -##Variables +* **req** the Express request +* **res** the Express response diff --git a/doc/jsdoc/server.md b/doc/jsdoc/server.md index b1b86af07..405b851f3 100644 --- a/doc/jsdoc/server.md +++ b/doc/jsdoc/server.md @@ -1,21 +1,12 @@ -#server +# server `require("./server");` -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -##Functions +This module is started with bin/run.sh. It sets up a Express HTTP and a Socket.IO Server. +Static file Requests are answered directly from this module, Socket.IO messages are passed +to MessageHandler and minfied requests are passed to minified. ##Variables -###maxAge +### maxAge diff --git a/doc/jsdoc/settings.md b/doc/jsdoc/settings.md index fd7154378..5137b9c86 100644 --- a/doc/jsdoc/settings.md +++ b/doc/jsdoc/settings.md @@ -1,36 +1,26 @@ -#settings +# settings `require("./settings");` -2011 Peter 'Pita' Martischka -* Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at -* http://www.apache.org/licenses/LICENSE-2.0 -* Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS-IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. - -##Functions +The Settings Modul reads the settings out of settings.json and provides +this information to the other modules ##Variables -###dbSettings +### dbSettings +This setting is passed with dbType to ueberDB to set up the database + +### dbType -###dbType +### defaultPadText +The default Text of a new pad +### logHTTP +A flag that shows if http requests should be loged to stdout -###defaultPadText - - -###logHTTP - - -###minify - - -###port +### minify +A flag that shows if minification is enabled or not +### port +The Port ep-lite should listen to diff --git a/node/AttributePoolFactory.js b/node/AttributePoolFactory.js index 8d8a1b427..55aecf612 100644 --- a/node/AttributePoolFactory.js +++ b/node/AttributePoolFactory.js @@ -1,4 +1,12 @@ /** + * This code represents the Attribute Pool Object of the original Etherpad. + * 90% of the code is still like in the original Etherpad + * Look at https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2.js + * You can find a explanation what a attribute pool is here: + * https://github.com/Pita/etherpad-lite/blob/master/doc/easysync/easysync-notes.txt + */ + +/* * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/node/AuthorManager.js b/node/AuthorManager.js index 3140b93ba..fa032e440 100644 --- a/node/AuthorManager.js +++ b/node/AuthorManager.js @@ -1,4 +1,8 @@ /** + * The AuthorManager controlls all information about the Pad authors + */ + +/* * 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,18 +18,15 @@ * limitations under the License. */ - -/** - * The AuthorManager controlls all information about the Pad authors - */ - var db = require("./db").db; var async = require("async"); /** * Returns the Author Id for a token. If the token is unkown, * it creates a author for the token - * @param token The token + * @param token {String} The token + * @param callback {Function} callback (err, author) + * The callback function that is called when the result is here */ exports.getAuthor4Token = function (token, callback) { @@ -73,6 +74,8 @@ exports.getAuthor4Token = function (token, callback) /** * Returns the color Id of the author + * @param author {String} The id of the author + * @param callback {Function} callback(err, colorId) */ exports.getAuthorColorId = function (author, callback) { @@ -81,6 +84,8 @@ exports.getAuthorColorId = function (author, callback) /** * Sets the color Id of the author + * @param author {String} The id of the author + * @param callback {Function} (optional) */ exports.setAuthorColorId = function (author, colorId, callback) { @@ -89,6 +94,8 @@ exports.setAuthorColorId = function (author, colorId, callback) /** * Returns the name of the author + * @param author {String} The id of the author + * @param callback {Function} callback(err, name) */ exports.getAuthorName = function (author, callback) { @@ -97,6 +104,8 @@ exports.getAuthorName = function (author, callback) /** * Sets the name of the author + * @param author {String} The id of the author + * @param callback {Function} (optional) */ exports.setAuthorName = function (author, name, callback) { diff --git a/node/Changeset.js b/node/Changeset.js index d2acbd0a4..ea2ac678b 100644 --- a/node/Changeset.js +++ b/node/Changeset.js @@ -1,4 +1,9 @@ -/** +/* + * This is the Changeset library copied from the old Etherpad with some modifications to use it in node.js + * Can be found in https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2.js + */ + +/* * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/node/MessageHandler.js b/node/MessageHandler.js index 930820384..21acb4064 100644 --- a/node/MessageHandler.js +++ b/node/MessageHandler.js @@ -1,4 +1,8 @@ /** + * The MessageHandler handles all Messages that comes from Socket.IO and controls the sessions + */ + +/* * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/node/Models/Pad.js b/node/Models/Pad.js index b7f9bb95b..64b444450 100644 --- a/node/Models/Pad.js +++ b/node/Models/Pad.js @@ -1,3 +1,7 @@ +/** + * The pad object, defined with joose + */ + var Changeset = require("../Changeset"); var AttributePoolFactory = require("../AttributePoolFactory"); var db = require("../db").db; @@ -5,7 +9,7 @@ var async = require("async"); var settings = require('../settings'); /** - * Copied from the Etherpad source code, don't know what its good for + * Copied from the Etherpad source code. It converts Windows line breaks to Unix line breaks and convert Tabs to spaces * @param txt */ exports.cleanText = function (txt) { diff --git a/node/PadManager.js b/node/PadManager.js index 5255c2ffd..ae4be3227 100644 --- a/node/PadManager.js +++ b/node/PadManager.js @@ -1,4 +1,8 @@ /** + * The Pad Manager is a Factory for pad Objects + */ + +/* * 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +18,6 @@ * limitations under the License. */ -/* -The Pad Module trys to simulate the pad object from EtherPad. You can find the original code in /etherpad/src/etherpad/pad/model.js -see https://github.com/ether/pad/blob/master/etherpad/src/etherpad/pad/model.js -*/ - var Changeset = require("./Models/Pad"); /** @@ -27,9 +26,9 @@ var Changeset = require("./Models/Pad"); globalPads = []; /** - * Return a Function Wrapper to work with the Pad + * Returns a Pad Object with the callback * @param id A String with the id of the pad - * @param createIfNotExist A Boolean which says the function if it should create the Pad if it not exist + * @param callback {Function} */ exports.getPad = function(id, callback) { diff --git a/node/db.js b/node/db.js index b91fd7a79..3656b6c6d 100644 --- a/node/db.js +++ b/node/db.js @@ -1,4 +1,9 @@ /** + * The DB Module provides a database initalized with the settings + * provided by the settings module + */ + +/* * 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -20,9 +25,15 @@ var settings = require("./settings"); //set database settings var db = new ueberDB.database(settings.dbType, settings.dbSettings); -//set the exported db to null, we will set it in intalize +/** + * The UeberDB Object that provides the database functions + */ exports.db = null; +/** + * Initalizes the database with the settings provided by the settings module + * @param callback {Function} + */ exports.init = function(callback) { //initalize the database async diff --git a/node/easysync_tests.js b/node/easysync_tests.js index b650d38f2..9eb68ec17 100644 --- a/node/easysync_tests.js +++ b/node/easysync_tests.js @@ -1,4 +1,10 @@ /** + * I found this tests in the old Etherpad and used it to test if the Changeset library can be run on node.js. + * It has no use for ep-lite, but I thought I keep it cause it may help someone to understand the Changeset library + * https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2_tests.js + */ + +/* * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/node/minify.js b/node/minify.js index 0ec7f4edc..7245b214f 100644 --- a/node/minify.js +++ b/node/minify.js @@ -1,4 +1,9 @@ /** + * This Module manages all /minified/* requests. It controls the + * minification && compression of Javascript and CSS. + */ + +/* * 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -27,6 +32,8 @@ var server = require('./server'); /** * Answers a http request for the pad javascript + * @param req the Express request + * @param res the Express response */ exports.padJS = function(req, res) { diff --git a/node/server.js b/node/server.js index 4cfb310b0..4fd8a3365 100644 --- a/node/server.js +++ b/node/server.js @@ -1,4 +1,10 @@ /** + * This module is started with bin/run.sh. It sets up a Express HTTP and a Socket.IO Server. + * Static file Requests are answered directly from this module, Socket.IO messages are passed + * to MessageHandler and minfied requests are passed to minified. + */ + +/* * 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/node/settings.js b/node/settings.js index ee2c90003..19f7eab1f 100644 --- a/node/settings.js +++ b/node/settings.js @@ -1,4 +1,9 @@ /** + * The Settings Modul reads the settings out of settings.json and provides + * this information to the other modules + */ + +/* * 2011 Peter 'Pita' Martischka * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -16,12 +21,29 @@ var fs = require("fs"); -//default settings +/** + * The Port ep-lite should listen to + */ exports.port = 9001; +/* + * The Type of the database + */ exports.dbType = "sqlite"; +/** + * This setting is passed with dbType to ueberDB to set up the database + */ exports.dbSettings = { "filename" : "../var/sqlite.db" }; +/** + * A flag that shows if http requests should be loged to stdout + */ exports.logHTTP = true; +/** + * The default Text of a new pad + */ exports.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\nEtherpad Lite on Github: http:\/\/j.mp/ep-lite\n"; +/** + * A flag that shows if minification is enabled or not + */ exports.minify = true; //read the settings sync