Home
The Toolkit for Online Communities
15899 Community Members, 0 members online, 2380 visitors today
Log In Register

content-item-procs.tcl

OpenACS Home : ACS API Browser : ACS Content Repository 5.5.1 : content-item-procs.tcl
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.21 2008/12/17 19:35:26 gustafn Exp $

Procedures in this file

Detailed information

content::item::content_type (public)

content::item::content_type -item_id item_id

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
 

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
 

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.
 

content::item::get (public)

content::item::get -item_id item_id [ -revision revision ] \
    [ -array_name array_name ]

Switches:
-item_id (required)
-revision (defaults to "live") (optional)
live, latest, or best (live if it exists, otherwise latest)
-array_name (defaults to "content_item") (optional)
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 sucessful
Error:
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2004-05-28
 

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:
 

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
 

content::item::get_context (public)

content::item::get_context -item_id item_id

Switches:
-item_id (required)
Returns:
NUMBER(38)
 

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
 

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 a 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
 

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:
 

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:
 

content::item::get_parent_folder (public)

content::item::get_parent_folder -item_id item_id

Switches:
-item_id (required)
Returns:
NUMBER(38)
 

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
 

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
 

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:
 

content::item::get_revision_count (public)

content::item::get_revision_count -item_id item_id

Switches:
-item_id (required)
Returns:
NUMBER
 

content::item::get_root_folder (public)

content::item::get_root_folder [ -item_id item_id ]

Switches:
-item_id (optional)
Returns:
NUMBER(38)
 

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)
Returns:
The template_id of the template which can be used to render the item, or an empty string on failure
 

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)
Returns:
The title of the item

See Also:
 

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
 

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
 

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:
 

content::item::is_published (public)

content::item::is_published -item_id item_id

Switches:
-item_id (required)
Returns:
CHAR
 

content::item::is_subclass (public)

content::item::is_subclass -object_type object_type \
    -supertype supertype

Switches:
-object_type (required)
-supertype (required)
Returns:
CHAR
 

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
 

content::item::move (public)

content::item::move -item_id item_id \
    -target_folder_id target_folder_id [ -name name ]

Switches:
-item_id (required)
item to move
-target_folder_id (required)
-name (optional)
new name, allows move with rename
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2004-05-28
 

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 ]

Switches:
-name (required)
-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 (defaults to "content_item") (optional)
-content_type (defaults to "content_revision") (optional)
- 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)
-storage_type (defaults to "file") (optional)
- file, lob, or text (postgresql only)
-attributes (optional)
- A list of lists ofpairs 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 tmp file
Returns:
item_id of the new content item
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2004-05-28 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 procdedure uses package_instantiate object. Under PostgreSQL the object_type new function must be registered with define_function_args.

See Also:
  • content::symlink::new content::extlink::new content::folder::new
 

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)
 

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 (defaults to "cr_item_rel") (optional)
Returns:
NUMBER(38)
 

content::item::rename (public)

content::item::rename -item_id item_id -name name

Switches:
-item_id (required)
-name (required)
Author:
Dave Bauer <dave@thedesignexperience.org>
Created:
2004-05-28 Rename a 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 (defaults to "ready") (optional)
 

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)
 

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)
 

content::item::unrelate (public)

content::item::unrelate -rel_id rel_id

Switches:
-rel_id (required)
 

content::item::unset_live_revision (public)

content::item::unset_live_revision -item_id item_id

Switches:
-item_id (required)
 

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
 

content::item::upload_file (public)

content::item::upload_file -upload_file upload_file \
    -parent_id parent_id [ -package_id package_id ]
Store the file uploaded under the parent_id if a file was uploaded

Switches:
-upload_file (required)
-parent_id (required)
-package_id (optional)
Returns:
the revision_id of the generated item
Error:
Author:
Malte Sussdorff <sussdorff@sussdorff.de>
Created:
2005-06-21