forked from extern/egroupware
W.I.P of collaborative odf editor:
- Define ServerFactory for egw collab - Revert unintentional commits on Server.js
This commit is contained in:
parent
6f5fd2fad8
commit
60c34e5881
30
api/js/webodf/collab/ServerFactory.js
Normal file
30
api/js/webodf/collab/ServerFactory.js
Normal file
@ -0,0 +1,30 @@
|
||||
define("egwCollab/ServerFactory", [
|
||||
"webodf/editor/backend/pullbox/Server",
|
||||
"webodf/editor/backend/pullbox/SessionBackend",
|
||||
"webodf/editor/backend/pullbox/SessionList"],
|
||||
function (PullBoxServer, PullBoxSessionBackend, PullBoxSessionList) {
|
||||
"use strict";
|
||||
|
||||
/**
|
||||
* @constructor
|
||||
* @implements ServerFactory
|
||||
*/
|
||||
return function egwCollabServerFactory() {
|
||||
this.createServer = function (args) {
|
||||
var server;
|
||||
args = args || {};
|
||||
|
||||
server = new PullBoxServer(args);
|
||||
server.getGenesisUrl = function(sid) {
|
||||
return args.genesisUrl;
|
||||
};
|
||||
return server;
|
||||
};
|
||||
this.createSessionBackend = function (sid, mid, server) {
|
||||
return new PullBoxSessionBackend(sid, mid, server);
|
||||
};
|
||||
this.createSessionList = function (server) {
|
||||
return new PullBoxSessionList(server);
|
||||
};
|
||||
};
|
||||
});
|
@ -144,16 +144,6 @@ define("webodf/editor/backend/pullbox/Server", [], function () {
|
||||
* @return {undefined}
|
||||
*/
|
||||
this.login = function (login, password, successCb, failCb) {
|
||||
successCb ({
|
||||
'full_name' :'Hadi Nategh',
|
||||
'uid' : 'sysop',
|
||||
'securityToken' : '10000',
|
||||
'token' : '10000',
|
||||
'sessiondata_list' : [],
|
||||
'success' : true,
|
||||
'member_id' : 'sysop'
|
||||
});
|
||||
return;
|
||||
call({
|
||||
command: "login",
|
||||
args: {
|
||||
@ -183,8 +173,6 @@ define("webodf/editor/backend/pullbox/Server", [], function () {
|
||||
* @return {undefined}
|
||||
*/
|
||||
this.joinSession = function (userId, sessionId, successCb, failCb) {
|
||||
successCb('sysop');
|
||||
return;
|
||||
call({
|
||||
command: "join_session",
|
||||
args: {
|
||||
|
@ -1381,7 +1381,7 @@ app.classes.filemanager = AppJS.extend(
|
||||
var sid = _sessionId;
|
||||
server.joinSession(userId, sid, function (_memberId) {
|
||||
memberId = _memberId;
|
||||
if (self.editor) {
|
||||
if (Object.keys(self.editor).length == 0) {
|
||||
Wodo.createCollabTextEditor('filemanager-editor_odfEditor', editorOptions, onEditorCreated);
|
||||
} else {
|
||||
self.editor.joinSession(serverFactory.createSessionBackend(sid, _memberId, server), onEditing);
|
||||
@ -1391,7 +1391,7 @@ app.classes.filemanager = AppJS.extend(
|
||||
});
|
||||
};
|
||||
|
||||
require(["webodf/editor/backend/pullbox/ServerFactory"], function (ServerFactory) {
|
||||
require(["egwCollab/ServerFactory"], function (ServerFactory) {
|
||||
serverFactory = new ServerFactory();
|
||||
server = serverFactory.createServer(serverParams);
|
||||
server.connect(8000, function (state) {
|
||||
|
Loading…
Reference in New Issue
Block a user