cr_write_content (public)
cr_write_content [ -string ] [ -item_id item_id ] \ [ -revision_id revision_id ]
Defined in packages/acs-content-repository/tcl/revision-procs.tcl
Write out the specified content to the current HTTP connection or return it to the caller by using the -string flag. Only one of item_id and revision_id should be passed to this procedure. If item_id is provided the item's live revision will be written, otherwise the specified revision. This routine was written to centralize the downloading of data from the content repository. Previously, similar code was scattered among various packages, not all of which were written to handle both in-database and in-filesystem storage of content items. Though this routine is written to be fully general in terms of a content item's storage type, typically those stored as text aren't simply dumped to the user in raw form, but rather ran through the templating system in order to surround the content with decorative HTML.
- Switches:
- -string (optional, boolean)
- specifies whether the content should be returned as a string or (the default) be written to the HTML connection (ola@polyxena.net)
- -item_id (optional)
- the item to write
- -revision_id (optional)
- revision to write
- Author:
- Don Baccus <dhogaza@pacifier.com>
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- content_revision
Source code: if { [info exists revision_id] && [info exists item_id] } { error "Both revision_id and item_id were specified" } if { [info exists item_id] } { if { ![db_0or1row get_item_info { select i.storage_type, i.storage_area_key, r.mime_type, r.revision_id, r.content, r.content_length from cr_items i, cr_revisions r where i.item_id = :item_id and r.revision_id = i.live_revision }] } { error "There is no content that matches item_id '$item_id'" {} NOT_FOUND } } elseif { [info exists revision_id] } { if { ![db_0or1row get_revision_info { select i.storage_type, i.storage_area_key, r.mime_type, i.item_id, r.content, r.content_length from cr_items i, cr_revisions r where r.revision_id = :revision_id and i.item_id = r.item_id }] } { error "There is no content that matches revision_id '$revision_id'" {} NOT_FOUND } } else { error "Either revision_id or item_id must be specified" } if { [info commands ::cr_write_content-$storage_type] eq "" } { error "Storage type '$storage_type' is invalid." } return [cr_write_content-$storage_type -string=$string_p -item_id $item_id -revision_id $revision_id -mime_type $mime_type -content $content -content_length $content_length -storage_area_key $storage_area_key]XQL Not present: Generic PostgreSQL XQL file: packages/acs-content-repository/tcl/revision-procs-postgresql.xql
Oracle XQL file: packages/acs-content-repository/tcl/revision-procs-oracle.xql