Discuss this template here
This template produces a collapsible wiki tree. Rather than pre-fetching the entire tree, it dynamically fetches only as much as necessary via AJAX and the Mindtouch API. This means it loads quickly even if the full tree is very large, and makes it suitable for implementing a navigation tree for an entire wiki site.
If you're not working with a large tree and therefore performance isn't an issue, you can also look at the non-AJAX version, "CollapsibleTree".
This template was originally implemented by Blake Harms based on the CollapsibleTree template, and currently maintained by Neil Weinstock.
| Version | Date | Author | Description |
|---|---|---|---|
| 1.8.1 | 12-May-2011 | Neil Weinstock | Fixed alphabetization error for top-level list. |
| 1.8 | 11-May-2011 | Neil Weinstock |
|
| 1.7 | 30-Sep-2009 | Neil Weinstock | Converted to use page IDs as links, to fix all character encoding and URL escaping issues |
| 1.6 | 4-Sep-2009 | Blake Harms | Fixes for German language - Thanks Baum! |
| 1.5.1 | 10-Jul-2009 | Blake Harms | Removed click function from pages that do not have subpages |
| 1.5 | 10-Jul-2009 | Blake Harms | Added Ajax checks for subpage #s and added depth to the bullets |
| 1.3 | 10-Jul-2009 | Blake Harms | Fixed XML parsing for all major browsers |
| 1.2 | 9-Jul-2009 | Blake Harms | Fixed a MAJOR bug where IE didn't read XML properly |
| 1.0 | 9-Jul-2009 | Blake Harms | First version posted to App Catalog |
These instructions will help you install the template'AjaxWikiTree' on your wiki quickly and correctly.
Perform the following steps:
HTML Source for Template:AjaxWikiTree
| Name | Type | Default | Description |
|---|---|---|---|
| path | str? | page.path | Path to the root of the tree |
| slide | bool? | false | Use "slide" effect to collapse and expand sub-trees |
NeilW wrote up his CollapsibleTree template so I immediately placed it at my root page and waited. And waited. And waited. With thousands of pages to process, it just wasn't worth the wait. Even on Chrome (which, arguably, has the fastest javascript engine). But it wasn't his fault, it was A LOT of pages. For a few pages, I would definitely recommend his template. But for a full-page structure, consider AJAX.
There are a few modifications. For instance, you cannot use just any tree. That wouldn't make any sense. This template is for loading thousands of pages based on the wiki hierarchy asynchronously. The way the template generates the tree is by calling wiki.tree(path,1) so that it only loads the first bit.
I considered loading the whole tree and only applying the javascript to code the subtree that was opened, but that wasn't nearly as cool. Plus, what if a page is created during the time that the tree is loaded and the javascript is run? You wouldn't get that page! Worlds would end, kittens would be murdered, and you wouldn't be up to date. For all these reasons, AJAX was chosen.
As with all of my "applications" I began this at home just to test some things out. And because I thought it would be fun. :P I quickly realized though, that it would be very useful everywhere, so I posted it here. I think it's matured quite well.
Have fun and enjoy!
Want to see more features? Have a bug to report? File them both here!
To show the tree starting at the current page:
{{ AjaxWikiTree() }}
To show a list from another page (As in the demo), add a parameter:
{{ AjaxWikiTree("path/to/tree") }}
Add a slide effect:
{{ AjaxWikiTree("path/to/tree",true) }}
And now, to demonstrate the RAW POWER of this template, I will attempt to load the ROOT PAGE!
That wasn't too bad.
| File | Version | Size | Modified | |
|---|---|---|---|---|
| ||||
| ||||
Copyright © 2011 MindTouch, Inc. Powered by
# Use SSH console
# type in export and see if http_proxy is configured, if not,
# type in (without speech marks) "export http_proxy=http://ip:port" (this is a CCproxy installation that piggybacks the connection through our ISA server)
# type in "wget http://scripts.mindtouch.com/<scriptname>.xml -O /var/www/dekiwiki/bin/<scriptname>.xml"
Replace <scriptname> with the name of the script in the manifest
# You should see from the feedback that the file is downloaded succesfully.
# Now change the path in the "add script" manifest box to "/var/www/dekiwiki/bin/<scriptname>.xml"
# This should work.
# I got this partly from here: http://forums.developer.mindtouch.co...ead.php?t=3514
I have it set in a page exactly like it is described, but it does not display anything.
No errors either, just a blank space where the list should be.
Could it be to do with the icons?
How can I trouble shoot the Javascript?
Thanks for your help.
BTW. If I deliberately foul up the {{ AjaxWikiTree() }}
with like the wrong number of brackets it pipes up and complains, so some of it seems to be working I guess.
On pages without subpages I get things like this - https://somesitename/Blah/%2FBlah%2FTest%2Fprogramme%2FJuly_2008_schedule
It adds another Blah to the front :-(
Initial try was to load it as an extension, which failed. I then tried it as a script which worked better, but still gave the error: "reference to undefined name 'dekiapi':"
I then added the namespace as dekiapi and I'm getting a the "/content/body/pre, map is not valid; expected uri: line 1, column 8" error.
Using 9.08. Figured out how to add Unsafe content permissions. I think I managed to cut and paste the code OK and format it in a Dekiscript block. Extension/Script is flagged as running. No Javascript errors. Have cleared cache a few times. Anything else I should look at?
content/body/pre[1], map is not valid; expected uri: line 1, column 13 (click for details)
MindTouch.Deki.Script.DekiScriptBadTypeException: map is not valid; expected uri: line 1, column 13
at MindTouch.Deki.Script.DekiScriptCall.Evaluate (MindTouch.Deki.Script.DekiScriptEnv env) [0x00000]
at MindTouch.Deki.Script.Dom.DekiScriptDomExpr.Evaluate (MindTouch.Deki.Script.DekiScriptEvalContext context, System.Xml.XmlNode parent, MindTouch.Deki.Script.DekiScriptEnv env) [0x00000] edited 07:32, 10 Aug 2010
reference to undefined name 'dekiapi' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown. (click for details)
Callstack:
at Engineering/Firmware
at Template:SimplePoll
MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException: reference to undefined name 'dekiapi' Exception of type 'MindTouch.Deki.Script.Runtime.DekiScriptUndefinedNameException' was thrown.
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptVar expr, DekiScriptExpressionEvaluationState state)
at MindTouch.Deki.Script.Expr.DekiScriptVar.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptCall expr, DekiScriptExpressionEvaluationState state)
at MindTouch.Deki.Script.Expr.DekiScriptCall.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptSequence expr, DekiScriptExpressionEvaluationState state)
at MindTouch.Deki.Script.Expr.DekiScriptSequence.VisitWith[TState,TReturn](IDekiScriptExpressionVisitor`2 visitor, TState state)
at MindTouch.Deki.Script.Compiler.DekiScriptExpressionEvaluation.Visit(DekiScriptReturnScope expr, DekiScriptExpressionEvaluationState state)
*Updated post to clarify statement* edited 05:51, 15 Jul 2011
Using the newest version, the gif files need to be attached to the *template page*. They're still here as well to avoid breaking the template for people using older versions.
Sure. I meant the links to the actual files are dead links up top (cfrwiki.raritan.com) and "collapse_icons.gif" wasn't attached to this page. So someone trying to use the template wouldn't have been able to get the 1 of the two files with the information provided on this page. That's all. I was just trying to make it more convenient since I already had the file. Now both image files can be downloaded directly from this page to attach to a user's template.
Whooooops. Thanks for pointing that out. If I had read your original note more carefully I would have seen it then. I fixed the links.