diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 99741dc47..20297b184 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -127,6 +127,17 @@ test:integration:email_deliver: - ruby -I test/ test/integration/email_deliver_test.rb - rake db:drop +test:integration:email_keep_on_server: + stage: test + tags: + - core + script: + - export RAILS_ENV=test + - rake db:create + - rake db:migrate + - ruby -I test/ test/integration/email_keep_on_server_test.rb + - rake db:drop + test:integration:twitter: stage: test tags: diff --git a/.travis.yml b/.travis.yml index 510217e74..c8153f76e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -7,7 +7,6 @@ notifications: env: - DB=mysql - DB=postgresql - - BUNDLE_JOBS=8 addons: postgresql: "9.4" apt: diff --git a/Gemfile b/Gemfile index 2695e13bb..9f5658fcf 100644 --- a/Gemfile +++ b/Gemfile @@ -40,6 +40,7 @@ gem 'omniauth-gitlab' gem 'omniauth-google-oauth2' gem 'omniauth-linkedin-oauth2' gem 'omniauth-twitter' +gem 'omniauth-microsoft-office365' gem 'twitter' gem 'telegramAPI' diff --git a/Gemfile.lock b/Gemfile.lock index 5b161264b..c8671468b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -151,10 +151,11 @@ GEM guard (~> 2.8) guard-compat (~> 1.0) multi_json (~> 1.8) - guard-symlink (0.1.0) + guard-symlink (0.1.1) + guard guard-compat (~> 1.1) hashdiff (0.3.2) - hashie (3.4.4) + hashie (3.5.5) htmlentities (4.3.4) http (1.0.4) addressable (~> 2.3) @@ -169,7 +170,7 @@ GEM icalendar (2.4.1) inflection (1.0.0) json (1.8.6) - jwt (1.5.4) + jwt (1.5.6) kgio (2.11.0) koala (2.4.0) addressable @@ -194,7 +195,7 @@ GEM mini_portile2 (2.2.0) minitest (5.10.2) multi_json (1.12.1) - multi_xml (0.5.5) + multi_xml (0.6.0) multipart-post (2.0.0) mysql2 (0.4.6) naught (1.1.0) @@ -208,33 +209,36 @@ GEM nenv (~> 0.1) shellany (~> 0.0) oauth (0.5.1) - oauth2 (1.2.0) - faraday (>= 0.8, < 0.10) + oauth2 (1.4.0) + faraday (>= 0.8, < 0.13) jwt (~> 1.0) multi_json (~> 1.3) multi_xml (~> 0.5) rack (>= 1.2, < 3) octokit (4.4.1) sawyer (~> 0.7.0, >= 0.5.3) - omniauth (1.3.1) - hashie (>= 1.2, < 4) - rack (>= 1.0, < 3) + omniauth (1.6.1) + hashie (>= 3.4.6, < 3.6.0) + rack (>= 1.6.2, < 3) omniauth-facebook (4.0.0) omniauth-oauth2 (~> 1.2) - omniauth-github (1.1.2) - omniauth (~> 1.0) - omniauth-oauth2 (~> 1.1) + omniauth-github (1.3.0) + omniauth (~> 1.5) + omniauth-oauth2 (>= 1.4.0, < 2.0) omniauth-gitlab (1.0.2) omniauth (~> 1.0) omniauth-oauth2 (~> 1.0) - omniauth-google-oauth2 (0.4.1) - jwt (~> 1.5.2) + omniauth-google-oauth2 (0.5.0) + jwt (~> 1.5) multi_json (~> 1.3) omniauth (>= 1.1.1) omniauth-oauth2 (>= 1.3.1) omniauth-linkedin-oauth2 (0.1.5) omniauth (~> 1.0) omniauth-oauth2 + omniauth-microsoft-office365 (0.0.7) + omniauth + omniauth-oauth2 omniauth-oauth (1.1.0) oauth omniauth (~> 1.0) @@ -463,6 +467,7 @@ DEPENDENCIES omniauth-gitlab omniauth-google-oauth2 omniauth-linkedin-oauth2 + omniauth-microsoft-office365 omniauth-oauth2 omniauth-twitter pg @@ -499,4 +504,4 @@ RUBY VERSION ruby 2.3.1p112 BUNDLED WITH - 1.13.7 + 1.15.1 diff --git a/app/assets/javascripts/app/controllers/_channel/email.coffee b/app/assets/javascripts/app/controllers/_channel/email.coffee index 99a71620e..a6855923a 100644 --- a/app/assets/javascripts/app/controllers/_channel/email.coffee +++ b/app/assets/javascripts/app/controllers/_channel/email.coffee @@ -560,21 +560,24 @@ class App.ChannelEmailAccountWizard extends App.WizardModal # inbound configureAttributesInbound = [ - { name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: @channelDriver.email.inbound }, - { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false }, - { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', }, - { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true }, - { name: 'options::ssl', display: 'SSL', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, default: true, translate: true, item_class: 'formGroup--halfSize' }, - { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false, default: '993', item_class: 'formGroup--halfSize' }, - { name: 'options::folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false }, + { name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: @channelDriver.email.inbound }, + { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false }, + { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off' }, + { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true }, + { name: 'options::ssl', display: 'SSL', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, default: true, translate: true, item_class: 'formGroup--halfSize' }, + { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false, default: '993', item_class: 'formGroup--halfSize' }, + { name: 'options::folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, item_class: 'formGroup--halfSize' }, + { name: 'options::keep_on_server', display: 'Keep messages on server', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, translate: true, default: false, item_class: 'formGroup--halfSize' }, ] showHideFolder = (params, attribute, attributes, classname, form, ui) -> return if !params if params.adapter is 'imap' ui.show('options::folder') + ui.show('options::keep_on_server') return ui.hide('options::folder') + ui.hide('options::keep_on_server') handlePort = (params, attribute, attributes, classname, form, ui) -> return if !params @@ -606,9 +609,10 @@ class App.ChannelEmailAccountWizard extends App.WizardModal # fill user / password based on intro info channel_used = { options: {} } if @account['meta'] - channel_used['options']['user'] = @account['meta']['email'] - channel_used['options']['password'] = @account['meta']['password'] - channel_used['options']['folder'] = @account['meta']['folder'] + channel_used['options']['user'] = @account['meta']['email'] + channel_used['options']['password'] = @account['meta']['password'] + channel_used['options']['folder'] = @account['meta']['folder'] + channel_used['options']['keep_on_server'] = @account['meta']['keep_on_server'] # show used backend @$('.base-outbound-settings').html('') @@ -670,7 +674,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal for key, value of data.setting @account[key] = value - if data.content_messages && data.content_messages > 0 + if data.content_messages && data.content_messages > 0 && (!@account['inbound']['options'] || @account['inbound']['options']['keep_on_server'] isnt true) message = App.i18n.translateContent('We have already found %s email(s) in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) @$('.js-inbound-acknowledge .js-message').html(message) @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro') @@ -724,7 +728,7 @@ class App.ChannelEmailAccountWizard extends App.WizardModal # remember account settings @account.inbound = params - if data.content_messages && data.content_messages > 0 + if data.content_messages && data.content_messages > 0 && (!@account['inbound']['options'] || @account['inbound']['options']['keep_on_server'] isnt true) message = App.i18n.translateContent('We have already found %s email(s) in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) @$('.js-inbound-acknowledge .js-message').html(message) @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-inbound') diff --git a/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee b/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee index 671da7abc..5f731803b 100644 --- a/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee +++ b/app/assets/javascripts/app/controllers/_profile/linked_accounts.coffee @@ -9,43 +9,7 @@ class Index extends App.ControllerSubContent @render() render: => - auth_provider_all = { - facebook: { - url: '/auth/facebook' - name: 'Facebook' - config: 'auth_facebook' - }, - twitter: { - url: '/auth/twitter' - name: 'Twitter' - config: 'auth_twitter' - }, - linkedin: { - url: '/auth/linkedin' - name: 'LinkedIn' - config: 'auth_linkedin' - }, - github: { - url: '/auth/github' - name: 'GitHub' - config: 'auth_github' - }, - gitlab: { - url: '/auth/gitlab' - name: 'GitLab' - config: 'auth_gitlab' - }, - google_oauth2: { - url: '/auth/google_oauth2' - name: 'Google' - config: 'auth_google_oauth2' - }, - oauth2: { - url: '/auth/oauth2' - name: 'OAuth2' - config: 'auth_oauth2' - }, - } + auth_provider_all = App.Config.get('auth_provider_all') auth_providers = {} for key, provider of auth_provider_all if @Config.get(provider.config) is true || @Config.get(provider.config) is 'true' @@ -90,3 +54,45 @@ class Index extends App.ControllerSubContent ) App.Config.set('LinkedAccounts', { prio: 4000, name: 'Linked Accounts', parent: '#profile', target: '#profile/linked', controller: Index, permission: ['user_preferences.linked_accounts'] }, 'NavBarProfile') +App.Config.set('auth_provider_all', { + facebook: + url: '/auth/facebook' + name: 'Facebook' + config: 'auth_facebook' + class: 'facebook' + twitter: + url: '/auth/twitter' + name: 'Twitter' + config: 'auth_twitter' + class: 'twitter' + linkedin: + url: '/auth/linkedin' + name: 'LinkedIn' + config: 'auth_linkedin' + class: 'linkedin' + github: + url: '/auth/github' + name: 'GitHub' + config: 'auth_github' + class: 'github' + gitlab: + url: '/auth/gitlab' + name: 'GitLab' + config: 'auth_gitlab' + class: 'gitlab' + microsoft_office365: + url: '/auth/microsoft_office365' + name: 'Office 365' + config: 'auth_microsoft_office365' + class: 'office365' + google_oauth2: + url: '/auth/google_oauth2' + name: 'Google' + config: 'auth_google_oauth2' + class: 'google' + oauth2: + url: '/auth/oauth2' + name: 'OAuth2' + config: 'auth_oauth2' + class: 'oauth2' +}) diff --git a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee index 0ac160b3c..80d61840b 100644 --- a/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee +++ b/app/assets/javascripts/app/controllers/_ui_element/object_manager_attribute.coffee @@ -82,7 +82,7 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi view: shown: true invite_customer: - show: false + shown: false required: false 'admin.user': create: @@ -94,10 +94,10 @@ class App.UiElement.object_manager_attribute extends App.UiElement.ApplicationUi view: shown: true invite_agent: - show: false + shown: false required: false invite_customer: - show: false + shown: false required: false Organization: 'ticket.customer': diff --git a/app/assets/javascripts/app/controllers/chat.coffee b/app/assets/javascripts/app/controllers/chat.coffee index f8e969e86..96f4de60d 100644 --- a/app/assets/javascripts/app/controllers/chat.coffee +++ b/app/assets/javascripts/app/controllers/chat.coffee @@ -587,7 +587,7 @@ class ChatWindow extends App.Controller @sounds.message.play() @notifyDesktop( title: @name - body: message + body: App.Utils.html2text(message) url: '#customer_chat' callback: => App.Event.trigger('chat_focus', { session_id: @session.session_id }) diff --git a/app/assets/javascripts/app/controllers/getting_started.coffee b/app/assets/javascripts/app/controllers/getting_started.coffee index c7d236267..8c2fbb71d 100644 --- a/app/assets/javascripts/app/controllers/getting_started.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.coffee @@ -450,8 +450,8 @@ class EmailNotification extends App.WizardFullScreen if adapter is 'smtp' configureAttributesOutbound = [ { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autofocus: true }, - { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password' }, - { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', single: true }, + { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'off' }, + { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'off', single: true }, { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false }, ] @form = new App.ControllerForm( @@ -671,20 +671,24 @@ class ChannelEmail extends App.WizardFullScreen # inbound configureAttributesInbound = [ - { name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: @channelDriver.email.inbound }, - { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false }, - { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', }, - { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'new-password', single: true }, - { name: 'options::ssl', display: 'SSL', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, default: true, translate: true, item_class: 'formGroup--halfSize' }, - { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false, default: '993', item_class: 'formGroup--halfSize' }, + { name: 'adapter', display: 'Type', tag: 'select', multiple: false, null: false, options: @channelDriver.email.inbound }, + { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false }, + { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', }, + { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: false, autocapitalize: false, autocomplete: 'off', single: true }, + { name: 'options::ssl', display: 'SSL', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, default: true, translate: true, item_class: 'formGroup--halfSize' }, + { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false, default: '993', item_class: 'formGroup--halfSize' }, + { name: 'options::folder', display: 'Folder', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, item_class: 'formGroup--halfSize' }, + { name: 'options::keep_on_server', display: 'Keep messages on server', tag: 'boolean', null: true, options: { true: 'yes', false: 'no' }, translate: true, default: false, item_class: 'formGroup--halfSize' }, ] showHideFolder = (params, attribute, attributes, classname, form, ui) -> return if !params if params.adapter is 'imap' ui.show('options::folder') + ui.show('options::keep_on_server') return ui.hide('options::folder') + ui.hide('options::keep_on_server') handlePort = (params, attribute, attributes, classname, form, ui) -> return if !params @@ -700,7 +704,7 @@ class ChannelEmail extends App.WizardFullScreen return new App.ControllerForm( - el: @$('.base-inbound-settings'), + el: @$('.base-inbound-settings') model: configure_attributes: configureAttributesInbound className: '' @@ -716,8 +720,10 @@ class ChannelEmail extends App.WizardFullScreen # fill user / password based on intro info channel_used = { options: {} } if @account['meta'] - channel_used['options']['user'] = @account['meta']['email'] - channel_used['options']['password'] = @account['meta']['password'] + channel_used['options']['user'] = @account['meta']['email'] + channel_used['options']['password'] = @account['meta']['password'] + channel_used['options']['folder'] = @account['meta']['folder'] + channel_used['options']['keep_on_server'] = @account['meta']['keep_on_server'] # show used backend @$('.base-outbound-settings').html('') @@ -725,8 +731,8 @@ class ChannelEmail extends App.WizardFullScreen if adapter is 'smtp' configureAttributesOutbound = [ { name: 'options::host', display: 'Host', tag: 'input', type: 'text', limit: 120, null: false, autocapitalize: false, autofocus: true }, - { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', }, - { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'new-password', single: true }, + { name: 'options::user', display: 'User', tag: 'input', type: 'text', limit: 120, null: true, autocapitalize: false, autocomplete: 'off', }, + { name: 'options::password', display: 'Password', tag: 'input', type: 'password', limit: 120, null: true, autocapitalize: false, autocomplete: 'off', single: true }, { name: 'options::port', display: 'Port', tag: 'input', type: 'text', limit: 6, null: true, autocapitalize: false }, ] @form = new App.ControllerForm( @@ -745,7 +751,7 @@ class ChannelEmail extends App.WizardFullScreen @account.meta = params @disable(e) - @$('.js-probe .js-email').text( params.email ) + @$('.js-probe .js-email').text(params.email) @showSlide('js-probe') @ajax( @@ -760,7 +766,7 @@ class ChannelEmail extends App.WizardFullScreen for key, value of data.setting @account[key] = value - if data.content_messages && data.content_messages > 0 + if data.content_messages && data.content_messages > 0 && (!@account['inbound']['options'] || @account['inbound']['options']['keep_on_server'] isnt true) message = App.i18n.translateContent('We have already found %s email(s) in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) @$('.js-inbound-acknowledge .js-message').html(message) @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-intro') @@ -809,7 +815,7 @@ class ChannelEmail extends App.WizardFullScreen # remember account settings @account.inbound = params - if data.content_messages && data.content_messages > 0 + if data.content_messages && data.content_messages > 0 && (!@account['inbound']['options'] || @account['inbound']['options']['keep_on_server'] isnt true) message = App.i18n.translateContent('We have already found %s emails in your mailbox. Zammad will move it all from your mailbox into Zammad.', data.content_messages) @$('.js-inbound-acknowledge .js-message').html(message) @$('.js-inbound-acknowledge .js-back').attr('data-slide', 'js-inbound') diff --git a/app/assets/javascripts/app/controllers/login.coffee b/app/assets/javascripts/app/controllers/login.coffee index 322a518c7..6e7f608d3 100644 --- a/app/assets/javascripts/app/controllers/login.coffee +++ b/app/assets/javascripts/app/controllers/login.coffee @@ -38,50 +38,7 @@ class Index extends App.ControllerContent ) render: (data = {}) -> - auth_provider_all = { - facebook: { - url: '/auth/facebook', - name: 'Facebook', - config: 'auth_facebook', - class: 'facebook' - }, - twitter: { - url: '/auth/twitter' - name: 'Twitter' - config: 'auth_twitter' - class: 'twitter' - }, - linkedin: { - url: '/auth/linkedin' - name: 'LinkedIn' - config: 'auth_linkedin' - class: 'linkedin' - }, - github: { - url: '/auth/github' - name: 'GitHub' - config: 'auth_github' - class: 'github' - }, - gitlab: { - url: '/auth/gitlab' - name: 'GitLab' - config: 'auth_gitlab' - class: 'gitlab' - }, - google_oauth2: { - url: '/auth/google_oauth2' - name: 'Google' - config: 'auth_google_oauth2' - class: 'google' - }, - oauth2: { - url: '/auth/oauth2' - name: 'OAuth2' - config: 'auth_oauth2' - class: 'oauth2' - }, - } + auth_provider_all = App.Config.get('auth_provider_all') auth_providers = [] for key, provider of auth_provider_all if @Config.get(provider.config) is true || @Config.get(provider.config) is 'true' diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee index 6b60eb01e..df150405a 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_actions.coffee @@ -391,6 +391,7 @@ class App.TicketZoomArticleActions extends App.Controller body = @el.closest('.ticketZoom').find('.article-add [data-name="body"]').html() || '' # check if quote need to be added + signaturePosition = 'bottom' selected = App.ClipBoard.getSelected('html') if selected selected = App.Utils.htmlCleanup(selected).html() @@ -399,6 +400,16 @@ class App.TicketZoomArticleActions extends App.Controller if selected selected = App.Utils.textCleanup(selected) selected = App.Utils.text2html(selected) + + # full quote, if needed + if !selected && article && App.Config.get('ui_ticket_zoom_article_email_full_quote') + signaturePosition = 'top' + if article.content_type.match('html') + selected = App.Utils.textCleanup(article.body) + if article.content_type.match('plain') + selected = App.Utils.textCleanup(selected) + selected = App.Utils.text2html(selected) + if selected selected = "


#{selected}

" @@ -409,7 +420,12 @@ class App.TicketZoomArticleActions extends App.Controller type = App.TicketArticleType.findByAttribute(name:'email') - App.Event.trigger('ui::ticket::setArticleType', { ticket: @ticket, type: type, article: articleNew } ) + App.Event.trigger('ui::ticket::setArticleType', { + ticket: @ticket + type: type + article: articleNew + signaturePosition: signaturePosition + }) telegramPersonalMessageReply: (e) => e.preventDefault() diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee index 60fd1b1bf..82ed57e1e 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/article_new.coffee @@ -59,7 +59,7 @@ class App.TicketZoomArticleNew extends App.Controller @$('[name="' + key + '"]').val(value).trigger('change') # preselect article type - @setArticleType(data.type.name) + @setArticleType(data.type.name, data.signaturePosition) # set focus at end of field if data.position is 'end' @@ -483,7 +483,7 @@ class App.TicketZoomArticleNew extends App.Controller @$('[name=internal]').val('') - setArticleType: (type) => + setArticleType: (type, signaturePosition = 'bottom') => wasScrolledToBottom = @isScrolledToBottom() @type = type @$('[name=type]').val(type).trigger('change') @@ -532,7 +532,10 @@ class App.TicketZoomArticleNew extends App.Controller body.append('

') signature = $("
#{signatureFinished}
") App.Utils.htmlStrip(signature) - body.append(signature) + if signaturePosition is 'top' + body.prepend(signature) + else + body.append(signature) @$('[data-name=body]').replaceWith(body) # remove old signature @@ -566,6 +569,20 @@ class App.TicketZoomArticleNew extends App.Controller @delay(@updateLetterCount, 600) @$('.js-textSizeLimit').removeClass('hide') + # convert remote src images to data uri + @$('[data-name=body] img').each( (i,image) -> + $image = $(image) + src = $image.attr('src') + if !_.isEmpty(src) && !src.match(/^data:image/i) + canvas = document.createElement('canvas') + canvas.width = image.width + canvas.height = image.height + ctx = canvas.getContext('2d') + ctx.drawImage(image, 0, 0) + dataURL = canvas.toDataURL() + $image.attr('src', dataURL) + ) + @scrollToBottom() if wasScrolledToBottom isScrolledToBottom: -> diff --git a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_organization.coffee b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_organization.coffee index ad612da6b..6fc2ef5cb 100644 --- a/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_organization.coffee +++ b/app/assets/javascripts/app/controllers/ticket_zoom/sidebar_organization.coffee @@ -1,5 +1,6 @@ class SidebarOrganization extends App.Controller sidebarItem: => + return if !@permissionCheck('ticket.agent') return if !@ticket.organization_id { head: 'Organization' diff --git a/app/assets/javascripts/app/controllers/widget/dev_banner.coffee b/app/assets/javascripts/app/controllers/widget/dev_banner.coffee index a8f7f5c9e..28d534391 100644 --- a/app/assets/javascripts/app/controllers/widget/dev_banner.coffee +++ b/app/assets/javascripts/app/controllers/widget/dev_banner.coffee @@ -5,10 +5,10 @@ class Widget banner = """ | | Welcome Zammad Developer! -| You can enable debugging by the following examples (value is a regex): +| You can enable debugging with the following examples (value is a regex): | | App.Log.config('module', '(websocket|delay|interval)') // enable debugging for websocket, delay and interval class -| App.Log.config('content', 'send') // enable debugging for messages which contains the string 'send' +| App.Log.config('content', 'send') // enable debugging for messages which contain the string 'send' | App.Log.config('banner', false) // disable this banner | | App.Log.config() // current settings diff --git a/app/assets/javascripts/app/lib/app_post/pretty_date.coffee b/app/assets/javascripts/app/lib/app_post/pretty_date.coffee index 9c607eee0..13c6157a2 100644 --- a/app/assets/javascripts/app/lib/app_post/pretty_date.coffee +++ b/app/assets/javascripts/app/lib/app_post/pretty_date.coffee @@ -38,11 +38,16 @@ class App.PrettyDate months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'] month = months[created.getMonth()] - # for less than 7 days - if diff < (60 * 60 * 24 * 7) + # for less than 6 days + # weekday HH::MM + if diff < (60 * 60 * 24 * 6) string = "#{App.i18n.translateInline(weekday)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}" - else if diff < (60 * 60 * 24 * 7) * 365 + # if it was this year + # weekday DD. MM HH::MM + else if created.getYear() is current.getYear() string = "#{App.i18n.translateInline(weekday)} #{created.getDate()}. #{App.i18n.translateInline(month)} #{created.getHours()}:#{@s(created.getMinutes(), 2)}" + # if it was the year before + # weekday YYYY-MM-DD HH::MM else string = "#{App.i18n.translateInline(weekday)} #{App.i18n.translateTimestamp(time)}" if escalation diff --git a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js index 2a1994828..d074e3dff 100644 --- a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js +++ b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js @@ -295,7 +295,7 @@ else { img = "" } - document.execCommand('insertHTML', false, img) + _this.paste(img) } // resize if to big @@ -367,13 +367,7 @@ text = App.Utils.removeEmptyLines(text) _this.log('insert', text) - // as fallback, insert html via pasteHtmlAtCaret (for IE 11 and lower) - if (docType == 'text3') { - _this.pasteHtmlAtCaret(text) - } - else { - document.execCommand('insertHTML', false, text) - } + _this.paste(text) return true }) @@ -533,37 +527,6 @@ return this.$element.html().trim() } - // taken from https://stackoverflow.com/questions/6690752/insert-html-at-caret-in-a-contenteditable-div/6691294#6691294 - Plugin.prototype.pasteHtmlAtCaret = function(html) { - var sel, range; - if (window.getSelection) { - sel = window.getSelection() - if (sel.getRangeAt && sel.rangeCount) { - range = sel.getRangeAt(0) - range.deleteContents() - - var el = document.createElement('div') - el.innerHTML = html; - var frag = document.createDocumentFragment(), node, lastNode - while ( (node = el.firstChild) ) { - lastNode = frag.appendChild(node) - } - range.insertNode(frag) - - if (lastNode) { - range = range.cloneRange() - range.setStartAfter(lastNode) - range.collapse(true) - sel.removeAllRanges() - sel.addRange(range) - } - } - } - else if (document.selection && document.selection.type != 'Control') { - document.selection.createRange().pasteHTML(html) - } - } - // log method Plugin.prototype.log = function() { if (App && App.Log) { @@ -574,7 +537,30 @@ } } - $.fn[pluginName] = function ( options ) { + // paste some content + Plugin.prototype.paste = function(string) { + var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; + + // IE <= 10 + if (document.selection && document.selection.createRange) { + var range = document.selection.createRange() + if (range.pasteHTML) { + range.pasteHTML(string) + } + } + // IE == 11 + else if (isIE11 && document.getSelection) { + var range = document.getSelection().getRangeAt(0) + var nnode = document.createElement('div') + range.surroundContents(nnode) + nnode.innerHTML = string + } + else { + document.execCommand('insertHTML', false, string) + } + } + + $.fn[pluginName] = function (options) { return this.each(function () { if (!$.data(this, 'plugin_' + pluginName)) { $.data(this, 'plugin_' + pluginName, diff --git a/app/assets/javascripts/app/lib/base/jquery.textmodule.js b/app/assets/javascripts/app/lib/base/jquery.textmodule.js index 6236f42d3..699ff1847 100644 --- a/app/assets/javascripts/app/lib/base/jquery.textmodule.js +++ b/app/assets/javascripts/app/lib/base/jquery.textmodule.js @@ -250,9 +250,21 @@ // paste some content Plugin.prototype.paste = function(string) { - if (document.selection) { // IE + var isIE11 = !!window.MSInputMethodContext && !!document.documentMode; + + // IE <= 10 + if (document.selection && document.selection.createRange) { var range = document.selection.createRange() - range.pasteHTML(string) + if (range.pasteHTML) { + range.pasteHTML(string) + } + } + // IE == 11 + else if (isIE11 && document.getSelection) { + var range = document.getSelection().getRangeAt(0) + var nnode = document.createElement('div') + range.surroundContents(nnode) + nnode.innerHTML = string } else { document.execCommand('insertHTML', false, string) @@ -295,14 +307,7 @@ // for chrome, insert space again if (start) { if (spacerChar === ' ') { - string = " " - if (document.selection) { // IE - var range = document.selection.createRange() - range.pasteHTML(string) - } - else { - document.execCommand('insertHTML', false, string) - } + this.paste(' ') } } } diff --git a/app/assets/javascripts/app/models/_application_model.coffee b/app/assets/javascripts/app/models/_application_model.coffee index f7c708b78..49ad8aac9 100644 --- a/app/assets/javascripts/app/models/_application_model.coffee +++ b/app/assets/javascripts/app/models/_application_model.coffee @@ -32,6 +32,10 @@ class App.Model extends Spine.Model return @title if @subject return @subject + if @phone + return @phone + if @login + return @login return '???' displayNameLong: -> @@ -57,6 +61,12 @@ class App.Model extends Spine.Model return @email if @title return @title + if @subject + return @subject + if @phone + return @phone + if @login + return @login return '???' icon: (user) -> @@ -165,6 +175,31 @@ class App.Model extends Spine.Model ### +set new attributes of model (remove already available attributes) + + App.Model.attributesSet(attributes) + + ### + + @attributesSet: (attributes) -> + + configure_attributes = App[ @.className ].configure_attributes + attributesNew = [] + for localAttribute in configure_attributes + found = false + for attribute in attributes + if attribute.name is localAttribute.name + found = true + break + if !found + attributesNew.push localAttribute + for attribute in attributes + App[@.className].attributes.push attribute.name + attributesNew.push attribute + App[ @.className ].configure_attributes = attributesNew + + ### + attributes = App.Model.attributesGet(optionalScreen, optionalAttributesList) returns diff --git a/app/assets/javascripts/app/views/getting_started/email.jst.eco b/app/assets/javascripts/app/views/getting_started/email.jst.eco index e3ef082f8..1d2d0cb50 100644 --- a/app/assets/javascripts/app/views/getting_started/email.jst.eco +++ b/app/assets/javascripts/app/views/getting_started/email.jst.eco @@ -63,7 +63,7 @@
-
+

<%- @T('Email Inbound') %>

diff --git a/app/assets/javascripts/app/views/layout_ref/inputs.jst.eco b/app/assets/javascripts/app/views/layout_ref/inputs.jst.eco index 7fc1e34c6..50ff41cc4 100644 --- a/app/assets/javascripts/app/views/layout_ref/inputs.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/inputs.jst.eco @@ -51,6 +51,10 @@
+
+ + +
diff --git a/app/assets/javascripts/app/views/layout_ref/user_list.jst.eco b/app/assets/javascripts/app/views/layout_ref/user_list.jst.eco index 93f91446e..07f1630aa 100644 --- a/app/assets/javascripts/app/views/layout_ref/user_list.jst.eco +++ b/app/assets/javascripts/app/views/layout_ref/user_list.jst.eco @@ -116,8 +116,8 @@
- <%- @Icon('magnifier') %> + <%- @Icon('magnifier') %>
diff --git a/app/assets/javascripts/app/views/login.jst.eco b/app/assets/javascripts/app/views/login.jst.eco index 00b086f48..135c1c859 100644 --- a/app/assets/javascripts/app/views/login.jst.eco +++ b/app/assets/javascripts/app/views/login.jst.eco @@ -24,7 +24,7 @@
- +
diff --git a/app/assets/javascripts/app/views/search/index.jst.eco b/app/assets/javascripts/app/views/search/index.jst.eco index 504e997f3..55637065d 100644 --- a/app/assets/javascripts/app/views/search/index.jst.eco +++ b/app/assets/javascripts/app/views/search/index.jst.eco @@ -3,8 +3,8 @@