From 45b2c49c589bec50306a1a8722a16ab8e491d802 Mon Sep 17 00:00:00 2001 From: Boris 'billiob' Faure Date: Tue, 24 Aug 2010 22:55:18 +0200 Subject: [PATCH] web: display our nick/psm/presence --- amsn2/ui/front_ends/web/contact_list.py | 3 ++- amsn2/ui/front_ends/web/static/js/amsn2.js | 28 +++++++++++++++++++--- 2 files changed, 27 insertions(+), 4 deletions(-) diff --git a/amsn2/ui/front_ends/web/contact_list.py b/amsn2/ui/front_ends/web/contact_list.py index c97bea63..04c9782c 100644 --- a/amsn2/ui/front_ends/web/contact_list.py +++ b/amsn2/ui/front_ends/web/contact_list.py @@ -48,7 +48,8 @@ def my_info_updated(self, view): ourself, such as DP, nick, psm, the current media being played,... @view: the contactView of the ourself (contains DP, nick, psm, currentMedia,...)""" - self._main.send("myInfoUpdated", unicode(view.nick)) + self._main.send("myInfoUpdated", unicode(view.nick), + unicode(view.presence), unicode(view.psm)) def get_contactlist_widget(self): return self._clwidget diff --git a/amsn2/ui/front_ends/web/static/js/amsn2.js b/amsn2/ui/front_ends/web/static/js/amsn2.js index 67a98272..b5ec2ad5 100644 --- a/amsn2/ui/front_ends/web/static/js/amsn2.js +++ b/amsn2/ui/front_ends/web/static/js/amsn2.js @@ -66,6 +66,25 @@ function debug(d) { //}}} // Contact List {{{ var g_cl = null; +var g_pw = null; + +function PersonalWidget(_parent) +{ + var parent = _parent; + + parent.update('
' + +''); + + this.remove = function() { + parent.update(); + } + + this.update = function(_nick, _presence, _psm) { + $('pw_nick').update(_nick); + $('pw_psm').update(_psm); + $('pw_presence').update(_presence); + } +} function ContactList(_parent) { @@ -548,11 +567,12 @@ function showMainWindow() }); g_mainWindow.setConstraint(true, {left: 0, right: 0, top: 0, bottom: 0}); fixMainWindow(); - g_mainWindow.setHTMLContent('
'); + g_mainWindow.setHTMLContent('
'); g_mainWindow.setCloseCallback(logoutCb); } if (!g_cl) { g_cl = new ContactList($('cl')); + g_pw = new PersonalWidget($('pw')); } g_mainWindow.showCenter(false, 10, document.viewport.getWidth() - g_mainWindow.getSize()['width'] - 10); @@ -584,9 +604,11 @@ function signingIn() hideLogin(); } -function myInfoUpdated(s) +function myInfoUpdated(_nick, _presence, _psm) { - // TODO + if (g_pw) { + g_pw.update(_nick, _presence, _psm); + } } function loggedOut() {