diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index fce9a2ee1..5d7d7ba19 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -91,6 +91,8 @@ define([ }, options); + this.txtOpenFile = options.txtOpenFile || this.txtOpenFile; + this.template = options.template || [ '
', '
', diff --git a/apps/spreadsheeteditor/main/app/controller/WBProtection.js b/apps/spreadsheeteditor/main/app/controller/WBProtection.js index 560fc7616..ea885d7d8 100644 --- a/apps/spreadsheeteditor/main/app/controller/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/controller/WBProtection.js @@ -105,30 +105,72 @@ define([ }, onWorkbookClick: function(state) { - var me = this, - win = new Common.Views.PasswordDialog({ - api: me.api, - txtTitle: me.view.txtWBTitle, - txtDescription: me.view.txtWBDescription, - passwordOptional: true, - height: 291, - buttons: [{ - value: 'ok', - caption: me.view.txtProtect - }, 'cancel'], - primary: 'ok', - handler: function(result, props) { - if (result == 'ok') { - me.api.asc_setProtectedWorkbook(me.api.asc_getProtectedWorkbook()); + if (state) { + var me = this, + win = new Common.Views.PasswordDialog({ + api: me.api, + title: me.view.txtWBTitle, + txtDescription: me.view.txtWBDescription, + passwordOptional: true, + height: 291, + buttons: [{ + value: 'ok', + caption: me.view.txtProtect + }, 'cancel'], + primary: 'ok', + handler: function(result, props) { + if (result == 'ok') { + me.api.asc_setProtectedWorkbook(me.api.asc_getProtectedWorkbook()); + } + Common.NotificationCenter.trigger('edit:complete'); } - Common.NotificationCenter.trigger('edit:complete'); - } - }); + }); - win.show(); + win.show(); + } else { + var me = this, + win = new Common.Views.OpenDialog({ + title: me.view.txtWBUnlockTitle, + closable: true, + type: Common.Utils.importTextType.DRM, + txtOpenFile: me.view.txtWBUnlockDescription, + validatePwd: false, + handler: function (result, value) { + if (result == 'ok') { + if (me.api) { + me.api.asc_setProtectedWorkbook(me.api.asc_getProtectedWorkbook()); + } + Common.NotificationCenter.trigger('edit:complete'); + } + } + }); + + win.show(); + } }, onSheetClick: function(state) { + if (state) { + + } else { + var me = this, + win = new Common.Views.OpenDialog({ + title: me.view.txtSheetUnlockTitle, + closable: true, + type: Common.Utils.importTextType.DRM, + txtOpenFile: me.view.txtSheetUnlockDescription, + validatePwd: false, + handler: function (result, value) { + if (result == 'ok') { + if (me.api) { + } + Common.NotificationCenter.trigger('edit:complete'); + } + } + }); + + win.show(); + } }, onRangesClick: function() { diff --git a/apps/spreadsheeteditor/main/app/view/WBProtection.js b/apps/spreadsheeteditor/main/app/view/WBProtection.js index 44d3f0899..998820242 100644 --- a/apps/spreadsheeteditor/main/app/view/WBProtection.js +++ b/apps/spreadsheeteditor/main/app/view/WBProtection.js @@ -212,7 +212,11 @@ define([ txtHiddenFormula: 'Hidden Formulas', txtProtect: 'Protect', txtWBDescription: 'To prevent other users from viewing hidden worksheets, adding, moving, deleting, or hiding worksheets and renaming worksheets, you can protect the structure of your workbook with a password.', - txtWBTitle: 'Protect Workbook structure' + txtWBTitle: 'Protect Workbook structure', + txtWBUnlockTitle: 'Unprotect Workbook', + txtWBUnlockDescription: 'Enter a password to unprotect workbook', + txtSheetUnlockTitle: 'Unprotect Sheet', + txtSheetUnlockDescription: 'Enter a password to unprotect sheet' } }()), SSE.Views.WBProtection || {})); }); \ No newline at end of file