resolve merge conflict

This commit is contained in:
John McLear 2013-12-09 21:55:04 +00:00
commit 58bbfd8a65
210 changed files with 12113 additions and 7505 deletions

View file

@ -74,6 +74,124 @@ exports.listSessionsOfAuthor = sessionManager.listSessionsOfAuthor;
/**PAD CONTENT FUNCTIONS*/
/************************/
/**
getAttributePool(padID) returns the attribute pool of a pad
Example returns:
{
"code":0,
"message":"ok",
"data": {
"pool":{
"numToAttrib":{
"0":["author","a.X4m8bBWJBZJnWGSh"],
"1":["author","a.TotfBPzov54ihMdH"],
"2":["author","a.StiblqrzgeNTbK05"],
"3":["bold","true"]
},
"attribToNum":{
"author,a.X4m8bBWJBZJnWGSh":0,
"author,a.TotfBPzov54ihMdH":1,
"author,a.StiblqrzgeNTbK05":2,
"bold,true":3
},
"nextNum":4
}
}
}
*/
exports.getAttributePool = function (padID, callback)
{
getPadSafe(padID, true, function(err, pad)
{
if (ERR(err, callback)) return;
callback(null, {pool: pad.pool});
});
}
/**
getRevisionChangeset (padID, [rev])
get the changeset at a given revision, or last revision if 'rev' is not defined.
Example returns:
{
"code" : 0,
"message" : "ok",
"data" : "Z:1>6b|5+6b$Welcome to Etherpad!\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"
}
*/
exports.getRevisionChangeset = function(padID, rev, callback)
{
// check if rev is set
if (typeof rev === "function")
{
callback = rev;
rev = undefined;
}
// check if rev is a number
if (rev !== undefined && typeof rev !== "number")
{
// try to parse the number
if (!isNaN(parseInt(rev)))
{
rev = parseInt(rev);
}
else
{
callback(new customError("rev is not a number", "apierror"));
return;
}
}
// ensure this is not a negative number
if (rev !== undefined && rev < 0)
{
callback(new customError("rev is not a negative number", "apierror"));
return;
}
// ensure this is not a float value
if (rev !== undefined && !is_int(rev))
{
callback(new customError("rev is a float value", "apierror"));
return;
}
// get the pad
getPadSafe(padID, true, function(err, pad)
{
if(ERR(err, callback)) return;
//the client asked for a special revision
if(rev !== undefined)
{
//check if this is a valid revision
if(rev > pad.getHeadRevisionNumber())
{
callback(new customError("rev is higher than the head revision of the pad","apierror"));
return;
}
//get the changeset for this revision
pad.getRevisionChangeset(rev, function(err, changeset)
{
if(ERR(err, callback)) return;
callback(null, changeset);
})
}
//the client wants the latest changeset, lets return it to him
else
{
callback(null, {"changeset": pad.getRevisionChangeset(pad.getHeadRevisionNumber())});
}
});
}
/**
getText(padID, [rev]) returns the text of a pad
@ -326,8 +444,8 @@ exports.getChatHistory = function(padID, start, end, callback)
// fall back to getting the whole chat-history if a parameter is missing
if(!start || !end)
{
start = 0;
end = pad.chatHead;
start = 0;
end = pad.chatHead;
}
if(start >= chatHead && chatHead > 0)
@ -438,6 +556,46 @@ exports.deletePad = function(padID, callback)
});
}
/**
copyPad(sourceID, destinationID[, force=false]) copies a pad. If force is true,
the destination will be overwritten if it exists.
Example returns:
{code: 0, message:"ok", data: {padID: destinationID}}
{code: 1, message:"padID does not exist", data: null}
*/
exports.copyPad = function(sourceID, destinationID, force, callback)
{
getPadSafe(sourceID, true, function(err, pad)
{
if(ERR(err, callback)) return;
pad.copy(destinationID, force, callback);
});
}
/**
movePad(sourceID, destinationID[, force=false]) moves a pad. If force is true,
the destination will be overwritten if it exists.
Example returns:
{code: 0, message:"ok", data: {padID: destinationID}}
{code: 1, message:"padID does not exist", data: null}
*/
exports.movePad = function(sourceID, destinationID, force, callback)
{
getPadSafe(sourceID, true, function(err, pad)
{
if(ERR(err, callback)) return;
pad.copy(destinationID, force, function(err) {
if(ERR(err, callback)) return;
pad.remove(callback);
});
});
}
/**
getReadOnlyLink(padID) returns the read only link of a pad
@ -664,7 +822,7 @@ createDiffHTML(padID, startRev, endRev) returns an object of diffs from 2 points
Example returns:
{"code":0,"message":"ok","data":{"html":"<style>\n.authora_HKIv23mEbachFYfH {background-color: #a979d9}\n.authora_n4gEeMLsv1GivNeh {background-color: #a9b5d9}\n.removed {text-decoration: line-through; -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)'; filter: alpha(opacity=80); opacity: 0.8; }\n</style>Welcome to Etherpad Lite!<br><br>This 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!<br><br>Get involved with Etherpad at <a href=\"http&#x3a;&#x2F;&#x2F;etherpad&#x2e;org\">http:&#x2F;&#x2F;etherpad.org</a><br><span class=\"authora_HKIv23mEbachFYfH\">aw</span><br><br>","authors":["a.HKIv23mEbachFYfH",""]}}
{"code":0,"message":"ok","data":{"html":"<style>\n.authora_HKIv23mEbachFYfH {background-color: #a979d9}\n.authora_n4gEeMLsv1GivNeh {background-color: #a9b5d9}\n.removed {text-decoration: line-through; -ms-filter:'progid:DXImageTransform.Microsoft.Alpha(Opacity=80)'; filter: alpha(opacity=80); opacity: 0.8; }\n</style>Welcome to Etherpad!<br><br>This 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!<br><br>Get involved with Etherpad at <a href=\"http&#x3a;&#x2F;&#x2F;etherpad&#x2e;org\">http:&#x2F;&#x2F;etherpad.org</a><br><span class=\"authora_HKIv23mEbachFYfH\">aw</span><br><br>","authors":["a.HKIv23mEbachFYfH",""]}}
{"code":4,"message":"no or wrong API Key","data":null}
*/
exports.createDiffHTML = function(padID, startRev, endRev, callback){