Forum OpenACS Development: Re: Help with xowiki

Collapse
8: Re: Help with xowiki (response to 7)
Posted by Antonio Pisano on
Thank you very much, your pointers have been enlightening! Now that I grasp how to come up with a multirow from a FormPage things start to fit in my brain! Digging into form-usages gave me some more insight about how to filter instances, I think I will steal a bit from there! 😊

To better explain my requirements: the application I am writing is going to be a wiki for a good 99%. The remaining 1% is represented by the ability of adding attributes to pages and, most of all, the ability of managing wiki entries in a nice and easy way. In a word: customization.

My company has a long tradition of building effective UIs using "old style" template::list. As antiquate as it may be, this api si very, very mature and allows an easy and declarative approach to listing, while being tightly integrated with adp templating. Features we use the most are of course filtering and pagination.

About pagination in particular, as far as I could see, there doesn't seem to be already some machinery to achieve this using xowiki api. Am I correct?

P.S. xowf is going to be another tool I am going to know more about! ...but first things first!

Collapse
9: Re: Help with xowiki (response to 8)
Posted by Antonio Pisano on
Hello there,

thanks to Gustaf's pointers and some digging, I am starting to understand the internals of xowiki.

Now I am wondering what should be the best way to do this: I have a xowiki instance mounted that serves me as "xowiki engine". Alongside this I have created a package taking care of my particular UI requirements.

My UI is "mobile friendly", that is, my pages are built and shown with big buttons and such. To let xowiki pages come out like this I have customized xowiki's "view" and "edit" template. For "view", I have created a new template called "view-my-application" and set this in xowiki parameters. For "edit", I have customized the standard edit.adp, because I did'nt know how to make it otherwise.

I want my users to create content using my custom UI, but see the result of their work as plain xowiki pages, a regular webpage. Right now, as I have overridden templates, pages are shown in mobile version all the time.

I could make it by putting some if in the templates, but probably there is a smarter way to do this... any clue?

Collapse
10: Re: Help with xowiki (response to 9)
Posted by Gustaf Neumann on
Sorry for being slow with my answers, much to do these days.

Concerning pagination: there are several ways to perform pagination in xowiki, typically using the Table widget, using parameters such as page_size and page_number. Look for e.g. into the weblog-procs or includelets such as "recent" (where pagination is just used for the first page). When it comes to filtering, there is much less support as in the list widget in acs-templating.

For templating xowiki content: When using FormPages, the Form provides you with templates for displaying the content or editing the content. If you want to customize the wiki-menu etc. one can adapt the xowiki templates (xowiki/www/view-*.{adp|tcl}). Just now I've added a small change to let xowiki look as well into the resources directory of the theme. With this change, you should be able to use your own view-default.adp via the theme package, like in:
YOURTHEME/resources/templates/packages/xowiki/www/view-default.adp

Collapse
11: Re: Help with xowiki (response to 10)
Posted by Antonio Pisano on
Thanks Gustaf and don't worry, busy days for everyone.

For filtering and pagination I could come up with something that fits my needs for now, but I will look throughly into other options, as one of my requirements will be to establish some best practices for colleagues if this project goes on.

About templating there is still something I don't get. How can I tell my website "Render this xowiki page with template1" and in a second moment "Now render with template2"?

Right now I can customize my templates globally, but I can't use different templates "case by case". Is there a way to do that?

My scenario is using a back-office template when authoring pages, and a front-office one when seeing pages as regular people.

Collapse
12: Re: Help with xowiki (response to 11)
Posted by Gustaf Neumann on
As before, there are two levels: In order to render a ::xowiki::FormPage with different ::xowiki::Forms, one should use the xowf package. With this the chosen Form depends on the state and optionally by the role of the person viewing the data.

In order to use the different view-*.adp templates, on a per-use case, an approach like the following should work:

   ::xo::Package initialize -url /xowiki
   ::xo::cc set_parameter template_file YOURTEMPLATE
-g
Collapse
13: Re: Help with xowiki (response to 12)
Posted by Antonio Pisano on
That's the trick, thank you!

For reference, ::xo::cc set_parameter template_file YOURTEMPLATE should be called after package initialization, or ::xo::cc instance won't be available.

For my convenience, I have slightly changed index.vuh for xowiki on my instance, so it accepts also a "template_file" parameter. This way I can force the resolver to use the template I want when viewing xowiki pages, case by case. It's a poor man solution, but does exactly what I need and doesn't harm the package whatsoever.

Putting xowf in the mix could do, as I could say: "use this template when logged and another one otherwise", but probably is a bit too much right now. I will get there some other time.

Thanks again!