我有一篇包含几个大列表的文章 - 我想通过将 -structure 转换为 mootools-tree 来使它们更容易导航(按照http://mootree.mindplay.dk/example_1.html中的示例)。
所以我禁用了任何文本过滤(仅适用于我的管理员用户)并使用“无编辑器”来启用纯文本输入,输入了以下代码,希望它将 mootools.tree-activation 结合在 Joomla 和示例中 -但没有显示树。
有任何想法吗?
<?php
JHTML::_( 'behavior.tree', 'mytree' );
?>
<script type="text/javascript">
var tree;
window.onload = function() {
// --- ordinary MooTreeControl example:
tree = new MooTreeControl({
div: 'mytree',
mode: 'files',
grid: true
},{
text: 'Root Node',
open: true
});
tree.disable(); // this stops visual updates while we're building the tree...
var node1 = tree.insert({text:'Subnode 1', id:'1'});
var node2 = tree.insert({text:'Subnode 2', id:'2', icon:'sample_icons.gif#1', openicon:'sample_icons.gif#2'});
var node3 = tree.insert({text:'Subnode 3', id:'3'});
var node2_1 = node2.insert({text:'Subnode 2.1', id:'2.1'});
var node2_2 = node2.insert({text:'Subnode 2.2', id:'2.2', color:'#ff0000'});
var node2_3 = node2.insert({text:'Subnode 2.3', id:'2.3'});
var node2_2_1 = node2_2.insert({text:'Subnode 2.2.1', id:'2.2.1', color:'#00a000'});
var node2_2_1_1 = node2_2_1.insert({text:'Subnode 2.2.1.1', id:'2.2.1.1', color:'#0000ff'});
var node4 = tree.insert({text:'Subnode 4', id:'4', icon:'sample_icons.gif#3'});
tree.expand();
tree.enable(); // this turns visual updates on again.
}
function find_node() {
var node = tree.get( $('nodeid_input').value );
window.alert( node ? 'found: ' + node.text : 'not found...' );
}
</script>
<h2>mooTree 2</h2>
<h4>example 1: basic tree example</h4>
<p>
This demonstrates most of the basic features of MooTree, including enable() and disable() which can be used
to minimize the number of visual updates performed.
</p>
<p>
This example also demonstrates basic usage of the get() method and node id's - for example, type "2.2" in the
text input at the bottom of this page, and press "find node".
</p>
<div id="mytree">
</div>
<p>
<input type="button" value=" expand all " onclick="tree.expand()" />
<input type="button" value=" collapse all " onclick="tree.collapse()" />
<input type="text" value="" id="nodeid_input" value="2.2" /><input type="submit" value="Find node" onclick="find_node()" />
</p>
firebug-Console 显示了很多消息,但我没有看到对我的代码的引用。
[13:59:10.896] GET http://localhost/index.php/2-uncategorised/3-mootree [HTTP/1.1 200 OK 1319ms]
[13:59:12.201] GET http://localhost/templates/system/css/system.css [HTTP/1.1 304 Not Modified 2ms]
[13:59:12.202] GET http://localhost/templates/beez_20/css/position.css [HTTP/1.1 304 Not Modified 2ms]
[13:59:12.203] GET http://localhost/templates/beez_20/css/layout.css [HTTP/1.1 304 Not Modified 5ms]
[13:59:12.203] GET http://localhost/templates/beez_20/css/print.css [HTTP/1.1 304 Not Modified 8ms]
[13:59:12.204] GET http://localhost/templates/beez_20/css/general.css [HTTP/1.1 304 Not Modified 8ms]
[13:59:12.205] GET http://localhost/templates/beez_20/css/general_mozilla.css [HTTP/1.1 304 Not Modified 9ms]
[13:59:12.205] GET http://localhost/templates/beez_20/css/personal.css [HTTP/1.1 304 Not Modified 6ms]
[13:59:12.206] GET http://localhost/media/system/js/mootools-core.js [HTTP/1.1 304 Not Modified 6ms]
[13:59:12.206] GET http://localhost/media/system/js/core.js [HTTP/1.1 304 Not Modified 7ms]
[13:59:12.207] GET http://localhost/media/system/js/caption.js [HTTP/1.1 304 Not Modified 10ms]
[13:59:12.208] GET http://localhost/media/system/js/mootools-more.js [HTTP/1.1 304 Not Modified 8ms]
[13:59:12.209] GET http://localhost/templates/beez_20/javascript/md_stylechanger.js [HTTP/1.1 304 Not Modified 8ms]
[13:59:12.210] GET http://localhost/templates/beez_20/javascript/hide.js [HTTP/1.1 304 Not Modified 9ms]
[13:59:12.183] Unbekannte Eigenschaft '-moz-border-radius'. Deklaration ignoriert. @ http://localhost/templates/beez_20/css/general_mozilla.css:13
[13:59:12.390] GET http://localhost/media/system/css/system.css [HTTP/1.1 304 Not Modified 1ms]
[13:59:12.242] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-core.js:123
[13:59:12.246] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-core.js:338
[13:59:12.246] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-core.js:340
[13:59:12.248] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-core.js:382
[13:59:12.255] ReferenceError: reference to undefined property v[i] @ http://localhost/media/system/js/mootools-core.js:42
[13:59:12.256] ReferenceError: reference to undefined property Element.prototype.fireEvent @ http://localhost/media/system/js/mootools-core.js:260
[13:59:12.256] ReferenceError: reference to undefined property a[1] @ http://localhost/media/system/js/mootools-core.js:272
[13:59:12.261] getAttributeNode() sollte nicht mehr verwendet werden. Verwenden Sie stattdessen getAttribute(). @ http://localhost/media/system/js/mootools-core.js:343
[13:59:12.268] TypeError: variable a redeclares argument @ http://localhost/media/system/js/core.js:9
[13:59:12.269] TypeError: function checkAll does not always return a value @ http://localhost/media/system/js/core.js:12
[13:59:12.274] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:247
[13:59:12.275] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:254
[13:59:12.277] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:378
[13:59:12.277] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:385
[13:59:12.282] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:612
[13:59:12.282] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:625
[13:59:12.283] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:628
[13:59:12.283] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:635
[13:59:12.283] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:638
[13:59:12.283] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:650
[13:59:12.284] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:686
[13:59:12.284] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:694
[13:59:12.284] SyntaxError: property name getSelected appears more than once in object literal @ http://localhost/media/system/js/mootools-more.js:695
[13:59:12.284] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:699
[13:59:12.284] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:700
[13:59:12.284] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:702
[13:59:12.284] SyntaxError: property name getSelected appears more than once in object literal @ http://localhost/media/system/js/mootools-more.js:703
[13:59:12.284] TypeError: anonymous function does not always return a value @ http://localhost/media/system/js/mootools-more.js:705
[13:59:12.289] ReferenceError: reference to undefined property this.Binds @ http://localhost/media/system/js/mootools-more.js:27
[13:59:12.291] ReferenceError: reference to undefined property this.document @ http://localhost/media/system/js/mootools-core.js:192
[13:59:12.291] ReferenceError: reference to undefined property this.document @ http://localhost/media/system/js/mootools-core.js:170
[13:59:12.293] ReferenceError: reference to undefined property this.parsed @ http://localhost/media/system/js/mootools-more.js:129
[13:59:12.528] GET http://localhost/templates/beez_20/images/personal/bg2.png [HTTP/1.1 304 Not Modified 3ms]
[13:59:12.528] GET http://localhost/images/joomla_black.gif [HTTP/1.1 304 Not Modified 2ms]
[13:59:12.529] GET http://localhost/templates/beez_20/images/system/arrow.png [HTTP/1.1 304 Not Modified 1ms]
[13:59:12.530] GET http://localhost/media/system/images/printButton.png [HTTP/1.1 304 Not Modified 1ms]
[13:59:12.530] GET http://localhost/media/system/images/emailButton.png [HTTP/1.1 304 Not Modified 1ms]
[13:59:12.531] GET http://localhost/templates/beez_20/images/personal/personal2.png [HTTP/1.1 304 Not Modified 2ms]
[13:59:12.531] GET http://localhost/templates/beez_20/images/nature/karo.gif [HTTP/1.1 304 Not Modified 2ms]
[13:59:12.532] GET http://localhost/templates/beez_20/images/content_bg.gif [HTTP/1.1 304 Not Modified 1ms]
[13:59:12.532] GET http://localhost/templates/beez_20/images/nature/arrow1.gif [HTTP/1.1 304 Not Modified 2ms]
[13:59:12.533] GET http://localhost/templates/beez_20/images/personal/tabs_back.png [HTTP/1.1 304 Not Modified 2ms]
[13:59:12.481] ReferenceError: assignment to undeclared variable STATE_PROVINCE_VALUE_MAPPING @ resource://gre/modules/XPIProvider.jsm -> jar:file:///C:/Users/MBaas/AppData/Roaming/Mozilla/Firefox/Profiles/b4ue9vdm.default/extensions/onepassword@agilebits.com.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://onepassword-at-agilebits-dot-com/onepassword/data/src/end.min.js:32
[13:59:12.481] ReferenceError: assignment to undeclared variable STATE_PROVINCE_REGEX_MAPPING @ resource://gre/modules/XPIProvider.jsm -> jar:file:///C:/Users/MBaas/AppData/Roaming/Mozilla/Firefox/Profiles/b4ue9vdm.default/extensions/onepassword@agilebits.com.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://onepassword-at-agilebits-dot-com/onepassword/data/src/end.min.js:32
[13:59:12.481] ReferenceError: assignment to undeclared variable COUNTRY_VALUE_MAPPING @ resource://gre/modules/XPIProvider.jsm -> jar:file:///C:/Users/MBaas/AppData/Roaming/Mozilla/Firefox/Profiles/b4ue9vdm.default/extensions/onepassword@agilebits.com.xpi!/bootstrap.js -> resource://gre/modules/commonjs/toolkit/loader.js -> resource://gre/modules/commonjs/sdk/loader/sandbox.js -> resource://onepassword-at-agilebits-dot-com/onepassword/data/src/end.min.js:32
[13:59:12.485] ReferenceError: MooTreeControl is not defined @ http://localhost/index.php/2-uncategorised/3-mootree:220
整个事情目前在 localhost 上运行,所以我无法提供 Live-URL,抱歉。