diff --git a/apps/spreadsheeteditor/main/app/controller/DataTab.js b/apps/spreadsheeteditor/main/app/controller/DataTab.js
index 2d6a12396..5e965b1cc 100644
--- a/apps/spreadsheeteditor/main/app/controller/DataTab.js
+++ b/apps/spreadsheeteditor/main/app/controller/DataTab.js
@@ -279,29 +279,52 @@ define([
},
onCustomSort: function() {
+ Common.NotificationCenter.trigger('protect:check', this.onCustomSortCallback, this);
+ },
+
+ onCustomSortCallback: function() {
var me = this;
if (this.api) {
var res = this.api.asc_sortCellsRangeExpand();
- if (res) {
- var config = {
- width: 500,
- title: this.toolbar.txtSorting,
- msg: this.toolbar.txtExpandSort,
-
- buttons: [ {caption: this.toolbar.txtExpand, primary: true, value: 'expand'},
- {caption: this.toolbar.txtSortSelected, primary: true, value: 'sort'},
- 'cancel'],
- callback: function(btn){
- if (btn == 'expand' || btn == 'sort') {
- setTimeout(function(){
- me.showCustomSort(btn == 'expand');
- },1);
+ switch (res) {
+ case Asc.c_oAscSelectionSortExpand.showExpandMessage:
+ var config = {
+ width: 500,
+ title: this.toolbar.txtSorting,
+ msg: this.toolbar.txtExpandSort,
+ buttons: [ {caption: this.toolbar.txtExpand, primary: true, value: 'expand'},
+ {caption: this.toolbar.txtSortSelected, primary: true, value: 'sort'},
+ 'cancel'],
+ callback: function(btn){
+ if (btn == 'expand' || btn == 'sort') {
+ setTimeout(function(){
+ me.showCustomSort(btn == 'expand');
+ },1);
+ }
}
- }
- };
- Common.UI.alert(config);
- } else
- me.showCustomSort(res !== null);
+ };
+ Common.UI.alert(config);
+ break;
+ case Asc.c_oAscSelectionSortExpand.showLockMessage:
+ var config = {
+ width: 500,
+ title: this.toolbar.txtSorting,
+ msg: this.toolbar.txtLockSort,
+ buttons: ['yes', 'no'],
+ primary: 'yes',
+ callback: function(btn){
+ (btn == 'yes') && setTimeout(function(){
+ me.showCustomSort(false);
+ },1);
+ }
+ };
+ Common.UI.alert(config);
+ break;
+ case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
+ case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
+ me.showCustomSort(res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
+ break;
+ }
}
},
@@ -326,7 +349,7 @@ define([
var me = this;
if (this.api) {
var res = this.api.asc_sortCellsRangeExpand();
- if (res) {
+ if (res===Asc.c_oAscSelectionSortExpand.showExpandMessage) {
var config = {
width: 500,
title: this.txtRemDuplicates,
@@ -343,8 +366,8 @@ define([
}
};
Common.UI.alert(config);
- } else
- me.showRemDuplicates(res !== null);
+ } else if (res !== Asc.c_oAscSelectionSortExpand.showLockMessage)
+ me.showRemDuplicates(res===Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
}
},
diff --git a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
index 292291c02..9a5343f46 100644
--- a/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
+++ b/apps/spreadsheeteditor/main/app/controller/DocumentHolder.js
@@ -436,28 +436,46 @@ define([
}
if (this.api) {
var res = this.api.asc_sortCellsRangeExpand();
- if (res) {
- var config = {
- width: 500,
- title: this.txtSorting,
- msg: this.txtExpandSort,
- buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
- {caption: this.txtSortSelected, primary: true, value: 'sort'},
- 'cancel'],
- callback: _.bind(function(btn){
- if (btn == 'expand' || btn == 'sort') {
- this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, btn == 'expand');
- }
- Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
- Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
- }, this)
- };
- Common.UI.alert(config);
- } else {
- this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, res !== null);
-
- Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
- Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
+ switch (res) {
+ case Asc.c_oAscSelectionSortExpand.showExpandMessage:
+ var config = {
+ width: 500,
+ title: this.txtSorting,
+ msg: this.txtExpandSort,
+ buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
+ {caption: this.txtSortSelected, primary: true, value: 'sort'},
+ 'cancel'],
+ callback: _.bind(function(btn){
+ if (btn == 'expand' || btn == 'sort') {
+ this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, btn == 'expand');
+ }
+ Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
+ Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
+ }, this)
+ };
+ Common.UI.alert(config);
+ break;
+ case Asc.c_oAscSelectionSortExpand.showLockMessage:
+ var config = {
+ width: 500,
+ title: this.txtSorting,
+ msg: this.txtLockSort,
+ buttons: ['yes', 'no'],
+ primary: 'yes',
+ callback: _.bind(function(btn){
+ (btn == 'yes') && this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, false);
+ Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
+ Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
+ }, this)
+ };
+ Common.UI.alert(config);
+ break;
+ case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
+ case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
+ this.api.asc_sortColFilter(item.value, '', undefined, (item.value==Asc.c_oAscSortOptions.ByColorFill) ? this.documentHolder.ssMenu.cellColor : this.documentHolder.ssMenu.fontColor, res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
+ Common.NotificationCenter.trigger('edit:complete', this.documentHolder);
+ Common.component.Analytics.trackEvent('DocumentHolder', 'Sort Cells');
+ break;
}
}
},
@@ -3924,7 +3942,8 @@ define([
txtImportWizard: 'Text Import Wizard',
textPasteSpecial: 'Paste special',
textStopExpand: 'Stop automatically expanding tables',
- textAutoCorrectSettings: 'AutoCorrect options'
+ textAutoCorrectSettings: 'AutoCorrect options',
+ txtLockSort: 'Data is found next to your selection, but you do not have sufficient permissions to change those cells.
Do you wish to continue with the current selection?'
}, SSE.Controllers.DocumentHolder || {}));
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/app/controller/Toolbar.js b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
index 1c5ead242..66791b48a 100644
--- a/apps/spreadsheeteditor/main/app/controller/Toolbar.js
+++ b/apps/spreadsheeteditor/main/app/controller/Toolbar.js
@@ -1202,25 +1202,43 @@ define([
}
Common.NotificationCenter.trigger('edit:complete', this.toolbar);
} else {
+ var me = this;
var res = this.api.asc_sortCellsRangeExpand();
- if (res) {
- var config = {
- width: 500,
- title: this.txtSorting,
- msg: this.txtExpandSort,
-
- buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
- {caption: this.txtSortSelected, primary: true, value: 'sort'},
- 'cancel'],
- callback: _.bind(function(btn){
- if (btn == 'expand' || btn == 'sort') {
- this.api.asc_sortColFilter(type, '', undefined, undefined, btn == 'expand');
+ switch (res) {
+ case Asc.c_oAscSelectionSortExpand.showExpandMessage:
+ var config = {
+ width: 500,
+ title: this.txtSorting,
+ msg: this.txtExpandSort,
+ buttons: [ {caption: this.txtExpand, primary: true, value: 'expand'},
+ {caption: this.txtSortSelected, primary: true, value: 'sort'},
+ 'cancel'],
+ callback: function(btn){
+ if (btn == 'expand' || btn == 'sort') {
+ me.api.asc_sortColFilter(type, '', undefined, undefined, btn == 'expand')
+ }
}
- }, this)
- };
- Common.UI.alert(config);
- } else
- this.api.asc_sortColFilter(type, '', undefined, undefined, res !== null);
+ };
+ Common.UI.alert(config);
+ break;
+ case Asc.c_oAscSelectionSortExpand.showLockMessage:
+ var config = {
+ width: 500,
+ title: this.txtSorting,
+ msg: this.txtLockSort,
+ buttons: ['yes', 'no'],
+ primary: 'yes',
+ callback: function(btn){
+ (btn == 'yes') && me.api.asc_sortColFilter(type, '', undefined, undefined, false);
+ }
+ };
+ Common.UI.alert(config);
+ break;
+ case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
+ case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
+ this.api.asc_sortColFilter(type, '', undefined, undefined, res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
+ break;
+ }
}
}
},
@@ -4403,7 +4421,8 @@ define([
textDirectional: 'Directional',
textShapes: 'Shapes',
textIndicator: 'Indicators',
- textRating: 'Ratings'
+ textRating: 'Ratings',
+ txtLockSort: 'Data is found next to your selection, but you do not have sufficient permissions to change those cells.
Do you wish to continue with the current selection?'
}, SSE.Controllers.Toolbar || {}));
});
\ No newline at end of file
diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json
index 03703ded1..8f33a562f 100644
--- a/apps/spreadsheeteditor/main/locale/en.json
+++ b/apps/spreadsheeteditor/main/locale/en.json
@@ -587,6 +587,7 @@
"SSE.Controllers.DocumentHolder.txtUndoExpansion": "Undo table autoexpansion",
"SSE.Controllers.DocumentHolder.txtUseTextImport": "Use text import wizard",
"SSE.Controllers.DocumentHolder.txtWidth": "Width",
+ "SSE.Controllers.DocumentHolder.txtLockSort": "Data is found next to your selection, but you do not have sufficient permissions to change those cells.
Do you wish to continue with the current selection?",
"SSE.Controllers.FormulaDialog.sCategoryAll": "All",
"SSE.Controllers.FormulaDialog.sCategoryCube": "Cube",
"SSE.Controllers.FormulaDialog.sCategoryDatabase": "Database",
@@ -1401,6 +1402,7 @@
"SSE.Controllers.Toolbar.txtTable_TableStyleMedium": "Table Style Medium",
"SSE.Controllers.Toolbar.warnLongOperation": "The operation you are about to perform might take rather much time to complete.
Are you sure you want to continue?",
"SSE.Controllers.Toolbar.warnMergeLostData": "Only the data from the upper-left cell will remain in the merged cell.
Are you sure you want to continue?",
+ "SSE.Controllers.Toolbar.txtLockSort": "Data is found next to your selection, but you do not have sufficient permissions to change those cells.
Do you wish to continue with the current selection?",
"SSE.Controllers.Viewport.textFreezePanes": "Freeze Panes",
"SSE.Controllers.Viewport.textFreezePanesShadow": "Show Frozen Panes Shadow",
"SSE.Controllers.Viewport.textHideFBar": "Hide Formula Bar",
diff --git a/apps/spreadsheeteditor/mobile/locale/en.json b/apps/spreadsheeteditor/mobile/locale/en.json
index ad93cc481..9211947d1 100644
--- a/apps/spreadsheeteditor/mobile/locale/en.json
+++ b/apps/spreadsheeteditor/mobile/locale/en.json
@@ -333,7 +333,10 @@
"txtExpandSort": "The data next to the selection will not be sorted. Do you want to expand the selection to include the adjacent data or continue with sorting the currently selected cells only?",
"txtNotUrl": "This field should be a URL in the format \"http://www.example.com\"",
"txtSorting": "Sorting",
- "txtSortSelected": "Sort selected"
+ "txtSortSelected": "Sort selected",
+ "txtLockSort": "Data is found next to your selection, but you do not have sufficient permissions to change those cells.
Do you wish to continue with the current selection?",
+ "txtYes": "Yes",
+ "txtNo": "No"
},
"Edit": {
"notcriticalErrorTitle": "Warning",
diff --git a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx
index 634b8d32d..5a94bdccc 100644
--- a/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx
+++ b/apps/spreadsheeteditor/mobile/src/controller/add/AddFilter.jsx
@@ -48,7 +48,9 @@ class AddFilterController extends Component {
f7.popover.close('#add-popover');
let typeCheck = type == 'down' ? Asc.c_oAscSortOptions.Ascending : Asc.c_oAscSortOptions.Descending;
- if( api.asc_sortCellsRangeExpand()) {
+ let res = api.asc_sortCellsRangeExpand();
+ switch (res) {
+ case Asc.c_oAscSelectionSortExpand.showExpandMessage:
f7.dialog.create({
title: _t.txtSorting,
text: _t.txtExpandSort,
@@ -63,18 +65,41 @@ class AddFilterController extends Component {
{
text: _t.txtSortSelected,
bold: true,
- onClick: () => {
- api.asc_sortColFilter(typeCheck, '', undefined, undefined);
+ onClick: () => {
+ api.asc_sortColFilter(typeCheck, '', undefined, undefined);
}
},
{
text: _t.textCancel
}
],
- verticalButtons: true,
+ verticalButtons: true
}).open();
- } else
- api.asc_sortColFilter(typeCheck, '', undefined, undefined, api.asc_sortCellsRangeExpand() !== null);
+ break;
+ case Asc.c_oAscSelectionSortExpand.showLockMessage:
+ f7.dialog.create({
+ title: _t.txtSorting,
+ text: _t.txtLockSort,
+ buttons: [
+ {
+ text: _t.txtYes,
+ bold: true,
+ onClick: () => {
+ api.asc_sortColFilter(typeCheck, '', undefined, undefined, false);
+ }
+ },
+ {
+ text: _t.txtNo
+ }
+ ],
+ verticalButtons: true
+ }).open();
+ break;
+ case Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage:
+ case Asc.c_oAscSelectionSortExpand.notExpandAndNotShowMessage:
+ api.asc_sortColFilter(typeCheck, '', undefined, undefined, res === Asc.c_oAscSelectionSortExpand.expandAndNotShowMessage);
+ break;
+ }
}
onInsertFilter (checked) {