xo::Package instproc require_root_folder (public)

 <instance of xo::Package[i]> require_root_folder \
    [ -parent_id parent_id ] [ -content_types content_types ] \
    -name name 

Defined in /var/www/openacs.org/packages/xotcl-core/tcl/06-package-procs.tcl

Make sure, the root folder for the given package exists. If not, create it and register all allowed content types. Note that xowiki (and derived packages) define their own version of "require_root_folder" based on form pages. Therefore, this function is just for packages not based on xowiki.

Switches:
-parent_id (optional, defaults to "-100")
-content_types (optional)
-name (required)
Returns:
folder_id

Testcases:
xowiki_test_cases
Source code:
set folder_id [::xo::xotcl_package_cache eval root_folder-${:id} {

  set folder_id [::xo::db::CrClass lookup -name $name -parent_id $parent_id]
  if {$folder_id == 0} {
    :log "folder with name '$name' and parent $parent_id does NOT EXIST"
    set folder_id [::acs::dc call content_folder new  -name $name  -label ${:instance_name}  -parent_id $parent_id  -package_id ${:id}  -context_id ${:id}]
    :log "CREATED folder '$name' and parent $parent_id ==> $folder_id"
  }

  # Register all specified content types
  ::xo::db::CrFolder register_content_types  -folder_id $folder_id  -content_types $content_types
  #:log "returning from cache folder_id $folder_id"
  return $folder_id
}]
#:log "returning from require folder_id $folder_id"
return $folder_id
XQL Not present:
Generic, PostgreSQL, Oracle
[ hide source ] | [ make this the default ]
Show another procedure: