Forum OpenACS Development: xowiki prototypes

Collapse
Posted by Pablo Moreno-Ger on
Hi all!

I am trying to use the prototype concept in xowiki (using version 0.37) to create new wiki pages, but I think I'm not really understanding their use.

My initial understanding was that executing one of these pieces of code (from the DS shell, for example) would create a page and I would see it on the lists. I have tried that without success.

Since that's exactly what I'm trying to do (create a xowiki page from a the code of a different package without user intervention), maybe I'm just seeing what I wanted to see behind prototypes :)

Could someone put me in the right direction? A couple of hints could be enough.

Collapse
2: Re: xowiki prototypes (response to 1)
Posted by Åsmund Realfsen on
Hi Pablo,

I don not know if this is what you are looking for, but I create a XoWiki page like this :

-------------------------------------------------
# Create PlainPage object
::xowiki::PlainPage create ::$page_name -noinit \
-set creator $creator_name \
-set object_type ::xowiki::PlainPage \
-set lang en \
-set text $body \
-set title "$title" \
-set nls_language en_US \
-name "en:$page_name"

# Import page object.
ns_log notice [::xowiki::Page import -objects ::$page_name -package_id $package_id -folder_id $folder_id]
--------------------------------------------------

Collapse
3: Re: xowiki prototypes (response to 2)
Posted by Pablo Moreno-Ger on
Hi Åsmund,

that certainly works and will do the job for us perfectly. Thank you very much!

Pablo.

P.S.: I'm still curious about the prototype system.

Collapse
4: Re: xowiki prototypes (response to 1)
Posted by Gustaf Neumann on
Åsmund was describing, what xowiki's import is doing. The same is essentially used in the section "Import and Export of XoWiki Pages" in http://media.wu-wien.ac.at/download/xowiki-doc/,
where pages are generated to be imported into xowiki via the admin pages. Import/export is a tool quite useful for mass import or creating pages from a program.

The intention of the xowiki prototypes is different. XOWiki prototypes are an instrument, where one can ship an xowiki installation with predefined pages, which are instantiated on demand for every instance. See for example the predefined index page /packages/xowiki/www/prototypes/index.page. This page is the default index page for every xowiki instance. During the first request, this page is loaded and added as all other xowiki pages into the content repository, where it can be edited etc. One can for example delete the index page from the xowiki menu bar, and on the next request, it is regenerated from the prototype. The same happens e.g. as well for the weblog /packages/xowiki/www/prototypes/weblog.page. Or one can provide "CGI-like" pages (pages containing executable code, see e.g. the samples in /packages/xowiki/www/prototypes/)

The prototype can be easily tailored for every xowiki installation by simply editing this file. It is as well straight forward to add new other pages in the same format.

My initial understanding was that executing one of these
pieces of code (from the DS shell, for example) would
create a page and I would see it on the lists. I have
tried that without success.

the prototypes are not executed from the developer shell, they are created on demand. Make a new xowiki instance, got to admin/list; you will see no weblog page. now type in the URL yourinstance/weblog, and go back to admin/list... now all parts of the weblog are created...

hope, this helps.

-gustaf neumann