diff --git a/apps/pdfeditor/main/app.js b/apps/pdfeditor/main/app.js index b58d01c506..c3ad9a82f8 100644 --- a/apps/pdfeditor/main/app.js +++ b/apps/pdfeditor/main/app.js @@ -156,7 +156,8 @@ require([ 'Common.Controllers.Chat', 'Common.Controllers.Comments', 'Common.Controllers.Draw', - 'Common.Controllers.Plugins' + 'Common.Controllers.Plugins', + 'Common.Controllers.Protection' ] }); @@ -185,7 +186,8 @@ require([ 'common/main/lib/controller/Chat', /** coauthoring end **/ 'common/main/lib/controller/Plugins', - 'common/main/lib/controller/Draw' + 'common/main/lib/controller/Draw', + 'common/main/lib/controller/Protection' ], function() { app.start(); }); diff --git a/apps/pdfeditor/main/app/controller/LeftMenu.js b/apps/pdfeditor/main/app/controller/LeftMenu.js index 3d0cae5139..a765d93dd4 100644 --- a/apps/pdfeditor/main/app/controller/LeftMenu.js +++ b/apps/pdfeditor/main/app/controller/LeftMenu.js @@ -411,7 +411,7 @@ define([ var value; var fast_coauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"), - canPDFSave = this.mode.isPDFAnnotate || this.mode.isPDFEdit; + canPDFSave = (this.mode.isPDFAnnotate || this.mode.isPDFEdit) && !this.mode.isOffline; /** coauthoring begin **/ if (this.mode.isEdit && !this.mode.isOffline && this.mode.canCoAuthoring && canPDFSave ) { if (this.mode.canChangeCoAuthoring) { diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 9b7eca5e52..20d4bf501e 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -1196,9 +1196,9 @@ define([ this.appOptions.isEdit = !this.appOptions.isXpsViewer && !this.appOptions.isForm; this.appOptions.canPDFEdit = false;//(this.permissions.edit !== false) && this.appOptions.canLicense; this.appOptions.isPDFEdit = false; // this.appOptions.canPDFEdit && this.editorConfig.mode !== 'view'; !! always open in view mode - this.appOptions.canPDFAnnotate = this.appOptions.canSwitchMode && this.appOptions.canLicense && (this.permissions.comment!== false); + this.appOptions.canPDFAnnotate = (this.appOptions.canSwitchMode || !this.appOptions.isXpsViewer && !this.appOptions.isForm && this.appOptions.isDesktopApp && this.appOptions.isOffline) && this.appOptions.canLicense && (this.permissions.comment!== false); this.appOptions.canPDFAnnotate = this.appOptions.canPDFAnnotate && !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.comments===false); - this.appOptions.isPDFAnnotate = false;// this.appOptions.canLicense && this.appOptions.canPDFAnnotate && !this.appOptions.isPDFEdit && this.editorConfig.mode !== 'view'; !! always open in view mode + this.appOptions.isPDFAnnotate = this.appOptions.canPDFAnnotate && this.appOptions.isDesktopApp && this.appOptions.isOffline; // this.appOptions.canPDFAnnotate && !this.appOptions.isPDFEdit && this.editorConfig.mode !== 'view'; !! online files always open in view mode this.appOptions.canComments = !this.appOptions.isXpsViewer && !this.appOptions.isForm; this.appOptions.canViewComments = this.appOptions.canComments; this.appOptions.canChat = this.appOptions.canLicense && !this.appOptions.isOffline && !(this.permissions.chat===false || (this.permissions.chat===undefined) && @@ -1225,7 +1225,7 @@ define([ this.appOptions.trialMode = params.asc_getLicenseMode(); this.appOptions.isBeta = params.asc_getIsBeta(); this.appOptions.isSignatureSupport= false;//this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isSignaturesSupport() && (this.permissions.protect!==false); - this.appOptions.isPasswordSupport = false;//this.appOptions.isEdit && this.api.asc_isProtectionSupport() && (this.permissions.protect!==false); + this.appOptions.isPasswordSupport = this.appOptions.isEdit && this.appOptions.isDesktopApp && this.appOptions.isOffline && this.api.asc_isProtectionSupport() && (this.permissions.protect!==false) && !this.appOptions.isForm; this.appOptions.canProtect = (this.permissions.protect!==false); this.appOptions.canHelp = !((typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.help===false); this.appOptions.canSubmitForms = this.appOptions.canLicense && (typeof (this.editorConfig.customization) == 'object') && !!this.editorConfig.customization.submitForm && !this.appOptions.isOffline; @@ -1464,7 +1464,9 @@ define([ if (this.appOptions.isEdit) { // var fontsControllers = application.getController('Common.Controllers.Fonts'); // fontsControllers && fontsControllers.setApi(me.api); - // application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); + + if (me.appOptions.isSignatureSupport || me.appOptions.isPasswordSupport) + application.getController('Common.Controllers.Protection').setMode(me.appOptions).setConfig({config: me.editorConfig}, me.api); var viewport = this.getApplication().getController('Viewport').getView('Viewport'); viewport.applyEditorMode(); diff --git a/apps/pdfeditor/main/app/controller/Toolbar.js b/apps/pdfeditor/main/app/controller/Toolbar.js index 6d14e90039..67ff5968d3 100644 --- a/apps/pdfeditor/main/app/controller/Toolbar.js +++ b/apps/pdfeditor/main/app/controller/Toolbar.js @@ -457,10 +457,10 @@ define([ } }); } else if (this.api) { - var isModified = this.api.asc_isDocumentCanSave(); - var isSyncButton = toolbar.btnCollabChanges && toolbar.btnCollabChanges.cmpEl.hasClass('notify'); - if (!isModified && !isSyncButton && !toolbar.mode.forcesave) - return; + // var isModified = this.api.asc_isDocumentCanSave(); + // var isSyncButton = toolbar.btnCollabChanges && toolbar.btnCollabChanges.cmpEl.hasClass('notify'); + // if (!isModified && !isSyncButton && !toolbar.mode.forcesave) + // return; this.api.asc_Save(); toolbar.btnSave && toolbar.btnSave.setDisabled(!toolbar.mode.forcesave && !toolbar.mode.saveAlwaysEnabled); diff --git a/apps/pdfeditor/main/app/template/FileMenu.template b/apps/pdfeditor/main/app/template/FileMenu.template index c128df7e8e..6736a39575 100644 --- a/apps/pdfeditor/main/app/template/FileMenu.template +++ b/apps/pdfeditor/main/app/template/FileMenu.template @@ -9,6 +9,7 @@
+ @@ -31,5 +32,6 @@ + \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/FileMenu.js b/apps/pdfeditor/main/app/view/FileMenu.js index b553bde17c..440d913337 100644 --- a/apps/pdfeditor/main/app/view/FileMenu.js +++ b/apps/pdfeditor/main/app/view/FileMenu.js @@ -447,6 +447,11 @@ define([ !this.panels['recent'] && (this.panels['recent'] = (new Common.Views.RecentFiles({ el: '#panel-recentfiles', menu:this, recent: this.mode.recent})).render()); } + if (this.mode.isSignatureSupport || this.mode.isPasswordSupport) { + !this.panels['protect'] && (this.panels['protect'] = (new PDFE.Views.FileMenuPanels.ProtectDoc({menu:this})).render()); + this.panels['protect'].setMode(this.mode); + } + if (this.mode.canDownload) { !this.panels['saveas'] && (this.panels['saveas'] = ((new PDFE.Views.FileMenuPanels.ViewSaveAs({menu: this, fileType: this.document.fileType, mode: this.mode})).render())); } else if (this.mode.canDownloadOrigin) diff --git a/apps/pdfeditor/main/app/view/FileMenuPanels.js b/apps/pdfeditor/main/app/view/FileMenuPanels.js index f4500c4dab..be7cd80ce8 100644 --- a/apps/pdfeditor/main/app/view/FileMenuPanels.js +++ b/apps/pdfeditor/main/app/view/FileMenuPanels.js @@ -659,7 +659,7 @@ define([ this.mode = mode; var fast_coauth = Common.Utils.InternalSettings.get("pdfe-settings-coauthmode"), - canPDFSave = mode.isPDFAnnotate || mode.isPDFEdit; + canPDFSave = (mode.isPDFAnnotate || mode.isPDFEdit) && !mode.isOffline; $('tr.edit', this.el)[mode.isEdit?'show':'hide'](); $('tr.autosave', this.el)[mode.isEdit && canPDFSave && (mode.canChangeCoAuthoring || !fast_coauth) ? 'show' : 'hide'](); @@ -1985,6 +1985,191 @@ define([ } }); + PDFE.Views.FileMenuPanels.ProtectDoc = Common.UI.BaseView.extend(_.extend({ + el: '#panel-protect', + menu: undefined, + + template: _.template([ + '', + '