[Phpfreechat-svn] SF.net SVN: phpfreechat: [1211] trunk
Status: Beta
Brought to you by:
kerphi
|
From: <ke...@us...> - 2007-11-11 15:21:11
|
Revision: 1211
http://phpfreechat.svn.sourceforge.net/phpfreechat/?rev=1211&view=rev
Author: kerphi
Date: 2007-11-11 07:21:12 -0800 (Sun, 11 Nov 2007)
Log Message:
-----------
- usermeta parameter now supports raw html (see demo65 for an example)
- new usermeta_key_to_hide parameter
Modified Paths:
--------------
trunk/data/public/js/pfcclient.js
trunk/demo/index.php
trunk/src/pfcglobalconfig.class.php
trunk/themes/default/chat.js.tpl.php
Added Paths:
-----------
trunk/demo/demo65_chat_popup.php
trunk/demo/demo65_metadata_and_html.php
Modified: trunk/data/public/js/pfcclient.js
===================================================================
--- trunk/data/public/js/pfcclient.js 2007-11-11 13:55:17 UTC (rev 1210)
+++ trunk/data/public/js/pfcclient.js 2007-11-11 15:21:12 UTC (rev 1211)
@@ -1292,20 +1292,31 @@
)
{
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);
+ if (nickmeta_key_to_hide.indexOf(k) != -1)
+ {
+ var td2 = document.createElement('td');
+ td2.setAttribute(className, 'pfc_nickwhois_c2');
+ td2.setAttribute('colspan', 2);
+ td2.update(v);
+ tr.appendChild(td2);
+ }
+ else
+ {
+ var td1 = document.createElement('td');
+ td1.setAttribute(className, 'pfc_nickwhois_c1');
+ var td2 = document.createElement('td');
+ td2.setAttribute(className, 'pfc_nickwhois_c2');
+ td1.update(k);
+ td2.update(v);
+ tr.appendChild(td1);
+ tr.appendChild(td2);
+ }
tbody.appendChild(tr);
}
}
div.appendChild(table);
- // add the privmsg link (do not add it if this button is yourself)
+ // add the privmsg link (do not add it if the nick is yours)
if (pfc.getUserMeta(nickid,'nick') != this.nickname)
{
var p = document.createElement('p');
Added: trunk/demo/demo65_chat_popup.php
===================================================================
--- trunk/demo/demo65_chat_popup.php (rev 0)
+++ trunk/demo/demo65_chat_popup.php 2007-11-11 15:21:12 UTC (rev 1211)
@@ -0,0 +1,22 @@
+<?php
+
+require_once dirname(__FILE__)."/../src/phpfreechat.class.php";
+$params['serverid'] = md5(__FILE__); // calculate a unique id for this chat
+$params['nickmeta']['id'] = rand(1,1000);
+$params['nickmeta']['profil'] = '<a href="demo65_metadata_and_html.php?profil='.$params['nickmeta']['id'].'" onclick="window.opener.location.href=this.href;return false;">open profil</a>';
+$params['nickmeta']['avatar'] = '<a href="demo65_metadata_and_html.php?profil='.$params['nickmeta']['id'].'" onclick="window.opener.location.href=this.href;return false;"><img src="http://img217.imageshack.us/img217/5223/244bg4.png" alt=""/></a>';
+$params['nickmeta_key_to_hide'] = array('profil','avatar');
+$chat = new phpFreeChat( $params );
+
+?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <title>phpFreeChat demo</title>
+ </head>
+
+ <body>
+<?php $chat->printChat(); ?>
+ </body>
+</html>
\ No newline at end of file
Added: trunk/demo/demo65_metadata_and_html.php
===================================================================
--- trunk/demo/demo65_metadata_and_html.php (rev 0)
+++ trunk/demo/demo65_metadata_and_html.php 2007-11-11 15:21:12 UTC (rev 1211)
@@ -0,0 +1,46 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html>
+ <head>
+ <meta http-equiv="content-type" content="text/html; charset=utf-8" />
+ <title>phpFreeChat demo</title>
+ </head>
+
+ <body>
+
+<p>
+Let us
+<a href=""
+ onclick="window.open('demo65_chat_popup.php','The chat popup','toolbar=0,menubar=0,scrollbars=1,width=800,height=630'); return false;">
+start chatting
+</a>
+</p>
+
+<?php if (isset($_GET['profil'])) { ?>
+ <p>Here is the user (id=<?php echo $_GET['profil']; ?>)profil</p>
+<?php } ?>
+
+<?php /* start hide */ ?>
+<?php
+ echo "<h2>The source code</h2>";
+ $filename = __FILE__;
+ echo "<p><code>".$filename."</code></p>";
+ echo "<pre style=\"margin: 0 50px 0 50px; padding: 10px; background-color: #DDD;\">";
+ $content = file_get_contents($filename);
+ $content = preg_replace('/\<\?php \/\* start hide \*\/ \?\>.*?\<\?php \/\* end hide \*\/ \?\>/s','',$content);
+ echo htmlentities($content);
+ echo "</pre>";
+?>
+
+<?php
+ echo "<h2>The chat popup source code</h2>";
+ $filename = 'demo65_chat_popup.php';
+ echo "<p><code>".$filename."</code></p>";
+ echo "<pre style=\"margin: 0 50px 0 50px; padding: 10px; background-color: #DDD;\">";
+ $content = file_get_contents($filename);
+ echo htmlentities($content);
+ echo "</pre>";
+?>
+<?php /* end hide */ ?>
+
+ </body>
+</html>
\ No newline at end of file
Modified: trunk/demo/index.php
===================================================================
--- trunk/demo/index.php 2007-11-11 13:55:17 UTC (rev 1210)
+++ trunk/demo/index.php 2007-11-11 15:21:12 UTC (rev 1211)
@@ -75,6 +75,7 @@
<li><a href="demo43_change_the_nicknames_colors.php">demo43 - shows how to change the nicknames automatic colors</a></li>
<li><a href="demo50_customized_usermetadata.php">demo50 - shows how to use user metadata : add avatar (images) to each connected users</a></li>
<li><a href="demo55_mysql_container.php">demo55 - shows how to use the mysql container</a></li>
+ <li><a href="demo65_metadata_and_html.php">demo65 - shows how to start a chat in a child popup window and how to display in this page a complete user profil comming from a chat request (user click) </a></li>
</ul>
Modified: trunk/src/pfcglobalconfig.class.php
===================================================================
--- trunk/src/pfcglobalconfig.class.php 2007-11-11 13:55:17 UTC (rev 1210)
+++ trunk/src/pfcglobalconfig.class.php 2007-11-11 15:21:12 UTC (rev 1211)
@@ -95,6 +95,12 @@
var $nickmeta_private = array('ip');
/**
+ * <p>Can be used to hide keys in the final displayed whoisbox.
+ * (Default value: <code>array()</code> - means that nothing is hidden)</p>
+ */
+ var $nickmeta_key_to_hide = array();
+
+ /**
* <p>Set this parameter to true if you want to give admin rights to the connected user.
* Attention : if you don't use any external registration system, all your users will be admins.
* You have to test current user rights before setting this parameter to true.
Modified: trunk/themes/default/chat.js.tpl.php
===================================================================
--- trunk/themes/default/chat.js.tpl.php 2007-11-11 13:55:17 UTC (rev 1210)
+++ trunk/themes/default/chat.js.tpl.php 2007-11-11 15:21:12 UTC (rev 1211)
@@ -51,6 +51,7 @@
var pfc_theme = <?php echo $json->encode($theme); ?>;
var pfc_isready = false;
var pfc_server_script_url = <?php echo $json->encode($c->server_script_url); ?>;
+var nickmeta_key_to_hide = <?php echo $json->encode($c->nickmeta_key_to_hide); ?>;
// todo : move this code in pfcClient
function pfc_loadChat() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|