Forum OpenACS Q&A: Re: Any xowiki demo?

Collapse
10: Re: Any xowiki demo? (response to 9)
Posted by Gustaf Neumann on
Separating xowiki::Form from and xowiki::FormPage is a certain challenge. When i have some more resources free, i can try to address this problem, maybe together with the xotcl 2.* transition. But as a first step, we need the release of a non-beta version of xotcl 2.

Trying to subclass the Note demo under e.g. xowiki::FormPage does not make much sense. It is much easier to define the fields you want for the Note example in a xowiki::Form, configure away the fields that you do not want, and use "fill-out" to create instances. If you need fast access to the form fields from the database, use hstore. One drawback is that you get this way the semantics of the content-repository (with e.g. revisions, search integration, etc), which you might not want. If you want more control over the submit-buttons, actions, etc., use xowf.

Collapse
11: Re: Any xowiki demo? (response to 10)
Posted by Antonio Pisano on
Ok, I am getting something more now...

My problem now is that I can't find any example of instantiation of ::xowiki::Form by code, and I can't figure out which parameters supply... Is there any snippet from some code?

I could put it into docs

Collapse
12: Re: Any xowiki demo? (response to 11)
Posted by Antonio Pisano on
I had already found some exported forms here: http://openacs.org/file/1440073/form.export.export . Alas, they are not working on current XoWiki.

Looking further, I finally found this: http://alice.wu-wien.ac.at:8000/xowiki/download/file/xowiki-forms.examples

This was exactly what I was looking for! I've linked the examples in XoWiki doc page to ease the struggle for the posterity.

Collapse
13: Re: Any xowiki demo? (response to 12)
Posted by Gustaf Neumann on
Hi Antonio.

These are exports of xowiki instances, and not thought for humans! In applications, you will have different IDs, but most of these are provided as well automatically. Please look at the following example. I've added this as well to

http://alice.wu-wien.ac.at:8000/s5-xowiki-tutorial/slides#listing-form-create

all the best
-g

#
# Sample snippet to show, how to create an 
# ::xowiki::Form programmatically
#

# Get package_id by initializing the package
::xo::Package initialize -url /xowiki

set template {
  @listing@
}
set fc {
  listing:code_listing
}

# Create a form instance in memory
set form_id [::xowiki::Form new -destroy_on_cleanup \
             -package_id $package_id \
             -parent_id [$package_id folder_id] \
             -name "en:sample.form" \
             -anon_instances "f" \
             -form {} \
             -text [list $template text/html] \
             -form_constraints $fc]

# save the form to the root folder of the package
$form_id save_new

Collapse
14: Re: Any xowiki demo? (response to 13)
Posted by Antonio Pisano on
Thanks for the example!

Don't worry, I've stated clearly that those forms are meant to be imported into xowiki, rather than being used in code directly. I've found them useful to show some advanced form specification.