<%= settingsBlock %>
diff --git a/public/res/providers/gdriveProviderBuilder.js b/public/res/providers/gdriveProviderBuilder.js
index e9612124..5582a46e 100644
--- a/public/res/providers/gdriveProviderBuilder.js
+++ b/public/res/providers/gdriveProviderBuilder.js
@@ -23,7 +23,6 @@ define([
gdriveProvider.defaultPublishFormat = "template";
gdriveProvider.exportPreferencesInputIds = [
providerId + "-parentid",
- providerId + "-realtime",
];
function createSyncIndex(id) {
@@ -63,10 +62,15 @@ define([
var fileDesc;
_.each(result, function(file) {
var parsedContent = gdriveProvider.parseContent(file.content);
- var syncAttributes = createSyncAttributes(file.id, file.etag, parsedContent.content, file.title, parsedContent.discussionListJSON);
- syncAttributes.isRealtime = file.isRealtime;
- var syncLocations = {};
- syncLocations[syncAttributes.syncIndex] = syncAttributes;
+ var syncLocations;
+ if(file.isRealtime) {
+ eventMgr.onError('Real time synchronization is not supported anymore. Please use standard synchronization.');
+ }
+ else {
+ var syncAttributes = createSyncAttributes(file.id, file.etag, parsedContent.content, file.title, parsedContent.discussionListJSON);
+ syncLocations = {};
+ syncLocations[syncAttributes.syncIndex] = syncAttributes;
+ }
fileDesc = fileMgr.createFile(file.title, parsedContent.content, parsedContent.discussionListJSON, syncLocations);
fileDescList.push(fileDesc);
});
@@ -121,18 +125,6 @@ define([
});
};
- gdriveProvider.exportRealtimeFile = function(event, title, content, discussionListJSON, callback) {
- var parentId = utils.getInputTextValue('#input-sync-export-' + providerId + '-parentid');
- googleHelper.createRealtimeFile(parentId, title, accountId, function(error, result) {
- if(error) {
- callback(error);
- return;
- }
- var syncAttributes = createSyncAttributes(result.id, result.etag, content, title, discussionListJSON);
- callback(undefined, syncAttributes);
- });
- };
-
gdriveProvider.syncUp = function(content, contentCRC, title, titleCRC, discussionList, discussionListCRC, syncAttributes, callback) {
if(
(syncAttributes.contentCRC == contentCRC) && // Content CRC hasn't changed
@@ -141,13 +133,23 @@ define([
) {
return callback(undefined, false);
}
- var uploadedContent = gdriveProvider.serializeContent(content, discussionList);
- googleHelper.upload(syncAttributes.id, undefined, title, uploadedContent, undefined, syncAttributes.etag, accountId, function(error, result) {
+
+ if(syncAttributes.isRealtime) {
+ var fileDesc = fileMgr.getFileFromSyncIndex(syncAttributes.syncIndex);
+ fileDesc.removeSyncLocation(syncAttributes);
+ eventMgr.onSyncRemoved(fileDesc, syncAttributes);
+ return eventMgr.onError('Real time synchronization is not supported anymore. Please use standard synchronization.');
+ }
+
+ var data = gdriveProvider.serializeContent(content, discussionList);
+ googleHelper.upload(syncAttributes.id, undefined, title, data, undefined, syncAttributes.etag, accountId, function(error, result) {
if(error) {
callback(error, true);
return;
}
syncAttributes.etag = result.etag;
+ // Remove this deprecated flag if exist
+ delete syncAttributes.isRealtime;
if(merge === true) {
// Need to store the whole content for merge
syncAttributes.content = content;
@@ -161,23 +163,6 @@ define([
});
};
- gdriveProvider.syncUpRealtime = function(content, contentCRC, title, titleCRC, discussionList, discussionListCRC, syncAttributes, callback) {
- // Skip if title CRC has not changed
- if(titleCRC == syncAttributes.titleCRC) {
- callback(undefined, false);
- return;
- }
- googleHelper.rename(syncAttributes.id, title, accountId, function(error, result) {
- if(error) {
- callback(error, true);
- return;
- }
- syncAttributes.etag = result.etag;
- syncAttributes.titleCRC = titleCRC;
- callback(undefined, true);
- });
- };
-
gdriveProvider.syncDown = function(callback) {
var lastChangeId = parseInt(storage[accountId + ".gdrive.lastChangeId"], 10);
googleHelper.checkChanges(lastChangeId, accountId, function(error, changes, newChangeId) {
@@ -223,11 +208,7 @@ define([
if(change.deleted === true) {
eventMgr.onError('"' + fileDesc.title + '" has been removed from ' + providerName + '.');
fileDesc.removeSyncLocation(syncAttributes);
- eventMgr.onSyncRemoved(fileDesc, syncAttributes);
- if(syncAttributes.isRealtime === true && fileMgr.currentFile === fileDesc) {
- gdriveProvider.stopRealtimeSync();
- }
- return;
+ return eventMgr.onSyncRemoved(fileDesc, syncAttributes);
}
var file = change.file;
var parsedContent = gdriveProvider.parseContent(file.content);
@@ -278,399 +259,6 @@ define([
return publishAttributes;
};
- // Keep a link to the Pagedown editor
- var pagedownEditor;
- var undoExecute;
- var redoExecute;
- var setUndoRedoButtonStates;
- eventMgr.addListener("onPagedownConfigure", function(pagedownEditorParam) {
- pagedownEditor = pagedownEditorParam;
- });
-
- // Realtime closure
- var realtimeContext;
- (function() {
- var inCompoundOperation = false;
- function modelChangeWrapper(cb) {
- realtimeContext.isChanging = true;
- try { cb(); }
- finally {
- if(inCompoundOperation) {
- try { realtimeContext.model.endCompoundOperation(); }
- catch(e) {}
- inCompoundOperation = false;
- }
- realtimeContext.isChanging = false;
- }
- }
- function compound(cb) {
- if(!inCompoundOperation) {
- realtimeContext.model.beginCompoundOperation();
- inCompoundOperation = true;
- }
- cb();
- }
-
- function toRealtimeDiscussion(context, discussion) {
- var realtimeCommentList = context.model.createList();
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_ADDED, onModelChange);
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_REMOVED, onModelChange);
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_SET, onModelChange);
- discussion.commentList && discussion.commentList.forEach(function(comment) {
- realtimeCommentList.push({
- author: comment.author,
- content: comment.content
- });
- });
- var realtimeDiscussion = context.model.createMap({
- discussionIndex: discussion.discussionIndex,
- selectionStart: discussion.selectionStart,
- selectionEnd: discussion.selectionEnd,
- type: discussion.type,
- commentList: realtimeCommentList
- });
- return realtimeDiscussion;
- }
-
- function toRealtimeDiscussionList(context) {
- var realtimeDiscussionList = context.model.createMap();
- _.each(context.fileDesc.discussionList, function(localDiscussion) {
- var realtimeDiscussion = toRealtimeDiscussion(context, localDiscussion);
- realtimeDiscussionList.set(localDiscussion.discussionIndex, realtimeDiscussion);
- });
- return realtimeDiscussionList;
- }
-
- function fromRealtimeDiscussion(realtimeDiscussion) {
- var realtimeCommentList = realtimeDiscussion.get('commentList');
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_ADDED, onModelChange);
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_REMOVED, onModelChange);
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_SET, onModelChange);
- var discussion = {
- discussionIndex: realtimeDiscussion.get('discussionIndex'),
- selectionStart: realtimeDiscussion.get('selectionStart'),
- selectionEnd: realtimeDiscussion.get('selectionEnd')
- };
- var type = realtimeDiscussion.get('type');
- type && (discussion.type = type);
- var commentList = realtimeCommentList.asArray();
- commentList.length && (discussion.commentList = commentList);
- return discussion;
- }
-
- function fromRealtimeDiscussionList(realtimeDiscussionList) {
- var localDiscussionList = {};
- realtimeDiscussionList.keys().forEach(function(discussionIndex) {
- var realtimeDiscussion = realtimeDiscussionList.get(discussionIndex);
- var discussion = fromRealtimeDiscussion(realtimeDiscussion);
- localDiscussionList[discussionIndex] = discussion;
- });
- return localDiscussionList;
- }
-
- function mergeDiscussion(localDiscussion, realtimeDiscussion, isModelChange) {
- var commentsChanged = false;
- // We don't pay attention to model selection modifications
- if(!isModelChange) {
- compound(function() {
- realtimeDiscussion.set('selectionStart', localDiscussion.selectionStart);
- realtimeDiscussion.set('selectionEnd', localDiscussion.selectionEnd);
- });
- }
- function isInDiscussion(comment, commentList) {
- return commentList.some(function(commentInDiscussion) {
- if(comment.author == commentInDiscussion.author && comment.content == commentInDiscussion.content) {
- return true;
- }
- });
- }
- var realtimeCommentList = realtimeDiscussion.get('commentList');
- var localCommentList = localDiscussion.commentList;
- function checkLocalComment(comment, index) {
- if(!isInDiscussion(comment, realtimeCommentList.asArray())) {
- if(isModelChange) {
- localCommentList.splice(index, 1);
- commentsChanged = true;
- return true;
- }
- else {
- compound(function() {
- realtimeCommentList.push(comment);
- });
- }
- }
- }
- while(localCommentList.some(checkLocalComment)) {}
- function checkRealtimeComment(comment, index) {
- if(!isInDiscussion(comment, localCommentList)) {
- if(!isModelChange) {
- compound(function() {
- realtimeCommentList.remove(index);
- });
- return true;
- }
- else {
- localCommentList.push(comment);
- commentsChanged = true;
- }
- }
- }
- while(realtimeCommentList.asArray().some(checkRealtimeComment)) {}
- return commentsChanged;
- }
-
- function mergeDiscussionList(context, isModelChange) {
- var commentsChanged = false;
- var localDiscussionList = context.fileDesc.discussionList;
- _.values(localDiscussionList).forEach(function(localDiscussion) {
- var realtimeDiscussion = context.realtimeDiscussionList.get(localDiscussion.discussionIndex);
- if(realtimeDiscussion) {
- commentsChanged |= mergeDiscussion(localDiscussion, realtimeDiscussion, isModelChange);
- }
- else if(!isModelChange) {
- compound(function() {
- realtimeDiscussion = toRealtimeDiscussion(context, localDiscussion);
- context.realtimeDiscussionList.set(localDiscussion.discussionIndex, realtimeDiscussion);
- });
- }
- else {
- delete localDiscussionList[localDiscussion.discussionIndex];
- eventMgr.onDiscussionRemoved(context.fileDesc, localDiscussion);
- }
- });
- context.realtimeDiscussionList.keys().forEach(function(discussionIndex) {
- var realtimeDiscussion = context.realtimeDiscussionList.get(discussionIndex);
- var localDiscussion = localDiscussionList[discussionIndex];
- if(localDiscussion) {
- commentsChanged |= mergeDiscussion(localDiscussion, realtimeDiscussion, isModelChange);
- }
- else if(isModelChange) {
- var discussion = fromRealtimeDiscussion(realtimeDiscussion);
- localDiscussionList[discussionIndex] = discussion;
- eventMgr.onDiscussionCreated(context.fileDesc, discussion);
- }
- else {
- compound(function() {
- context.realtimeDiscussionList.delete(discussionIndex);
- });
- }
- });
- context.fileDesc.discussionList = localDiscussionList; // Write in localStorage
- if(commentsChanged) {
- eventMgr.onCommentsChanged(context.fileDesc);
- }
- }
-
- function updateStatus() {
- var context = realtimeContext;
- if(!context) {
- return;
- }
- var syncAttributes = context.syncAttributes;
- var content = context.realtimeString.getText();
- syncAttributes.contentCRC = utils.crc32(content);
- var discussionList = {};
- context.realtimeDiscussionList.keys().forEach(function(discussionIndex) {
- var discussion = fromRealtimeDiscussion(context.realtimeDiscussionList.get(discussionIndex));
- discussionList[discussion.discussionIndex] = discussion;
- });
- var discussionListJSON = JSON.stringify(discussionList);
- syncAttributes.discussionListCRC = utils.crc32(discussionListJSON);
- if(merge === true) {
- // Need to store the whole content for merge
- syncAttributes.content = content;
- syncAttributes.discussionList = discussionListJSON;
- }
- utils.storeAttributes(context.syncAttributes);
- }
-
- var onChange = (function() {
- var debouncedOnChange = utils.debounce(function() {
- var context = realtimeContext;
- if(!context) {
- return;
- }
- if(context.isModelChange) {
- logger.log('Realtime syncing model changes');
- }
- else {
- logger.log('Realtime syncing local changes');
- }
-
- modelChangeWrapper(function() {
- // Check content modifications
- var localContent = context.fileDesc.content;
- var remoteContent = context.realtimeString.getText();
- var contentChanged = localContent != remoteContent;
- if(contentChanged) {
- if(context.isModelChange) {
- editor.setValue(remoteContent);
- }
- else {
- compound(function() {
- context.realtimeString.setText(localContent);
- });
- }
- }
-
- // Check discussion modifications
- mergeDiscussionList(context, context.isModelChange);
-
- // For local changes, CRCs are updated on "save success" event
- if(context.isModelChange) {
- updateStatus();
- }
- context.isModelChange = false;
- });
- });
- return function(fileDesc) {
- if(realtimeContext && realtimeContext.fileDesc === fileDesc) {
- debouncedOnChange();
- }
- };
- })();
- function onModelChange() {
- if(!realtimeContext || realtimeContext.isChanging) {
- return;
- }
- realtimeContext.isModelChange = true;
- onChange(realtimeContext.fileDesc);
- }
- eventMgr.addListener('onContentChanged', onChange);
- eventMgr.addListener('onDiscussionCreated', onChange);
- eventMgr.addListener('onDiscussionRemoved', onChange);
- eventMgr.addListener('onCommentsChanged', onChange);
-
- // Start realtime synchronization
- gdriveProvider.startRealtimeSync = function(fileDesc, syncAttributes) {
- if(realtimeContext !== undefined) {
- return;
- }
- var context = {
- fileDesc: fileDesc,
- syncAttributes: syncAttributes
- };
- realtimeContext = context;
- googleHelper.loadRealtime(syncAttributes.id, accountId, function(err, doc) {
- if(err || !doc) {
- if(context === realtimeContext) {
- realtimeContext = undefined;
- }
- return;
- }
-
- // If user just switched to another document or file has just been reselected
- if(context !== realtimeContext) {
- return doc.close();
- }
-
- logger.log("Starting Google Drive realtime synchronization");
- context.document = doc;
- var model = doc.getModel();
- context.model = model;
-
- // Get or create content string
- var realtimeString = model.getRoot().get('content');
- if(!realtimeString) {
- // Initial value
- realtimeString = model.createString(fileDesc.content);
- model.getRoot().set('content', realtimeString);
- }
- context.realtimeString = realtimeString;
- // Listen to content modifications
- realtimeString.addEventListener(gapi.drive.realtime.EventType.TEXT_INSERTED, onModelChange);
- realtimeString.addEventListener(gapi.drive.realtime.EventType.TEXT_DELETED, onModelChange);
-
- // Get or create discussion map
- var realtimeDiscussionList = model.getRoot().get('discussionList');
- if(!realtimeDiscussionList) {
- // Initial value
- realtimeDiscussionList = toRealtimeDiscussionList(context);
- model.getRoot().set('discussionList', realtimeDiscussionList);
- }
- context.realtimeDiscussionList = realtimeDiscussionList;
- // Listen to discussion modifications
- realtimeDiscussionList.addEventListener(gapi.drive.realtime.EventType.VALUE_CHANGED, onModelChange);
- realtimeDiscussionList.keys().forEach(function(discussionIndex) {
- var realtimeDiscussion = context.realtimeDiscussionList.get(discussionIndex);
- var realtimeCommentList = realtimeDiscussion.get('commentList');
- // Listen to comment modifications in every discussion
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_ADDED, onModelChange);
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_REMOVED, onModelChange);
- realtimeCommentList.addEventListener(gapi.drive.realtime.EventType.VALUES_SET, onModelChange);
- });
-
- // Also listen to "save success" event
- doc.addEventListener(gapi.drive.realtime.EventType.DOCUMENT_SAVE_STATE_CHANGED, function(evt) {
- if(evt.isPending === false && evt.isSaving === false) {
- updateStatus();
- }
- });
-
- // Merge offline modifications
- var remoteContent = realtimeString.getText();
- var remoteTitle = fileDesc.title; // Not synchronized, so make sure no changes will be detected
- var remoteDiscussionList = fromRealtimeDiscussionList(realtimeDiscussionList);
- var remoteDiscussionListJSON = JSON.stringify(remoteDiscussionList);
- gdriveProvider.syncMerge(fileDesc, syncAttributes, remoteContent, remoteTitle, remoteDiscussionList, remoteDiscussionListJSON);
- onChange(context.fileDesc);
-
- // Save undo/redo buttons default actions
- undoExecute = pagedownEditor.uiManager.buttons.undo.execute;
- redoExecute = pagedownEditor.uiManager.buttons.redo.execute;
- setUndoRedoButtonStates = pagedownEditor.uiManager.setUndoRedoButtonStates;
-
- // Set temporary actions for undo/redo buttons
- pagedownEditor.uiManager.buttons.undo.execute = _.bind(model.undo, model);
- pagedownEditor.uiManager.buttons.redo.execute = _.bind(model.redo, model);
-
- // Add event handler for model's UndoRedoStateChanged events
- pagedownEditor.uiManager.setUndoRedoButtonStates = _.debounce(function() {
- pagedownEditor.uiManager.setButtonState(pagedownEditor.uiManager.buttons.undo, model.canUndo);
- pagedownEditor.uiManager.setButtonState(pagedownEditor.uiManager.buttons.redo, model.canRedo);
- }, 10);
- pagedownEditor.uiManager.setUndoRedoButtonStates();
- model.addEventListener(gapi.drive.realtime.EventType.UNDO_REDO_STATE_CHANGED, function() {
- pagedownEditor.uiManager.setUndoRedoButtonStates();
- });
-
- }, function(err) {
- logger.error(err);
- if(err.type == "token_refresh_required") {
- googleHelper.refreshGdriveToken(accountId);
- }
- else if(err.type == "not_found") {
- eventMgr.onError('"' + fileDesc.title + '" has been removed from ' + providerName + '.');
- fileDesc.removeSyncLocation(syncAttributes);
- eventMgr.onSyncRemoved(fileDesc, syncAttributes);
- gdriveProvider.stopRealtimeSync();
- }
- else if(err.isFatal) {
- // Retry will be attempted shortly...
- gdriveProvider.stopRealtimeSync();
- }
- });
- };
-
- // Stop realtime synchronization
- gdriveProvider.stopRealtimeSync = function() {
- logger.log("Stopping Google Drive realtime synchronization");
- if(realtimeContext !== undefined) {
- try { realtimeContext.model.endCompoundOperation(); }
- catch(e) {}
- realtimeContext.document && realtimeContext.document.close();
- realtimeContext = undefined;
- }
-
- if(setUndoRedoButtonStates !== undefined) {
- // Set back original undo/redo actions
- pagedownEditor.uiManager.buttons.undo.execute = undoExecute;
- pagedownEditor.uiManager.buttons.redo.execute = redoExecute;
- pagedownEditor.uiManager.setUndoRedoButtonStates = setUndoRedoButtonStates;
- pagedownEditor.uiManager.setUndoRedoButtonStates();
- }
- };
- })();
// Initialize the AutoSync dialog fields
gdriveProvider.setAutosyncDialogConfig = function() {
var config = gdriveProvider.autosyncConfig;
@@ -746,13 +334,6 @@ define([
}, 'folder', accountId);
});
- // On export, disable file ID input if realtime is checked
- var $realtimeCheckboxElt = $('#input-sync-export-' + providerId + '-realtime');
- var $fileIdInputElt = $('#input-sync-export-' + providerId + '-fileid');
- $('#input-sync-export-' + providerId + '-realtime').change(function() {
- $fileIdInputElt.prop('disabled', $realtimeCheckboxElt.prop('checked'));
- });
-
// Skip gdrive action if provider is not enabled in the settings
if(accountIndex >= settings.gdriveMultiAccount) {
return;
diff --git a/public/res/styles/base.less b/public/res/styles/base.less
index fca53929..bf9f9360 100644
--- a/public/res/styles/base.less
+++ b/public/res/styles/base.less
@@ -342,9 +342,6 @@ kbd {
.icon-provider-gdrive, .icon-provider-gdrivesec, .icon-provider-gdriveter {
background-position: -18px 0;
- &.realtime {
- background-position: -162px 0;
- }
}
.icon-provider-dropbox {
diff --git a/public/res/styles/main.less b/public/res/styles/main.less
index 0c6d8bbf..2fa3f915 100644
--- a/public/res/styles/main.less
+++ b/public/res/styles/main.less
@@ -182,6 +182,10 @@ body {
}
}
+.collapsed > .icon-up-dir:before {
+ content: '\e94d';
+}
+
.modal {
&.fade .modal-dialog {
.translate(0, 0);
diff --git a/public/res/synchronizer.js b/public/res/synchronizer.js
index f95c070c..1296fa30 100644
--- a/public/res/synchronizer.js
+++ b/public/res/synchronizer.js
@@ -95,14 +95,7 @@ define([
// Dequeue a synchronized location
var syncAttributes = uploadSyncAttributesList.pop();
- var providerSyncUpFunction = syncAttributes.provider.syncUp;
- // Call a special function in case of a real time synchronized location
- if(syncAttributes.isRealtime === true) {
- providerSyncUpFunction = syncAttributes.provider.syncUpRealtime;
- }
-
- // Use the specified provider to perform the upload
- providerSyncUpFunction(
+ syncAttributes.provider.syncUp(
uploadContent,
uploadContentCRC,
uploadTitle,
@@ -237,59 +230,6 @@ define([
return true;
};
- /***************************************************************************
- * Realtime synchronization
- **************************************************************************/
-
- var isOnline = true;
-
- // Tries to start/stop real time sync on online/offline event
- function onOfflineChanged(isOfflineParam) {
- if(isOfflineParam === false) {
- isOnline = true;
- startRealtimeSync();
- }
- else {
- stopRealtimeSync();
- isOnline = false;
- }
- }
-
- // Starts real time synchronization if:
- // 1. current file has real time sync location
- // 2. we are online
- function startRealtimeSync() {
- var fileDesc = fileMgr.currentFile;
- _.each(fileDesc.syncLocations, function(syncAttributes) {
- syncAttributes.isRealtime && syncAttributes.provider.startRealtimeSync(fileDesc, syncAttributes);
- });
- }
-
- // Stops previously started synchronization if any
- function stopRealtimeSync() {
- _.each(providerMap, function(provider) {
- provider.stopRealtimeSync && provider.stopRealtimeSync();
- });
- }
-
- // Triggers realtime synchronization from eventMgr events
- if(window.viewerMode === false) {
- // On file open, try to start realtime sync
- eventMgr.addListener("onFileOpen", startRealtimeSync);
- // On new sync location, try to start realtime sync
- eventMgr.addListener("onSyncExportSuccess", startRealtimeSync);
- // On file close, stop any active realtime synchronization
- eventMgr.addListener("onFileClosed", stopRealtimeSync);
- // Start/stop realtime sync depending on network status
- eventMgr.addListener("onOfflineChanged", onOfflineChanged);
- // Try to start realtime sync every 15 sec in case of error
- eventMgr.addListener("onPeriodicRun", _.throttle(startRealtimeSync, 15000));
- // Stop realtime sync if synchronized location is removed
- eventMgr.addListener("onSyncRemoved", function(fileDesc, syncAttributes) {
- fileDesc === fileMgr.currentFile && syncAttributes.isRealtime && syncAttributes.provider.stopRealtimeSync();
- });
- }
-
/***************************************************************************
* Initialize module
**************************************************************************/
@@ -353,37 +293,15 @@ define([
$(".modal-autosync-" + provider.providerId).modal();
});
$(".action-sync-export-" + provider.providerId).click(function(event) {
- var isRealtime = utils.getInputChecked("#input-sync-export-" + provider.providerId + "-realtime");
var fileDesc = fileMgr.currentFile;
- if(isRealtime) {
- if(_.size(fileDesc.syncLocations) > 0) {
- return eventMgr.onError("Real time collaborative document can't be synchronized with multiple locations");
- }
- // Perform the provider's real time export
- provider.exportRealtimeFile(event, fileDesc.title, fileDesc.content, fileDesc.discussionListJSON, function(error, syncAttributes) {
- if(error) {
- return;
- }
- syncAttributes.isRealtime = true;
- fileDesc.addSyncLocation(syncAttributes);
- eventMgr.onSyncExportSuccess(fileDesc, syncAttributes);
- });
- }
- else {
- if(_.size(fileDesc.syncLocations) > 0 && _.first(_.values(fileDesc.syncLocations)).isRealtime) {
- eventMgr.onError("Real time collaborative document can't be synchronized with multiple locations");
+ provider.exportFile(event, fileDesc.title, fileDesc.content, fileDesc.discussionListJSON, function(error, syncAttributes) {
+ if(error) {
return;
}
- // Perform the provider's standard export
- provider.exportFile(event, fileDesc.title, fileDesc.content, fileDesc.discussionListJSON, function(error, syncAttributes) {
- if(error) {
- return;
- }
- fileDesc.addSyncLocation(syncAttributes);
- eventMgr.onSyncExportSuccess(fileDesc, syncAttributes);
- });
- }
+ fileDesc.addSyncLocation(syncAttributes);
+ eventMgr.onSyncExportSuccess(fileDesc, syncAttributes);
+ });
// Store input values as preferences for next time we open the
// export dialog