PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » HTML » HTML_TreeMenu » Bug #7324

Problem using together with XMLRPC

Details

Submitted2006-04-06 13:04 UTC
Fromatisss at gmail dot com
Assignedkguest
StatusClosed
PackageHTML_TreeMenu
PHP VersionIrrelevant
Roadmaps1.2.2

Comments

[2006-04-06 13:04 UTC] atisss at gmail dot com

Description:
------------
I was trying to use it together with vcXMLRPC, however i got completely wrong results in tree captions. A little investigation showed that problem is somewhat connected with use of Array in 'TreeMenu.js'. vcXMLRPC adds

Array.prototype.toXMLRPC = function(){...}

however contents of it is printed out in text of tree node.

For vcXMLRPC see:
www.vcdn.org/Public/XMLRPC/

A quick workaround:

within TreeMenu.prototype.drawMenu search for

/**
* Add event handlers
*/
var eventHandlers = "";
for (j in nodes[i].events) {
eventHandlers += this.stringFormat('{0}="{1}" ', j, nodes[i].events[j]);
}

Before eventHandlers += ... add a line
if (j != "toXMLRPC")

However, this fixes problem only with vcXMLRPC, however problem might repeat for other packages. Different use of Array() should be considered.

Expected result:
----------------
<a href="test.php" target="_self"><span>Second level</span></a>

Actual result:
--------------
<a href="test.php" target="_self"><span toxmlrpc="function () {
var retstr = "><array><data>";
for (var i = 0; i < this.length; i++) {
retstr += "<value>" + XMLRPC.getXML(this[i]) + "</value>";
}
return retstr + "</data></array>";
}" >Second level</span>

[2006-04-07 10:24 UTC] atisss at gmail dot com

A more general fix works. The same line could be replaced with

if (typeof(nodes[i].events[j]) == 'function') continue;