mirror of
https://github.com/ether/etherpad-lite.git
synced 2025-05-04 14:19:13 -04:00
Merge 97119b9bdd
into a9540cb8b7
This commit is contained in:
commit
9dadeeec86
5 changed files with 56 additions and 4 deletions
|
@ -34,7 +34,7 @@ var exportHtml = require("../utils/ExportHtml");
|
|||
exports.createGroup = groupManager.createGroup;
|
||||
exports.createGroupIfNotExistsFor = groupManager.createGroupIfNotExistsFor;
|
||||
exports.deleteGroup = groupManager.deleteGroup;
|
||||
exports.listPads = groupManager.listPads;
|
||||
exports.listGroupPads = groupManager.listGroupPads;
|
||||
exports.createGroupPad = groupManager.createGroupPad;
|
||||
|
||||
/**********************/
|
||||
|
@ -58,6 +58,15 @@ exports.listSessionsOfAuthor = sessionManager.listSessionsOfAuthor;
|
|||
/**PAD CONTENT FUNCTIONS*/
|
||||
/************************/
|
||||
|
||||
|
||||
exports.listAllPads = function(callback)
|
||||
{
|
||||
padManager.listAllPads(callback);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
getText(padID, [rev]) returns the text of a pad
|
||||
|
||||
|
|
|
@ -244,7 +244,7 @@ exports.createGroupPad = function(groupID, padName, text, callback)
|
|||
});
|
||||
}
|
||||
|
||||
exports.listPads = function(groupID, callback)
|
||||
exports.listGroupPads = function(groupID, callback)
|
||||
{
|
||||
exports.doesGroupExist(groupID, function(err, exists)
|
||||
{
|
||||
|
|
|
@ -380,7 +380,19 @@ Class('Pad', {
|
|||
else
|
||||
{
|
||||
var firstChangeset = Changeset.makeSplice("\n", 0, 0, exports.cleanText(text));
|
||||
|
||||
db.get("allpads",function(err,data)
|
||||
{
|
||||
if(err) callback(err);
|
||||
if(data){
|
||||
data.push(_this.id);
|
||||
db.set("allpads",data);
|
||||
|
||||
}
|
||||
else {
|
||||
db.set("allpads",[_this.id]);
|
||||
}
|
||||
|
||||
});
|
||||
_this.appendRevision(firstChangeset, '');
|
||||
}
|
||||
|
||||
|
@ -471,6 +483,21 @@ Class('Pad', {
|
|||
{
|
||||
db.remove("pad:"+padID);
|
||||
padManager.unloadPad(padID);
|
||||
|
||||
// delete entry from allpads
|
||||
db.get("allpads",function(err,data)
|
||||
{
|
||||
if(err) callback(err);
|
||||
if(data){
|
||||
delete data[padID];
|
||||
db.set("allpads",data);
|
||||
}
|
||||
else{
|
||||
//nothing to do, although there should be an entry
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
callback();
|
||||
}
|
||||
], function(err)
|
||||
|
|
|
@ -123,3 +123,18 @@ exports.unloadPad = function(padId)
|
|||
if(globalPads.get(padId))
|
||||
globalPads.remove(padId);
|
||||
}
|
||||
|
||||
exports.listAllPads = function(callback)
|
||||
{
|
||||
db.get("allpads",function(err,data)
|
||||
{
|
||||
if(err) callback(err);
|
||||
if(data){
|
||||
callback(err,data);
|
||||
}
|
||||
else callback(err,[]);
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -38,7 +38,8 @@ var functions = {
|
|||
"createGroup" : [],
|
||||
"createGroupIfNotExistsFor" : ["groupMapper"],
|
||||
"deleteGroup" : ["groupID"],
|
||||
"listPads" : ["groupID"],
|
||||
"listAllPads" : [],
|
||||
"listGroupPads" : ["groupID"],
|
||||
"createPad" : ["padID", "text"],
|
||||
"createGroupPad" : ["groupID", "padName", "text"],
|
||||
"createAuthor" : ["name"],
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue