[Phpfreechat-svn] SF.net SVN: phpfreechat: [1015] trunk
Status: Beta
Brought to you by:
kerphi
From: <ke...@us...> - 2007-04-13 11:52:03
|
Revision: 1015 http://svn.sourceforge.net/phpfreechat/?rev=1015&view=rev Author: kerphi Date: 2007-04-13 04:42:00 -0700 (Fri, 13 Apr 2007) Log Message: ----------- [en] Bug fix: the demo50 (usermeta / avatar) was broken [0h25] [fr] Bug fix?\194?\160: la demo50 (usermeta / avatar) ne fonctionnait pas corretement [0h25] Modified Paths: -------------- trunk/demo/demo50_customized_usermetadata.php trunk/demo/demo50_data/mytheme/customize.js.php trunk/themes/default/style.css.php Modified: trunk/demo/demo50_customized_usermetadata.php =================================================================== --- trunk/demo/demo50_customized_usermetadata.php 2007-04-01 13:10:16 UTC (rev 1014) +++ trunk/demo/demo50_customized_usermetadata.php 2007-04-13 11:42:00 UTC (rev 1015) @@ -5,7 +5,7 @@ $params["serverid"] = md5(__FILE__); // calculate a unique id for this chat $params["title"] = "A chat which shows how to use user metadata : add avatar (images) to each connected users"; $params["nick"] = "guest".rand(1,1000); -$params["nickmeta"] = array("avatar" => "demo50_data/avatar".rand(1,10).".jpg"); +$params["nickmeta"] = array("avatar" => "demo50_data/avatar".rand(1,9).".jpg"); $params["theme_path"] = dirname(__FILE__)."/demo50_data"; $params["theme"] = "mytheme"; $chat = new phpFreeChat( $params ); Modified: trunk/demo/demo50_data/mytheme/customize.js.php =================================================================== --- trunk/demo/demo50_data/mytheme/customize.js.php 2007-04-01 13:10:16 UTC (rev 1014) +++ trunk/demo/demo50_data/mytheme/customize.js.php 2007-04-13 11:42:00 UTC (rev 1015) @@ -1,71 +1,43 @@ pfcClient.prototype.updateNickWhoisBox = function(nickid) - { +{ + var usermeta = this.getAllUserMeta(nickid); + var div = document.createElement('div'); div.setAttribute('class', 'pfc_nickwhois'); div.setAttribute('className', 'pfc_nickwhois'); // for IE6 - var ul = document.createElement('ul'); - div.appendChild(ul); + var p = document.createElement('p'); + p.setAttribute('class', 'pfc_nickwhois_header'); + p.setAttribute('className', 'pfc_nickwhois_header'); // for IE6 + div.appendChild(p); // add the close button - var li = document.createElement('li'); - li.setAttribute('class', 'pfc_nickwhois_close'); - li.setAttribute('className', 'pfc_nickwhois_close'); // for IE6 - ul.appendChild(li); - var a = document.createElement('a'); - a.setAttribute('href', ''); - a.pfc_parent = div; - a.onclick = function(evt){ + var img = document.createElement('img'); + img.setAttribute('class', 'pfc_nickwhois_close'); + img.setAttribute('className', 'pfc_nickwhois_close'); // for IE6 + img.pfc_parent = div; + img.onclick = function(evt){ this.pfc_parent.style.display = 'none'; return false; } - var img = document.createElement('img'); img.setAttribute('src', this.res.getFileUrl('images/close-whoisbox.gif')); - img.alt = document.createTextNode(this.res.getLabel('Close')); - a.appendChild(img); - li.appendChild(a); + img.alt = this.res.getLabel('Close'); + p.appendChild(img); + p.appendChild(document.createTextNode(usermeta['nick'])); // append the nickname text in the title - // add the privmsg link (do not add it if this button is yourself) - if (pfc.getUserMeta(nickid,'nick') != this.nickname) - { - var li = document.createElement('li'); - li.setAttribute('class', 'pfc_nickwhois_pv'); - li.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6 - ul.appendChild(li); - var a = document.createElement('a'); - a.setAttribute('href', ''); - a.pfc_nickid = nickid; - a.pfc_parent = div; - a.onclick = function(evt){ - var nick = pfc.getUserMeta(this.pfc_nickid,'nick'); - pfc.sendRequest('/privmsg "'+nick+'"'); - this.pfc_parent.style.display = 'none'; - return false; - } - var img = document.createElement('img'); - img.setAttribute('src', this.res.getFileUrl('images/openpv.gif')); - img.alt = document.createTextNode(this.res.getLabel('Private message')); - a.appendChild(img); - a.appendChild(document.createTextNode(this.res.getLabel('Private message'))); - li.appendChild(a); - } - - // add the whois information table var table = document.createElement('table'); -// table.setAttribute('cellspacing',0); -// table.setAttribute('cellpadding',0); -// table.setAttribute('border',0); var tbody = document.createElement('tbody'); table.appendChild(tbody); - var um = this.getAllUserMeta(nickid); - var um_keys = um.keys(); + var um_keys = usermeta.keys(); var msg = ''; for (var i=0; i<um_keys.length; i++) { var k = um_keys[i]; - var v = um[k]; + var v = usermeta[k]; if (v && k != 'nickid' + && k != 'nick' // useless because it is displayed in the box title + && k != 'isadmin' // useless because of the gold shield icon && k != 'floodtime' && k != 'flood_nbmsg' && k != 'flood_nbchar' @@ -89,11 +61,39 @@ div.appendChild(table); // append the avatar image - var img = document.createElement('img'); - img.setAttribute('src',this.getUserMeta(nickid,'avatar')); - img.setAttribute('class', 'pfc_nickwhois_avatar'); - img.setAttribute('className', 'pfc_nickwhois_avatar'); // for IE6 - div.appendChild(img); + if (this.getUserMeta(nickid,'avatar')) + { + var img = document.createElement('img'); + img.setAttribute('src',this.getUserMeta(nickid,'avatar')); + img.setAttribute('class', 'pfc_nickwhois_avatar'); + img.setAttribute('className', 'pfc_nickwhois_avatar'); // for IE6 + div.appendChild(img); + } + + // add the privmsg link (do not add it if this button is yourself) + if (pfc.getUserMeta(nickid,'nick') != this.nickname) + { + var p = document.createElement('p'); + p.setAttribute('class', 'pfc_nickwhois_pv'); + p.setAttribute('className', 'pfc_nickwhois_pv'); // for IE6 + var a = document.createElement('a'); + a.setAttribute('href', ''); + a.pfc_nickid = nickid; + a.pfc_parent = div; + a.onclick = function(evt){ + var nick = pfc.getUserMeta(this.pfc_nickid,'nick'); + pfc.sendRequest('/privmsg "'+nick+'"'); + this.pfc_parent.style.display = 'none'; + return false; + } + var img = document.createElement('img'); + img.setAttribute('src', this.res.getFileUrl('images/openpv.gif')); + img.alt = document.createTextNode(this.res.getLabel('Private message')); + a.appendChild(img); + a.appendChild(document.createTextNode(this.res.getLabel('Private message'))); + p.appendChild(a); + div.appendChild(p); + } - this.nickwhoisbox[nickid] = div; - } + this.nickwhoisbox[nickid] = div; +} Modified: trunk/themes/default/style.css.php =================================================================== --- trunk/themes/default/style.css.php 2007-04-01 13:10:16 UTC (rev 1014) +++ trunk/themes/default/style.css.php 2007-04-13 11:42:00 UTC (rev 1015) @@ -359,6 +359,7 @@ font-size: 75%; } .pfc_nickwhois_header { + margin: 0; padding: 0; background-color: #EEE; border-bottom: 1px solid #444; text-align: center; @@ -379,6 +380,10 @@ } td.pfc_nickwhois_c2 { } +.pfc_nickwhois_pv { + margin:0; padding: 0; + text-align: center; +} .pfc_nickwhois_pv a { text-decoration: none; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |