Index: openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl,v diff -u -r1.1 -r1.2 --- openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl 16 Jul 2003 04:52:32 -0000 1.1 +++ openacs-4/contrib/packages/classified-ads/tcl/classified-ads-init.tcl 23 Jul 2003 22:23:47 -0000 1.2 @@ -8,30 +8,43 @@ } -ns_log Notice "classified-ads-init: starting..." +ns_log Debug "classified-ads-init: starting..." -# are we installed? +# +# Are we installed? +# + if {[classified-ads::is_instantiated]} { + ns_log Debug "classified-ads-init: checking for root folder..." - ns_log Notice "classified-ads-init: checking for root folder..." set root_folder_id [classified-ads::root_folder_exists_p] + if {!$root_folder_id} { ns_log Error "Root Folder for classified ads not found. Datamodel probably not loaded." } else { - ns_log Notice "Root Folder for classified ads found." + ns_log Debug "Root Folder for classified ads found." + # # we have a root folder. let's now look for mounted instances of classified-ads and # check if they have folders. if they don't let's create it for them + # + set package_list [classified-ads::get_mounted_packages] + foreach package_id $package_list { set package_folder_id [classified-ads::get_folder_id -package_id $package_id] + if {!$package_folder_id} { - ns_log Notice "classified-ads-init: creating root folder for package $package_id..." + ns_log Debug "classified-ads-init: creating root folder for package $package_id..." set package_folder_id [classified-ads::create_package_folder -root_folder_id $root_folder_id \ -package_id $package_id \ ] } + + # # DEDS: FIXME - right now, the content types are hardcoded. This should not be the case. # We should also loop through acs_object_types and get all child types + # + if {$package_folder_id} { classified-ads::register_content_type -folder_id $package_folder_id -content_type ca_ad ns_log Notice "classified-ads-init: registering ca_ad for $package_folder_id" @@ -40,16 +53,16 @@ classified-ads::register_content_type -folder_id $package_folder_id -content_type ca_image ns_log Notice "classified-ads-init: registering ca_image for $package_folder_id" } - } } - ns_log Notice "classified-ads-init: checking for root keyword..." + ns_log Debug "classified-ads-init: checking for root keyword..." + if {![classified-ads::main_keyword_exists_p]} { ns_log Error "Root Keyword for classified ads not found. Datamodel probably not loaded." } else { - ns_log Notice "Root Keyword for classified ads found." + ns_log Debug "Root Keyword for classified ads found." } } -ns_log Notice "classified-ads-init: done" +ns_log Debug "classified-ads-init: done"