+ Reply to Thread
Page 1 of 9 1 2 3 ... LastLast
Results 1 to 10 of 81

Thread: NEW: AJAX Collapsible Wiki.Tree

  1. #1
    Join Date
    May 2009
    Location
    Houston, Tx
    Posts
    237

    Default NEW: AJAX Collapsible Wiki.Tree

    First of all, thanks go to NeilW for his AMAZING CollapsibleTree template. Without which, I wouldn't have even attempted. Anyway, it's pretty much been rewritten... Same comments and structure though.
    I had a lot of fun doing it, and I hope you enjoy.
    What this does:
    It loads the first level of sub-pages and sets their bullets to +. When clicked, it will ask the server for subpages and load them below that item. Simple.
    You can use the current page (default) or send in a root page. And, of course, you can specify the slide effect (default: off)
    Article
    To err is human; to make real mess, you need a computer.
    Follow me on Twitter

  2. #2
    Join Date
    Feb 2008
    Location
    London upon Thames
    Posts
    2,792

    Default

    Nice!

    Two points:
    • Can you make it not add a + if you have no children on that node?
    • This is exactly what is needed to do the MSDN style layout that people are asking for!
    If my post helped you, please click the icon below this post to my reputation. Thanks!

  3. #3
    Join Date
    May 2009
    Location
    Houston, Tx
    Posts
    237

    Default

    Quote Originally Posted by crb View Post
    Nice!

    Two points:
    • Can you make it not add a + if you have no children on that node?
    • This is exactly what is needed to do the MSDN style layout that people are asking for!
    I can make that happen, but that requires an ajax request for each sub-node. I decided to skip this because it would take far too long to load a list of 100 subpages (We have a 'Glossary' page that has many definitions).

    Edit:
    Also, I just fixed the XML parsing so it should work in all major browsers.
    Last edited by blakeh; 07-10-2009 at 02:23 PM. Reason: Forgot some important news!
    To err is human; to make real mess, you need a computer.
    Follow me on Twitter

  4. #4
    Join Date
    Feb 2008
    Location
    London upon Thames
    Posts
    2,792

    Default

    Isn't there an API which tells you how many pages each child node off a given page has? Could have sworn I saw it somewhere.
    If my post helped you, please click the icon below this post to my reputation. Thanks!

  5. #5
    Join Date
    May 2009
    Location
    Houston, Tx
    Posts
    237

    Default

    Quote Originally Posted by crb View Post
    Isn't there an API which tells you how many pages each child node off a given page has? Could have sworn I saw it somewhere.
    http://developer.mindtouch.com/Deki/API_Reference/GET: pages//{pageid}//subpages
    Does, but that also returns every page. This takes time. It could take upwards of 1, 2 seconds for 100 or more pages. I can add it... but I don't really want to because of the latency. Now if that api had a limit parameter, it could take very little time.

    Edit: I'll post a version in a subpage for testing this.
    Last edited by crb; 07-10-2009 at 03:37 PM. Reason: to humor CRB. :P
    To err is human; to make real mess, you need a computer.
    Follow me on Twitter

  6. #6

    Default

    Quote Originally Posted by blakeh View Post
    http://developer.mindtouch.com/Deki/API_Reference/GETages//{pageid}//subpages
    Does, but that also returns every page. This takes time. It could take upwards of 1, 2 seconds for 100 or more pages. I can add it... but I don't really want to because of the latency. Now if that api had a limit parameter, it could take very little time.

    Edit: I'll post a version in a subpage for testing this.
    blakeh - The subpages feature does actually have limit/offset (but it looks like our documentation isn't up to date).

    Code:
    [DreamFeatureParam("offset", "int?", "Number of subpages to skip. Default: 0")]
    [DreamFeatureParam("limit", "int?", "Number of subpages to retrieve. (default: 100)")]
    For example:
    http://developer.mindtouch.com/@api/...mit=2&offset=0
    PeteE - MindTouch lackey
    Join #mindtouch on freenode for questions about MindTouch

  7. #7
    Join Date
    May 2009
    Location
    Houston, Tx
    Posts
    237

    Default

    Quote Originally Posted by PeteE View Post
    blakeh - The subpages feature does actually have limit/offset (but it looks like our documentation isn't up to date).
    Excellent! Then I can go ahead and play with that.
    To err is human; to make real mess, you need a computer.
    Follow me on Twitter

  8. #8
    Join Date
    Feb 2008
    Location
    London upon Thames
    Posts
    2,792

    Default

    I'm really not worth humouring, but:

    http://developer.mindtouch.com/@api/...PeteE/subpages

    (scroll right and see the bolded bit - I guess this is what you get to build the first level anyway?)

    Code:
    <subpages totalcount="45" count="45" href="http://developer.mindtouch.com/@api/deki/pages/1232/subpages">
        <page.subpage id="24925" href="http://developer.mindtouch.com/@api/deki/pages/24925?redirects=0" terminal="false" subpages="false">
            <uri.ui>http://developer.mindtouch.com/User:PeteE/AttachmentTest2</uri.ui>
            <title>AttachmentTest2</title>
            <path>User:PeteE/AttachmentTest2</path>
            <namespace>user</namespace>
        </page.subpage>
        <page.subpage id="29919" href="http://developer.mindtouch.com/@api/deki/pages/29919?redirects=0" terminal="true" subpages="false">
            <uri.ui>http://developer.mindtouch.com/User:PeteE/Bugs</uri.ui>
            <title>Bugs</title>
            <path>User:PeteE/Bugs</path>
            <namespace>user</namespace>
        </page.subpage>
    If my post helped you, please click the icon below this post to my reputation. Thanks!

  9. #9
    Join Date
    May 2009
    Location
    Houston, Tx
    Posts
    237

    Default

    Quote Originally Posted by crb View Post
    I'm really not worth humouring
    You certainly are worth humoring!
    Here's your example. It will be pushed into stable when I can figure out how to add depth to it (instead of just using the boring black dot for every level.)
    I limited it to 0 because I saw that there is an attribute on subpages called "totalcount" so I checked to see that there are more than 0. That way only like 50 letters are actually sent. It's so fast!

    Edit: I see what you are saying CRB. I'll look into that.
    Last edited by blakeh; 07-10-2009 at 03:46 PM.
    To err is human; to make real mess, you need a computer.
    Follow me on Twitter

  10. #10
    Join Date
    May 2009
    Location
    Houston, Tx
    Posts
    237

    Default

    Quote Originally Posted by blakeh View Post
    It will be pushed into stable when I can figure out how to add depth to it (instead of just using the boring black dot for every level.)
    Done and done.
    mcraven was having some trouble with his template, and I'm not sure what could be wrong. Here's his post:
    When I try and use the template I get the following error:
    MindTouch.Deki.Script.DekiScriptBadTypeException: map is not valid; expected uri: line 1, column 8
    at MindTouch.Deki.Script.DekiScriptCall.Evaluate(Deki ScriptEnv env)
    at MindTouch.Deki.Script.DekiScriptSequence.Evaluate( DekiScriptEnv env)
    at MindTouch.Deki.Script.Dom.DekiScriptDomExpr.Evalua te(DekiScriptEvalContext context, XmlNode parent, DekiScriptEnv env)
    He has 9.02, the code is in a dekiscript block and he has installed the deki api extension.
    To err is human; to make real mess, you need a computer.
    Follow me on Twitter

+ Reply to Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts