From 23a49167f10e0a6a49431cb177e868fb3c8d3808 Mon Sep 17 00:00:00 2001 From: Julia Radzhabova Date: Tue, 3 Apr 2018 13:22:24 +0300 Subject: [PATCH] [PE][SSE] Change interface for creating hyperlinks. --- .../main/app/view/HyperlinkSettingsDialog.js | 7 +- .../main/app/view/HyperlinkSettingsDialog.js | 60 ++++++++------- apps/presentationeditor/main/locale/en.json | 2 +- .../main/app/view/HyperlinkSettingsDialog.js | 76 +++++++++++-------- apps/spreadsheeteditor/main/locale/en.json | 2 +- 5 files changed, 78 insertions(+), 69 deletions(-) diff --git a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js index cb1073a77..739f09689 100644 --- a/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/documenteditor/main/app/view/HyperlinkSettingsDialog.js @@ -98,7 +98,6 @@ define([ this.options.tpl = _.template(this.template)(this.options); this.api = this.options.api; this._originalProps = null; - this.linkType = c_oHyperlinkType.WebLink; Common.UI.Window.prototype.initialize.call(this, this.options); }, @@ -257,8 +256,6 @@ define([ } else this.btnOk.setDisabled(false); - - this.linkType = value; }, onLinkTypeClick: function(type, btn, event) { @@ -329,7 +326,7 @@ define([ props = new Asc.CHyperlinkProperty(), display = ''; - if (this.linkType == c_oHyperlinkType.WebLink) { + if (this.btnExternal.isActive()) {//WebLink var url = $.trim(me.inputUrl.getValue()); if (! /(((^https?)|(^ftp)):\/\/)|(^mailto:)/i.test(url) ) @@ -380,7 +377,7 @@ define([ _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { - if (this.linkType == c_oHyperlinkType.WebLink) { + if (this.btnExternal.isActive()) {//WebLink if (this.inputUrl.checkValidate() !== true) { this.inputUrl.cmpEl.find('input').focus(); return; diff --git a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js index 31cbe3712..796a8e1c9 100644 --- a/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/presentationeditor/main/app/view/HyperlinkSettingsDialog.js @@ -69,14 +69,14 @@ define([ }, options || {}); this.template = [ - '
', - '
', - '', + '
', + '
', + '', + '', '
', - '', '', @@ -89,11 +89,11 @@ define([ '', '
', '
', - '', + '', '
', '', '
', - '', + '', '
', '', '
', @@ -116,23 +116,22 @@ define([ var me = this, $window = this.getChild(); - me._arrTypeSrc = [ - {displayValue: me.textInternalLink, value: c_oHyperlinkType.InternalLink}, - {displayValue: me.textExternalLink, value: c_oHyperlinkType.WebLink} - ]; - - me.cmbLinkType = new Common.UI.ComboBox({ - el: $('#id-dlg-hyperlink-type'), - cls: 'input-group-nr', - style: 'width: 100%;', - menuStyle: 'min-width: 318px;', - editable: false, - data: this._arrTypeSrc + me.btnExternal = new Common.UI.Button({ + el: $('#id-dlg-hyperlink-external'), + enableToggle: true, + toggleGroup: 'hyperlink-type', + allowDepress: false, + pressed: true }); - me.cmbLinkType.setValue(me._arrTypeSrc[1].value); - me.cmbLinkType.on('selected', _.bind(function(combo, record) { - this.ShowHideElem(record.value); - }, me)); + me.btnExternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.WebLink)); + + me.btnInternal = new Common.UI.Button({ + el: $('#id-dlg-hyperlink-internal'), + enableToggle: true, + toggleGroup: 'hyperlink-type', + allowDepress: false + }); + me.btnInternal.on('click', _.bind(me.onLinkTypeClick, me, c_oHyperlinkType.InternalLink)); me.inputUrl = new Common.UI.InputField({ el : $('#id-dlg-hyperlink-url'), @@ -217,7 +216,7 @@ define([ var me = this; var type = me.parseUrl(props.get_Value()); - me.cmbLinkType.setValue(type); + (type == c_oHyperlinkType.WebLink) ? me.btnExternal.toggle(true) : me.btnInternal.toggle(true); me.ShowHideElem(type); if (props.get_Text()!==null) { @@ -239,7 +238,7 @@ define([ var me = this, props = new Asc.CHyperlinkProperty(); var def_display = ''; - if (me.cmbLinkType.getValue() == c_oHyperlinkType.InternalLink) { + if (this.btnInternal.isActive()) {//InternalLink var url = "ppaction://hlink"; var tip = ''; var txttip = me.inputTip.getValue(); @@ -298,7 +297,7 @@ define([ _handleInput: function(state) { if (this.options.handler) { if (state == 'ok') { - var checkurl = (this.cmbLinkType.getValue() == c_oHyperlinkType.WebLink) ? this.inputUrl.checkValidate() : true, + var checkurl = (this.btnExternal.isActive()) ? this.inputUrl.checkValidate() : true, checkdisp = this.inputDisplay.checkValidate(); if (checkurl !== true) { this.inputUrl.cmpEl.find('input').focus(); @@ -321,6 +320,10 @@ define([ this.internalPanel.toggleClass('hidden', value !== c_oHyperlinkType.InternalLink); }, + onLinkTypeClick: function(type, btn, event) { + this.ShowHideElem(type); + }, + parseUrl: function(url) { if (url===null || url===undefined || url=='' ) return c_oHyperlinkType.WebLink; @@ -364,13 +367,12 @@ define([ }, textTitle: 'Hyperlink Settings', - textInternalLink: 'Place In This Document', - textExternalLink: 'File or Web Page', + textInternalLink: 'Slide In This Presentation', + textExternalLink: 'External Link', textEmptyLink: 'Enter link here', textEmptyDesc: 'Enter caption here', textEmptyTooltip: 'Enter tooltip here', txtSlide: 'Slide', - textLinkType: 'Link Type', strDisplay: 'Display', textTipText: 'Screen Tip Text', strLinkTo: 'Link To', diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index a60255b37..6aba18f05 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -980,7 +980,7 @@ "PE.Views.HyperlinkSettingsDialog.textEmptyTooltip": "Enter tooltip here", "PE.Views.HyperlinkSettingsDialog.textExternalLink": "External Link", "PE.Views.HyperlinkSettingsDialog.textInternalLink": "Slide In This Presentation", - "PE.Views.HyperlinkSettingsDialog.textLinkType": "Link Type", + "del_PE.Views.HyperlinkSettingsDialog.textLinkType": "Link Type", "PE.Views.HyperlinkSettingsDialog.textTipText": "ScreenTip Text", "PE.Views.HyperlinkSettingsDialog.textTitle": "Hyperlink Settings", "PE.Views.HyperlinkSettingsDialog.txtEmpty": "This field is required", diff --git a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js index 4dd36c427..8fb87634e 100644 --- a/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js +++ b/apps/spreadsheeteditor/main/app/view/HyperlinkSettingsDialog.js @@ -63,18 +63,17 @@ define([ this.template = [ '
', - '
', - '', + '
', + '', + '', '
', - '', - '