W.I.P of collaborative odf editor:

- Define ServerFactory for egw collab
- Revert unintentional commits on Server.js
This commit is contained in:
Hadi Nategh 2016-08-05 12:39:56 +02:00
parent 6f5fd2fad8
commit 60c34e5881
3 changed files with 32 additions and 14 deletions

View 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);
};
};
});

View File

@ -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: {

View File

@ -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) {