Forum OpenACS Development: xowiki prototypes

Collapse
Posted by Iuri Sampaio on
I created a new package that wraps up xowiki in a component/portlet/includelet

The package works in a way that for every project there is xowiki's instance wrapped in a component.

When the project is created a xowiki's instance is also instantiate using the API

site_node::instantiate_and_mount -parent_node_id $xowiki_node_id -node_name $project_id -package_key "xowiki" -package_name "XoWIKI $project_name"

Furthermore, we want the index page to have its content amended.

I tried to use content::revision::new but it didn't work because the "index page" isn't created (there is no item_id yet) right after the execution of API site_node::instantiate_and_mount

set item_name "xowiki: $project_wiki_package_id"
db_1row select_item_id {
SELECT item_id as page_item_id FROM cr_items WHERE parent_id = ( SELECT item_id FROM cr_items WHERE name = :item_name) AND name = 'en:index'
}

content::revision::new -item_id $page_item_id -content "{{recent -max_entries 25}}" -is_live "t"

On the other hand I could easily set the content of xowiki's index page by changing the file index.page within /packages/xowiki/www/prototypes.

However, this isn't the properly approach.
1) I must not touch in the xowiki's source code!!
2) I want the changes applied only for the instances which will be used as a project component. (not all of them)

Moreover, I created my own prototype at /packages/intranet-xowiki/www/prototypes/index.page

But I have no idea how to set them to be used.
I tried to force it calling
ad_return_template "/xowiki/?import_prototype_page=/packages/intranet-xowiki/www/prototype/index.page"

right after [site_node::mount_and _instantiate] but it was an unsuccessfully attempt.

Does anyone have an idea how to solve that?

Collapse
2: Re: xowiki prototypes (response to 1)
Posted by Malte Sussdorff on
How about calling

::xowiki::Package import_prototype_page -package_key "intranet-xowiki" -name "index" -parent_id (folder of the XoWIKI instance...) -package_id (package_id of the new xowiki instance)

once you have executed site_node::instantiate_and_mount. At this point both folder_id and package_id should be available to you.

Collapse
3: Re: xowiki prototypes (response to 2)
Posted by Iuri Sampaio on
I was expecting that. However none of those are available.
It seems xowiki does not instantiate the package on site_node::instantiate_and_mount.

At least neither package_id nor folder_id are on the respective tables yet (apm_packages, cr_items/cr_folders) .

Collapse
4: Re: xowiki prototypes (response to 1)
Posted by Gustaf Neumann on
My suspicion is that the passed values to instantiate_and_mount are incorrect, or you have some half-broken entries from some earlier attempts. See xowiki/www/admin/test.tcl for an example where a new instance is created using "site_node::instantiate_and_mount".

For proper subclassing xowiki (to build some own value added versions of xowiki) see the s5 package in the openacs cvs.