Documentation

pull/35/head
Peter 'Pita' Martischka 2011-05-30 15:53:11 +01:00
parent 88297a99ef
commit f7b46f6e69
22 changed files with 368 additions and 447 deletions

View File

@ -1,32 +1,14 @@
#AttributePoolFactory # AttributePoolFactory
`require("./AttributePoolFactory");` `require("./AttributePoolFactory");`
Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka This code represents the Attribute Pool Object of the original Etherpad.
* Licensed under the Apache License, Version 2.0 (the "License"); 90% of the code is still like in the original Etherpad
you may not use this file except in compliance with the License. Look at https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2.js
You may obtain a copy of the License at You can find a explanation what a attribute pool is here:
* http://www.apache.org/licenses/LICENSE-2.0 https://github.com/Pita/etherpad-lite/blob/master/doc/easysync/easysync-notes.txt
* 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
###createAttributePool () ### 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.
* ****
##Variables

View File

@ -1,59 +1,41 @@
#AuthorManager # AuthorManager
`require("./AuthorManager");` `require("./AuthorManager");`
2011 Peter 'Pita' Martischka The AuthorManager controlls all information about the Pad authors
* 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
###getAuthor4Token (token, callback) ### getAuthor4Token (token, callback)
2011 Peter 'Pita' Martischka Returns the Author Id for a token. If the token is unkown,
* Licensed under the Apache License, Version 2.0 (the "License"); it creates a author for the token
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.
* **token** The token * **token** *(String)* The token
* **callback** * **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 Returns the color Id of the author
* **author** * **author** *(String)* The id of the author
* **callback** * **callback** *(Function)* callback(err, colorId)
###getAuthorName (author, callback) ### getAuthorName (author, callback)
Returns the name of the author Returns the name of the author
* **author** * **author** *(String)* The id of the author
* **callback** * **callback** *(Function)* callback(err, name)
###setAuthorColorId (author, colorId, callback) ### setAuthorColorId (author, colorId, callback)
Sets the color Id of the author Sets the color Id of the author
* **author** * **author** *(String)* The id of the author
* **colorId** * **colorId** *No description*
* **callback** * **callback** *(Function)* (optional)
###setAuthorName (author, name, callback) ### setAuthorName (author, name, callback)
Sets the name of the author Sets the name of the author
* **author** * **author** *(String)* The id of the author
* **name** * **name** *No description*
* **callback** * **callback** *(Function)* (optional)
##Variables

View File

@ -1,328 +1,303 @@
#Changeset # Changeset
`require("./Changeset");` `require("./Changeset");`
Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka ## Functions
* 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 ### _slicerZipperFunc (attOp, csOp, opOut, pool)
###_slicerZipperFunc (attOp, csOp, opOut, pool) * **attOp** *No description*
* **csOp** *No description*
* **opOut** *No description*
* **pool** *No description*
* **attOp** ### appendATextToAssembler (atext, assem)
* **csOp**
* **opOut**
* **pool**
###appendATextToAssembler (atext, assem) * **atext** *No description*
* **assem** *No description*
* **atext** ### applyToAText (cs, atext, pool)
* **assem**
###applyToAText (cs, atext, pool) * **cs** *No description*
* **atext** *No description*
* **pool** *No description*
* **cs** ### applyToAttribution (cs, astr, pool)
* **atext**
* **pool**
###applyToAttribution (cs, astr, pool) * **cs** *No description*
* **astr** *No description*
* **pool** *No description*
* **cs** ### applyToText (cs, str)
* **astr**
* **pool**
###applyToText (cs, str) * **cs** *No description*
* **str** *No description*
* **cs** ### applyZip (in1, idx1, in2, idx2, func)
* **str**
###applyZip (in1, idx1, in2, idx2, func) * **in1** *No description*
* **idx1** *No description*
* **in2** *No description*
* **idx2** *No description*
* **func** *No description*
* **in1** ### attribsAttributeValue (attribs, key, pool)
* **idx1**
* **in2**
* **idx2**
* **func**
###attribsAttributeValue (attribs, key, pool) * **attribs** *No description*
* **key** *No description*
* **pool** *No description*
* **attribs** ### attributeTester (attribPair, pool)
* **key**
* **pool**
###attributeTester (attribPair, pool) * **attribPair** *No description*
* **pool** *No description*
* **attribPair** ### builder (oldLen)
* **pool**
###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** ### checkRep (cs)
* **startChar**
* **endChar**
* **insertionsAfter**
###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** ### composeAttributes (att1, att2, resultIsMutation, pool)
* **cs2**
* **pool**
###composeAttributes (att1, att2, resultIsMutation, pool) * **att1** *No description*
* **att2** *No description*
* **resultIsMutation** *No description*
* **pool** *No description*
* **att1** ### copyAText (atext1, atext2)
* **att2**
* **resultIsMutation**
* **pool**
###copyAText (atext1, atext2) * **atext1** *No description*
* **atext2** *No description*
* **atext1** ### copyOp (op1, op2)
* **atext2**
###copyOp (op1, op2) * **op1** *No description*
* **op2** *No description*
* **op1** ### eachAttribNumber (cs, func)
* **op2**
###eachAttribNumber (cs, func) * **cs** *No description*
* **func** *No description*
* **cs** ### filterAttribNumbers (cs, filter)
* **func**
###filterAttribNumbers (cs, filter) * **cs** *No description*
* **filter** *No description*
* **cs** ### follow (cs1, cs2, reverseInsertOrder, pool)
* **filter**
###follow (cs1, cs2, reverseInsertOrder, pool) * **cs1** *No description*
* **cs2** *No description*
* **reverseInsertOrder** *No description*
* **pool** *No description*
* **cs1** ### followAttributes (att1, att2, pool)
* **cs2**
* **reverseInsertOrder**
* **pool**
###followAttributes (att1, att2, pool) * **att1** *No description*
* **att2** *No description*
* **pool** *No description*
* **att1** ### identity (N)
* **att2**
* **pool**
###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** ### isIdentity (cs)
* **lines**
* **alines**
* **pool**
###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** ### makeAttribsString (opcode, attribs, pool)
* **attribs**
###makeAttribsString (opcode, attribs, pool) * **opcode** *No description*
* **attribs** *No description*
* **pool** *No description*
* **opcode** ### makeAttribution (text)
* **attribs**
* **pool**
###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** ### mapAttribNumbers (cs, func)
* **spliceStart**
* **numRemoved**
* **newText**
* **optNewTextAPairs**
* **pool**
###mapAttribNumbers (cs, func) * **cs** *No description*
* **func** *No description*
* **cs** ### mergingOpAssembler ()
* **func**
###mergingOpAssembler ()
* **** ### moveOpsToNewPool (cs, oldPool, newPool)
###moveOpsToNewPool (cs, oldPool, newPool) * **cs** *No description*
* **oldPool** *No description*
* **newPool** *No description*
* **cs** ### mutateAttributionLines (cs, lines, pool)
* **oldPool**
* **newPool**
###mutateAttributionLines (cs, lines, pool) * **cs** *No description*
Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka * **lines** *No description*
* Licensed under the Apache License, Version 2.0 (the "License"); * **pool** *No description*
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** ### mutateTextLines (cs, lines)
* **lines**
* **pool**
###mutateTextLines (cs, lines) * **cs** *No description*
* **lines** *No description*
* **cs** ### newLen (cs)
* **lines**
###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** ### opAssembler ()
* **optStartIndex**
* **charBank**
###opAssembler ()
* **** ### opAttributeValue (op, key, pool)
###opAttributeValue (op, key, pool) * **op** *No description*
* **key** *No description*
* **pool** *No description*
* **op** ### opIterator (opsStr, optStartIndex)
* **key**
* **pool**
###opIterator (opsStr, optStartIndex) * **opsStr** *No description*
* **optStartIndex** *No description*
* **opsStr** ### opString (op)
* **optStartIndex**
###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** ### parseNum (str)
* **newLen**
* **opsStr**
* **bank**
###parseNum (str) * **str** *No description*
* **str** ### prepareForWire (cs, pool)
###prepareForWire (cs, pool) * **cs** *No description*
* **pool** *No description*
* **cs** ### smartOpAssembler ()
* **pool**
###smartOpAssembler ()
* **** ### splitAttributionLines (attrOps, text)
###splitAttributionLines (attrOps, text) * **attrOps** *No description*
* **text** *No description*
* **attrOps** ### splitTextLines (text)
* **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** ### textLinesMutator (lines)
* **start**
* **optEnd**
###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** *No description*
* **cs**
##Variables ##Variables
###assert ### assert
###error ### error

View File

@ -1,48 +1,28 @@
#MessageHandler # MessageHandler
`require("./MessageHandler");` `require("./MessageHandler");`
Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka The MessageHandler handles all Messages that comes from Socket.IO and controls the sessions
* 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
###handleConnect (client) ### handleConnect (client)
Handles the connection of a new user Handles the connection of a new user
* **client** the new client * **client** the new client
###handleDisconnect (client) ### handleDisconnect (client)
Handles the disconnection of a user Handles the disconnection of a user
* **client** the client that leaves * **client** the client that leaves
###handleMessage (client, message) ### handleMessage (client, message)
Handles a message from a user Handles a message from a user
* **client** the client that send this message * **client** the client that send this message
* **message** the message from the client * **message** the message from the client
###setSocketIO (socket_io) ### setSocketIO (socket_io)
Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka A associative array that translates a session to a pad
* 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.
* **socket_io** The Socket * **socket_io** The Socket
##Variables

View File

@ -1,15 +1,12 @@
#Mod # Mod
`require("./Models/Pad");` `require("./Models/Pad");`
Copied from the Etherpad source code, don't know what its good for The pad object, defined with joose
@param txt
##Functions ## Functions
###cleanText (txt) ### cleanText (txt)
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
* **txt** * **txt** *No description*
##Variables

View File

@ -1,33 +1,13 @@
#PadManager # PadManager
`require("./PadManager");` `require("./PadManager");`
2011 Peter 'Pita' Martischka The Pad Manager is a Factory for pad Objects
* 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
###getPad (id, callback) ### getPad (id, callback)
2011 Peter 'Pita' Martischka A Array with all known Pads
* 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.
* **id** A String with the id of the pad * **id** A String with the id of the pad
* **callback** * **callback** *(Function)* *No description*
##Variables

View File

@ -1,25 +1,18 @@
#db # db
`require("./db");` `require("./db");`
2011 Peter 'Pita' Martischka The DB Module provides a database initalized with the settings
* Licensed under the Apache License, Version 2.0 (the "License"); provided by the settings module
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
###init (callback) ### init (callback)
Initalizes the database with the settings provided by the settings module
* **callback** * **callback** *(Function)* *No description*
##Variables ##Variables
###db ### db
The UeberDB Object that provides the database functions

View File

@ -1,18 +1,7 @@
#easysync_tests # easysync_tests
`require("./easysync_tests");` `require("./easysync_tests");`
Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka I found this tests in the old Etherpad and used it to test if the Changeset library can be run on node.js.
* Licensed under the Apache License, Version 2.0 (the "License"); It has no use for ep-lite, but I thought I keep it cause it may help someone to understand the Changeset library
you may not use this file except in compliance with the License. https://github.com/ether/pad/blob/master/infrastructure/ace/www/easysync2_tests.js
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

View File

@ -1,33 +1,14 @@
#minify # minify
`require("./minify");` `require("./minify");`
2011 Peter 'Pita' Martischka This Module manages all /minified/* requests. It controls the
* Licensed under the Apache License, Version 2.0 (the "License"); minification && compression of Javascript and CSS.
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
###padJS (req, res) ### padJS (req, res)
2011 Peter 'Pita' Martischka Answers a http request for the pad javascript
* 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.
* **req** * **req** the Express request
* **res** * **res** the Express response
##Variables

View File

@ -1,21 +1,12 @@
#server # server
`require("./server");` `require("./server");`
2011 Peter 'Pita' Martischka This module is started with bin/run.sh. It sets up a Express HTTP and a Socket.IO Server.
* Licensed under the Apache License, Version 2.0 (the "License"); Static file Requests are answered directly from this module, Socket.IO messages are passed
you may not use this file except in compliance with the License. to MessageHandler and minfied requests are passed to minified.
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 ##Variables
###maxAge ### maxAge

View File

@ -1,36 +1,26 @@
#settings # settings
`require("./settings");` `require("./settings");`
2011 Peter 'Pita' Martischka The Settings Modul reads the settings out of settings.json and provides
* Licensed under the Apache License, Version 2.0 (the "License"); this information to the other modules
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 ##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 ### minify
A flag that shows if minification is enabled or not
###logHTTP
###minify
###port
### port
The Port ep-lite should listen to

View File

@ -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 * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,4 +1,8 @@
/** /**
* The AuthorManager controlls all information about the Pad authors
*/
/*
* 2011 Peter 'Pita' Martischka * 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -14,18 +18,15 @@
* limitations under the License. * limitations under the License.
*/ */
/**
* The AuthorManager controlls all information about the Pad authors
*/
var db = require("./db").db; var db = require("./db").db;
var async = require("async"); var async = require("async");
/** /**
* Returns the Author Id for a token. If the token is unkown, * Returns the Author Id for a token. If the token is unkown,
* it creates a author for the token * 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) exports.getAuthor4Token = function (token, callback)
{ {
@ -73,6 +74,8 @@ exports.getAuthor4Token = function (token, callback)
/** /**
* Returns the color Id of the author * 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) exports.getAuthorColorId = function (author, callback)
{ {
@ -81,6 +84,8 @@ exports.getAuthorColorId = function (author, callback)
/** /**
* Sets the color Id of the author * 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) exports.setAuthorColorId = function (author, colorId, callback)
{ {
@ -89,6 +94,8 @@ exports.setAuthorColorId = function (author, colorId, callback)
/** /**
* Returns the name of the author * 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) exports.getAuthorName = function (author, callback)
{ {
@ -97,6 +104,8 @@ exports.getAuthorName = function (author, callback)
/** /**
* Sets the name of the author * Sets the name of the author
* @param author {String} The id of the author
* @param callback {Function} (optional)
*/ */
exports.setAuthorName = function (author, name, callback) exports.setAuthorName = function (author, name, callback)
{ {

View File

@ -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 * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -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 * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,3 +1,7 @@
/**
* The pad object, defined with joose
*/
var Changeset = require("../Changeset"); var Changeset = require("../Changeset");
var AttributePoolFactory = require("../AttributePoolFactory"); var AttributePoolFactory = require("../AttributePoolFactory");
var db = require("../db").db; var db = require("../db").db;
@ -5,7 +9,7 @@ var async = require("async");
var settings = require('../settings'); 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 * @param txt
*/ */
exports.cleanText = function (txt) { exports.cleanText = function (txt) {

View File

@ -1,4 +1,8 @@
/** /**
* The Pad Manager is a Factory for pad Objects
*/
/*
* 2011 Peter 'Pita' Martischka * 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -14,11 +18,6 @@
* limitations under the License. * 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"); var Changeset = require("./Models/Pad");
/** /**
@ -27,9 +26,9 @@ var Changeset = require("./Models/Pad");
globalPads = []; 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 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) exports.getPad = function(id, callback)
{ {

View File

@ -1,4 +1,9 @@
/** /**
* The DB Module provides a database initalized with the settings
* provided by the settings module
*/
/*
* 2011 Peter 'Pita' Martischka * 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -20,9 +25,15 @@ var settings = require("./settings");
//set database settings //set database settings
var db = new ueberDB.database(settings.dbType, settings.dbSettings); 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; exports.db = null;
/**
* Initalizes the database with the settings provided by the settings module
* @param callback {Function}
*/
exports.init = function(callback) exports.init = function(callback)
{ {
//initalize the database async //initalize the database async

View File

@ -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 * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -1,4 +1,9 @@
/** /**
* This Module manages all /minified/* requests. It controls the
* minification && compression of Javascript and CSS.
*/
/*
* 2011 Peter 'Pita' Martischka * 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * 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 * Answers a http request for the pad javascript
* @param req the Express request
* @param res the Express response
*/ */
exports.padJS = function(req, res) exports.padJS = function(req, res)
{ {

View File

@ -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 * 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");

View File

@ -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 * 2011 Peter 'Pita' Martischka
* *
* Licensed under the Apache License, Version 2.0 (the "License"); * Licensed under the Apache License, Version 2.0 (the "License");
@ -16,12 +21,29 @@
var fs = require("fs"); var fs = require("fs");
//default settings /**
* The Port ep-lite should listen to
*/
exports.port = 9001; exports.port = 9001;
/*
* The Type of the database
*/
exports.dbType = "sqlite"; exports.dbType = "sqlite";
/**
* This setting is passed with dbType to ueberDB to set up the database
*/
exports.dbSettings = { "filename" : "../var/sqlite.db" }; exports.dbSettings = { "filename" : "../var/sqlite.db" };
/**
* A flag that shows if http requests should be loged to stdout
*/
exports.logHTTP = true; 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"; 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; exports.minify = true;
//read the settings sync //read the settings sync