Forum OpenACS Q&A: Re: Using AJAX with xowiki

Collapse
4: Re: Using AJAX with xowiki (response to 3)
Posted by Richard Hamilton on
Just to round off the thread, the 'href' in question is a property of the YAHOO.widget.TextNode() class which the xowiki toc includelet uses for fetching page content when the user clicks a node on the treeview table of contents.

Mystery solved.

Collapse
5: Re: Using AJAX with xowiki (response to 4)
Posted by Richard Hamilton on
Oh, dear, I'm very sorry, I was talking rubbish!

'href' in this contect is a method of the toc object created in the preceeding code and passed as an argument into the YAHOO.util.Connect.asyncRequest() as part of the callback definition.

  toc instproc href {book_mode name} {
    my instvar package_id __including_page
    if {$book_mode} {
      set href [$package_id url]#[toc anchor $name]
    } else {
      set href [$package_id pretty_link -parent_id [$__including_page parent_id] $name]
    }
    return $href
  }

Clearly it returns a suitable url based on the node in the toc treeview that has been clicked.  This url is then used to obtain the page content.  It appears that the url is a standard one and I can see no customisation server-side to support the AJAX request.

The responseText property of the response object contains the server's reply which is then inserted into the appropriate page fragment using the innerHTML property.

Richard