diff --git a/apps/common/main/lib/component/Mixtbar.js b/apps/common/main/lib/component/Mixtbar.js index 0f1eaa71a5..81bd6cf10d 100644 --- a/apps/common/main/lib/component/Mixtbar.js +++ b/apps/common/main/lib/component/Mixtbar.js @@ -143,7 +143,8 @@ define([ this.$layout = $(options.template({ tabsmarkup: _.template(_template_tabs)({items: options.tabs}), - isRTL: Common.UI.isRTL() + isRTL: Common.UI.isRTL(), + config: options.config })); config.tabs = options.tabs; diff --git a/apps/common/main/lib/view/Header.js b/apps/common/main/lib/view/Header.js index 2568e8cba2..44ab50c734 100644 --- a/apps/common/main/lib/view/Header.js +++ b/apps/common/main/lib/view/Header.js @@ -222,7 +222,7 @@ define([ function updateDocNamePosition(config) { if ( $labelDocName && config) { var $parent = $labelDocName.parent(); - if (!config.isEdit) { + if (!(config.isEdit || isPDFEditor && config.isRestrictedEdit)) { var _left_width = $parent.position().left, _right_width = $parent.next().outerWidth(); $parent.css('padding-left', _left_width < _right_width ? Math.max(2, _right_width - _left_width) : 2); @@ -242,7 +242,7 @@ define([ } } - if (!(config.customization && config.customization.toolbarHideFileName) && (!config.isEdit || config.customization && config.customization.compactHeader)) { + if (!(config.customization && config.customization.toolbarHideFileName) && (!(config.isEdit || isPDFEditor && config.isRestrictedEdit) || config.customization && config.customization.compactHeader)) { var basis = parseFloat($parent.css('padding-left') || 0) + parseFloat($parent.css('padding-right') || 0) + parseInt($labelDocName.css('min-width') || 50); // 2px - box-shadow config.isCrypted && (basis += 20); $parent.css('flex-basis', Math.ceil(basis) + 'px'); @@ -262,7 +262,7 @@ define([ } function onResize() { - if (appConfig && appConfig.isEdit && !(appConfig.customization && appConfig.customization.compactHeader)) { + if (appConfig && (appConfig.isEdit || isPDFEditor && appConfig.isRestrictedEdit) && !(appConfig.customization && appConfig.customization.compactHeader)) { updateDocNamePosition(appConfig); } } @@ -383,7 +383,7 @@ define([ }); } - if ( !mode.isEdit ) { + if ( !(mode.isEdit || isPDFEditor && mode.isRestrictedEdit) ) { if ( me.btnDownload ) { me.btnDownload.updateHint(me.tipDownload); me.btnDownload.on('click', function (e) { @@ -443,7 +443,7 @@ define([ Common.NotificationCenter.trigger('pdf:mode', item.value, _.bind(changePDFMode, me)); }); } - if (appConfig.isEdit && !(appConfig.customization && appConfig.customization.compactHeader)) + if ((appConfig.isEdit || isPDFEditor && appConfig.isRestrictedEdit) && !(appConfig.customization && appConfig.customization.compactHeader)) Common.NotificationCenter.on('window:resize', onResize); } @@ -638,7 +638,7 @@ define([ $html.find('#slot-btn-favorite').hide(); } - if ( !config.isEdit ) { + if ( !(config.isEdit || isPDFEditor && config.isRestrictedEdit)) { if ( (config.canDownload || config.canDownloadOrigin) && !config.isOffline ) this.btnDownload = createTitleButton('toolbar__icon icon--inverse btn-download', $html.findById('#slot-hbtn-download'), undefined, 'bottom', 'big'); @@ -653,7 +653,7 @@ define([ } me.btnSearch.render($html.find('#slot-btn-search')); - if (!config.isEdit || config.customization && !!config.customization.compactHeader) { + if (!(config.isEdit || isPDFEditor && config.isRestrictedEdit) || config.customization && !!config.customization.compactHeader) { if (config.user.guest && config.canRenameAnonymous) { me.btnUserName = new Common.UI.Button({ el: $html.findById('.slot-btn-user-name'), @@ -734,13 +734,15 @@ define([ $btnUserName = $html.find('.color-user-name'); me.setUserName(me.options.userName); - if ( config.canPrint && config.isEdit ) { + if ( config.canPrint && (config.isEdit || isPDFEditor && config.isRestrictedEdit) ) { me.btnPrint = createTitleButton('toolbar__icon icon--inverse btn-print', $html.findById('#slot-btn-dt-print'), true, undefined, undefined, 'P'); } - if ( config.canQuickPrint && config.isEdit ) + if ( config.canQuickPrint && (config.isEdit || isPDFEditor && config.isRestrictedEdit) ) me.btnPrintQuick = createTitleButton('toolbar__icon icon--inverse btn-quick-print', $html.findById('#slot-btn-dt-print-quick'), true, undefined, undefined, 'Q'); - me.btnSave = createTitleButton('toolbar__icon icon--inverse btn-save', $html.findById('#slot-btn-dt-save'), true, undefined, undefined, 'S'); + if (!isPDFEditor || !config.isForm) + me.btnSave = createTitleButton('toolbar__icon icon--inverse btn-save', $html.findById('#slot-btn-dt-save'), true, undefined, undefined, 'S'); + me.btnUndo = createTitleButton('toolbar__icon icon--inverse btn-undo', $html.findById('#slot-btn-dt-undo'), true, undefined, undefined, 'Z'); me.btnRedo = createTitleButton('toolbar__icon icon--inverse btn-redo', $html.findById('#slot-btn-dt-redo'), true, undefined, undefined, 'Y'); diff --git a/apps/pdfeditor/main/app/controller/DocumentHolder.js b/apps/pdfeditor/main/app/controller/DocumentHolder.js index 24f2e858e4..4170c6c63a 100644 --- a/apps/pdfeditor/main/app/controller/DocumentHolder.js +++ b/apps/pdfeditor/main/app/controller/DocumentHolder.js @@ -41,7 +41,10 @@ define([ 'core', - 'pdfeditor/main/app/view/DocumentHolder' + 'pdfeditor/main/app/view/DocumentHolder', + 'common/main/lib/view/ImageFromUrlDialog', + 'common/main/lib/view/SelectFileDlg', + 'common/main/lib/view/SaveAsDlg' ], function () { 'use strict'; @@ -164,6 +167,13 @@ define([ this.api.asc_registerCallback('asc_onShowPDFFormsActions', _.bind(this.onShowFormsPDFActions, this)); this.api.asc_registerCallback('asc_onHidePdfFormsActions', _.bind(this.onHidePdfFormsActions, this)); } + if (this.mode.isRestrictedEdit) { + this.api.asc_registerCallback('asc_onShowContentControlsActions', _.bind(this.onShowContentControlsActions, this)); + this.api.asc_registerCallback('asc_onHideContentControlsActions', _.bind(this.onHideContentControlsActions, this)); + Common.Gateway.on('insertimage', _.bind(this.insertImage, this)); + Common.NotificationCenter.on('storage:image-load', _.bind(this.openImageFromStorage, this)); // try to load image from storage + Common.NotificationCenter.on('storage:image-insert', _.bind(this.insertImageFromStorage, this)); // set loaded image to control + } this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onCoAuthoringDisconnect, this)); @@ -836,8 +846,8 @@ define([ }, onHidePdfFormsActions: function() { - this.listControlMenu && this.listControlMenu.isVisible() && this.listControlMenu.hide(); - var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container'); + this.listControlMenuPdf && this.listControlMenuPdf.isVisible() && this.listControlMenuPdf.hide(); + var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container-pdf'); if (controlsContainer.is(':visible')) controlsContainer.hide(); }, @@ -848,7 +858,7 @@ define([ this.onShowListActionsPDF(obj, x, y); break; case AscPDF.FIELD_TYPES.text: - this.onShowDateActions(obj, x, y); + this.onShowDateActionsPDF(obj, x, y); break; } }, @@ -856,16 +866,16 @@ define([ onShowListActionsPDF: function(obj) { var isForm = true, cmpEl = this.documentHolder.cmpEl, - menu = this.listControlMenu, + menu = this.listControlMenuPdf, menuContainer = menu ? cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, me = this; - me._listObj = obj; + me._listObjPdf = obj; this._fromShowContentControls = true; Common.UI.Menu.Manager.hideAll(); if (!menu) { - this.listControlMenu = menu = new Common.UI.Menu({ + this.listControlMenuPdf = menu = new Common.UI.Menu({ maxHeight: 207, menuAlign: 'tr-bl', items: [] @@ -885,7 +895,7 @@ define([ menu.render(menuContainer); menu.cmpEl.attr({tabindex: "-1"}); menu.on('hide:after', function(){ - me.listControlMenu.removeAll(); + me.listControlMenuPdf.removeAll(); if (!me._fromShowContentControls) me.api.asc_UncheckContentControlButtons(); }); @@ -925,15 +935,15 @@ define([ this._fromShowContentControls = false; }, - onShowDateActions: function(obj, x, y) { + onShowDateActionsPDF: function(obj, x, y) { var cmpEl = this.documentHolder.cmpEl, - controlsContainer = cmpEl.find('#calendar-control-container'), + controlsContainer = cmpEl.find('#calendar-control-container-pdf'), me = this; - this._dateObj = obj; + this._dateObjPdf = obj; if (controlsContainer.length < 1) { - controlsContainer = $('
'); + controlsContainer = $('
'); cmpEl.append(controlsContainer); } @@ -945,19 +955,19 @@ define([ controlsContainer.css({left: oGlobalCoords.X, top : oGlobalCoords.Y}); controlsContainer.show(); - if (!this.cmpCalendar) { - this.cmpCalendar = new Common.UI.Calendar({ - el: cmpEl.find('#id-document-calendar-control'), + if (!this.cmpCalendarPdf) { + this.cmpCalendarPdf = new Common.UI.Calendar({ + el: cmpEl.find('#id-document-calendar-control-pdf'), enableKeyEvents: true, firstday: 1 }); - this.cmpCalendar.on('date:click', function (cmp, date) { + this.cmpCalendarPdf.on('date:click', function (cmp, date) { var specProps = new AscCommon.CSdtDatePickerPr(); specProps.put_FullDate(new Date(date)); me.api.asc_SetTextFormDatePickerDate(specProps); controlsContainer.hide(); }); - this.cmpCalendar.on('calendar:keydown', function (cmp, e) { + this.cmpCalendarPdf.on('calendar:keydown', function (cmp, e) { if (e.keyCode==Common.UI.Keys.ESC) { controlsContainer.hide(); } @@ -969,14 +979,320 @@ define([ }); } - var val = this._dateObj ? this._dateObj.GetValue() : undefined; + var val = this._dateObjPdf ? this._dateObjPdf.GetValue() : undefined; if (val) { val = new Date(val); if (Object.prototype.toString.call(val) !== '[object Date]' || isNaN(val)) val = undefined; } !val && (val = new Date()); - this.cmpCalendar.setDate(val); + this.cmpCalendarPdf.setDate(val); + + // align + var offset = controlsContainer.offset(), + docW = Common.Utils.innerWidth(), + docH = Common.Utils.innerHeight() - 10, // Yep, it's magic number + menuW = this.cmpCalendarPdf.cmpEl.outerWidth(), + menuH = this.cmpCalendarPdf.cmpEl.outerHeight(), + buttonOffset = 22, + left = offset.left - menuW, + top = offset.top; + if (top + menuH > docH) { + top = docH - menuH; + left -= buttonOffset; + } + if (top < 0) + top = 0; + if (left + menuW > docW) + left = docW - menuW; + this.cmpCalendarPdf.cmpEl.css({left: left, top : top}); + + this._preventClick = true; + }, + + onShowContentControlsActions: function(obj, x, y) { + if (this._isDisabled) return; + + var me = this; + switch (obj.type) { + case Asc.c_oAscContentControlSpecificType.DateTime: + this.onShowDateActions(obj, x, y); + break; + case Asc.c_oAscContentControlSpecificType.Picture: + if (obj.pr && obj.pr.get_Lock) { + var lock = obj.pr.get_Lock(); + if (lock == Asc.c_oAscSdtLockType.SdtContentLocked || lock==Asc.c_oAscSdtLockType.ContentLocked) + return; + } + this.onShowImageActions(obj, x, y); + break; + case Asc.c_oAscContentControlSpecificType.DropDownList: + case Asc.c_oAscContentControlSpecificType.ComboBox: + this.onShowListActions(obj, x, y); + break; + } + }, + + onHideContentControlsActions: function() { + this.listControlMenu && this.listControlMenu.isVisible() && this.listControlMenu.hide(); + var controlsContainer = this.documentHolder.cmpEl.find('#calendar-control-container'); + if (controlsContainer.is(':visible')) + controlsContainer.hide(); + }, + + onShowImageActions: function(obj, x, y) { + var cmpEl = this.documentHolder.cmpEl, + menu = this.imageControlMenu, + menuContainer = menu ? cmpEl.find(Common.Utils.String.format('#menu-container-{0}', menu.id)) : null, + me = this; + + this.internalFormObj = obj && obj.pr ? obj.pr.get_InternalId() : null; + this._fromShowContentControls = true; + Common.UI.Menu.Manager.hideAll(); + + if (!menu) { + this.imageControlMenu = menu = new Common.UI.Menu({ + maxHeight: 207, + menuAlign: 'tl-bl', + items: [ + {caption: this.documentHolder.mniImageFromFile, value: 'file'}, + {caption: this.documentHolder.mniImageFromUrl, value: 'url'}, + {caption: this.documentHolder.mniImageFromStorage, value: 'storage', visible: this.mode.canRequestInsertImage || this.mode.fileChoiceUrl && this.mode.fileChoiceUrl.indexOf("{documentType}")>-1} + ] + }); + menu.on('item:click', function(menu, item) { + setTimeout(function(){ + me.onImageSelect(menu, item); + }, 1); + setTimeout(function(){ + me.api.asc_UncheckContentControlButtons(); + }, 500); + }); + + // Prepare menu container + if (!menuContainer || menuContainer.length < 1) { + menuContainer = $(Common.Utils.String.format('', menu.id)); + cmpEl.append(menuContainer); + } + + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + menu.on('hide:after', function(){ + if (!me._fromShowContentControls) + me.api.asc_UncheckContentControlButtons(); + }); + } + menuContainer.css({left: x, top : y}); + menuContainer.attr('data-value', 'prevent-canvas-click'); + this._preventClick = true; + menu.show(); + + _.delay(function() { + menu.cmpEl.focus(); + }, 10); + this._fromShowContentControls = false; + }, + + onImageSelect: function(menu, item) { + if (item.value=='url') { + var me = this; + (new Common.Views.ImageFromUrlDialog({ + handler: function(result, value) { + if (result == 'ok') { + if (me.api) { + var checkUrl = value.replace(/ /g, ''); + if (!_.isEmpty(checkUrl)) { + me.setImageUrl(checkUrl); + } + } + } + } + })).show(); + } else if (item.value=='storage') { + Common.NotificationCenter.trigger('storage:image-load', 'control'); + } else { + if (this._isFromFile) return; + this._isFromFile = true; + this.api.asc_addImage(this.internalFormObj); + this._isFromFile = false; + } + }, + + openImageFromStorage: function(type) { + var me = this; + if (this.mode.canRequestInsertImage) { + Common.Gateway.requestInsertImage(type); + } else { + (new Common.Views.SelectFileDlg({ + fileChoiceUrl: this.mode.fileChoiceUrl.replace("{fileExt}", "").replace("{documentType}", "ImagesOnly") + })).on('selectfile', function(obj, file){ + file && (file.c = type); + !file.images && (file.images = [{fileType: file.fileType, url: file.url}]); // SelectFileDlg uses old format for inserting image + file.url = null; + me.insertImage(file); + }).show(); + } + }, + + setImageUrl: function(url, token) { + this.api.asc_SetContentControlPictureUrl(url, this.internalFormObj && this.internalFormObj.pr ? this.internalFormObj.pr.get_InternalId() : null, token); + }, + + insertImage: function(data) { // gateway + if (data && (data.url || data.images)) { + data.url && console.log("Obsolete: The 'url' parameter of the 'insertImage' method is deprecated. Please use 'images' parameter instead."); + + var arr = []; + if (data.images && data.images.length>0) { + for (var i=0; i', menu.id)); + cmpEl.append(menuContainer); + } + + menu.render(menuContainer); + menu.cmpEl.attr({tabindex: "-1"}); + menu.on('hide:after', function(){ + me.listControlMenu.removeAll(); + if (!me._fromShowContentControls) + me.api.asc_UncheckContentControlButtons(); + }); + } + if (specProps) { + if (isForm){ // for dropdown and combobox form control always add placeholder item + var text = props.get_PlaceholderText(); + menu.addItem(new Common.UI.MenuItem({ + caption : (text.trim()!=='') ? text : this.documentHolder.txtEmpty, + value : '', + template : _.template([ + ' opacity: 0.6 <% } %>">', + '<%= Common.Utils.String.htmlEncode(caption) %>', + '' + ].join('')) + })); + } + var count = specProps.get_ItemsCount(); + for (var i=0; i', + '<%= Common.Utils.String.htmlEncode(caption) %>', + '' + ].join('')) + })); + } + if (!isForm && menu.items.length<1) { + menu.addItem(new Common.UI.MenuItem({ + caption : this.documentHolder.txtEmpty, + value : -1 + })); + } + } + + menuContainer.css({left: x, top : y}); + menuContainer.attr('data-value', 'prevent-canvas-click'); + this._preventClick = true; + menu.show(); + + _.delay(function() { + menu.cmpEl.focus(); + }, 10); + this._fromShowContentControls = false; + }, + + onShowDateActions: function(obj, x, y) { + var props = obj.pr, + specProps = props.get_DateTimePr(), + cmpEl = this.documentHolder.cmpEl, + controlsContainer = cmpEl.find('#calendar-control-container'), + me = this; + + this._dateObj = props; + + if (controlsContainer.length < 1) { + controlsContainer = $('
'); + cmpEl.append(controlsContainer); + } + + Common.UI.Menu.Manager.hideAll(); + + controlsContainer.css({left: x, top : y}); + controlsContainer.show(); + + if (!this.cmpCalendar) { + this.cmpCalendar = new Common.UI.Calendar({ + el: cmpEl.find('#id-document-calendar-control'), + enableKeyEvents: true, + firstday: 1 + }); + this.cmpCalendar.on('date:click', function (cmp, date) { + var specProps = me._dateObj.get_DateTimePr(); + specProps.put_FullDate(new Date(date)); + me.api.asc_SetContentControlDatePickerDate(specProps); + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + }); + this.cmpCalendar.on('calendar:keydown', function (cmp, e) { + if (e.keyCode==Common.UI.Keys.ESC) { + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + } + }); + $(document).on('mousedown', function(e) { + if (e.target.localName !== 'canvas' && controlsContainer.is(':visible') && controlsContainer.find(e.target).length==0) { + controlsContainer.hide(); + me.api.asc_UncheckContentControlButtons(); + } + }); + + } + var val = specProps ? specProps.get_FullDate() : undefined; + this.cmpCalendar.setDate(val ? new Date(val) : new Date()); // align var offset = controlsContainer.offset(), diff --git a/apps/pdfeditor/main/app/controller/LeftMenu.js b/apps/pdfeditor/main/app/controller/LeftMenu.js index 845565e3cf..30ecc55e6b 100644 --- a/apps/pdfeditor/main/app/controller/LeftMenu.js +++ b/apps/pdfeditor/main/app/controller/LeftMenu.js @@ -200,7 +200,11 @@ define([ } /** coauthoring end **/ - this.leftMenu.setOptionsPanel('navigation', this.getApplication().getController('Navigation').getView('Navigation')); + if (this.mode.canUseViwerNavigation) { + this.leftMenu.setOptionsPanel('navigation', this.getApplication().getController('Navigation').getView('Navigation')); + } else { + this.leftMenu.btnNavigation.hide(); + } if (this.mode.canUseThumbnails) { this.leftMenu.setOptionsPanel('thumbnails', this.getApplication().getController('PageThumbnails').getView('PageThumbnails')); diff --git a/apps/pdfeditor/main/app/controller/Main.js b/apps/pdfeditor/main/app/controller/Main.js index 23c8263644..c7fe66af73 100644 --- a/apps/pdfeditor/main/app/controller/Main.js +++ b/apps/pdfeditor/main/app/controller/Main.js @@ -97,8 +97,10 @@ define([ }); this.translationTable = { + 'Your text here': this.txtArt, "Choose an item": this.txtChoose, - "Enter a date": this.txtEnterDate + "Enter a date": this.txtEnterDate, + "Click to load image": this.txtClickToLoad }; }, @@ -449,7 +451,9 @@ define([ docInfo.put_Lang(this.editorConfig.lang); docInfo.put_Mode(this.editorConfig.mode); - var enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); + var enable = !this.editorConfig.customization || (this.editorConfig.customization.macros!==false); + docInfo.asc_putIsEnabledMacroses(!!enable); + enable = !this.editorConfig.customization || (this.editorConfig.customization.plugins!==false); docInfo.asc_putIsEnabledPlugins(!!enable); // docInfo.put_Review(this.permissions.review); @@ -473,6 +477,7 @@ define([ this.api.asc_registerCallback('asc_onGetEditorPermissions', _.bind(this.onEditorPermissions, this)); this.api.asc_registerCallback('asc_onLicenseChanged', _.bind(this.onLicenseChanged, this)); + this.api.asc_registerCallback('asc_onRunAutostartMacroses', _.bind(this.onRunAutostartMacroses, this)); this.api.asc_setDocInfo(docInfo); this.api.asc_getEditorPermissions(this.editorConfig.licenseUrl, this.editorConfig.customerId); @@ -481,6 +486,12 @@ define([ } }, + onRunAutostartMacroses: function() { + if (!this.editorConfig.customization || (this.editorConfig.customization.macros!==false)) { + this.api.asc_runAutostartMacroses(); + } + }, + onProcessSaveResult: function(data) { this.api.asc_OnSaveEnd(data.result); if (data && data.result === false) { @@ -1000,8 +1011,8 @@ define([ documentHolderController.getView().on('editcomplete', _.bind(me.onEditComplete, me)); - if (me.appOptions.isEdit) { - if (me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true + if (me.appOptions.isEdit || me.appOptions.isRestrictedEdit) { + if (me.appOptions.isEdit && me.appOptions.canForcesave) {// use asc_setIsForceSaveOnUserSave only when customization->forcesave = true me.appOptions.forcesave = Common.localStorage.getBool("pdfe-settings-forcesave", me.appOptions.canForcesave); Common.Utils.InternalSettings.set("pdfe-settings-forcesave", me.appOptions.forcesave); me.api.asc_setIsForceSaveOnUserSave(me.appOptions.forcesave); @@ -1010,6 +1021,7 @@ define([ if (me.needToUpdateVersion) Common.NotificationCenter.trigger('api:disconnect'); + me.appOptions.isRestrictedEdit && me.api.asc_SetHighlightRequiredFields(true); var timer_sl = setTimeout(function(){ toolbarController.createDelayedElements(); @@ -1065,7 +1077,7 @@ define([ onLicenseChanged: function(params) { var licType = params.asc_getLicenseType(); - if (licType !== undefined && (this.appOptions.canPDFEdit) && this.editorConfig.mode !== 'view' && + if (licType !== undefined && (this.appOptions.canPDFEdit && this.editorConfig.mode !== 'view' || this.appOptions.isRestrictedEdit) && (licType===Asc.c_oLicenseResult.Connections || licType===Asc.c_oLicenseResult.UsersCount || licType===Asc.c_oLicenseResult.ConnectionsOS || licType===Asc.c_oLicenseResult.UsersCountOS || licType===Asc.c_oLicenseResult.SuccessLimit && (this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0)) this._state.licenseType = licType; @@ -1075,6 +1087,9 @@ define([ }, applyLicense: function() { + if (this.appOptions.isForm) + return this.applyLicenseForm(); + if (this.appOptions.canSwitchMode && (this.appOptions.canPDFAnnotate || this.appOptions.canPDFEdit) && !this.appOptions.isDesktopApp && !this.appOptions.canBrandingExt && this.editorConfig && this.editorConfig.customization && (this.editorConfig.customization.loaderName || this.editorConfig.customization.loaderLogo || @@ -1092,6 +1107,57 @@ define([ } }, + applyLicenseForm: function() { + if (!this.appOptions.isAnonymousSupport && !!this.appOptions.user.anonymous) { + this.api.asc_coAuthoringDisconnect(); + Common.NotificationCenter.trigger('api:disconnect'); + Common.UI.warning({ + title: this.notcriticalErrorTitle, + msg : this.warnLicenseAnonymous, + buttons: ['ok'] + }); + } else if (this._state.licenseType) { + var license = this._state.licenseType, + buttons = ['ok'], + primary = 'ok'; + if ((this.appOptions.trialMode & Asc.c_oLicenseMode.Limited) !== 0 && + (license===Asc.c_oLicenseResult.SuccessLimit || this.appOptions.permissionsLicense===Asc.c_oLicenseResult.SuccessLimit)) { + license = this.warnLicenseLimitedRenewed; + } else if (license===Asc.c_oLicenseResult.Connections || license===Asc.c_oLicenseResult.UsersCount) { + license = (license===Asc.c_oLicenseResult.Connections) ? this.warnLicenseExceeded : this.warnLicenseUsersExceeded; + } else { + license = (license===Asc.c_oLicenseResult.ConnectionsOS) ? this.warnNoLicense : this.warnNoLicenseUsers; + buttons = [{value: 'buynow', caption: this.textBuyNow}, {value: 'contact', caption: this.textContactUs}]; + primary = 'buynow'; + } + + if (this._state.licenseType!==Asc.c_oLicenseResult.SuccessLimit && this.appOptions.isRestrictedEdit) { + this.api.asc_coAuthoringDisconnect(); + Common.NotificationCenter.trigger('api:disconnect'); + } + + var value = Common.localStorage.getItem("pdfe-license-warning"); + value = (value!==null) ? parseInt(value) : 0; + var now = (new Date).getTime(); + if (now - value > 86400000) { + Common.UI.info({ + maxwidth: 500, + title: this.textNoLicenseTitle, + msg : license, + buttons: buttons, + primary: primary, + callback: function(btn) { + Common.localStorage.setItem("pdfe-license-warning", now); + if (btn == 'buynow') + window.open('{{PUBLISHER_URL}}', "_blank"); + else if (btn == 'contact') + window.open('mailto:{{SALES_EMAIL}}', "_blank"); + } + }); + } + } + }, + onOpenDocument: function(progress) { var elem = document.getElementById('loadmask-text'); var proc = (progress.asc_getCurrentFont() + progress.asc_getCurrentImage())/(progress.asc_getFontsCount() + progress.asc_getImagesCount()); @@ -1117,8 +1183,8 @@ define([ if (params.asc_getRights() !== Asc.c_oRights.Edit) this.permissions.edit = this.permissions.review = false; - var isXpsViewer = /^(?:(djvu|xps|oxps))$/.test(this.document.fileType) || Common.Locale.getDefaultLanguage() === 'ru'; - + this.appOptions.isXpsViewer = /^(?:(djvu|xps|oxps))$/.test(this.document.fileType) || Common.Locale.getDefaultLanguage() === 'ru'; + this.appOptions.isForm = !this.appOptions.isXpsViewer && !!this.document.isForm; this.appOptions.permissionsLicense = licType; this.appOptions.canAnalytics = params.asc_getIsAnalyticsEnable(); this.appOptions.canLicense = (licType === Asc.c_oLicenseResult.Success || licType === Asc.c_oLicenseResult.SuccessLimit); @@ -1127,18 +1193,18 @@ define([ this.appOptions.canCoAuthoring = !this.appOptions.isLightVersion; /** coauthoring end **/ this.appOptions.isOffline = this.api.asc_isOffline(); - this.appOptions.canCreateNew = this.appOptions.canCreateNew && !this.appOptions.isOffline; + this.appOptions.canCreateNew = this.appOptions.canCreateNew && !this.appOptions.isOffline && !this.isForm; this.appOptions.isCrypted = this.api.asc_isCrypto(); this.appOptions.canRequestEditRights = this.editorConfig.canRequestEditRights; - this.appOptions.canSwitchMode = !isXpsViewer && false; // switch between View/pdf comments/pdf edit - this.appOptions.canEdit = !isXpsViewer; - this.appOptions.isEdit = !isXpsViewer; + this.appOptions.canSwitchMode = !this.appOptions.isXpsViewer && !this.appOptions.isForm && false; // switch between View/pdf comments/pdf edit + this.appOptions.canEdit = !this.appOptions.isXpsViewer && !this.appOptions.isForm; + 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.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.canComments = !isXpsViewer; + 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) && (typeof (this.editorConfig.customization) == 'object') && this.editorConfig.customization.chat===false); @@ -1167,6 +1233,11 @@ define([ this.appOptions.isPasswordSupport = false;//this.appOptions.isEdit && this.api.asc_isProtectionSupport() && (this.permissions.protect!==false); 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; + // TODO: check view mode + this.appOptions.canFillForms = this.appOptions.canLicense && this.appOptions.isForm && ((this.permissions.fillForms===undefined) ? (this.permissions.edit !== false) : this.permissions.fillForms) && (this.editorConfig.mode !== 'view'); + this.appOptions.isAnonymousSupport = !!this.api.asc_isAnonymousSupport(); + this.appOptions.isRestrictedEdit = !this.appOptions.isEdit && this.appOptions.canFillForms; if ( !this.appOptions.canCoAuthoring ) { this.appOptions.canChat = false; @@ -1174,8 +1245,8 @@ define([ this.appOptions.canDownloadOrigin = false; this.appOptions.canDownload = this.permissions.download !== false; - this.appOptions.canUseSelectHandTools = isXpsViewer; - this.appOptions.canUseThumbnails = this.appOptions.canUseViwerNavigation = true; + this.appOptions.canUseSelectHandTools = this.appOptions.isXpsViewer; + this.appOptions.canUseThumbnails = this.appOptions.canUseViwerNavigation = !this.appOptions.isForm; this.appOptions.fileKey = this.document.key; @@ -1224,7 +1295,8 @@ define([ this.onLongActionBegin(Asc.c_oAscAsyncActionType.BlockInteraction, LoadingDocument); } - this.api.asc_setViewMode(!this.appOptions.isEdit); + this.api.asc_setViewMode(!this.appOptions.isEdit && !this.appOptions.isRestrictedEdit); + this.appOptions.isRestrictedEdit && this.api.asc_setRestriction(Asc.c_oAscRestrictionType.OnlyForms); this.api.asc_LoadDocument(); }, @@ -1328,9 +1400,9 @@ define([ onPdfModeApply: function() { if (!this.api) return; - this._state.fastCoauth = (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) ? Common.Utils.InternalSettings.get("pdfe-settings-coauthmode") : false; + this._state.fastCoauth = (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) ? Common.Utils.InternalSettings.get("pdfe-settings-coauthmode") : this.appOptions.isForm; this.api.asc_SetFastCollaborative(this._state.fastCoauth); - this.api.asc_setAutoSaveGap(this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit ? Common.Utils.InternalSettings.get("pdfe-settings-autosave") : 0); + this.api.asc_setAutoSaveGap(this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit ? Common.Utils.InternalSettings.get("pdfe-settings-autosave") : (this.appOptions.isForm ? 1 : 0)); if (this.appOptions.isPDFAnnotate || this.appOptions.isPDFEdit) { var value = Common.Utils.InternalSettings.get((this._state.fastCoauth) ? "pdfe-settings-showchanges-fast" : "pdfe-settings-showchanges-strict"); switch(value) { @@ -1340,7 +1412,8 @@ define([ default: value = (this._state.fastCoauth) ? Asc.c_oAscCollaborativeMarksShowType.None : Asc.c_oAscCollaborativeMarksShowType.LastChanges; } this.api.SetCollaborativeMarksShowType(value); - } + } else + this.api.SetCollaborativeMarksShowType(Asc.c_oAscCollaborativeMarksShowType.None); this.getApplication().getController('LeftMenu').leftMenu.getMenu('file').applyMode(); }, @@ -1597,6 +1670,10 @@ define([ config.msg = this.errorPasswordIsNotCorrect; break; + case Asc.c_oAscError.ID.TextFormWrongFormat: + config.msg = this.errorTextFormWrongFormat; + break; + case Asc.c_oAscError.ID.ConvertationOpenFormat: config.maxwidth = 600; if (errData === 'pdf') @@ -2456,7 +2533,9 @@ define([ txtValidPdfFormat: 'Field value should match format "{0}".', txtChoose: 'Choose an item', txtEnterDate: 'Enter a date', - errorEmailClient: 'No email client could be found' + errorEmailClient: 'No email client could be found', + errorTextFormWrongFormat: 'The value entered does not match the format of the field.', + txtArt: 'Your text here', } })(), PDFE.Controllers.Main || {})) }); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/controller/Toolbar.js b/apps/pdfeditor/main/app/controller/Toolbar.js index e478d1366c..8058084416 100644 --- a/apps/pdfeditor/main/app/controller/Toolbar.js +++ b/apps/pdfeditor/main/app/controller/Toolbar.js @@ -166,7 +166,6 @@ define([ var me = this; toolbar.btnPrint.on('click', _.bind(this.onPrint, this)); toolbar.btnPrint.on('disabled', _.bind(this.onBtnChangeState, this, 'print:disabled')); - toolbar.btnSave.on('click', _.bind(this.tryToSave, this)); toolbar.btnUndo.on('click', _.bind(this.onUndo, this)); toolbar.btnUndo.on('disabled', _.bind(this.onBtnChangeState, this, 'undo:disabled')); toolbar.btnRedo.on('click', _.bind(this.onRedo, this)); @@ -174,23 +173,6 @@ define([ toolbar.btnCopy.on('click', _.bind(this.onCopyPaste, this, 'copy')); toolbar.btnPaste.on('click', _.bind(this.onCopyPaste, this, 'paste')); toolbar.btnCut.on('click', _.bind(this.onCopyPaste, this, 'cut')); - toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this)); - toolbar.btnSelectTool.on('toggle', _.bind(this.onSelectTool, this, 'select')); - toolbar.btnHandTool.on('toggle', _.bind(this.onSelectTool, this, 'hand')); - toolbar.btnAddComment.on('click', function (btn, e) { - Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); - }); - toolbar.btnStrikeout.on('click', _.bind(this.onBtnStrikeout, this)); - toolbar.mnuStrikeoutColorPicker.on('select', _.bind(this.onSelectStrikeoutColor, this)); - toolbar.mnuStrikeoutTransparent.on('click', _.bind(this.onStrikeoutTransparentClick, this)); - toolbar.btnUnderline.on('click', _.bind(this.onBtnUnderline, this)); - toolbar.mnuUnderlineColorPicker.on('select', _.bind(this.onSelectUnderlineColor, this)); - toolbar.mnuUnderlineTransparent.on('click', _.bind(this.onUnderlineTransparentClick, this)); - toolbar.btnHighlight.on('click', _.bind(this.onBtnHighlight, this)); - toolbar.mnuHighlightColorPicker.on('select', _.bind(this.onSelectHighlightColor, this)); - toolbar.mnuHighlightTransparent.on('click', _.bind(this.onHighlightTransparentClick, this)); - toolbar.chShowComments.on('change', _.bind(this.onShowCommentsChange, this)); - // toolbar.btnRotate.on('click', _.bind(this.onRotateClick, this)); toolbar.fieldPages.on('changed:after', _.bind(this.onPagesChanged, this)); toolbar.fieldPages.on('inputleave', function(){ Common.NotificationCenter.trigger('edit:complete', me.toolbar);}); toolbar.fieldPages.cmpEl && toolbar.fieldPages.cmpEl.on('focus', 'input.form-control', function() { @@ -203,26 +185,90 @@ define([ this.onBtnChangeState('undo:disabled', toolbar.btnUndo, toolbar.btnUndo.isDisabled()); this.onBtnChangeState('redo:disabled', toolbar.btnRedo, toolbar.btnRedo.isDisabled()); - Common.NotificationCenter.on('leftmenu:save', _.bind(this.tryToSave, this)); - Common.NotificationCenter.on('draw:start', _.bind(this.onDrawStart, this)); + + if (this.mode && this.mode.isEdit) { + toolbar.btnSave.on('click', _.bind(this.tryToSave, this)); + toolbar.btnSelectAll.on('click', _.bind(this.onSelectAll, this)); + toolbar.btnSelectTool.on('toggle', _.bind(this.onSelectTool, this, 'select')); + toolbar.btnHandTool.on('toggle', _.bind(this.onSelectTool, this, 'hand')); + toolbar.btnAddComment.on('click', function (btn, e) { + Common.NotificationCenter.trigger('app:comment:add', 'toolbar'); + }); + toolbar.btnStrikeout.on('click', _.bind(this.onBtnStrikeout, this)); + toolbar.mnuStrikeoutColorPicker.on('select', _.bind(this.onSelectStrikeoutColor, this)); + toolbar.mnuStrikeoutTransparent.on('click', _.bind(this.onStrikeoutTransparentClick, this)); + toolbar.btnUnderline.on('click', _.bind(this.onBtnUnderline, this)); + toolbar.mnuUnderlineColorPicker.on('select', _.bind(this.onSelectUnderlineColor, this)); + toolbar.mnuUnderlineTransparent.on('click', _.bind(this.onUnderlineTransparentClick, this)); + toolbar.btnHighlight.on('click', _.bind(this.onBtnHighlight, this)); + toolbar.mnuHighlightColorPicker.on('select', _.bind(this.onSelectHighlightColor, this)); + toolbar.mnuHighlightTransparent.on('click', _.bind(this.onHighlightTransparentClick, this)); + toolbar.chShowComments.on('change', _.bind(this.onShowCommentsChange, this)); + // toolbar.btnRotate.on('click', _.bind(this.onRotateClick, this)); + Common.NotificationCenter.on('leftmenu:save', _.bind(this.tryToSave, this)); + Common.NotificationCenter.on('draw:start', _.bind(this.onDrawStart, this)); + } + if (this.mode && this.mode.isRestrictedEdit) { + toolbar.btnClear.on('click', _.bind(this.onClearClick, this)); + toolbar.btnPrevForm.on('click', _.bind(this.onGoToForm, this, 'prev')); + toolbar.btnNextForm.on('click', _.bind(this.onGoToForm, this, 'next')); + toolbar.btnSubmit && toolbar.btnSubmit.on('click', _.bind(this.onSubmitClick, this)); + toolbar.btnSaveForm && toolbar.btnSaveForm.on('click', _.bind(this.onSaveFormClick, this)); + if (toolbar.btnSubmit && !this.api.asc_IsAllRequiredFormsFilled()) { + toolbar.lockToolbar(Common.enumLock.requiredNotFilled, true, {array: [toolbar.btnSubmit]}); + if (!Common.localStorage.getItem("pdfe-embed-hide-submittip")) { + var requiredTooltip = new Common.UI.SynchronizeTip({ + extCls: 'colored', + placement: 'bottom-right', + target: toolbar.btnSubmit.$el, + text: this.textRequired, + showLink: false, + closable: false, + showButton: true, + textButton: this.textGotIt + }); + var onclose = function () { + requiredTooltip.hide(); + me.api && me.api.asc_MoveToFillingForm(true, true, true); + toolbar.btnSubmit.updateHint(me.textRequired); + }; + requiredTooltip.on('buttonclick', function () { + onclose(); + Common.localStorage.setItem("pdfe-embed-hide-submittip", 1); + }); + requiredTooltip.on('closeclick', onclose); + requiredTooltip.show(); + } else { + toolbar.btnSubmit.updateHint(me.textRequired); + } + } + } }, setApi: function(api) { this.api = api; - if (this.mode.isEdit) { - this.toolbar.setApi(api); - + if (this.mode.isEdit || this.mode.isRestrictedEdit) { this.api.asc_registerCallback('asc_onCanUndo', _.bind(this.onApiCanRevert, this, 'undo')); this.api.asc_registerCallback('asc_onCanRedo', _.bind(this.onApiCanRevert, this, 'redo')); - this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onZoomChange', _.bind(this.onApiZoomChange, this)); - this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); Common.NotificationCenter.on('api:disconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); + this.api.asc_registerCallback('asc_onCoAuthoringDisconnect', _.bind(this.onApiCoAuthoringDisconnect, this)); this.api.asc_registerCallback('asc_onCanCopyCut', _.bind(this.onApiCanCopyCut, this)); + } + + if (this.mode.isEdit) { + this.toolbar.setApi(api); + this.api.asc_registerCallback('asc_onFocusObject', _.bind(this.onApiFocusObject, this)); this.api.asc_registerCallback('asc_onContextMenu', _.bind(this.onContextMenu, this)); this.api.asc_registerCallback('asc_onMarkerFormatChanged', _.bind(this.onApiStartHighlight, this)); } + if (this.mode.isRestrictedEdit) { + this.api.asc_registerCallback('asc_onStartAction', _.bind(this.onLongActionBegin, this)); + this.api.asc_registerCallback('asc_onEndAction', _.bind(this.onLongActionEnd, this)); + this.api.asc_registerCallback('asc_onError', _.bind(this.onError, this)); + this.api.asc_registerCallback('sync_onAllRequiredFormsFilled', _.bind(this.onFillRequiredFields, this)); + } this.api.asc_registerCallback('asc_onCountPages', _.bind(this.onCountPages, this)); this.api.asc_registerCallback('asc_onCurrentPage', _.bind(this.onCurrentPage, this)); this.api.asc_registerCallback('asc_onDownloadUrl', _.bind(this.onDownloadUrl, this)); @@ -416,7 +462,7 @@ define([ return; this.api.asc_Save(); - toolbar.btnSave.setDisabled(!toolbar.mode.forcesave && !toolbar.mode.saveAlwaysEnabled); + toolbar.btnSave && toolbar.btnSave.setDisabled(!toolbar.mode.forcesave && !toolbar.mode.saveAlwaysEnabled); Common.component.Analytics.trackEvent('Save'); Common.component.Analytics.trackEvent('ToolBar', 'Save'); } @@ -439,17 +485,13 @@ define([ defFileName: defFileName }); me._saveCopyDlg.on('saveaserror', function(obj, err){ - var config = { + Common.UI.warning({ closable: false, - title: me.notcriticalErrorTitle, msg: err, - iconCls: 'warn', - buttons: ['ok'], callback: function(btn){ Common.NotificationCenter.trigger('edit:complete', me); } - }; - Common.UI.alert(config); + }); }).on('close', function(obj){ me._saveCopyDlg = undefined; }); @@ -695,13 +737,77 @@ define([ // this.api && this.api.asc_Rotate(); }, + onFillRequiredFields: function(isFilled) { + this.toolbar && this.toolbar.btnSubmit && this.toolbar.lockToolbar(Common.enumLock.requiredNotFilled, !isFilled, {array: [this.toolbar.btnSubmit]}); + }, + + onClearClick: function() { + this.api && this.api.asc_ClearAllSpecialForms(); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onGoToForm: function(type) { + this.api && this.api.asc_MoveToFillingForm(type=='next'); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onSubmitClick: function() { + this.api && this.api.asc_SendForm(); + Common.NotificationCenter.trigger('edit:complete', this.toolbar); + }, + + onSaveFormClick: function() { + if (this.api && this.mode && this.mode.canDownload) { + if (this.mode.isOffline) + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF)); + else { + this._state.isFromToolbarDownloadAs = this.mode.canRequestSaveAs || !!this.mode.saveAsUrl; + this.api.asc_DownloadAs(new Asc.asc_CDownloadOptions(Asc.c_oAscFileType.PDF, this._state.isFromToolbarDownloadAs)); + } + } + }, + + onLongActionBegin: function(type, id) { + if (id==Asc.c_oAscAsyncAction['Submit'] && this.toolbar.btnSubmit) { + this._submitFail = false; + this.submitedTooltip && this.submitedTooltip.hide(); + this.toolbar.lockToolbar(Common.enumLock.submit, true, {array: [this.toolbar.btnSubmit]}) + } + }, + + onLongActionEnd: function(type, id) { + if (id==Asc.c_oAscAsyncAction['Submit'] && this.toolbar.btnSubmit) { + this.toolbar.lockToolbar(Common.enumLock.submit, false, {array: [this.toolbar.btnSubmit]}) + if (!this.submitedTooltip) { + this.submitedTooltip = new Common.UI.SynchronizeTip({ + text: this.textSubmited, + extCls: 'no-arrow', + showLink: false, + target: $('.toolbar'), + placement: 'bottom' + }); + this.submitedTooltip.on('closeclick', function () { + this.submitedTooltip.hide(); + }, this); + } + !this._submitFail && this.submitedTooltip.show(); + } + }, + + onError: function(id, level, errData) { + if (id==Asc.c_oAscError.ID.Submit) { + this._submitFail = true; + this.submitedTooltip && this.submitedTooltip.hide(); + } + }, + activateControls: function() { this.toolbar.lockToolbar(Common.enumLock.disableOnStart, false); this.toolbar.lockToolbar(Common.enumLock.undoLock, this._state.can_undo!==true, {array: [this.toolbar.btnUndo]}); this.toolbar.lockToolbar(Common.enumLock.redoLock, this._state.can_redo!==true, {array: [this.toolbar.btnRedo]}); this.toolbar.lockToolbar(Common.enumLock.copyLock, this._state.can_copy!==true, {array: [this.toolbar.btnCopy]}); this.toolbar.lockToolbar(Common.enumLock.cutLock, this._state.can_cut!==true, {array: [this.toolbar.btnCut]}); - this.toolbar.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate && !this.mode.saveAlwaysEnabled); + this.toolbar.btnSave && this.toolbar.btnSave.setDisabled(!this.mode.isPDFEdit && !this.mode.isPDFAnnotate && !this.mode.saveAlwaysEnabled); this._state.activated = true; }, @@ -713,7 +819,7 @@ define([ }, onApiCoAuthoringDisconnect: function(enableDownload) { - this.mode.isEdit && this.toolbar.setMode({isDisconnected:true, enableDownload: !!enableDownload}); + (this.mode.isEdit || this.mode.isRestrictedEdit) && this.toolbar.setMode({isDisconnected:true, enableDownload: !!enableDownload}); this.editMode = false; this.DisableToolbar(true, true); }, @@ -750,8 +856,8 @@ define([ onAppShowed: function (config) { var me = this; - var compactview = !config.isEdit; - if ( config.isEdit) { + var compactview = !(config.isEdit || config.isRestrictedEdit); + if ( config.isEdit || config.isRestrictedEdit) { if ( Common.localStorage.itemExists("pdfe-compact-toolbar") ) { compactview = Common.localStorage.getBool("pdfe-compact-toolbar"); } else @@ -761,11 +867,8 @@ define([ me.toolbar.render(_.extend({isCompactView: compactview}, config)); - if ( config.isEdit ) { + if ( config.isEdit || config.isRestrictedEdit) { me.toolbar.setMode(config); - - me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); - if (!(config.customization && config.customization.compactHeader)) { // hide 'print' and 'save' buttons group and next separator me.toolbar.btnPrint.$el.parents('.group').hide().next().hide(); @@ -779,6 +882,9 @@ define([ me.toolbar.btnCopy.$el.removeClass('split'); me.toolbar.processPanelVisible(null, true, true); } + } + if ( config.isEdit ) { + me.toolbar.btnSave.on('disabled', _.bind(me.onBtnChangeState, me, 'save:disabled')); var drawtab = me.getApplication().getController('Common.Controllers.Draw'); drawtab.setApi(me.api).setMode(config); @@ -857,7 +963,10 @@ define([ txtDownload: 'Download', txtSaveCopy: 'Save copy', errorAccessDeny: 'You are trying to perform an action you do not have rights for.
Please contact your Document Server administrator.', - txtUntitled: 'Untitled' + txtUntitled: 'Untitled', + textRequired: 'Fill all required fields to send form.', + textGotIt: 'Got it', + textSubmited: 'Form submitted successfully
Click to close the tip.' }, PDFE.Controllers.Toolbar || {})); }); diff --git a/apps/pdfeditor/main/app/controller/ViewTab.js b/apps/pdfeditor/main/app/controller/ViewTab.js index 4c0309c671..ce0396ce1a 100644 --- a/apps/pdfeditor/main/app/controller/ViewTab.js +++ b/apps/pdfeditor/main/app/controller/ViewTab.js @@ -159,10 +159,14 @@ define([ .on('combo:blur', _.bind(me.onComboBlur, me, false)); }); - me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) { - if (state !== me.view.btnNavigation.pressed) - me.view.turnNavigation(state); - }); + if (me.view.btnNavigation) { + me.getApplication().getController('LeftMenu').leftMenu.btnNavigation.on('toggle', function (btn, state) { + if (state !== me.view.btnNavigation.pressed) + me.view.turnNavigation(state); + }); + } else { + me.view.$el.find('.separator-navigation').hide().prev('.group').hide(); + } if (Common.UI.Themes.available()) { function _fill_themes() { diff --git a/apps/pdfeditor/main/app/controller/Viewport.js b/apps/pdfeditor/main/app/controller/Viewport.js index 3a93767a54..577f47c6b0 100644 --- a/apps/pdfeditor/main/app/controller/Viewport.js +++ b/apps/pdfeditor/main/app/controller/Viewport.js @@ -77,7 +77,7 @@ define([ 'render:before' : function (toolbar) { var config = PDFE.getController('Main').appOptions; toolbar.setExtra('right', me.header.getPanel('right', config)); - if (!config.isEdit || config.customization && !!config.customization.compactHeader) + if (!config.isEdit && !config.isRestrictedEdit || config.customization && !!config.customization.compactHeader) toolbar.setExtra('left', me.header.getPanel('left', config)); var value = Common.localStorage.getBool("pdfe-settings-quick-print-button", true); @@ -174,7 +174,7 @@ define([ me.viewport.$el.attr('applang', me.appConfig.lang.split(/[\-_]/)[0]); - if ( !config.isEdit || ( !Common.localStorage.itemExists("pdfe-compact-toolbar") && + if ( !(config.isEdit || config.isRestrictedEdit) || ( !Common.localStorage.itemExists("pdfe-compact-toolbar") && config.customization && config.customization.compactToolbar )) { var panel = me.viewport.vlayout.getItem('toolbar'); if ( panel ) panel.height = _intvars.get('toolbar-height-tabs'); @@ -188,7 +188,7 @@ define([ me.viewport.vlayout.getItem('toolbar').el.addClass('style-skip-docname'); } - if ( config.isEdit && !(config.customization && config.customization.compactHeader)) { + if ( (config.isEdit || config.isRestrictedEdit) && !(config.customization && config.customization.compactHeader)) { var $title = me.viewport.vlayout.getItem('title').el; $title.html(me.header.getPanel('title', config)).show(); $title.find('.extra').html(me.header.getPanel('left', config)); diff --git a/apps/pdfeditor/main/app/template/Toolbar.template b/apps/pdfeditor/main/app/template/Toolbar.template index 3160cdc472..cd32b37e81 100644 --- a/apps/pdfeditor/main/app/template/Toolbar.template +++ b/apps/pdfeditor/main/app/template/Toolbar.template @@ -34,14 +34,29 @@
+ <% if ( typeof config !== "undefined" && config.isEdit) { %>
+ <% } %>
+ <% if ( typeof config !== "undefined" && config.isRestrictedEdit) { %> +
+ + + +
+
+
+ + +
+
+ <% } %>
diff --git a/apps/pdfeditor/main/app/view/DocumentHolder.js b/apps/pdfeditor/main/app/view/DocumentHolder.js index 993e1198f9..f09b94b01f 100644 --- a/apps/pdfeditor/main/app/view/DocumentHolder.js +++ b/apps/pdfeditor/main/app/view/DocumentHolder.js @@ -258,7 +258,10 @@ define([ textCopy: 'Copy', addCommentText: 'Add Comment', - txtWarnUrl: 'Clicking this link can be harmful to your device and data.
Are you sure you want to continue?' + txtWarnUrl: 'Clicking this link can be harmful to your device and data.
Are you sure you want to continue?', + mniImageFromFile: 'Image from File', + mniImageFromUrl: 'Image from URL', + mniImageFromStorage: 'Image from Storage', }, PDFE.Views.DocumentHolder || {})); }); \ No newline at end of file diff --git a/apps/pdfeditor/main/app/view/FileMenuPanels.js b/apps/pdfeditor/main/app/view/FileMenuPanels.js index 31645ece31..386ea3de7b 100644 --- a/apps/pdfeditor/main/app/view/FileMenuPanels.js +++ b/apps/pdfeditor/main/app/view/FileMenuPanels.js @@ -658,10 +658,10 @@ define([ this.chAutosave.setCaption(this.textAutoRecover); } /** coauthoring begin **/ - $('tr.collaboration', this.el)[mode.canCoAuthoring || mode.canViewReview ? 'show' : 'hide'](); + $('tr.collaboration', this.el)[mode.canCoAuthoring && !mode.isForm || mode.canViewReview ? 'show' : 'hide'](); $('tr.coauth.changes-mode', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && mode.canChangeCoAuthoring && canPDFSave ? 'show' : 'hide'](); $('tr.coauth.changes-show', this.el)[mode.isEdit && !mode.isOffline && mode.canCoAuthoring && canPDFSave ? 'show' : 'hide'](); - $('tr.comments', this.el)[mode.canCoAuthoring ? 'show' : 'hide'](); + $('tr.comments', this.el)[mode.canCoAuthoring && !mode.isForm ? 'show' : 'hide'](); $('tr.ui-rtl', this.el)[mode.uiRtl ? 'show' : 'hide'](); /** coauthoring end **/ diff --git a/apps/pdfeditor/main/app/view/LeftMenu.js b/apps/pdfeditor/main/app/view/LeftMenu.js index 21f545e52e..500a6f6362 100644 --- a/apps/pdfeditor/main/app/view/LeftMenu.js +++ b/apps/pdfeditor/main/app/view/LeftMenu.js @@ -395,6 +395,7 @@ define([ this.mode = mode; this.btnAbout.panel.setMode(mode); mode.canUseThumbnails && this.btnThumbnails.show(); + mode.canUseViwerNavigation && this.btnNavigation.show(); return this; }, diff --git a/apps/pdfeditor/main/app/view/Toolbar.js b/apps/pdfeditor/main/app/view/Toolbar.js index d5415eba39..2337fe6e13 100644 --- a/apps/pdfeditor/main/app/view/Toolbar.js +++ b/apps/pdfeditor/main/app/view/Toolbar.js @@ -77,7 +77,9 @@ define([ lostConnect: 'disconnect', disableOnStart: 'on-start', firstPage: 'first-page', - lastPage: 'last-page' + lastPage: 'last-page', + requiredNotFilled: 'required-not-filled', + submit: 'submit' }; for (var key in enumLock) { if (enumLock.hasOwnProperty(key)) { @@ -126,28 +128,13 @@ define([ {caption: me.textTabFile, action: 'file', extcls: 'canedit', layoutname: 'toolbar-file', haspanel:false, dataHintTitle: 'F'}, {caption: me.textTabHome, action: 'home', extcls: 'canedit', dataHintTitle: 'H'}, {caption: me.textTabComment, action: 'comment', extcls: 'canedit', dataHintTitle: 'C'} - ] + ], + config: config } ); this.btnSaveCls = 'btn-save'; this.btnSaveTip = this.tipSave;// + Common.Utils.String.platformKey('Ctrl+S'); - - this.btnPrint = new Common.UI.Button({ - id: 'id-toolbar-btn-print', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-print no-mask', - lock: [_set.cantPrint, _set.disableOnStart], - signals: ['disabled'], - split: config.canQuickPrint, - menu: config.canQuickPrint, - dataHint: '1', - dataHintDirection: 'bottom', - dataHintTitle: 'P', - printType: 'print' - }); - this.toolbarControls.push(this.btnPrint); - this.btnSave = new Common.UI.Button({ id: 'id-toolbar-btn-save', cls: 'btn-toolbar', @@ -161,73 +148,6 @@ define([ this.toolbarControls.push(this.btnSave); this.btnCollabChanges = this.btnSave; - this.btnUndo = new Common.UI.Button({ - id: 'id-toolbar-btn-undo', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-undo', - lock: [_set.undoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView], - signals: ['disabled'], - dataHint: '1', - dataHintDirection: 'bottom', - dataHintTitle: 'Z' - }); - this.toolbarControls.push(this.btnUndo); - - this.btnRedo = new Common.UI.Button({ - id: 'id-toolbar-btn-redo', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-redo', - lock: [_set.redoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView], - signals: ['disabled'], - dataHint: '1', - dataHintDirection: 'bottom', - dataHintTitle: 'Y' - }); - this.toolbarControls.push(this.btnRedo); - - this.btnCopy = new Common.UI.Button({ - id: 'id-toolbar-btn-copy', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-copy', - lock: [_set.copyLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], - dataHint: '1', - dataHintDirection: 'top', - dataHintTitle: 'C' - }); - this.toolbarControls.push(this.btnCopy); - - this.btnPaste = new Common.UI.Button({ - id: 'id-toolbar-btn-paste', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-paste', - lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], - dataHint: '1', - dataHintDirection: 'top', - dataHintTitle: 'V' - }); - this.paragraphControls.push(this.btnPaste); - - this.btnCut = new Common.UI.Button({ - id: 'id-toolbar-btn-cut', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-cut', - lock: [_set.cutLock, _set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.imageLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], - dataHint: '1', - dataHintDirection: 'top', - dataHintTitle: 'X' - }); - this.paragraphControls.push(this.btnCut); - - this.btnSelectAll = new Common.UI.Button({ - id: 'id-toolbar-btn-select-all', - cls: 'btn-toolbar', - iconCls: 'toolbar__icon btn-select-all', - lock: [_set.viewFormMode, _set.disableOnStart], - dataHint: '1', - dataHintDirection: 'bottom' - }); - this.toolbarControls.push(this.btnSelectAll); - this.btnSelectTool = new Common.UI.Button({ id: 'tlbtn-selecttool', cls: 'btn-toolbar x-huge icon-top', @@ -346,6 +266,163 @@ define([ }); this.paragraphControls.push(this.btnHighlight); + } else if ( config.isRestrictedEdit ) { + Common.UI.Mixtbar.prototype.initialize.call(this, { + template: _.template(template), + tabs: [ + {caption: me.textTabFile, action: 'file', extcls: 'canedit', layoutname: 'toolbar-file', haspanel:false, dataHintTitle: 'F'}, + {caption: me.textTabHome, action: 'home', extcls: 'canedit', dataHintTitle: 'H'} + ], + config: config + } + ); + + this.btnClear = new Common.UI.Button({ + id: 'id-toolbar-btn-clear', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-clear-style', + lock: [_set.disableOnStart], + caption: this.textClear, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.toolbarControls.push(this.btnClear); + + this.btnPrevForm = new Common.UI.Button({ + id: 'id-toolbar-btn-prev', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-previous-field', + lock: [_set.disableOnStart], + caption: this.capBtnPrev, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.toolbarControls.push(this.btnPrevForm); + + this.btnNextForm = new Common.UI.Button({ + id: 'id-toolbar-btn-next', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-next-field', + lock: [_set.disableOnStart], + caption: this.capBtnNext, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.toolbarControls.push(this.btnNextForm); + + if (config.canSubmitForms) { + this.btnSubmit = new Common.UI.Button({ + id: 'id-toolbar-btn-submit', + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-submit-form', + lock: [_set.lostConnect, _set.disableOnStart, _set.requiredNotFilled, _set.submit], + caption: this.capBtnSubmit, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.toolbarControls.push(this.btnSubmit); + } else if (config.canDownload) { + this.btnSaveForm = new Common.UI.Button({ + id: 'id-toolbar-btn-download-form', + cls: 'btn-toolbar x-huge icon-top', + lock: [_set.lostConnect, _set.disableOnStart], + iconCls: 'toolbar__icon btn-save-form', + caption: config.canRequestSaveAs || !!config.saveAsUrl ? this.capBtnSaveForm : (config.isOffline ? this.capBtnSaveFormDesktop : this.capBtnDownloadForm), + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.toolbarControls.push(this.btnSaveForm); + } + } + + if ( config.isEdit || config.isRestrictedEdit) { + this.btnPrint = new Common.UI.Button({ + id: 'id-toolbar-btn-print', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-print no-mask', + lock: [_set.cantPrint, _set.disableOnStart], + signals: ['disabled'], + split: config.canQuickPrint, + menu: config.canQuickPrint, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintTitle: 'P', + printType: 'print' + }); + this.toolbarControls.push(this.btnPrint); + + this.btnUndo = new Common.UI.Button({ + id: 'id-toolbar-btn-undo', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-undo', + lock: [_set.undoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView], + signals: ['disabled'], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintTitle: 'Z' + }); + this.toolbarControls.push(this.btnUndo); + + this.btnRedo = new Common.UI.Button({ + id: 'id-toolbar-btn-redo', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-redo', + lock: [_set.redoLock, _set.previewReviewMode, _set.lostConnect, _set.disableOnStart, _set.docLockView], + signals: ['disabled'], + dataHint: '1', + dataHintDirection: 'bottom', + dataHintTitle: 'Y' + }); + this.toolbarControls.push(this.btnRedo); + + this.btnCopy = new Common.UI.Button({ + id: 'id-toolbar-btn-copy', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-copy', + lock: [_set.copyLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'top', + dataHintTitle: 'C' + }); + this.toolbarControls.push(this.btnCopy); + + this.btnPaste = new Common.UI.Button({ + id: 'id-toolbar-btn-paste', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-paste', + lock: [_set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], + dataHint: '1', + dataHintDirection: 'top', + dataHintTitle: 'V' + }); + this.paragraphControls.push(this.btnPaste); + + this.btnCut = new Common.UI.Button({ + id: 'id-toolbar-btn-cut', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-cut', + lock: [_set.cutLock, _set.paragraphLock, _set.headerLock, _set.richEditLock, _set.plainEditLock, _set.imageLock, _set.previewReviewMode, _set.viewFormMode, _set.lostConnect, _set.disableOnStart, _set.docLockView, _set.docLockComments], + dataHint: '1', + dataHintDirection: 'top', + dataHintTitle: 'X' + }); + this.paragraphControls.push(this.btnCut); + + this.btnSelectAll = new Common.UI.Button({ + id: 'id-toolbar-btn-select-all', + cls: 'btn-toolbar', + iconCls: 'toolbar__icon btn-select-all', + lock: [_set.viewFormMode, _set.disableOnStart], + dataHint: '1', + dataHintDirection: 'bottom' + }); + this.toolbarControls.push(this.btnSelectAll); + this.fieldPages = new Common.UI.InputFieldFixed({ id: 'id-toolbar-txt-pages', style : 'width: 100%;', @@ -438,7 +515,7 @@ define([ this.fireEvent('render:before', [this]); me.isCompactView = mode.isCompactView; - if ( mode.isEdit ) { + if ( mode.isEdit || mode.isRestrictedEdit) { me.$el.html(me.rendererComponents(me.$layout)); } else { me.$layout.find('.canedit').hide(); @@ -460,9 +537,8 @@ define([ this.showSynchTip = !Common.localStorage.getBool("de-hide-synch"); this.needShowSynchTip = false; /** coauthoring end **/ - - me.setTab('home'); } + (mode.isEdit || mode.isRestrictedEdit) && me.setTab('home'); if ( me.isCompactView ) me.setFolded(true); @@ -516,6 +592,11 @@ define([ _injectComponent('#slot-btn-prev-page', this.btnPrevPage); _injectComponent('#slot-btn-next-page', this.btnNextPage); _injectComponent('#slot-chk-showcomment', this.chShowComments); + _injectComponent('#slot-btn-form-clear', this.btnClear); + _injectComponent('#slot-btn-form-prev', this.btnPrevForm); + _injectComponent('#slot-btn-form-next', this.btnNextForm); + _injectComponent('#slot-btn-form-submit', this.btnSubmit); + _injectComponent('#slot-btn-form-save', this.btnSaveForm); this.btnPrint.menu && this.btnPrint.$el.addClass('split'); return $host; @@ -571,7 +652,7 @@ define([ (new Promise( function(resolve, reject) { resolve(); })).then(function () { - if ( !config.isEdit ) return; + if ( !config.isEdit && !config.isRestrictedEdit) return; if(me.btnPrint.menu){ me.btnPrint.setMenu( @@ -596,17 +677,17 @@ define([ ] })); } - if (me.btnStrikeout.menu) { + if (me.btnStrikeout && me.btnStrikeout.menu) { var arr = me.createPen(me.btnStrikeout, 'strikeout'); me.mnuStrikeoutColorPicker = arr[0]; me.mnuStrikeoutTransparent = arr[1]; } - if (me.btnUnderline.menu) { + if (me.btnUnderline && me.btnUnderline.menu) { var arr = me.createPen(me.btnUnderline, 'underline'); me.mnuUnderlineColorPicker = arr[0]; me.mnuUnderlineTransparent = arr[1]; } - if (me.btnHighlight.menu) { + if (me.btnHighlight && me.btnHighlight.menu) { var arr = me.createPen(me.btnHighlight, 'highlight'); me.mnuHighlightColorPicker = arr[0]; me.mnuHighlightTransparent = arr[1]; @@ -620,21 +701,30 @@ define([ } // set hints + if (this.mode.isEdit) { + this.btnSave.updateHint(this.btnSaveTip); + this.btnSelectTool.updateHint(this.tipSelectTool); + this.btnHandTool.updateHint(this.tipHandTool); + this.btnAddComment.updateHint(this.tipAddComment); + this.btnStrikeout.updateHint(this.textStrikeout); + this.btnUnderline.updateHint(this.textUnderline); + this.btnHighlight.updateHint(this.textHighlight); + // this.btnRotate.updateHint(this.tipRotate); + + } else if (this.mode.isRestrictedEdit) { + this.btnClear.updateHint(this.textClearFields); + this.btnPrevForm.updateHint(this.tipPrevForm); + this.btnNextForm.updateHint(this.tipNextForm); + this.btnSubmit && this.btnSubmit.updateHint(this.tipSubmit); + this.btnSaveForm && this.btnSaveForm.updateHint(this.mode.canRequestSaveAs || !!this.mode.saveAsUrl ? this.tipSaveForm : this.tipDownloadForm); + } this.btnPrint.updateHint(this.tipPrint + Common.Utils.String.platformKey('Ctrl+P')); - this.btnSave.updateHint(this.btnSaveTip); this.btnUndo.updateHint(this.tipUndo + Common.Utils.String.platformKey('Ctrl+Z')); this.btnRedo.updateHint(this.tipRedo + Common.Utils.String.platformKey('Ctrl+Y')); this.btnCopy.updateHint(this.tipCopy + Common.Utils.String.platformKey('Ctrl+C')); this.btnPaste.updateHint(this.tipPaste + Common.Utils.String.platformKey('Ctrl+V')); this.btnCut.updateHint(this.tipCut + Common.Utils.String.platformKey('Ctrl+X')); this.btnSelectAll.updateHint(this.tipSelectAll + Common.Utils.String.platformKey('Ctrl+A')); - this.btnSelectTool.updateHint(this.tipSelectTool); - this.btnHandTool.updateHint(this.tipHandTool); - this.btnAddComment.updateHint(this.tipAddComment); - this.btnStrikeout.updateHint(this.textStrikeout); - this.btnUnderline.updateHint(this.textUnderline); - this.btnHighlight.updateHint(this.textHighlight); - // this.btnRotate.updateHint(this.tipRotate); this.btnFirstPage.updateHint(this.tipFirstPage); this.btnLastPage.updateHint(this.tipLastPage); this.btnPrevPage.updateHint(this.tipPrevPage); @@ -786,7 +876,21 @@ define([ tipLastPage: 'Go to the last page', tipPrevPage: 'Go to the previous page', tipNextPage: 'Go to the next page', - capBtnShowComments: 'Show Comments' + capBtnShowComments: 'Show Comments', + textClearFields: 'Clear All Fields', + textClear: 'Clear Fields', + capBtnPrev: 'Previous Field', + capBtnNext: 'Next Field', + capBtnSubmit: 'Submit', + tipPrevForm: 'Go to the previous field', + tipNextForm: 'Go to the next field', + tipSubmit: 'Submit form', + textSubmited: 'Form submitted successfully', + capBtnSaveForm: 'Save as pdf', + capBtnSaveFormDesktop: 'Save as...', + tipSaveForm: 'Save a file as a fillable PDF', + capBtnDownloadForm: 'Download as pdf', + tipDownloadForm: 'Download a file as a fillable PDF', } })(), PDFE.Views.Toolbar || {})); }); diff --git a/apps/pdfeditor/main/app/view/ViewTab.js b/apps/pdfeditor/main/app/view/ViewTab.js index b938ea84a3..788660d859 100644 --- a/apps/pdfeditor/main/app/view/ViewTab.js +++ b/apps/pdfeditor/main/app/view/ViewTab.js @@ -50,7 +50,7 @@ define([ '
' + '' + '
' + - '
' + + '
' + '
' + '
' + '' + @@ -95,7 +95,7 @@ define([ setEvents: function () { var me = this; - me.btnNavigation.on('click', function (btn, e) { + me.btnNavigation && me.btnNavigation.on('click', function (btn, e) { me.fireEvent('viewtab:navigation', [btn.pressed]); }); me.btnsFitToPage.forEach(function (btn) { @@ -137,17 +137,19 @@ define([ var me = this; var _set = Common.enumLock; - this.btnNavigation = new Common.UI.Button({ - cls: 'btn-toolbar x-huge icon-top', - iconCls: 'toolbar__icon btn-big-menu-navigation', - lock: [_set.lostConnect, _set.disableOnStart], - caption: this.textOutline, - enableToggle: true, - dataHint: '1', - dataHintDirection: 'bottom', - dataHintOffset: 'small' - }); - this.lockedControls.push(this.btnNavigation); + if (!this.appConfig.isForm) { + this.btnNavigation = new Common.UI.Button({ + cls: 'btn-toolbar x-huge icon-top', + iconCls: 'toolbar__icon btn-big-menu-navigation', + lock: [_set.lostConnect, _set.disableOnStart], + caption: this.textOutline, + enableToggle: true, + dataHint: '1', + dataHintDirection: 'bottom', + dataHintOffset: 'small' + }); + this.lockedControls.push(this.btnNavigation); + } this.cmbsZoom = [this.getZoomCombo()]; @@ -268,7 +270,7 @@ define([ this.$el = $(_.template(template)( {} )); var $host = this.$el; - this.btnNavigation.render($host.find('#slot-btn-navigation')); + this.btnNavigation && this.btnNavigation.render($host.find('#slot-btn-navigation')); this.cmbsZoom[0].render($host.find('.slot-field-zoom')); $host.find('.slot-lbl-zoom').text(this.textZoom); this.btnsFitToPage[0].render($host.find('.slot-btn-ftp')); @@ -298,7 +300,7 @@ define([ onAppReady: function () { var me = this; - this.btnNavigation.updateHint(this.tipHeadings); + this.btnNavigation && this.btnNavigation.updateHint(this.tipHeadings); this.btnInterfaceTheme.updateHint(this.tipInterfaceTheme); this.btnDarkDocument.updateHint(this.tipDarkDocument); this.btnsFitToPage.forEach(function (btn) { diff --git a/apps/pdfeditor/main/index.html b/apps/pdfeditor/main/index.html index 56e5c50f20..1bbe2930a8 100644 --- a/apps/pdfeditor/main/index.html +++ b/apps/pdfeditor/main/index.html @@ -314,7 +314,6 @@ document.querySelectorAll('.compact').forEach(function(item){ item.style.display = 'inline-block'; }); - document.querySelector('.fat').style.left = '655px'; } visible && (document.querySelector('.brendpanel').style.display = 'block'); diff --git a/apps/pdfeditor/main/index.html.deploy b/apps/pdfeditor/main/index.html.deploy index f81036a13e..dab5568389 100644 --- a/apps/pdfeditor/main/index.html.deploy +++ b/apps/pdfeditor/main/index.html.deploy @@ -278,7 +278,6 @@ document.querySelectorAll('.compact').forEach(function(item){ item.style.display = 'inline-block'; }); - document.querySelector('.fat').style.left = '655px'; } visible && (document.querySelector('.brendpanel').style.display = 'block');