- Publicity: Public Only All
content-item-procs.tcl
Tcl API for cr_items in the content repository
- Location:
- packages/acs-content-repository/tcl/content-item-procs.tcl
- Created:
- 2004-05-28
- Authors:
- Dave Bauer <dave@thedesignexperience.org>
- Jun Yamog
- CVS Identification:
$Id: content-item-procs.tcl,v 1.38.2.12 2023/10/30 14:46:58 antoniop Exp $
Procedures in this file
- content::item::content_is_null (public)
- content::item::content_methods_by_type (public)
- content::item::content_type (public, deprecated)
- content::item::copy (public)
- content::item::delete (public)
- content::item::get (public)
- content::item::get_best_revision (public)
- content::item::get_content (public)
- content::item::get_content_type (public)
- content::item::get_context (public, deprecated)
- content::item::get_descendants (public)
- content::item::get_id (public)
- content::item::get_id_by_name (public)
- content::item::get_latest_revision (public)
- content::item::get_live_revision (public)
- content::item::get_parent_folder (public)
- content::item::get_path (public)
- content::item::get_publish_date (public)
- content::item::get_publish_status (public)
- content::item::get_revision_content (public)
- content::item::get_revision_count (public)
- content::item::get_root_folder (public)
- content::item::get_template (public)
- content::item::get_title (public)
- content::item::get_virtual_path (public)
- content::item::is_index_page (public)
- content::item::is_publishable (public)
- content::item::is_published (public)
- content::item::is_subclass (public)
- content::item::is_valid_child (public)
- content::item::move (public)
- content::item::new (public)
- content::item::publish (public)
- content::item::register_template (public)
- content::item::relate (public)
- content::item::rename (public)
- content::item::set_live_revision (public)
- content::item::set_release_period (public)
- content::item::unpublish (public)
- content::item::unregister_template (public)
- content::item::unrelate (public)
- content::item::unset_live_revision (public)
- content::item::update (public)
- content::item::upload_file (public)
Detailed information
content::item::content_is_null (public)
content::item::content_is_null revision_id
Determines if the content for the revision is null (not mereley zero-length)
- Parameters:
- revision_id (required)
- The revision id
- Returns:
- 1 if the content is null, 0 otherwise
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::item::content_methods_by_type (public)
content::item::content_methods_by_type [ -get_labels ] content_type
Determines all the valid content methods for instantiating a content type. Possible choices are text_entry, file_upload, no_content and xml_import. Currently, this proc merely removes the text_entry method if the item does not have a text mime type registered to it. In the future, a more sophisticated mechanism will be implemented.
- Switches:
- -get_labels (optional, boolean)
- Return not just a list of types, but a list of name-value pairs, as in the -options ATS switch for form widgets
- Parameters:
- content_type (required)
- The content type
- Returns:
- A Tcl list of all possible content methods
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::content_type (public, deprecated)
content::item::content_type -item_id item_id
Deprecated. Invoking this procedure generates a warning.
- Switches:
- -item_id (required)
- The item_id of the content item
- Returns:
- The content type of the item, or an empty string if no such item exists
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::copy (public)
content::item::copy -item_id item_id \ -target_folder_id target_folder_id \ [ -creation_user creation_user ] [ -creation_ip creation_ip ] \ [ -name name ]
- Switches:
- -item_id (required)
- - item_id of the content to be copied from. source content item
- -target_folder_id (required)
- - destination folder where the new content item is be passed
- -creation_user (optional)
- -
- -creation_ip (optional)
- -
- -name (optional)
- - the name of the new item, useful if you are copying in the same folder.
- Returns:
- item_id of the new copied item
- Author:
- Jun Yamog
- Created:
- 2004-06-27 copy a content item to a new content item
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::item::delete (public)
content::item::delete -item_id item_id
- Switches:
- -item_id (required)
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-28 Delete a content item from the database. If the content item to delete has children content items referencing its parent via acs_objects.context_id then this proc will fail.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_image, content_item, content_revision
content::item::get (public)
content::item::get -item_id item_id [ -revision revision ] \ [ -array_name array_name ]
Get an item.
- Switches:
- -item_id (required)
- -revision (optional, defaults to
"live"
)- live, latest
- -array_name (optional, defaults to
"content_item"
)- name of array to upvar content into
- Returns:
- upvars array_name containing all attributes of the content type except content
returns 0 if item does not exists or 1 if query was successful- Error:
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-28
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_folder, content_item
content::item::get_best_revision (public)
content::item::get_best_revision -item_id item_id
Attempts to retrieve the live revision for the item. If no live revision exists, attempts to retrieve the latest revision. If the item has no revisions, returns an empty string.
- Switches:
- -item_id (required)
- The item_id of the content item
- Returns:
- The best revision_id for the item, or an empty string if no revisions exist
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- cr_item_search_triggers
content::item::get_content (public)
content::item::get_content [ -revision_id revision_id ] \ [ -item_id item_id ] -array array
Create a onerow datasource called content in the calling frame which contains all attributes for the revision (including inherited ones).
The datasource will contain a column called "text", representing the main content (blob) of the revision, but only if the revision has a textual mime-type.
- Switches:
- -revision_id (optional)
- The revision whose attributes are to be retrieved
- -item_id (optional)
- The item_id of the corresponding item. You can provide this as an optimization. If you don't provide revision_id, you must provide item_id, and the item must have a live revision.
- -array (required)
- Returns:
- 1 on success (and set the array in the calling frame), 0 on failure
- See Also:
- proc content::item::get_content_type
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_image, content_item_nested_structure, content_revision
content::item::get_content_type (public)
content::item::get_content_type -item_id item_id
Retrieves the content type of the item. If the item does not exist, returns an empty string.
- Switches:
- -item_id (required)
- The item_id of the content item
- Returns:
- The content type of the item, or an empty string if no such item exists
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::item::get_context (public, deprecated)
content::item::get_context -item_id item_id
Deprecated. Invoking this procedure generates a warning.
- Switches:
- -item_id (required)
- Returns:
- NUMBER(38)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::get_descendants (public)
content::item::get_descendants -parent_id parent_id [ -depth depth ]
Returns the ids of every content item that is descendant of supplied parent_id.
- Switches:
- -parent_id (required)
- -depth (optional)
- how deep we should go in the hierarchy. 1 means direct children. Returns every descendant when not specified.
- Returns:
- list of cr_items.item_id
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::get_id (public)
content::item::get_id -item_path item_path \ [ -root_folder_id root_folder_id ] \ [ -resolve_index resolve_index ]
Looks up the item_path starting with the root folder and returns item_id for that content item or empty, if none exists
- Switches:
- -item_path (required)
- -root_folder_id (optional)
- -resolve_index (optional)
- Returns:
- The item_id of the found item, or the empty string on failure
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- image_new, content_item, cr_item_search_triggers
content::item::get_id_by_name (public)
content::item::get_id_by_name -name name -parent_id parent_id
Returns The item_id of the content item with the passed in name
- Switches:
- -name (required)
- Name of the content item
- -parent_id (required)
- Parent_id of the content item
- Returns:
- The item_id belonging to the name, empty string if no item_id was found
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- cr_item_search_triggers, fs_add_file_to_folder
content::item::get_latest_revision (public)
content::item::get_latest_revision -item_id item_id
Retrieves the latest revision for the item. If the item has no live revision, returns an empty string.
- Switches:
- -item_id (required)
- The item_id of the content item
- Returns:
- The latest revision_id for the item, or an empty string if no revisions exist
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item, cr_item_search_triggers
content::item::get_live_revision (public)
content::item::get_live_revision -item_id item_id
Retrieves the live revision for the item. If the item has no live revision, returns an empty string.
- Switches:
- -item_id (required)
- The item_id of the content item
- Returns:
- The live revision_id for the item, or an empty string if no live revision exists
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- cr_item_search_triggers
content::item::get_parent_folder (public)
content::item::get_parent_folder -item_id item_id
- Switches:
- -item_id (required)
- Returns:
- NUMBER(38)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- cr_item_search_triggers
content::item::get_path (public)
content::item::get_path -item_id item_id \ [ -root_folder_id root_folder_id ]
- Switches:
- -item_id (required)
- -root_folder_id (optional)
- Returns:
- VARCHAR2
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::get_publish_date (public)
content::item::get_publish_date -item_id item_id [ -is_live is_live ]
- Switches:
- -item_id (required)
- -is_live (optional)
- Returns:
- DATE
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::get_publish_status (public)
content::item::get_publish_status -item_id item_id
Get the publish status of the item. The publish status will be one of the following:
- production - The item is still in production. The workflow (if any) is not finished, and the item has no live revision.
- ready - The item is ready for publishing
- live - The item has been published
- expired - The item has been published in the past, but its publication has expired
- Switches:
- -item_id (required)
- The item_id of the content item
- Returns:
- The publish status of the item, or the empty string on failure
- See Also:
- proc content::item::is_publishable
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::get_revision_content (public)
content::item::get_revision_content -revision_id revision_id \ [ -item_id item_id ]
Create a one-row datasource called content in the calling frame which contains all attributes for the revision (including inherited ones). The datasource will contain a column called "text", representing the main content (blob) of the revision, but only if the revision has a textual mime-type.
- Switches:
- -revision_id (required)
- The revision whose attributes are to be retrieved
- -item_id (optional)
- The item_id of the corresponding item.
- Returns:
- 1 on success (and create a content array in the calling frame), 0 on failure
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::get_revision_count (public)
content::item::get_revision_count -item_id item_id
- Switches:
- -item_id (required)
- Returns:
- NUMBER
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_revision
content::item::get_root_folder (public)
content::item::get_root_folder [ -item_id item_id ]
- Switches:
- -item_id (optional)
- Returns:
- NUMBER(38)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item, content_item_nested_structure
content::item::get_template (public)
content::item::get_template -item_id item_id -use_context use_context
Retrieves the template which can be used to render the item. If there is a template registered directly to the item, returns the id of that template. Otherwise, returns the id of the default template registered to the item's content_type. Returns an empty string on failure.
- Switches:
- -item_id (required)
- The item_id
- -use_context (required)
- The context in which the template will be used (e.g. public)
- Returns:
- The template_id of the template which can be used to render the item, or an empty string on failure
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::get_title (public)
content::item::get_title -item_id item_id [ -is_live is_live ]
Get the title for the item. If a live revision for the item exists, use the live revision. Otherwise, use the latest revision.
- Switches:
- -item_id (required)
- The item_id of the content item
- -is_live (optional, defaults to
"f"
)- If true, return the title of the live revision, otherwise the one of the latest revision (default). Boolean, 't' or 'f'.
- Returns:
- The title of the item
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::get_virtual_path (public)
content::item::get_virtual_path -item_id item_id \ [ -root_folder_id root_folder_id ]
Retrieves the relative path to the item. The path is relative to the page root, and has no extension (Example: "/foo/bar/baz").
- Switches:
- -item_id (required)
- The item_id for the item, for which the path is computed
- -root_folder_id (optional)
- Starts path resolution from this folder. Defaults to the root of the sitemap (when null).
- Returns:
- The path to the item, or an empty string on failure
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::is_index_page (public)
content::item::is_index_page -item_id item_id -folder_id folder_id
- Switches:
- -item_id (required)
- -folder_id (required)
- Returns:
- VARCHAR2
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::is_publishable (public)
content::item::is_publishable -item_id item_id
Determine if the item is publishable. The item is publishable only if:
- All child relations, as well as item relations, are satisfied (according to min_n and max_n)
- The workflow (if any) for the item is finished
- Switches:
- -item_id (required)
- The item_id of the content item
- Returns:
- 't' if the item is publishable, 'f' otherwise
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::is_published (public)
content::item::is_published -item_id item_id
- Switches:
- -item_id (required)
- Returns:
- CHAR
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::is_subclass (public)
content::item::is_subclass -object_type object_type \ -supertype supertype
- Switches:
- -object_type (required)
- -supertype (required)
- Returns:
- CHAR
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- attachments_name_api
content::item::is_valid_child (public)
content::item::is_valid_child -item_id item_id \ -content_type content_type [ -relation_tag relation_tag ]
- Switches:
- -item_id (required)
- -content_type (required)
- -relation_tag (optional)
- Returns:
- CHAR
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::move (public)
content::item::move -item_id item_id \ -target_folder_id target_folder_id [ -name name ]
Move an item to a folder.
- Switches:
- -item_id (required)
- item to move
- -target_folder_id (required)
- folder to move the item to
- -name (optional)
- new name, allows move with rename
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-28
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::new (public)
content::item::new -name name [ -parent_id parent_id ] \ [ -item_id item_id ] [ -locale locale ] \ [ -creation_date creation_date ] [ -creation_user creation_user ] \ [ -context_id context_id ] [ -package_id package_id ] \ [ -creation_ip creation_ip ] [ -item_subtype item_subtype ] \ [ -content_type content_type ] [ -title title ] \ [ -description description ] [ -mime_type mime_type ] \ [ -nls_language nls_language ] [ -text text ] [ -data data ] \ [ -relation_tag relation_tag ] [ -is_live is_live ] \ [ -storage_type storage_type ] [ -attributes attributes ] \ [ -tmp_filename tmp_filename ]
Create a new content item This proc creates versioned content items where content_type iscontent_revision or subtypes of content revision. There are procedures for each other base content item. This procedure uses package_instantiate object. Under PostgreSQL the object_type new function must be registered with define_function_args.
- Switches:
- -name (required)
- name of the item, must be unique for the folder
- -parent_id (optional)
- parent object of this content_item
- -item_id (optional)
- item_id of this content_item. If this is not specified an item_id will be generated automatically
- -locale (optional)
- -
- -creation_date (optional)
- defaults to current date and time
- -creation_user (optional)
- -
- -context_id (optional)
- Context of the item. usually used in conjunction with permissions.
- -package_id (optional)
- Package ID of the object
- -creation_ip (optional)
- -
- -item_subtype (optional, defaults to
"content_item"
)- -content_type (optional, defaults to
"content_revision"
)- content_revision or subtype of content_revision
- -title (optional)
- - title of content_revision to be created
- -description (optional)
- of content_revision to be created
- -mime_type (optional)
- -nls_language (optional)
- - ???
- -text (optional)
- - text of content revision to be created
- -data (optional)
- - ???
- -relation_tag (optional)
- -is_live (optional, defaults to
"f"
)- -storage_type (optional, defaults to
"file"
)- file, lob, or text (postgresql only)
- -attributes (optional)
- A list of lists of pairs of additional attributes and their values to pass to the constructor. Each pair is a list of two elements: key => value such as [list [list attribute value] [list attribute value]]
- -tmp_filename (optional)
- file containing content to be added to new revision. Caller is responsible to handle cleaning up the temporary file
- Returns:
- item_id of the new content item
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-28
- See Also:
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_image, content_item, content_item_nested_structure, content_revision, cr_item_search_triggers, data_links_update_links, data_links_update_links_with_tag, data_links_with_tag
content::item::publish (public)
content::item::publish -item_id item_id [ -revision_id revision_id ]
Publish a content item. Updates the live_revision and publish_date attributes, and sets publish_status to live.
- Switches:
- -item_id (required)
- The id of the content item
- -revision_id (optional)
- The id of the revision to publish. Defaults to the latest revision.
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::register_template (public)
content::item::register_template -item_id item_id \ -template_id template_id -use_context use_context
- Switches:
- -item_id (required)
- -template_id (required)
- -use_context (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::relate (public)
content::item::relate -item_id item_id -object_id object_id \ [ -relation_tag relation_tag ] [ -order_n order_n ] \ [ -relation_type relation_type ]
- Switches:
- -item_id (required)
- -object_id (required)
- -relation_tag (optional)
- -order_n (optional)
- -relation_type (optional, defaults to
"cr_item_rel"
)- Returns:
- NUMBER(38)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::rename (public)
content::item::rename -item_id item_id -name name
Rename an item.
- Switches:
- -item_id (required)
- -name (required)
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-05-28 Rename a content item.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item
content::item::set_live_revision (public)
content::item::set_live_revision -revision_id revision_id \ [ -publish_status publish_status ]
- Switches:
- -revision_id (required)
- -publish_status (optional, defaults to
"ready"
)- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- cr_item_search_triggers
content::item::set_release_period (public)
content::item::set_release_period -item_id item_id \ [ -start_when start_when ] [ -end_when end_when ]
- Switches:
- -item_id (required)
- -start_when (optional)
- -end_when (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::unpublish (public)
content::item::unpublish -item_id item_id \ [ -publish_status publish_status ]
Unpublish a content item.
- Switches:
- -item_id (required)
- The id of the content item
- -publish_status (optional, defaults to
"production"
)- The publish_status to put the item in after unpublishing it.
- Author:
- Peter Marklund
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item_nested_structure
content::item::unregister_template (public)
content::item::unregister_template -item_id item_id \ [ -template_id template_id ] [ -use_context use_context ]
- Switches:
- -item_id (required)
- -template_id (optional)
- -use_context (optional)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::unrelate (public)
content::item::unrelate -rel_id rel_id
- Switches:
- -rel_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
content::item::unset_live_revision (public)
content::item::unset_live_revision -item_id item_id
- Switches:
- -item_id (required)
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- cr_item_search_triggers
content::item::update (public)
content::item::update -item_id item_id -attributes attributes
Update standard non-versioned content item attributes (cr_items) Valid attributes: name parent_id latest_revision live_revision locale publish_status
- Switches:
- -item_id (required)
- item to update
- -attributes (required)
- A list of pairs of additional attributes and their values to get. Each pair is a list of two elements: key => value
- Returns:
- Error:
- Author:
- Dave Bauer <dave@thedesignexperience.org>
- Created:
- 2004-06-04
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_item, cr_item_search_triggers
content::item::upload_file (public)
content::item::upload_file -upload_file upload_file \ -parent_id parent_id [ -package_id package_id ] [ -title title ]
Store the file uploaded under the parent_id if a file was uploaded
- Switches:
- -upload_file (required)
- File to upload
- -parent_id (required)
- Parent ID
- -package_id (optional)
- -title (optional)
- Title of the uploaded file
- Returns:
- revision_id of the generated item
- Author:
- Malte Sussdorff <sussdorff@sussdorff.de>
- Created:
- 2005-06-21
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.