Hi All,
I'm trying to import a number of HTML pages into our ]po[ Documentation XoWiki:
AOLserver: 4.5.1
OpenACS: 5.4.0
XoTCL-Core: 0.106
XoWiki: 0.118
I'm using the script from the XoWiki manual to import HTML pages:
## A small script to load the OpenACS documentation into xowiki
## by Gustaf Neumann
## load doc pages into xowiki -gustaf neumann
# include path for loading tdom
lappend auto_path /usr/local/aolserver4/lib
package require tdom
package require XOTcl; namespace import ::xotcl::*
package require xotcl::serializer
namespace eval ::xowiki {
Class create Page -parameter { {lang en} {description ""} {text ""}
{nls_language en_US} {mime_type text/html} name title text
}
set docpath /export/projop/web/data-model/Functions
set c 0
foreach docpage [glob "$docpath/*.html"] {
set f [open $docpage r]; set data [read $f]; close $f
dom parse -html $data doc
$doc documentElement root
set content ""
foreach n [$root selectNodes //body/*] { append content [$n asHTML] \n }
set p [Page create page[incr c] \
-name en:[file tail $docpage] \
-title [[$root selectNodes //title] asText] \
-text [list $content text/html]]
puts [$p serialize]
}
}
doc_return 200 text/html OK
Here is what I get:
- The original script gave me an error. I had to move the "set docpath ..." into the "namespace eval" block.
- The first time I run I get the "OK", but nothing happens. The "page1" isn't there and the Xowiki Admin page shows the same number of pages.
- The 2nd time I run the script I get a error "::xowiki::require_folder: unable to dispatch method 'package_id' during '::xowiki::require_folder package_id'" when looking at the index page. The error is gone after restarting the server.
Btw., the Wiki isn't finished yet, but it starts to contain reasonable information on the structure of ]po[, packages, object types, categories etc. Have a look at: http://www.project-open.org/documentation/. Contents are licensed as Creative Commons.
Cheers!
Frank