Forum OpenACS Development: XoWiki

Collapse
Posted by Gustaf Neumann on
Over the last week, i developed a small package called XoWiki (bsd-style open source license) that some of you might be interested in. It has a few quite interesting functions.

Instead of trying to implement the full set of wiki markup commands of systems like MediaWiki, XoWiki is based on a rich text editor and focuses more on integration with oacs (e.g categories, general comments, adp-includes). XoWiki combines aspects of wikis (ease of page-creation) with aspects of a content management system (revisions, reusable content, multiple languages). Furthermore, XoWiki allows to define different types of links such one could define book-structures (where a navigation structure could be built on the fly) or glossaries with differnt kind of word relationships (like synonyms, etc.). XoWiki supports pages in multiple languages and is localized (currently only for English and German).

For more details, see http://media.wu-wien.ac.at/download/xowiki-doc/index.html

In the same step, i have replaced in my oacs 5.2b5 revision
RTE with xinha, which is much nicer. If there is interest, i can provide patches or import the changed files (and/or xowiki) into CVS.

When i upgraded to the selva theme, i noticed that the contents of the title variable is not displayed on the pages. Is this intended?

Collapse
2: Re: XoWiki (response to 1)
Posted by Malte Sussdorff on
Could you upload the patch somewhere? And did you commit XoWiki to the CVS in the 5.2 branch (or head for that matter). This is definitely something with which I can finally put ETP to rest for our site, at least from the looks at it.

As for Xinha, is it possible to reduce the number of features using a parameter in acs-templating and thereby make it quicker to download?

Furthermore, has anyone thought about a method to support multiple editors within OpenACS?

Collapse
3: Re: XoWiki (response to 1)
Posted by Dave Bauer on
Malt, multiple editors seems like a good idea.

I agree the Xinha is too big by default and takes a long time to load. Especially using it with a Wiki style package it makes sense to reduce the number of options.

I will check out this, it sounds like a good addition to openacs.

Collapse
4: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
xinha is not the "perfect" solution, since it is a little slow on displaying. It is not only the number of options that cause this. however, xinha is functionally quite good and has many of the problems removed that existed as well in the lastest revisions of htmlarea (e.g. focus problems in tables). xinha has a good plug-in model and produces resonable code. we have developed such an image selection-plugin for learn@wu to choose images from certain folders. when i find the time, i will clean it up and make it available...

For now i will make a simple hack to make xinha coexisting/easy switchable with rte and check this into 5.2 if nobody objects.

Collapse
5: Re: XoWiki (response to 1)
Posted by Dave Bauer on
This looks nice.

I installed XoTcl 1.3.8 xotcl-core 0.18 and xowiki but I can't get it to work.

Here is the error message:

undefined variable `object_type_key'
    while executing
"ns_pg_bind select nsdb0 {
      select object_type from acs_object_types where
      tree_sortkey between :object_type_key and tree_right(:object_typ..."
    ("uplevel" body line 1)
    invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
    ("postgresql" arm line 2)
    invoked from within
"switch $driverkey {
                oracle {
                    return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
                }
       ..."

Sorry, I don't know enough XoTcl to debug it further. It appears that the object_type_key instvar is supposed to be set by the CrClass instproc init but apparently that has not happened?

It looks like its this code in index.tcl that is failing:

if {![info exists object_type]} {
  set object_types [$supertype object_types]
  set page_title "List of all kind of [$supertype set pretty_plural] \
    ([join $object_types {, }])"
  set with_subtypes true
  set object_type $supertype
} else {

Any hints?

Thanks!
Dave

Collapse
6: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Hmm, if you check your log-file, you see some earlier error during schema generation. Sorry for that, a result of an untested cleanup, this code is not run when the schema is already there. i did a fresh install on a 5.1.* oacs and found that i used as well a call of the cr-interface introduced in 5.2; i have removed that as well and detected a missing localize entry in xowiki as well, so i upgraded all
version numbers:

hope, i have got it right by now....

Collapse
7: Re: XoWiki (response to 1)
Posted by Dave Bauer on
Thank you. It is working now. I had to comment out a check for a dotlrn community since I wasn't using dotlrn.
Collapse
8: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
ok, i have made the check for the dotlrn communities conditional in my local version.

as announced, i have as well committed the change for xinha support to cvs 5.2. per default, rte is used as before. when one sets the line

set richtextEditor xinha

in template::widget::richtext, one can switch easily to xinha. It should be quite simple now to add a parameter....
Affected files are

  • www/blank-master.adp
  • www/blank-master.tcl
  • packages/acs-templating/tcl/richtext-procs.tcl

However, i was not able to add the xinha sources to
packages/acs-templating/www/resources/xinha-nightly/

i always get some messages like:

cvs commit: failed to create lock directory for `/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FindReplace' (/cvsroot/openacs-4/packages/acs-templating/www/resources/xinha-nightly/plugins/FindReplace/#cvs.lock): No such file or directory
cvs commit: lock failed - giving up
cvs [commit aborted]: lock failed - giving up

i am not sure, what i have done wrong, but i am giving up by now (5 o'clock in the morning).
can someone please get the xinha sources from its web site and place it there?

thanks -gustaf

Collapse
9: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
well, it seems, i have finally managed to get the xinha tree successfully into the oacs-5-2 branch.
Collapse
10: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
I would recommend to commit this work in oacs-5-2 since from what I see XoTCL can be installed optionally.
Collapse
11: Re: XoWiki (response to 1)
Posted by Alfred Essa on
Gustaf this is fabulous. Great work. It will be very valuable to have a Wiki package tightly integrated with oacs.
Collapse
12: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Upgraded from an older version of xowiki and tried to create a new page. But got this:

Database operation "select" failed (exception NSDB, "Query was not a statement returning rows.")

FEHLER: Spalte »link_type« existiert nicht

SQL: SELECT page,ci.name,link_type from xowiki_references, cr_items ci where reference=1456296 and ci.item_id = page
while executing
"ns_pg_bind select nsdb0 {SELECT page,ci.name,link_type from xowiki_references, cr_items ci where reference=1456296 and ci.item_id = page}"
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
("postgresql" arm line 2)
invoked from within
"switch $driverkey {
oracle {
return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
}
..."
invoked from within
"db_exec select $db $full_statement_name $sql"
invoked from within
"set selection [db_exec select $db $full_statement_name $sql]"
("uplevel" body line 2)
invoked from within
"uplevel 1 $code_block "
invoked from within
"db_with_handle -dbn $dbn db {
set selection [db_exec select $db $full_statement_name $sql]

set result [list]

while { [db_get..."
(procedure "db_list_of_lists" line 9)
invoked from within
"db_list_of_lists references "SELECT page,ci.name,link_type from xowiki_references, cr_items ci where reference=[my page_id] and ci.item_id = page""
(procedure "references" line 4)
::xotcl::__#0 ::xowiki::Page->references
invoked from within
"$page references"
invoked from within
"set references [$page references]"
("uplevel" body line 24)
invoked from within
"uplevel {
ad_page_contract {
view a wiki item

@author Gustaf Neumann (mailto:gustaf.neumann@wu-wien.ac.at)
@creation-date Oct 23, 2005
@cvs-i..."
(procedure "code::tcl::/www/unima0/packages/xowiki/www/view" line 2)
invoked from within
"code::tcl::$__adp_stub"
invoked from within
"if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init tcl $__adp_stub
..."
("uplevel" body line 3)
invoked from within
"uplevel {

if { [file exists $__adp_stub.tcl] } {

# ensure that data source preparation procedure exists and is up-to-date
adp_init t..."
(procedure "adp_prepare" line 2)
invoked from within
"adp_prepare "
(procedure "template::adp_parse" line 30)
invoked from within
"template::adp_parse [file root [ad_conn file]] {}"
(procedure "adp_parse_ad_conn_file" line 5)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$path""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$path"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl_url2path_info..."

Collapse
13: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Nima,

i have not implemented an update script from the first pre-releases. i should have warned you. Do from sql a

drop table xowiki_references;
and do a reboot. The table will recreate itself
when you view the pages...

-gustaf

Collapse
14: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
I am pleased to annonce a better and improved version of XoWiki. The following are the most important changes:
  • Support for different types of wiki pages. Included is support for the rich text and plain text interface. In general, pages can differ much more. See bottom of the documentation page mentioned below.

  • Initial support for nested wiki pages (not yet updating the links of the including page, not yet using typed links to indicate inclusion structure, but checking recurion depth).
    Example: {{adp portlets/wiki {name en:GN}}}

  • Some code reorganizations: Better structure, less passing around of form arguments, better access to relevant data in including adp-pages. Added recursion count for nested wiki pages.
  • Moved images to www/resources

  • Removed dependency on dotlrn (thanks to Dave pointing this out)

Brian, it should be quite simple now (famous last words) to hook in your plain-text parser. Just check out

CrWikiPlainPage instproc substitute_markup
in xowiki-procs.

For more details and sources, see http://media.wu-wien.ac.at/download/xowiki-doc/index.html

Collapse
15: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Hi everybody! On the usual place is now a new an slightly improved verison of XoWiki.

The biggest change is a the integration of XoWiki with a file-selector which can be used to select images from the file store or to make internal links to files of certain types in the file store. The file-selector was originally developed by Günther Ernst from the Learn@WU-project. I have invested a few days to remove our local dependencies, to make it more configurable, flexible, and easier to integrate.

The file-selector is now configured from the richttext form specification (see below for an example), where one can specify the folder_id, or the file-store, or some pattern for file types.

In oder to use xinha in a richtext field, one has to use editor xinha in the options of the richtext form field specification. The following options for xinha may be specified:

  • editor: xinha
  • height: height of the xinha widget (e.g. 350px)
  • width: width of the xinha widget (e.g. 500px)
  • plugins: tcl list of plugins to be used in xinha. The new plugin for the oacs file selector is called OacsFs. If no options are specified, the following plugins will be loaded:

    GetHtml CharacterMap ContextMenu FullScreen
    ListType TableOperations EditTag LangMarks Abbreviation
The following options are used by the OacsFs plugin
  • folder_id: the folder from which files should be taken for the file selector. Can be used alterantive with fs_package_id, whatever more handy in the application.

  • fs_package_id: the package id of the file_storage package from which files should be taken for the file selector. Can be used alterantive with folder_id, whatever more handy in the application. If nothing is specified, the globally mounted file-store is used.

  • file_types: SQL match pattern for selecting certain types of files (e.g. pdf files). The match pattern is applied on the MIME type of the field. E.g. a value of %text/% allows any kind of text files to be selected, while %pdf% could be used for pdf-files. If nothing is specified, all file-types are presented.

Here is an example for the use of the xinha widget with some options:

   text:richtext(richtext),nospell,optional
	  {label Inhalt}
	  {options {editor xinha plugins OacsFs height 350px file_types %pdf%}}
	  {html {rows 15 cols 50 style {width: 100%}}}
The changes for richtext and blank-master, as well an updated version of xinha, and the OACS file-selector widget are commited to the oacs-5-2 branch.

Caveat: the three adp-files needed for the OpenACS file selector (insert-image, insert-ilink and file-selector) are currently part of the xowiki package, since acs-templating is per default not mounted. Does anyone has some suggestions, where these files should go?

The picture gallery in http://media.wu-wien.ac.at/download/xowiki-doc/index.html contains now a screen shot of the file-selector. In addition, i have added a screen shot with a wiki-page with a complex form on it (this would be some challenge in a classical wiki) and the documentation of XoWiki as a wiki page.

i hope, somebody finds this useful.

Collapse
16: Re: XoWiki (response to 1)
Posted by Dave Bauer on
Gustaf,

You can put the files under /packages/acs-templating/lib/

The /lib/ directory under a package is the standard location to put includable adps.

This sounds like a great addition, I can't wait to try it out.

Collapse
17: Re: XoWiki (response to 1)
Posted by Nick Carroll on
Gustaf,

I noticed on your ToDo list that you need to do RSS support and search integration. From what Dave Bauer has been telling me, if you do the new search integration, you get RSS support for free. So you won't have to use the rss-support package.

Also, I was wondering if you will be supporting MathML in xowiki?

Cheers,
Nick.

Collapse
18: Re: XoWiki (response to 1)
Posted by Orzenil Silva Junior on
Hi Gustaf,

xoWiki is amazing! xoTcl will be a great addition when fully integrated in OpenACS 5.2. Thanks for your support and sharing.

File-selector as you implemented using xinha plugin is a great idea.

A problem i had trying file-selector:

OacsFs xinha plugin files in acs-templating/www/resources/xinha-nightly/plugins/OacsFs
were not commited to oacs-5-2 branch. They are only in HEAD for now.

Collapse
19: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Orzenil, i think, i have managed to move it into oacs-5-2
Collapse
20: Re: Re: XoWiki (response to 19)
Posted by Orzenil Silva Junior on
thank you, Gustaf. It is into oacs-5-2 now 😊

One more stuff i needed to do to get oacsFS plugin working is about a type error in xowiki/www/xinha/file-selector.tcl file

In lines 121 and 130 i changed package_id switch value in proc fs::add_file from

fs::add_file \
...
-package_id $package_id

to

fs::add_file \
...
-package_id $fs_package_id

\Orzenil

Collapse
21: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Orzenil, thanks a lot for this report. It happend in the last round of cleanup, and apparently, i did not try to upload a new file over the file-selector after that.

I have placed a fixed version of the file-selector into the xowiki package (version 0.10) and into CVS under xinha as well. The most boring thing about xinha is currently that it takes a while for displaying the first time. There is a certain hope for improvement, as someone starts integrating xinha into firefox via xul (see xinha forum). This could drastically improve the loading time....

The updated version of XoWiki supports now adp-template substitutions in the Wiki pages. If a page contains e.g. @title@, this string will be substituted by the actual title of the wiki page. This way, the attributes of the instance record in the database and the instance variables of the WikiPage objects can be addressed. Check out to section Templates on the http://media.wu-wien.ac.at/download/xowiki-doc/index.html and the added screen shots.

Collapse
23: Re: Re: XoWiki (response to 21)
Posted by Orzenil Silva Junior on
Gustaf,

a javascript error is occurring in file-selector. The fix i made:

in file-selector.adp look for:

opener.document.getElementById("f_title").value = document.getElementById(id + "_file_title").value;

and replace "f_title" with "f_alt" so it looks now:

opener.document.getElementById("f_alt").value = document.getElementById(id + "_file_title").value;

yes, i noted xinha takes a while for displaying the first time but it integrates well into applications. I am using firefox for Gnu/Linux and tried xinha using oacsFS plugin with xowiki, forums and weblogger and it worked well. I will try it with other browsers and see how is the behavior.

Collapse
22: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Dave wrote
You can put the files under /packages/acs-templating/lib/

I believe, this does not help much, since the tcl/adp pairs insert-image, insert-ilink and file-selector are called from java script. We cannot call http://.../acs-templating/lib/xinha/insert-image directly through the request processor. The actual call must come from a mounted package like xowiki (where we could certainly use the adp-include), but this seems not perfect as well, since every app using xinha+file selector must do this. Or is there some other trick?

Collapse
24: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Orzenil,

i assume, you got this message when inserting an image, not a link. Your fix appears correct, but insterestingly, this error does not pop up on the java script console of Firefox 1.0.7 of my mac os x box. Your fix will be included in the next release.

although i have not tested it with the most recent nightly version, at least earlier version of xinha worked with IE.

Collapse
25: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
just tested a few browsers with the current version of xinha:
I looks, as if currently, only firefox (unix/mac/win) works.

Safari (Mac OS X) does not work (it says, to old), IE (win) has currently a problem apparently with the plugins loading (happens in xinha). There are many switches in the xinha code querying IE, so i hope, the problem is only temporarily.

Collapse
26: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Orzenil, i found and fixed locally the showstopper for xinha + oacsfs for IE. i have to rush now, but will check in the changes this evening.
Collapse
27: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Xinha works now with the OacsFs for IE.

The fix is in the repository and in the xowiki apm (0.11). The main problem was that the length of an initialized array was returned in Firefox as 2, while it was 3 in IE. No wonder that many javascripts have problems on different platforms. I have as well improved a little the sizing of the popup for ilink in IE.

Collapse
28: Re: XoWiki (response to 1)
Posted by Ivan Histand on
Gustaf,

Thanks very much for the work that you have done on this module. I think it will be very useful.

I have installed it in a default installation of the 5.2 branch, and seem to be running into a problem when viewing items. I can edit and create new items just fine, the error comes when viewing.

Here's an url to my dev site, you don't need a login to see the error, just click on the view icon: http://coastalportraits.org/xowiki/

I've pasted the first few lines of the stack trace below:

::xotcl::nonposArgs: unable to dispatch method 'Boolean'
while executing
"::xotcl::nonposArgs Boolean adp on"
invoked from within
"::xotcl::interpretNonpositionalArgs $args"
(procedure "render" line 2)
::xotcl::__#0 ::CrWikiPage->render
invoked from within
"$page render -adp on"
invoked from within
"set content [$page render -adp on]"
("uplevel" body line 29)
invoked from within
"uplevel {
ad_page_contract {
view a wiki item

Any ideas what I should look at to debug this issue?

Thanks,
Ivan

Collapse
29: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Sorry for that. Change the capital B into a lower b in "Boolean" in the xowiki-procs, or get verison 12. This typo must have sneaked in after makeing the screen shots for the templating variables... Guess, regression testing as part of the release process is one of the next issues for xowiki.
Collapse
30: Re: XoWiki (response to 1)
Posted by Ivan Histand on
Gustaf, thank you for the fix, it is now working for me.  The only other bug I've found is a minor dependency issue, I've added the following to my xowiki.info file to resolve this:

<requires url="categories" version="1.1d4"/>
<requires url="file-storage" version="5.2.0d8"/>

Thanks again!
Ivan

Collapse
31: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Ivan, actually, xotcl-core uses categoriesin its form support, and xowiki requests it. similarly, filestore is used only in the dialog boxes of richtext. These are rather weak dependencies (rather uses). however, crashing if the packages are not there is not a good idea either, so i added these dependencies.

Just now, i have added on the usual place http://media.wu-wien.ac.at/download/xowiki-doc/index.html a new version of xowiki. It has two major changes: Page templates and it uses the new form system from xotcl-core.

As my toenails were always curling up when i tried to implement various similar ad_forms for various kinds of wiki pages, i gave up and wrote some better infrastructure where one can subclass forms (still based on ad_form). i do not like the communitcation btwn. tcl and adp via upvars and ad_levels etc. This should be objects with adp-markup as facades, but this is another story.

The new xowiki uses this new infrastrucure, so some new bugs are not unlinkely. i have as well changed the way how "extra" attributes are handled (using now cr_atrributes). These changes were necessary for implementing page templates and page instances.

A page template is a wiki page, containing "undefined" template variables and is similar to a slide master in presentation graphics. when a page instance is created, one can choose an according page template from a drop down list and provide values for the missing information. The according form is generated on the fly. In the current version, the filled in values are uninterpreted text. See the new section in the documentation for some screen shots and more details.

Collapse
32: Re: XoWiki (response to 1)
Posted by Nick Carroll on
Gustaf,

I just tried to compile thread 2.6.1 with the command:

sudo ../configure --enable-threads \
--prefix=/usr/local/aolserver \
--exec-prefix=/usr/local/aolserver \
--with-aolserver=/usr/local/aolserver

as specified in your documentation, and got the following error:

checking for correct TEA configuration... ok (TEA 3.1)
checking for Tcl configuration... configure: WARNING: "Cannot find Tcl configuration definitions"

Turns out that you need to specify the location of TCL. Would you be able to update your documentation with the --with-tcl flag, as follows:

sudo ../configure --enable-threads \
--prefix=/usr/local/aolserver \
--exec-prefix=/usr/local/aolserver \
--with-aolserver=/usr/local/aolserver \
--with-tcl=/usr/lib/tcl8.4

Collapse
33: Re: XoWiki (response to 1)
Posted by Nick Carroll on
Gustaf,

You need to specify a dependency on general comments in xowiki. Otherwise you get errors on the view page, as the general comment procs are not defined.

Collapse
34: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Nick,

concerning libthread compilation: the need for --with-tcl depends on the local configuration. you are right, --with-tcl should be mentioned. btw. xowiki does not depend on libthread.

You are also right about the general comments dependency. Either i add the dependency or make the code conditionally. The blueprint concepts make me lazy in defining this dependencies, and does not scale well when the number of packages grows....

Is there a general rule when to add dependencies? Is it correct to assume that every package required and not staring with "acs-" needs a dependency?

Collapse
35: Re: XoWiki (response to 1)
Posted by Malte Sussdorff on
Gustaf, if your code relies on API or Includes from a third package a dependency is in order. Also make sure that you update the dependency requirements from time to time.

All packages should have a dependency on the kernel version they need to run so you could detect what version of OpenACS is needed.

So better be save then sorry and add more than less strict dependencies to the system. I realized a couple of times that I forgot to update the required version number, which left me sometimes wondering in the dark why it worked on site one but not on site two.

Collapse
36: Re: XoWiki (response to 1)
Posted by Joe Cooper on
Hi Gustaf and all,

I'm still running OACS 5.1.5 on my production server. Any chance I'll be able to cajole XOWiki into working on that version, or am I asking for trouble?

Thanks!

Collapse
37: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Joe,

the only problem i know with 5.1.5 is the issue with content_type__create_attribute(see https://openacs.org/forums/message-view?message_id=349019)
which is in turn only needed so far for the page templates/page instances (see http://media.wu-wien.ac.at/download/xowiki-doc/index.html towards the end). it should not be a big problem to make it conditionally, such one can use the rest of the package. Would this help you?

Collapse
38: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Joe, i have committed a verison working with 5.1.5 to CVS head, which has PageInstance and PageTemplate deactivated. When someone fixes the magically created views NAMEi and NAMEx to include the extra attributes like in 5.2, xowiki would work most probably completely with 5.1.
Collapse
39: Re: Re: XoWiki (response to 38)
Posted by Joe Cooper on
Hey Gustaf,

I'm not sure what you just said, but it sounds promising. 😉

I'll give it a bit of experimentation this weekend. It looks like the perfect thing for documentation on my site. (If only I can figure out a good automated way to convert my few hundred pages of DocBook XML to Wiki markup...)

Thanks!

Collapse
40: Re: XoWiki (response to 1)
Posted by Malte Sussdorff on
Joe, please do and the community will be forever grateful, as this means we can convert *our* docbook as well into Wiki and therefore effectively maintain the documentation without the docbook hurdle.
Collapse
41: Re: XoWiki (response to 1)
Posted by Ivan Histand on
Hi Gustaf,

I'm getting the following error when trying to edit a page instance, and have not had any success in tracking it down, can you point me in the right direction? Dev instance is at http://coastalportraits.org/xowiki Installation is the 5.2 released version plus the HEAD on all xotcl packages.

==========================
Database operation "dml" failed (exception ERROR, "ERROR: column "page_template" of relation "xowiki_page_instancei" does not exist
")

ERROR: column "page_template" of relation "xowiki_page_instancei" does not exist

SQL:
insert into xowiki_page_instancei (item_id,revision_id,title,description,mime_type,nls_language,text,page_template,instance_attributes)
values ('1002','1004','en:Test Page Instance','Hello World Test Page Instance','text/plain','en_US',NULL,'998',NULL)
while executing
"ns_pg_bind dml nsdb0 {
insert into xowiki_page_instancei (item_id,revision_id,title,description,mime_type,nls_language,text,page_template,instance_at..."
("uplevel" body line 1)
invoked from within
"uplevel $ulevel [list ns_pg_bind $type $db $sql]"
("postgresql" arm line 2)
invoked from within
"switch $driverkey {
oracle {
return [uplevel $ulevel [list ns_ora $type $db $sql] $args]
}
..."
invoked from within
"db_exec dml $db $full_statement_name $sql"

Collapse
42: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Since you have no page instance in your list, my guess is that the error does not occur during edit, but in an page create, when you press "add ...".

The error message indicates that the automatically created view does still not have the extra attributes (page template).

from psql, you should see:

# \d xowiki_page_instancei
            View "public.xowiki_page_instancei"
       Column        |           Type           | Modifiers
---------------------+--------------------------+-----------
 object_id           | integer                  |
 object_type         | character varying(100)   |
 object_title        | character varying(1000)  |
 object_package_id   | integer                  |
 context_id          | integer                  |
 security_inherit_p  | boolean                  |
 creation_user       | integer                  |
 creation_date       | timestamp with time zone |
 creation_ip         | character varying(50)    |
 last_modified       | timestamp with time zone |
 modifying_user      | integer                  |
 modifying_ip        | character varying(50)    |
 tree_sortkey        | bit varying              |
 max_child_sortkey   | bit varying              |
 revision_id         | integer                  |
 title               | character varying(1000)  |
 item_id             | integer                  |
 data                | text                     |
 text                | text                     |
 description         | text                     |
 publish_date        | timestamp with time zone |
 mime_type           | character varying(200)   |
 nls_language        | character varying(50)    |
 page_instance_id    | integer                  |
 page_template       | text                     |
 instance_attributes | text                     |
 page_id             | integer                  |

so, i guess there is something left in the database from your last attemtpts from earlier versions. I would try to get rid of the definitions of the page instance.

try xowiki/admin and drop the type + table from there. if you don't see this type, you might try "::xowiki::PageInstance drop_object_type" from the ds/shell.

if this does not work either, drop the page_instance* tables manually and delete the object type: delete from acs_object_types where object_type like '%PageInstance%';

when you restart your server, xowiki will recreate the tables/views on the fly.

btw, the page template on your site does not contain @-variables, so the page instance will look exactly like the template. look into the html documentation for examples.

Ps: i cant recreate the problem on your site, since one needs an account for adding items.

help this helps

Collapse
43: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Forget my last posting. I started with a fresh install of openacs-5-2, could repoduced the bug, and fixed it (version mismatch on my side). The fixed version works with 5.1.5 as well.

Happy new year!

Collapse
44: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Get the new version from CVS head.
Collapse
45: Re: XoWiki (response to 1)
Posted by Ben Koot on
Can someone please add XOwiki to the repository, so it becomes possible for people not familiar with installing from CVS to start using the package?

Alternatively, is there an instruction for end-users about how to use the CVS? If so, please add them to the CVS section of the blog

Thanks
Ben

Collapse
46: Re: XoWiki (response to 1)
Posted by Gustaf Neumann on
Ben,

you should be able to install it from
http://media.wu-wien.ac.at/download/xotcl-core-0.30.apm
http://media.wu-wien.ac.at/download/xowiki-0.17.apm
from from server via /acs-admin/apm/package-load, provided that you have xotcl akready installed.

i have no idea how openacs.org/repository works, but this would be certainly a more convenient approach from upgrading packages for non-programmers. an alternative approach would be t allow access to the cvs repository via a oacs-web interface.

Collapse
47: Re: XoWiki (response to 1)
Posted by Ben Koot on
Gustaf,

It seems we both have the same problem 😉 I guess it won't be rocket science for the oacs gurus to come up with a solution.

Cheers
Ben

Collapse
48: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Has someone a working example for a single select and multiple choice question using xowiki::Form?
Collapse
49: Re: XoWiki (response to 48)
Posted by Nima Mazloumi on
Form:
@mc@

Constraints:
mc:select,required,options=?

Not sure how to enter the options.

Collapse
50: Re: XoWiki (response to 48)
Posted by Nima Mazloumi on
If I use html form direclty the options are missing:
<form>
<select name="standards">
<option value="1" selected="selected">1</option>
<option value="2">2</option>
<option value="3">3</option>
</select>
</form>
Collapse
51: Re: XoWiki (response to 48)
Posted by Nima Mazloumi on
Another problem I have. I use xowiki::Form with this:

Template:
@myvar@

Form:
&lt;input name="myvar" type="text" /&gt;

When I fill out the form leaving myvar empty I get:

**** unknown variable 'myvar' **** (::6545133 ::xowiki::FormPage->get_value)

I tried the constraints:

@fields:optional or myvar:optional but it doesn't help.

Any idea?

Collapse
52: Re: XoWiki (response to 51)
Posted by Gustaf Neumann on

q1: every form-field-spec in the form constraints is a Tcl list element. therefore use

Form:
@mc@

Constraints:
{mc:select,required,options={yes 1} {no 0}}

q2: There is a but in some tdom versions that convert the given text to

<form>
<select name="standards">
<option value="1" selected="selected"></option>1
<option value="2"></option>2
<option value="3"></option>3
</select>
</form>
which is not displayed. an upgrade of tdom from cvs should help.

q3: unknown variable 'myvar'
The message says, that there are form entries in your database that have this variable not defined. This is most likely due to the fact that you have changed to form after some instances got some values. Most likely, you can deleted some earlier form instances to get rid of the warning message.

oops, i missed q0: examples:
Here are single and multiple choice questions: http://alice.wu-wien.ac.at:8000/xowiki-demo/klausur
some more examples: http://alice.wu-wien.ac.at:8000/s5-xowiki-060/slides

i have added the export of the demo examples above to http://media.wu-wien.ac.at/download/xowiki-forms-demo.export

Collapse
53: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Thank you Gustaf.

cvs.tdom.org is down for days. I ugraded from 0.8.1 to 0.8.2 and now you mc example works.

I removed all existing form pages but the error with the unknown variable still exists.

Collapse
54: Re: XoWiki (response to 53)
Posted by Gustaf Neumann on
hmm, it works for me (without form constraints). you say, you get the message after filling out the form? what version do you use?
Collapse
55: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
I use tDom 0.8.2, xotcl-core 0.56.3, xowiki 0.60.3
here is my form export: https://openacs.org/storage/view/xowiki-resources//form.export
Collapse
56: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Is there support for boolean expressions in PageTemplate and Form (Template) like in acs templates? This would allow customization of the display attributes according to their value.
Collapse
57: Re: XoWiki (response to 56)
Posted by Gustaf Neumann on
The problem was not with input type text, as described above, but with input type checkbox (as seen in the example). checkboxes are different from other input types, since only checked items are transmitted. The problem existed, when they were specified literally in the HTML form. I think, i fixed these cases now in oacs-head and oacs-5-3.

concerning customization: i am not sure, what you have exactly in mind. there are multiple ways to customize form fields. if you want certain behavior on multiple form fields, the most flexible way is to subclass existing form field types. Look through the provided types in form-field procs. The verison in head has as well conditional properties.

Collapse
58: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Gurstaf, how would you recommend realising a small workflow? I would like to trigger an event after submit according to user entry like registration, package instance creating, confirmation email.
Collapse
60: Re: XoWiki (response to 58)
Posted by Gustaf Neumann on
i have this on my todo list, a convenient solution will still take some time. As always, a quick solution is easy, a full blown one is more complex. Quick solution: to fire an action in certain situations, subclass Form and FormPage and overload methods called in the interesting situations (e.g. the method save_data). This allows to call application specific calls before or after the methods in question.

if you want to go that way, just send me mail, i'll help to decouple Form and FormPage to make subclassing easier. I am quite busy until i leave for guatemala to get everything finished.

Collapse
59: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
With customization I meant for instance like this

&lt;if attr ne ""&gt;@attr@&lt;/if&gt;

Collapse
61: Re: XoWiki (response to 59)
Posted by Gustaf Neumann on
look e.g. at FormField::url or FormField::detail_link
Collapse
62: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
great. thank you. I will get in touch with you after the conference.
Collapse
63: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Two questions: Is it possible to
- set permissions that users can only create new formpages and edit/view/delete those they own
- activate notifications only for admins and/or only for items you own?
Collapse
64: Re: XoWiki (response to 63)
Posted by Gustaf Neumann on
q1: yes. this is possible. one can define a policy with the "role" creator, such that only the creator (and the admin) has rights to perform certain operations. This is independent of formpages and works for all kind of of xowiki objects. We did last year the conference registration for the Vienna OpenACS/DotLrn conference based on that.

q2: currently, one can subscribe either the whole xowiki instance (via package_id) or a category (subscribe to changes for pages having this category). It should be possible with moderate effort to add subscription for single items. Having this, it should be technically possible to auto-subscribe admins and owners for certain items. But both steps are not implemented, maybe there are better approaches to reach this effect.

Collapse
65: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
maybe we could manage notifications via security policies. then it would be easy on class and attribute level to define what can be sent out. what do you think?

same could apply to rss feeds, templates and the like.

Collapse
66: Re: XoWiki (response to 65)
Posted by Gustaf Neumann on
There exists a family of architectural styles and approaches using attribute based selection, which are often used in connection with event based systems (e.g. middleware). In such system, one can define types of events that trigger arbitrary actions for observed (managed) objects, where attributes are used as a selection mechanism of a monitor (quite similar to an access control monitor). Such approaches are frequently discussed in the area of publish/subscribe systems and event-based middleware (see e.g. http://www.computer.org/portal/site/dsonline/menuitem.9ed3d9924aeb0dcd82ccc6716bbe36ec/index.jsp?&pName=dso_level1&path=dsonline/topics/middleware/em&file=EM.xml&xsl=article.xsl
http://cocoon.ifs.tuwien.ac.at/pub/debs/debs2007.pdf
http://portal.acm.org/citation.cfm?id=966636).

xowiki policies make only one step in this direction, one could certainly bind some actions to the identified situations. However, this is a limited form (maybe still useful), where the publishing part (one should be able to publish event types, for which users could subscribe) and the user subscription part are missing. one could probably use the notification part of OpenACS.

Collapse
67: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Using policy3 results to the below error.

I use xotcl-core 0.56.3 und xowiki 0.60.3.

can't read "policy": no such variable
while executing
"$policy enforce_permissions $object $method"
(procedure "call" line 5)
::6616827 ::xowiki::Package->call
invoked from within
"my call $page $method"
(procedure "invoke" line 12)
::6616827 ::xowiki::Package->invoke
invoked from within
"::$package_id invoke -method $m"
invoked from within
"::$package_id reply_to_user [::$package_id invoke -method $m]"
(file "/www/unima2/packages/xowiki/www/index.vuh" line 21)
invoked from within
"source [ad_conn file]"
(procedure "rp_handle_tcl_request" line 3)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {

Collapse
68: Re: XoWiki (response to 67)
Posted by Gustaf Neumann on
whatever the error is, it is not related with policy3. It might be a consequence of an earlier error, or maybe of a package reload. If you find a way to reproduce the error, please report.
Collapse
69: Re: XoWiki (response to 68)
Posted by Nima Mazloumi on
I was not able to reproduce the policy3 error but the unknown variable 'myvar' still exists even with a new Form and FormPages.

You can reproduce it this way. Create a new form:

template:leave empty
form:

&lt;form>
&lt;div class="form-item-wrapper">
&lt;div class="form-label">Alternativen&nbsp;
&lt;/div>
&lt;div class="form-widget">Alt 1
&lt;input type="checkbox" value="t" name="a1" /> Alt 2
&lt;input type="checkbox" value="t" name="a2" />
&lt;/div>
&lt;/div>
&lt;/form>

constraints:
@cr_fields:hidden a1:boolean a2:boolean

Now create a new formpage but only check one of the two boxes. If you view the page everything is still fine.

now go back to form and add this to the form template:
@a1@ @a2@

Go back to the formpage. now you should get the message:
**** unknown variable 'a2' **** (::6546417 ::xowiki::FormPage->get_value)

Another problem I found while testing: Go back to form and add this constraint:

@table:a1,a2

When you go to the list view you will see one saying "yes" and one empty. Now edit the formpage and deselect the one selected and go back to the list view. it is still saying yes. go back and select the second save and deselect it and go to list view. now both say "yes".

A third thing I found: If I change to policy3 the list view is not permitted even though I am swa and have admin rights on the xowiki instance.

Collapse
70: Re: XoWiki (response to 69)
Posted by Gustaf Neumann on
Hi Nima,

the test cases appear to be correct in the head version. In the case of the table view, with "@table:a1,a2", it says first "yes" "no" and then "no" "no". I am not sure if it is worth backporting the fixes from the head version to oacs-5-3, since it is in some respects already quite different, and i have a very tough schedule until i leave on monday morning (including the materials for the conference).

The plan is to produce another stable version from head in the oacs-5-4 branch, which will have these problems fixed.

The permission stuff is simple to fix, there were no rules for Form in policy2 and policy3; see:
http://cvs.openacs.org/cvs/openacs-4/packages/xowiki/tcl/package-procs.tcl?r1=1.94&r2=1.95
One is only allowed to call methods if a policy permits it. Removing entries from there (or not adding it) makes methods unaccessible via the url interface.

Collapse
71: Re: XoWiki (response to 70)
Posted by Nima Mazloumi on
Thank you. I will test with head version.
Collapse
72: Re: Res: Re: XoWiki (response to 68)
Posted by Raúl Morales Hidalgo on
We get a similar error in an OpenACS 5.3 (oracle) checked out from CVS

can't read "policy": no such variable
while executing
"$policy defined_methods Package"
(procedure "resolve_page" line 9)
::950 ::xowiki::Package->resolve_page
invoked from within
"my resolve_page [my set object] method"
(procedure "invoke" line 6)
::950 ::xowiki::Package->invoke
invoked from within
"::$package_id invoke -method $m"
invoked from within
"::$package_id reply_to_user [::$package_id invoke -method $m]"
(file "/web/devext/packages/xowiki/www/index.vuh" line 21)
invoked from within
"source [ad_conn file]"
(procedure "rp_handle_tcl_request" line 3)
invoked from within
"$handler"
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
$handler
} ad_script_abort val {
# do nothing
}"
invoked from within
"rp_serve_concrete_file [ad_conn file]"
(procedure "rp_serve_abstract_file" line 60)
invoked from within
"rp_serve_abstract_file "$root/$path""
("uplevel" body line 2)
invoked from within
"uplevel $code"
invoked from within
"ad_try {
rp_serve_abstract_file "$root/$path"
set tcl_url2file([ad_conn url]) [ad_conn file]
set tcl_url2path_info..."

the versions are the ones from CVS oacs-5-3:

xotcl-core 0.56.3
xowiki 0.60.3

we have the error in aproximately half of the clicks within xowiki pages so we can't reproduce it always but very often.
It's not always in resolve_page, in fact more often we got it in the call procedure,

Any Ideas or any further things we should test?

thanks in advance

Collapse
73: Re: XoWiki (response to 1)
Posted by Nima Mazloumi on
Is there a way to inlcude an xowiki page into a normal adp page?
Collapse
74: Re: XoWiki (response to 73)
Posted by Gustaf Neumann on
&lt;include src="/packages/xowiki/lib/view" url="@url@" template_file="view-links"&gt;
Collapse
75: Re: XoWiki (response to 74)
Posted by Nima Mazloumi on
Great! Thank you.