- Publicity: Public Only All
content-folder-procs.tcl
Tcl API for content_folders
- Location:
- packages/acs-content-repository/tcl/content-folder-procs.tcl
- Created:
- 2004-05-28
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- CVS Identification:
$Id: content-folder-procs.tcl,v 1.20.2.2 2020/08/25 14:54:20 antoniop Exp $
Procedures in this file
- content::folder::delete (public)
- content::folder::get_folder_from_package (public, deprecated)
- content::folder::get_folder_from_package_not_cached (public, deprecated)
- content::folder::get_index_page (public)
- content::folder::get_label (public)
- content::folder::is_empty (public)
- content::folder::is_folder (public)
- content::folder::is_registered (public)
- content::folder::is_root (public)
- content::folder::is_sub_folder (public)
- content::folder::new (public)
- content::folder::register_content_type (public)
- content::folder::unregister_content_type (public)
- content::folder::update (public)
Detailed information
content::folder::delete (public)
content::folder::delete -folder_id folder_id [ -cascade_p cascade_p ]
Delete a content folder
- Switches:
- -folder_id (required)
- item_id of the content_folder
- -cascade_p (optional, defaults to
"f"
)- if true delete all children, if false, return error if folder is nonempty
- Returns:
- Error:
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-28
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_image, content_item, content_revision
content::folder::get_folder_from_package (public, deprecated)
content::folder::get_folder_from_package -package_id package_id
Deprecated. Invoking this procedure generates a warning.
- Switches:
- -package_id (required)
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Created:
- 2005-01-06 Returns the folder_id of the package instance. Cached DEPRECATED: this proc assumes there will be just one folder for each package, which is not true in general!
- See Also:
- other packages as file-storage or xowiki define the concept of a root_folder. This is explicitly meant to be unique for each package. If your package can guarantee there will only be one folder per package, you should write your own api for it.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::folder::get_folder_from_package_not_cached (public, deprecated)
content::folder::get_folder_from_package_not_cached \ -package_id package_id
Deprecated. Invoking this procedure generates a warning.
- Switches:
- -package_id (required)
- Author:
- Timo Hentschel <timo@timohentschel.de>
- Created:
- 2005-01-06 Returns the folder_id of the package instance DEPRECATED: this proc assumes there will be just one folder for each package, which is not true in general!
- See Also:
- other packages as file-storage or xowiki define the concept of a root_folder. This is explicitly meant to be unique for each package. If your package can guarantee there will only be one folder per package, you should write your own api for it.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::folder::get_index_page (public)
content::folder::get_index_page -folder_id folder_id
- Switches:
- -folder_id (required)
- Returns:
- item_id of content item named "index" in folder_id
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::folder::get_label (public)
content::folder::get_label -folder_id folder_id
- Switches:
- -folder_id (required)
- Returns:
- label of cr_folder suitable for display
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::folder::is_empty (public)
content::folder::is_empty -folder_id folder_id
- Switches:
- -folder_id (required)
- Returns:
- t or f
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::folder::is_folder (public)
content::folder::is_folder -item_id item_id
- Switches:
- -item_id (required)
- Returns:
- t or f
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item, content_item_nested_structure
content::folder::is_registered (public)
content::folder::is_registered -folder_id folder_id \ -content_type content_type [ -include_subtypes include_subtypes ]
- Switches:
- -folder_id (required)
- -content_type (required)
- -include_subtypes (optional)
- Returns:
- t or f
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::folder::is_root (public)
content::folder::is_root -folder_id folder_id
- Switches:
- -folder_id (required)
- Returns:
- t or f
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::folder::is_sub_folder (public)
content::folder::is_sub_folder -folder_id folder_id \ -target_folder_id target_folder_id
- Switches:
- -folder_id (required)
- -target_folder_id (required)
- Returns:
- t of f
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_folder
content::folder::new (public)
content::folder::new -name name [ -folder_id folder_id ] \ [ -parent_id parent_id ] [ -content_type content_type ] \ [ -label label ] [ -description description ] \ [ -creation_user creation_user ] [ -creation_ip creation_ip ] \ [ -creation_date creation_date ] [ -context_id context_id ] \ [ -package_id package_id ]
- Switches:
- -name (required)
- -folder_id (optional)
- -parent_id (optional)
- -content_type (optional, defaults to
"content_folder"
)- -label (optional)
- -description (optional)
- -creation_user (optional)
- -creation_ip (optional)
- -creation_date (optional)
- -context_id (optional)
- -package_id (optional)
- Returns:
- Error:
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-28
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_folder, content_image, image_new, content_item, content_item_nested_structure, content_revision
content::folder::register_content_type (public)
content::folder::register_content_type -folder_id folder_id \ -content_type content_type [ -include_subtypes include_subtypes ]
Register an allowed content type for folder_id
- Switches:
- -folder_id (required)
- folder to register type to
- -content_type (required)
- content_revision or subtype of content_revision
- -include_subtypes (optional, defaults to
"f"
)- t or f
- Returns:
- Error:
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-29
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_extlink, content_folder, content_image, image_new, content_item, content_revision, fs_publish_file
content::folder::unregister_content_type (public)
content::folder::unregister_content_type -folder_id folder_id \ -content_type content_type [ -include_subtypes include_subtypes ]
Unregister an allowed content type for folder_id
- Switches:
- -folder_id (required)
- folder to unregister type from
- -content_type (required)
- content_revision or subtype of content_revision
- -include_subtypes (optional, defaults to
"f"
)- t or f
- Returns:
- Error:
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-06-04
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_image, content_revision
content::folder::update (public)
content::folder::update -folder_id folder_id -attributes attributes
Update standard cr_folder attributes, including the attributes for the folder cr_item
- Switches:
- -folder_id (required)
- folder to update
- -attributes (required)
- A list of pairs of additional attributes and their values to set. Each pair is a list of lists of two elements: key => value Valid attributes are: label, description, name, package_id
- Returns:
- Error:
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-06-04
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_folder
Content File Source
# ad_library { Tcl API for content_folders @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-05-28 @cvs-id $Id: content-folder-procs.tcl,v 1.20.2.2 2020/08/25 14:54:20 antoniop Exp $ } namespace eval ::content::folder {} d_proc -public ::content::folder::new { -name:required {-folder_id ""} {-parent_id ""} {-content_type "content_folder"} {-label ""} {-description ""} {-creation_user ""} {-creation_ip ""} -creation_date {-context_id ""} {-package_id ""} } { @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-05-28 @param folder_id @param name @param parent_id @param content_type @param label @param description @param creation_user @param creation_ip @param creation_date @param context_id @param package_id @return @error } { set var_list [list] foreach var [list folder_id name label description parent_id context_id package_id] { lappend var_list [list $var [set $var]] } if {[info exists creation_date] && $creation_date ne ""} { lappend var_list [list creation_date $creation_date] } set folder_id [package_instantiate_object \ -creation_user $creation_user \ -creation_ip $creation_ip \ -var_list $var_list \ $content_type] return $folder_id } d_proc -public ::content::folder::delete { -folder_id:required {-cascade_p "f"} } { Delete a content folder @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-05-28 @param folder_id item_id of the content_folder @param cascade_p if true delete all children, if false, return error if folder is nonempty @return @error } { return [package_exec_plsql \ -var_list [list \ [list folder_id $folder_id ] \ [list cascade_p $cascade_p] ] \ content_folder del] } d_proc -public ::content::folder::register_content_type { -folder_id:required -content_type:required {-include_subtypes "f"} } { Register an allowed content type for folder_id @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-05-29 @param folder_id folder to register type to @param content_type content_revision or subtype of content_revision @param include_subtypes t or f @return @error } { return [package_exec_plsql \ -var_list [list \ [list folder_id $folder_id] \ [list content_type $content_type] \ [list include_subtypes $include_subtypes]] \ content_folder register_content_type] } d_proc -public ::content::folder::unregister_content_type { -folder_id:required -content_type:required {-include_subtypes "f"} } { Unregister an allowed content type for folder_id @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-06-04 @param folder_id folder to unregister type from @param content_type content_revision or subtype of content_revision @param include_subtypes t or f @return @error } { return [package_exec_plsql \ -var_list [list \ [list folder_id $folder_id] \ [list content_type $content_type] \ [list include_subtypes $include_subtypes]] \ content_folder unregister_content_type] } d_proc -public ::content::folder::update { -folder_id:required -attributes:required } { Update standard cr_folder attributes, including the attributes for the folder cr_item @author Dave Bauer (dave@thedesignexperience.org) @creation-date 2004-06-04 @param folder_id folder to update @param attributes A list of pairs of additional attributes and their values to set. Each pair is a list of lists of two elements: key => value Valid attributes are: label, description, name, package_id @return @error } { set valid_attributes [list label description package_id] set update_text "" foreach {attribute_list} $attributes { lassign $attribute_list attribute value if {$attribute in $valid_attributes} { # create local variable to use for binding set $attribute $value if {$update_text ne ""} { append update_text "," } append update_text " ${attribute} = :${attribute} " } } if {$update_text ne ""} { # we have valid attributes, update them set query_text "update cr_folders set ${update_text} where folder_id=:folder_id" db_dml item_update $query_text } # pass the rest of the attributes to content::item::update # we can just send the folder attributes because they don't overlap content::item::update \ -item_id $folder_id \ -attributes $attributes } d_proc -public content::folder::get_index_page { -folder_id:required } { @param folder_id @return item_id of content item named "index" in folder_id } { return [package_exec_plsql \ -var_list [list [list \ folder_id $folder_id \ ]] \ content_folder get_index_page] } d_proc -public content::folder::get_label { -folder_id:required } { @param folder_id @return label of cr_folder suitable for display } { return [package_exec_plsql \ -var_list [list \ [list folder_id $folder_id] \ ] \ content_folder get_label] } d_proc -public content::folder::is_empty { -folder_id:required } { @param folder_id @return t or f } { return [package_exec_plsql \ -var_list [list \ [list folder_id $folder_id ] \ ] \ content_folder is_empty] } d_proc -public content::folder::is_folder { -item_id:required } { @param item_id @return t or f } { return [package_exec_plsql -var_list [list \ [list item_id $item_id] \ ] content_folder is_folder] } d_proc -public content::folder::is_registered { -folder_id:required -content_type:required {-include_subtypes ""} } { @param folder_id @param content_type @param include_subtypes @return t or f } { return [package_exec_plsql \ -var_list [list \ [list folder_id $folder_id] \ [list content_type $content_type] \ [list include_subtypes $include_subtypes] \ ] \ content_folder is_registered] } d_proc -public content::folder::is_root { -folder_id:required } { @param folder_id @return t or f } { return [package_exec_plsql -var_list [list \ [list folder_id $folder_id] \ ] content_folder is_root] } d_proc -public content::folder::is_sub_folder { -folder_id:required -target_folder_id:required } { @param folder_id @param target_folder_id @return t of f } { return [package_exec_plsql \ -var_list [list \ [list folder_id $folder_id] \ [list target_folder_id $target_folder_id] \ ] \ content_folder is_sub_folder] } d_proc -deprecated content::folder::get_folder_from_package { -package_id:required } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-06 Returns the folder_id of the package instance. Cached DEPRECATED: this proc assumes there will be just one folder for each package, which is not true in general! @see other packages as file-storage or xowiki define the concept of a root_folder. This is explicitly meant to be unique for each package. If your package can guarantee there will only be one folder per package, you should write your own api for it. } { return [util_memoize [list content::folder::get_folder_from_package_not_cached -package_id $package_id]] } d_proc -deprecated content::folder::get_folder_from_package_not_cached { -package_id:required } { @author Timo Hentschel (timo@timohentschel.de) @creation-date 2005-01-06 Returns the folder_id of the package instance DEPRECATED: this proc assumes there will be just one folder for each package, which is not true in general! @see other packages as file-storage or xowiki define the concept of a root_folder. This is explicitly meant to be unique for each package. If your package can guarantee there will only be one folder per package, you should write your own api for it. } { return [db_string get_folder_id { select folder_id from cr_folders where package_id = :package_id }] } # Local variables: # mode: tcl # tcl-indent-level: 4 # indent-tabs-mode: nil # End: