Merge branch 'develop' of github.com:martini/zammad into develop

This commit is contained in:
Felix Niklas 2015-11-26 10:52:22 +01:00
commit ae1b39cac7
4 changed files with 18 additions and 14 deletions

View file

@ -294,6 +294,12 @@ class ChatWindow extends App.Controller
if event.data and event.data.callback if event.data and event.data.callback
event.data.callback() event.data.callback()
@$('.js-customerChatInput').ce({
mode: 'richtext'
multiline: true
maxlength: 40000
})
close: => close: =>
@el.one 'transitionend', { callback: @release }, @onTransitionend @el.one 'transitionend', { callback: @release }, @onTransitionend
@el.removeClass('is-open') @el.removeClass('is-open')

View file

@ -116,7 +116,7 @@ class App.Utils
) )
# remove tags & content # remove tags & content
html.find('div, span, p, li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, br, hr, img, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove() html.find('div, span, p, li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, br, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
html html
@ -138,7 +138,7 @@ class App.Utils
) )
# remove tags & content # remove tags & content
html.find('li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, address, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, hr, img, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove() html.find('li, ul, ol, a, b, u, i, label, small, strong, strike, pre, code, center, blockquote, form, textarea, font, address, table, thead, tbody, tr, td, h1, h2, h3, h4, h5, h6, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
html html
@ -155,7 +155,7 @@ class App.Utils
@_removeWordMarkup(html) @_removeWordMarkup(html)
# remove tags, keep content # remove tags, keep content
html.find('a, font, small, time').replaceWith( -> html.find('a, font, small, time, form').replaceWith( ->
$(@).contents() $(@).contents()
) )
@ -179,7 +179,7 @@ class App.Utils
) )
# remove tags & content # remove tags & content
html.find('form, font, hr, img, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove() html.find('font, hr, img, svg, input, select, button, style, applet, embed, noframes, canvas, script, frame, iframe').remove()
html html

View file

@ -5,7 +5,6 @@ class Chat < ApplicationModel
store :preferences store :preferences
def customer_state(session_id = nil) def customer_state(session_id = nil)
return { state: 'chat_disabled' } if !Setting.get('chat')
# reconnect # reconnect
if session_id if session_id
@ -63,7 +62,6 @@ class Chat < ApplicationModel
end end
def self.agent_state(user_id) def self.agent_state(user_id)
return { state: 'chat_disabled' } if !Setting.get('chat')
assets = {} assets = {}
Chat.where(active: true).each {|chat| Chat.where(active: true).each {|chat|
assets = chat.assets(assets) assets = chat.assets(assets)

View file

@ -246,7 +246,7 @@ test("htmlRemoveTags", function() {
result = App.Utils.htmlRemoveTags($(source)) result = App.Utils.htmlRemoveTags($(source))
equal(result.html(), should, source) equal(result.html(), should, source)
source = "<div><form class=\"xxx\">test 123</form></div>" source = "<div><form class=\"xxx\">test 123</form><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
//should = "<div>test 123</div>" //should = "<div>test 123</div>"
should = "test 123" should = "test 123"
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlRemoveRichtext($(source))
@ -345,7 +345,7 @@ test("htmlRemoveRichtext", function() {
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlRemoveRichtext($(source))
equal(result.html(), should, source) equal(result.html(), should, source)
source = "<div><font size=\"3\" color=\"red\">This is some text!</font></div>" source = "<div><font size=\"3\" color=\"red\">This is some text!</font><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
//should = "<div>This is some text!</div>" //should = "<div>This is some text!</div>"
should = "This is some text!" should = "This is some text!"
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlRemoveRichtext($(source))
@ -400,31 +400,31 @@ test("htmlCleanup", function() {
source = "<div><div class=\"xxx\"><br></div></div>" source = "<div><div class=\"xxx\"><br></div></div>"
//should = "<div><div><br></div></div>" //should = "<div><div><br></div></div>"
should = "<div><br></div>" should = "<div><br></div>"
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlCleanup($(source))
equal(result.html(), should, source) equal(result.html(), should, source)
source = "<div><form class=\"xxx\">test 123</form></div>" source = "<div><form class=\"xxx\">test 123</form></div>"
//should = "<div>test 123<br></div>" //should = "<div>test 123<br></div>"
should = "test 123" should = "test 123"
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlCleanup($(source))
equal(result.html(), should, source) equal(result.html(), should, source)
source = "<div><form class=\"xxx\">test 123</form> some other value</div>" source = "<div><form class=\"xxx\">test 123</form> some other value</div>"
//should = "<div>test 123 some other value</div>" //should = "<div>test 123 some other value</div>"
should = "test 123 some other value" should = "test 123 some other value"
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlCleanup($(source))
equal(result.html(), should, source) equal(result.html(), should, source)
source = "<div><form class=\"xxx\">test 123</form> some other value<input value=\"should not be shown\"></div>" source = "<div><form class=\"xxx\">test 123</form> some other value<input value=\"should not be shown\"></div>"
//should = "<div>test 123 some other value</div>" //should = "<div>test 123 some other value</div>"
should = "test 123 some other value" should = "test 123 some other value"
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlCleanup($(source))
equal(result.html(), should, source) equal(result.html(), should, source)
source = "<div><font size=\"3\" color=\"red\">This is some text!</font></div>" source = "<div><font size=\"3\" color=\"red\">This is some text!</font><svg><use xlink:href=\"assets/images/icons.svg#icon-status\"></svg></div>"
//should = "<div>This is some text!</div>" //should = "<div>This is some text!</div>"
should = "This is some text!" should = "This is some text!"
result = App.Utils.htmlRemoveRichtext($(source)) result = App.Utils.htmlCleanup($(source))
equal(result.html(), should, source) equal(result.html(), should, source)
source = "<div><p>some link to somewhere from word<w:sdt>abc</w:sdt></p><o:p></o:p></a>" source = "<div><p>some link to somewhere from word<w:sdt>abc</w:sdt></p><o:p></o:p></a>"