Mercurial > libervia-web
comparison browser_side/panels.py @ 217:f7ec248192de
browser_side: display clickable URLs in chat text
author | souliane <souliane@mailoo.org> |
---|---|
date | Sun, 08 Sep 2013 12:34:00 +0200 |
parents | 7b26be266ab1 |
children | 4e6467efd6bf |
comparison
equal
deleted
inserted
replaced
216:9827cda1a6b0 | 217:f7ec248192de |
---|---|
38 from pyjamas import DOM | 38 from pyjamas import DOM |
39 from card_game import CardPanel | 39 from card_game import CardPanel |
40 from radiocol import RadioColPanel | 40 from radiocol import RadioColPanel |
41 from menu import Menu | 41 from menu import Menu |
42 from jid import JID | 42 from jid import JID |
43 from tools import html_sanitize | 43 from tools import html_sanitize, addURLToText |
44 from datetime import datetime | 44 from datetime import datetime |
45 from time import time | 45 from time import time |
46 import dialog | 46 import dialog |
47 import base_widget | 47 import base_widget |
48 from pyjamas import Window | 48 from pyjamas import Window |
272 <div class="mb_entry_dialog"> | 272 <div class="mb_entry_dialog"> |
273 <p class="bubble">%(body)s</p> | 273 <p class="bubble">%(body)s</p> |
274 </div> | 274 </div> |
275 """ % {"author": html_sanitize(self.author), | 275 """ % {"author": html_sanitize(self.author), |
276 "timestamp": _datetime, | 276 "timestamp": _datetime, |
277 "body": html_sanitize(mblog_entry.content) | 277 "body": addURLToText(html_sanitize(mblog_entry.content)) |
278 }) | 278 }) |
279 self.avatar = Image(blog_panel.host.getAvatar(self.author)) | 279 self.avatar = Image(blog_panel.host.getAvatar(self.author)) |
280 self.panel.add(self.avatar, "id_avatar") | 280 self.panel.add(self.avatar, "id_avatar") |
281 self.panel.setStyleName('mb_entry') | 281 self.panel.setStyleName('mb_entry') |
282 self.add(self.panel) | 282 self.add(self.panel) |
531 _msg_class.append("chat_text_mymess") | 531 _msg_class.append("chat_text_mymess") |
532 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>" % | 532 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>" % |
533 {"timestamp": _date.strftime("%H:%M"), | 533 {"timestamp": _date.strftime("%H:%M"), |
534 "nick": "[%s]" % html_sanitize(nick), | 534 "nick": "[%s]" % html_sanitize(nick), |
535 "msg_class": ' '.join(_msg_class), | 535 "msg_class": ' '.join(_msg_class), |
536 "msg": html_sanitize(msg)} | 536 "msg": addURLToText(html_sanitize(msg))} |
537 ) | 537 ) |
538 self.setStyleName('chatText') | 538 self.setStyleName('chatText') |
539 | 539 |
540 | 540 |
541 class Occupant(HTML): | 541 class Occupant(HTML): |