Mercurial > libervia-web
comparison browser_side/contact.py @ 51:9f19e16187ff
browser side: HTML sanitization
author | Goffi <goffi@goffi.org> |
---|---|
date | Thu, 26 May 2011 23:03:45 +0200 |
parents | 7cabe3c1a5f2 |
children | f25c4077f6b9 |
comparison
equal
deleted
inserted
replaced
50:72c51a4839cc | 51:9f19e16187ff |
---|---|
28 from pyjamas import DOM | 28 from pyjamas import DOM |
29 | 29 |
30 from pyjamas.dnd import makeDraggable | 30 from pyjamas.dnd import makeDraggable |
31 from pyjamas.ui.DragWidget import DragWidget, DragContainer | 31 from pyjamas.ui.DragWidget import DragWidget, DragContainer |
32 from jid import JID | 32 from jid import JID |
33 from tools import html_sanitize | |
33 | 34 |
34 class DragLabel(DragWidget): | 35 class DragLabel(DragWidget): |
35 | 36 |
36 def __init__(self, text, type): | 37 def __init__(self, text, type): |
37 DragWidget.__init__(self) | 38 DragWidget.__init__(self) |
63 #parent.addMessage(message) | 64 #parent.addMessage(message) |
64 | 65 |
65 class GroupLabel(DragLabel, Label): | 66 class GroupLabel(DragLabel, Label): |
66 def __init__(self, group): | 67 def __init__(self, group): |
67 self.group = group | 68 self.group = group |
68 Label.__init__(self, group) #, Element=DOM.createElement('div') | 69 Label.__init__(self, html_sanitize(group)) #, Element=DOM.createElement('div') |
69 self.setStyleName('group') | 70 self.setStyleName('group') |
70 DragLabel.__init__(self, group, "GROUP") | 71 DragLabel.__init__(self, group, "GROUP") |
71 | 72 |
72 | 73 |
73 class ContactLabel(DragLabel, Label): | 74 class ContactLabel(DragLabel, Label): |
74 def __init__(self, jid, name=None): | 75 def __init__(self, jid, name=None): |
75 if not name: | 76 if not name: |
76 name=jid | 77 name=jid |
77 Label.__init__(self, name) | 78 Label.__init__(self, html_sanitize(name)) |
78 self.jid=jid | 79 self.jid=jid |
79 self.setStyleName('contact') | 80 self.setStyleName('contact') |
80 DragLabel.__init__(self, jid, "CONTACT") | 81 DragLabel.__init__(self, jid, "CONTACT") |
81 | 82 |
82 class GroupList(VerticalPanel): | 83 class GroupList(VerticalPanel): |