[DE mobile] Accept/Reject review changes
This commit is contained in:
parent
cb2afba88f
commit
e607c5f279
|
@ -57,7 +57,10 @@ define([
|
||||||
_view,
|
_view,
|
||||||
_fastCoAuthTips = [],
|
_fastCoAuthTips = [],
|
||||||
_actionSheets = [],
|
_actionSheets = [],
|
||||||
_isEdit = false;
|
_isEdit = false,
|
||||||
|
_canAcceptChanges = false,
|
||||||
|
_inRevisionChange = false,
|
||||||
|
_menuPos = [];
|
||||||
|
|
||||||
return {
|
return {
|
||||||
models: [],
|
models: [],
|
||||||
|
@ -90,11 +93,13 @@ define([
|
||||||
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me));
|
me.api.asc_registerCallback('asc_onDocumentContentReady', _.bind(me.onApiDocumentContentReady, me));
|
||||||
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
|
Common.NotificationCenter.on('api:disconnect', _.bind(me.onCoAuthoringDisconnect, me));
|
||||||
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect,me));
|
me.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(me.onCoAuthoringDisconnect,me));
|
||||||
|
me.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(me.onApiShowChange, me));
|
||||||
me.api.asc_coAuthoringGetUsers();
|
me.api.asc_coAuthoringGetUsers();
|
||||||
},
|
},
|
||||||
|
|
||||||
setMode: function (mode) {
|
setMode: function (mode) {
|
||||||
_isEdit = mode.isEdit;
|
_isEdit = mode.isEdit;
|
||||||
|
_canAcceptChanges = mode.canReview && !mode.isReviewOnly;
|
||||||
},
|
},
|
||||||
|
|
||||||
// When our application is ready, lets get started
|
// When our application is ready, lets get started
|
||||||
|
@ -135,10 +140,29 @@ define([
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if ('accept' == eventName) {
|
||||||
|
me.api.asc_GetNextRevisionsChange();
|
||||||
|
me.api.asc_AcceptChanges();
|
||||||
|
} else if ('acceptall' == eventName) {
|
||||||
|
me.api.asc_AcceptAllChanges();
|
||||||
|
} else if ('reject' == eventName) {
|
||||||
|
me.api.asc_GetNextRevisionsChange();
|
||||||
|
me.api.asc_RejectChanges();
|
||||||
|
} else if ('rejectall' == eventName) {
|
||||||
|
me.api.asc_RejectAllChanges();
|
||||||
|
} else if ('review' == eventName) {
|
||||||
|
if (Common.SharedSettings.get('phone')) {
|
||||||
|
_actionSheets = me._initReviewMenu();
|
||||||
|
me.onContextMenuClick(view, 'showActionSheet');
|
||||||
|
} else {
|
||||||
|
_.delay(function () {
|
||||||
|
_view.showMenu(me._initReviewMenu(), _menuPos[0] || 0, _menuPos[1] || 0);
|
||||||
|
}, 100);
|
||||||
|
}
|
||||||
} else if ('showActionSheet' == eventName && _actionSheets.length > 0) {
|
} else if ('showActionSheet' == eventName && _actionSheets.length > 0) {
|
||||||
_.delay(function () {
|
_.delay(function () {
|
||||||
_.each(_actionSheets, function (action) {
|
_.each(_actionSheets, function (action) {
|
||||||
action.text = action.caption
|
action.text = action.caption;
|
||||||
action.onClick = function () {
|
action.onClick = function () {
|
||||||
me.onContextMenuClick(null, action.event)
|
me.onContextMenuClick(null, action.event)
|
||||||
}
|
}
|
||||||
|
@ -166,6 +190,7 @@ define([
|
||||||
if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal.modal-in, .actions-modal').length > 0) {
|
if ($('.popover.settings, .popup.settings, .picker-modal.settings, .modal.modal-in, .actions-modal').length > 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
_menuPos = [posX, posY];
|
||||||
|
|
||||||
var me = this,
|
var me = this,
|
||||||
items;
|
items;
|
||||||
|
@ -283,6 +308,10 @@ define([
|
||||||
_view = this.createView('DocumentHolder').render();
|
_view = this.createView('DocumentHolder').render();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
onApiShowChange: function(sdkchange) {
|
||||||
|
_inRevisionChange = sdkchange && sdkchange.length>0;
|
||||||
|
},
|
||||||
|
|
||||||
// Internal
|
// Internal
|
||||||
|
|
||||||
_openLink: function(url) {
|
_openLink: function(url) {
|
||||||
|
@ -378,6 +407,13 @@ define([
|
||||||
event: 'addlink'
|
event: 'addlink'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_canAcceptChanges && _inRevisionChange) {
|
||||||
|
menuItems.push({
|
||||||
|
caption: me.menuReview,
|
||||||
|
event: 'review'
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -401,6 +437,33 @@ define([
|
||||||
return menuItems;
|
return menuItems;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
_initReviewMenu: function (stack) {
|
||||||
|
var me = this,
|
||||||
|
menuItems = [];
|
||||||
|
|
||||||
|
menuItems.push({
|
||||||
|
caption: me.menuAccept,
|
||||||
|
event: 'accept'
|
||||||
|
});
|
||||||
|
|
||||||
|
menuItems.push({
|
||||||
|
caption: me.menuReject,
|
||||||
|
event: 'reject'
|
||||||
|
});
|
||||||
|
|
||||||
|
menuItems.push({
|
||||||
|
caption: me.menuAcceptAll,
|
||||||
|
event: 'acceptall'
|
||||||
|
});
|
||||||
|
|
||||||
|
menuItems.push({
|
||||||
|
caption: me.menuRejectAll,
|
||||||
|
event: 'rejectall'
|
||||||
|
});
|
||||||
|
|
||||||
|
return menuItems;
|
||||||
|
},
|
||||||
|
|
||||||
onCoAuthoringDisconnect: function() {
|
onCoAuthoringDisconnect: function() {
|
||||||
this.isDisconnected = true;
|
this.isDisconnected = true;
|
||||||
},
|
},
|
||||||
|
@ -414,7 +477,12 @@ define([
|
||||||
menuAddLink: 'Add Link',
|
menuAddLink: 'Add Link',
|
||||||
menuOpenLink: 'Open Link',
|
menuOpenLink: 'Open Link',
|
||||||
menuMore: 'More',
|
menuMore: 'More',
|
||||||
sheetCancel: 'Cancel'
|
sheetCancel: 'Cancel',
|
||||||
|
menuReview: 'Review',
|
||||||
|
menuAccept: 'Accept',
|
||||||
|
menuAcceptAll: 'Accept All',
|
||||||
|
menuReject: 'Reject',
|
||||||
|
menuRejectAll: 'Reject All'
|
||||||
}
|
}
|
||||||
})(), DE.Controllers.DocumentHolder || {}))
|
})(), DE.Controllers.DocumentHolder || {}))
|
||||||
});
|
});
|
|
@ -24,6 +24,11 @@
|
||||||
"DE.Controllers.DocumentHolder.menuPaste": "Paste",
|
"DE.Controllers.DocumentHolder.menuPaste": "Paste",
|
||||||
"DE.Controllers.DocumentHolder.sheetCancel": "Cancel",
|
"DE.Controllers.DocumentHolder.sheetCancel": "Cancel",
|
||||||
"DE.Controllers.DocumentHolder.textGuest": "Guest",
|
"DE.Controllers.DocumentHolder.textGuest": "Guest",
|
||||||
|
"DE.Controllers.DocumentHolder.menuReview": "Review",
|
||||||
|
"DE.Controllers.DocumentHolder.menuAccept": "Accept",
|
||||||
|
"DE.Controllers.DocumentHolder.menuAcceptAll": "Accept All",
|
||||||
|
"DE.Controllers.DocumentHolder.menuReject": "Reject",
|
||||||
|
"DE.Controllers.DocumentHolder.menuRejectAll": "Reject All",
|
||||||
"DE.Controllers.EditContainer.textChart": "Chart",
|
"DE.Controllers.EditContainer.textChart": "Chart",
|
||||||
"DE.Controllers.EditContainer.textHyperlink": "Hyperlink",
|
"DE.Controllers.EditContainer.textHyperlink": "Hyperlink",
|
||||||
"DE.Controllers.EditContainer.textImage": "Image",
|
"DE.Controllers.EditContainer.textImage": "Image",
|
||||||
|
|
Loading…
Reference in a new issue