Index: openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl,v diff -u -r1.9 -r1.10 --- openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 1 Jan 2007 11:12:58 -0000 1.9 +++ openacs-4/packages/xowiki/tcl/xowiki-callback-procs.tcl 5 Jan 2007 21:22:20 -0000 1.10 @@ -256,12 +256,23 @@ ad_proc update_views {} { update all automatic views of xowiki } { + set updates [db_list_of_lists get_xowiki_types \ "select object_type,\ content_type__refresh_view(object_type) from acs_object_types \ where object_type like '::xowiki::%' \ order by tree_sortkey "] + + catch {db_dml drop_live_revision_view "drop view xowiki_page_live_revision"} + ::xo::db::require view xowiki_page_live_revision \ + "select p.*, cr.*,ci.parent_id, ci.name, ci.locale, ci.live_revision, \ + ci.latest_revision, ci.publish_status, ci.content_type, ci.storage_type, \ + ci.storage_area_key, ci.tree_sortkey, ci.max_child_sortkey \ + from xowiki_page p, cr_items ci, cr_revisions cr \ + where p.page_id = ci.live_revision \ + and p.page_id = cr.revision_id \ + and ci.publish_status <> 'production'" } ad_proc add_ltree_order_column {} { Index: openacs-4/packages/xowiki/tcl/xowiki-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-procs.tcl,v diff -u -r1.67 -r1.68 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 5 Jan 2007 12:11:02 -0000 1.67 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 5 Jan 2007 21:22:20 -0000 1.68 @@ -420,19 +420,35 @@ set msg "processing objects: $objects

" set added 0 set replaced 0 + set updated 0 + array set excluded_var { + folder_id 1 package_id 1 absolute_links 1 lang_links 1 + publish_status 1 item_id 1 revision_id 1 last_modified 1 parent_id 1 + } foreach o $objects { $o set parent_id $folder_id $o set package_id $package_id $o set creation_user $user_id # page instances have references to page templates, add these first if {[$o istype ::xowiki::PageInstance]} continue - set item [CrItem lookup -name [$o set name] -parent_id $folder_id] - if {$item != 0 && $replace} { ;# we delete the original - ::Generic::CrItem delete -item_id $item - set item 0 - incr replaced + set item_id [CrItem lookup -name [$o set name] -parent_id $folder_id] + if {$item_id != 0} { + if {$replace} { ;# we delete the original + ::Generic::CrItem delete -item_id $item_id + set item_id 0 + incr replaced + } else { + ::Generic::CrItem instantiate -item_id $item_id + foreach var [$o info vars] { + if {![info exists excluded_var($var)]} { + $item_id set $var [$o set $var] + } + } + $item_id save + incr updated + } } - if {$item == 0} { + if {$item_id == 0} { $o save_new incr added } @@ -441,13 +457,24 @@ foreach o $objects { if {[$o istype ::xowiki::PageInstance]} { db_transaction { - set item [CrItem lookup -name [$o set name] -parent_id $folder_id] - if {$item != 0 && $replace} { ;# we delete the original - ::Generic::CrItem delete -item_id $item - set item 0 - incr replaced - } - if {$item == 0} { ;# the item does not exist -> update reference and save + set item_id [CrItem lookup -name [$o set name] -parent_id $folder_id] + if {$item_id != 0} { + if {$replace} { ;# we delete the original + ::Generic::CrItem delete -item_id $item_id + set item_id 0 + incr replaced + } else { + ::Generic::CrItem instantiate -item_id $item_id + foreach var [$o info vars] { + if {![info exists excluded_var($var)]} { + $item_id set $var [$o set $var] + } + } + $item_id save + incr updated + } + } + if {$item_id == 0} { ;# the item does not exist -> update reference and save set old_template_id [$o set page_template] set template [CrItem lookup \ -name [$old_template_id set name] \ @@ -460,7 +487,7 @@ } $o destroy } - append msg "$added objects inserted, $replaced objects replaced

" + append msg "$added objects newly inserted, $updated object updated, $replaced objects replaced

" } # @@ -583,9 +610,9 @@ if {[catch {set page_name [lindex $arg 0]} errMsg]} { #my log "--S arg='$arg'" # there is something syntactically wrong - return "$Error in '{{$arg}}' in [my set name]
\n\ + return "

$Error in '{{$arg}}' in [my set name]
\n\ Syntax: <name of portlet> {<argument list>}
\n - Invalid argument list: '$arg'; must be attribute value pairs (attribues with dashes)" + Invalid argument list: '$arg'; must be attribute value pairs (attribues with dashes)
" } # the include is either a portlet class, or a wiki page @@ -618,7 +645,7 @@ } return [$page render] } else { - return "

Error: includelet '$page_name' unknown

\n" + return "

Error: includelet '$page_name' unknown

\n" } } @@ -627,26 +654,26 @@ if {[regexp {^adp (.*)$} $arg _ adp]} { if {[catch {lindex $adp 0} errMsg]} { # there is something syntactically wrong - return "${ch}Error in '{{$arg}}' in [my set name]
\n\ + return "${ch}
Error in '{{$arg}}' in [my set name]
\n\ Syntax: adp <name of adp-file> {<argument list>}
\n - Invalid argument list: '$adp'; must be attribute value pairs (even number of elements)" + Invalid argument list: '$adp'; must be attribute value pairs (even number of elements)
" } set adp [string map {  " "} $adp] set adp_fn [lindex $adp 0] if {![string match "/*" $adp_fn]} {set adp_fn /packages/xowiki/www/$adp_fn} set adp_args [lindex $adp 1] if {[llength $adp_args] % 2 == 1} { - return "${ch}Error in '{{$arg}}'
\n\ + return "${ch}
Error in '{{$arg}}'
\n\ Syntax: adp <name of adp-file> {<argument list>}
\n - Invalid argument list: '$adp_args'; must be attribute value pairs (even number of elements)" + Invalid argument list: '$adp_args'; must be attribute value pairs (even number of elements)
" } lappend adp_args __including_page [self] set including_page_level [template::adp_level] if {[catch {set page [template::adp_include $adp_fn $adp_args]} errorMsg]} { # in case of error, reset the adp_level to the previous value set ::template::parse_level $including_page_level - return "${ch}Error during evaluation of '{{$arg}}' in [my set name]
\n\ - adp_include returned error message: $errorMsg
\n" + return "${ch}
Error during evaluation of '{{$arg}}' in [my set name]
\n\ + adp_include returned error message: $errorMsg
\n" } return $ch$page @@ -716,7 +743,7 @@ -folder_id $parent_id -package_id $package_id if {[catch {eval [self]::link configure $options} error]} { - return "${ch}Error during processing of options: $error
" + return "${ch}
Error during processing of options: $error
" } else { return $ch[[self]::link render] } @@ -786,7 +813,7 @@ if {[catch {set template_value [template::adp_eval template_code]} errmsg]} { set ::template::parse_level $my_parse_level #my log "--pl after adp_eval '[template::adp_level]' mpl=$my_parse_level" - return "Error in Page $name: $errmsg
$content

Possible values are$__template_variables__" + return "

Error in Page $name: $errmsg
$content

Possible values are$__template_variables__" } return $template_value } Index: openacs-4/packages/xowiki/www/admin/import.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/import.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/xowiki/www/admin/import.tcl 3 Jan 2007 23:13:40 -0000 1.7 +++ openacs-4/packages/xowiki/www/admin/import.tcl 5 Jan 2007 21:22:21 -0000 1.8 @@ -30,11 +30,12 @@ set f [open $upload_tmpfile]; set content [read $f]; close $f foreach o [::xowiki::Page allinstances] { $o destroy } - if {[catch {eval $content} error]} { + if {[catch {namespace eval ::xo::import $content} error]} { set msg "Error: $error" } else { - set msg [::xowiki::Page import -replace 1] + set msg [::xowiki::Page import -replace 0] } + namespace delete ::xo::import } Index: openacs-4/packages/xowiki/www/resources/xowiki.css =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/resources/xowiki.css,v diff -u -r1.8 -r1.9 --- openacs-4/packages/xowiki/www/resources/xowiki.css 29 Dec 2006 11:01:37 -0000 1.8 +++ openacs-4/packages/xowiki/www/resources/xowiki.css 5 Jan 2007 21:22:21 -0000 1.9 @@ -54,6 +54,8 @@ #page-body h3 {font-size: 14px} #page-body h4 {font-size: 12px; margin: 0;} #page-body .box {border: 1px solid #a1a5a9; padding: 0 5px 5px 5px; margin: 0 0 1.25em 0;} +#page-body .errorMsg {color: red; font-weight: bold;} + #content .box h2 {border-bottom: 1px solid #a1a5a9; padding: 5px; background: #f2f2f2; margin: 0 -5px 5px -5px; font-size: 12px;} #sidebar {float: right; top: 0px; width: 29%; font: 10px 'Lucida Grande', Geneva, Verdana, Arial, sans-serif;} #sidebar h2 {font-size: 12px; margin: 0;}