Mercurial > libervia-web
annotate src/browser/sat_browser/blog.py @ 653:e1d067378ad3 frontends_multi_profiles
browser_side: fixes sending/updating blog message/comment
author | souliane <souliane@mailoo.org> |
---|---|
date | Fri, 27 Feb 2015 01:45:34 +0100 |
parents | 0262fee86375 |
children | ebb602d8b3f2 |
rev | line source |
---|---|
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
1 #!/usr/bin/python |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
2 # -*- coding: utf-8 -*- |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
3 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
4 # Libervia: a Salut à Toi frontend |
340 | 5 # Copyright (C) 2011, 2012, 2013, 2014 Jérôme Poisson <goffi@goffi.org> |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
6 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
7 # This program is free software: you can redistribute it and/or modify |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
8 # it under the terms of the GNU Affero General Public License as published by |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
9 # the Free Software Foundation, either version 3 of the License, or |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
10 # (at your option) any later version. |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
11 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
12 # This program is distributed in the hope that it will be useful, |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
15 # GNU Affero General Public License for more details. |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
16 |
339
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
17 # You should have received a copy of the GNU Affero General Public License |
2067d6241927
fixed docstrings wrong usage for licence informations
Goffi <goffi@goffi.org>
parents:
334
diff
changeset
|
18 # along with this program. If not, see <http://www.gnu.org/licenses/>. |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
19 |
226
744426c2b699
browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents:
223
diff
changeset
|
20 import pyjd # this is dummy in pyjs |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
21 from sat.core.log import getLogger |
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
22 log = getLogger(__name__) |
449
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
23 |
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
24 from sat.core.i18n import _ |
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
25 |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
26 from pyjamas.ui.SimplePanel import SimplePanel |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
27 from pyjamas.ui.VerticalPanel import VerticalPanel |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
28 from pyjamas.ui.HorizontalPanel import HorizontalPanel |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
29 from pyjamas.ui.HTMLPanel import HTMLPanel |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
30 from pyjamas.ui.Label import Label |
83 | 31 from pyjamas.ui.Button import Button |
33 | 32 from pyjamas.ui.HTML import HTML |
83 | 33 from pyjamas.ui.Image import Image |
19 | 34 from pyjamas.ui.ClickListener import ClickHandler |
291
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
35 from pyjamas.ui.FlowPanel import FlowPanel |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
36 from pyjamas.ui.KeyboardListener import KEY_ENTER, KeyboardHandler |
323
0b7934e75e76
misc: reorganization of the file panels.py + clean the modules import:
souliane <souliane@mailoo.org>
parents:
322
diff
changeset
|
37 from pyjamas.ui.FocusListener import FocusHandler |
33 | 38 from pyjamas.Timer import Timer |
323
0b7934e75e76
misc: reorganization of the file panels.py + clean the modules import:
souliane <souliane@mailoo.org>
parents:
322
diff
changeset
|
39 |
0b7934e75e76
misc: reorganization of the file panels.py + clean the modules import:
souliane <souliane@mailoo.org>
parents:
322
diff
changeset
|
40 from datetime import datetime |
0b7934e75e76
misc: reorganization of the file panels.py + clean the modules import:
souliane <souliane@mailoo.org>
parents:
322
diff
changeset
|
41 from time import time |
449
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
42 |
467 | 43 import html_tools |
449
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
44 import dialog |
981ed669d3b3
/!\ reorganize all the file hierarchy, move the code and launching script to src:
souliane <souliane@mailoo.org>
parents:
442
diff
changeset
|
45 import richtext |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
638
diff
changeset
|
46 import editor_widget |
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
638
diff
changeset
|
47 import libervia_widget |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
48 from constants import Const as C |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
49 from sat_frontends.quick_frontend import quick_widgets |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
50 from sat_frontends.tools import jid |
279
2d6bd975a72d
browser_side: set your own presence status and display those of others
souliane <souliane@mailoo.org>
parents:
276
diff
changeset
|
51 |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
52 # TODO: at some point we should decide which behaviors to keep and remove these two constants |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
53 TOGGLE_EDITION_USE_ICON = False # set to True to use an icon inside the "toggle syntax" button |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
54 NEW_MESSAGE_USE_BUTTON = False # set to True to display the "New message" button instead of an empty entry |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
55 |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
56 unicode = str # XXX: pyjamas doesn't manage unicode |
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
57 |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
58 |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
59 class MicroblogItem(): |
226
744426c2b699
browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents:
223
diff
changeset
|
60 # XXX: should be moved in a separated module |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
61 |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
62 def __init__(self, data): |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
63 self.id = data['id'] |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
64 self.type = data.get('type', 'main_item') |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
65 self.empty = data.get('new', False) |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
66 self.title = data.get('title', '') |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
67 self.title_xhtml = data.get('title_xhtml', '') |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
68 self.content = data.get('content', '') |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
69 self.content_xhtml = data.get('content_xhtml', '') |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
70 self.author = jid.JID(data['author']) |
307
44b46db7dfef
browser_side (groupblog): order items using "published" instead of "updated"
souliane <souliane@mailoo.org>
parents:
306
diff
changeset
|
71 self.updated = float(data.get('updated', 0)) # XXX: int doesn't work here |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
72 self.published = float(data.get('published', self.updated)) # XXX: int doesn't work here |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
73 self.service = data.get('service', '') |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
74 self.node = data.get('node', '') |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
75 self.comments = data.get('comments', False) |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
76 self.comments_service = data.get('comments_service', '') |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
77 self.comments_node = data.get('comments_node', '') |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
78 |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
79 |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
80 class MicroblogEntry(SimplePanel, ClickHandler, FocusHandler, KeyboardHandler): |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
81 |
350
f1b9ec412769
browser_side: MicroblogEntry defines properties to access MicroblogItem attributes (instead of overwriting __getattr__)
souliane <souliane@mailoo.org>
parents:
349
diff
changeset
|
82 def __init__(self, blog_panel, data): |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
83 """ |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
84 @param blog_panel: the parent panel |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
85 @param data: dict containing the blog item data, or a MicroblogItem instance. |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
86 """ |
350
f1b9ec412769
browser_side: MicroblogEntry defines properties to access MicroblogItem attributes (instead of overwriting __getattr__)
souliane <souliane@mailoo.org>
parents:
349
diff
changeset
|
87 self._base_item = data if isinstance(data, MicroblogItem) else MicroblogItem(data) |
f1b9ec412769
browser_side: MicroblogEntry defines properties to access MicroblogItem attributes (instead of overwriting __getattr__)
souliane <souliane@mailoo.org>
parents:
349
diff
changeset
|
88 for attr in ['id', 'type', 'empty', 'title', 'title_xhtml', 'content', 'content_xhtml', |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
89 'author', 'updated', 'published', 'comments', 'service', 'node', |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
90 'comments_service', 'comments_node']: |
350
f1b9ec412769
browser_side: MicroblogEntry defines properties to access MicroblogItem attributes (instead of overwriting __getattr__)
souliane <souliane@mailoo.org>
parents:
349
diff
changeset
|
91 getter = lambda attr: lambda inst: getattr(inst._base_item, attr) |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
92 setter = lambda attr: lambda inst, value: setattr(inst._base_item, attr, value) |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
93 setattr(MicroblogEntry, attr, property(getter(attr), setter(attr))) |
350
f1b9ec412769
browser_side: MicroblogEntry defines properties to access MicroblogItem attributes (instead of overwriting __getattr__)
souliane <souliane@mailoo.org>
parents:
349
diff
changeset
|
94 |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
95 SimplePanel.__init__(self) |
199
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
96 self._blog_panel = blog_panel |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
97 |
291
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
98 self.panel = FlowPanel() |
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
99 self.panel.setStyleName('mb_entry') |
307
44b46db7dfef
browser_side (groupblog): order items using "published" instead of "updated"
souliane <souliane@mailoo.org>
parents:
306
diff
changeset
|
100 |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
101 self.header = HTMLPanel('') |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
102 self.panel.add(self.header) |
291
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
103 |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
104 self.entry_actions = VerticalPanel() |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
105 self.entry_actions.setStyleName('mb_entry_actions') |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
106 self.panel.add(self.entry_actions) |
291
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
107 |
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
108 entry_avatar = SimplePanel() |
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
109 entry_avatar.setStyleName('mb_entry_avatar') |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
110 assert isinstance(self.author, jid.JID) # FIXME: temporary |
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
111 self.avatar = Image(self._blog_panel.host.getAvatarURL(self.author)) # FIXME: self.author should be initially a jid.JID |
291
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
112 entry_avatar.add(self.avatar) |
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
113 self.panel.add(entry_avatar) |
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
114 |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
115 if TOGGLE_EDITION_USE_ICON: |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
116 self.entry_dialog = HorizontalPanel() |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
117 else: |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
118 self.entry_dialog = VerticalPanel() |
291
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
119 self.entry_dialog.setStyleName('mb_entry_dialog') |
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
120 self.panel.add(self.entry_dialog) |
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
121 |
119 | 122 self.add(self.panel) |
199
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
123 ClickHandler.__init__(self) |
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
124 self.addClickListener(self) |
119 | 125 |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
126 self.__pub_data = (self.service, self.node, self.id) |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
127 self.__setContent() |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
128 |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
129 def __setContent(self): |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
130 """Actually set the entry content (header, icons, bubble...)""" |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
131 self.delete_label = self.update_label = self.comment_label = None |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
132 self.bubble = self._current_comment = None |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
133 self.__setHeader() |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
134 self.__setBubble() |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
135 self.__setIcons() |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
136 |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
137 def __setHeader(self): |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
138 """Set the entry header""" |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
139 if self.empty: |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
140 return |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
141 update_text = u" — ✍ " + "<span class='mb_entry_timestamp'>%s</span>" % datetime.fromtimestamp(self.updated) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
142 self.header.setHTML("""<div class='mb_entry_header'> |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
143 <span class='mb_entry_author'>%(author)s</span> on |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
144 <span class='mb_entry_timestamp'>%(published)s</span>%(updated)s |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
145 </div>""" % {'author': html_tools.html_sanitize(unicode(self.author)), |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
146 'published': datetime.fromtimestamp(self.published), |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
147 'updated': update_text if self.published != self.updated else '' |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
148 } |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
149 ) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
150 |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
151 def __setIcons(self): |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
152 """Set the entry icons (delete, update, comment)""" |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
153 if self.empty: |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
154 return |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
155 |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
156 def addIcon(label, title): |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
157 label = Label(label) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
158 label.setTitle(title) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
159 label.addClickListener(self) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
160 self.entry_actions.add(label) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
161 return label |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
162 |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
163 if self.comments: |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
164 self.comment_label = addIcon(u"↶", "Comment this message") |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
165 self.comment_label.setStyleName('mb_entry_action_larger') |
366
39ae5bf92786
browser_side: allow one blogger to moderate the comments made on his own blog messages.
souliane <souliane@mailoo.org>
parents:
365
diff
changeset
|
166 is_publisher = self.author == self._blog_panel.host.whoami.bare |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
167 if is_publisher: |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
168 self.update_label = addIcon(u"✍", "Edit this message") |
624
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
169 if is_publisher or str(self.node).endswith(unicode(self._blog_panel.host.whoami.bare)): |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
170 self.delete_label = addIcon(u"✗", "Delete this message") |
291
89818bca1a33
browser_side: set the ideal width for the blog post update dialog
souliane <souliane@mailoo.org>
parents:
289
diff
changeset
|
171 |
119 | 172 def updateAvatar(self, new_avatar): |
173 """Change the avatar of the entry | |
174 @param new_avatar: path to the new image""" | |
175 self.avatar.setUrl(new_avatar) | |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
176 |
199
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
177 def onClick(self, sender): |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
178 if sender == self: |
322
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
179 self._blog_panel.setSelectedEntry(self) |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
180 elif sender == self.delete_label: |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
181 self._delete() |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
182 elif sender == self.update_label: |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
183 self.edit(True) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
184 elif sender == self.comment_label: |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
185 self._comment() |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
186 |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
187 def __modifiedCb(self, content): |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
188 """Send the new content to the backend |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
189 @return: False to restore the original content if a deletion has been cancelled |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
190 """ |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
191 if not content['text']: # previous content has been emptied |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
192 self._delete(True) |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
193 return False |
307
44b46db7dfef
browser_side (groupblog): order items using "published" instead of "updated"
souliane <souliane@mailoo.org>
parents:
306
diff
changeset
|
194 extra = {'published': str(self.published)} |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
195 if isinstance(self.bubble, richtext.RichTextEditor): |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
196 # TODO: if the user change his parameters after the message edition started, |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
197 # the message syntax could be different then the current syntax: pass the |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
198 # message syntax in extra for the frontend to use it instead of current syntax. |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
199 extra.update({'content_rich': content['text'], 'title': content['title']}) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
200 if self.empty: |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
201 if self.type == 'main_item': |
653
e1d067378ad3
browser_side: fixes sending/updating blog message/comment
souliane <souliane@mailoo.org>
parents:
652
diff
changeset
|
202 self._blog_panel.host.bridge.call('sendMblog', None, None, tuple(self._blog_panel.accepted_groups), content['text'], extra) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
203 else: |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
204 self._blog_panel.host.bridge.call('sendMblogComment', None, self._parent_entry.comments, content['text'], extra) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
205 else: |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
206 self._blog_panel.host.bridge.call('updateMblog', None, self.__pub_data, self.comments, content['text'], extra) |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
207 return True |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
208 |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
209 def __afterEditCb(self, content): |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
210 """Remove the entry if it was an empty one (used for creating a new blog post). |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
211 Data for the actual new blog post will be received from the bridge""" |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
212 if self.empty: |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
213 self._blog_panel.removeEntry(self.type, self.id) |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
214 if self.type == 'main_item': # restore the "New message" button |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
215 self._blog_panel.refresh() |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
216 else: # allow to create a new comment |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
217 self._parent_entry._current_comment = None |
425
19bd203daa27
browser_side: set microblog editor width to 80%
souliane <souliane@mailoo.org>
parents:
422
diff
changeset
|
218 self.entry_dialog.setWidth('auto') |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
219 try: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
220 self.toggle_syntax_button.removeFromParent() |
595
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
221 except (AttributeError, TypeError): |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
222 pass |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
223 |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
224 def __setBubble(self, edit=False): |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
225 """Set the bubble displaying the initial content.""" |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
226 content = {'text': self.content_xhtml if self.content_xhtml else self.content, |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
227 'title': self.title_xhtml if self.title_xhtml else self.title} |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
228 if self.content_xhtml: |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
229 content.update({'syntax': C.SYNTAX_XHTML}) |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
230 if self.author != self._blog_panel.host.whoami.bare: |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
231 options = ['read_only'] |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
232 else: |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
233 options = [] if self.empty else ['update_msg'] |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
234 self.bubble = richtext.RichTextEditor(self._blog_panel.host, content, self.__modifiedCb, self.__afterEditCb, options) |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
235 else: # assume raw text message have no title |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
638
diff
changeset
|
236 self.bubble = editor_widget.LightTextEditor(content, self.__modifiedCb, self.__afterEditCb, options={'no_xhtml': True}) |
425
19bd203daa27
browser_side: set microblog editor width to 80%
souliane <souliane@mailoo.org>
parents:
422
diff
changeset
|
237 self.bubble.addStyleName("bubble") |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
238 try: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
239 self.toggle_syntax_button.removeFromParent() |
595
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
240 except (AttributeError, TypeError): |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
241 pass |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
242 self.entry_dialog.add(self.bubble) |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
243 self.edit(edit) |
362
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
244 self.bubble.addEditListener(self.__showWarning) |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
245 |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
246 def __showWarning(self, sender, keycode): |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
247 if keycode == KEY_ENTER: |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
248 self._blog_panel.host.showWarning(None, None) |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
249 else: |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
250 self._blog_panel.host.showWarning(*self._blog_panel.getWarningData(self.type == 'comment')) |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
251 |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
252 def _delete(self, empty=False): |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
253 """Ask confirmation for deletion. |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
254 @return: False if the deletion has been cancelled.""" |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
255 def confirm_cb(answer): |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
256 if answer: |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
257 self._blog_panel.host.bridge.call('deleteMblog', None, self.__pub_data, self.comments) |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
258 else: # restore the text if it has been emptied during the edition |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
259 self.bubble.setContent(self.bubble._original_content) |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
260 |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
261 if self.empty: |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
262 text = _("New ") + (_("message") if self.comments else _("comment")) + _(" without body has been cancelled.") |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
263 dialog.InfoDialog(_("Information"), text).show() |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
264 return |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
265 text = "" |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
266 if empty: |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
267 text = (_("Message") if self.comments else _("Comment")) + _(" body has been emptied.<br/>") |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
268 target = _('message and all its comments') if self.comments else _('comment') |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
269 text += _("Do you really want to delete this %s?") % target |
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
270 dialog.ConfirmDialog(confirm_cb, text=text).show() |
119 | 271 |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
272 def _comment(self): |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
273 """Add an empty entry for a new comment""" |
315
09205b410a53
browser_side: handle successive click on blog post "edit" and "comment" icons
souliane <souliane@mailoo.org>
parents:
314
diff
changeset
|
274 if self._current_comment: |
351
c943fd54c90e
browser_side: heavy refactorisation for microblogs:
souliane <souliane@mailoo.org>
parents:
350
diff
changeset
|
275 self._current_comment.bubble.setFocus(True) |
496
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
276 self._blog_panel.setSelectedEntry(self._current_comment, True) |
315
09205b410a53
browser_side: handle successive click on blog post "edit" and "comment" icons
souliane <souliane@mailoo.org>
parents:
314
diff
changeset
|
277 return |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
278 data = {'id': str(time()), |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
279 'new': True, |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
280 'type': 'comment', |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
281 'author': unicode(self._blog_panel.host.whoami.bare), |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
282 'service': self.comments_service, |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
283 'node': self.comments_node |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
284 } |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
285 entry = self._blog_panel.addEntry(data) |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
286 if entry is None: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
287 log.info("The entry of id %s can not be commented" % self.id) |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
288 return |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
289 entry._parent_entry = self |
315
09205b410a53
browser_side: handle successive click on blog post "edit" and "comment" icons
souliane <souliane@mailoo.org>
parents:
314
diff
changeset
|
290 self._current_comment = entry |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
291 self.edit(True, entry) |
496
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
292 self._blog_panel.setSelectedEntry(entry, True) |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
293 |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
294 def edit(self, edit, entry=None): |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
295 """Toggle the bubble between display and edit mode |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
296 @edit: boolean value |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
297 @entry: MicroblogEntry instance, or None to use self |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
298 """ |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
299 if entry is None: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
300 entry = self |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
301 try: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
302 entry.toggle_syntax_button.removeFromParent() |
595
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
303 except (AttributeError, TypeError): |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
304 pass |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
305 entry.bubble.edit(edit) |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
306 if edit: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
307 if isinstance(entry.bubble, richtext.RichTextEditor): |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
308 image = '<a class="richTextIcon">A</a>' |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
309 html = '<a style="color: blue;">raw text</a>' |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
310 title = _('Switch to raw text edition') |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
311 else: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
312 image = '<img src="media/icons/tango/actions/32/format-text-italic.png" class="richTextIcon"/>' |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
313 html = '<a style="color: blue;">rich text</a>' |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
314 title = _('Switch to rich text edition') |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
315 if TOGGLE_EDITION_USE_ICON: |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
316 entry.entry_dialog.setWidth('80%') |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
317 entry.toggle_syntax_button = Button(image, entry.toggleContentSyntax) |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
318 entry.toggle_syntax_button.setTitle(title) |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
319 entry.entry_dialog.add(entry.toggle_syntax_button) |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
320 else: |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
321 entry.toggle_syntax_button = HTML(html) |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
322 entry.toggle_syntax_button.addClickListener(entry.toggleContentSyntax) |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
323 entry.toggle_syntax_button.addStyleName('mb_entry_toggle_syntax') |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
324 entry.entry_dialog.add(entry.toggle_syntax_button) |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
325 entry.toggle_syntax_button.setStyleAttribute('top', '-20px') # XXX: need to force CSS |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
326 entry.toggle_syntax_button.setStyleAttribute('left', '-20px') |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
327 |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
328 def toggleContentSyntax(self): |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
329 """Toggle the editor between raw and rich text""" |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
330 original_content = self.bubble.getOriginalContent() |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
331 rich = not isinstance(self.bubble, richtext.RichTextEditor) |
400
487dd238ab88
browser_side: bug fixes for microblog raw/rich edition toggle
souliane <souliane@mailoo.org>
parents:
397
diff
changeset
|
332 if rich: |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
333 original_content['syntax'] = C.SYNTAX_XHTML |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
334 |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
335 def setBubble(text): |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
336 self.content = text |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
337 self.content_xhtml = text if rich else '' |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
338 self.content_title = self.content_title_xhtml = '' |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
339 self.bubble.removeFromParent() |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
340 self.__setBubble(True) |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
341 self.bubble.setOriginalContent(original_content) |
400
487dd238ab88
browser_side: bug fixes for microblog raw/rich edition toggle
souliane <souliane@mailoo.org>
parents:
397
diff
changeset
|
342 if rich: |
487dd238ab88
browser_side: bug fixes for microblog raw/rich edition toggle
souliane <souliane@mailoo.org>
parents:
397
diff
changeset
|
343 self.bubble.setDisplayContent() # needed in case the edition is aborted, to not end with an empty bubble |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
344 |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
345 text = self.bubble.getContent()['text'] |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
346 if not text: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
347 setBubble(' ') # something different than empty string is needed to initialize the rich text editor |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
348 return |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
349 if not rich: |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
350 def confirm_cb(answer): |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
351 if answer: |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
352 self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, C.SYNTAX_CURRENT, C.SYNTAX_TEXT) |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
353 dialog.ConfirmDialog(confirm_cb, text=_("Do you really want to lose the title and text formatting?")).show() |
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
354 else: |
433
bbdbee25123a
import constants.Const as C (according to the coding rules)
souliane <souliane@mailoo.org>
parents:
432
diff
changeset
|
355 self._blog_panel.host.bridge.call('syntaxConvert', setBubble, text, C.SYNTAX_TEXT, C.SYNTAX_XHTML) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
356 |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
357 |
648
6d3142b782c3
browser_side: classes reorganisation:
Goffi <goffi@goffi.org>
parents:
638
diff
changeset
|
358 class MicroblogPanel(quick_widgets.QuickWidget, libervia_widget.LiberviaWidget): |
499
ec3f30253040
browser_side: also display the warning banner when writing to a single contact and unibox is disabled
souliane <souliane@mailoo.org>
parents:
498
diff
changeset
|
359 warning_msg_public = "This message will be <b>PUBLIC</b> and everybody will be able to see it, even people you don't know" |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
360 warning_msg_group = "This message will be published for all the people of the following groups: <span class='warningTarget'>%s</span>" |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
361 # FIXME: all the generic parts must be moved to quick_frontends |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
362 |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
363 def __init__(self, host, targets, profiles=None): |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
364 """Panel used to show microblog |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
365 |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
366 @param targets (tuple(unicode)): contact groups displayed in this panel. |
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
367 If empty, show all microblogs from all contacts. |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
368 """ |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
369 # do not mix self.targets (set of tuple of unicode) and self.accepted_groups (set of unicode) |
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
370 quick_widgets.QuickWidget.__init__(self, host, targets, C.PROF_KEY_NONE) |
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
371 libervia_widget.LiberviaWidget.__init__(self, host, ", ".join(self.accepted_groups), selectable=True) |
58
4fa3d57f72f8
browser side: microblog entries caching
Goffi <goffi@goffi.org>
parents:
57
diff
changeset
|
372 self.entries = {} |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
373 self.comments = {} |
199
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
374 self.selected_entry = None |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
375 self.vpanel = VerticalPanel() |
83 | 376 self.vpanel.setStyleName('microblogPanel') |
34 | 377 self.setWidget(self.vpanel) |
624
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
378 |
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
379 # FIXME: workaround for a pyjamas issue: calling hash on a class method always return a different value if that method is defined directly within the class (with the "def" keyword) |
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
380 self.avatarListener = self.onAvatarUpdate |
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
381 host.addListener('avatar', self.avatarListener, [C.PROF_KEY_NONE]) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
382 |
595
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
383 def __str__(self): |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
384 return u"Blog Widget [target: {}, profile: {}]".format(', '.join(self.accepted_groups), self.profile) |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
385 |
607
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
386 def onDelete(self): |
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
387 quick_widgets.QuickWidget.onDelete(self) |
624
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
388 self.host.removeListener('avatar', self.avatarListener) |
607
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
389 |
638
63697f082e8a
browser side: fixed use of profile for listeners
Goffi <goffi@goffi.org>
parents:
624
diff
changeset
|
390 def onAvatarUpdate(self, jid_, hash_, profile): |
607
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
391 """Called on avatar update events |
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
392 |
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
393 @param jid_: jid of the entity with updated avatar |
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
394 @param hash_: hash of the avatar |
638
63697f082e8a
browser side: fixed use of profile for listeners
Goffi <goffi@goffi.org>
parents:
624
diff
changeset
|
395 @param profile: %(doc_profile)s |
607
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
396 """ |
624
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
397 whoami = self.host.profiles[self.profile].whoami |
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
398 if self.isJidAccepted(jid_) or jid_.bare == whoami.bare: |
607
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
399 self.updateValue('avatar', jid_, hash_) |
537649f6a2d0
browser side (blog, contact list): use of new listener mechanism to update avatar
Goffi <goffi@goffi.org>
parents:
606
diff
changeset
|
400 |
326
36927be51481
browser_side: fixed the behavior regarding "Enable unibox" parameter:
souliane <souliane@mailoo.org>
parents:
323
diff
changeset
|
401 def refresh(self): |
36927be51481
browser_side: fixed the behavior regarding "Enable unibox" parameter:
souliane <souliane@mailoo.org>
parents:
323
diff
changeset
|
402 """Refresh the display of this widget. If the unibox is disabled, |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
403 display the 'New message' button or an empty bubble on top of the panel""" |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
404 if hasattr(self, 'new_button'): |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
405 self.new_button.setVisible(self.host.uni_box is None) |
326
36927be51481
browser_side: fixed the behavior regarding "Enable unibox" parameter:
souliane <souliane@mailoo.org>
parents:
323
diff
changeset
|
406 return |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
407 if self.host.uni_box is None: |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
408 def addBox(): |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
409 if hasattr(self, 'new_button'): |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
410 self.new_button.setVisible(False) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
411 data = {'id': str(time()), |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
412 'new': True, |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
413 'author': unicode(self.host.whoami.bare), |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
414 } |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
415 entry = self.addEntry(data) |
395
98cd5387d291
browser_side: new microblogs are not using the rich text editor by default:
souliane <souliane@mailoo.org>
parents:
394
diff
changeset
|
416 entry.edit(True) |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
417 if NEW_MESSAGE_USE_BUTTON: |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
418 self.new_button = Button("New message", listener=addBox) |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
419 self.new_button.setStyleName("microblogNewButton") |
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
420 self.vpanel.insert(self.new_button, 0) |
461
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
421 elif not self.getNewMainEntry(): |
442
17259c2ff96f
browser_side: changes about the UI (remarks from Franck):
souliane <souliane@mailoo.org>
parents:
439
diff
changeset
|
422 addBox() |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
423 |
461
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
424 def getNewMainEntry(self): |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
425 """Get the new entry being edited, or None if it doesn't exists. |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
426 |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
427 @return (MicroblogEntry): the new entry being edited. |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
428 """ |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
429 try: |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
430 first = self.vpanel.children[0] |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
431 except IndexError: |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
432 return None |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
433 assert(first.type == 'main_item') |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
434 return first if first.empty else None |
4f25aa5039b3
browser_side: avoid adding more than one new message bubble on top of the microblog panel
souliane <souliane@mailoo.org>
parents:
451
diff
changeset
|
435 |
598
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
436 @staticmethod |
651
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
437 def onGroupDrop(host, targets): |
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
438 """Create a microblog panel for one, several or all contact groups. |
195 | 439 |
617
5baca9d46c34
browser_side: add/improve some docstrings
souliane <souliane@mailoo.org>
parents:
616
diff
changeset
|
440 @param host (SatWebFrontend): the SatWebFrontend instance |
651
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
441 @param targets (tuple(unicode)): tuple of groups (empty for "all groups") |
230
266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
souliane <souliane@mailoo.org>
parents:
226
diff
changeset
|
442 @return: the created MicroblogPanel |
266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
souliane <souliane@mailoo.org>
parents:
226
diff
changeset
|
443 """ |
651
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
444 type_ = 'ALL' if not targets else 'GROUP' |
230
266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
souliane <souliane@mailoo.org>
parents:
226
diff
changeset
|
445 # XXX: pyjamas doesn't support use of cls directly |
651
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
446 widget = host.displayWidget(MicroblogPanel, targets, dropped=True) |
598
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
447 host.FillMicroblogPanel(widget) |
651
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
448 host.bridge.getMassiveLastMblogs(type_, targets, 10, profile=C.PROF_KEY_NONE, callback=widget.massiveInsert) |
598
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
449 widget.refresh() # FIXME: needed ? |
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
450 return widget |
230
266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
souliane <souliane@mailoo.org>
parents:
226
diff
changeset
|
451 |
266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
souliane <souliane@mailoo.org>
parents:
226
diff
changeset
|
452 @property |
266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
souliane <souliane@mailoo.org>
parents:
226
diff
changeset
|
453 def accepted_groups(self): |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
454 """Return a set of the accepted groups""" |
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
455 return set().union(*self.targets) |
195 | 456 |
362
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
457 def getWarningData(self, comment=None): |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
458 """ |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
459 @param comment: True if the composed message is a comment. If None, consider we are |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
460 composing from the unibox and guess the message type from self.selected_entry |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
461 @return: a couple (type, msg) for calling self.host.showWarning""" |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
462 if comment is None: # composing from the unibox |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
463 if self.selected_entry and not self.selected_entry.comments: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
464 log.error("an item without comment is selected") |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
465 return ("NONE", None) |
362
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
466 comment = self.selected_entry is not None |
019e1e706e74
browser_side: display the popup notifying the message's recipient when you edit the blog entry's bubble.
souliane <souliane@mailoo.org>
parents:
361
diff
changeset
|
467 if comment: |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
468 return ("PUBLIC", "This is a <span class='warningTarget'>comment</span> and keep the initial post visibility, so it is potentialy public") |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
469 elif not self.accepted_groups: |
201
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
470 # we have a meta MicroblogPanel, we publish publicly |
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
471 return ("PUBLIC", self.warning_msg_public) |
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
472 else: |
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
473 # FIXME: manage several groups |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
474 return ("GROUP", self.warning_msg_group % ' '.join(self.accepted_groups)) |
201
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
475 |
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
476 def onTextEntered(self, text): |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
477 if self.selected_entry: |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
478 # we are entering a comment |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
479 comments_url = self.selected_entry.comments |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
480 if not comments_url: |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
481 raise Exception("ERROR: the comments URL is empty") |
653
e1d067378ad3
browser_side: fixes sending/updating blog message/comment
souliane <souliane@mailoo.org>
parents:
652
diff
changeset
|
482 self.bridge.call("sendMblogComment", None, comments_url, text, {}) |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
483 target = ("COMMENT", comments_url) |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
484 elif not self.accepted_groups: |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
485 # we are entering a public microblog |
653
e1d067378ad3
browser_side: fixes sending/updating blog message/comment
souliane <souliane@mailoo.org>
parents:
652
diff
changeset
|
486 self.bridge.call("sendMblog", None, "PUBLIC", (), text, {}) |
201
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
487 else: |
653
e1d067378ad3
browser_side: fixes sending/updating blog message/comment
souliane <souliane@mailoo.org>
parents:
652
diff
changeset
|
488 self.bridge.call("sendMblog", None, "GROUP", tuple(self.accepted_groups), text, {}) |
201
aa76793da353
server + browser: message warning level/sending refactoring:
Goffi <goffi@goffi.org>
parents:
200
diff
changeset
|
489 |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
490 def accept_all(self): |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
491 return not self.accepted_groups # we accept every microblog only if we are not filtering by groups |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
492 |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
493 def getEntries(self): |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
494 """Ask all the entries for the currenly accepted groups, |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
495 and fill the panel""" |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
496 |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
497 def massiveInsert(self, mblogs): |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
498 """Insert several microblogs at once |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
499 @param mblogs: dictionary of microblogs, as the result of getMassiveLastGroupBlogs |
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
500 """ |
579
4a0f2f294ea2
browser_side (blogs): massive insertion display the actual number of blogs being inserted
souliane <souliane@mailoo.org>
parents:
577
diff
changeset
|
501 count = sum([len(value) for value in mblogs.values()]) |
4a0f2f294ea2
browser_side (blogs): massive insertion display the actual number of blogs being inserted
souliane <souliane@mailoo.org>
parents:
577
diff
changeset
|
502 log.debug("Massive insertion of %d microblogs" % count) |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
503 for publisher in mblogs: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
504 log.debug("adding blogs for [%s]" % publisher) |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
505 for mblog in mblogs[publisher]: |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
506 if not "content" in mblog: |
580
79fbc20c786b
browser_side: fixes call to logging method with more than one argument
souliane <souliane@mailoo.org>
parents:
579
diff
changeset
|
507 log.warning("No content found in microblog [%s]" % mblog) |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
508 continue |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
509 self.addEntry(mblog) |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
510 |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
511 def mblogsInsert(self, mblogs): |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
512 """ Insert several microblogs at once |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
513 @param mblogs: list of microblogs |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
514 """ |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
515 for mblog in mblogs: |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
516 if not "content" in mblog: |
580
79fbc20c786b
browser_side: fixes call to logging method with more than one argument
souliane <souliane@mailoo.org>
parents:
579
diff
changeset
|
517 log.warning("No content found in microblog [%s]" % mblog) |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
518 continue |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
519 self.addEntry(mblog) |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
520 |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
521 def _chronoInsert(self, vpanel, entry, reverse=True): |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
522 """ Insert an entry in chronological order |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
523 @param vpanel: VerticalPanel instance |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
524 @param entry: MicroblogEntry |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
525 @param reverse: more recent entry on top if True, chronological order else""" |
463
b62c1cf0dbf7
browser side: a new message being edited should always stay on top position (or last position for a comment)
souliane <souliane@mailoo.org>
parents:
462
diff
changeset
|
526 assert(isinstance(reverse, bool)) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
527 if entry.empty: |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
528 entry.published = time() |
135
ceef355156de
server + browser side: groupblog subscription + fixed blog insertion order
Goffi <goffi@goffi.org>
parents:
132
diff
changeset
|
529 # we look for the right index to insert our entry: |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
530 # if reversed, we insert the entry above the first entry |
135
ceef355156de
server + browser side: groupblog subscription + fixed blog insertion order
Goffi <goffi@goffi.org>
parents:
132
diff
changeset
|
531 # in the past |
ceef355156de
server + browser side: groupblog subscription + fixed blog insertion order
Goffi <goffi@goffi.org>
parents:
132
diff
changeset
|
532 idx = 0 |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
533 |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
534 for child in vpanel.children: |
135
ceef355156de
server + browser side: groupblog subscription + fixed blog insertion order
Goffi <goffi@goffi.org>
parents:
132
diff
changeset
|
535 if not isinstance(child, MicroblogEntry): |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
536 idx += 1 |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
537 continue |
463
b62c1cf0dbf7
browser side: a new message being edited should always stay on top position (or last position for a comment)
souliane <souliane@mailoo.org>
parents:
462
diff
changeset
|
538 condition_to_stop = child.empty or (child.published > entry.published) |
b62c1cf0dbf7
browser side: a new message being edited should always stay on top position (or last position for a comment)
souliane <souliane@mailoo.org>
parents:
462
diff
changeset
|
539 if condition_to_stop != reverse: # != is XOR |
b62c1cf0dbf7
browser side: a new message being edited should always stay on top position (or last position for a comment)
souliane <souliane@mailoo.org>
parents:
462
diff
changeset
|
540 break |
210
3092f6b1710c
browser side: make the OK button title for group selector configureable + few "cosmetic" changes (PEP 8...)
souliane <souliane@mailoo.org>
parents:
206
diff
changeset
|
541 idx += 1 |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
542 |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
543 vpanel.insert(entry, idx) |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
544 |
597
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
545 |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
546 def addEntryIfAccepted(self, sender, groups, mblog_entry): |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
547 """Check if an entry can go in MicroblogPanel and add to it |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
548 |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
549 @param sender(jid.JID): jid of the entry sender |
597
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
550 @param groups: groups which can receive this entry |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
551 @param mblog_entry: panels.MicroblogItem instance |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
552 """ |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
553 assert isinstance(sender, jid.JID) # FIXME temporary |
597
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
554 if (mblog_entry.type == "comment" |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
555 or self.isJidAccepted(sender) |
624
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
556 or (groups is None and sender == self.host.profiles[self.profile].whoami.bare) |
597
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
557 or (groups and groups.intersection(self.accepted_groups))): |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
558 self.addEntry(mblog_entry) |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
559 |
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
560 def addEntry(self, data, ignore_invalid=False): |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
561 """Add an entry to the panel |
597
be2891462e63
browser side (blog): added addEntryIfAccepeted method in MicroblogPanel, so it decide itself is an entry should be added, it's not done anymore in libervia_main.
Goffi <goffi@goffi.org>
parents:
595
diff
changeset
|
562 |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
563 @param data: dict containing the item data |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
564 @return: the added entry, or None |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
565 """ |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
566 _entry = MicroblogEntry(self, data) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
567 if _entry.type == "comment": |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
568 comments_hash = (_entry.service, _entry.node) |
624
9092e624bb27
browser_side: fixes various issues
souliane <souliane@mailoo.org>
parents:
622
diff
changeset
|
569 if comments_hash not in self.comments: |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
570 # The comments node is not known in this panel |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
571 return None |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
572 parent = self.comments[comments_hash] |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
573 parent_idx = self.vpanel.getWidgetIndex(parent) |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
574 # we find or create the panel where the comment must be inserted |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
575 try: |
226
744426c2b699
browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents:
223
diff
changeset
|
576 sub_panel = self.vpanel.getWidget(parent_idx + 1) |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
577 except IndexError: |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
578 sub_panel = None |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
579 if not sub_panel or not isinstance(sub_panel, VerticalPanel): |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
580 sub_panel = VerticalPanel() |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
581 sub_panel.setStyleName('microblogPanel') |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
582 sub_panel.addStyleName('subPanel') |
226
744426c2b699
browser_side, misc: better PEP8 compliance
souliane <souliane@mailoo.org>
parents:
223
diff
changeset
|
583 self.vpanel.insert(sub_panel, parent_idx + 1) |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
584 for idx in xrange(0, len(sub_panel.getChildren())): |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
585 comment = sub_panel.getIndexedChild(idx) |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
586 if comment.id == _entry.id: |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
587 # update an existing comment |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
588 sub_panel.remove(comment) |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
589 sub_panel.insert(_entry, idx) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
590 return _entry |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
591 # we want comments to be inserted in chronological order |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
592 self._chronoInsert(sub_panel, _entry, reverse=False) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
593 return _entry |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
594 |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
595 if _entry.id in self.entries: # update |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
596 idx = self.vpanel.getWidgetIndex(self.entries[_entry.id]) |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
597 self.vpanel.remove(self.entries[_entry.id]) |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
598 self.vpanel.insert(_entry, idx) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
599 else: # new entry |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
600 self._chronoInsert(self.vpanel, _entry) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
601 self.entries[_entry.id] = _entry |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
602 |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
603 if _entry.comments: |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
604 # entry has comments, we keep the comments service/node as a reference |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
605 comments_hash = (_entry.comments_service, _entry.comments_node) |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
606 self.comments[comments_hash] = _entry |
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
607 self.host.bridge.call('getMblogComments', self.mblogsInsert, _entry.comments_service, _entry.comments_node) |
312
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
608 |
b4781a350483
browser_side: display a "New message" button and add a "comment" icon for main entries in MicroblogPanel when the unibox is disabled
souliane <souliane@mailoo.org>
parents:
311
diff
changeset
|
609 return _entry |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
610 |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
611 def removeEntry(self, type_, id_): |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
612 """Remove an entry from the panel |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
613 @param type_: entry type ('main_item' or 'comment') |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
614 @param id_: entry id |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
615 """ |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
616 for child in self.vpanel.getChildren(): |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
617 if isinstance(child, MicroblogEntry) and type_ == 'main_item': |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
618 if child.id == id_: |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
619 main_idx = self.vpanel.getWidgetIndex(child) |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
620 try: |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
621 sub_panel = self.vpanel.getWidget(main_idx + 1) |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
622 if isinstance(sub_panel, VerticalPanel): |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
623 sub_panel.removeFromParent() |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
624 except IndexError: |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
625 pass |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
626 child.removeFromParent() |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
627 self.selected_entry = None |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
628 break |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
629 elif isinstance(child, VerticalPanel) and type_ == 'comment': |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
630 for comment in child.getChildren(): |
365
a74a2dfbe4f5
browser_side: groupblog: handle main items with no associated comments node + do not mix up attributes names between the item own service/node and the comments service/node
souliane <souliane@mailoo.org>
parents:
362
diff
changeset
|
631 if comment.id == id_: |
282
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
632 comment.removeFromParent() |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
633 self.selected_entry = None |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
634 break |
ae3ec654836d
browser_side: added blog item modification/deletion
souliane <souliane@mailoo.org>
parents:
279
diff
changeset
|
635 |
496
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
636 def ensureVisible(self, entry): |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
637 """Scroll to an entry to ensure its visibility |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
638 |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
639 @param entry (MicroblogEntry): the entry |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
640 """ |
322
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
641 try: |
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
642 self.vpanel.getParent().ensureVisible(entry) # scroll to the clicked entry |
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
643 except AttributeError: |
439
d52f529a6d42
browser side: use of new log system (first draft):
Goffi <goffi@goffi.org>
parents:
433
diff
changeset
|
644 log.warning("FIXME: MicroblogPanel.vpanel should be wrapped in a ScrollPanel!") |
496
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
645 |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
646 def setSelectedEntry(self, entry, ensure_visible=False): |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
647 """Select an entry. |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
648 |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
649 @param entry (MicroblogEntry): the entry to select |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
650 @param ensure_visible (boolean): if True, also scroll to the entry |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
651 """ |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
652 if ensure_visible: |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
653 self.ensureVisible(entry) |
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
654 |
322
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
655 if not self.host.uni_box or not entry.comments: |
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
656 entry.addStyleName('selected_entry') # blink the clicked entry |
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
657 clicked_entry = entry # entry may be None when the timer is done |
496
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
658 Timer(500, lambda timer: clicked_entry.removeStyleName('selected_entry')) |
322
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
659 if not self.host.uni_box: |
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
660 return # unibox is disabled |
496
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
661 |
322
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
662 # from here the previous behavior (toggle main item selection) is conserved |
971e3812903a
browser_side: scroll to the clicked microblog post and blink it (previous behavior is conserved when the unibox is enabled)
souliane <souliane@mailoo.org>
parents:
319
diff
changeset
|
663 entry = entry if entry.comments else None |
199
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
664 if self.selected_entry == entry: |
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
665 entry = None |
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
666 if self.selected_entry: |
496
0924710b666a
browser_side: remove the annoying (esp. when editing a message) scrolling each time you select a microblog entry
souliane <souliane@mailoo.org>
parents:
495
diff
changeset
|
667 self.selected_entry.removeStyleName('selected_entry') |
199
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
668 if entry: |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
669 log.debug("microblog entry selected (author=%s)" % unicode(entry.author)) |
199
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
670 entry.addStyleName('selected_entry') |
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
671 self.selected_entry = entry |
39311c7dad77
browser side: it is now possible to select a microblog panel or an entry inside it
Goffi <goffi@goffi.org>
parents:
195
diff
changeset
|
672 |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
673 def updateValue(self, type_, jid_, value): |
119 | 674 """Update a jid value in entries |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
675 |
241
86055ccf69c3
browser_side: added class PopupMenuPanel to manage more complex context menu
souliane <souliane@mailoo.org>
parents:
239
diff
changeset
|
676 @param type_: one of 'avatar', 'nick' |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
677 @param jid_(jid.JID): jid concerned |
119 | 678 @param value: new value""" |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
679 assert isinstance(jid_, jid.JID) # FIXME: temporary |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
680 def updateVPanel(vpanel): |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
681 avatar_url = self.host.getAvatarURL(jid_) |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
682 for child in vpanel.children: |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
683 if isinstance(child, MicroblogEntry) and child.author == jid_: |
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
684 child.updateAvatar(avatar_url) |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
685 elif isinstance(child, VerticalPanel): |
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
686 updateVPanel(child) |
241
86055ccf69c3
browser_side: added class PopupMenuPanel to manage more complex context menu
souliane <souliane@mailoo.org>
parents:
239
diff
changeset
|
687 if type_ == 'avatar': |
202
2bc6cf004e61
browser, server: comments handling:
Goffi <goffi@goffi.org>
parents:
201
diff
changeset
|
688 updateVPanel(self.vpanel) |
119 | 689 |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
690 def addAcceptedGroups(self, groups): |
230
266e9678eec0
browser_side: added the flag REUSE_EXISTING_LIBERVIA_WIDGETS
souliane <souliane@mailoo.org>
parents:
226
diff
changeset
|
691 """Add one or more group(s) which can be displayed in this panel. |
589
a5019e62c3e9
browser side: big refactoring to base Libervia on QuickFrontend, first draft:
Goffi <goffi@goffi.org>
parents:
585
diff
changeset
|
692 |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
693 @param groups (tuple(unicode)): tuple of groups to add |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
694 """ |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
695 # FIXME: update the widget's hash in QuickApp._widgets[MicroblogPanel] |
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
696 self.targets.update(groups) |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
697 |
595
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
698 def isJidAccepted(self, jid_): |
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
699 """Tell if a jid is actepted and must be shown in this panel |
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
700 |
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
701 @param jid_(jid.JID): jid to check |
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
702 @return: True if the jid is accepted |
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
703 """ |
606
7af8f4ab3675
browser side: fixed avatar getting + better DEFAULT/EMPTY avatars constants + use of jid.JID for microblog's author
Goffi <goffi@goffi.org>
parents:
598
diff
changeset
|
704 assert isinstance(jid_, jid.JID) # FIXME temporary |
132
30d8e328559b
server & browser side: microblogging refactoring first draft
Goffi <goffi@goffi.org>
parents:
131
diff
changeset
|
705 if self.accept_all(): |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
706 return True |
652
0262fee86375
browser_side: MicroblogPanel.accepted_groups (set of unicode) is now built from QuickWidget.targets (set of tuple of unicode)
souliane <souliane@mailoo.org>
parents:
651
diff
changeset
|
707 for group in self.accepted_groups: |
595
d78126d82ca0
browser side (blog module): fixed isJidAccepted + added __str__ method to facilitate debugging + use of AttributeError and TypeError in some exception (because pyjamas can raise both depending on compilation options)
Goffi <goffi@goffi.org>
parents:
589
diff
changeset
|
708 if self.host.contact_lists[self.profile].isEntityInGroup(jid_, group): |
18
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
709 return True |
795d144fc1d2
moved panels and menu in a separate file
Goffi <goffi@goffi.org>
parents:
diff
changeset
|
710 return False |
598
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
711 |
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
712 |
651
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
713 libervia_widget.LiberviaWidget.addDropKey("GROUP", lambda host, item: MicroblogPanel.onGroupDrop(host, (item,))) |
598
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
714 |
ed6d8f7c6026
browser side (blog, chat): fixed dropKey callbacks to adapt them to new widget creation system. Drag'n'Drop should be fixed.
Goffi <goffi@goffi.org>
parents:
597
diff
changeset
|
715 # Needed for the drop keys to not be mixed between meta panel and panel for "Contacts" group |
651
2df91d0308ac
browser_side, server_side: MicroblogPanel.onGroupDrop and bridge method getMassiveLastMBlogs now only accepts the publishers as a set of unicode (no more None value or single unicode).
souliane <souliane@mailoo.org>
parents:
648
diff
changeset
|
716 libervia_widget.LiberviaWidget.addDropKey("CONTACT_TITLE", lambda host, item: MicroblogPanel.onGroupDrop(host, ())) |