|
@@ -28,7 +28,62 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
constructor: ->
|
|
|
super
|
|
|
|
|
|
- # set possble article types
|
|
|
+ @internalSelector = true
|
|
|
+ @type = @defaults['type'] || 'note'
|
|
|
+ @setPossibleArticleTypes()
|
|
|
+
|
|
|
+ if @permissionCheck('ticket.customer')
|
|
|
+ @internalSelector = false
|
|
|
+
|
|
|
+ @textareaHeight =
|
|
|
+ open: 148
|
|
|
+ closed: 20
|
|
|
+
|
|
|
+ @dragEventCounter = 0
|
|
|
+ @attachments = []
|
|
|
+
|
|
|
+ @render()
|
|
|
+
|
|
|
+ if @defaults.body or @isIE10()
|
|
|
+ @openTextarea(null, true)
|
|
|
+
|
|
|
+ # set article type and expand text area
|
|
|
+ @bind('ui::ticket::setArticleType', (data) =>
|
|
|
+ return if data.ticket.id.toString() isnt @ticket_id.toString()
|
|
|
+
|
|
|
+ @openTextarea(null, true)
|
|
|
+ for key, value of data.article
|
|
|
+ if key is 'body'
|
|
|
+ @$('[data-name="' + key + '"]').html(value)
|
|
|
+ else
|
|
|
+ @$('[name="' + key + '"]').val(value).trigger('change')
|
|
|
+
|
|
|
+ # preselect article type
|
|
|
+ @setArticleType(data.type.name)
|
|
|
+
|
|
|
+ # set focus at end of field
|
|
|
+ if data.position is 'end'
|
|
|
+ @placeCaretAtEnd(@textarea.get(0))
|
|
|
+ return
|
|
|
+
|
|
|
+ # set focus into field
|
|
|
+ @textarea.focus()
|
|
|
+ )
|
|
|
+
|
|
|
+ # reset new article screen
|
|
|
+ @bind('ui::ticket::taskReset', (data) =>
|
|
|
+ return if data.ticket_id.toString() isnt @ticket_id.toString()
|
|
|
+ @type = 'note'
|
|
|
+ @defaults = {}
|
|
|
+ @render()
|
|
|
+ )
|
|
|
+
|
|
|
+ # rerender, e. g. on language change
|
|
|
+ @bind('ui:rerender', =>
|
|
|
+ @render()
|
|
|
+ )
|
|
|
+
|
|
|
+ setPossibleArticleTypes: =>
|
|
|
possibleArticleType =
|
|
|
note: true
|
|
|
phone: true
|
|
@@ -50,12 +105,9 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
possibleArticleType['email'] = true
|
|
|
|
|
|
# gets referenced in @setArticleType
|
|
|
- @internalSelector = true
|
|
|
- @type = @defaults['type'] || 'note'
|
|
|
@articleTypes = []
|
|
|
if possibleArticleType.note
|
|
|
- internal = @Config.get('ui_ticket_zoom_article_new_internal')
|
|
|
-
|
|
|
+ internal = @Config.get('ui_ticket_zoom_article_note_new_internal')
|
|
|
@articleTypes.push {
|
|
|
name: 'note'
|
|
|
icon: 'note'
|
|
@@ -64,10 +116,13 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
features: ['attachment']
|
|
|
}
|
|
|
if possibleArticleType.email
|
|
|
+ attributes = ['to', 'cc', 'subject']
|
|
|
+ if !@Config.get('ui_ticket_zoom_article_email_subject')
|
|
|
+ attributes = ['to', 'cc']
|
|
|
@articleTypes.push {
|
|
|
name: 'email'
|
|
|
icon: 'email'
|
|
|
- attributes: ['to', 'cc']
|
|
|
+ attributes: attributes
|
|
|
internal: false,
|
|
|
features: ['attachment']
|
|
|
}
|
|
@@ -80,6 +135,9 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
features: []
|
|
|
}
|
|
|
if possibleArticleType['twitter status']
|
|
|
+ attributes = ['body:limit', 'body:initials']
|
|
|
+ if !@Config.get('ui_ticket_zoom_article_twitter_initials')
|
|
|
+ attributes = ['body:limit']
|
|
|
@articleTypes.push {
|
|
|
name: 'twitter status'
|
|
|
icon: 'twitter'
|
|
@@ -90,6 +148,9 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
warningTextLength: 30
|
|
|
}
|
|
|
if possibleArticleType['twitter direct-message']
|
|
|
+ attributes = ['body:limit', 'body:initials']
|
|
|
+ if !@Config.get('ui_ticket_zoom_article_twitter_initials')
|
|
|
+ attributes = ['body:limit']
|
|
|
@articleTypes.push {
|
|
|
name: 'twitter direct-message'
|
|
|
icon: 'twitter'
|
|
@@ -130,57 +191,6 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
},
|
|
|
]
|
|
|
|
|
|
- if @permissionCheck('ticket.customer')
|
|
|
- @internalSelector = false
|
|
|
-
|
|
|
- @textareaHeight =
|
|
|
- open: 148
|
|
|
- closed: 20
|
|
|
-
|
|
|
- @dragEventCounter = 0
|
|
|
- @attachments = []
|
|
|
-
|
|
|
- @render()
|
|
|
-
|
|
|
- if @defaults.body or @isIE10()
|
|
|
- @openTextarea(null, true)
|
|
|
-
|
|
|
- # set article type and expand text area
|
|
|
- @bind('ui::ticket::setArticleType', (data) =>
|
|
|
- return if data.ticket.id.toString() isnt @ticket_id.toString()
|
|
|
-
|
|
|
- @openTextarea(null, true)
|
|
|
- for key, value of data.article
|
|
|
- if key is 'body'
|
|
|
- @$('[data-name="' + key + '"]').html(value)
|
|
|
- else
|
|
|
- @$('[name="' + key + '"]').val(value).trigger('change')
|
|
|
-
|
|
|
- # preselect article type
|
|
|
- @setArticleType(data.type.name)
|
|
|
-
|
|
|
- # set focus at end of field
|
|
|
- if data.position is 'end'
|
|
|
- @placeCaretAtEnd(@textarea.get(0))
|
|
|
- return
|
|
|
-
|
|
|
- # set focus into field
|
|
|
- @textarea.focus()
|
|
|
- )
|
|
|
-
|
|
|
- # reset new article screen
|
|
|
- @bind('ui::ticket::taskReset', (data) =>
|
|
|
- return if data.ticket_id.toString() isnt @ticket_id.toString()
|
|
|
- @type = 'note'
|
|
|
- @defaults = {}
|
|
|
- @render()
|
|
|
- )
|
|
|
-
|
|
|
- # rerender, e. g. on language change
|
|
|
- @bind('ui:rerender', =>
|
|
|
- @render()
|
|
|
- )
|
|
|
-
|
|
|
placeCaretAtEnd: (el) ->
|
|
|
el.focus()
|
|
|
if typeof window.getSelection isnt 'undefined' && typeof document.createRange isnt 'undefined'
|
|
@@ -318,9 +328,6 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
params.form_id = @form_id
|
|
|
params.content_type = 'text/html'
|
|
|
|
|
|
- if !params['internal']
|
|
|
- params['internal'] = false
|
|
|
-
|
|
|
if @permissionCheck('ticket.customer')
|
|
|
sender = App.TicketArticleSender.findByAttribute('name', 'Customer')
|
|
|
type = App.TicketArticleType.findByAttribute('name', 'web')
|
|
@@ -332,6 +339,11 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
params.sender_id = sender.id
|
|
|
params.type_id = type.id
|
|
|
|
|
|
+ if params.internal
|
|
|
+ params.internal = true
|
|
|
+ else
|
|
|
+ params.internal = false
|
|
|
+
|
|
|
if params.type is 'twitter status'
|
|
|
App.Utils.htmlRemoveRichtext(@$('[data-name=body]'), false)
|
|
|
params.content_type = 'text/plain'
|
|
@@ -478,6 +490,8 @@ class App.TicketZoomArticleNew extends App.Controller
|
|
|
@articleNewEdit.attr('data-type', type)
|
|
|
@$('.js-selectableTypes').addClass('hide').filter("[data-type='#{type}']").removeClass('hide')
|
|
|
|
|
|
+ @setPossibleArticleTypes()
|
|
|
+
|
|
|
# get config
|
|
|
config = {}
|
|
|
for articleTypeConfig in @articleTypes
|