Index: openacs-4/packages/xotcl-core/tcl/generic-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/generic-procs.tcl,v diff -u -r1.27 -r1.28 --- openacs-4/packages/xotcl-core/tcl/generic-procs.tcl 18 Sep 2006 13:56:42 -0000 1.27 +++ openacs-4/packages/xotcl-core/tcl/generic-procs.tcl 23 Sep 2006 10:36:02 -0000 1.28 @@ -65,11 +65,11 @@ CrClass set common_query_atts { item_id revision_id creation_user creation_date last_modified object_type - creation_user last_modified package_id + creation_user last_modified } - #if {[apm_version_names_compare [ad_acs_version] 5.2] > -1} { - # CrClass lappend common_query_atts object_package_id - #} + if {[apm_version_names_compare [ad_acs_version] 5.2] > -1} { + CrClass lappend common_query_atts package_id + } CrClass set common_insert_atts {name title description mime_type nls_language text} @@ -325,20 +325,25 @@ lappend atts $fq } if {$revision_id} { - $object db_1row note_select "\ + $object db_1row fetch_from_view_revision_id "\ select [join $atts ,], i.parent_id \ from [my set table_name]i n, cr_items i,acs_objects o \ where n.revision_id = $revision_id \ and i.item_id = n.item_id \ and o.object_id = i.item_id" } else { - $object db_1row note_select "\ + $object db_1row fetch_from_view_item_id "\ select [join $atts ,], i.parent_id \ from [my set table_name]i n, cr_items i, acs_objects o \ where i.item_id = $item_id \ and n.[my id_column] = i.live_revision \ and o.object_id = i.item_id" } + + if {[apm_version_names_compare [ad_acs_version] 5.2] <= -1} { + $object set package_id [db_string get_pid "select package_id from cr_folders where folder_id = [$object set parent_id]"] + } + #my log "--AFTER FETCH\n[$object serialize]" $object initialize_loaded_object return $object @@ -625,6 +630,25 @@ return $item_id } + if {[apm_version_names_compare [ad_acs_version] 5.2] > -1} { + ns_log notice "--Version 5.2 or newer [ad_acs_version]" + CrItem set content_item__new { + select content_item__new(:name,$parent_id,null,null,null,\ + :creation_user,null,null,\ + 'content_item',:object_type,null,:description,:mime_type,\ + :nls_language,null,null,null,'f',:storage_type, :package_id) + } + } else { + ns_log notice "--Version 5.1 or older [ad_acs_version]" + CrItem set content_item__new { + select content_item__new(:name,$parent_id,null,null,null,\ + :creation_user,null,null,\ + 'content_item',:object_type,null,\ + :description,:mime_type,\ + :nls_language,null,:storage_type) + } + } + CrItem ad_instproc save_new {-package_id -creation_user_id} { Insert a new item to the content repository and make it the live revision. @@ -657,12 +681,9 @@ $__class instvar storage_type object_type $__class folder_type -folder_id $parent_id register db_dml lock_objects "LOCK TABLE acs_objects IN SHARE ROW EXCLUSIVE MODE" - set item_id [db_string insert_item "\ - select content_item__new(:name,$parent_id,null,null,null,\ - :creation_user,null,null,\ - 'content_item',:object_type,null,:description,:mime_type,\ - :nls_language,null,null,null,'f',:storage_type, $package_id)"] + set item_id [db_string insert_item \ + [subst [[self class] set content_item__new]]] set revision_id [db_nextval acs_object_id_seq] if {$storage_type eq "file"} { set text [cr_create_content_file $item_id $revision_id $import_file] 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.13 -r1.14 --- openacs-4/packages/xowiki/tcl/package-procs.tcl 17 Sep 2006 21:40:18 -0000 1.13 +++ openacs-4/packages/xowiki/tcl/package-procs.tcl 23 Sep 2006 10:39:05 -0000 1.14 @@ -16,9 +16,16 @@ } { #TODO can most probably further simplified set page [::Generic::CrItem instantiate -item_id $item_id -revision_id $revision_id] + #my log "--I instantiate i=$item_id revision_id=$revision_id page=$page" + $page folder_id [$page set parent_id] - set package_id [$page set package_id] + if {[apm_version_names_compare [ad_acs_version] 5.2] <= -1} { + set package_id [db_string get_pid "select package_id from cr_folders where folder_id = [$page $folder_id]"] + $page package_id $package_id + } else { + set package_id [$page set package_id] + } ::xowiki::Package initialize \ -package_id $package_id -user_id $user_id \ -parameter $parameter -init_url false -actual_query "" @@ -565,3 +572,6 @@ } + + + Index: openacs-4/packages/xowiki/tcl/template-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowiki/tcl/template-procs.tcl,v diff -u --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/xowiki/tcl/template-procs.tcl 23 Sep 2006 10:39:05 -0000 1.1 @@ -0,0 +1,53 @@ +### +### just for backward compatibility for oacs 5.1 -gustaf neumann +### + +if {[apm_version_names_compare [ad_acs_version] 5.2] <= -1} { + + +ad_proc -public ::template::adp_include { + {-uplevel 1} + src + varlist +} { + return a the output of a tcl/adp pair as a string. adp_level is + set to the calling procedure so that pass by reference works. + and example of using this is in the search indexer for various content + types: +
+    bookshelf::book::get -book_id $book_id -array bookdata
+    set body [template::adp_include /packages/bookshelf/lib/one-book \ 
+                  [list &book "bookdata" base $base style feed]]
+  
+ + The [list &book "bookdata" ...] tells adp_include to pass the book array by reference to the adp in +clude, where it is + refered to via @book.field@. + + @param uplevel how far up the stack should the adp_level be set to + (default is the calling procedures level) + @param src should be the path to the tcl/adp pair relative to the server root, as + with the src attribute to the include tag. + @param varlist a list of {key value key value ... } varlist can also be &var foo + for things passed by reference (arrays and multirows) + + @return the string generated by the tcl/adp pair. + + @author Jeff Davis davis@xarg.net + @creation-date 2004-06-02 + + @see template::adp_parse +} { + # set the stack frame at which the template is being parsed so that + # other procedures can reference variables cleanly + variable parse_level + lappend parse_level [expr [info level] - $uplevel] + + set __adp_out [template::adp_parse [template::util::url_to_file $src] $varlist] + + # pop off parse level + template::util::lpop parse_level + + return $__adp_out +} +} \ No newline at end of file