Merge pull request #189 from adityab/memberops

Op-ify Member Data
This commit is contained in:
Friedrich
2013-11-20 13:50:32 -08:00
26 changed files with 592 additions and 822 deletions
+4 -2
View File
@@ -292,6 +292,7 @@ set(LIBJSFILES lib/packages.js lib/runtime.js lib/core/Base64.js
lib/odf/OdfCanvas.js
lib/odf/CommandLineTools.js
lib/ops/Member.js
lib/ops/Server.js
lib/ops/Operation.js
lib/ops/OpAddCursor.js
@@ -312,6 +313,9 @@ set(LIBJSFILES lib/packages.js lib/runtime.js lib/core/Base64.js
lib/ops/OpRemoveStyle.js
lib/ops/OpAddAnnotation.js
lib/ops/OpRemoveAnnotation.js
lib/ops/OpAddMember.js
lib/ops/OpUpdateMember.js
lib/ops/OpRemoveMember.js
lib/ops/OperationFactory.js
lib/gui/SelectionMover.js
lib/ops/StepsTranslator.js
@@ -334,8 +338,6 @@ set(LIBJSFILES lib/packages.js lib/runtime.js lib/core/Base64.js
lib/gui/AnnotationController.js
lib/gui/EventManager.js
lib/gui/SessionController.js
lib/ops/MemberModel.js
lib/ops/TrivialMemberModel.js
lib/ops/OperationRouter.js
lib/ops/TrivialOperationRouter.js
lib/gui/EditInfoHandle.js
+24 -7
View File
@@ -124,7 +124,20 @@ define("webodf/editor/Editor", [
* @return {undefined}
*/
this.openDocument = function (docUrl, memberId, editorReadyCallback) {
initDocLoading(docUrl, memberId, editorReadyCallback);
initDocLoading(docUrl, memberId, function () {
runtime.loadClass("ops.OpAddMember");
var op = new ops.OpAddMember();
op.init({
memberid: memberId,
setProperties: {
fullName: runtime.tr("Unknown Author"),
color: "black",
imageUrl: "avatar-joe.png"
}
});
session.enqueue([op]);
editorReadyCallback();
});
};
/**
@@ -134,6 +147,14 @@ define("webodf/editor/Editor", [
*/
this.closeDocument = function (callback) {
runtime.assert(session, "session should exist here.");
runtime.loadClass("ops.OpRemoveMember");
var op = new ops.OpRemoveMember();
op.init({
memberid: editorSession.sessionController.getInputMemberId()
});
session.enqueue([op]);
session.close(function (err) {
if (err) {
callback(err);
@@ -195,16 +216,12 @@ define("webodf/editor/Editor", [
*/
this.openSession = function (sessionId, memberId, editorReadyCallback) {
initDocLoading(server.getGenesisUrl(sessionId), memberId, function () {
var opRouter, memberModel;
// overwrite router and member model
// overwrite router
// TODO: serverFactory should be a backendFactory,
// and there should be a backendFactory for local editing
opRouter = serverFactory.createOperationRouter(sessionId, memberId, server, odfCanvas.odfContainer());
var opRouter = serverFactory.createOperationRouter(sessionId, memberId, server, odfCanvas.odfContainer());
session.setOperationRouter(opRouter);
memberModel = serverFactory.createMemberModel(sessionId, server);
session.setMemberModel(memberModel);
opRouter.requestReplay(function done() {
editorReadyCallback();
});
+34 -10
View File
@@ -82,8 +82,11 @@ define("webodf/editor/EditorSession", [
domUtils = new core.DomUtils(),
eventNotifier = new core.EventNotifier([
EditorSession.signalMemberAdded,
EditorSession.signalMemberUpdated,
EditorSession.signalMemberRemoved,
EditorSession.signalCursorAdded,
EditorSession.signalCursorMoved,
EditorSession.signalCursorRemoved,
EditorSession.signalParagraphChanged,
EditorSession.signalCommonStyleCreated,
EditorSession.signalCommonStyleDeleted,
@@ -211,13 +214,25 @@ define("webodf/editor/EditorSession", [
paragraphRange.detach();
}
function onMemberAdded(member) {
self.emit(EditorSession.signalMemberAdded, member.getMemberId());
}
function onMemberUpdated(member) {
self.emit(EditorSession.signalMemberUpdated, member.getMemberId());
}
function onMemberRemoved(memberId) {
self.emit(EditorSession.signalMemberRemoved, memberId);
}
function onCursorAdded(cursor) {
self.emit(EditorSession.signalMemberAdded, cursor.getMemberId());
self.emit(EditorSession.signalCursorAdded, cursor.getMemberId());
trackCursor(cursor);
}
function onCursorRemoved(memberId) {
self.emit(EditorSession.signalMemberRemoved, memberId);
self.emit(EditorSession.signalCursorRemoved, memberId);
}
function onCursorMoved(cursor) {
@@ -267,14 +282,6 @@ define("webodf/editor/EditorSession", [
eventNotifier.unsubscribe(eventid, cb);
};
this.getMemberDetailsAndUpdates = function (memberId, subscriber) {
return session.getMemberModel().getMemberDetailsAndUpdates(memberId, subscriber);
};
this.unsubscribeMemberDetailsUpdates = function (memberId, subscriber) {
return session.getMemberModel().unsubscribeMemberDetailsUpdates(memberId, subscriber);
};
this.getCursorPosition = function () {
return odtDocument.getCursorPosition(localMemberId);
};
@@ -513,6 +520,14 @@ define("webodf/editor/EditorSession", [
self.sessionController.getImageManager().insertImage(mimetype, content, width, height);
};
/**
* @param {!string} memberId
* @return {?ops.Member}
*/
this.getMember = function (memberId) {
return odtDocument.getMember(memberId);
};
/**
* @param {!function(!Object=)} callback, passing an error object in case of error
* @return {undefined}
@@ -522,6 +537,9 @@ define("webodf/editor/EditorSession", [
head.removeChild(fontStyles);
odtDocument.unsubscribe(ops.OdtDocument.signalMemberAdded, onMemberAdded);
odtDocument.unsubscribe(ops.OdtDocument.signalMemberUpdated, onMemberUpdated);
odtDocument.unsubscribe(ops.OdtDocument.signalMemberRemoved, onMemberRemoved);
odtDocument.unsubscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded);
odtDocument.unsubscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved);
odtDocument.unsubscribe(ops.OdtDocument.signalCursorMoved, onCursorMoved);
@@ -578,6 +596,9 @@ define("webodf/editor/EditorSession", [
self.availableFonts = getAvailableFonts();
selectionViewManager.registerCursor(shadowCursor, true);
// Custom signals, that make sense in the Editor context. We do not want to expose webodf's ops signals to random bits of the editor UI.
odtDocument.subscribe(ops.OdtDocument.signalMemberAdded, onMemberAdded);
odtDocument.subscribe(ops.OdtDocument.signalMemberUpdated, onMemberUpdated);
odtDocument.subscribe(ops.OdtDocument.signalMemberRemoved, onMemberRemoved);
odtDocument.subscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded);
odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved);
odtDocument.subscribe(ops.OdtDocument.signalCursorMoved, onCursorMoved);
@@ -592,7 +613,10 @@ define("webodf/editor/EditorSession", [
};
/**@const*/EditorSession.signalMemberAdded = "memberAdded";
/**@const*/EditorSession.signalMemberUpdated = "memberUpdated";
/**@const*/EditorSession.signalMemberRemoved = "memberRemoved";
/**@const*/EditorSession.signalCursorAdded = "cursorAdded";
/**@const*/EditorSession.signalCursorRemoved = "cursorRemoved";
/**@const*/EditorSession.signalCursorMoved = "cursorMoved";
/**@const*/EditorSession.signalParagraphChanged = "paragraphChanged";
/**@const*/EditorSession.signalCommonStyleCreated = "styleCreated";
+18 -7
View File
@@ -73,11 +73,11 @@ define("webodf/editor/MemberListView",
while (node) {
if (node.localName === "img") {
// update avatar image
node.src = memberDetails.imageurl;
node.src = memberDetails.imageUrl;
// update border color
node.style.borderColor = memberDetails.color;
} else if (node.localName === "div") {
node.setAttribute('fullname', memberDetails.fullname);
node.setAttribute('fullname', memberDetails.fullName);
}
node = node.nextSibling;
}
@@ -139,8 +139,21 @@ define("webodf/editor/MemberListView",
* @return {undefined}
*/
function addMember(memberId) {
var member = editorSession.getMember(memberId),
properties = member.getProperties();
createAvatarButton(memberId);
editorSession.getMemberDetailsAndUpdates(memberId, updateAvatarButton);
updateAvatarButton(memberId, properties);
}
/**
* @param {!string} memberId
* @return {undefined}
*/
function updateMember(memberId) {
var member = editorSession.getMember(memberId),
properties = member.getProperties();
updateAvatarButton(memberId, properties);
}
/**
@@ -148,7 +161,6 @@ define("webodf/editor/MemberListView",
* @return {undefined}
*/
function removeMember(memberId) {
editorSession.unsubscribeMemberDetailsUpdates(memberId, updateAvatarButton);
removeAvatarButton(memberId);
}
@@ -158,14 +170,12 @@ define("webodf/editor/MemberListView",
if (editorSession) {
// unsubscribe from editorSession
editorSession.unsubscribe(EditorSession.signalMemberAdded, addMember);
editorSession.unsubscribe(EditorSession.signalMemberUpdated, updateMember);
editorSession.unsubscribe(EditorSession.signalMemberRemoved, removeMember);
// remove all current avatars
node = memberListDiv.firstChild;
while (node) {
nextNode = node.nextSibling;
if (node.memberId) {
editorSession.unsubscribeMemberDetailsUpdates(node.memberId, updateAvatarButton);
}
memberListDiv.removeChild(node);
node = nextNode;
}
@@ -182,6 +192,7 @@ define("webodf/editor/MemberListView",
editorSession = session;
if (editorSession) {
editorSession.subscribe(EditorSession.signalMemberAdded, addMember);
editorSession.subscribe(EditorSession.signalMemberUpdated, updateMember);
editorSession.subscribe(EditorSession.signalMemberRemoved, removeMember);
}
};
-7
View File
@@ -57,13 +57,6 @@ ServerFactory.prototype.createServer = function () {"use strict"; };
*/
ServerFactory.prototype.createOperationRouter = function (sessionId, memberId, server, odfContainer) {"use strict"; };
/**
* @param {!string} sessionId
* @param {!ops.Server} server
* @return {!ops.MemberModel}
*/
ServerFactory.prototype.createMemberModel = function (sessionId, server) {"use strict"; };
/**
* @param {!ops.Server} server
* @return {!SessionList}
-209
View File
@@ -1,209 +0,0 @@
/**
* @license
* Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops, runtime */
define("webodf/editor/server/nowjs/MemberModel", [], function () {
"use strict";
/**
* @constructor
* @implements ops.MemberModel
*/
return function NowjsMemberModel(server) {
var cachedUserData = {},
memberDataSubscribers = {},
nowObject = server.getNowObject();
/**
* @param {!string} memberId
* @return {!string}
*/
function userIdFromMemberId(memberId) {
return memberId.split("___")[0];
}
/**
* @param {!string} userId
* @param {?Object} userData
*/
function cacheUserDatum(userId, userData) {
var subscribers,
i;
// notify all subscribers who are interested in this data
subscribers = memberDataSubscribers[userId];
if (subscribers) {
// cache
cachedUserData[userId] = userData;
for (i = 0; i < subscribers.length; i += 1) {
subscribers[i].subscriber(subscribers[i].memberId, userData);
}
}
}
/**
* callback is called as soon as the userdata is available and after that
* on every userdata update.
* a parameter `null` passed to the callback means that the user is finally
* not known.
*
* @param {!string} memberId
* @param {!function(!string, ?Object)} subscriber
* @return {undefined}
*/
this.getMemberDetailsAndUpdates = function (memberId, subscriber) {
// TODO: remove the ___ split.
// FIXME: caching data by userid seems to be incorrect:
// a user can have multiple members in a document,
// data should be per member (e.g.: current network lag, current
// description of what the member is changing, even the avatar
// image might be member-specific (home vs. work); this reminds
// me of XMPP resources).
// member-details should probably start with some values received
// from the user. also the subscriptions here should be per
// avatar and thus per member (and in fact the handling of the
// callback is per memberId already)
// fixing that should happen in a later commit to reduce change-
// complexity.
var userId = userIdFromMemberId(memberId),
/**@type{Object}*/
userData = cachedUserData[userId],
subscribers = memberDataSubscribers[userId] || [],
i;
memberDataSubscribers[userId] = subscribers;
runtime.assert(subscriber !== undefined, "missing callback");
// detect double subscription
for (i=0; i<subscribers.length; i+=1) {
if ((subscribers[i].subscriber === subscriber) &&
(subscribers[i].memberId === memberId)) {
break;
}
}
if (i < subscribers.length) {
// already subscribed
runtime.log("double subscription request for "+memberId+" in MemberModel::getMemberDetailsAndUpdates");
} else {
// subscribe
subscribers.push({memberId: memberId, subscriber: subscriber});
// query data from server, if not done yet
if (subscribers.length === 1) {
// TODO we should start considering security at some point
nowObject.subscribeUserDetailsUpdates(userId);
}
}
if (userData) {
// data available from cache
subscriber(memberId, userData);
} else {
// pass temporary data
subscriber(memberId, {
memberid: memberId,
fullname: "Unknown",
color: "black",
imageurl: "avatar-joe.png"
});
}
};
/**
* getMemberDetailsAndUpdates subscribes a callback for updates on user details.
* this function undoes this subscription.
*
* @param {!string} memberId
* @param {!function(!string, ?Object)} subscriber
* @return {undefined}
*/
this.unsubscribeMemberDetailsUpdates = function (memberId, subscriber) {
var i,
userId = userIdFromMemberId(memberId),
subscribers = memberDataSubscribers[userId];
runtime.assert(subscriber!==undefined, "missing subscriber parameter or null");
runtime.assert(subscribers,
"tried to unsubscribe when no one is subscribed ('" + memberId + "')");
if (subscribers) {
for (i=0; i<subscribers.length; i+=1) {
if ((subscribers[i].subscriber === subscriber) &&
(subscribers[i].memberId === memberId)) {
break;
}
}
runtime.assert((i < subscribers.length),
"tried to unsubscribe when not subscribed for memberId '" + memberId + "'");
subscribers.splice(i,1);
// clean up
if (subscribers.length === 0) {
runtime.log("no more subscribers for: "+memberId);
delete memberDataSubscribers[userId];
delete cachedUserData[userId];
nowObject.unsubscribeUserDetailsUpdates(userId);
}
}
};
/*jslint emptyblock: true*/
this.close = function (cb) {
// TODO: stop timers...
// (or in other words: implement this thing...)
cb();
};
/*jslint emptyblock: false*/
nowObject.updateUserDetails = function (userId, udata) {
// this will call all subscribers
cacheUserDatum(userId, udata?{
userid: udata.uid,
fullname: udata.fullname,
imageurl: "/user/" + udata.avatarId + "/avatar.png",
color: udata.color
}:null);
};
runtime.assert(nowObject.networkStatus === "ready", "network not ready");
};
});
@@ -40,10 +40,9 @@
define("webodf/editor/server/nowjs/ServerFactory", [
"webodf/editor/server/nowjs/Server",
"webodf/editor/server/nowjs/MemberModel",
"webodf/editor/server/nowjs/OperationRouter",
"webodf/editor/server/nowjs/SessionList"],
function (NowjsServer, NowjsMemberModel, NowjsOperationRouter, NowjsSessionList) {
function (NowjsServer, NowjsOperationRouter, NowjsSessionList) {
"use strict";
/**
@@ -57,9 +56,6 @@ define("webodf/editor/server/nowjs/ServerFactory", [
this.createOperationRouter = function (sid, mid, server, odfContainer) {
return new NowjsOperationRouter(sid, mid, server);
};
this.createMemberModel = function (sid, server) {
return new NowjsMemberModel(server);
};
this.createSessionList = function (server) {
return new NowjsSessionList(server);
};
@@ -1,279 +0,0 @@
/**
* @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* This file is part of WebODF.
*
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global runtime, ops*/
define("webodf/editor/server/pullbox/MemberModel", [], function () {
"use strict";
/**
* @constructor
* @implements ops.MemberModel
*/
return function PullBoxMemberModel(sessionId, server) {
var cachedMemberData = {},
memberDataSubscribers = {},
isServerPullingActivated = false,
isServerPullingOpen = true,
serverPullingTimeoutId = null,
isInstantPullingRequested = false,
isPulling = false,
/**@const*/pullingIntervall = 20000;
/**
* @param {!Object} memberData
*/
function cacheMemberDatum(memberData) {
var subscribers,
i;
// notify all subscribers who are interested in this data
subscribers = memberDataSubscribers[memberData.memberid];
if (subscribers) {
// cache
cachedMemberData[memberData.memberid] = memberData;
for (i = 0; i < subscribers.length; i += 1) {
subscribers[i](memberData.memberid, memberData);
}
}
}
function pullMemberData() {
var i,
memberIds = Object.keys(memberDataSubscribers);
if (!isServerPullingOpen || isPulling) {
return;
}
// no more timeout or instant pull request in any case
serverPullingTimeoutId = null;
isInstantPullingRequested = false;
// set lock
isPulling = true;
runtime.log("member-list request for : " + memberIds.join(","));
server.call({
command: 'query_memberdata_list',
args: {
es_id: sessionId,
member_ids: memberIds
}
}, function(responseData) {
var response = /**@type {{memberdata_list:Array.<{uid,member_id,display_name,avatar_url,color}>}}*/(runtime.fromJson(responseData)),
memberDataList,
newMemberData, oldMemberData;
// unlock
isPulling = false;
// meanwhile closed/disactivated?
if (!isServerPullingOpen || !isServerPullingActivated) {
return;
}
runtime.log("member-list reply: " + responseData);
if (response.hasOwnProperty("memberdata_list")) {
// add/update with all delivered memberdata
memberDataList = response.memberdata_list;
for (i = 0; i < memberDataList.length; i+=1) {
newMemberData = {
memberid: memberDataList[i].member_id,
fullname: memberDataList[i].display_name,
imageurl: memberDataList[i].avatar_url,
color: memberDataList[i].color
};
oldMemberData = cachedMemberData.hasOwnProperty(newMemberData.memberid) ? cachedMemberData[newMemberData.memberid] : null;
if (!oldMemberData ||
oldMemberData.fullname !== newMemberData.fullname ||
oldMemberData.imageurl !== newMemberData.imageurl ||
oldMemberData.color !== newMemberData.color) {
cacheMemberDatum(newMemberData);
}
}
} else {
runtime.log("Meh, memberdata list broken: " + responseData);
}
// trigger the next pulling
if (isInstantPullingRequested) {
pullMemberData();
} else {
serverPullingTimeoutId = runtime.setTimeout(pullMemberData, pullingIntervall);
}
});
}
/**
* Activates the pulling
* @return {undefined}
*/
function pullNewMemberData() {
// cancel any running pulling timeout
if (serverPullingTimeoutId !== null) {
runtime.clearTimeout(serverPullingTimeoutId);
}
isInstantPullingRequested = true;
isServerPullingActivated = true;
pullMemberData();
}
/**
* Deactivates the pulling if there are no more subscribers
* @return {undefined}
*/
function deactivatePeriodicMemberDataPulling() {
var key;
if (!isServerPullingActivated) {
return;
}
// check if there is no more subscription
for(key in memberDataSubscribers) {
if (memberDataSubscribers.hasOwnProperty(key)) {
// still subscribers, cannot deactivate yet
return;
}
}
isServerPullingActivated = false;
// cancel any running pulling timeout
if (serverPullingTimeoutId !== null) {
runtime.clearTimeout(serverPullingTimeoutId);
}
}
/**
* callback is called as soon as the memberdata is available and after that
* on every memberdata update.
* a parameter `null` passed to the callback means that the member is finally
* not known.
*
* @param {!string} memberId
* @param {!function(!string, ?Object)} subscriber
* @return {undefined}
*/
this.getMemberDetailsAndUpdates = function (memberId, subscriber) {
var /**@type{Object}*/
memberData = cachedMemberData[memberId],
subscribers = memberDataSubscribers[memberId] || [],
i;
memberDataSubscribers[memberId] = subscribers;
runtime.assert(subscriber !== undefined, "missing callback");
// detect double subscription
for (i=0; i<subscribers.length; i+=1) {
if (subscribers[i] === subscriber) {
break;
}
}
if (i < subscribers.length) {
// already subscribed
runtime.log("double subscription request for "+memberId+" in PullBoxMemberModel::getMemberDetailsAndUpdates");
} else {
// subscribe
subscribers.push(subscriber);
// query data from server, if not done yet
if (subscribers.length === 1) {
// TODO: only fetch data for memberId here
pullNewMemberData();
}
}
if (memberData) {
// data available from cache
subscriber(memberId, memberData);
} else {
// pass temporary data
subscriber(memberId, {
memberid: memberId,
fullname: "Unknown",
color: "black",
imageurl: ""
});
}
};
/**
* getMemberDetailsAndUpdates subscribes a callback for updates on member details.
* this function undoes this subscription.
*
* @param {!string} memberId
* @param {!function(!string, ?Object)} subscriber
* @return {undefined}
*/
this.unsubscribeMemberDetailsUpdates = function (memberId, subscriber) {
var i,
subscribers = memberDataSubscribers[memberId];
runtime.assert(subscriber!==undefined, "missing subscriber parameter or null");
runtime.assert(subscribers,
"tried to unsubscribe when no one is subscribed ('" + memberId + "')");
if (subscribers) {
for (i=0; i<subscribers.length; i+=1) {
if (subscribers[i] === subscriber) {
break;
}
}
runtime.assert((i < subscribers.length),
"tried to unsubscribe when not subscribed for memberId '" + memberId + "'");
subscribers.splice(i,1);
// clean up
if (subscribers.length === 0) {
runtime.log("no more subscribers for: "+memberId);
delete memberDataSubscribers[memberId];
delete cachedMemberData[memberId];
deactivatePeriodicMemberDataPulling();
}
}
};
/**
* Requests a gracefull shutdown of the Member Model
* No more network activity is necessary.
*/
this.close = function (cb) {
isServerPullingOpen = false;
cb();
};
runtime.assert(server.networkStatus() === "ready", "network not ready");
};
});
@@ -27,10 +27,9 @@
define("webodf/editor/server/pullbox/ServerFactory", [
"webodf/editor/server/pullbox/Server",
"webodf/editor/server/pullbox/MemberModel",
"webodf/editor/server/pullbox/OperationRouter",
"webodf/editor/server/pullbox/SessionList"],
function (PullBoxServer, PullBoxMemberModel, PullBoxOperationRouter, PullBoxSessionList) {
function (PullBoxServer, PullBoxOperationRouter, PullBoxSessionList) {
"use strict";
/**
@@ -44,9 +43,6 @@ define("webodf/editor/server/pullbox/ServerFactory", [
this.createOperationRouter = function (sid, mid, server, odfContainer) {
return new PullBoxOperationRouter(sid, mid, server, odfContainer);
};
this.createMemberModel = function (sid, server) {
return new PullBoxMemberModel(sid, server);
};
this.createSessionList = function (server) {
return new PullBoxSessionList(server);
};
-25
View File
@@ -180,8 +180,6 @@ gui.AnnotationViewManager = function AnnotationViewManager(odfCanvas, odfFragmen
connectorAngle = 0,
previousAnnotation = annotations[annotations.indexOf(annotation) - 1],
previousRect,
creatorNode = annotation.node.getElementsByTagNameNS(odf.Namespaces.dcns, 'creator')[0],
creatorName,
zoomLevel = odfCanvas.getZoomLevel();
annotationNote.style.left =
@@ -220,29 +218,6 @@ gui.AnnotationViewManager = function AnnotationViewManager(odfCanvas, odfFragmen
connectorAngular.style.MozTransform = 'rotate(' + connectorAngle + 'rad)';
connectorAngular.style.WebkitTransform = 'rotate(' + connectorAngle + 'rad)';
connectorAngular.style.msTransform = 'rotate(' + connectorAngle + 'rad)';
// Bad hack: Since we do not have a straightforward way to access member data here, we will read the computed style
// of dc:creator[editinfo|memberid]:before, always applied by SessionView, because that contains the creator name
// as the content, when an annotation is created by OpAddAnnotation.
if (creatorNode) {
creatorName = window.getComputedStyle(/**@type{!Element}*/(creatorNode), ':before').content;
// The default `content: ` value for :before and :after pseudo-elements
// in webkit is '' and `none` in gecko.
if (creatorName && creatorName !== 'none') {
// Strip possible opening and closing quotes
/*jslint regexp: true*/ // jslint complains otherwise about "Insecure '.'"
if (/^["'].*["']$/.test(creatorName)) {
creatorName = creatorName.substring(1, creatorName.length - 1);
}
/*jslint regexp: false*/
if (creatorNode.firstChild) {
creatorNode.firstChild.nodeValue = creatorName;
} else {
creatorNode.appendChild(doc.createTextNode(creatorName));
}
}
}
}
/**
+17 -51
View File
@@ -39,7 +39,6 @@
/*global Node, document, runtime, gui, ops, core */
runtime.loadClass("gui.Caret");
runtime.loadClass("ops.TrivialMemberModel");
runtime.loadClass("ops.EditInfo");
runtime.loadClass("gui.EditInfoMarker");
@@ -164,7 +163,6 @@ gui.SessionView = (function () {
setStyle('div.editInfoMarker', '{ background-color: ' + color + '; }', '');
setStyle('span.editInfoColor', '{ background-color: ' + color + '; }', '');
setStyle('span.editInfoAuthor', '{ content: "' + name + '"; }', ':before');
setStyle('dc|creator', '{ content: "' + name + '"; display: none;}', ':before');
setStyle('dc|creator', '{ background-color: ' + color + '; }', '');
setStyle('div.selectionOverlay', '{ background-color: ' + color + ';}', '');
}
@@ -299,31 +297,17 @@ gui.SessionView = (function () {
};
/**
* @param {!string} memberId
* @param {?Object} memberData
* @param {!ops.Member} member
* @return {undefined}
*
* Setting memberData to null will apply empty (bogus) member data.
*/
function renderMemberData(memberId, memberData) {
var caret = caretManager.getCaret(memberId);
function renderMemberData(member) {
var memberId = member.getMemberId(),
properties = member.getProperties();
// this takes care of incorrectly implemented MemberModels,
// which might end up returning undefined member data
if (!memberData) {
runtime.log("MemberModel sent undefined data for member \"" + memberId + "\".");
return;
}
if (caret) {
caret.setAvatarImageUrl(memberData.imageurl);
caret.setColor(memberData.color);
}
setAvatarInfoStyle(memberId, memberData.fullname, memberData.color);
setAvatarInfoStyle(memberId, properties.fullName, properties.color);
if (localMemberId === memberId) {
// Shadow cursor has an empty member ID
setAvatarInfoStyle("", memberData.fullname, memberData.color);
setAvatarInfoStyle("", "", properties.color);
}
}
@@ -333,18 +317,17 @@ gui.SessionView = (function () {
*/
function onCursorAdded(cursor) {
var memberId = cursor.getMemberId(),
memberModel = session.getMemberModel();
properties = session.getOdtDocument().getMember(memberId).getProperties(),
caret;
caretManager.registerCursor(cursor, showCaretAvatars, blinkOnRangeSelect);
selectionViewManager.registerCursor(cursor, true);
// preset bogus data
// TODO: indicate loading state
// (instead of setting the final 'unknown identity' data)
renderMemberData(memberId, null);
// subscribe to real updates
memberModel.getMemberDetailsAndUpdates(memberId, renderMemberData);
caret = caretManager.getCaret(memberId);
if (caret) {
caret.setAvatarImageUrl(properties.imageUrl);
caret.setColor(properties.color);
}
runtime.log("+++ View here +++ eagerly created an Caret for '" + memberId + "'! +++");
}
@@ -376,23 +359,7 @@ gui.SessionView = (function () {
* @return {undefined}
*/
function onCursorRemoved(memberid) {
var /**@type{!boolean}*/ hasMemberEditInfo = false,
keyname;
// check if there is any edit info with this member
for (keyname in editInfoMap) {
if (editInfoMap.hasOwnProperty(keyname) &&
editInfoMap[keyname].getEditInfo().getEdits().hasOwnProperty(memberid)) {
hasMemberEditInfo = true;
break;
}
}
selectionViewManager.removeSelectionView(memberid);
if (!hasMemberEditInfo) {
session.getMemberModel().unsubscribeMemberDetailsUpdates(memberid, renderMemberData);
}
}
/**
@@ -436,9 +403,10 @@ gui.SessionView = (function () {
*/
this.destroy = function(callback) {
var odtDocument = session.getOdtDocument(),
memberModel = session.getMemberModel(),
editInfoArray = Object.keys(editInfoMap).map(function(keyname) { return editInfoMap[keyname]; });
odtDocument.unsubscribe(ops.OdtDocument.signalMemberAdded, renderMemberData);
odtDocument.unsubscribe(ops.OdtDocument.signalMemberUpdated, renderMemberData);
odtDocument.unsubscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded);
odtDocument.unsubscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved);
odtDocument.unsubscribe(ops.OdtDocument.signalParagraphChanged, onParagraphChanged);
@@ -450,10 +418,6 @@ gui.SessionView = (function () {
stopRerenderLoop();
caretManager.getCarets().forEach(function(caret) {
memberModel.unsubscribeMemberDetailsUpdates(caret.getCursor().getMemberId(), renderMemberData);
});
avatarInfoStyles.parentNode.removeChild(avatarInfoStyles);
(function destroyEditInfo(i, err){
@@ -473,6 +437,8 @@ gui.SessionView = (function () {
var odtDocument = session.getOdtDocument(),
head = document.getElementsByTagName('head')[0];
odtDocument.subscribe(ops.OdtDocument.signalMemberAdded, renderMemberData);
odtDocument.subscribe(ops.OdtDocument.signalMemberUpdated, renderMemberData);
odtDocument.subscribe(ops.OdtDocument.signalCursorAdded, onCursorAdded);
odtDocument.subscribe(ops.OdtDocument.signalCursorRemoved, onCursorRemoved);
odtDocument.subscribe(ops.OdtDocument.signalParagraphChanged, onParagraphChanged);
+4 -2
View File
@@ -98,8 +98,7 @@
"ops/Server.js",
"ops/EditInfo.js",
"ops/StepsTranslator.js",
"ops/MemberModel.js",
"ops/TrivialMemberModel.js",
"ops/Member.js",
"ops/Operation.js",
"ops/OperationTransformMatrix.js",
"ops/OperationTransformer.js",
@@ -109,6 +108,9 @@
"ops/OdtDocument.js",
"ops/Session.js",
"ops/SessionNodeFilter.js",
"ops/OpAddMember.js",
"ops/OpUpdateMember.js",
"ops/OpRemoveMember.js",
"ops/OpAddCursor.js",
"ops/OpAddAnnotation.js",
"ops/OpApplyDirectStyling.js",
+113
View File
@@ -0,0 +1,113 @@
/**
* @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* This file is part of WebODF.
*
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops, runtime*/
/**
* Class to represent a member in WebODF.
* A member is uniquely identified by it's memberId,
* and this class encapsulates various things like
* the full name and also custom properties that can represent
* information like the avatar image, color, etc.
* @constructor
* @param {!string} memberId The unique identifier of this member.
* @param {?Object.<!string, !string>} properties Custom properties
* that may contain some reserved keys such as fullName (string),
* imageUrl (string representing a URL) and color (string representing
* CSS color value).
*/
ops.Member = function Member(memberId, properties) {
"use strict";
var props = {};
/**
* Returns the member ID of the member
* @return {!string}
*/
function getMemberId() {
return memberId;
}
/**
* Returns the properties of the member
* (including fullName, color, and imageUrl)
* @return {Object}
*/
function getProperties() {
return props;
}
/**
* Sets some properties on the member
* @param {!Object.<!string, !string>} newProperties
* @return {undefined}
*/
function setProperties(newProperties) {
Object.keys(newProperties).forEach(function (key) {
props[key] = newProperties[key];
});
}
/**
* Removes the properties specified in the object.
* 'fullName', 'color', and 'imageUrl' are not
* removable, they will be filtered out of
* removedProperties if found.
* @param {!Object} removedProperties
* @return {undefined}
*/
function removeProperties(removedProperties) {
delete removedProperties.fullName;
delete removedProperties.color;
delete removedProperties.imageUrl;
Object.keys(removedProperties).forEach(function (key) {
if (props.hasOwnProperty(key)) {
delete props[key];
}
});
}
this.getMemberId = getMemberId;
this.getProperties = getProperties;
this.setProperties = setProperties;
this.removeProperties = removeProperties;
function init() {
runtime.assert(Boolean(memberId), "No memberId was supplied!");
if (!properties.fullName) {
properties.fullName = runtime.tr("Unknown Author");
}
if (!properties.color) {
properties.color = "black";
}
if (!properties.imageUrl) {
properties.imageUrl = "avatar-joe.png";
}
props = properties;
}
init();
};
-83
View File
@@ -1,83 +0,0 @@
/**
* @license
* Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops*/
/*jslint emptyblock: true, unparam: true*/
/*
* this thing might feel a bit more at home in a namespaces
* called "collab" or "members" or "editing" than here in "ops".
*/
/**
* A model which provides information about members in a session.
* @interface
*/
ops.MemberModel = function MemberModel() {"use strict"; };
/**
* callback is called as soon as the memberdata is available and after that
* on every memberdata update.
* a parameter `null` passed to the callback means that the member is finally
* not known.
*
* @param {!string} memberId
* @param {function(!string, ?Object)} subscriber
* @return {undefined}
*/
ops.MemberModel.prototype.getMemberDetailsAndUpdates = function (memberId, subscriber) {"use strict"; };
/**
* getMemberDetailsAndUpdates subscribes a callback for updates on member details.
* this function undoes this subscription.
*
* @param {!string} memberId
* @param {function(!string, ?Object)} subscriber
* @return {undefined}
*/
ops.MemberModel.prototype.unsubscribeMemberDetailsUpdates = function (memberId, subscriber) {"use strict"; };
/**
* Requests a gracefull shutdown of the Member Model
* No more network activity is necessary.
* A callback is called, getting passed an error object in case of error.
*
* @param {!function(!Object=)} callback
* @return {undefined}
*/
ops.MemberModel.prototype.close = function (callback) {"use strict"; };
+33
View File
@@ -46,6 +46,7 @@ runtime.loadClass("gui.SelectionMover");
runtime.loadClass("core.PositionFilterChain");
runtime.loadClass("ops.StepsTranslator");
runtime.loadClass("ops.TextPositionFilter");
runtime.loadClass("ops.Member");
/**
* A document that keeps all data related to the mapped document.
@@ -59,7 +60,11 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
odfUtils,
domUtils,
/**!Object.<!ops.OdtCursor>*/cursors = {},
/**!Object.<!ops.Member>*/members = {},
eventNotifier = new core.EventNotifier([
ops.OdtDocument.signalMemberAdded,
ops.OdtDocument.signalMemberUpdated,
ops.OdtDocument.signalMemberRemoved,
ops.OdtDocument.signalCursorAdded,
ops.OdtDocument.signalCursorRemoved,
ops.OdtDocument.signalCursorMoved,
@@ -583,6 +588,31 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
*/
this.getRootNode = getRootNode;
/**
* @param {!ops.Member} member
* @return {undefined}
*/
this.addMember = function (member) {
runtime.assert(members[member.getMemberId()] === undefined, "This member already exists");
members[member.getMemberId()] = member;
};
/**
* @param {!string} memberId
* @return {?ops.Member}
*/
this.getMember = function (memberId) {
return members.hasOwnProperty(memberId) ? members[memberId] : null;
};
/**
* @param {!string} memberId
* @return {undefined}
*/
this.removeMember = function (memberId) {
delete members[memberId];
};
/**
* @param {!string} memberid
* @return {ops.OdtCursor}
@@ -728,6 +758,9 @@ ops.OdtDocument = function OdtDocument(odfCanvas) {
init();
};
/**@const*/ops.OdtDocument.signalMemberAdded = "member/added";
/**@const*/ops.OdtDocument.signalMemberUpdated = "member/updated";
/**@const*/ops.OdtDocument.signalMemberRemoved = "member/removed";
/**@const*/ops.OdtDocument.signalCursorAdded = "cursor/added";
/**@const*/ops.OdtDocument.signalCursorRemoved = "cursor/removed";
/**@const*/ops.OdtDocument.signalCursorMoved = "cursor/moved";
+1 -2
View File
@@ -72,10 +72,9 @@ ops.OpAddAnnotation = function OpAddAnnotation() {
annotationNode = doc.createElementNS(odf.Namespaces.officens, 'office:annotation');
annotationNode.setAttributeNS(odf.Namespaces.officens, 'office:name', name);
// Only set the memberid attribute on dc:creator. Let the annotation manager actually set the name
// for now
creatorNode = doc.createElementNS(odf.Namespaces.dcns, 'dc:creator');
creatorNode.setAttributeNS('urn:webodf:names:editinfo', 'editinfo:memberid', memberid);
creatorNode.textContent = odtDocument.getMember(memberid).getProperties().fullName;
// Date.toISOString return the current Dublin Core representation
dateNode = doc.createElementNS(odf.Namespaces.dcns, 'dc:date');
+71
View File
@@ -0,0 +1,71 @@
/**
* @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* This file is part of WebODF.
*
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops, runtime*/
runtime.loadClass("ops.Member");
/**
* OpAddMember has 3 required properties:
* fullName, color, and imageUrl. Because the
* spec does not expose those explicitly right now,
* internally these properties are set as
* runtime.tr("Unknown Author"), 'black', and "avatar-joe.png"
* respectively, if unspecified.
* @constructor
* @implements ops.Operation
*/
ops.OpAddMember = function OpAddMember() {
"use strict";
var memberid, timestamp, setProperties;
this.init = function (data) {
memberid = data.memberid;
timestamp = parseInt(data.timestamp, 10);
setProperties = data.setProperties;
};
this.execute = function (odtDocument) {
if (odtDocument.getMember(memberid)) {
return false;
}
var member = new ops.Member(memberid, setProperties);
odtDocument.addMember(member);
odtDocument.emit(ops.OdtDocument.signalMemberAdded, member);
return true;
};
this.spec = function () {
return {
optype: "AddMember",
memberid: memberid,
timestamp: timestamp,
setProperties: setProperties
};
};
};
+62
View File
@@ -0,0 +1,62 @@
/**
* @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* This file is part of WebODF.
*
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops, runtime*/
runtime.loadClass("ops.Member");
/**
* @constructor
* @implements ops.Operation
*/
ops.OpRemoveMember = function OpRemoveMember() {
"use strict";
var memberid, timestamp;
this.init = function (data) {
memberid = data.memberid;
timestamp = parseInt(data.timestamp, 10);
};
this.execute = function (odtDocument) {
if (!odtDocument.getMember(memberid)) {
return false;
}
odtDocument.removeMember(memberid);
odtDocument.emit(ops.OdtDocument.signalMemberRemoved, memberid);
return true;
};
this.spec = function () {
return {
optype: "RemoveMember",
memberid: memberid,
timestamp: timestamp
};
};
};
+102
View File
@@ -0,0 +1,102 @@
/**
* @license
* Copyright (C) 2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* This file is part of WebODF.
*
* WebODF is free software: you can redistribute it and/or modify it
* under the terms of the GNU Affero General Public License (GNU AGPL)
* as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* WebODF is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with WebODF. If not, see <http://www.gnu.org/licenses/>.
* @licend
*
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops, xmldom, odf, runtime*/
runtime.loadClass("ops.Member");
runtime.loadClass("xmldom.XPath");
/**
* OpUpdateMember allows you to set and remove
* certain properties.
* 'fullName', 'color', and 'imageUrl' are not
* removable, they will be filtered out of
* removedProperties if found.
* @constructor
* @implements ops.Operation
*/
ops.OpUpdateMember = function OpUpdateMember() {
"use strict";
var memberid, timestamp,
/**@type{Object}*/setProperties,
/**@type{{attributes}}*/removedProperties,
doc;
this.init = function (data) {
memberid = data.memberid;
timestamp = parseInt(data.timestamp, 10);
setProperties = data.setProperties;
removedProperties = data.removedProperties;
};
function updateCreators() {
var xpath = new xmldom.XPath(),
xp = "//dc:creator[@editinfo:memberid='" + memberid + "']",
creators = xpath.getODFElementsWithXPath(doc.getRootNode(), xp, function (prefix) {
if (prefix === "editinfo") {
return "urn:webodf:names:editinfo";
}
return odf.Namespaces.resolvePrefix(prefix);
}),
i;
for (i = 0; i < creators.length; i += 1) {
creators[i].textContent = setProperties.fullName;
}
}
this.execute = function (odtDocument) {
doc = odtDocument;
var member = odtDocument.getMember(memberid);
if (!member) {
return false;
}
if (removedProperties) {
member.removeProperties(removedProperties);
}
if (setProperties) {
member.setProperties(setProperties);
if (setProperties.fullName) {
updateCreators();
}
}
odtDocument.emit(ops.OdtDocument.signalMemberUpdated, member);
return true;
};
this.spec = function () {
return {
optype: "UpdateMember",
memberid: memberid,
timestamp: timestamp,
setProperties: setProperties,
removedProperties: removedProperties
};
};
};
+6
View File
@@ -42,6 +42,9 @@
* create specific operation instances.
*/
runtime.loadClass("ops.OpAddMember");
runtime.loadClass("ops.OpUpdateMember");
runtime.loadClass("ops.OpRemoveMember");
runtime.loadClass("ops.OpAddCursor");
runtime.loadClass("ops.OpApplyDirectStyling");
runtime.loadClass("ops.OpRemoveCursor");
@@ -104,6 +107,9 @@ ops.OperationFactory = function OperationFactory() {
function init() {
specs = {
AddMember: constructor(ops.OpAddMember),
UpdateMember: constructor(ops.OpUpdateMember),
RemoveMember: constructor(ops.OpRemoveMember),
AddCursor : constructor(ops.OpAddCursor),
ApplyDirectStyling : constructor(ops.OpApplyDirectStyling),
SetBlob : constructor(ops.OpSetBlob),
@@ -1014,6 +1014,13 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() {
* empty if the opspec turned into a no-op in the transformation.
* If a transformation is not doable, the method returns "null".
*
* Some operations are added onto the stack by the server, for example
* AddMember, RemoveMember, and UpdateMember. These therefore need
* not be transformed against each other, since the server is the
* only originator of these ops. Therefore, their entries in the
* matrix are missing. They do however require a passUnchanged entry
* with other ops.
*
* Here the CC signature of each transformation method:
* param {!Object} opspecA
* param {!Object} opspecB
@@ -1029,11 +1036,25 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() {
{
"AddCursor": {
"AddCursor": passUnchanged,
"AddMember": passUnchanged,
"AddStyle": passUnchanged,
"ApplyDirectStyling": passUnchanged,
"InsertText": passUnchanged,
"MoveCursor": passUnchanged,
"RemoveCursor": passUnchanged,
"RemoveMember": passUnchanged,
"RemoveStyle": passUnchanged,
"RemoveText": passUnchanged,
"SetParagraphStyle": passUnchanged,
"SplitParagraph": passUnchanged,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"AddMember": {
"AddStyle": passUnchanged,
"InsertText": passUnchanged,
"MoveCursor": passUnchanged,
"RemoveCursor": passUnchanged,
"RemoveStyle": passUnchanged,
"RemoveText": passUnchanged,
"SetParagraphStyle": passUnchanged,
@@ -1046,10 +1067,12 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() {
"InsertText": passUnchanged,
"MoveCursor": passUnchanged,
"RemoveCursor": passUnchanged,
"RemoveMember": passUnchanged,
"RemoveStyle": transformAddStyleRemoveStyle,
"RemoveText": passUnchanged,
"SetParagraphStyle": passUnchanged,
"SplitParagraph": passUnchanged,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"ApplyDirectStyling": {
@@ -1067,49 +1090,69 @@ ops.OperationTransformMatrix = function OperationTransformMatrix() {
"InsertText": transformInsertTextInsertText,
"MoveCursor": transformInsertTextMoveCursor,
"RemoveCursor": passUnchanged,
"RemoveMember": passUnchanged,
"RemoveStyle": passUnchanged,
"RemoveText": transformInsertTextRemoveText,
// TODO:"SetParagraphStyle": transformInsertTextSetParagraphStyle,
"SplitParagraph": transformInsertTextSplitParagraph,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"MoveCursor": {
"MoveCursor": passUnchanged,
"RemoveCursor": transformMoveCursorRemoveCursor,
"RemoveMember": passUnchanged,
"RemoveStyle": passUnchanged,
"RemoveText": transformMoveCursorRemoveText,
"SetParagraphStyle": passUnchanged,
"SplitParagraph": transformMoveCursorSplitParagraph,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"RemoveCursor": {
"RemoveCursor": transformRemoveCursorRemoveCursor,
"RemoveMember": passUnchanged,
"RemoveStyle": passUnchanged,
"RemoveText": passUnchanged,
"SetParagraphStyle": passUnchanged,
"SplitParagraph": passUnchanged,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"RemoveMember": {
"RemoveStyle": passUnchanged,
"RemoveText": passUnchanged,
"SetParagraphStyle": passUnchanged,
"SplitParagraph": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"RemoveStyle": {
"RemoveStyle": transformRemoveStyleRemoveStyle,
"RemoveText": passUnchanged,
"SetParagraphStyle": transformRemoveStyleSetParagraphStyle,
"SplitParagraph": passUnchanged,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": transformRemoveStyleUpdateParagraphStyle
},
"RemoveText": {
"RemoveText": transformRemoveTextRemoveText,
// TODO:"SetParagraphStyle": transformRemoveTextSetParagraphStyle,
"SplitParagraph": transformRemoveTextSplitParagraph,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"SetParagraphStyle": {
// TODO:"SetParagraphStyle": transformSetParagraphStyleSetParagraphStyle,
// TODO:"SetParagraphStyle": transformSetParagraphStyleSplitParagraph,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"SplitParagraph": {
"SplitParagraph": transformSplitParagraphSplitParagraph,
"UpdateMember": passUnchanged,
"UpdateParagraphStyle": passUnchanged
},
"UpdateMember": {
"UpdateParagraphStyle": passUnchanged
},
"UpdateParagraphStyle": {
+1 -25
View File
@@ -38,7 +38,6 @@
/*global runtime, ops, odf*/
runtime.loadClass("ops.TrivialMemberModel");
runtime.loadClass("ops.TrivialOperationRouter");
runtime.loadClass("ops.OperationFactory");
runtime.loadClass("ops.OdtDocument");
@@ -55,19 +54,9 @@ ops.Session = function Session(odfCanvas) {
operationFactory = new ops.OperationFactory(),
/**@type{!ops.OdtDocument}*/
odtDocument = new ops.OdtDocument(odfCanvas),
/**@type{!ops.MemberModel}*/
memberModel = new ops.TrivialMemberModel(),
/**@type{?ops.OperationRouter}*/
operationRouter = null;
/**
* @param {!ops.MemberModel} uModel
* @return {undefined}
*/
this.setMemberModel = function (uModel) {
memberModel = uModel;
};
/**
* @param {!ops.OperationFactory} opFactory
*/
@@ -91,13 +80,6 @@ ops.Session = function Session(odfCanvas) {
opRouter.setOperationFactory(operationFactory);
};
/**
* @return {!ops.MemberModel}
*/
this.getMemberModel = function () {
return memberModel;
};
/**
* @returns {!ops.OperationFactory}
*/
@@ -131,13 +113,7 @@ ops.Session = function Session(odfCanvas) {
if (err) {
callback(err);
} else {
memberModel.close(function(err) {
if (err) {
callback(err);
} else {
odtDocument.close(callback);
}
});
odtDocument.close(callback);
}
});
};
-89
View File
@@ -1,89 +0,0 @@
/**
* @license
* Copyright (C) 2012-2013 KO GmbH <copyright@kogmbh.com>
*
* @licstart
* The JavaScript code in this page is free software: you can redistribute it
* and/or modify it under the terms of the GNU Affero General Public License
* (GNU AGPL) as published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version. The code is distributed
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU AGPL for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this code. If not, see <http://www.gnu.org/licenses/>.
*
* As additional permission under GNU AGPL version 3 section 7, you
* may distribute non-source (e.g., minimized or compacted) forms of
* that code without the copy of the GNU GPL normally required by
* section 4, provided you include this license notice and a URL
* through which recipients can access the Corresponding Source.
*
* As a special exception to the AGPL, any HTML file which merely makes function
* calls to this code, and for that purpose includes it by reference shall be
* deemed a separate work for copyright law purposes. In addition, the copyright
* holders of this code give you permission to combine this code with free
* software libraries that are released under the GNU LGPL. You may copy and
* distribute such a system following the terms of the GNU AGPL for this code
* and the LGPL for the libraries. If you modify this code, you may extend this
* exception to your version of the code, but you are not obligated to do so.
* If you do not wish to do so, delete this exception statement from your
* version.
*
* This license applies to this entire compilation.
* @licend
* @source: http://www.webodf.org/
* @source: https://github.com/kogmbh/WebODF/
*/
/*global ops, runtime*/
/*
* this thing might feel a bit more at home in a namespaces
* called "collab" or "members" or "editing" than here in "ops".
*/
/**
* @constructor
* @implements ops.MemberModel
*/
ops.TrivialMemberModel = function TrivialMemberModel() {
"use strict";
/**
* callback is called as soon as the memberdata is available and after that
* on every memberdata update.
* a parameter `null` passed to the callback means that the member is finally
* not known.
*
* @param {!string} memberId
* @param {function(!string, ?Object)} subscriber
* @return {undefined}
*/
this.getMemberDetailsAndUpdates = function (memberId, subscriber) {
// pass some dummy data
subscriber(memberId, {
memberid: memberId,
fullname: runtime.tr("Unknown Author"),
color: "black",
imageurl: "avatar-joe.png"
});
// no need to note the subscriber, as there will never be updates
};
/*jslint emptyblock: true, unparam: true*/
/**
* getMemberDetailsAndUpdates subscribes a callback for updates on member details.
* this function undoes this subscription.
*
* @param {!string} memberId
* @param {function(!string, ?Object)} subscriber
* @return {undefined}
*/
this.unsubscribeMemberDetailsUpdates = function (memberId, subscriber) {
};
this.close = function (cb) {
cb();
};
};
+5
View File
@@ -315,6 +315,11 @@ ops.OperationTests = function OperationTests(runner) {
t.odfContainer = new odf.OdfContainer("", null);
t.odfcanvas.setOdfContainer(t.odfContainer);
t.odtDocument = new ops.OdtDocument(t.odfcanvas);
t.odtDocument.addMember(new ops.Member('Alice', {
color: "black",
fullName: "Alice",
imageUrl: ""
}));
};
this.tearDown = function () {
t.odfcanvas.destroy(function() { return; });
+48 -12
View File
@@ -1128,7 +1128,43 @@
</op>
</ops>
<after>
<office:text><text:p>AB<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>CD</text:p></office:text>
<office:text><text:p>AB<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>CD</text:p></office:text>
</after>
</test>
<test name="AddMemberAddAnnotation_simple">
<before>
<office:text><text:p>ABCD</text:p></office:text>
</before>
<ops>
<op optype="AddMember" memberid="John">
<setProperties fullName="John Doe">
</setProperties>
</op>
<op optype="AddAnnotation" memberid="John" position="2" length="0" name="alice_1" timestamp="1375706047061">
</op>
</ops>
<after>
<office:text><text:p>AB<office:annotation office:name="alice_1"><dc:creator e:memberid="John">John Doe</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>CD</text:p></office:text>
</after>
</test>
<test name="AddAnnotationUpdateMember_simple">
<before>
<office:text><text:p>ABCD</text:p></office:text>
</before>
<ops>
<op optype="AddMember" memberid="John">
<setProperties fullName="John Doe">
</setProperties>
</op>
<op optype="AddAnnotation" memberid="John" position="2" length="0" name="alice_1" timestamp="1375706047061">
</op>
<op optype="UpdateMember" memberid="John">
<setProperties fullName="Don Joe">
</setProperties>
</op>
</ops>
<after>
<office:text><text:p>AB<office:annotation office:name="alice_1"><dc:creator e:memberid="John">Don Joe</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>CD</text:p></office:text>
</after>
</test>
<test name="AddAnnotation_ranged">
@@ -1140,7 +1176,7 @@
</op>
</ops>
<after>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>H<office:annotation-end office:name="alice_2"/>IJ</text:span></text:p></office:text>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>H<office:annotation-end office:name="alice_2"/>IJ</text:span></text:p></office:text>
</after>
</test>
<test name="AddAnnotation_rangedMultiple">
@@ -1152,12 +1188,12 @@
<op optype="AddAnnotation" memberid="Alice" position="3" length="0" name="alice_2" timestamp="1375706047061"/>
</ops>
<after>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>H<office:annotation-end office:name="alice_1"/>IJ</text:span></text:p></office:text>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>H<office:annotation-end office:name="alice_1"/>IJ</text:span></text:p></office:text>
</after>
</test>
<test name="RemoveAnnotation_ranged">
<before>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p>xyz</text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>H<office:annotation-end office:name="alice_2"/>IJ</text:span></text:p></office:text>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p>xyz</text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>H<office:annotation-end office:name="alice_2"/>IJ</text:span></text:p></office:text>
</before>
<ops>
<op optype="RemoveAnnotation" memberid="Alice" position="4" length="3">
@@ -1169,7 +1205,7 @@
</test>
<test name="RemoveAnnotation_simple">
<before>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>HIJ</text:span></text:p></office:text>
<office:text><text:p>ABC<office:annotation office:name="alice_2"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p></text:p></text:list-item></text:list></office:annotation>D</text:p><text:p>EFG<text:span>HIJ</text:span></text:p></office:text>
</before>
<ops>
<op optype="RemoveAnnotation" memberid="Alice" position="4" length="0">
@@ -1190,7 +1226,7 @@
<op optype="MoveCursor" memberid="Eve" position="3"/>
<op optype="AddAnnotation" memberid="Alice" position="3" length="0" name="alice_1" timestamp="1375706047061"/>
</ops>
<after><office:text><text:p>abc<c:cursor c:memberId="Bob"/><c:cursor c:memberId="Eve"/><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>defgh</text:p></office:text></after>
<after><office:text><text:p>abc<c:cursor c:memberId="Bob"/><c:cursor c:memberId="Eve"/><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>defgh</text:p></office:text></after>
</test>
<test name="AddAnnotation_simple_multiCursors_2">
<before><office:text><text:p>abcdefgh</text:p></office:text></before>
@@ -1203,7 +1239,7 @@
<op optype="AddCursor" memberid="Eve"/>
<op optype="MoveCursor" memberid="Eve" position="3"/>
</ops>
<after><office:text><text:p>abc<c:cursor c:memberId="Bob"/><c:cursor c:memberId="Eve"/><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>defgh</text:p></office:text></after>
<after><office:text><text:p>abc<c:cursor c:memberId="Bob"/><c:cursor c:memberId="Eve"/><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>defgh</text:p></office:text></after>
</test>
<test name="SplitParagraphAddAnnotation_startPosSame">
<!-- a paragraph split at the position of the start of an annotation should keep the split outside of the annotation,
@@ -1217,7 +1253,7 @@
<op optype="AddAnnotation" memberid="Alice" position="2" length="1" name="alice_1" timestamp="1375706047061"/>
<op optype="SplitParagraph" memberid="Bob" position="2"/>
</ops>
<after><office:text><text:p>ab</text:p><text:p><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation><c:cursor c:memberId="Bob"/>c<office:annotation-end office:name="alice_1"/>d</text:p></office:text></after>
<after><office:text><text:p>ab</text:p><text:p><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation><c:cursor c:memberId="Bob"/>c<office:annotation-end office:name="alice_1"/>d</text:p></office:text></after>
</test>
<test name="SplitParagraphAddAnnotation_endPosSame">
<!-- a paragraph split at the position of the end of an annotation should add the split to the annotated area -->
@@ -1230,7 +1266,7 @@
<op optype="AddAnnotation" memberid="Alice" position="2" length="1" name="alice_1" timestamp="1375706047061"/>
<op optype="SplitParagraph" memberid="Bob" position="4"/>
</ops>
<after><office:text><text:p>ab<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>c</text:p><text:p><office:annotation-end office:name="alice_1"/><c:cursor c:memberId="Bob"/>d</text:p></office:text></after>
<after><office:text><text:p>ab<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>c</text:p><text:p><office:annotation-end office:name="alice_1"/><c:cursor c:memberId="Bob"/>d</text:p></office:text></after>
</test>
<test name="AddAnnotationInsertText_startPosSameNotAtStartOfParagraph">
<!-- text inserted at the position of the start of an annotation which is not at the start of a paragraph should be added before the annotated area -->
@@ -1243,7 +1279,7 @@
<op optype="AddAnnotation" memberid="Alice" position="2" length="1" name="alice_1" timestamp="1375706047061"/>
<op optype="InsertText" memberid="Bob" position="2" text="123"/>
</ops>
<after><office:text><text:p>ab123<c:cursor c:memberId="Bob"/><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>c<office:annotation-end office:name="alice_1"/>d</text:p></office:text></after>
<after><office:text><text:p>ab123<c:cursor c:memberId="Bob"/><office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>c<office:annotation-end office:name="alice_1"/>d</text:p></office:text></after>
</test>
<test name="AddAnnotationInsertText_endPosSameNotAtEndOfParagraph">
<!-- text inserted at the position of the end of an annotation which is not at the end of a paragraph should be added to the annotated area -->
@@ -1257,7 +1293,7 @@
<op optype="InsertText" memberid="Bob" position="4" text="1"/>
<op optype="InsertText" memberid="Bob" position="5" text="2"/>
</ops>
<after><office:text><text:p>ab<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>c12<c:cursor c:memberId="Bob"/><office:annotation-end office:name="alice_1"/>d</text:p></office:text></after>
<after><office:text><text:p>ab<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>c12<c:cursor c:memberId="Bob"/><office:annotation-end office:name="alice_1"/>d</text:p></office:text></after>
</test>
<test name="AddAnnotationInsertText_endPosSameAtEndOfParagraph">
<!-- also text inserted at the position of the end of an annotation which is at the end of a paragraph should be added to the annotated area -->
@@ -1271,7 +1307,7 @@
<op optype="InsertText" memberid="Bob" position="5" text="1"/>
<op optype="InsertText" memberid="Bob" position="6" text="2"/>
</ops>
<after><office:text><text:p>ab<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice"></dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>cd12<c:cursor c:memberId="Bob"/><office:annotation-end office:name="alice_1"/></text:p></office:text></after>
<after><office:text><text:p>ab<office:annotation office:name="alice_1"><dc:creator e:memberid="Alice">Alice</dc:creator><dc:date>2013-08-05T12:34:07.061Z</dc:date><text:list><text:list-item><text:p><c:cursor c:memberId="Alice"/></text:p></text:list-item></text:list></office:annotation>cd12<c:cursor c:memberId="Bob"/><office:annotation-end office:name="alice_1"/></text:p></office:text></after>
</test>
<test name="InsertImage">
<before>
+4 -2
View File
@@ -48,6 +48,10 @@
<script src="../lib/odf/OdfCanvas.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/odf/CommandLineTools.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/Operation.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/Member.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/OpAddMember.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/OpUpdateMember.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/OpRemoveMember.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/OpAddCursor.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/gui/StyleHelper.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/OpAddAnnotation.js" type="text/javascript" charset="utf-8"></script>
@@ -87,8 +91,6 @@
<script src="../lib/gui/EventManager.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/gui/AnnotationController.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/gui/SessionController.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/MemberModel.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/TrivialMemberModel.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/ops/TrivialOperationRouter.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/gui/EditInfoHandle.js" type="text/javascript" charset="utf-8"></script>
<script src="../lib/gui/EditInfoMarker.js" type="text/javascript" charset="utf-8"></script>