[Phpfreechat-svn] SF.net SVN: phpfreechat:[1261] trunk
Status: Beta
Brought to you by:
kerphi
|
From: <ke...@us...> - 2009-04-25 11:09:35
|
Revision: 1261
http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1261&view=rev
Author: kerphi
Date: 2009-04-25 11:09:31 +0000 (Sat, 25 Apr 2009)
Log Message:
-----------
Makes more flexible "whoisbox" customization (example: add an avatar)
Modified Paths:
--------------
trunk/data/public/js/pfcclient.js
trunk/demo/demo50_data/mytheme/customize.js.php
Modified: trunk/data/public/js/pfcclient.js
===================================================================
--- trunk/data/public/js/pfcclient.js 2009-03-11 09:19:41 UTC (rev 1260)
+++ trunk/data/public/js/pfcclient.js 2009-04-25 11:09:31 UTC (rev 1261)
@@ -1283,7 +1283,28 @@
this.updateNickWhoisBox(nickid);
return this.nickwhoisbox.get(nickid);
},
-
+
+ updateNickWhoisBox_ignored_field: function(k)
+ {
+ return ( 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'
+ );
+ },
+
+ updateNickWhoisBox_append_html: function(nickid, div)
+ {
+ // this methode can be overloaded to append customized data to the whoisbox
+ },
+
+ updateNickWhoisBox_prepend_html: function(nickid, div)
+ {
+ // this methode can be overloaded to prepend customized data to the whoisbox
+ },
+
updateNickWhoisBox: function(nickid)
{
var className = (! is_ie) ? 'class' : 'className';
@@ -1308,6 +1329,8 @@
img.alt = this.res.getLabel('Close');
p.appendChild(img);
p.appendChild(document.createTextNode(usermeta.get('nick'))); // append the nickname text in the title
+
+ this.updateNickWhoisBox_prepend_html(nickid,div);
// add the whois information table
var table = document.createElement('table');
@@ -1319,13 +1342,7 @@
{
var k = um_keys[i];
var v = usermeta.get(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'
- )
+ if (v && !this.updateNickWhoisBox_ignored_field(k))
{
var tr = document.createElement('tr');
if (pfc_nickmeta_key_to_hide.indexOf(k) != -1)
@@ -1351,7 +1368,9 @@
}
}
div.appendChild(table);
-
+
+ this.updateNickWhoisBox_append_html(nickid,div);
+
// add the privmsg link (do not add it if the nick is yours)
if (pfc.getUserMeta(nickid,'nick') != this.nickname)
{
Modified: trunk/demo/demo50_data/mytheme/customize.js.php
===================================================================
--- trunk/demo/demo50_data/mytheme/customize.js.php 2009-03-11 09:19:41 UTC (rev 1260)
+++ trunk/demo/demo50_data/mytheme/customize.js.php 2009-04-25 11:09:31 UTC (rev 1261)
@@ -1,62 +1,19 @@
-pfcClient.prototype.updateNickWhoisBox = function(nickid)
+pfcClient.prototype.updateNickWhoisBox_ignored_field = function(k)
{
+ return ( 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' ||
+ k == 'avatar'
+ );
+}
+
+pfcClient.prototype.updateNickWhoisBox_append_html = function(nickid, div)
+{
var className = (! is_ie) ? 'class' : 'className';
-
- var usermeta = this.getAllUserMeta(nickid);
-
- var div = document.createElement('div');
- div.setAttribute(className, 'pfc_nickwhois');
-
- var p = document.createElement('p');
- p.setAttribute(className, 'pfc_nickwhois_header');
- div.appendChild(p);
-
- // add the close button
- var img = document.createElement('img');
- img.setAttribute(className, 'pfc_nickwhois_close');
- img.pfc_parent = div;
- img.onclick = function(evt){
- this.pfc_parent.style.display = 'none';
- return false;
- }
- img.setAttribute('src', this.res.getFileUrl('images/close-whoisbox.gif'));
- img.alt = this.res.getLabel('Close');
- p.appendChild(img);
- p.appendChild(document.createTextNode(usermeta['nick'])); // append the nickname text in the title
-
- // add the whois information table
- var table = document.createElement('table');
- var tbody = document.createElement('tbody');
- table.appendChild(tbody);
- var um_keys = usermeta.keys();
- var msg = '';
- for (var i=0; i<um_keys.length; i++)
- {
- var k = um_keys[i];
- 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'
- && k != 'avatar'
- )
- {
- var tr = document.createElement('tr');
- var td1 = document.createElement('td');
- td1.setAttribute(className, 'pfc_nickwhois_c1');
- var td2 = document.createElement('td');
- td2.setAttribute(className, 'pfc_nickwhois_c2');
- td1.appendChild(document.createTextNode(k));
- td2.appendChild(document.createTextNode(v));
- tr.appendChild(td1);
- tr.appendChild(td2);
- tbody.appendChild(tr);
- }
- }
- div.appendChild(table);
-
+
// append the avatar image
if (this.getUserMeta(nickid,'avatar'))
{
@@ -65,30 +22,4 @@
img.setAttribute(className, 'pfc_nickwhois_avatar');
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(className, 'pfc_nickwhois_pv');
- 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 was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|