comparison browser_side/panels.py @ 246:d7c41c84d062

browser side: use of inlineRoot to display XHTML chat text
author Goffi <goffi@goffi.org>
date Sat, 09 Nov 2013 10:24:03 +0100
parents a25aa882e09a
children c24715dcd2f6
comparison
equal deleted inserted replaced
245:43881c3dda9d 246:d7c41c84d062
41 from pyjamas import DOM 41 from pyjamas import DOM
42 from card_game import CardPanel 42 from card_game import CardPanel
43 from radiocol import RadioColPanel 43 from radiocol import RadioColPanel
44 from menu import Menu 44 from menu import Menu
45 from jid import JID 45 from jid import JID
46 from tools import html_sanitize, addURLToText 46 from tools import html_sanitize, addURLToText, inlineRoot
47 from datetime import datetime 47 from datetime import datetime
48 from time import time 48 from time import time
49 import dialog 49 import dialog
50 import base_widget 50 import base_widget
51 from richtext import RichTextEditor 51 from richtext import RichTextEditor
617 _msg_class.append("chat_text_mymess") 617 _msg_class.append("chat_text_mymess")
618 HTMLPanel.__init__(self, "<span class='chat_text_timestamp'>%(timestamp)s</span> <span class='chat_text_nick'>%(nick)s</span> <span class='%(msg_class)s'>%(msg)s</span>" % 618 HTMLPanel.__init__(self, "<span class='chat_text_timestamp'>%(timestamp)s</span> <span class='chat_text_nick'>%(nick)s</span> <span class='%(msg_class)s'>%(msg)s</span>" %
619 {"timestamp": _date.strftime("%H:%M"), 619 {"timestamp": _date.strftime("%H:%M"),
620 "nick": "[%s]" % html_sanitize(nick), 620 "nick": "[%s]" % html_sanitize(nick),
621 "msg_class": ' '.join(_msg_class), 621 "msg_class": ' '.join(_msg_class),
622 "msg": addURLToText(html_sanitize(msg)) if not xhtml else xhtml} #FIXME: images and external links must be removed according to preferences 622 "msg": addURLToText(html_sanitize(msg)) if not xhtml else inlineRoot(xhtml)} #FIXME: images and external links must be removed according to preferences
623 ) 623 )
624 self.setStyleName('chatText') 624 self.setStyleName('chatText')
625 625
626 626
627 class Occupant(HTML): 627 class Occupant(HTML):