added getRevisionsCount

pull/85/merge
Peter 'Pita' Martischka 2011-08-04 17:24:36 +01:00
parent d5d9830dd3
commit 7b030710d2
2 changed files with 63 additions and 45 deletions

View File

@ -360,13 +360,17 @@ Example returns:
*/
exports.getRevisionsCount = function(padID, callback)
{
//check if this is a valid padID
var notValidReason = isValidPadID(padID);
if(notValidReason != null)
//get the pad
getPadSafe(padID, function(err, pad)
{
callback(notValidReason);
if(err)
{
callback(err);
return;
}
callback(null, {revisions: pad.getHeadRevisionNumber()});
});
}
/**
@ -379,13 +383,17 @@ Example returns:
*/
exports.deletePad = function(padID, callback)
{
//check if this is a valid padID
var notValidReason = isValidPadID(padID);
if(notValidReason != null)
//get the pad
getPadSafe(padID, function(err, pad)
{
callback(notValidReason);
if(err)
{
callback(err);
return;
}
});
}
/**
@ -398,13 +406,7 @@ Example returns:
*/
exports.getReadOnlyLink = function(padID, callback)
{
//check if this is a valid padID
var notValidReason = isValidPadID(padID);
if(notValidReason != null)
{
callback(notValidReason);
return;
}
}
/**
@ -417,13 +419,17 @@ Example returns:
*/
exports.setPublicStatus = function(padID, publicStatus, callback)
{
//check if this is a valid padID
var notValidReason = isValidPadID(padID);
if(notValidReason != null)
//get the pad
getPadSafe(padID, function(err, pad)
{
callback(notValidReason);
if(err)
{
callback(err);
return;
}
});
}
/**
@ -436,13 +442,17 @@ Example returns:
*/
exports.getPublicStatus = function(padID, callback)
{
//check if this is a valid padID
var notValidReason = isValidPadID(padID);
if(notValidReason != null)
//get the pad
getPadSafe(padID, function(err, pad)
{
callback(notValidReason);
if(err)
{
callback(err);
return;
}
});
}
/**
@ -455,13 +465,17 @@ Example returns:
*/
exports.setPassword = function(padID, password, callback)
{
//check if this is a valid padID
var notValidReason = isValidPadID(padID);
if(notValidReason != null)
//get the pad
getPadSafe(padID, function(err, pad)
{
callback(notValidReason);
if(err)
{
callback(err);
return;
}
});
}
/**
@ -474,13 +488,17 @@ Example returns:
*/
exports.isPasswordProtected = function(padID, callback)
{
//check if this is a valid padID
var notValidReason = isValidPadID(padID);
if(notValidReason != null)
//get the pad
getPadSafe(padID, function(err, pad)
{
callback(notValidReason);
if(err)
{
callback(err);
return;
}
});
}
/******************************/

View File

@ -50,8 +50,8 @@ var functions = {
// "deleteAllSessionsOfGroup" : ["groupID"],
// "deleteAllSessionsOfAuthor" : ["authorID"],
"getText" : ["padID", "rev"],
"setText" : ["padID", "text"]
// "getRevisionsCount" : ["padID"],
"setText" : ["padID", "text"],
"getRevisionsCount" : ["padID"],
// "deletePad" : ["padID"],
// "getReadOnlyLink" : ["padID"],
// "setPublicStatus" : ["padID", "publicStatus"],