Commit 8c3269ac authored by Alexander Yuzhin's avatar Alexander Yuzhin

[DE mobile] License check. Fixed open/save TXT. Undo/redo warning on co-authtoring.

parent 840cc376
...@@ -364,7 +364,7 @@ define([ ...@@ -364,7 +364,7 @@ define([
} }
if (id==Asc.c_oAscAsyncAction['Save'] && (!this._state.fastCoauth || this._state.usersCount<2)) { if (id==Asc.c_oAscAsyncAction['Save'] && (!this._state.fastCoauth || this._state.usersCount<2)) {
this.synchronizeChanges(); // this.synchronizeChanges();
} }
}, },
...@@ -668,35 +668,39 @@ define([ ...@@ -668,35 +668,39 @@ define([
mode: me.appOptions.isEdit?'edit':'view' mode: me.appOptions.isEdit?'edit':'view'
}); });
if (this.api) { if (me.api) {
this.api.Resize(); me.api.Resize();
this.api.zoomFitToWidth(); me.api.zoomFitToWidth();
} }
// if (this._state.licenseWarning) { if (me._state.licenseWarning) {
// value = Common.localStorage.getItem("de-license-warning"); value = Common.localStorage.getItem("de-license-warning");
// value = (value!==null) ? parseInt(value) : 0; value = (value!==null) ? parseInt(value) : 0;
// var now = (new Date).getTime(); var now = (new Date).getTime();
// if (now - value > 86400000) {
// Common.localStorage.setItem("de-license-warning", now); if (now - value > 86400000) {
// Common.UI.info({ Common.localStorage.setItem("de-license-warning", now);
// width: 500, uiApp.modal({
// title: this.textNoLicenseTitle, title: me.textNoLicenseTitle,
// msg : this.warnNoLicense, text : me.warnNoLicense,
// buttons: [ buttons: [
// {value: 'buynow', caption: this.textBuyNow}, {
// {value: 'contact', caption: this.textContactUs} text: me.textBuyNow,
// ], bold: true,
// primary: 'buynow', onClick: function() {
// callback: function(btn) { window.open('http://www.onlyoffice.com/enterprise-edition.aspx', "_blank");
// if (btn == 'buynow') }
// window.open('http://www.onlyoffice.com/enterprise-edition.aspx', "_blank"); },
// else if (btn == 'contact') {
// window.open('mailto:sales@onlyoffice.com', "_blank"); text: me.textContactUs,
// } onClick: function() {
// }); window.open('mailto:sales@onlyoffice.com', "_blank");
// } }
// } }
],
});
}
}
}, },
onOpenDocument: function(progress) { onOpenDocument: function(progress) {
...@@ -1122,6 +1126,7 @@ define([ ...@@ -1122,6 +1126,7 @@ define([
// toolbarView.btnSave.setDisabled(!isModified && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1); // toolbarView.btnSave.setDisabled(!isModified && !isSyncButton || this._state.isDisconnected || this._state.fastCoauth && this._state.usersCount>1);
// } // }
}, },
onDocumentCanSaveChanged: function (isCanSave) { onDocumentCanSaveChanged: function (isCanSave) {
// var application = this.getApplication(), // var application = this.getApplication(),
// toolbarController = application.getController('Toolbar'), // toolbarController = application.getController('Toolbar'),
...@@ -1198,87 +1203,6 @@ define([ ...@@ -1198,87 +1203,6 @@ define([
}, },
/** coauthoring end **/ /** coauthoring end **/
synchronizeChanges: function() {
// this.getApplication().getController('Statusbar').synchronizeChanges();
// this.getApplication().getController('DocumentHolder').getView('DocumentHolder').hideTips();
// /** coauthoring begin **/
// this.getApplication().getController('Toolbar').getView('Toolbar').synchronizeChanges();
// /** coauthoring end **/
this._state.hasCollaborativeChanges = false;
},
fillAutoShapes: function(groupNames, shapes){
// if (_.isEmpty(shapes) || _.isEmpty(groupNames) || shapes.length != groupNames.length)
// return;
//
// var me = this,
// shapegrouparray = [],
// shapeStore = this.getCollection('ShapeGroups');
//
// shapeStore.reset();
//
// var groupscount = groupNames.length;
// _.each(groupNames, function(groupName, index){
// var store = new Backbone.Collection([], {
// model: DE.Models.ShapeModel
// });
//
// var cols = (shapes[index].length) > 18 ? 7 : 6,
// height = Math.ceil(shapes[index].length/cols) * 35 + 3,
// width = 30 * cols;
//
// _.each(shapes[index], function(shape, idx){
// store.add({
// imageUrl : shape.Image,
// data : {shapeType: shape.Type},
// tip : me.textShape + ' ' + (idx+1),
// allowSelected : true,
// selected: false
// });
// });
//
// shapegrouparray.push({
// groupName : me.shapeGroupNames[index],
// groupStore : store,
// groupWidth : width,
// groupHeight : height
// });
// });
//
// shapeStore.add(shapegrouparray);
//
// setTimeout(function(){
// me.getApplication().getController('Toolbar').fillAutoShapes();
// }, 50);
},
fillTextArt: function(shapes){
// if (_.isEmpty(shapes)) return;
//
// var me = this, arr = [],
// artStore = this.getCollection('Common.Collections.TextArt');
//
// _.each(shapes, function(shape, index){
// arr.push({
// imageUrl : shape,
// data : index,
// allowSelected : true,
// selected: false
// });
// });
// artStore.reset(arr);
//
// setTimeout(function(){
// me.getApplication().getController('Toolbar').fillTextArt();
// }, 50);
//
// setTimeout(function(){
// me.getApplication().getController('RightMenu').fillTextArt();
// }, 50);
},
updateThemeColors: function() { updateThemeColors: function() {
// var me = this; // var me = this;
// setTimeout(function(){ // setTimeout(function(){
...@@ -1301,12 +1225,6 @@ define([ ...@@ -1301,12 +1225,6 @@ define([
// } // }
}, },
loadLanguages: function() {
// var langs = this.api.asc_getSpellCheckLanguages();
// this.getApplication().getController('DocumentHolder').getView('DocumentHolder').setLanguages(langs);
// this.getApplication().getController('Statusbar').setLanguages(langs);
},
onAdvancedOptions: function(advOptions) { onAdvancedOptions: function(advOptions) {
var type = advOptions.asc_getOptionId(), var type = advOptions.asc_getOptionId(),
me = this, modal; me = this, modal;
...@@ -1343,10 +1261,13 @@ define([ ...@@ -1343,10 +1261,13 @@ define([
if (me.api) { if (me.api) {
me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding)); me.api.asc_setAdvancedOptions(type, new Asc.asc_CTXTAdvancedOptions(encoding));
if (!me._isDocReady) {
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
} }
} }
} }
}
] ]
}); });
...@@ -1378,37 +1299,22 @@ define([ ...@@ -1378,37 +1299,22 @@ define([
onClick: function () { onClick: function () {
var password = $(modal).find('.modal-text-input[name="modal-password"]').val(); var password = $(modal).find('.modal-text-input[name="modal-password"]').val();
me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password)); me.api.asc_setAdvancedOptions(type, new Asc.asc_CDRMAdvancedOptions(password));
if (!me._isDocReady) {
me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument); me.onLongActionBegin(Asc.c_oAscAsyncActionType['BlockInteraction'], LoadingDocument);
} }
} }
}
] ]
}); });
} }
}, },
onTryUndoInFastCollaborative: function() { onTryUndoInFastCollaborative: function() {
// var val = window.localStorage.getItem("de-hide-try-undoredo"); uiApp.alert(
// if (!(val && parseInt(val) == 1)) this.textTryUndoRedo,
// Common.UI.info({ this.notcriticalErrorTitle
// width: 500, );
// msg: this.textTryUndoRedo,
// iconCls: 'info',
// buttons: ['custom', 'cancel'],
// primary: 'custom',
// customButtonText: this.textStrict,
// dontshow: true,
// callback: _.bind(function(btn, dontshow){
// if (dontshow) window.localStorage.setItem("de-hide-try-undoredo", 1);
// if (btn == 'custom') {
// Common.localStorage.setItem("de-settings-coauthmode", 0);
// this.api.asc_SetFastCollaborative(false);
// this._state.fastCoauth = false;
// Common.localStorage.setItem("de-settings-showchanges-strict", 'last');
// this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.LastChanges);
// }
// this.fireEvent('editcomplete', this);
// }, this)
// });
}, },
onAuthParticipantsChanged: function(users) { onAuthParticipantsChanged: function(users) {
...@@ -1420,16 +1326,6 @@ define([ ...@@ -1420,16 +1326,6 @@ define([
this._state.usersCount = length; this._state.usersCount = length;
}, },
applySettings: function() {
if (this.appOptions.isEdit && this.appOptions.canLicense && !this.appOptions.isOffline && this.appOptions.canCoAuthoring) {
var value = Common.localStorage.getItem("de-settings-coauthmode"),
oldval = this._state.fastCoauth;
this._state.fastCoauth = (value===null || parseInt(value) == 1);
if (this._state.fastCoauth && !oldval)
this.synchronizeChanges();
}
},
onDocumentName: function(name) { onDocumentName: function(name) {
// this.getApplication().getController('Viewport').getView('Common.Views.Header').setDocumentCaption(name); // this.getApplication().getController('Viewport').getView('Common.Views.Header').setDocumentCaption(name);
this.updateWindowTitle(true); this.updateWindowTitle(true);
...@@ -1547,7 +1443,7 @@ define([ ...@@ -1547,7 +1443,7 @@ define([
txtArt: 'Your text here', txtArt: 'Your text here',
errorConnectToServer: ' The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the \'OK\' button, you will be prompted to download the document.<br><br>' + errorConnectToServer: ' The document could not be saved. Please check connection settings or contact your administrator.<br>When you click the \'OK\' button, you will be prompted to download the document.<br><br>' +
'Find more information about connecting Document Server <a href=\"https://api.onlyoffice.com/editors/callback\" target=\"_blank\">here</a>', 'Find more information about connecting Document Server <a href=\"https://api.onlyoffice.com/editors/callback\" target=\"_blank\">here</a>',
textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.<br>Click the \'Strict mode\' button to switch to the Strict co-editing mode to edit the file without other users interference and send your changes only after you save them. You can switch between the co-editing modes using the editor Advanced settings.', textTryUndoRedo: 'The Undo/Redo functions are disabled for the Fast co-editing mode.',
textStrict: 'Strict mode', textStrict: 'Strict mode',
txtErrorLoadHistory: 'Loading history failed', txtErrorLoadHistory: 'Loading history failed',
textBuyNow: 'Visit website', textBuyNow: 'Visit website',
......
...@@ -249,6 +249,7 @@ define([ ...@@ -249,6 +249,7 @@ define([
if (format) { if (format) {
if (format == Asc.c_oAscFileType.TXT) { if (format == Asc.c_oAscFileType.TXT) {
_.delay(function () {
uiApp.confirm( uiApp.confirm(
me.warnDownloadAs, me.warnDownloadAs,
me.notcriticalErrorTitle, me.notcriticalErrorTitle,
...@@ -256,6 +257,7 @@ define([ ...@@ -256,6 +257,7 @@ define([
me.api.asc_DownloadAs(format); me.api.asc_DownloadAs(format);
} }
); );
}, 300);
} else { } else {
me.api.asc_DownloadAs(format); me.api.asc_DownloadAs(format);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment