Forum OpenACS Q&A: Context bar and xowiki.

Collapse
Posted by Richard Hamilton on
I am just getting to grips with xowiki and have set up and openacs to serve an xowiki page as the overall site default index page.

That works fine such that a request for:

http://www.mydomain.com

...delivers the xowiki page designed to be the site homepage.

HOWEVER!

The context bar is, quite correctly:

mydomain.com : xowiki : home

I would like the context bar to be:

home :

...effectively trimming off the upper nodes when pages of the xowiki instance are being displayed.

I am comfortable with hacking the code to achieve this, but before I do I wanted to check if there is a parameter or configuration setting that will do this that I have overlooked?

If not I may hack it to chop the top two layers for all but admin users for example.

Thanks
Richard

Collapse
Posted by Claudio Pasolini on
Hi Richard,

to achieve your goal I'm using a small index.vuh script by Gustaf, placed into the top www folder. Here is the script:

::xowiki::Package initialize -ad_doc {

  @author Gustaf Neumann (gustaf.neumann@wu-wien.ac.at)
  @creation-date July, 2006
  @cvs-id $Id: index.vuh,v 1.1.1.1 2008/11/10 09:06:52 alter Exp $
  } -parameter {
    {-m view}
    {-folder_id:integer 0}
  } -url /xowiki[ns_conn url]

  ::$package_id reply_to_user [::$package_id invoke -method $m]
  ad_script_abort

Collapse
Posted by Richard Hamilton on
Fantastic, thank you Claudio. I'll try that.

It looks like a magic incantation! 😊

Looks as is if I need to bone up on ::xowiki::Package!

R.

Collapse
Posted by Richard Hamilton on
Claudio,

I put that index.vuh in the server root for the openacs instance and received the following error:

unknown argument '-' for method 'initialize': valid arguments -ad_doc {-parameter {}} {-package_id 0} {-url {}} {-user_id -1} {-actual_query { }} -original_url_and_query {-init_url true} -form_parameter
while executing
"::xotcl::interpretNonpositionalArgs $args"
(procedure "initialize" line 2)
::xowiki::Package ::xo::PackageMgr->initialize
invoked from within

Any idea what I have done wrong?

Regards
Richard

Collapse
Posted by Claudio Pasolini on
I suspect that during the copying and pasting of the script some weird character has been added.

I suggest that you drop any extra character from the command or write it by hand and retry.

Collapse
Posted by Richard Hamilton on
Claudio,

I don't think that is it because I didn't do it that way. I noticed the similarity between the file you posted and the index.vuh from the xowiki/www directory, so I copied that file and then modified it by stripping out the additional lines and very carefully adding the one additional magic incantation.

R.

Collapse
Posted by Claudio Pasolini on
The method 'initialize' receives an unexpected '-' argument and so something must be wrong in your script.

I would try writing the full ::xowiki::Package command without extra spaces on a single line.

Collapse
Posted by Richard Hamilton on
Claudio,

Fantastic, thanks for your clearheaded guidance. The error unsurprisingly was in the only bit that I hand-typed. I had accidentally inserted a space between the '-' and 'url'.

Silly boy!

That has very nicely removed the xowiki package node from the breadcrumb trail. However it still leaves the main root node as follows:

Main : Home

In this case Home is the current page, and Main is a link to the currently displayed page (i.e. Home). This is clearly redundant.

Is it possible to change the -url declaration to in order to skip both superior levels, and if so can that be done only for non-logged in visitors?

Richard.

Collapse
Posted by Richard Hamilton on
Can anyone please explain how the -url declaration in this index.vuh tells the request processor to pretend that one of the site nodes doesn't exist?

Also, I have been searching for documentation that explains '::xowiki::Package initialize' but I cannot find anything appropriate. Any pointers gratefully received.

Richard

Collapse
Posted by Gustaf Neumann on
"initialize" is a method of the xo* package manager, that initializes a package for a http request (query context).

If you google for "instproc initialize" you find the generic https://openacs.org/api-doc/proc-view?proc=%3A%3Axo%3A%3APackageMgr+instproc+initialize
There is as well some info in the xowiki tutorial: http://alice.wu-wien.ac.at:8000/s5-xowiki-tutorial/slides

Collapse
Posted by Richard Hamilton on
Thank you Gustav. I am starting to work through your xotcl docs and these links will be very helpful.

I am hoping to get to grips with oo programming from scratch using xotcl in advance of re-writing an internal message package I wrote for an earlier version of OpenACS.

It is the kind of application that would lend itself to an oo approach.

R.

Collapse
Posted by Frank Bergmann on
Hi,

Thanks for the solution with the index.vuh. I'd also like to setup a plain Web site that only consists of an XoWiki in the root directory.

However, I'd like all XoWiki pages to appear in the root ("/") folder. They are found there, but links included in these pages point to /xowiki/page.

So: is there an elegant solution to keep these links in the main directory (eliminate the /xowiki/ from the links)?

It should be relatively easy to modify ::xowiki::Link render or ::xowiki::Package make_link, but that would be quite ugly.

Cheers,
Frank