comparison src/browser/sat_browser/base_panels.py @ 468:830b50593597

browser_side: fixes issues from the refactoring
author souliane <souliane@mailoo.org>
date Tue, 10 Jun 2014 01:15:13 +0200
parents 97c72fe4a5f2
children c97fe4059f71
comparison
equal deleted inserted replaced
467:97c72fe4a5f2 468:830b50593597
53 _msg_class = ["chat_text_msg"] 53 _msg_class = ["chat_text_msg"]
54 if mymess: 54 if mymess:
55 _msg_class.append("chat_text_mymess") 55 _msg_class.append("chat_text_mymess")
56 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>" % 56 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>" %
57 {"timestamp": _date.strftime("%H:%M"), 57 {"timestamp": _date.strftime("%H:%M"),
58 "nick": "[%s]" % html_tools.sanitize(nick), 58 "nick": "[%s]" % html_tools.html_sanitize(nick),
59 "msg_class": ' '.join(_msg_class), 59 "msg_class": ' '.join(_msg_class),
60 "msg": strings.addURLToText(html_tools.sanitize(msg)) if not xhtml else html_tools.inlineRoot(xhtml)} # FIXME: images and external links must be removed according to preferences 60 "msg": strings.addURLToText(html_tools.html_sanitize(msg)) if not xhtml else html_tools.inlineRoot(xhtml)} # FIXME: images and external links must be removed according to preferences
61 ) 61 )
62 self.setStyleName('chatText') 62 self.setStyleName('chatText')
63 63
64 64
65 class Occupant(HTML): 65 class Occupant(HTML):
99 self._refresh() 99 self._refresh()
100 100
101 def _refresh(self): 101 def _refresh(self):
102 state = (' %s' % C.MUC_USER_STATES[self._state]) if self._state else '' 102 state = (' %s' % C.MUC_USER_STATES[self._state]) if self._state else ''
103 special = "" if len(self.special) == 0 else " %s" % self.special 103 special = "" if len(self.special) == 0 else " %s" % self.special
104 self.setHTML("<div class='occupant'>%s%s%s</div>" % (html_tools.sanitize(self.nick), special, state)) 104 self.setHTML("<div class='occupant'>%s%s%s</div>" % (html_tools.html_sanitize(self.nick), special, state))
105 105
106 106
107 class OccupantsList(AbsolutePanel): 107 class OccupantsList(AbsolutePanel):
108 """Panel user to show occupants of a room""" 108 """Panel user to show occupants of a room"""
109 109
478 if self.options['listen_focus']: 478 if self.options['listen_focus']:
479 FocusHandler.__init__(self) 479 FocusHandler.__init__(self)
480 if self.options['listen_click']: 480 if self.options['listen_click']:
481 ClickHandler.__init__(self) 481 ClickHandler.__init__(self)
482 KeyboardHandler.__init__(self) 482 KeyboardHandler.__init__(self)
483 strproc = lambda text: html_tools.sanitize(html_tools.html_strip(text)) if self.options['no_xhtml'] else html_tools.html_strip(text) 483 strproc = lambda text: html_tools.html_sanitize(html_tools.html_strip(text)) if self.options['no_xhtml'] else html_tools.html_strip(text)
484 BaseTextEditor.__init__(self, content, strproc, modifiedCb, afterEditCb) 484 BaseTextEditor.__init__(self, content, strproc, modifiedCb, afterEditCb)
485 self.textarea = self.display = None 485 self.textarea = self.display = None
486 486
487 def setContent(self, content=None): 487 def setContent(self, content=None):
488 BaseTextEditor.setContent(self, content) 488 BaseTextEditor.setContent(self, content)