Merge branch 'feature/new-mobile' of https://github.com/ONLYOFFICE/web-apps into feature/new-mobile

This commit is contained in:
Alexander Yuzhin 2016-11-24 18:14:14 +03:00
commit 2143b97ee1
17 changed files with 94 additions and 78 deletions

View file

@ -336,6 +336,8 @@
window.alert("The \"document.key\" parameter for the config object must be string. Please correct it."); window.alert("The \"document.key\" parameter for the config object must be string. Please correct it.");
return false; return false;
} }
_config.document.token = _config.token;
} }
return true; return true;

View file

@ -96,6 +96,7 @@ var ApplicationController = new(function(){
docInfo.put_Title(docConfig.title); docInfo.put_Title(docConfig.title);
docInfo.put_Format(docConfig.fileType); docInfo.put_Format(docConfig.fileType);
docInfo.put_VKey(docConfig.vkey); docInfo.put_VKey(docConfig.vkey);
docInfo.put_Token(docConfig.token);
if (api) { if (api) {
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);

View file

@ -286,6 +286,7 @@ define([
docInfo.put_Options(data.doc.options); docInfo.put_Options(data.doc.options);
docInfo.put_UserInfo(_user); docInfo.put_UserInfo(_user);
docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl);
docInfo.put_Token(data.doc.token);
// docInfo.put_Review(this.permissions.review); // docInfo.put_Review(this.permissions.review);
// docInfo.put_OfflineApp(this.editorConfig.nativeApp === true); // used in sdk for testing // docInfo.put_OfflineApp(this.editorConfig.nativeApp === true); // used in sdk for testing
} }

View file

@ -199,6 +199,7 @@ define([
docInfo.put_Options(data.doc.options); docInfo.put_Options(data.doc.options);
docInfo.put_UserInfo(_user); docInfo.put_UserInfo(_user);
docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl);
docInfo.put_Token(data.doc.token);
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));

View file

@ -97,6 +97,7 @@ var ApplicationController = new(function(){
docInfo.put_Title(docConfig.title); docInfo.put_Title(docConfig.title);
docInfo.put_Format(docConfig.fileType); docInfo.put_Format(docConfig.fileType);
docInfo.put_VKey(docConfig.vkey); docInfo.put_VKey(docConfig.vkey);
docInfo.put_Token(docConfig.token);
if (api) { if (api) {
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);

View file

@ -273,6 +273,7 @@ define([
docInfo.put_Options(data.doc.options); docInfo.put_Options(data.doc.options);
docInfo.put_UserInfo(_user); docInfo.put_UserInfo(_user);
docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl);
docInfo.put_Token(data.doc.token);
//docInfo.put_OfflineApp(this.editorConfig.nativeApp === true); //docInfo.put_OfflineApp(this.editorConfig.nativeApp === true);
} }

View file

@ -122,10 +122,13 @@ define([
onPreview: function(btn, e) { onPreview: function(btn, e) {
var previewPanel = PE.getController('Viewport').getView('DocumentPreview'), var previewPanel = PE.getController('Viewport').getView('DocumentPreview'),
me = this; me = this,
isResized = false;
if (previewPanel && me.api) { if (previewPanel && me.api) {
previewPanel.show(); previewPanel.show();
var onWindowResize = function() { var onWindowResize = function() {
if (isResized) return;
isResized = true;
Common.NotificationCenter.off('window:resize', onWindowResize); Common.NotificationCenter.off('window:resize', onWindowResize);
var current = me.api.getCurrentPage(); var current = me.api.getCurrentPage();
@ -136,6 +139,9 @@ define([
if (!me.statusbar.mode.isDesktopApp && !Common.Utils.isIE11) { if (!me.statusbar.mode.isDesktopApp && !Common.Utils.isIE11) {
Common.NotificationCenter.on('window:resize', onWindowResize); Common.NotificationCenter.on('window:resize', onWindowResize);
me.fullScreen(document.documentElement); me.fullScreen(document.documentElement);
setTimeout(function(){
onWindowResize();
}, 100);
} else } else
onWindowResize(); onWindowResize();
} }

View file

@ -763,10 +763,13 @@ define([
onPreview: function(slidenum) { onPreview: function(slidenum) {
var previewPanel = PE.getController('Viewport').getView('DocumentPreview'), var previewPanel = PE.getController('Viewport').getView('DocumentPreview'),
me = this; me = this,
isResized = false;
if (previewPanel && me.api) { if (previewPanel && me.api) {
previewPanel.show(); previewPanel.show();
var onWindowResize = function() { var onWindowResize = function() {
if (isResized) return;
isResized = true;
Common.NotificationCenter.off('window:resize', onWindowResize); Common.NotificationCenter.off('window:resize', onWindowResize);
me.api.StartDemonstration('presentation-preview', _.isNumber(slidenum) ? slidenum : 0); me.api.StartDemonstration('presentation-preview', _.isNumber(slidenum) ? slidenum : 0);
Common.component.Analytics.trackEvent('ToolBar', 'Preview'); Common.component.Analytics.trackEvent('ToolBar', 'Preview');
@ -774,6 +777,9 @@ define([
if (!me.toolbar.mode.isDesktopApp && !Common.Utils.isIE11) { if (!me.toolbar.mode.isDesktopApp && !Common.Utils.isIE11) {
Common.NotificationCenter.on('window:resize', onWindowResize); Common.NotificationCenter.on('window:resize', onWindowResize);
me.fullScreen(document.documentElement); me.fullScreen(document.documentElement);
setTimeout(function(){
onWindowResize();
}, 100);
} else } else
onWindowResize(); onWindowResize();
} }

View file

@ -1291,6 +1291,7 @@ define([
var hkPreview = 'command+f5,ctrl+f5'; var hkPreview = 'command+f5,ctrl+f5';
keymap[hkPreview] = function(e) { keymap[hkPreview] = function(e) {
var isResized = false;
e.preventDefault(); e.preventDefault();
e.stopPropagation(); e.stopPropagation();
if (me.slidesCount>0) { if (me.slidesCount>0) {
@ -1298,12 +1299,17 @@ define([
if (previewPanel && !previewPanel.isVisible() && me.api) { if (previewPanel && !previewPanel.isVisible() && me.api) {
previewPanel.show(); previewPanel.show();
var onWindowResize = function() { var onWindowResize = function() {
if (isResized) return;
isResized = true;
Common.NotificationCenter.off('window:resize', onWindowResize); Common.NotificationCenter.off('window:resize', onWindowResize);
me.api.StartDemonstration('presentation-preview', 0); me.api.StartDemonstration('presentation-preview', 0);
}; };
if (!me.mode.isDesktopApp && !Common.Utils.isIE11) { if (!me.mode.isDesktopApp && !Common.Utils.isIE11) {
Common.NotificationCenter.on('window:resize', onWindowResize); Common.NotificationCenter.on('window:resize', onWindowResize);
me.fullScreen(document.documentElement); me.fullScreen(document.documentElement);
setTimeout(function(){
onWindowResize();
}, 100);
} else } else
onWindowResize(); onWindowResize();
} }
@ -1558,10 +1564,13 @@ define([
var mnuPreview = new Common.UI.MenuItem({ var mnuPreview = new Common.UI.MenuItem({
caption : me.txtPreview caption : me.txtPreview
}).on('click', function(item) { }).on('click', function(item) {
var previewPanel = PE.getController('Viewport').getView('DocumentPreview'); var previewPanel = PE.getController('Viewport').getView('DocumentPreview'),
isResized = false;
if (previewPanel && me.api) { if (previewPanel && me.api) {
previewPanel.show(); previewPanel.show();
var onWindowResize = function() { var onWindowResize = function() {
if (isResized) return;
isResized = true;
Common.NotificationCenter.off('window:resize', onWindowResize); Common.NotificationCenter.off('window:resize', onWindowResize);
var current = me.api.getCurrentPage(); var current = me.api.getCurrentPage();
@ -1572,6 +1581,9 @@ define([
if (!me.mode.isDesktopApp && !Common.Utils.isIE11) { if (!me.mode.isDesktopApp && !Common.Utils.isIE11) {
Common.NotificationCenter.on('window:resize', onWindowResize); Common.NotificationCenter.on('window:resize', onWindowResize);
me.fullScreen(document.documentElement); me.fullScreen(document.documentElement);
setTimeout(function(){
onWindowResize();
}, 100);
} else } else
onWindowResize(); onWindowResize();
} }

View file

@ -55,20 +55,6 @@ define([
Common.localStorage.setKeysFilter('pe-,asc.presentation'); Common.localStorage.setKeysFilter('pe-,asc.presentation');
Common.localStorage.sync(); Common.localStorage.sync();
var fillUserInfo = function(info, lang, defname) {
var user = info || {};
!user.id && (user.id = ('uid-' + Date.now()));
_.isEmpty(user.firstname) && _.isEmpty(user.lastname) && (user.firstname = defname);
if (_.isEmpty(user.firstname))
user.fullname = user.lastname;
else if (_.isEmpty(user.lastname))
user.fullname = user.firstname;
else
user.fullname = /^ru/.test(lang) ? user.lastname + ' ' + user.firstname : user.firstname + ' ' + user.lastname;
return user;
};
return { return {
models: [], models: [],
collections: [], collections: [],
@ -159,7 +145,7 @@ define([
me.editorConfig = $.extend(me.editorConfig, data.config); me.editorConfig = $.extend(me.editorConfig, data.config);
me.editorConfig.user = me.editorConfig.user =
me.appOptions.user = fillUserInfo(me.editorConfig.user, me.editorConfig.lang, me.textAnonymous); me.appOptions.user = Common.Utils.fillUserInfo(me.editorConfig.user, me.editorConfig.lang, me.textAnonymous);
me.appOptions.nativeApp = me.editorConfig.nativeApp === true; me.appOptions.nativeApp = me.editorConfig.nativeApp === true;
me.appOptions.isDesktopApp = me.editorConfig.targetApp == 'desktop'; me.appOptions.isDesktopApp = me.editorConfig.targetApp == 'desktop';
me.appOptions.canCreateNew = !_.isEmpty(me.editorConfig.createUrl) && !me.appOptions.isDesktopApp; me.appOptions.canCreateNew = !_.isEmpty(me.editorConfig.createUrl) && !me.appOptions.isDesktopApp;
@ -198,8 +184,6 @@ define([
var _user = new Asc.asc_CUserInfo(); var _user = new Asc.asc_CUserInfo();
_user.put_Id(this.appOptions.user.id); _user.put_Id(this.appOptions.user.id);
_user.put_FirstName(this.appOptions.user.firstname);
_user.put_LastName(this.appOptions.user.lastname);
_user.put_FullName(this.appOptions.user.fullname); _user.put_FullName(this.appOptions.user.fullname);
docInfo = new Asc.asc_CDocInfo(); docInfo = new Asc.asc_CDocInfo();
@ -211,6 +195,7 @@ define([
docInfo.put_Options(data.doc.options); docInfo.put_Options(data.doc.options);
docInfo.put_UserInfo(_user); docInfo.put_UserInfo(_user);
docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl);
docInfo.put_Token(data.doc.token);
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));

View file

@ -95,6 +95,7 @@ var ApplicationController = new(function(){
docInfo.put_Title(docConfig.title); docInfo.put_Title(docConfig.title);
docInfo.put_Format(docConfig.fileType); docInfo.put_Format(docConfig.fileType);
docInfo.put_VKey(docConfig.vkey); docInfo.put_VKey(docConfig.vkey);
docInfo.put_Token(docConfig.token);
if (api) { if (api) {
api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions); api.asc_registerCallback('asc_onGetEditorPermissions', onEditorPermissions);

View file

@ -936,12 +936,10 @@ define([
$(document.body).append(src); $(document.body).append(src);
showPoint = [ showPoint = [
coAuthTip.x_point + coAuthTip.XY[0], (is_sheet_lock) ? (coAuthTip.x_point + coAuthTip.rightMenuWidth) : (coAuthTip.bodyWidth - (coAuthTip.x_point + coAuthTip.XY[0])),
coAuthTip.y_point + coAuthTip.XY[1] coAuthTip.y_point + coAuthTip.XY[1]
]; ];
!is_sheet_lock && (showPoint[0] = coAuthTip.bodyWidth - showPoint[0]);
if (showPoint[1] > coAuthTip.XY[1] && if (showPoint[1] > coAuthTip.XY[1] &&
showPoint[1] + coAuthTip.ttHeight < coAuthTip.XY[1] + coAuthTip.apiHeight) { showPoint[1] + coAuthTip.ttHeight < coAuthTip.XY[1] + coAuthTip.apiHeight) {
src.text(getUserName(data.asc_getUserId())); src.text(getUserName(data.asc_getUserId()));
@ -1042,6 +1040,7 @@ define([
me.documentHolder.cmpEl.offset().top - $(window).scrollTop() me.documentHolder.cmpEl.offset().top - $(window).scrollTop()
]; ];
me.tooltips.coauth.apiHeight = me.documentHolder.cmpEl.height(); me.tooltips.coauth.apiHeight = me.documentHolder.cmpEl.height();
me.tooltips.coauth.rightMenuWidth = $('#right-menu').width();
me.tooltips.coauth.bodyWidth = $(window).width(); me.tooltips.coauth.bodyWidth = $(window).width();
} }
}, },
@ -1141,6 +1140,7 @@ define([
documentHolder = this.documentHolder, documentHolder = this.documentHolder,
seltype = cellinfo.asc_getFlags().asc_getSelectionType(), seltype = cellinfo.asc_getFlags().asc_getSelectionType(),
isCellLocked = cellinfo.asc_getLocked(), isCellLocked = cellinfo.asc_getLocked(),
isTableLocked = cellinfo.asc_getLockedTable()===true,
isObjLocked = false, isObjLocked = false,
commentsController = this.getApplication().getController('Common.Controllers.Comments'), commentsController = this.getApplication().getController('Common.Controllers.Comments'),
insfunc = false, insfunc = false,
@ -1341,9 +1341,15 @@ define([
item.setDisabled(isCellLocked); item.setDisabled(isCellLocked);
}); });
documentHolder.pmiCopy.setDisabled(false); documentHolder.pmiCopy.setDisabled(false);
documentHolder.pmiFilterCells.setDisabled(isCellLocked || (filterInfo==null)); documentHolder.pmiInsertEntire.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiSortCells.setDisabled(isCellLocked || (filterInfo==null)); documentHolder.pmiInsertCells.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiReapply.setDisabled(isCellLocked || (isApplyAutoFilter!==true)); documentHolder.pmiInsertTable.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiDeleteEntire.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiDeleteCells.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiDeleteTable.setDisabled(isCellLocked || isTableLocked);
documentHolder.pmiFilterCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null));
documentHolder.pmiSortCells.setDisabled(isCellLocked || isTableLocked|| (filterInfo==null));
documentHolder.pmiReapply.setDisabled(isCellLocked || isTableLocked|| (isApplyAutoFilter!==true));
if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event); if (showMenu) this.showPopupMenu(documentHolder.ssMenu, {}, event);
} else if (this.permissions.isEditDiagram && seltype == Asc.c_oAscSelectionType.RangeChartText) { } else if (this.permissions.isEditDiagram && seltype == Asc.c_oAscSelectionType.RangeChartText) {
if (!showMenu && !documentHolder.textInShapeMenu.isVisible()) return; if (!showMenu && !documentHolder.textInShapeMenu.isVisible()) return;

View file

@ -307,6 +307,7 @@ define([
docInfo.put_Options(data.doc.options); docInfo.put_Options(data.doc.options);
docInfo.put_UserInfo(_user); docInfo.put_UserInfo(_user);
docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl);
docInfo.put_Token(data.doc.token);
this.headerView.setDocumentCaption(data.doc.title); this.headerView.setDocumentCaption(data.doc.title);
} }

View file

@ -121,19 +121,14 @@ define([
this._openRightMenu = true; this._openRightMenu = true;
} }
var need_disable = info.asc_getLocked(); var need_disable = info.asc_getLocked(),
need_disable_table = (info.asc_getLockedTable()===true),
need_disable_spark = (info.asc_getLockedSparkline()===true);
this.onFocusObject(SelectedObjects, formatTableInfo, sparkLineInfo, need_disable); this.onFocusObject(SelectedObjects, formatTableInfo, sparkLineInfo, need_disable, need_disable_table, need_disable_spark);
if (this._state.prevDisabled != need_disable) {
this._state.prevDisabled = need_disable;
this._settings.forEach(function(item){
item.panel.setLocked(need_disable);
});
}
}, },
onFocusObject: function(SelectedObjects, formatTableInfo, sparkLineInfo, isCellLocked) { onFocusObject: function(SelectedObjects, formatTableInfo, sparkLineInfo, isCellLocked, isTableLocked, isSparkLocked) {
if (!this.editMode) if (!this.editMode)
return; return;
@ -146,7 +141,6 @@ define([
for (i=0; i<SelectedObjects.length; ++i) for (i=0; i<SelectedObjects.length; ++i)
{ {
var type = SelectedObjects[i].asc_getObjectType();
var eltype = SelectedObjects[i].asc_getObjectType(), var eltype = SelectedObjects[i].asc_getObjectType(),
settingsType = this.getDocumentSettingsType(eltype); settingsType = this.getDocumentSettingsType(eltype);
if (settingsType===undefined || settingsType>=this._settings.length || this._settings[settingsType]===undefined) if (settingsType===undefined || settingsType>=this._settings.length || this._settings[settingsType]===undefined)
@ -174,14 +168,14 @@ define([
if (formatTableInfo) { if (formatTableInfo) {
settingsType = Common.Utils.documentSettingsType.Table; settingsType = Common.Utils.documentSettingsType.Table;
this._settings[settingsType].props = formatTableInfo; this._settings[settingsType].props = formatTableInfo;
this._settings[settingsType].locked = isCellLocked; this._settings[settingsType].locked = isTableLocked;
this._settings[settingsType].hidden = 0; this._settings[settingsType].hidden = 0;
} }
if (sparkLineInfo) { if (sparkLineInfo) {
settingsType = Common.Utils.documentSettingsType.Chart; settingsType = Common.Utils.documentSettingsType.Chart;
this._settings[settingsType].props = sparkLineInfo; this._settings[settingsType].props = sparkLineInfo;
this._settings[settingsType].locked = isCellLocked; this._settings[settingsType].locked = isSparkLocked;
this._settings[settingsType].hidden = 0; this._settings[settingsType].hidden = 0;
} }

View file

@ -1604,7 +1604,7 @@ define([
if (!this.editMode) return; if (!this.editMode) return;
var selectionType = info.asc_getFlags().asc_getSelectionType(), var selectionType = info.asc_getFlags().asc_getSelectionType(),
coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true) : false, coauth_disable = (!this.toolbar.mode.isEditMailMerge && !this.toolbar.mode.isEditDiagram) ? (info.asc_getLocked()===true || info.asc_getLockedTable()===true) : false,
editOptionsDisabled = this._disableEditOptions(selectionType, coauth_disable), editOptionsDisabled = this._disableEditOptions(selectionType, coauth_disable),
me = this, me = this,
toolbar = this.toolbar, toolbar = this.toolbar,
@ -2345,7 +2345,6 @@ define([
_disableEditOptions: function(seltype, coauth_disable) { _disableEditOptions: function(seltype, coauth_disable) {
if (this.api.isCellEdited) return true; if (this.api.isCellEdited) return true;
if (this.api.isRangeSelection) return true; if (this.api.isRangeSelection) return true;
if (this._state.selection_type===seltype && this._state.coauthdisable===coauth_disable) return (seltype===Asc.c_oAscSelectionType.RangeImage);
var toolbar = this.toolbar, var toolbar = this.toolbar,
is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText, is_chart_text = seltype == Asc.c_oAscSelectionType.RangeChartText,
@ -2353,7 +2352,19 @@ define([
is_shape_text = seltype == Asc.c_oAscSelectionType.RangeShapeText, is_shape_text = seltype == Asc.c_oAscSelectionType.RangeShapeText,
is_shape = seltype == Asc.c_oAscSelectionType.RangeShape, is_shape = seltype == Asc.c_oAscSelectionType.RangeShape,
is_image = seltype == Asc.c_oAscSelectionType.RangeImage, is_image = seltype == Asc.c_oAscSelectionType.RangeImage,
is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart; is_mode_2 = is_shape_text || is_shape || is_chart_text || is_chart,
is_objLocked = false;
if (!(is_mode_2 || is_image) && this._state.selection_type===seltype && this._state.coauthdisable===coauth_disable) return (seltype===Asc.c_oAscSelectionType.RangeImage);
if (is_mode_2) {
var SelectedObjects = this.api.asc_getGraphicObjectProps();
for (var i=0; i<SelectedObjects.length; ++i)
{
if (SelectedObjects[i].asc_getObjectType() == Asc.c_oAscTypeSelectElement.Image)
is_objLocked = is_objLocked || SelectedObjects[i].asc_getObjectValue().asc_getLocked();
}
}
if ( coauth_disable ) { if ( coauth_disable ) {
toolbar.lockToolbar(SSE.enumLock.coAuth, coauth_disable); toolbar.lockToolbar(SSE.enumLock.coAuth, coauth_disable);
@ -2382,6 +2393,7 @@ define([
merge: true, merge: true,
clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth] clear: [_set.selImage, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.coAuth]
}); });
toolbar.lockToolbar(SSE.enumLock.coAuthText, is_objLocked);
} }
$('#ce-func-label').toggleClass('disabled', is_image || is_mode_2 || coauth_disable); $('#ce-func-label').toggleClass('disabled', is_image || is_mode_2 || coauth_disable);

View file

@ -71,6 +71,7 @@ define([
selRange: 'sel-range', selRange: 'sel-range',
lostConnect: 'disconnect', lostConnect: 'disconnect',
coAuth: 'co-auth', coAuth: 'co-auth',
coAuthText: 'co-auth-text',
ruleMerge: 'rule-btn-merge', ruleMerge: 'rule-btn-merge',
ruleFilter: 'rule-filter', ruleFilter: 'rule-filter',
ruleDelFilter: 'rule-clear-filter', ruleDelFilter: 'rule-clear-filter',
@ -149,7 +150,7 @@ define([
cls : 'input-group-nr', cls : 'input-group-nr',
menuStyle : 'min-width: 55px;', menuStyle : 'min-width: 55px;',
hint : me.tipFontSize, hint : me.tipFontSize,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect], lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
data : [ data : [
{ value: 8, displayValue: "8" }, { value: 8, displayValue: "8" },
{ value: 9, displayValue: "9" }, { value: 9, displayValue: "9" },
@ -189,7 +190,7 @@ define([
menuCls : 'scrollable-menu', menuCls : 'scrollable-menu',
menuStyle : 'min-width: 325px;', menuStyle : 'min-width: 325px;',
hint : me.tipFontName, hint : me.tipFontName,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect], lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
store : new Common.Collections.Fonts() store : new Common.Collections.Fonts()
}); });
@ -239,21 +240,21 @@ define([
id : 'id-toolbar-btn-incfont', id : 'id-toolbar-btn-incfont',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-incfont', iconCls : 'btn-incfont',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect] lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect]
}); });
me.btnDecFontSize = new Common.UI.Button({ me.btnDecFontSize = new Common.UI.Button({
id : 'id-toolbar-btn-decfont', id : 'id-toolbar-btn-decfont',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-decfont', iconCls : 'btn-decfont',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect] lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect]
}); });
me.btnBold = new Common.UI.Button({ me.btnBold = new Common.UI.Button({
id : 'id-toolbar-btn-bold', id : 'id-toolbar-btn-bold',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-bold', iconCls : 'btn-bold',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect], lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true enableToggle: true
}); });
@ -261,7 +262,7 @@ define([
id : 'id-toolbar-btn-italic', id : 'id-toolbar-btn-italic',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-italic', iconCls : 'btn-italic',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect], lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true enableToggle: true
}); });
@ -269,7 +270,7 @@ define([
id : 'id-toolbar-btn-underline', id : 'id-toolbar-btn-underline',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-underline', iconCls : 'btn-underline',
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect], lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
enableToggle: true enableToggle: true
}); });
@ -279,7 +280,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-fontcolor', iconCls : 'btn-fontcolor',
split : true, split : true,
lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.lostConnect], lock : [_set.selImage, _set.editFormula, _set.selRange, _set.coAuth, _set.coAuthText, _set.lostConnect],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ template: _.template('<div id="id-toolbar-menu-fontcolor" style="width: 165px; height: 220px; margin: 10px;"></div>') }, { template: _.template('<div id="id-toolbar-menu-fontcolor" style="width: 165px; height: 220px; margin: 10px;"></div>') },
@ -302,7 +303,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-fillparag', iconCls : 'btn-fillparag',
split : true, split : true,
lock : [_set.selImage, _set.editCell, _set.coAuth, _set.lostConnect], lock : [_set.selImage, _set.editCell, _set.coAuth, _set.coAuthText, _set.lostConnect],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ template: _.template('<div id="id-toolbar-menu-paracolor" style="width: 165px; height: 220px; margin: 10px;"></div>') }, { template: _.template('<div id="id-toolbar-menu-paracolor" style="width: 165px; height: 220px; margin: 10px;"></div>') },
@ -337,7 +338,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-align-left', iconCls : 'btn-align-left',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
toggleGroup : 'alignGroup' toggleGroup : 'alignGroup'
}); });
@ -346,7 +347,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-align-center', iconCls : 'btn-align-center',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
toggleGroup : 'alignGroup' toggleGroup : 'alignGroup'
}); });
@ -355,7 +356,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-align-right', iconCls : 'btn-align-right',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
toggleGroup : 'alignGroup' toggleGroup : 'alignGroup'
}); });
@ -364,7 +365,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-align-just', iconCls : 'btn-align-just',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
toggleGroup: 'alignGroup' toggleGroup: 'alignGroup'
}); });
@ -402,7 +403,7 @@ define([
id : 'id-toolbar-rtn-valign-top', id : 'id-toolbar-rtn-valign-top',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-valign-top', iconCls : 'btn-valign-top',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
enableToggle: true, enableToggle: true,
toggleGroup : 'vAlignGroup' toggleGroup : 'vAlignGroup'
}); });
@ -412,7 +413,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-valign-middle', iconCls : 'btn-valign-middle',
enableToggle: true, enableToggle: true,
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
toggleGroup : 'vAlignGroup' toggleGroup : 'vAlignGroup'
}); });
@ -420,7 +421,7 @@ define([
id : 'id-toolbar-rtn-valign-bottom', id : 'id-toolbar-rtn-valign-bottom',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-valign-bottom', iconCls : 'btn-valign-bottom',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
enableToggle: true, enableToggle: true,
toggleGroup : 'vAlignGroup' toggleGroup : 'vAlignGroup'
}); });
@ -438,7 +439,7 @@ define([
id : 'id-toolbar-rtn-textorient', id : 'id-toolbar-rtn-textorient',
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-text-orient', iconCls : 'btn-text-orient',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.selShape, _set.selShapeText, _set.selImage, _set.lostConnect, _set.coAuth, _set.coAuthText],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {
@ -961,7 +962,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-align-left', iconCls : 'btn-align-left',
icls : 'btn-align-left', icls : 'btn-align-left',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.lostConnect, _set.coAuth, _set.coAuthText],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {
@ -1010,7 +1011,7 @@ define([
cls : 'btn-toolbar', cls : 'btn-toolbar',
iconCls : 'btn-valign-bottom', iconCls : 'btn-valign-bottom',
icls : 'btn-valign-bottom', icls : 'btn-valign-bottom',
lock : [_set.editCell, _set.selChart, _set.selChartText, _set.lostConnect, _set.coAuth], lock : [_set.editCell, _set.selChart, _set.selChartText, _set.lostConnect, _set.coAuth, _set.coAuthText],
menu : new Common.UI.Menu({ menu : new Common.UI.Menu({
items: [ items: [
{ {

View file

@ -57,20 +57,6 @@ define([
Common.localStorage.setKeysFilter('sse-,asc.table'); Common.localStorage.setKeysFilter('sse-,asc.table');
Common.localStorage.sync(); Common.localStorage.sync();
var fillUserInfo = function(info, lang, defname) {
var user = info || {};
!user.id && (user.id = ('uid-' + Date.now()));
_.isEmpty(user.firstname) && _.isEmpty(user.lastname) && (user.firstname = defname);
if (_.isEmpty(user.firstname))
user.fullname = user.lastname;
else if (_.isEmpty(user.lastname))
user.fullname = user.firstname;
else
user.fullname = /^ru/.test(lang) ? user.lastname + ' ' + user.firstname : user.firstname + ' ' + user.lastname;
return user;
};
return { return {
models: [], models: [],
collections: [], collections: [],
@ -160,7 +146,7 @@ define([
this.editorConfig = $.extend(this.editorConfig, data.config); this.editorConfig = $.extend(this.editorConfig, data.config);
this.editorConfig.user = this.editorConfig.user =
this.appOptions.user = fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous); this.appOptions.user = Common.Utils.fillUserInfo(this.editorConfig.user, this.editorConfig.lang, this.textAnonymous);
this.appOptions.nativeApp = this.editorConfig.nativeApp === true; this.appOptions.nativeApp = this.editorConfig.nativeApp === true;
this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop'; this.appOptions.isDesktopApp = this.editorConfig.targetApp == 'desktop';
this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp; this.appOptions.canCreateNew = !_.isEmpty(this.editorConfig.createUrl) && !this.appOptions.isDesktopApp;
@ -198,8 +184,6 @@ define([
var _user = new Asc.asc_CUserInfo(); var _user = new Asc.asc_CUserInfo();
_user.put_Id(this.appOptions.user.id); _user.put_Id(this.appOptions.user.id);
_user.put_FirstName(this.appOptions.user.firstname);
_user.put_LastName(this.appOptions.user.lastname);
_user.put_FullName(this.appOptions.user.fullname); _user.put_FullName(this.appOptions.user.fullname);
docInfo = new Asc.asc_CDocInfo(); docInfo = new Asc.asc_CDocInfo();
@ -211,6 +195,7 @@ define([
docInfo.put_Options(data.doc.options); docInfo.put_Options(data.doc.options);
docInfo.put_UserInfo(_user); docInfo.put_UserInfo(_user);
docInfo.put_CallbackUrl(this.editorConfig.callbackUrl); docInfo.put_CallbackUrl(this.editorConfig.callbackUrl);
docInfo.put_Token(data.doc.token);
} }
this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this));