Index: openacs-4/packages/xotcl-core/xotcl-core.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/xotcl-core.info,v diff -u -r1.69 -r1.70 --- openacs-4/packages/xotcl-core/xotcl-core.info 28 Apr 2009 14:33:27 -0000 1.69 +++ openacs-4/packages/xotcl-core/xotcl-core.info 18 Sep 2009 12:00:38 -0000 1.70 @@ -10,10 +10,10 @@ t xotcl - + Gustaf Neumann XOTcl library functionality (e.g. thread handling, online documentation, Generic Form and List Classes) - 2009-04-28 + 2009-09-18 Gustaf Neumann, WU Wien This component contains some core functionality for OpenACS applications using XOTcl. It includes @@ -43,7 +43,7 @@ BSD-Style 0 - + Index: openacs-4/packages/xotcl-core/tcl/01-debug-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/01-debug-procs.tcl,v diff -u -r1.41 -r1.42 --- openacs-4/packages/xotcl-core/tcl/01-debug-procs.tcl 28 Apr 2009 14:33:27 -0000 1.41 +++ openacs-4/packages/xotcl-core/tcl/01-debug-procs.tcl 18 Sep 2009 12:00:38 -0000 1.42 @@ -168,8 +168,6 @@ ::xotcl::Object instproc ds msg { ds_comment "[self]: $msg, ([self callingclass]->[self callingproc] [my __timediff])" } - - ::xotcl::Object instproc debug msg { ns_log debug "[self] [self callingclass]->[self callingproc]: $msg" } @@ -183,6 +181,16 @@ } } } + +# quick debugging tool +proc ::! args { + ns_log notice "-- PROC [info level -1]" + ns_log notice "-- CALL $args" + set r [uplevel $args] + ns_log notice "-- EXIT $r" + return $r +} + ::xotcl::Object instproc qn query_name { set qn "dbqd.[my uplevel self class]-[my uplevel self proc].$query_name" return $qn Index: openacs-4/packages/xotcl-core/tcl/04-library-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/04-library-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/xotcl-core/tcl/04-library-procs.tcl 23 Apr 2009 10:14:51 -0000 1.2 +++ openacs-4/packages/xotcl-core/tcl/04-library-procs.tcl 18 Sep 2009 12:00:38 -0000 1.3 @@ -23,6 +23,9 @@ # # ::xo::library require filename # +# The library to be loaded must be defined with a +# ::xo::library doc {...} +# # Source files extending classes of the current file. # # When classes are defined in the current file and (some) of their methods @@ -42,7 +45,7 @@ #my log "--loaded nsv_set [self]-loaded [info script] 1" } - library ad_proc require {filename} { + library ad_proc require {{-package ""} filename} { Use this method to indicate when some other files (from the same package) are needed to be sourced before the current file. This @@ -59,14 +62,18 @@ nsv_set [self]-loaded [info script] 1 set myfile [file tail [info script]] set dirname [file dirname [info script]] - set otherfile $dirname/$filename.tcl + if {$package eq ""} { + set otherfile $dirname/$filename.tcl + } else { + set otherfile [acs_root_dir]/packages/$package/tcl/$filename.tcl + } set vn [self] #my log "--exists otherfile $otherfile => [nsv_exists $vn $otherfile]" if {[nsv_exists $vn $otherfile]} { - nsv_set $vn $otherfile [lsort -unique [concat [nsv_get $vn $otherfile] $myfile]] + nsv_set $vn $otherfile [lsort -unique [concat [nsv_get $vn $otherfile] [info script]]] #my log "--setting nsv_set $vn $otherfile [lsort -unique [concat [nsv_get $vn $otherfile] $myfile]]" } else { - nsv_set $vn $otherfile $myfile + nsv_set $vn $otherfile [info script] #my log "--setting nsv_set $vn $otherfile $myfile" } #my log "--source when not loaded [self]-loaded $otherfile: [nsv_exists [self]-loaded $otherfile]" @@ -96,8 +103,10 @@ #my log "--check nsv_exists $vn $dirname/$myfile [nsv_exists $vn $dirname/$myfile]" if {[nsv_exists $vn $dirname/$myfile]} { foreach file [nsv_get $vn $dirname/$myfile] { - my log "--sourcing dependent $dirname/$file" - apm_source $dirname/$file + #my log "--sourcing dependent $dirname/$file" + #apm_source $dirname/$file + #my log "--sourcing dependent $file" + apm_source $file } } } Index: openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl,v diff -u -r1.81 -r1.82 --- openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 28 Apr 2009 14:33:27 -0000 1.81 +++ openacs-4/packages/xotcl-core/tcl/05-db-procs.tcl 18 Sep 2009 12:00:38 -0000 1.82 @@ -918,17 +918,19 @@ } # Standard mapping rules switch -glob -- $name { - ::xo::db::Object {return acs_object} - ::xo::db::CrItem {return content_revision} - ::xo::db::* {return [string range $name 10 end]} - default {return $name} + ::xo::db::Object {return acs_object} + ::xo::db::CrItem {return content_revision} + ::xo::db::CrFolder {return content_folder} + ::xo::db::* {return [string range $name 10 end]} + default {return $name} } } ::xo::db::Class proc object_type_to_class {name} { switch -glob -- $name { acs_object {return ::xo::db::Object} content_revision {return ::xo::db::CrItem} + content_folder {return ::xo::db::CrFolder} ::* {return $name} default {return ::xo::db::$name} } @@ -1669,19 +1671,25 @@ my instvar name column_name datatype pretty_name domain set object_type [$domain object_type] + if {$object_type eq "content_folder"} { + # content_folder does NOT allow to use create_attribute etc. + return + } + + my log "check attribute $column_name ot=$object_type, domain=$domain" if {[db_string dbqd..check_att {select 0 from acs_attributes where attribute_name = :column_name and object_type = :object_type} -default 1]} { - + if {![::xo::db::Class object_type_exists_in_db -object_type $object_type]} { - $domain create_object_type + $domain create_object_type } - + ::xo::db::sql::content_type create_attribute \ - -content_type $object_type \ - -attribute_name $column_name \ - -datatype $datatype \ - -pretty_name $pretty_name \ - -column_spec [my column_spec] + -content_type $object_type \ + -attribute_name $column_name \ + -datatype $datatype \ + -pretty_name $pretty_name \ + -column_spec [my column_spec] } } Index: openacs-4/packages/xotcl-core/tcl/cr-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xotcl-core/tcl/cr-procs.tcl,v diff -u -r1.31 -r1.32 --- openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 27 Apr 2009 20:31:34 -0000 1.31 +++ openacs-4/packages/xotcl-core/tcl/cr-procs.tcl 18 Sep 2009 12:00:38 -0000 1.32 @@ -1,4 +1,4 @@ -ad_library { +::xo::library doc { XOTcl for the Content Repository @author Gustaf Neumann @@ -266,7 +266,6 @@ -id_column $id_column \ -name_method $name_method - #my create_attributes my folder_type register } } @@ -1250,6 +1249,30 @@ return $allowed } + ::xo::db::CrClass create ::xo::db::CrFolder \ + -superclass ::xo::db::CrItem \ + -pretty_name "Folder" -pretty_plural "Folders" \ + -table_name "cr_folders" -id_column "folder_id" \ + -object_type content_folder \ + -form CrFolderForm \ + -edit_form CrFolderForm \ + -slots { + ::xo::db::CrAttribute create folder_id -datatype integer -pretty_name "Folder ID" \ + -references "cr_items on delete cascade" + ::xo::db::CrAttribute create label -datatype text -pretty_name "Label" + ::xo::db::CrAttribute create description \ + -datatype text -pretty_name "Description" -spec "textarea,cols=80,rows=2" + # the package_id in folders is deprecated, the one in acs_objects should be used + } \ +\ + -ad_doc { + This is a generic class that represents a "cr_folder" + XoWiki specific methods are currently directly mixed + into all instances of this class. + + @see ::xowiki::Folder + } + # # Caching interface # @@ -1377,7 +1400,7 @@ CrItem instmixin CrCache::Item } +#::xo::library source_dependent -