Merge pull request #144 from ONLYOFFICE/feature/review-in-viewer
Feature/review in viewer
This commit is contained in:
commit
f42585109b
|
@ -133,47 +133,8 @@ define([
|
||||||
};
|
};
|
||||||
|
|
||||||
var panel, resizer, stretch = false;
|
var panel, resizer, stretch = false;
|
||||||
options.items.forEach(function(item) {
|
this.freeze = options.freeze;
|
||||||
item.el instanceof HTMLElement && (item.el = $(item.el));
|
this.changeLayout(options.items);
|
||||||
panel = _.extend(new LayoutPanel(), item);
|
|
||||||
if ( panel.stretch ) {
|
|
||||||
stretch = true;
|
|
||||||
panel.rely = false;
|
|
||||||
panel.resize = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.panels.push(panel);
|
|
||||||
|
|
||||||
if (panel.resize) {
|
|
||||||
resizer = {
|
|
||||||
isresizer : true,
|
|
||||||
minpos : panel.resize.min||0,
|
|
||||||
maxpos : panel.resize.max||0,
|
|
||||||
fmin : panel.resize.fmin,
|
|
||||||
fmax : panel.resize.fmax,
|
|
||||||
behaviour : panel.behaviour,
|
|
||||||
index : this.splitters.length,
|
|
||||||
offset : panel.resize.offset || 0
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!stretch) {
|
|
||||||
panel.resize.el =
|
|
||||||
resizer.el = panel.el.after('<div class="layout-resizer after"></div>').next();
|
|
||||||
this.panels.push(resizer);
|
|
||||||
} else {
|
|
||||||
panel.resize.el =
|
|
||||||
resizer.el = panel.el.before('<div class="layout-resizer before"></div>').prev();
|
|
||||||
this.panels.splice(this.panels.length - 1, 0, resizer);
|
|
||||||
}
|
|
||||||
|
|
||||||
this.splitters.push({resizer:resizer});
|
|
||||||
|
|
||||||
panel.resize.hidden && resizer.el.hide();
|
|
||||||
Common.Gateway.on('processmouse', this.resize.eventStop);
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.freeze = options.freeze; this.freeze && this.freezePanels(this.freeze);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
doLayout: function() {
|
doLayout: function() {
|
||||||
|
@ -181,6 +142,10 @@ define([
|
||||||
|
|
||||||
changeLayout: function(items) {
|
changeLayout: function(items) {
|
||||||
var panel, resizer, stretch = false;
|
var panel, resizer, stretch = false;
|
||||||
|
this.splitters && this.splitters.forEach(function(item) {
|
||||||
|
item.resizer && item.resizer.el.remove();
|
||||||
|
}, this);
|
||||||
|
this.splitters = [];
|
||||||
this.panels = [];
|
this.panels = [];
|
||||||
items.forEach(function(item) {
|
items.forEach(function(item) {
|
||||||
item.el instanceof HTMLElement && (item.el = $(item.el));
|
item.el instanceof HTMLElement && (item.el = $(item.el));
|
||||||
|
@ -221,6 +186,7 @@ define([
|
||||||
Common.Gateway.on('processmouse', this.resize.eventStop);
|
Common.Gateway.on('processmouse', this.resize.eventStop);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
this.freezePanels(this.freeze);
|
||||||
},
|
},
|
||||||
|
|
||||||
getElementHeight: function(el) {
|
getElementHeight: function(el) {
|
||||||
|
@ -422,8 +388,10 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
setResizeValue: function (index, value) {
|
setResizeValue: function (index, value) {
|
||||||
if (index >= this.splitters.length)
|
if (index >= this.splitters.length) {
|
||||||
|
this.doLayout();
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
var panel = null, next = null, oldValue = 0,
|
var panel = null, next = null, oldValue = 0,
|
||||||
resize = this.splitters[index].resizer,
|
resize = this.splitters[index].resizer,
|
||||||
|
@ -472,16 +440,6 @@ define([
|
||||||
Common.UI.VBoxLayout.prototype = _.extend(new BaseLayout(), {
|
Common.UI.VBoxLayout.prototype = _.extend(new BaseLayout(), {
|
||||||
initialize: function(options){
|
initialize: function(options){
|
||||||
BaseLayout.prototype.initialize.call(this,options);
|
BaseLayout.prototype.initialize.call(this,options);
|
||||||
|
|
||||||
this.panels.forEach(function(panel){
|
|
||||||
!panel.stretch && !panel.height && (panel.height = this.getElementHeight(panel.el));
|
|
||||||
|
|
||||||
if (panel.isresizer) {
|
|
||||||
panel.el.on('mousedown', {type: 'vertical', panel: panel}, _.bind(this.resizeStart, this));
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.doLayout.call(this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
doLayout: function() {
|
doLayout: function() {
|
||||||
|
@ -518,6 +476,18 @@ define([
|
||||||
height += style.height || this.getElementHeight(panel.el);
|
height += style.height || this.getElementHeight(panel.el);
|
||||||
}
|
}
|
||||||
}, this);
|
}, this);
|
||||||
|
},
|
||||||
|
|
||||||
|
changeLayout: function(items) {
|
||||||
|
BaseLayout.prototype.changeLayout.call(this, items);
|
||||||
|
this.panels.forEach(function(panel){
|
||||||
|
!panel.stretch && !panel.height && (panel.height = this.getElementHeight(panel.el));
|
||||||
|
|
||||||
|
if (panel.isresizer) {
|
||||||
|
panel.el.on('mousedown', {type: 'vertical', panel: panel}, _.bind(this.resizeStart, this));
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
this.doLayout.call(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -529,16 +499,6 @@ define([
|
||||||
Common.UI.HBoxLayout.prototype = _.extend(new BaseLayout(), {
|
Common.UI.HBoxLayout.prototype = _.extend(new BaseLayout(), {
|
||||||
initialize: function(options){
|
initialize: function(options){
|
||||||
BaseLayout.prototype.initialize.call(this,options);
|
BaseLayout.prototype.initialize.call(this,options);
|
||||||
|
|
||||||
this.panels.forEach(function(panel){
|
|
||||||
!panel.stretch && !panel.width && (panel.width = this.getElementWidth(panel.el));
|
|
||||||
|
|
||||||
if (panel.isresizer) {
|
|
||||||
panel.el.on('mousedown', {type: 'horizontal', panel: panel}, _.bind(this.resizeStart, this));
|
|
||||||
}
|
|
||||||
}, this);
|
|
||||||
|
|
||||||
this.doLayout.call(this);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
doLayout: function(event) {
|
doLayout: function(event) {
|
||||||
|
@ -581,6 +541,18 @@ define([
|
||||||
width += this.getElementWidth(panel.el);
|
width += this.getElementWidth(panel.el);
|
||||||
}
|
}
|
||||||
},this);
|
},this);
|
||||||
|
},
|
||||||
|
|
||||||
|
changeLayout: function(items) {
|
||||||
|
BaseLayout.prototype.changeLayout.call(this, items);
|
||||||
|
this.panels.forEach(function(panel){
|
||||||
|
!panel.stretch && !panel.width && (panel.width = this.getElementWidth(panel.el));
|
||||||
|
|
||||||
|
if (panel.isresizer) {
|
||||||
|
panel.el.on('mousedown', {type: 'horizontal', panel: panel}, _.bind(this.resizeStart, this));
|
||||||
|
}
|
||||||
|
}, this);
|
||||||
|
this.doLayout.call(this);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@ define([
|
||||||
subEditStrings : {},
|
subEditStrings : {},
|
||||||
filter : undefined,
|
filter : undefined,
|
||||||
hintmode : false,
|
hintmode : false,
|
||||||
previewmode: false,
|
viewmode: false,
|
||||||
isSelectedComment : false,
|
isSelectedComment : false,
|
||||||
uids : [],
|
uids : [],
|
||||||
oldUids : [],
|
oldUids : [],
|
||||||
|
@ -169,7 +169,7 @@ define([
|
||||||
this.currentUserName = data.config.user.fullname;
|
this.currentUserName = data.config.user.fullname;
|
||||||
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
|
this.sdkViewName = data['sdkviewname'] || this.sdkViewName;
|
||||||
this.hintmode = data['hintmode'] || false;
|
this.hintmode = data['hintmode'] || false;
|
||||||
this.previewmode = data['previewmode'] || false;
|
this.viewmode = data['viewmode'] || false;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
setApi: function (api) {
|
setApi: function (api) {
|
||||||
|
@ -194,10 +194,8 @@ define([
|
||||||
setMode: function(mode) {
|
setMode: function(mode) {
|
||||||
this.mode = mode;
|
this.mode = mode;
|
||||||
this.isModeChanged = true; // change show-comment mode from/to hint mode using canComments flag
|
this.isModeChanged = true; // change show-comment mode from/to hint mode using canComments flag
|
||||||
if (!this.mode.canComments) {
|
this.view.viewmode = !this.mode.canComments;
|
||||||
this.view.changeLayout(mode);
|
this.view.changeLayout(mode);
|
||||||
}
|
|
||||||
|
|
||||||
return this;
|
return this;
|
||||||
},
|
},
|
||||||
//
|
//
|
||||||
|
@ -283,8 +281,6 @@ define([
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
onShowComment: function (id, selected) {
|
onShowComment: function (id, selected) {
|
||||||
if (this.previewmode) return;
|
|
||||||
|
|
||||||
var comment = this.findComment(id);
|
var comment = this.findComment(id);
|
||||||
if (comment) {
|
if (comment) {
|
||||||
if (null !== comment.get('quote')) {
|
if (null !== comment.get('quote')) {
|
||||||
|
@ -818,11 +814,9 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onApiShowComment: function (uids, posX, posY, leftX, opts, hint) {
|
onApiShowComment: function (uids, posX, posY, leftX, opts, hint) {
|
||||||
if (this.previewmode) return;
|
|
||||||
this.isModeChanged = false;
|
|
||||||
var same_uids = (0 === _.difference(this.uids, uids).length) && (0 === _.difference(uids, this.uids).length);
|
var same_uids = (0 === _.difference(this.uids, uids).length) && (0 === _.difference(uids, this.uids).length);
|
||||||
|
|
||||||
if (hint && this.isSelectedComment && same_uids) {
|
if (hint && this.isSelectedComment && same_uids && !this.isModeChanged) {
|
||||||
// хотим показать тот же коментарий что был и выбран
|
// хотим показать тот же коментарий что был и выбран
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -833,7 +827,7 @@ define([
|
||||||
if (popover) {
|
if (popover) {
|
||||||
this.clearDummyComment();
|
this.clearDummyComment();
|
||||||
|
|
||||||
if (this.isSelectedComment && same_uids) {
|
if (this.isSelectedComment && same_uids && !this.isModeChanged) {
|
||||||
//NOTE: click to sdk view ?
|
//NOTE: click to sdk view ?
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
//this.view.txtComment.blur();
|
//this.view.txtComment.blur();
|
||||||
|
@ -905,6 +899,7 @@ define([
|
||||||
popover.setLeftTop(posX, posY, leftX);
|
popover.setLeftTop(posX, posY, leftX);
|
||||||
popover.showComments(animate, false, true, text);
|
popover.showComments(animate, false, true, text);
|
||||||
}
|
}
|
||||||
|
this.isModeChanged = false;
|
||||||
},
|
},
|
||||||
onApiHideComment: function (hint) {
|
onApiHideComment: function (hint) {
|
||||||
var t = this;
|
var t = this;
|
||||||
|
@ -940,8 +935,6 @@ define([
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
onApiUpdateCommentPosition: function (uids, posX, posY, leftX) {
|
onApiUpdateCommentPosition: function (uids, posX, posY, leftX) {
|
||||||
if (this.previewmode) return;
|
|
||||||
|
|
||||||
var i, useAnimation = false,
|
var i, useAnimation = false,
|
||||||
comment = null,
|
comment = null,
|
||||||
text = undefined,
|
text = undefined,
|
||||||
|
@ -1480,9 +1473,16 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
setPreviewMode: function(mode) {
|
setPreviewMode: function(mode) {
|
||||||
this.previewmode = mode;
|
if (this.viewmode === mode) return;
|
||||||
|
this.viewmode = mode;
|
||||||
|
if (mode)
|
||||||
|
this.prevcanComments = this.mode.canComments;
|
||||||
|
this.mode.canComments = (mode) ? false : this.prevcanComments;
|
||||||
|
this.closeEditing();
|
||||||
|
this.setMode(this.mode);
|
||||||
|
this.updateComments(true);
|
||||||
if (this.getPopover())
|
if (this.getPopover())
|
||||||
this.getPopover().hide();
|
this.getPopover().update(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, Common.Controllers.Comments || {}));
|
}, Common.Controllers.Comments || {}));
|
||||||
|
|
|
@ -115,7 +115,7 @@ define([
|
||||||
if (api) {
|
if (api) {
|
||||||
this.api = api;
|
this.api = api;
|
||||||
|
|
||||||
if (this.appConfig.canReview) {
|
if (this.appConfig.canReview || this.appConfig.canViewReview) {
|
||||||
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
|
this.api.asc_registerCallback('asc_onShowRevisionsChange', _.bind(this.onApiShowChange, this));
|
||||||
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
|
this.api.asc_registerCallback('asc_onUpdateRevisionsChangesPosition', _.bind(this.onApiUpdateChangePosition, this));
|
||||||
}
|
}
|
||||||
|
@ -157,7 +157,7 @@ define([
|
||||||
|
|
||||||
this.getPopover().showReview(animate, lock, lockUser);
|
this.getPopover().showReview(animate, lock, lockUser);
|
||||||
|
|
||||||
if (!this.appConfig.isReviewOnly && this._state.lock !== lock) {
|
if (this.appConfig.canReview && !this.appConfig.isReviewOnly && this._state.lock !== lock) {
|
||||||
this.view.btnAccept.setDisabled(lock==true);
|
this.view.btnAccept.setDisabled(lock==true);
|
||||||
this.view.btnReject.setDisabled(lock==true);
|
this.view.btnReject.setDisabled(lock==true);
|
||||||
if (this.dlgChanges) {
|
if (this.dlgChanges) {
|
||||||
|
@ -207,7 +207,7 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
getPopover: function () {
|
getPopover: function () {
|
||||||
if (this.appConfig.canReview && _.isUndefined(this.popover)) {
|
if ((this.appConfig.canReview || this.appConfig.canViewReview) && _.isUndefined(this.popover)) {
|
||||||
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
this.popover = Common.Views.ReviewPopover.prototype.getPopover({
|
||||||
reviewStore : this.popoverChanges,
|
reviewStore : this.popoverChanges,
|
||||||
renderTo : this.sdkViewName
|
renderTo : this.sdkViewName
|
||||||
|
@ -408,7 +408,8 @@ define([
|
||||||
lockuser : item.get_LockUserId(),
|
lockuser : item.get_LockUserId(),
|
||||||
type : item.get_Type(),
|
type : item.get_Type(),
|
||||||
changedata : item,
|
changedata : item,
|
||||||
scope : me.view
|
scope : me.view,
|
||||||
|
hint : !me.appConfig.canReview
|
||||||
});
|
});
|
||||||
|
|
||||||
arr.push(change);
|
arr.push(change);
|
||||||
|
@ -513,17 +514,22 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
onReviewViewClick: function(menu, item, e) {
|
onReviewViewClick: function(menu, item, e) {
|
||||||
|
this.turnDisplayMode(item.value);
|
||||||
|
!this.appConfig.canReview && Common.localStorage.setItem(this.view.appPrefix + "review-mode", item.value);
|
||||||
|
Common.NotificationCenter.trigger('edit:complete', this.view);
|
||||||
|
},
|
||||||
|
|
||||||
|
turnDisplayMode: function(mode) {
|
||||||
if (this.api) {
|
if (this.api) {
|
||||||
if (item.value === 'final')
|
if (mode === 'final')
|
||||||
this.api.asc_BeginViewModeInReview(true);
|
this.api.asc_BeginViewModeInReview(true);
|
||||||
else if (item.value === 'original')
|
else if (mode === 'original')
|
||||||
this.api.asc_BeginViewModeInReview(false);
|
this.api.asc_BeginViewModeInReview(false);
|
||||||
else
|
else
|
||||||
this.api.asc_EndViewModeInReview();
|
this.api.asc_EndViewModeInReview();
|
||||||
}
|
}
|
||||||
this.disableEditing(item.value !== 'markup');
|
this.disableEditing(mode == 'final' || mode == 'original');
|
||||||
this._state.previewMode = (item.value !== 'markup');
|
this._state.previewMode = (mode == 'final' || mode == 'original');
|
||||||
Common.NotificationCenter.trigger('edit:complete', this.view);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
isPreviewChangesMode: function() {
|
isPreviewChangesMode: function() {
|
||||||
|
@ -561,21 +567,22 @@ define([
|
||||||
|
|
||||||
disableEditing: function(disable) {
|
disableEditing: function(disable) {
|
||||||
var app = this.getApplication();
|
var app = this.getApplication();
|
||||||
app.getController('RightMenu').getView('RightMenu').clearSelection();
|
|
||||||
app.getController('Toolbar').DisableToolbar(disable, false, true);
|
app.getController('Toolbar').DisableToolbar(disable, false, true);
|
||||||
|
app.getController('DocumentHolder').getView().SetDisabled(disable);
|
||||||
|
|
||||||
|
if (this.appConfig.canReview) {
|
||||||
|
app.getController('RightMenu').getView('RightMenu').clearSelection();
|
||||||
app.getController('RightMenu').SetDisabled(disable, false);
|
app.getController('RightMenu').SetDisabled(disable, false);
|
||||||
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
app.getController('Statusbar').getView('Statusbar').SetDisabled(disable);
|
||||||
app.getController('DocumentHolder').getView().SetDisabled(disable);
|
|
||||||
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
app.getController('Navigation') && app.getController('Navigation').SetDisabled(disable);
|
||||||
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
|
app.getController('Common.Controllers.Plugins').getView('Common.Views.Plugins').disableControls(disable);
|
||||||
|
}
|
||||||
|
|
||||||
var leftMenu = app.getController('LeftMenu').leftMenu;
|
|
||||||
leftMenu.btnComments.setDisabled(disable);
|
|
||||||
if (disable) leftMenu.close();
|
|
||||||
var comments = app.getController('Common.Controllers.Comments');
|
var comments = app.getController('Common.Controllers.Comments');
|
||||||
if (comments)
|
if (comments)
|
||||||
comments.setPreviewMode(disable);
|
comments.setPreviewMode(disable);
|
||||||
|
|
||||||
|
var leftMenu = app.getController('LeftMenu').leftMenu;
|
||||||
leftMenu.getMenu('file').miProtect.setDisabled(disable);
|
leftMenu.getMenu('file').miProtect.setDisabled(disable);
|
||||||
|
|
||||||
if (this.view) {
|
if (this.view) {
|
||||||
|
@ -626,6 +633,9 @@ define([
|
||||||
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
|
me.dlgChanges.show(Math.max(10, offset.left + sdk.width() - 300), Math.max(10, offset.top + sdk.height() - 150));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
} else if (config.canViewReview) {
|
||||||
|
config.canViewReview = me.api.asc_HaveRevisionsChanges(true); // check revisions from all users
|
||||||
|
config.canViewReview && me.turnDisplayMode(Common.localStorage.getItem(me.view.appPrefix + "review-mode") || 'original'); // load display mode only in viewer
|
||||||
}
|
}
|
||||||
|
|
||||||
if (me.view && me.view.btnChat) {
|
if (me.view && me.view.btnChat) {
|
||||||
|
|
|
@ -62,6 +62,7 @@ define([
|
||||||
lockuser : '',
|
lockuser : '',
|
||||||
type : 0,
|
type : 0,
|
||||||
changedata : null,
|
changedata : null,
|
||||||
|
hint : false,
|
||||||
|
|
||||||
id : Common.UI.getId(), // internal
|
id : Common.UI.getId(), // internal
|
||||||
scope : null
|
scope : null
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<% if (quote!==null && quote!=='') { %>
|
<% if (quote!==null && quote!=='') { %>
|
||||||
<div class="user-quote"><%=scope.getFixedQuote(quote)%></div>
|
<div class="user-quote"><%=scope.getFixedQuote(quote)%></div>
|
||||||
<% } %>
|
<% } %>
|
||||||
<% if (!editText || hint) { %>
|
<% if (!editText || scope.viewmode) { %>
|
||||||
<div class="user-message" data-can-copy="true"><%=scope.pickLink(comment)%></div>
|
<div class="user-message" data-can-copy="true"><%=scope.pickLink(comment)%></div>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<div class="inner-edit-ct">
|
<div class="inner-edit-ct">
|
||||||
|
@ -25,14 +25,14 @@
|
||||||
<% if (replys.length) { %>
|
<% if (replys.length) { %>
|
||||||
<div class="reply-arrow img-commonctrl"></div>
|
<div class="reply-arrow img-commonctrl"></div>
|
||||||
<% _.each(replys, function (item, index) { %>
|
<% _.each(replys, function (item, index) { %>
|
||||||
<div class="reply-item-ct" <% if (hint && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;>
|
<div class="reply-item-ct" <% if (scope.viewmode && index==replys.length-1) { %>style="padding-bottom: 0;" <% } %>;>
|
||||||
<div class="user-name">
|
<div class="user-name">
|
||||||
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>
|
<div class="color" style="display: inline-block; background-color: <% if (item.get("usercolor")!==null) { %><%=item.get("usercolor")%><% } else { %> #cfcfcf <% } %>; " ></div><%= scope.getUserName(item.get("username")) %>
|
||||||
</div>
|
</div>
|
||||||
<div class="user-date"><%=item.get("date")%></div>
|
<div class="user-date"><%=item.get("date")%></div>
|
||||||
<% if (!item.get("editText")) { %>
|
<% if (!item.get("editText")) { %>
|
||||||
<div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>
|
<div class="user-message" data-can-copy="true"><%=scope.pickLink(item.get("reply"))%></div>
|
||||||
<% if (!hint) { %>
|
<% if (!scope.viewmode) { %>
|
||||||
<div class="btns-reply-ct">
|
<div class="btns-reply-ct">
|
||||||
<% if (item.get("editable")) { %>
|
<% if (item.get("editable")) { %>
|
||||||
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
|
<div class="btn-edit img-commonctrl" data-value="<%=item.get("id")%>"></div>
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
<!-- add reply button -->
|
<!-- add reply button -->
|
||||||
|
|
||||||
<% if (!showReply && !hint) { %>
|
<% if (!showReply && !scope.viewmode) { %>
|
||||||
<% if (replys.length) { %>
|
<% if (replys.length) { %>
|
||||||
<label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>
|
<label class="user-reply" style="margin-left: 20px; margin-top: 5px;" role="presentation" tabindex="-1">textAddReply</label>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
<!-- edit buttons -->
|
<!-- edit buttons -->
|
||||||
|
|
||||||
<% if (!editText && !lock && !hint) { %>
|
<% if (!editText && !lock && !scope.viewmode) { %>
|
||||||
<div class="edit-ct">
|
<div class="edit-ct">
|
||||||
<% if (editable) { %>
|
<% if (editable) { %>
|
||||||
<div class="btn-edit img-commonctrl"></div>
|
<div class="btn-edit img-commonctrl"></div>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="user-date"><%=date%></div>
|
<div class="user-date"><%=date%></div>
|
||||||
<div class="user-message limit-height"><%=changetext%></div>
|
<div class="user-message limit-height"><%=changetext%></div>
|
||||||
|
<% if (!hint) { %>
|
||||||
<div class="edit-ct">
|
<div class="edit-ct">
|
||||||
<% if (scope.appConfig.isReviewOnly) { %>
|
<% if (scope.appConfig.isReviewOnly) { %>
|
||||||
<div class="btn-delete img-commonctrl"></div>
|
<div class="btn-delete img-commonctrl"></div>
|
||||||
|
@ -12,4 +13,5 @@
|
||||||
<div class="btn-reject img-commonctrl"></div>
|
<div class="btn-reject img-commonctrl"></div>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
<% } %>
|
||||||
</div>
|
</div>
|
|
@ -79,6 +79,7 @@ define([
|
||||||
addCommentHeight: 45,
|
addCommentHeight: 45,
|
||||||
newCommentHeight: 110,
|
newCommentHeight: 110,
|
||||||
textBoxAutoSizeLocked: undefined, // disable autosize textbox
|
textBoxAutoSizeLocked: undefined, // disable autosize textbox
|
||||||
|
viewmode: false,
|
||||||
|
|
||||||
initialize: function (options) {
|
initialize: function (options) {
|
||||||
Common.UI.BaseView.prototype.initialize.call(this, options);
|
Common.UI.BaseView.prototype.initialize.call(this, options);
|
||||||
|
@ -550,13 +551,38 @@ define([
|
||||||
},
|
},
|
||||||
|
|
||||||
changeLayout: function(mode) {
|
changeLayout: function(mode) {
|
||||||
if (!mode.canComments) {
|
var me = this,
|
||||||
var add = $('.new-comment-ct', this.el),
|
add = $('.new-comment-ct', this.el),
|
||||||
to = $('.add-link-ct', this.el),
|
to = $('.add-link-ct', this.el),
|
||||||
msgs = $('.messages-ct', this.el);
|
msgs = $('.messages-ct', this.el);
|
||||||
|
msgs.toggleClass('stretch', !mode.canComments);
|
||||||
|
if (!mode.canComments) {
|
||||||
add.hide(); to.hide();
|
add.hide(); to.hide();
|
||||||
msgs.addClass('stretch');
|
|
||||||
this.layout.changeLayout([{el: msgs[0], rely: false, stretch: true}]);
|
this.layout.changeLayout([{el: msgs[0], rely: false, stretch: true}]);
|
||||||
|
} else {
|
||||||
|
var container = $('#comments-box', this.el),
|
||||||
|
items = container.find(' > .layout-item');
|
||||||
|
to.show();
|
||||||
|
this.layout.changeLayout([{el: items[0], rely: true,
|
||||||
|
resize: {
|
||||||
|
hidden: false,
|
||||||
|
autohide: false,
|
||||||
|
fmin: (function () {
|
||||||
|
var height = container.height();
|
||||||
|
if (add.css('display') !== 'none') {
|
||||||
|
if (height * 0.5 < me.newCommentHeight)
|
||||||
|
return height - me.newCommentHeight;
|
||||||
|
}
|
||||||
|
return height * 0.5;
|
||||||
|
}),
|
||||||
|
fmax: (function () {
|
||||||
|
if (add.css('display') !== 'none')
|
||||||
|
return container.height() - me.newCommentHeight;
|
||||||
|
return container.height() - me.addCommentHeight;
|
||||||
|
})
|
||||||
|
}},
|
||||||
|
{el: items[1], stretch: true},
|
||||||
|
{el: items[2], stretch: true}]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -126,11 +126,11 @@ define([
|
||||||
this.btnsTurnReview.forEach(function (button) {
|
this.btnsTurnReview.forEach(function (button) {
|
||||||
button.on('click', _click_turnpreview.bind(me));
|
button.on('click', _click_turnpreview.bind(me));
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
if (this.appConfig.canViewReview)
|
||||||
this.btnReviewView.menu.on('item:click', function (menu, item, e) {
|
this.btnReviewView.menu.on('item:click', function (menu, item, e) {
|
||||||
me.fireEvent('reviewchanges:view', [menu, item]);
|
me.fireEvent('reviewchanges:view', [menu, item]);
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
this.btnsSpelling.forEach(function(button) {
|
this.btnsSpelling.forEach(function(button) {
|
||||||
button.on('click', function (b, e) {
|
button.on('click', function (b, e) {
|
||||||
|
@ -206,7 +206,8 @@ define([
|
||||||
enableToggle: true
|
enableToggle: true
|
||||||
});
|
});
|
||||||
this.btnsTurnReview = [this.btnTurnOn];
|
this.btnsTurnReview = [this.btnTurnOn];
|
||||||
|
}
|
||||||
|
if (this.appConfig.canViewReview) {
|
||||||
this.btnReviewView = new Common.UI.Button({
|
this.btnReviewView = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
iconCls: 'btn-ic-reviewview',
|
iconCls: 'btn-ic-reviewview',
|
||||||
|
@ -223,7 +224,7 @@ define([
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!this.appConfig.isOffline && this.appConfig.canCoAuthoring) {
|
if (this.appConfig.isEdit && !this.appConfig.isOffline && this.appConfig.canCoAuthoring) {
|
||||||
this.btnCoAuthMode = new Common.UI.Button({
|
this.btnCoAuthMode = new Common.UI.Button({
|
||||||
cls: 'btn-toolbar x-huge icon-top',
|
cls: 'btn-toolbar x-huge icon-top',
|
||||||
iconCls: 'btn-ic-coedit',
|
iconCls: 'btn-ic-coedit',
|
||||||
|
@ -311,6 +312,10 @@ define([
|
||||||
);
|
);
|
||||||
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]);
|
me.btnReject.updateHint([me.tipRejectCurrent, me.txtRejectChanges]);
|
||||||
|
|
||||||
|
me.btnAccept.setDisabled(config.isReviewOnly);
|
||||||
|
me.btnReject.setDisabled(config.isReviewOnly);
|
||||||
|
}
|
||||||
|
if (me.appConfig.canViewReview) {
|
||||||
me.btnReviewView.setMenu(
|
me.btnReviewView.setMenu(
|
||||||
new Common.UI.Menu({
|
new Common.UI.Menu({
|
||||||
cls: 'ppm-toolbar',
|
cls: 'ppm-toolbar',
|
||||||
|
@ -345,11 +350,8 @@ define([
|
||||||
]
|
]
|
||||||
}));
|
}));
|
||||||
me.btnReviewView.updateHint(me.tipReviewView);
|
me.btnReviewView.updateHint(me.tipReviewView);
|
||||||
|
!me.appConfig.canReview && me.turnDisplayMode(Common.localStorage.getItem(me.appPrefix + "review-mode") || 'original');
|
||||||
me.btnAccept.setDisabled(config.isReviewOnly);
|
|
||||||
me.btnReject.setDisabled(config.isReviewOnly);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
me.btnSharing && me.btnSharing.updateHint(me.tipSharing);
|
me.btnSharing && me.btnSharing.updateHint(me.tipSharing);
|
||||||
me.btnHistory && me.btnHistory.updateHint(me.tipHistory);
|
me.btnHistory && me.btnHistory.updateHint(me.tipHistory);
|
||||||
me.btnChat && me.btnChat.updateHint(me.txtChat + Common.Utils.String.platformKey('Alt+Q'));
|
me.btnChat && me.btnChat.updateHint(me.txtChat + Common.Utils.String.platformKey('Alt+Q'));
|
||||||
|
@ -392,7 +394,7 @@ define([
|
||||||
|
|
||||||
var separator_sharing = !(me.btnSharing || me.btnCoAuthMode) ? me.$el.find('.separator.sharing') : '.separator.sharing',
|
var separator_sharing = !(me.btnSharing || me.btnCoAuthMode) ? me.$el.find('.separator.sharing') : '.separator.sharing',
|
||||||
separator_comments = !(config.canComments && config.canCoAuthoring) ? me.$el.find('.separator.comments') : '.separator.comments',
|
separator_comments = !(config.canComments && config.canCoAuthoring) ? me.$el.find('.separator.comments') : '.separator.comments',
|
||||||
separator_review = !config.canReview ? me.$el.find('.separator.review') : '.separator.review',
|
separator_review = !(config.canReview || config.canViewReview) ? me.$el.find('.separator.review') : '.separator.review',
|
||||||
separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
|
separator_chat = !me.btnChat ? me.$el.find('.separator.chat') : '.separator.chat',
|
||||||
separator_last;
|
separator_last;
|
||||||
|
|
||||||
|
@ -419,7 +421,7 @@ define([
|
||||||
if (!me.btnHistory && separator_last)
|
if (!me.btnHistory && separator_last)
|
||||||
me.$el.find(separator_last).hide();
|
me.$el.find(separator_last).hide();
|
||||||
|
|
||||||
Common.NotificationCenter.trigger('tab:visible', 'review', true);
|
Common.NotificationCenter.trigger('tab:visible', 'review', config.isEdit || config.canViewReview);
|
||||||
|
|
||||||
setEvents.call(me);
|
setEvents.call(me);
|
||||||
});
|
});
|
||||||
|
@ -434,8 +436,8 @@ define([
|
||||||
this.btnAccept.render(this.$el.find('#btn-change-accept'));
|
this.btnAccept.render(this.$el.find('#btn-change-accept'));
|
||||||
this.btnReject.render(this.$el.find('#btn-change-reject'));
|
this.btnReject.render(this.$el.find('#btn-change-reject'));
|
||||||
this.btnTurnOn.render(this.$el.find('#btn-review-on'));
|
this.btnTurnOn.render(this.$el.find('#btn-review-on'));
|
||||||
this.btnReviewView.render(this.$el.find('#btn-review-view'));
|
|
||||||
}
|
}
|
||||||
|
this.btnReviewView && this.btnReviewView.render(this.$el.find('#btn-review-view'));
|
||||||
|
|
||||||
this.btnSharing && this.btnSharing.render(this.$el.find('#slot-btn-sharing'));
|
this.btnSharing && this.btnSharing.render(this.$el.find('#slot-btn-sharing'));
|
||||||
this.btnCoAuthMode && this.btnCoAuthMode.render(this.$el.find('#slot-btn-coauthmode'));
|
this.btnCoAuthMode && this.btnCoAuthMode.render(this.$el.find('#slot-btn-coauthmode'));
|
||||||
|
@ -529,6 +531,14 @@ define([
|
||||||
this.btnChat && this.btnChat.toggle(state, true);
|
this.btnChat && this.btnChat.toggle(state, true);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
turnDisplayMode: function(mode) {
|
||||||
|
if (this.btnReviewView) {
|
||||||
|
this.btnReviewView.menu.items[0].setChecked(mode=='markup', true);
|
||||||
|
this.btnReviewView.menu.items[1].setChecked(mode=='final', true);
|
||||||
|
this.btnReviewView.menu.items[2].setChecked(mode=='original', true);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
|
||||||
SetDisabled: function (state, langs) {
|
SetDisabled: function (state, langs) {
|
||||||
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
|
this.btnsSpelling && this.btnsSpelling.forEach(function(button) {
|
||||||
if ( button ) {
|
if ( button ) {
|
||||||
|
|
|
@ -1109,6 +1109,7 @@ define([
|
||||||
(!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true
|
(!this.appOptions.isReviewOnly || this.appOptions.canLicense); // if isReviewOnly==true -> canLicense must be true
|
||||||
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
|
this.appOptions.isEdit = this.appOptions.canLicense && this.appOptions.canEdit && this.editorConfig.mode !== 'view';
|
||||||
this.appOptions.canReview = this.permissions.review === true && this.appOptions.canLicense && this.appOptions.isEdit;
|
this.appOptions.canReview = this.permissions.review === true && this.appOptions.canLicense && this.appOptions.isEdit;
|
||||||
|
this.appOptions.canViewReview = true;
|
||||||
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline;
|
this.appOptions.canUseHistory = this.appOptions.canLicense && this.editorConfig.canUseHistory && this.appOptions.canCoAuthoring && !this.appOptions.isOffline;
|
||||||
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
|
this.appOptions.canHistoryClose = this.editorConfig.canHistoryClose;
|
||||||
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
|
this.appOptions.canHistoryRestore= this.editorConfig.canHistoryRestore && !!this.permissions.changeHistory;
|
||||||
|
@ -1214,21 +1215,19 @@ define([
|
||||||
this.contComments.setConfig({config: this.editorConfig}, this.api);
|
this.contComments.setConfig({config: this.editorConfig}, this.api);
|
||||||
/** coauthoring end **/
|
/** coauthoring end **/
|
||||||
|
|
||||||
if (this.appOptions.isEdit) {
|
|
||||||
var me = this,
|
var me = this,
|
||||||
application = this.getApplication(),
|
application = this.getApplication(),
|
||||||
toolbarController = application.getController('Toolbar'),
|
|
||||||
rightmenuController = application.getController('RightMenu'),
|
|
||||||
fontsControllers = application.getController('Common.Controllers.Fonts'),
|
|
||||||
reviewController = application.getController('Common.Controllers.ReviewChanges');
|
reviewController = application.getController('Common.Controllers.ReviewChanges');
|
||||||
|
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
||||||
|
|
||||||
|
if (this.appOptions.isEdit) {
|
||||||
|
var toolbarController = application.getController('Toolbar'),
|
||||||
|
rightmenuController = application.getController('RightMenu'),
|
||||||
|
fontsControllers = application.getController('Common.Controllers.Fonts');
|
||||||
fontsControllers && fontsControllers.setApi(me.api);
|
fontsControllers && fontsControllers.setApi(me.api);
|
||||||
toolbarController && toolbarController.setApi(me.api);
|
toolbarController && toolbarController.setApi(me.api);
|
||||||
|
|
||||||
rightmenuController && rightmenuController.setApi(me.api);
|
rightmenuController && rightmenuController.setApi(me.api);
|
||||||
|
|
||||||
reviewController.setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
|
||||||
|
|
||||||
if (this.appOptions.canProtect)
|
if (this.appOptions.canProtect)
|
||||||
application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api);
|
||||||
|
|
||||||
|
|
|
@ -2718,7 +2718,7 @@ define([
|
||||||
|
|
||||||
toolbar._state.previewmode = reviewmode && disable;
|
toolbar._state.previewmode = reviewmode && disable;
|
||||||
if (reviewmode) {
|
if (reviewmode) {
|
||||||
toolbar._state.previewmode && toolbar.btnSave.setDisabled(true);
|
toolbar._state.previewmode && toolbar.btnSave && toolbar.btnSave.setDisabled(true);
|
||||||
|
|
||||||
if (toolbar.needShowSynchTip) {
|
if (toolbar.needShowSynchTip) {
|
||||||
toolbar.needShowSynchTip = false;
|
toolbar.needShowSynchTip = false;
|
||||||
|
@ -2768,15 +2768,14 @@ define([
|
||||||
|
|
||||||
me.toolbar.render(_.extend({isCompactView: compactview}, config));
|
me.toolbar.render(_.extend({isCompactView: compactview}, config));
|
||||||
|
|
||||||
if ( config.isEdit ) {
|
|
||||||
me.toolbar.setMode(config);
|
|
||||||
|
|
||||||
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
|
var tab = {action: 'review', caption: me.toolbar.textTabCollaboration};
|
||||||
var $panel = this.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
|
var $panel = this.getApplication().getController('Common.Controllers.ReviewChanges').createToolbarPanel();
|
||||||
|
|
||||||
if ( $panel )
|
if ( $panel )
|
||||||
me.toolbar.addTab(tab, $panel, 4);
|
me.toolbar.addTab(tab, $panel, 4);
|
||||||
|
|
||||||
|
if ( config.isEdit ) {
|
||||||
|
me.toolbar.setMode(config);
|
||||||
|
|
||||||
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));
|
me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled'));
|
||||||
|
|
||||||
// hide 'print' and 'save' buttons group and next separator
|
// hide 'print' and 'save' buttons group and next separator
|
||||||
|
|
|
@ -390,8 +390,8 @@ define([
|
||||||
DE.getController('DocumentHolder').getView().SetDisabled(disable, true);
|
DE.getController('DocumentHolder').getView().SetDisabled(disable, true);
|
||||||
DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable);
|
DE.getController('Navigation') && DE.getController('Navigation').SetDisabled(disable);
|
||||||
|
|
||||||
var leftMenu = DE.getController('LeftMenu').leftMenu;
|
// var leftMenu = DE.getController('LeftMenu').leftMenu;
|
||||||
leftMenu.btnComments.setDisabled(disable);
|
// leftMenu.btnComments.setDisabled(disable);
|
||||||
var comments = DE.getController('Common.Controllers.Comments');
|
var comments = DE.getController('Common.Controllers.Comments');
|
||||||
if (comments)
|
if (comments)
|
||||||
comments.setPreviewMode(disable);
|
comments.setPreviewMode(disable);
|
||||||
|
|
|
@ -343,8 +343,8 @@ define([
|
||||||
PE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
PE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||||
PE.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
|
PE.getController('DocumentHolder').getView('DocumentHolder').SetDisabled(disable);
|
||||||
|
|
||||||
var leftMenu = PE.getController('LeftMenu').leftMenu;
|
// var leftMenu = PE.getController('LeftMenu').leftMenu;
|
||||||
leftMenu.btnComments.setDisabled(disable);
|
// leftMenu.btnComments.setDisabled(disable);
|
||||||
var comments = PE.getController('Common.Controllers.Comments');
|
var comments = PE.getController('Common.Controllers.Comments');
|
||||||
if (comments)
|
if (comments)
|
||||||
comments.setPreviewMode(disable);
|
comments.setPreviewMode(disable);
|
||||||
|
|
|
@ -389,8 +389,8 @@ define([
|
||||||
SSE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
SSE.getController('Common.Controllers.ReviewChanges').SetDisabled(disable);
|
||||||
SSE.getController('DocumentHolder').SetDisabled(disable, true);
|
SSE.getController('DocumentHolder').SetDisabled(disable, true);
|
||||||
|
|
||||||
var leftMenu = SSE.getController('LeftMenu').leftMenu;
|
// var leftMenu = SSE.getController('LeftMenu').leftMenu;
|
||||||
leftMenu.btnComments.setDisabled(disable);
|
// leftMenu.btnComments.setDisabled(disable);
|
||||||
var comments = SSE.getController('Common.Controllers.Comments');
|
var comments = SSE.getController('Common.Controllers.Comments');
|
||||||
if (comments)
|
if (comments)
|
||||||
comments.setPreviewMode(disable);
|
comments.setPreviewMode(disable);
|
||||||
|
|
Loading…
Reference in a new issue