Index: openacs-4/packages/xowiki/tcl/package-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/package-procs.tcl,v diff -u -r1.39 -r1.40 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 25 Feb 2007 09:57:09 -0000 1.39 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 1 Mar 2007 10:25:10 -0000 1.40 @@ -496,7 +496,7 @@ ############################################################### # - # user callable methods + # user callable methods on package level # Package ad_instproc reindex {} { @@ -529,14 +529,9 @@ 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 + $o demarshall -parent_id $folder_id -package_id $package_id -creation_user $user_id # page instances have references to page templates, add these first if {[$o istype ::xowiki::PageInstance]} continue set item_id [CrItem lookup -name [$o set name] -parent_id $folder_id] @@ -547,11 +542,7 @@ 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 copy_content_vars -from_object $o $item_id save incr updated } @@ -573,11 +564,7 @@ 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 copy_content_vars -from_object $o $item_id save incr updated } Index: openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl,v diff -u -r1.32 -r1.33 --- openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 27 Feb 2007 21:13:01 -0000 1.32 +++ openacs-4/packages/xowiki/tcl/xowiki-form-procs.tcl 1 Mar 2007 10:25:10 -0000 1.33 @@ -121,12 +121,11 @@ # # this should be OO-ified -gustaf proc ::xowiki::validate_file {} { - #my log "--F validate_file data=[my exists data]" my instvar data my get_uploaded_file - #my log "--F validate_file returns [$data exists import_file]" upvar title title if {$title eq ""} {set title [$data set upload_file]} + #my log "--F validate_file returns [$data set mime_type] data=[my exists data]" return [$data exists import_file] } @@ -148,9 +147,7 @@ my instvar data my log "--F validate_name ot=$object_type data=[my exists data]" $data instvar package_id - if {[lsearch [$object_type info heritage] ::xowiki::File] > -1 && [$data exists mime_type]} { - - #my get_uploaded_file + if {[$data istype ::xowiki::File] && [$data exists mime_type]} { #my log "--mime validate_name ot=$object_type data=[my exists data] MIME [$data set mime_type]" set mime [$data set mime_type] set fn [$data set upload_file] 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.79 -r1.80 --- openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 27 Feb 2007 21:13:01 -0000 1.79 +++ openacs-4/packages/xowiki/tcl/xowiki-procs.tcl 1 Mar 2007 10:25:10 -0000 1.80 @@ -231,6 +231,56 @@ return $sql } + # + # Page marshall/demarshall + # + + + Page instproc marshall {} { + return [my serialize] + } + + File instproc marshall {} { + set fn [my full_file_name] + set F [open $fn] + fconfigure $F -translation binary + set C [read $F] + close $F + my set __file_content [::base64::encode $C] + next + } + + Page instproc demarshall {-parent_id -package_id -creation_user} { + # this method is the counterpart of marshall + my set parent_id $parent_id + my set package_id $package_id + my set creation_user $creation_user + # in the general case, no actions required + } + + File instproc demarshall {args} { + next + # we have to care about recoding the file content + my instvar import_file __file_content + set import_file [ns_tmpnam] + set F [open $import_file w] + fconfigure $F -translation binary + puts -nonewline $F [::base64::decode $__file_content] + close $F + } + + Page instproc copy_content_vars {-from_object:required} { + 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 var [$from_object info vars] { + if {![info exists excluded_var($var)]} { + my set $var [$from_object set $var] + } + } + } + Page proc import {-user_id -package_id -folder_id {-replace 0} -objects} { my log "DEPRECATED" if {![info exists package_id]} {set package_id [::xo::cc package_id]} Index: openacs-4/packages/xowiki/www/admin/export.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/www/admin/export.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/xowiki/www/admin/export.tcl 17 Aug 2006 01:44:26 -0000 1.3 +++ openacs-4/packages/xowiki/www/admin/export.tcl 1 Mar 2007 10:25:10 -0000 1.4 @@ -18,7 +18,7 @@ db_foreach instance_select $sql { ::Generic::CrItem instantiate -item_id $item_id $item_id volatile - append content [::Serializer deepSerialize $item_id] \n + append content [$item_id marshall] \n } ns_return 200 text/plain $content \ No newline at end of file